aboutsummaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2016-08-18 16:14:55 +0200
committerPierre Ossman <ossman@cendio.se>2016-08-18 16:14:55 +0200
commit2a66f6f3a0d9cf5b266c304718efbecf976c13d1 (patch)
tree5fc0dcbe29fd89d6946f1558cad2bf965d5373a8 /unix
parente823c0caa3e176a9de86da7746598189b9ef9936 (diff)
downloadtigervnc-2a66f6f3a0d9cf5b266c304718efbecf976c13d1.tar.gz
tigervnc-2a66f6f3a0d9cf5b266c304718efbecf976c13d1.zip
Convert pointer coordinates to absolute
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.
Diffstat (limited to 'unix')
-rw-r--r--unix/xserver/hw/vnc/Input.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/unix/xserver/hw/vnc/Input.c b/unix/xserver/hw/vnc/Input.c
index 55befa75..64305cbc 100644
--- a/unix/xserver/hw/vnc/Input.c
+++ b/unix/xserver/hw/vnc/Input.c
@@ -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;