From 2eb1a31e16bc08da96f53a381943bb0c76073ce4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 21 Aug 2025 17:16:36 -0600 Subject: [PATCH] canvas: fix enter notify event handler to work with gtk ungrabs GTK delivers both window and root coordinates as (0,0) for GDK_CROSSING_GTK_UNGRAB modes. We need the real coordinates of the pointer to pick the right canvas item --- libs/canvas/canvas.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 680279732d..523dfce2c0 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -1396,7 +1396,13 @@ GtkCanvas::on_touch_end_event (GdkEventTouch *ev) bool GtkCanvas::on_enter_notify_event (GdkEventCrossing* ev) { - pick_current_item (Duple (ev->x, ev->y), ev->state); + if (ev->mode == GDK_CROSSING_GTK_UNGRAB) { + int px, py; + get_pointer (px, py); + pick_current_item (Duple (px, py), ev->state); + } else { + pick_current_item (Duple (ev->x, ev->y), ev->state); + } return true; }