Commit Graph
798 Commits
Author SHA1 Message Date
Geoffrey McRae a00a6429d3 [client] app: fix spelling error 2021-02-21 10:31:48 +11:00
Geoffrey McRae 4e1c0cc0d0 [client] ds: refactor app and cursor state into app.c and core.c 2021-02-21 10:31:48 +11:00
Geoffrey McRae 33fed48277 [client] app: fix broken mouse sensitivity 2021-02-21 10:31:48 +11:00
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
Quantum ecebcc4c35 [client] opengl: make ds functions optional
Using a macro ENABLE_OPENGL just like ENABLE_EGL to optionally remove
OpenGL implementation code. This is mostly because on Wayland it's just
a rehash of the EGL code (as EGL is the only way to create OpenGL
contexts on Wayland).
2021-02-21 10:31:48 +11:00
Geoffrey McRae 973806dd9c [client] opengl: implement & fix opengl support 2021-02-21 10:31:48 +11:00
Geoffrey McRae 4dfe4b8e2b [client] allow renderers to pass back if they need an OpenGL context 2021-02-21 10:31:48 +11:00
Geoffrey McRae cc521eab90 [client] app: fix reversed ds init logic 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 8919d2718f [client] egl: fix building without EGL support 2021-02-21 10:31:48 +11:00
Quantum 9f0b99dac0 [client] wayland: implement window creation for egl
This commit implements window creation and resize logic, allowing the desktop
to be drawn.
2021-02-21 10:31:48 +11:00
Geoffrey McRae f4c1927f56 [client] ds: added new getFullscreen operation
As the window manager may change our mode to full screen without our
request we must ask the ds backend for the current state when we want to
toggle the mode.
2021-02-21 10:31:48 +11:00
Geoffrey McRae 2d1e3c8022 [client] ds: validate the ds before attempting to use it 2021-02-21 10:31:48 +11:00
Geoffrey McRae f8ac860fde [client] app: rearrange code to reflect the header 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 6b1e310343 [client] move remaining code in core.c into the SDL 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 6f1c19b3b0 [all] improve backtrace and debugging support 2021-02-21 10:30:57 +11:00
Quantum ec921d7f39 [client] spice: correctly ungrab keyboard when grabKeyboardOnFocus=no
When input:grabKeyboardOnFocus=no, exiting capture mode should ungrab
the keyboard. Otherwise, focusing the window doesn't grab the keyboard,
but toggling capture mode would leave the keyboard stuck in a grabbed
state until defocused.
2021-02-09 20:06:27 +11:00
Tudor Brindus e6ebcec689 [client] spice: don't send zero deltas for Wayland input
While a compositor will never send us 0-delta motion events, they can
still end up as 0-deltas post-projection, consuming QEMU buffer space
for no reason.

This should help with mouse skipping issues.
2021-02-01 11:09:46 +11:00
Geoffrey McRae e951aaad2d [client] spice: fix errant keyboard grab/ungrab behaviour 2021-01-30 12:01:20 +11:00
Quantum 4fbaf18c89 [client] update host log file path 2021-01-29 15:56:01 +11:00
Geoffrey McRae 05f2305fa0 [client] correct error in variable name from last commit 2021-01-28 09:04:52 +11:00
Geoffrey McRae b76fedeb67 [client] all: don't trigger cursor redraws if the cursor is not visible 2021-01-28 08:58:59 +11:00
Geoffrey McRae 837858c214 [client] prevent lgInit from resetting the run state
If the renderer fails to start it sets the run state to stopped, having
lgInit where it was causes this to be reset to running triggering
invalid usage of g_state.lgmp.
2021-01-25 15:25:52 +11:00
Tudor Brindus 941c651fad [client] unconditionally quit on second SIGINT
Under some circumstances, Looking Glass can hang when SIGINT'd, for
instance, if it's stuck waiting on spice I/O that won't complete because
the guest is misbehaving.

This commit provides an escape hatch for such cases, so one doesn't have
to reach for `kill -9 $(pidof looking-glass-client)`.
2021-01-25 09:39:35 +11:00
Geoffrey McRae 185c7764ba [client] spice: always show the pointer if using input:captureOnly 2021-01-21 17:36:22 +11:00
Geoffrey McRae 4113294d30 [client] spice: fix failure to ungrab the kb with captureOnly 2021-01-21 17:32:44 +11:00
Geoffrey McRae aa92a7a90d [client] app: fix error: ‘dataSize’ may be used uninitialized (take 2) 2021-01-21 17:25:53 +11:00
Geoffrey McRae c83243f22c [client] app: fix error: ‘dataSize’ may be used uninitialized 2021-01-21 17:21:24 +11:00
Geoffrey McRae 23e883f60f Revert "[client] sdl: move SDL specific screensaver inhibit"
This reverts commit afb0146d33.
Additional handling is required to implement this properly, postpone
this for Beta 4
2021-01-21 15:58:37 +11:00
Geoffrey McRae dcd0cb7d8e [client] spice: release the mouse if the host stops 2021-01-21 15:39:15 +11:00
Geoffrey McRae 29ea8ecf6b [client] app: if spice is not in use, hide the local cursor (fixes #415) 2021-01-21 14:17:31 +11:00
Geoffrey McRae afb0146d33 [client] sdl: move SDL specific screensaver inhibit out of main.c 2021-01-21 14:03:05 +11:00
Quantum 3385438095 [client] wm: use correct logic for screensaver inhibition
Namely, we should inhibitIdle if noScreensaver is true, not the other way
around.
2021-01-21 12:14:38 +11:00
Quantum 6077dcc123 [client] spice/wayland: fix jitter when moving the cursor slowly
It does not make sense to accumulate fractional error in non-capture mode
as you know exactly where the cursor is supposed to be, at least on Wayland.

On Wayland, we base movements on the current guest position and desired
target position, and the accumulated errors only skew our movements.
2021-01-20 22:54:08 +11:00
Geoffrey McRae e758f88519 [client] spice: fix failure to align and grab the pointer 2021-01-20 22:45:48 +11:00
Geoffrey McRae 3bccd9c45e [client] spice: input:captureOnly shouldn't capture the pointer at start 2021-01-20 22:16:03 +11:00
Geoffrey McRae 947ba9bfe3 [client] spice: fix input:captureOnly support 2021-01-20 22:12:39 +11:00
Geoffrey McRae 8fa2b5f368 [client] config: make the help text for winRotate more descriptive 2021-01-20 15:35:13 +11:00
Geoffrey McRae d1043e590a [client] x11: register for absolute motion events while grabbed 2021-01-20 05:51:18 +11:00
Geoffrey McRae f883c630f6 [client] spice: set inView false if the focus is lost
Failure to do this results in loss of input on X11 as we need to be sure
the cursor is ungrabbed.
2021-01-20 05:07:55 +11:00
Geoffrey McRae ac3333c0d2 [client] x11: switch to using XInput2 for all events and warp
On platforms like KDE, mixing X core events with XInput2 events causes
issues, so just switch entirely over to XInput2.
2021-01-20 04:53:43 +11:00
Geoffrey McRae da65c47245 [client] spice: fix transposed cursor scale calculations 2021-01-20 04:53:43 +11:00
Xiretza 31ea93dd0d [client] Fix compiler warnings about potentially uninitialized variables
Build failed with _FORTIFY_SOURCE enabled because the compiler couldn't
ensure the switch statements didn't hit the default arm and thus wouldn't
define the variables. Adding a statically failing assert makes sure that
all code paths either define the variables or fail early.

$ cd client
$ env CFLAGS='-O1 -D_FORTIFY_SOURCE=1' cmake -B build/
$ make -C build
[...]
client/renderers/EGL/egl.c: In function ‘egl_calc_mouse_size’:
client/renderers/EGL/egl.c:299:36: error: ‘h’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  299 |         (this->mouseHeight * (1.0f / h)) * this->scaleY
      |                              ~~~~~~^~~~
2021-01-20 03:05:30 +11:00