[PATCH xserver 1/3] xf86Cursor: Use CursoreRec::bits->x/yhot in xf86MoveCursor

Michel Dänzer michel at daenzer.net
Wed Oct 5 09:41:36 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

xf86CursorScreenRec::HotX/Y contain 0 for PRIME slave screens.

Fixes incorrect HW cursor position on PRIME slave screens.

Also hoist the hotspot translation out from xf86ScreenMoveCursor to
xf86MoveCursor, since the hotspot position is a property of the cursor,
not the screen.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 hw/xfree86/ramdac/xf86HWCurs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index e8966ed..8feb767 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -263,8 +263,8 @@ xf86ScreenMoveCursor(ScreenPtr pScreen, int x, int y)
                                                xf86CursorScreenKey);
     xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
 
-    x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
-    y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
+    x -= infoPtr->pScrn->frameX0;
+    y -= infoPtr->pScrn->frameY0;
 
     (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);
 }
@@ -272,8 +272,12 @@ xf86ScreenMoveCursor(ScreenPtr pScreen, int x, int y)
 void
 xf86MoveCursor(ScreenPtr pScreen, int x, int y)
 {
+    CursorPtr pCurs = xf86CurrentCursor(pScreen);
     ScreenPtr pSlave;
 
+    x -= pCurs->bits->xhot;
+    y -= pCurs->bits->yhot;
+
     xf86ScreenMoveCursor(pScreen, x, y);
 
     /* ask each slave driver to move the cursor */
-- 
2.9.3



More information about the xorg-devel mailing list