aboutsummaryrefslogtreecommitdiffstats
path: root/unix/xserver/hw/vnc/vncHooks.c
diff options
context:
space:
mode:
authorlhchavez <lhchavez@lhchavez.com>2021-02-07 16:36:47 -0800
committerlhchavez <lhchavez@lhchavez.com>2021-03-02 08:36:53 -0800
commitcb8629a213a6fc0988bb603e31ffcecc25646e01 (patch)
tree745f407aae4ce03c475e998f598576f2b4c0d849 /unix/xserver/hw/vnc/vncHooks.c
parent0c8b68f88ec4ef5c78dcf8ad8427996ee962e6e9 (diff)
downloadtigervnc-cb8629a213a6fc0988bb603e31ffcecc25646e01.tar.gz
tigervnc-cb8629a213a6fc0988bb603e31ffcecc25646e01.zip
Add support for notifying clients about pointer movements
This change adds support for the VMware Mouse Position pseudo-encoding[1], which is used to notify VNC clients when X11 clients call `XWarpPointer()`[2]. This function is called by SDL (and other similar libraries) when they detect that the server does not support native relative motion, like some RFB clients. With this, RFB clients can choose to adjust the local cursor position under certain circumstances to match what the server has set. For instance, if pointer lock has been enabled on the client's machine and the cursor is not being drawn locally, the local position of the cursor is irrelevant, so the RFB client can use what the server sends as the canonical absolute position of the cursor. This ultimately enables the possibility of games (especially FPS games) to behave how users expect (if the clients implement the corresponding change). Part of: #619 1: https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#vmware-cursor-position-pseudo-encoding 2: https://tronche.com/gui/x/xlib/input/XWarpPointer.html 3: https://hg.libsdl.org/SDL/file/28e3b60e2131/src/events/SDL_mouse.c#l804
Diffstat (limited to 'unix/xserver/hw/vnc/vncHooks.c')
-rw-r--r--unix/xserver/hw/vnc/vncHooks.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/unix/xserver/hw/vnc/vncHooks.c b/unix/xserver/hw/vnc/vncHooks.c
index a8ab917b..d206e342 100644
--- a/unix/xserver/hw/vnc/vncHooks.c
+++ b/unix/xserver/hw/vnc/vncHooks.c
@@ -62,6 +62,9 @@ typedef struct _vncHooksScreenRec {
CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground;
DisplayCursorProcPtr DisplayCursor;
+#if XORG >= 119
+ CursorWarpedToProcPtr CursorWarpedTo;
+#endif
ScreenBlockHandlerProcPtr BlockHandler;
#ifdef RENDER
CompositeProcPtr Composite;
@@ -113,6 +116,12 @@ static void vncHooksClearToBackground(WindowPtr pWin, int x, int y, int w,
int h, Bool generateExposures);
static Bool vncHooksDisplayCursor(DeviceIntPtr pDev,
ScreenPtr pScreen, CursorPtr cursor);
+#if XORG >= 119
+static void vncHooksCursorWarpedTo(DeviceIntPtr pDev,
+ ScreenPtr pScreen_, ClientPtr pClient,
+ WindowPtr pWindow, SpritePtr pSprite,
+ int x, int y);
+#endif
#if XORG <= 118
static void vncHooksBlockHandler(ScreenPtr pScreen, void * pTimeout,
void * pReadmask);
@@ -271,6 +280,9 @@ int vncHooksInit(int scrIdx)
wrap(vncHooksScreen, pScreen, CopyWindow, vncHooksCopyWindow);
wrap(vncHooksScreen, pScreen, ClearToBackground, vncHooksClearToBackground);
wrap(vncHooksScreen, pScreen, DisplayCursor, vncHooksDisplayCursor);
+#if XORG >= 119
+ wrap(vncHooksScreen, pScreen, CursorWarpedTo, vncHooksCursorWarpedTo);
+#endif
wrap(vncHooksScreen, pScreen, BlockHandler, vncHooksBlockHandler);
#ifdef RENDER
ps = GetPictureScreenIfSet(pScreen);
@@ -631,6 +643,20 @@ out:
return ret;
}
+// CursorWarpedTo - notify that the cursor was warped
+
+#if XORG >= 119
+static void vncHooksCursorWarpedTo(DeviceIntPtr pDev,
+ ScreenPtr pScreen_, ClientPtr pClient,
+ WindowPtr pWindow, SpritePtr pSprite,
+ int x, int y)
+{
+ SCREEN_PROLOGUE(pScreen_, CursorWarpedTo);
+ vncSetCursorPos(pScreen->myNum, x, y);
+ SCREEN_EPILOGUE(CursorWarpedTo);
+}
+#endif
+
// BlockHandler - ignore any changes during the block handler - it's likely
// these are just drawing the cursor.