[gtk/wip/matthiasc/popup2: 61/90] main: Hide popups for outside events
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup2: 61/90] main: Hide popups for outside events
- Date: Sat, 23 Mar 2019 13:41:13 +0000 (UTC)
commit f43cf526d2a9c40c765451ef40d067e8cbb3ba17
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Mar 19 22:49:32 2019 -0400
main: Hide popups for outside events
If the user clicks outside our surfaces, Wayland
will dismiss the popup on its own. If the user
clicks on one of our surfaces, we get the event,
but we want the same thing to happen. So, hide
the widget.
gtk/gtkmain.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index e6abf58ace..3e1f8fc3a3 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1329,6 +1329,27 @@ rewrite_event_for_grabs (GdkEvent *event)
event_widget = gtk_get_event_widget (event);
grab_widget = gtk_root_get_for_surface (grab_surface);
+ switch ((guint) event->any.type)
+ {
+ case GDK_BUTTON_PRESS:
+ case GDK_BUTTON_RELEASE:
+ case GDK_KEY_PRESS:
+ case GDK_KEY_RELEASE:
+ case GDK_TOUCH_BEGIN:
+ case GDK_TOUCH_END:
+ case GDK_TOUCH_CANCEL:
+ case GDK_TOUCHPAD_SWIPE:
+ case GDK_TOUCHPAD_PINCH:
+ if (grab_surface != event->any.surface &&
+ GTK_IS_POPUP (grab_widget))
+ {
+ gtk_widget_hide (grab_widget);
+ return NULL;
+ }
+ break;
+ default:;
+ }
+
if (grab_widget &&
gtk_main_get_window_group (grab_widget) != gtk_main_get_window_group (event_widget))
return rewrite_event_for_surface (event, grab_surface);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]