diff options
author | Pierre Ossman <ossman@cendio.se> | 2016-08-18 16:16:45 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2016-08-18 16:16:45 +0200 |
commit | af7fb8dad3f5dadce417b58ff28638b55d7f1cb3 (patch) | |
tree | 583c8101564ff31dbf8fdf0bc933ff89870a09ae /unix | |
parent | 2a66f6f3a0d9cf5b266c304718efbecf976c13d1 (diff) | |
download | tigervnc-af7fb8dad3f5dadce417b58ff28638b55d7f1cb3.tar.gz tigervnc-af7fb8dad3f5dadce417b58ff28638b55d7f1cb3.zip |
Adjust client pointer coordinates to absolute
The client is not aware of where the screen is placed so it will give
us screen relative coordinates. Convert to and from these and absolute
coordinates before interacting with the input layer.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/xserver/hw/vnc/XorgGlue.c | 10 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/XorgGlue.h | 2 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/XserverDesktop.cc | 5 |
3 files changed, 16 insertions, 1 deletions
diff --git a/unix/xserver/hw/vnc/XorgGlue.c b/unix/xserver/hw/vnc/XorgGlue.c index d7892b18..712ed6af 100644 --- a/unix/xserver/hw/vnc/XorgGlue.c +++ b/unix/xserver/hw/vnc/XorgGlue.c @@ -92,6 +92,16 @@ void vncGetScreenFormat(int scrIdx, int *depth, int *bpp, *blueMask = vis->blueMask; } +int vncGetScreenX(int scrIdx) +{ + return screenInfo.screens[scrIdx]->x; +} + +int vncGetScreenY(int scrIdx) +{ + return screenInfo.screens[scrIdx]->y; +} + int vncGetScreenWidth(int scrIdx) { return screenInfo.screens[scrIdx]->width; diff --git a/unix/xserver/hw/vnc/XorgGlue.h b/unix/xserver/hw/vnc/XorgGlue.h index 92b0d18d..5cae860a 100644 --- a/unix/xserver/hw/vnc/XorgGlue.h +++ b/unix/xserver/hw/vnc/XorgGlue.h @@ -33,6 +33,8 @@ void vncGetScreenFormat(int scrIdx, int *depth, int *bpp, int *trueColour, int *bigEndian, int *redMask, int *greenMask, int *blueMask); +int vncGetScreenX(int scrIdx); +int vncGetScreenY(int scrIdx); int vncGetScreenWidth(int scrIdx); int vncGetScreenHeight(int scrIdx); diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index 4eaa41f3..4f82a544 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -514,6 +514,8 @@ void XserverDesktop::readWakeupHandler(fd_set* fds, int nfds) // We are responsible for propagating mouse movement between clients int cursorX, cursorY; vncGetPointerPos(&cursorX, &cursorY); + cursorX -= vncGetScreenX(screenIndex); + cursorY -= vncGetScreenY(screenIndex); if (oldCursorPos.x != cursorX || oldCursorPos.y != cursorY) { oldCursorPos.x = cursorX; oldCursorPos.y = cursorY; @@ -648,7 +650,8 @@ void XserverDesktop::approveConnection(uint32_t opaqueId, bool accept, void XserverDesktop::pointerEvent(const Point& pos, int buttonMask) { - vncPointerMove(pos.x, pos.y); + vncPointerMove(pos.x + vncGetScreenX(screenIndex), + pos.y + vncGetScreenY(screenIndex)); vncPointerButtonAction(buttonMask); } |