From bde2332a1aeaf2944ab7bb1523296b816421bdd3 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 4 Oct 2018 13:08:14 +0200 Subject: [PATCH] main: Report correct target for button release events Button release events should not go to the widget below the pointer, but to the widget that received the original button press. Fixes #24 --- gtk/gtkmain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 25d39d785d..8222f5774b 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -1651,11 +1651,11 @@ handle_pointing_event (GdkEvent *event) if (event->any.type == GDK_BUTTON_RELEASE) { - old_target = target; - target = gtk_widget_pick (GTK_WIDGET (toplevel), x, y); - if (target == NULL) - target = GTK_WIDGET (toplevel); - gtk_synthesize_crossing_events (toplevel, old_target, target, event, + GtkWidget *new_target; + new_target = gtk_widget_pick (GTK_WIDGET (toplevel), x, y); + if (new_target == NULL) + new_target = GTK_WIDGET (toplevel); + gtk_synthesize_crossing_events (toplevel, target, new_target, event, GDK_CROSSING_UNGRAB); gtk_window_maybe_update_cursor (toplevel, NULL, device); }