[gtk/wip/matthiasc/popup5: 81/89] popover: Use gdk_surface_show_with_auto_dismissal
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup5: 81/89] popover: Use gdk_surface_show_with_auto_dismissal
- Date: Thu, 2 May 2019 22:00:03 +0000 (UTC)
commit f8ff5675e52ef2a59312625018a561b2f23282c8
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 | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 5ef55e3d21..24f72df3f5 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -140,7 +140,6 @@ typedef struct {
guint surface_transform_changed_cb;
GtkPositionType position;
gboolean modal;
- gboolean has_grab;
GtkWidget *contents_widget;
} GtkPopoverPrivate;
@@ -533,14 +532,6 @@ gtk_popover_hide (GtkWidget *widget)
g_signal_emit (widget, signals[CLOSED], 0);
}
-static void
-grab_prepare_func (GdkSeat *seat,
- GdkSurface *surface,
- gpointer data)
-{
- gdk_surface_show (surface);
-}
-
static void
unset_surface_transform_changed_cb (gpointer data)
{
@@ -571,13 +562,11 @@ gtk_popover_map (GtkWidget *widget)
if (priv->modal)
{
+ GdkSeat *seat;
+
display = gtk_widget_get_display (priv->relative_to);
- gdk_seat_grab (gdk_display_get_default_seat (display),
- priv->surface,
- GDK_SEAT_CAPABILITY_ALL,
- TRUE,
- NULL, NULL, grab_prepare_func, NULL);
- priv->has_grab = TRUE;
+ seat = gdk_display_get_default_seat (display),
+ gdk_surface_show_with_auto_dismissal (priv->surface, seat);
}
gtk_widget_get_surface_allocation (priv->relative_to, &parent_rect);
@@ -610,14 +599,6 @@ gtk_popover_unmap (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_popover_parent_class)->unmap (widget);
gdk_surface_hide (priv->surface);
- if (priv->has_grab)
- {
- GdkDisplay *display;
-
- display = gtk_widget_get_display (priv->relative_to);
- gdk_seat_ungrab (gdk_display_get_default_seat (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]