diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2017-05-12 12:42:48 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2017-05-25 16:25:59 +0200 |
commit | ee894903c780cbf7e1e5445c2b492326fbb36ede (patch) | |
tree | ac2a9fc2a516f594fb064b4beb09c565ecd9d12d /gtk | |
parent | 47e505781e475d9d1e42b113366066858124603d (diff) | |
download | gtk+-ee894903c780cbf7e1e5445c2b492326fbb36ede.tar.gz |
gtkpopover: Use event coordinates right away to detect clicks outside.
There's no need anymore to translate coordinates, the event already contains
popover-relative ones.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkpopover.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 95b363e25e..44a0515625 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -1410,31 +1410,21 @@ gtk_popover_button_release (GtkWidget *widget, GdkEventButton *event) { GtkPopover *popover = GTK_POPOVER (widget); - GtkWidget *child, *event_widget; + GtkAllocation child_alloc; + GtkWidget *child; child = gtk_bin_get_child (GTK_BIN (widget)); if (!popover->priv->button_pressed) return GDK_EVENT_PROPAGATE; - event_widget = gtk_get_event_widget ((GdkEvent *) event); - - if (child && event->window == gtk_widget_get_window (widget)) - { - GtkAllocation child_alloc; - - gtk_widget_get_allocation (child, &child_alloc); + gtk_widget_get_allocation (child, &child_alloc); - if (event->x < child_alloc.x || - event->x > child_alloc.x + child_alloc.width || - event->y < child_alloc.y || - event->y > child_alloc.y + child_alloc.height) - gtk_popover_popdown (popover); - } - else if (!gtk_widget_is_ancestor (event_widget, widget)) - { - gtk_popover_popdown (popover); - } + if (event->x < child_alloc.x || + event->x > child_alloc.x + child_alloc.width || + event->y < child_alloc.y || + event->y > child_alloc.y + child_alloc.height) + gtk_popover_popdown (popover); return GDK_EVENT_PROPAGATE; } |