summaryrefslogtreecommitdiff
path: root/gtk/gtktooltip.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@imendio.com>2008-07-02 09:32:14 +0000
committerKristian Rietveld <kristian@src.gnome.org>2008-07-02 09:32:14 +0000
commit4cceb2f1dcfcd939238d7a5e1caa0bab334c4d42 (patch)
treeb05b43c007f90a85b9a2a7b56969b9165900851e /gtk/gtktooltip.c
parente625b41a1d7535f5fb92f49ca780bebc6a414393 (diff)
downloadgtk+-4cceb2f1dcfcd939238d7a5e1caa0bab334c4d42.tar.gz
Bug 455268 - Add gtk-enable-tooltips GtkSetting
2008-07-02 Kristian Rietveld <kris@imendio.com> Bug 455268 - Add gtk-enable-tooltips GtkSetting * gtk/gtk.symbols: * gtk/gtktoolbar.[ch] (gtk_toolbar_[gs]et_tooltips): deprecated. * gtk/gtksettings.c: introduce gtk-enable-tooltips XSetting. * gtk/gtktooltip.c (_gtk_tooltip_handle_event): take the newly introduced XSetting into account. * demos/gtk-demo/appwindow.c: don't use the now deprecated gtk_toolbar_set_tooltips(). svn path=/trunk/; revision=20730
Diffstat (limited to 'gtk/gtktooltip.c')
-rw-r--r--gtk/gtktooltip.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 5b55b1adeb..4e12c2948b 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -1201,24 +1201,35 @@ _gtk_tooltip_hide (GtkWidget *widget)
gtk_tooltip_hide_tooltip (tooltip);
}
+static gboolean
+tooltips_enabled (GdkWindow *window)
+{
+ gboolean enabled;
+ gboolean touchscreen;
+ GdkScreen *screen;
+ GtkSettings *settings;
+
+ screen = gdk_drawable_get_screen (window);
+ settings = gtk_settings_get_for_screen (screen);
+
+ g_object_get (settings,
+ "gtk-touchscreen-mode", &touchscreen,
+ "gtk-enable-tooltips", &enabled,
+ NULL);
+
+ return (!touchscreen && enabled);
+}
+
void
_gtk_tooltip_handle_event (GdkEvent *event)
{
gint x, y;
gboolean return_value = FALSE;
- gboolean touchscreen;
GtkWidget *has_tooltip_widget = NULL;
- GdkScreen *screen;
GdkDisplay *display;
GtkTooltip *current_tooltip;
- GtkSettings *settings;
-
- /* Disable tooltips in touchscreen mode */
- screen = gdk_drawable_get_screen (event->any.window);
- settings = gtk_settings_get_for_screen (screen);
- g_object_get (settings, "gtk-touchscreen-mode", &touchscreen, NULL);
- if (touchscreen)
+ if (!tooltips_enabled (event->any.window))
return;
/* Returns coordinates relative to has_tooltip_widget's allocation. */