[gtk/wip/otte/matthiasc/popup2: 48/92] popup: Keep surface state in sync



commit f941a47f646d55ab911829fdd38663b0ff6642d9
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Mar 19 22:51:41 2019 -0400

    popup: Keep surface state in sync
    
    Under Wayland, the surface may 'spontaneously'
    disappear (when the user clicks elsewhere). In this
    case, we get a state-changed signal and need to
    keep the GTK state in sync by hiding the widget.

 gtk/gtkpopup.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gtk/gtkpopup.c b/gtk/gtkpopup.c
index 6519ffdf03..cdf72c60c1 100644
--- a/gtk/gtkpopup.c
+++ b/gtk/gtkpopup.c
@@ -197,6 +197,12 @@ surface_state_changed (GtkWidget *widget)
 
   if (changed_mask & GDK_SURFACE_STATE_FOCUSED)
     ensure_state_flag_backdrop (widget);
+
+  if (changed_mask & GDK_SURFACE_STATE_WITHDRAWN)
+    {
+      if (priv->state & GDK_SURFACE_STATE_WITHDRAWN)
+        gtk_widget_hide (widget);
+    }
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]