[PATCH 7/7] mi: add special handling for keyboard events on switching screens.

Peter Hutterer peter.hutterer at who-t.net
Thu Sep 1 03:41:30 PDT 2011


When a screen switch is triggered by PointerKeys, the device for
NewCurrentScreen is the keyboard. Submitting pointer events for this
keyboard (without valuators) has no effect as GPE ignores the event.

Force the dequeuing through the XTest device attached to this device.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
I've made this commit for the 1.10 branch, so for master I'll replace the
IsFloating() blah blah with the new GetMaster(POINTER_OR_FLOAT).

 mi/mieq.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/mi/mieq.c b/mi/mieq.c
index 3a5aaf0..f13e264 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -350,6 +350,7 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
 static void
 switch_screen(DeviceIntPtr dev, InternalEvent *event, ScreenPtr screen)
 {
+    DeviceIntPtr ptr;
     int x = 0, y = 0;
 
     switch (event->any.type)
@@ -357,19 +358,22 @@ switch_screen(DeviceIntPtr dev, InternalEvent *event, ScreenPtr screen)
         /* Catch events that include valuator information and check if they
          * are changing the screen */
         case ET_Motion:
-        case ET_KeyPress:
-        case ET_KeyRelease:
         case ET_ButtonPress:
         case ET_ButtonRelease:
-            DequeueScreen(dev) = screen;
-            x = event->device_event.root_x;
-            y = event->device_event.root_y;
-            NewCurrentScreen (dev, DequeueScreen(dev), x, y);
+            ptr = dev;
+            break;
+        case ET_KeyPress:
+        case ET_KeyRelease:
+            ptr = IsFloating(dev) ? dev : GetXTestDevice(GetMaster(dev, MASTER_POINTER));
             break;
         default:
             return;
     }
 
+    x = event->device_event.root_x;
+    y = event->device_event.root_y;
+    DequeueScreen(ptr) = screen;
+    NewCurrentScreen (ptr, DequeueScreen(ptr), x, y);
 }
 
 /**
-- 
1.7.6



More information about the xorg-devel mailing list