Commit Graph

131 Commits

Author SHA1 Message Date
Quantum
b0f9d2f713 [client] spice/wayland: improve cursor tracking logic
One of the major issues with the old tracking code is a data race
between the cursor thread updating g_cursor.guest and the
app_handleMouseBasic function. Specifically, the latter may have
sent mouse input via spice that has not been processed by the guest
and updated g_cursor.guest, but the guest may overwrite g_cursor.guest
to a previous state before the input is processed. This causes some
movements to be doubled. Eventually, the cursor positions will
synchronize, but this nevertheless causes a lot of jitter.

In this commit, we introduce a new field g_cursor.projected, which
is unambiguously the position of the cursor after taking into account
all the input already sent via spice. This is synced up to the guest
cursor upon entering the window and when the host restarts. Afterwards,
all mouse movements will be based on this position. This eliminates
all cursor jitter as far as I could tell.

Also, the cursor is now synced to the host position when exiting
capture mode.

A downside of this commit is that if the 1:1 movement patch is not
correctly applied, the cursor position would be wildly off instead
of simply jittering, but that is an unsupported configuration and
should not matter.

Also unsupported is when an application in guest moves the cursor
programmatically and bypassing spice. When using those applications,
capture mode must be on. Before this commit, we try to move the guest
cursor back to where it should be, but it's inherently fragile and
may lead to scenarios such as wild movements in first-person shooters.
2021-02-21 10:31:48 +11:00
Geoffrey McRae
7d2c9ec447 [client] app: don't call ds->free if the ds was not initialized 2021-02-21 10:31:48 +11:00
Geoffrey McRae
ca5c3938e4 [client] all: move all SDL specific code into displayservers/sdl 2021-02-21 10:31:48 +11:00
Geoffrey McRae
7ff5da4d62 [client] refactor keybinds out of main.c 2021-02-21 10:31:48 +11:00
Geoffrey McRae
37b3a26b9c [client] all: refactor keybind code & functions 2021-02-21 10:31:48 +11:00
Geoffrey McRae
e18f7d3365 [client] app: replace old SDL_Scancode with int 2021-02-21 10:31:48 +11:00
Geoffrey McRae
3d03699cc8 [client] all: move keybind implementation into app.c/h 2021-02-21 10:31:48 +11:00
Geoffrey McRae
dbb18a6ecb [client] x11/sdl: get the border dimensions from the backend 2021-02-21 10:31:48 +11:00
Geoffrey McRae
bf583290a4 [client/common] restructure project in prep for full SDL removal 2021-02-21 10:31:46 +11:00
Geoffrey McRae
dcd0cb7d8e [client] spice: release the mouse if the host stops 2021-01-21 15:39:15 +11:00
Geoffrey McRae
b2ac2980d5 [client] don't attempt to align to the guest with invalid pos data 2021-01-19 05:56:40 +11:00
Geoffrey McRae
083deff489 [client] add keybind <ScrollLock+R> to rotate the display at runtime 2021-01-19 03:49:09 +11:00
Geoffrey McRae
8a1578230f [client] all: properly support guest rotation
If the guest has it's output rotated (ie, landscape) we must rotate and
translate the pointer draw location, as well as all the translations of
cursor coordinate spaces based on the rotation, along with any local
rotations that may also be applied.
2021-01-19 02:54:56 +11:00
Tudor Brindus
1f943fbbab [client] use uapi keybindings internally
This commit moves SDL to uapi mapping to the SDL backend.
2021-01-19 02:49:51 +11:00
Geoffrey McRae
d22124519e [client] mouse: dont leave the window if any mouse buttons are held 2021-01-17 15:13:45 +11:00
Geoffrey McRae
e23d536af5 [client] mouse: correct issues with cursor alignment on enter/exit/focus 2021-01-17 12:53:55 +11:00
Geoffrey McRae
27a38294ea [client] major restructure of platform specific code 2021-01-16 20:41:13 +11:00
Geoffrey McRae
72c86d7125 [client] all: add screen rotation support win:rotate
Currently only supports EGL, if there is enough demand for OpenGL
support this can be added later.

Closes #231
2021-01-15 12:42:16 +11:00
Tudor Brindus
fd009c6392 [client] wm/wayland: bypass SDL loop for pointer events 2021-01-13 13:59:00 +11:00
Tudor Brindus
c21f502414 [client] wm/wayland: implement grab mode for capture 2021-01-12 12:36:21 +11:00
Geoffrey McRae
f47c8cb806 [client] add input:captureOnly to disable input when not captured 2021-01-09 18:01:08 +11:00
Geoffrey McRae
579be87597 [client] spice: added basic mouse smoothing for non-capture mode
Enabled by default, can be disabled with `input:mouseSmoothing`
2021-01-09 14:39:48 +11:00
Geoffrey McRae
40c3c38681 [client] refactor struct CursorState to use struct DoublePoint 2021-01-08 20:49:20 +11:00
Geoffrey McRae
59ea957d0d [client] spice: don't grab the keyboard input unless we are focused 2021-01-08 20:26:32 +11:00
Geoffrey McRae
2789e73296 [client] spice: added new input:autoCapture mode
This new mode if enabled (disabled by default) will cause the client to
attempt to hold onto the mouse when a title/game has it captured in the
guest. This is best effort and is not a replacement for full capture
mode.
2021-01-08 19:41:10 +11:00
Geoffrey McRae
6c8eba5f54 [client] spice: rewrite cursor handling code to take advantage of xinput 2021-01-08 15:37:40 +11:00
Geoffrey McRae
526572c9c9 [client] added new feature input:rawMouse for RAW mouse input
This option allows those that want it (gamers) to bypass all X11 mouse
acceleration and smoothing giving true 1:1 input to the guest while in
capture mode. Note: only supported for X11!
2021-01-08 03:12:42 +11:00
Geoffrey McRae
d6bb518992 [client] spice: refactor g_cursor.last to g_cursor.pos 2021-01-07 02:16:55 +11:00
Geoffrey McRae
9b309db964 [client] spice: general improvements to cursor warp logic
Previously only up to two pending warp requests were possible, this
changes this so that additional warps can be queued if the cursor's
delta has moved more then 50px between each warp request.

The old code also had an error where it would null out any additional
movement since the warp was requested, but before it was processed, this
has been corrected.
2021-01-06 22:11:28 +11:00
Geoffrey McRae
6f99280fe3 [client] fix the warp logic to account for still pending warps to finish
As X11 is a server/client protocol, issuing commands such as
XWarpPointer do not happen immediately, as such we need to identify when
the warp is complete to know to null out the movement. To do this we
track each warp issued and look for it's completion in the event filter.
As some events come in via XInput2 we need to also make use of this
instead of just relying on MotionNotify, as such the support has been
implemented for XI_Motion events.
2021-01-05 11:47:17 +11:00
Geoffrey McRae
25d370ef22 [client] move new scaling variables into the CursorState struct 2021-01-05 09:48:30 +11:00
Quantum
a172d79f66 spice: scale mouse input based on host DPI information 2021-01-05 09:03:29 +11:00
Geoffrey McRae
8fd08cdd79 [client] spice: add option to ignore the windows key
If active this will prevent the client from sending keyboard events for
the windows key. The idea is to allow people to keep the windows key
bound to their WMs default action without causing the Windows start menu
to open
2021-01-04 18:22:39 +11:00
Geoffrey McRae
33b117e732 [client] spice: add new keybinds <ScrLck>+<LWin>, <ScrLck>+<RWin> 2021-01-04 18:07:09 +11:00
Geoffrey McRae
3b0a98ede2 [client] spice: use xlib directly for warping
This change allows us to look for and filter out the warp completion
event as we can obtain and use the serial number of the warp request to
do so. This is far more elegant then the x/y match that we were doing
prior.
2021-01-04 15:40:23 +11:00
Geoffrey McRae
1195a76368 [client] video: ensure that the renderer is always updated on resize 2021-01-04 13:40:03 +11:00
Geoffrey McRae
2bc767430c [client] spice: be more aggressive with window warp for high DPI mice 2021-01-04 12:59:14 +11:00
Geoffrey McRae
f7d7fbdb73 [client] rename state to g_state 2021-01-04 12:06:54 +11:00
Geoffrey McRae
6878eee40a [client] refactor cursor variables into their own global struct 2021-01-04 12:04:43 +11:00
Geoffrey McRae
5323d9833a [client] spice: fix mouse warp on window focus 2021-01-03 22:59:23 +11:00
Geoffrey McRae
c0a3b85580 [client] spice: don't disable warp when the future cursor pos is invalid 2020-12-04 17:32:28 +11:00
Geoffrey McRae
c5befbba0e [client] spice: don't scale mouse if it's 1:1 2020-12-04 00:50:27 +11:00
Geoffrey McRae
3df23d6b73 [client] reworked the mouse tracking logic 2020-12-04 00:32:28 +11:00
Geoffrey McRae
e57f084c93 [client] added streaming clipboard support for large transfers 2020-12-03 12:01:51 +11:00
Geoffrey McRae
bbcaaccdcc [client] added new option input:grabKeyboardOnFocus 2020-11-29 07:12:19 +11:00
jonpas
db51acdd8a [client] add option to always show cursor 2020-11-16 06:48:57 +11:00
Geoffrey McRae
ed95f8863d [client] fix divide by zero fault with fpsMin disabled (set to 0) 2020-11-08 10:58:18 +11:00
Geoffrey McRae
4f9544d61d [client] egl: added DMA texture support for direct upload
Note: This only works with the KVMFR kernel module in a VM->VM
configuration. If this causes issues it can be disabled with the new
option `app:allowDMA`
2020-10-30 02:36:45 +11:00
Ali Abdel-Qader
3284431785 change 'frameCount' to be atomic 2020-10-29 13:46:14 +11:00
Geoffrey McRae
757a90a643 [client] add new keybind to toggle the video stream (ScrLck+V) 2020-10-14 19:32:21 +11:00
Geoffrey McRae
46df25bb80 [client] added new option win:dontUpscale 2020-10-12 23:27:33 +11:00
Jonathan Rubenstein
66df00cee2 Add option to skip splash screen fade out 2020-10-09 03:28:58 +11:00
Geoffrey McRae
6927dbecd2 [client] added new input:mouseRedraw option
This new option, when enabled (the default) enables cursor movements to
trigger frame updates in the client, improving responsiveness at the
cost of increased FPS while the mouse is moving around.
2020-08-20 15:50:33 +10:00
Geoffrey McRae
5c912e3c27 [client] spice: improve mouse syncronization with the host 2020-08-20 14:52:24 +10:00
Geoffrey McRae
7e362050f7 [all] update KVMFR to provide cursor hotspot information
This commit bumps the KVMFR protocol version as it adds additional
hotspot x & y fields to the KVMFRCursor struct. This corrects the issue
of invalid alignment of the local mouse when the shape has an offset
such as the 'I' beam.
2020-08-20 13:51:01 +10:00
Geoffrey McRae
e3f97e384b [client] rework the start/restart logic to use an enum 2020-08-11 15:14:58 +10:00
Geoffrey McRae
74649ddb96 [client] gracefully restart if the host application restarts 2020-08-11 14:30:44 +10:00
Geoffrey McRae
302b988524 [client] use atomics to track frame counts and avoid extra signals 2020-08-09 15:14:17 +10:00
Samuel Bowman
bd42445ea7 [client] add option to capture input on start 2020-07-17 08:39:32 +10:00
Geoffrey McRae
dedab38b99 [client] rename fpsLimit to fpsMin 2020-05-22 18:15:17 +10:00
feltcat
e3cbdd18a0 [client] add quit keybind 2020-04-23 17:57:58 +10:00
Geoffrey McRae
e554635e48 [spice] turn on TCP_QUICKACK
https://assets.extrahop.com/whitepapers/TCP-Optimization-Guide-by-ExtraHop.pdf
2020-01-11 16:03:28 +11:00
Geoffrey McRae
13f55011c0 [client] don't draw the cursor if it leaves the frame 2020-01-11 12:56:46 +11:00
Geoffrey McRae
05dc713dac [client] more cursor tweaks for better integration with the WM 2020-01-11 06:03:16 +11:00
Geoffrey McRae
80f3c7934a [client] more cursor tweaks and some cleanup 2020-01-11 05:22:12 +11:00
Geoffrey McRae
5b163063c3 [client] improved sync with guest cursor position 2020-01-11 03:41:44 +11:00
Geoffrey McRae
bea7c94cae [client/c-host] updated to use new LGMP naming conventions 2020-01-10 11:01:35 +11:00
Geoffrey McRae
2d755a45e0 [client] added support for LGMP 2020-01-09 20:32:42 +11:00
Geoffrey McRae
45ee79014d [common] added back support for shared memory files 2020-01-06 00:20:30 +11:00
Geoffrey McRae
49bf115c84 [client] fix issue with windowmanager forcing the window size (i3wm) 2020-01-03 16:51:24 +11:00
Geoffrey McRae
2196516e2b [client] added new win:forceAspect option
Fixes #225
2020-01-03 15:53:44 +11:00
Geoffrey McRae
4345d94d68 [client] update client to use the common ivshmem* methods 2020-01-03 15:17:14 +11:00
Geoffrey McRae
ba31c78412 [client] switch from SDL_Thread to lgThread 2020-01-02 23:59:06 +11:00
Geoffrey McRae
e93bd7a3bf [client] fix shutdown race condition with the frame thread 2019-08-30 11:54:26 +10:00
Rokas Kupstys
745ba66119 Implement option to disable minimizing window on focus loss. Default behavior is not changed - not configuring these options unfocused window is minimized.
* Added config entry win:minimizeOnFocusLoss (default true).
2019-07-09 21:57:47 +10:00
Geoffrey McRae
dd7413f973 [client] added keybinds to send Ctrl+Alt+Fn
Fixes #165
2019-05-31 16:39:55 +10:00
Jonathan (JJRcop) Rubenstein
d07aa4b29e [client] Add win:maximize to maximize on startup 2019-05-26 20:47:59 +10:00
Geoffrey McRae
437ebf6265 [client] main: new feature to increase/decrease mouse sensitivity 2019-05-24 05:29:38 +10:00
Geoffrey McRae
84b2917706 [client] app: new options to reduce CPU usage
This patch increases the default cursor and frame polling interval from
1us to 1000us which for most use cases should be more then fast enough.

It also adds two new configuration options to adjust these should it be
required:

  * app:cursorPollInterval
  * app:framePollInterval
2019-05-22 12:00:06 +10:00
Geoffrey McRae
e3c98ddc35 [client] port all configuration parsing to use the new option helper 2019-05-21 15:03:59 +10:00
Geoffrey McRae
35094a57cb [client] more cleanup and added alerts for new events 2019-03-30 12:26:06 +11:00