summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-12-15 07:57:47 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-21 14:16:36 +1000
commit48547068b115b1f5e5f46a70110454a2175fb9a4 (patch)
treef76557a076645744be16e34fd977b6c7f73e848b
parent3b1e2035cc4740711360c845cfcdff07f7b60558 (diff)
mi: split move to new screen logic to a helper function
No functional changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--mi/mieq.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/mi/mieq.c b/mi/mieq.c
index ea8bcf044..5bdf97122 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;