[gtk/matthiasc/for-master] Add a warning when a grab fails



commit 86e8e3e7636d74f0cf779b712f6fc1a92423ce85
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 21 22:03:28 2020 -0500

    Add a warning when a grab fails
    
    This reveals that the grabs for popover menus
    always fail now, causing the menus to not properly
    hide.

 gdk/wayland/gdksurface-wayland.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 2174bdf72a..c761611dbc 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -2799,18 +2799,28 @@ gdk_wayland_surface_present_popup (GdkSurface     *surface,
       if (surface->autohide)
         {
           GrabPrepareData data;
+          GdkGrabStatus result;
 
           data = (GrabPrepareData) {
             .width = width,
             .height = height,
             .layout = layout,
           };
-          gdk_seat_grab (gdk_display_get_default_seat (surface->display),
-                         surface,
-                         GDK_SEAT_CAPABILITY_ALL,
-                         TRUE,
-                         NULL, NULL,
-                         show_grabbing_popup, &data);
+
+          result = gdk_seat_grab (gdk_display_get_default_seat (surface->display),
+                                  surface,
+                                  GDK_SEAT_CAPABILITY_ALL,
+                                  TRUE,
+                                  NULL, NULL,
+                                  show_grabbing_popup, &data);
+          if (result != GDK_GRAB_SUCCESS)
+            {
+              const char *grab_status[] = {
+                "success", "already grabbed", "invalid time",
+                "not viewable", "frozen", "failed"
+              };
+              g_warning ("Grab failed: %s", grab_status[result]);
+            }
         }
       else
         {


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