[PATCH v2 7/7] dix: NewCurrentScreen must work on pointers where possible

Peter Hutterer peter.hutterer at who-t.net
Thu Sep 1 18:36:51 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>
---

This patch replaces 6/7 and 7/7 of this series.

 dix/events.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 6d37834..199d115 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3267,7 +3267,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;
@@ -3279,15 +3283,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,
@@ -3297,7 +3301,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