]> source.dussan.org Git - tigervnc.git/commitdiff
Convert pointer coordinates to absolute
authorPierre Ossman <ossman@cendio.se>
Thu, 18 Aug 2016 14:14:55 +0000 (16:14 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 18 Aug 2016 14:14:55 +0000 (16:14 +0200)
It is possible to set pointer coordinate using absolute numbers, but
getting them back will always give us screen relative ones. Do the
necessary calculations manually so we return sane values to the caller.

unix/xserver/hw/vnc/Input.c

index 55befa7509e2b2c4e83305aa81062812c222ac45..64305cbc20fb3a2304a423acafd12466ff275f7b 100644 (file)
@@ -33,7 +33,9 @@
 #include "inpututils.h"
 #endif
 #include "mi.h"
+#include "mipointer.h"
 #include "exevents.h"
+#include "scrnintstr.h"
 #include "xkbsrv.h"
 #include "xkbstr.h"
 #include "xserver-properties.h"
@@ -186,8 +188,16 @@ void vncPointerMove(int x, int y)
 
 void vncGetPointerPos(int *x, int *y)
 {
-       if (vncPointerDev != NULL)
-               GetSpritePosition(vncPointerDev, &cursorPosX, &cursorPosY);
+       if (vncPointerDev != NULL) {
+               ScreenPtr ptrScreen;
+
+               miPointerGetPosition(vncPointerDev, &cursorPosX, &cursorPosY);
+
+               /* Pointer coordinates are screen relative */
+               ptrScreen = miPointerGetScreen(vncPointerDev);
+               cursorPosX += ptrScreen->x;
+               cursorPosY += ptrScreen->y;
+       }
 
        *x = cursorPosX;
        *y = cursorPosY;