Support the VMware Cursor Position extension on vncviewer
This change makes it possible for re-synchronizing the remote cursor on
the vncviewer when in fullscreen mode. This is done by locally moving
the cursor position to what the server thinks it should be.
Now SDL games should work!
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
Some of these were incorrectly calculated so the server or client would
wait too long before proceeding with decoding.
Change all of these to be a more explicit calculation to avoid such
issues in the future.
We computed a safe area if a client gave us a bogus one, but we didn't
actually use it. Fix this properly and make sure we don't pass on bad
coordinates further.
The extended clipboard protocol has the ability for the peer to request
things to be sent automatically, without a request message. Make sure we
honor such settings.
It's a better match for what the key symbolises, even though it is not
as common on Unix systems. But we want to avoid getting in to tailoring
things for any one specific input method implementation.
Some of the virtual key codes for Japanese keys are used for other
things on other layouts, so we need to make sure we only use this look
up table when the layout is indeed set to Japanese.