[gtk: 1/2] gtk/gtktooltip.c: check result of event position get operation
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] gtk/gtktooltip.c: check result of event position get operation
- Date: Fri, 9 Sep 2022 14:56:34 +0000 (UTC)
commit 982b4ff3b22aee04e5f91c04e95a6c6b9d8b66e2
Author: Maxim Zakharov <zakhma muli com au>
Date: Tue Aug 30 15:45:52 2022 +1000
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).
gtk/gtktooltip.c | 10 ++++++----
1 file 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]