summaryrefslogtreecommitdiff
path: root/gdk/gdkdevice.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-10-28 00:54:39 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-10-28 00:54:39 -0400
commitabe7187cfb2c19a177a28b9adc236060bf17665e (patch)
tree5a15e40215475441178810197c6d27b403b93929 /gdk/gdkdevice.c
parent86f66d26fe154db10d13c405414ba9dc90b0baca (diff)
downloadgtk+-abe7187cfb2c19a177a28b9adc236060bf17665e.tar.gz
Add another multi-device invariant
The device and window passed to gdk_device_grab() must be on the same display, or things are unlikely to work. Document and assert this.
Diffstat (limited to 'gdk/gdkdevice.c')
-rw-r--r--gdk/gdkdevice.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 3c9cf672ee..f71ff50485 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1260,6 +1260,8 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
* or the window becomes unviewable. This overrides any previous grab on the device
* by this client.
*
+ * Note that @device and @window need to be on the same display.
+ *
* Device grabs are used for operations which need complete control over the
* given device events (either pointer or keyboard). For example in GTK+ this
* is used for Drag and Drop operations, popup menus and such.
@@ -1293,6 +1295,7 @@ gdk_device_grab (GdkDevice *device,
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_GRAB_FAILED);
g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_GRAB_FAILED);
+ g_return_val_if_fail (gdk_window_get_display (window) == gdk_device_get_display (device), GDK_GRAB_FAILED);
native = gdk_window_get_toplevel (window);