Commit Graph

67 Commits

Author SHA1 Message Date
Geoffrey McRae
facbb54776 [client] x11: create _NET_WM_BYPASS_COMPOSITOR if it doesn't exist
If a compositor has not yet started or is not running the atom
`_NET_WM_BYPASS_COMPOSITOR` may not have yet been created. As such we
need to create it so that if a compositor is started it will see this
propery and honour it.
2021-06-17 11:16:26 +10:00
Quantum
5c00f73d23 [client] x11: use correct spelling of _NET_WM_BYPASS_COMPOSITOR
The incorrect spelling, NETWM_BYPASS_COMPOSITOR, somehow worked in the
past, but it appears to not work right now. Corrgan on Discord reported
the issue and confirmed that changing the spelling allowed the compositor
to be bypassed and the client to update faster than 60 Hz on his mixed
refresh rate setup.
2021-06-07 11:17:06 +10:00
Quantum
24d0aa0c18 [all] normalize copyright on all source files 2021-06-06 11:53:05 +10:00
Geoffrey McRae
9ddfacc1a8 [client] x11: update to support new spice clipboard type list 2021-05-30 11:37:31 +10:00
Geoffrey McRae
118d9a086e [client] x11: implement win:noResize
This is the final fix for #506
2021-05-28 20:16:22 +10:00
Geoffrey McRae
3be645a357 [client] x11: fix BadAtom when pasting large buffers
To start a clipboard incr transfer the client has to delete the INCR
window property as the reply to the selection. This deletion generates a
property change event with the type delete, errornously triggering the
incr processing of the data. This patch corrects this by ignoring
property deletions.
2021-05-27 18:41:54 +10:00
Geoffrey McRae
95ec206b36 [client] x11: cosmetics 2021-05-27 18:41:54 +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
903cc9815f [client] x11/sdl/wayland: implement new minimize (stub for wayland)
This implements the new minimize function introduced in the last commit
for x11 and SDL. Wayland at current is just a stub and needs some
attention.
2021-05-06 22:25:38 +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
7acbc57bc7 [client] x11: remove pointer motion event mask
This was added as a test when developing the overlapping window code and
is not needed/used.
2021-05-04 18:11:30 +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
4c0c8f804f [client] x11: cosmetics 2021-04-29 12:26:18 +10:00
Geoffrey McRae
3912d3411c [client] x11: process clipboard events early
Due to the logic in the event loop property events may get filtered out
that were clipboard related. This changes ensures the clipboard event
handler code gets to run first avoiding this issue.
2021-04-29 12:24:23 +10:00
Geoffrey McRae
9015706fcb [client] x11: fix failure to paste clipboard into the guest
The clipboard atoms may not exist yet and as such we must create them if
this is the case. Failure to do so results in `SEL_DATA` being zero
breaking the clipboard paste mechanics
2021-04-29 12:22:54 +10:00
Geoffrey McRae
ae36abb1ca [client] x11: fallback to a utility window if motif atom is missing
If the window manager does not support the motif hints then fallback to
creating a utility window, do not do both. A utility window is a
sub-optimal fallback as it may prevent the application being shown in
the taskbar or as a running application as has been reported on KDE.
2021-03-27 21:42:47 +11:00
Mikko Rasa
358515f4a8 [client] x11: Find and use the correct valuators for mouse axes
Using the first two valuators present in the event is incorrect.  Events
with only one valuator set, such as those sent by the Xorg evdev driver
when the mouse moved along one axis only, were being discarded.  On the
other hand, mice with multiple scroll wheels may be able to emit events
with two scroll wheel valuators set.

The XInput2 specification is light on details, but "Rel X" and "Rel Y"
appear to be the de facto standard names for the motion valuators.  If
valuators with those labels are not found, fall back to using valuators
with numbers 0 and 1.
2021-03-27 21:12:52 +11:00
Geoffrey McRae
d74307223f [client] x11: set the window center via WM_SIZE_HINTS
Due to the confusing nature of the x11 protocol, bit_gravity and
win_gravity are not what they appear to be. These do not describe the
window position but rather the pixels/subwindows when the window is
resized. Instead set the gravity via the WM_SIZE_HINTS property which
all modern window managers should respect.
2021-03-27 21:05:27 +11:00
Geoffrey McRae
5aa7a391ac [client] x11: implement center, borderless and maximized parameters 2021-03-27 11:17:48 +11:00
Geoffrey McRae
1bf9fb7d73 [client] x11: fix segfault caused by clipboard processing on shutdown 2021-03-27 10:06:57 +11:00
Geoffrey McRae
84d4c18c48 [client] x11: split out atoms into a seperate structure 2021-03-27 10:05:57 +11:00
Geoffrey McRae
2f14d64289 [client] x11: split out clipboard code for maintainabillity 2021-03-27 09:21:32 +11:00
Geoffrey McRae
ab4d7cb94b [client] x11: _NET_WM_* hints are ATOMS not CARDINAL
This fixes the fullscreen and likely borderless issue too that people
have been reporting on X11 under gnome. Thanks to tdb in discord for
spotting the error.
2021-03-25 09:29:06 +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
Geoffrey McRae
5454053d96 [client] x11: set the window class name 2021-02-21 10:31:48 +11:00
Geoffrey McRae
17d423db06 [client] x11: handle window deletion properly 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
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
06af101bf9 [client] x11: properly handle window destruction and fullscreen support 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
740dad943b [client] x11: cleanup on failure to initialize 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
cfa9171465 [client] x11: don't report borders if in fullscreen mode 2021-02-21 10:31:48 +11:00
Geoffrey McRae
2eac3dcb56 [client] x11: implemented missing functionallity 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
9674421ce4 [client] x11: fix double initialization of event members 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
8caf951c41 [client] x11: don't attempt to grab the pointer on window resize 2021-01-25 09:25:01 +11:00
Geoffrey McRae
ef54e1be7f [client] x11: add error checking around XIGrabDevice 2021-01-25 06:52:23 +11:00
Geoffrey McRae
4c1893fe20 [all] fix numerous memory leaks at application shutdown 2021-01-24 21:47:53 +11:00
Geoffrey McRae
d6f39d66bf [client] x11: xi is now a required library for the x11 backend 2021-01-20 15:33:34 +11:00
Geoffrey McRae
ee8c883201 [client] x11: implement screensaver (un)inhibit 2021-01-20 15:24:10 +11:00
Geoffrey McRae
d1043e590a [client] x11: register for absolute motion events while grabbed 2021-01-20 05:51:18 +11:00