[gtk+/client-side-windows: 168/284] Ungrab keyboard if virtual window is hidden or destroyed



commit cf54a2c68e93aacb418fa70b3ba326d694c14b8d
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Jan 23 15:39:04 2009 +0100

    Ungrab keyboard if virtual window is hidden or destroyed
---
 gdk/gdkinternals.h |    2 ++
 gdk/gdkwindow.c    |   13 +++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index a878e05..e70f82c 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -484,6 +484,8 @@ void _gdk_display_set_has_keyboard_grab (GdkDisplay *display,
 					 gboolean owner_events,
 					 unsigned long serial,
 					 guint32 time);
+void _gdk_display_unset_has_keyboard_grab (GdkDisplay *display,
+					   gboolean implicit);
 
 void _gdk_window_invalidate_for_expose (GdkWindow       *window,
 					const GdkRegion *region);
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 39c1b45..b203d94 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -5725,6 +5725,19 @@ gdk_window_hide (GdkWindow *window)
 	    }
 	}
 
+      if (display->keyboard_grab.window != NULL)
+	{
+	  if (is_parent_of (window, display->keyboard_grab.window))
+	    {
+	      /* Call this ourselves, even though gdk_display_keyboard_ungrab
+		 does so too, since we want to pass implicit == TRUE so the
+		 broken grab event is generated */
+	      _gdk_display_unset_has_keyboard_grab (display,
+						    TRUE);
+	      gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
+	    }
+	}
+      
       private->state = GDK_WINDOW_STATE_WITHDRAWN;
     }
 



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