Commit Graph

85 Commits

Author SHA1 Message Date
Geoffrey McRae
a34d3bbab4 [client] overlay: windowRects is not an array of pointers 2021-07-22 14:48:08 +10:00
Geoffrey McRae
2310920e79 [client] overlay: added new interface for overlay windows using ImGui 2021-07-22 14:42:54 +10:00
Geoffrey McRae
6389a06903 [client] main: let the renderer know if it's rendering a whole new frame
While the renderer can internally track this it would be better to
simply provide this information to the renderer directly so it can make
better decisions on how best to update the screen.
2021-07-21 17:26:48 +10:00
Quantum
0cbc529640 [client] ds: refactor common EGL swap with damage logic
This commit creates a new utility library, eglutil.h, which contains code
to detect and use EGL_KHR_swap_buffers_with_damage or its EXT equivalent.

This logic used to be duplicated between the X11 and Wayland display servers,
which is not ideal.
2021-07-19 19:35:52 +10:00
Geoffrey McRae
2de9912ac0 [client] egl: EGL_KHR_swap_buffers_with_damage returns EGLBoolean 2021-07-19 13:32:56 +10:00
Quantum
7c872d2d9e [client] egl: properly use OpenGL ES
Instead of using the desktop <GL/gl.h>, we properly use the OpenGL ES 3.x
headers. Also, we now use GL_EXT_buffer_storage for MAP_PERSISTENT_BIT_EXT
and MAP_COHERENT_BIT_EXT as the core versions are only available in desktop
OpenGL 4.4. Similarly, we need GL_EXT_texture_format_BGRA8888 for GL_BGRA_EXT
as GL_BGRA is desktop-only.
2021-07-18 20:44:32 +10:00
Geoffrey McRae
ab31040d5f [client] all: use imgui for FPS/UPS display 2021-07-18 20:43:17 +10:00
Quantum
42d8f31eba [client] imgui: use ES 3.0 and remove glew dependency
If we specifically tell ImGui's OpenGL 3.x backend to target OpenGL ES 3.0,
then no extension loader is necessary.
2021-07-18 18:50:12 +10:00
Quantum
c6a6230a56 [client] egl: revert "only copy damaged areas when using dmabuf"
This reverts commit a14de25661.
Frame is sometimes incorrect.
2021-07-18 18:48:35 +10:00
Quantum
a14de25661 [client] egl: only copy damaged areas when using dmabuf
This speeds up the copy significantly when the frame only has small
amount of damage.
2021-07-18 17:41:29 +10:00
Quantum
15bc6a1509 [client] imgui: support registering new graphs
Currently, our struct ll doesn't support removing elements from the middle,
so we will not be removing anything for now.
2021-07-18 16:15:10 +10:00
Quantum
f49f2af6cd [client] egl: implement error reporting callback
This reports useful information from OpenGL on supported platforms.
2021-07-18 13:54:16 +10:00
Quantum
12cb3e512f [client] util: add function for merging overlapping rectangles
This will be used to merge overlapping rectangles in order to avoid copying
the same rectangles multiple times.
2021-07-18 10:41:50 +10:00
Quantum
442ab318fd [client] egl: use desktop frame damage information 2021-07-18 10:41:50 +10:00
Geoffrey McRae
f08163fd72 [client] imgui: added imgui to the client and OpenGL/EGL renderers 2021-07-17 21:09:51 +10:00
Quantum
24d0aa0c18 [all] normalize copyright on all source files 2021-06-06 11:53:05 +10:00
Geoffrey McRae
28640295f1 [client] spice: update to support sending clipboard type list 2021-05-30 11:37:15 +10:00
Quantum
e70cfd84fb [client] egl: use eglSwapBuffersWithDamageKHR for cursor-only updates
Instead of damaging the entire surface when rendering a cursor move,
we can use the EGL_KHR_swap_buffers_with_damage extension to only
damage the part of the window covered by the cursor. This should
reduce the cursor movement latency on Wayland.
2021-05-19 18:56:36 +10:00
Quantum
f9a9953071 [client] egl: use new util_hasGLExt helper to check extensions
We previously used strstr, which can be prone to false positives when
the name of one extension is a substring of another extension.

This commit creates the helper function util_hasGLExt, which asserts
that the substring found in extension list is bounded by either spaces
or the beginning/end of the string.
2021-05-19 15:58:54 +10:00
Geoffrey McRae
f698e4589d [client] ds: add new minimize function to the ds interface
This change is to allow the application to minimize the window on focus
loss if the user's preferences are configured to do this.
2021-05-06 22:24:42 +10:00
Quantum
0f2fd84724 [client] ds: avoid util_cursorToInt when warping pointer
Using util_cursorToInt messes with the error tracking for normal movements,
and is not necessary since we are computing an absolute position on the
client window.

Instead, we should pass doubles directly to display servers and let them
decide how to best handle them. For example, XIWarpPointer accepts doubles
directly.
2021-05-04 19:02:13 +10:00
Quantum
00c2773e6b [client] ds: separate grab and capture logic
Currently, (un)grabPointer is used both for tracking/confining the mouse
in normal mode, as well as entering/exiting capture mode. This makes it
impossible to use separate cursor logic for capture mode, which is needed
to deal with overlapping windows for the Wayland backend.

This commit creates separate (un)capturePointer for entering/exiting
capture mode. There should be no behaviour changes.
2021-05-04 18:17:19 +10:00
Geoffrey McRae
d0a12f6097 [client] ds: detect when the cursor exits into an overlapping window
This adds a new method to the display server interface to allow the
application to notify the ds when there is a guest cursor position
update along with the translated local guest cursor position. This makes
it possible for the display server to keep the local cursor position in
sync with the guest cursor so that window leave events can be detected
when the cursor would move into an overlapping window.

Wayland currently just has a stub for this, and the X11 implementation
still needs some minor tweaking.
2021-05-04 06:35:36 +10:00
Geoffrey McRae
f3b46e6d4f [client] app: delay showing the escape help for 250ms
This change prevents the help text being shown unless the escape key has
been held for a minimum of 250ms (reduced from 500ms).
2021-02-26 10:21:56 +11:00
Quantum
b35e19fc27 [client] renderer: add interface for high DPI rendering 2021-02-21 19:06:53 +11:00
Quantum
1ba1108099 [client] wayland: add option to enable cursor warp
This is enabled on default. Specify wayland:warpSupport=no to disable it,
which may be useful on certain compositors that do not warp when the
pointer is confined.
2021-02-21 10:31:49 +11:00
Quantum
270631f1b9 [client] ds: add surface-only warp variant
This commit converts the output of ds->getProp(LG_DS_WARP_SUPPORT) to
an enum containing three items:

* LG_DS_WARP_NONE: warp is not supported at all
* LG_DS_WARP_SURFACE: warp is possible, but only inside the window
* LG_DS_WARP_SCREEN: warp is possible anywhere on the screen

LG_DS_WARP_NONE corresponds to the old false return value, and
LG_DS_WARP_SCREEN corresponds to the old true return value.

LG_DS_WARP_SURFACE is designed for Wayland, where warping is possible,
but only in our window. In this case, since we cannot warp outside
the window, we can warp the cursor to the edge when we attempt to exit.
If the cursor leaves, the normal leave routine gets called, and the
cursor disappears. If the cursor does not end up leaving, we grab it
again.
2021-02-21 10:31:49 +11:00
Quantum
89b73512ad [client] renderer: add ability to toggle the FPS display
Before, if you want to see the FPS, you need to close the client and
restart it with the -k switch to see the FPS. This is annoying.

This PR introduces a new keybind, ScrollLock+D, which, when pressed,
toggles the display of the FPS.

This is implemented for both EGL and OpenGL backends.
2021-02-21 10:31:48 +11:00
Quantum
96dc8c602c [client] keybind: display help overlay while ScrollLock is held
This overlay will show the list of keybindings.
2021-02-21 10:31:48 +11:00
Quantum
ead8069dae [client] keybind: add descriptions for all keybindings 2021-02-21 10:31:48 +11:00
Quantum
5dce97264b [client] renderers: add on_help to renderer interface
This will be used to tell a render to display a help message.
2021-02-21 10:31:48 +11:00
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
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
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
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
819562d906 [client] fix keybind regression for EGL 2021-01-19 21:12:20 +11:00