From 2c8b95a518bea2192145efe11219f2e36091b37a Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Thu, 24 May 2018 15:42:47 +0200 Subject: [PATCH] gdkseatdefault: Don't hide GdkWindow on grab failure Application is not expecting that. Bug found due gdk_seat_grab() failure on Lock Screen. When user Unlock the screen, the application is visible but does not receive enter-event any more on X11/GNOME. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1485968 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1571422 Signed-off-by: Victor Toso Signed-off-by: Carlos Garnacho --- gdk/gdkseatdefault.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gdk/gdkseatdefault.c b/gdk/gdkseatdefault.c index 91a42cd4af..ce4bdc82d2 100644 --- a/gdk/gdkseatdefault.c +++ b/gdk/gdkseatdefault.c @@ -115,8 +115,10 @@ gdk_seat_default_grab (GdkSeat *seat, GdkSeatDefaultPrivate *priv; guint32 evtime = event ? gdk_event_get_time (event) : GDK_CURRENT_TIME; GdkGrabStatus status = GDK_GRAB_SUCCESS; + gboolean was_visible; priv = gdk_seat_default_get_instance_private (GDK_SEAT_DEFAULT (seat)); + was_visible = gdk_window_is_visible (window); if (prepare_func) (prepare_func) (seat, window, prepare_func_data); @@ -163,10 +165,12 @@ gdk_seat_default_grab (GdkSeat *seat, { if (capabilities & ~GDK_SEAT_CAPABILITY_KEYBOARD) gdk_device_ungrab (priv->master_pointer, evtime); - gdk_window_hide (window); } } + if (status != GDK_GRAB_SUCCESS && !was_visible) + gdk_window_hide (window); + G_GNUC_END_IGNORE_DEPRECATIONS; return status; -- 2.17.0