tooltip: Move tooltips enabled checks into tooltips_enabled

This commit is contained in:
Timm Bäder 2019-01-18 09:16:44 +01:00
parent 2353e0e03f
commit c8ec0f42a0
2 changed files with 28 additions and 22 deletions

View File

@ -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;

View File

@ -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);