[mutter] backend-x11: Take grabs on the stage window



commit 18730f2a5e731dcb32c35c0744ea2b2f52982312
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 28 13:22:17 2014 -0400

    backend-x11: Take grabs on the stage window
    
    This means that grabs will be reported with respect to the
    stage window, and that our event coordinates will be more
    correct under nested.

 src/backends/x11/meta-backend-x11.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
index de5c418..3a7c77a 100644
--- a/src/backends/x11/meta-backend-x11.c
+++ b/src/backends/x11/meta-backend-x11.c
@@ -68,15 +68,21 @@ handle_alarm_notify (MetaBackend *backend,
       meta_idle_monitor_xsync_handle_xevent (backend->device_monitors[i], (XSyncAlarmNotifyEvent*) event);
 }
 
-static void
-translate_device_event (MetaBackendX11 *x11,
-                        XIDeviceEvent  *device_event)
+static Window
+get_stage_window (MetaBackendX11 *x11)
 {
   MetaDisplay *display = meta_get_display ();
   MetaCompositor *compositor = display->compositor;
   ClutterStage *stage = CLUTTER_STAGE (compositor->stage);
 
-  device_event->event = clutter_x11_get_stage_window (stage);
+  return clutter_x11_get_stage_window (stage);
+}
+
+static void
+translate_device_event (MetaBackendX11 *x11,
+                        XIDeviceEvent  *device_event)
+{
+  device_event->event = get_stage_window (x11);
   device_event->event_x = device_event->root_x;
   device_event->event_y = device_event->root_y;
 }
@@ -311,7 +317,7 @@ meta_backend_x11_grab_device (MetaBackend *backend,
   MetaCursor cursor = meta_cursor_reference_get_meta_cursor (cursor_ref);
 
   ret = XIGrabDevice (priv->xdisplay, device_id,
-                      DefaultRootWindow (priv->xdisplay),
+                      get_stage_window (x11),
                       timestamp,
                       meta_cursor_create_x_cursor (priv->xdisplay, cursor),
                       XIGrabModeAsync, XIGrabModeAsync,


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