[gtk/wip/matthiasc/popup4: 107/115] popover: Use gdk_surface_show_with_auto_dismissal



commit a4805f2191ea4f234d0c85c98881faad00b49190
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Apr 22 21:33:26 2019 +0000

    popover: Use gdk_surface_show_with_auto_dismissal
    
    The new api is made for this case.

 gtk/gtkpopover.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 40cae4905a..ff8fb852e7 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -145,7 +145,6 @@ typedef struct {
   guint surface_transform_changed_cb;
   GtkPositionType position;
   gboolean modal;
-  gboolean has_grab;
 
   GtkWidget *contents_widget;
 } GtkPopoverPrivate;
@@ -553,12 +552,10 @@ gtk_popover_map (GtkWidget *widget)
 
   if (priv->modal)
     {
-      gdk_seat_grab (gdk_display_get_default_seat (priv->display),
-                     priv->surface,
-                     GDK_SEAT_CAPABILITY_ALL,
-                     TRUE,
-                     NULL, NULL, grab_prepare_func, NULL);
-      priv->has_grab = TRUE;
+      GdkSeat *seat;
+
+      seat = gdk_display_get_default_seat (priv->display),
+      gdk_surface_show_with_auto_dismissal (priv->surface, seat);
     }
 
   gtk_widget_get_surface_allocation (priv->relative_to, &parent_rect);
@@ -591,11 +588,6 @@ gtk_popover_unmap (GtkWidget *widget)
   GTK_WIDGET_CLASS (gtk_popover_parent_class)->unmap (widget);
 
   gdk_surface_hide (priv->surface);
-  if (priv->has_grab)
-    {
-      gdk_seat_ungrab (gdk_display_get_default_seat (priv->display));
-      priv->has_grab = FALSE;
-    }
 
   child = gtk_bin_get_child (GTK_BIN (widget));
   if (child != NULL)


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