From f96437317b0d3ae4d9b7ede29b239d3bbead6580 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 16 Sep 2014 17:14:09 +0200
Subject: [PATCH] gdkwindow: check grab window and children on
 get_pointer_window()

If !owner_events, the pointer window has been usually set to NULL if
the pointer fell outside the grabbing widget, but it was not being
checked that the pointer_window is actually a child of the grab
window, in which case it should be obtained as if ungrabbed.

https://bugzilla.gnome.org/show_bug.cgi?id=735749
---
 gdk/gdkwindow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 0460ffca81..e023042ca7 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -7623,7 +7623,8 @@ get_pointer_window (GdkDisplay *display,
   grab = _gdk_display_has_device_grab (display, device, serial);
   if (grab != NULL &&
       !grab->owner_events &&
-      pointer_window != grab->window)
+      pointer_window != grab->window &&
+      !gdk_window_is_ancestor (pointer_window, grab->window))
     pointer_window = NULL;
 
   return pointer_window;