[PATCH 41/42] mi: split move to new screen logic to a helper function

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 14 19:02:18 PST 2011


No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 mi/mieq.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/mi/mieq.c b/mi/mieq.c
index ea8bcf0..5bdf971 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -471,6 +471,19 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
 }
 
 
+static void
+mieqMoveToNewScreen(DeviceIntPtr dev, ScreenPtr screen, DeviceEvent *event)
+{
+    if (dev && screen && screen != DequeueScreen(dev))
+    {
+        int x = 0, y = 0;
+        DequeueScreen(dev) = screen;
+        x = event->root_x;
+        y = event->root_y;
+        NewCurrentScreen (dev, DequeueScreen(dev), x, y);
+    }
+}
+
 /**
  * Post the given @event through the device hierarchy, as appropriate.
  * Use this function if an event must be posted for a given device during the
@@ -482,7 +495,6 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
                        ScreenPtr screen)
 {
     mieqHandler handler;
-    int x = 0, y = 0;
     DeviceIntPtr master;
     InternalEvent mevent; /* master event */
 
@@ -499,12 +511,8 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
         case ET_KeyRelease:
         case ET_ButtonPress:
         case ET_ButtonRelease:
-            if (dev && screen && screen != DequeueScreen(dev) && !handler) {
-                DequeueScreen(dev) = screen;
-                x = event->device_event.root_x;
-                y = event->device_event.root_y;
-                NewCurrentScreen (dev, DequeueScreen(dev), x, y);
-            }
+            if (!handler)
+                mieqMoveToNewScreen(dev, screen, &event->device_event);
             break;
         default:
             break;
-- 
1.7.7.1



More information about the xorg-devel mailing list