[gtk] Add a warning when a grab fails
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] Add a warning when a grab fails
- Date: Sat, 22 Feb 2020 13:12:38 +0000 (UTC)
commit 76e115b91035215871094121a9dfb5a4b11f476a
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]