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 committed by Edgar Aichinger
parent b292e5191c
commit 2eb1a31e16

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