diff options
author | Maxim Zakharov <zakhma@muli.com.au> | 2022-08-30 15:45:52 +1000 |
---|---|---|
committer | Maxim Zakharov <zakhma@muli.com.au> | 2022-08-30 15:54:52 +1000 |
commit | 982b4ff3b22aee04e5f91c04e95a6c6b9d8b66e2 (patch) | |
tree | e621120b08a1822c31ecd2950f244a8f4de5f54d /gtk/gtktooltip.c | |
parent | 0f2582ff027325841111fe4e908f22a0da91b2e5 (diff) | |
download | gtk+-982b4ff3b22aee04e5f91c04e95a6c6b9d8b66e2.tar.gz |
gtk/gtktooltip.c: check result of event position get operation
Do not perform coordinates transformation when gdk_event_get_position()
returns FALSE as it returns NaNs in that case and these coordinates
are not used anyway in further processing (closes #5134).
Diffstat (limited to 'gtk/gtktooltip.c')
-rw-r--r-- | gtk/gtktooltip.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index 9f0fa15cca..54708a14aa 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -925,16 +925,18 @@ _gtk_tooltip_handle_event (GtkWidget *target, return; event_type = gdk_event_get_event_type (event); - surface = gdk_event_get_surface (event); - gdk_event_get_position (event, &x, &y); /* ignore synthetic motion events */ if (event_type == GDK_MOTION_NOTIFY && gdk_event_get_time (event) == GDK_CURRENT_TIME) return; - gtk_native_get_surface_transform (native, &nx, &ny); - gtk_widget_translate_coordinates (GTK_WIDGET (native), target, x - nx, y - ny, &x, &y); + surface = gdk_event_get_surface (event); + if (gdk_event_get_position (event, &x, &y)) + { + gtk_native_get_surface_transform (native, &nx, &ny); + gtk_widget_translate_coordinates (GTK_WIDGET (native), target, x - nx, y - ny, &x, &y); + } gtk_tooltip_handle_event_internal (event_type, surface, target, x, y); } |