[PATCH 4/8] dix: NewCurrentScreen must work on pointers where possible

Peter Hutterer peter.hutterer at who-t.net
Thu Sep 8 21:20:49 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>
---
 dix/events.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 5193f07..c36c7cc 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3361,7 +3361,11 @@ WindowHasNewCursor(WindowPtr pWin)
 void
 NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
 {
-    SpritePtr pSprite = pDev->spriteInfo->sprite;
+    DeviceIntPtr ptr;
+    SpritePtr pSprite;
+
+    ptr = IsFloating(pDev) ? pDev : GetXTestDevice(GetMaster(pDev, MASTER_POINTER));
+    pSprite = ptr->spriteInfo->sprite;
 
     pSprite->hotPhys.x = x;
     pSprite->hotPhys.y = y;
@@ -3373,15 +3377,15 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
 	    pSprite->screen = newScreen;
 	    /* Make sure we tell the DDX to update its copy of the screen */
 	    if(pSprite->confineWin)
-		XineramaConfineCursorToWindow(pDev,
+		XineramaConfineCursorToWindow(ptr,
                         pSprite->confineWin, TRUE);
 	    else
-		XineramaConfineCursorToWindow(pDev, screenInfo.screens[0]->root, TRUE);
+		XineramaConfineCursorToWindow(ptr, screenInfo.screens[0]->root, TRUE);
 	    /* if the pointer wasn't confined, the DDX won't get
 	       told of the pointer warp so we reposition it here */
 	    if(!syncEvents.playingEvents)
 		(*pSprite->screen->SetCursorPosition)(
-                                                      pDev,
+                                                      ptr,
                                                       pSprite->screen,
 		    pSprite->hotPhys.x + screenInfo.screens[0]->x -
 			pSprite->screen->x,
@@ -3391,7 +3395,7 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
     } else
 #endif
     if (newScreen != pSprite->hotPhys.pScreen)
-	ConfineCursorToWindow(pDev, newScreen->root, TRUE, FALSE);
+	ConfineCursorToWindow(ptr, newScreen->root, TRUE, FALSE);
 }
 
 #ifdef PANORAMIX
-- 
1.7.6



More information about the xorg-devel mailing list