[gtk] tooltip: Move tooltips enabled checks into tooltips_enabled
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] tooltip: Move tooltips enabled checks into tooltips_enabled
- Date: Fri, 18 Jan 2019 19:06:26 +0000 (UTC)
commit c8ec0f42a02b77a856370b8bdc5c95e1174b5bab
Author: Timm Bäder <mail baedert org>
Date: Fri Jan 18 09:16:44 2019 +0100
tooltip: Move tooltips enabled checks into tooltips_enabled
gtk/gtkmain.c | 13 +------------
gtk/gtktooltip.c | 37 +++++++++++++++++++++++++++----------
2 files changed, 28 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index eff0d62ed3..a26044b8cb 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1904,18 +1904,7 @@ gtk_main_do_event (GdkEvent *event)
break;
}
- if (event->any.type == GDK_ENTER_NOTIFY
- || event->any.type == GDK_LEAVE_NOTIFY
- || event->any.type == GDK_BUTTON_PRESS
- || event->any.type == GDK_KEY_PRESS
- || event->any.type == GDK_DRAG_ENTER
- || event->any.type == GDK_GRAB_BROKEN
- || event->any.type == GDK_MOTION_NOTIFY
- || event->any.type == GDK_TOUCH_UPDATE
- || event->any.type == GDK_SCROLL)
- {
- _gtk_tooltip_handle_event (event);
- }
+ _gtk_tooltip_handle_event (event);
cleanup:
tmp_list = current_events;
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 4590de4148..42f550c24e 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -841,6 +841,33 @@ tooltips_enabled (GdkEvent *event)
{
GdkDevice *source_device;
GdkInputSource source;
+ GdkModifierType event_state = 0;
+
+ switch ((guint)gdk_event_get_event_type (event))
+ {
+ case GDK_ENTER_NOTIFY:
+ case GDK_LEAVE_NOTIFY:
+ case GDK_BUTTON_PRESS:
+ case GDK_KEY_PRESS:
+ case GDK_DRAG_ENTER:
+ case GDK_GRAB_BROKEN:
+ case GDK_MOTION_NOTIFY:
+ case GDK_TOUCH_UPDATE:
+ case GDK_SCROLL:
+ break; /* OK */
+
+ default:
+ return FALSE;
+ }
+
+ gdk_event_get_state (event, &event_state);
+ if ((event_state &
+ (GDK_BUTTON1_MASK |
+ GDK_BUTTON2_MASK |
+ GDK_BUTTON3_MASK |
+ GDK_BUTTON4_MASK |
+ GDK_BUTTON5_MASK)) != 0)
+ return FALSE;
source_device = gdk_event_get_source_device (event);
@@ -862,20 +889,10 @@ _gtk_tooltip_handle_event (GdkEvent *event)
GtkWidget *target;
GdkSurface *surface;
gdouble dx, dy;
- GdkModifierType event_state = 0;
if (!tooltips_enabled (event))
return;
- gdk_event_get_state (event, &event_state);
- if ((event_state &
- (GDK_BUTTON1_MASK |
- GDK_BUTTON2_MASK |
- GDK_BUTTON3_MASK |
- GDK_BUTTON4_MASK |
- GDK_BUTTON5_MASK)) != 0)
- return;
-
event_type = gdk_event_get_event_type (event);
surface = gdk_event_get_surface (event);
gdk_event_get_coords (event, &dx, &dy);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]