[gtk+] [broadway] Ungrab if grabbed window is destroyed
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] [broadway] Ungrab if grabbed window is destroyed
- Date: Fri, 15 Apr 2011 18:39:21 +0000 (UTC)
commit 66231a29b82e72ba57ca9243bd9231a99cb5ca59
Author: Alexander Larsson <alexl redhat com>
Date: Fri Apr 15 16:17:27 2011 +0200
[broadway] Ungrab if grabbed window is destroyed
gdk/broadway/gdkdevice-broadway.c | 35 +++++++++++++++++++++++++++++++++++
gdk/broadway/gdkprivate-broadway.h | 4 +++-
gdk/broadway/gdkwindow-broadway.c | 3 +++
3 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c
index 6b514ea..edbc3eb 100644
--- a/gdk/broadway/gdkdevice-broadway.c
+++ b/gdk/broadway/gdkdevice-broadway.c
@@ -234,6 +234,41 @@ gdk_broadway_device_query_state (GdkDevice *device,
return TRUE;
}
+void
+_gdk_broadway_window_grab_check_destroy (GdkWindow *window)
+{
+ GdkDisplay *display = gdk_window_get_display (window);
+ GdkBroadwayDisplay *broadway_display;
+ GdkDeviceManager *device_manager;
+ GdkDeviceGrabInfo *grab;
+ GList *devices, *d;
+
+ broadway_display = GDK_BROADWAY_DISPLAY (display);
+
+ device_manager = gdk_display_get_device_manager (display);
+
+ /* Get all devices */
+ devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
+
+ for (d = devices; d; d = d->next)
+ {
+ /* Make sure there is no lasting grab in this native window */
+ grab = _gdk_display_get_last_device_grab (display, d->data);
+
+ if (grab && grab->native_window == window)
+ {
+ grab->serial_end = grab->serial_start;
+ grab->implicit_ungrab = TRUE;
+
+ broadway_display->pointer_grab_window = NULL;
+ }
+
+ }
+
+ g_list_free (devices);
+}
+
+
static GdkGrabStatus
gdk_broadway_device_grab (GdkDevice *device,
GdkWindow *window,
diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h
index 4956894..4450e76 100644
--- a/gdk/broadway/gdkprivate-broadway.h
+++ b/gdk/broadway/gdkprivate-broadway.h
@@ -87,7 +87,9 @@ void _gdk_broadway_window_change_property (GdkWindow *window,
void _gdk_broadway_window_delete_property (GdkWindow *window,
GdkAtom property);
-void _gdk_broadway_selection_window_destroyed (GdkWindow *window);
+
+void _gdk_broadway_selection_window_destroyed (GdkWindow *window);
+void _gdk_broadway_window_grab_check_destroy (GdkWindow *window);
void _gdk_keymap_keys_changed (GdkDisplay *display);
gint _gdk_broadway_get_group_for_state (GdkDisplay *display,
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 6b0a713..aa6973d 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -273,6 +273,8 @@ gdk_window_impl_broadway_finalize (GObject *object)
wrapper = impl->wrapper;
+ _gdk_broadway_window_grab_check_destroy (wrapper);
+
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper));
if (broadway_display->mouse_in_toplevel == GDK_WINDOW (wrapper))
@@ -472,6 +474,7 @@ _gdk_broadway_window_destroy (GdkWindow *window,
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
_gdk_broadway_selection_window_destroyed (window);
+ _gdk_broadway_window_grab_check_destroy (window);
if (impl->ref_surface)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]