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
This commit is contained in:
Paul Davis 2025-08-21 17:16:36 -06:00
parent 5d58ff7ebf
commit 40b7b0a55c

View file

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