From 9a79c3d643d7381e1755866bf7a9b6ffc2a06595 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 5 Apr 2013 17:06:09 +0200 Subject: [PATCH] broadway: Unsure we clear the grab on window hide --- gdk/broadway/gdkdevice-broadway.c | 23 +++++++++++++++++++++++ gdk/broadway/gdkprivate-broadway.h | 2 ++ gdk/broadway/gdkwindow-broadway.c | 4 ++++ 3 files changed, 29 insertions(+) diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c index b87186ed33..f8dec2308b 100644 --- a/gdk/broadway/gdkdevice-broadway.c +++ b/gdk/broadway/gdkdevice-broadway.c @@ -211,6 +211,29 @@ gdk_broadway_device_query_state (GdkDevice *device, return; } +void +_gdk_broadway_window_grab_check_unmap (GdkWindow *window, + gulong serial) +{ + GdkDisplay *display = gdk_window_get_display (window); + GdkDeviceManager *device_manager; + GList *devices, *d; + + device_manager = gdk_display_get_device_manager (display); + + /* Get all devices */ + devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER); + devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_SLAVE)); + devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING)); + + /* End all grabs on the newly hidden window */ + for (d = devices; d; d = d->next) + _gdk_display_end_device_grab (display, d->data, serial, window, TRUE); + + g_list_free (devices); +} + + void _gdk_broadway_window_grab_check_destroy (GdkWindow *window) { diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h index 8277c0880a..e611ca8c39 100644 --- a/gdk/broadway/gdkprivate-broadway.h +++ b/gdk/broadway/gdkprivate-broadway.h @@ -92,6 +92,8 @@ gboolean _gdk_broadway_moveresize_configure_done (GdkDisplay *display, void _gdk_broadway_selection_window_destroyed (GdkWindow *window); void _gdk_broadway_window_grab_check_destroy (GdkWindow *window); +void _gdk_broadway_window_grab_check_unmap (GdkWindow *window, + gulong serial); 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 3784b5a57c..7919d1c168 100644 --- a/gdk/broadway/gdkwindow-broadway.c +++ b/gdk/broadway/gdkwindow-broadway.c @@ -437,6 +437,10 @@ gdk_window_broadway_hide (GdkWindow *window) _gdk_make_event (GDK_WINDOW (window), GDK_UNMAP, NULL, FALSE); broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window)); + + _gdk_broadway_window_grab_check_unmap (window, + _gdk_broadway_server_get_next_serial (broadway_display->server)); + if (_gdk_broadway_server_window_hide (broadway_display->server, impl->id)) queue_flush (window);