Commit Graph

1033 Commits

Author SHA1 Message Date
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
vroad
5d5eb47598 [client] egl: do not leak fence when using DMABUF 2021-04-25 14:32:17 +10:00
Quantum
30c3b399f2 [client] wayland: do not leak cursor wl_buffer and wl_surface 2021-04-19 17:03:25 +10:00
Quantum
a380803d37 [client] libdecor: fix gcc compile warnings-turned-errors
This commit fixes the -Wmissing-field-initializers warning, which can only
be disabled with a pragma. GCC wants us to Initialize libdecor reserved
fields, which requires knowing how many reserved fields there are.
This is an implementation detail, and so we can only disable the warning.

This also fixes -Wincompatible-pointer-types, which is an actual bug.
2021-04-19 17:03:13 +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
ba3243f88a [client] wayland: make input handlers aware of multiple surfaces
This prevents input handlers from breaking in presence of subsurfaces,
which are used by libdecor for client-side decorations.
2021-03-15 10:54:35 +11:00
Quantum
d6a290a31d [client] wayland: implement libdecor pseudo-shell backend
This allows decorations to be drawn on GNOME and other crazy compositors
that do not support server-side decorations.
2021-03-15 10:54:35 +11:00
Quantum
82e107af8a [client] cmake: support building with libdecor 2021-03-15 10:54:35 +11:00
Quantum
4031a862df [client] wayland: split xdg-shell handling into a module
This will allow libdecor to be added as a new pseudo-shell.
2021-03-15 10:54:35 +11:00
Quantum
854b53e28c [client] wayland: use consistent naming in poll module
Some of the functions were named WaylandEpoll*, which is inconsistent.
This commit changed them to be WaylandPoll*.
2021-03-03 16:38:23 +11:00
Quantum
fc7dd7dbb7 [common] cmake: correctly link static libbfd.a
When linking against libbfd.so, just passing libbfd.so to the compiler is
sufficient. When linking against the static version libbfd.a, however,
we must additionally link against libiberty.a and libz.a.

This commit adds a CMake helper to find the correct libraries that need
to be passed to link against libbfd correctly.
2021-03-03 16:37:34 +11:00
Tudor Brindus
484012a90c [client] wayland: bind no-op drag-and-drop handlers
Otherwise, libwayland aborts when a drag into the Looking Glass window
occurs.
2021-02-27 14:49:06 +11:00
Tudor Brindus
97009027d1 [client] wayland: require wl_compositor v3 instead of v4
The only addition to v4 was `wl_surface_damage_buffer`, which we do not
use.

This change should allow running on more compositors (even though v4 is
already old -- 5 years now).

Ref
3384f69ecf.
2021-02-27 14:48:40 +11:00
Tudor Brindus
d6b8823dce [client] wayland: gracefully downgrade to wl_output v2
We don't necessarily need `wl_output.release`, which is the only
addition in v3.

This allows Looking Glass to run on Ubuntu 20.04 without having to go
difficult lengths to acquire newer Wayland packages. Since 20.04 is an
LTS release, this seems worthwhile for the small amount of complexity
this introduces.

Fixes
https://forum.level1techs.com/t/latest-build-allow-inhibiting-shortcuts-dialog-ubuntu/168684/6.
2021-02-27 14:48:28 +11:00
Quantum
31c1452451 [client] readme: remove mention of Wayland's lack of warp
We have an implementation of Wayland cursor warping now, so there is no
need for the section saying that Wayland lacks the feature.
2021-02-26 10:29:07 +11:00
Quantum
8c6cff012d [client] readme: remove mention of SDL
SDL is default to off and its usage should not be encouraged, so
-DENABLE_SDL=ON is not mentioned as an option in the README.
2021-02-26 10:28:51 +11:00
Quantum
c34fe10f23 [client] ds: make SDL display server optional
This commit also moved the SDL dependencies into the SDL backend so that
-DENABLE_SDL=NO builds do not link against SDL.
2021-02-26 10:28:51 +11: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
521ac706c1 [client] app: do not toggle capture if escapeKey is held
When users press escapeKey for a long time, they probably want to
see the help text instead of actually toggling capture. Therefore,
if the key is held down for more than 500 ms, we assume the user
wants to look at the help text and do not toggle capture mode.

500 ms seems to be a decent compromise, allowing slow presses, but
is not enough time for the user to have looked at the help text.
2021-02-26 09:59:17 +11:00
Quantum
9886c2bf40 [client] fonts: remove SDL font backend 2021-02-26 09:58:21 +11:00
Geoffrey McRae
c96ee0f786 [client] font: fix left shift runtime error due to signed shift 2021-02-26 09:54:08 +11:00
Quantum
5551420983 [client] wayland: clean up #includes in wayland.c
This was missed when splitting up wayland.c into multiple modules.
This commit also drops the useless #include <SDL2/SDL.h>, bringing
SDL removal one step closer.
2021-02-26 09:44:59 +11:00
Quantum
84e14edfe7 [client] opengl: remove dependency on SDL 2021-02-26 09:44:34 +11:00
Quantum
798a1aadb5 [client] wayland: fail gracefully when interfaces are too old
Before, we just attempt to bind, causing an obscure Wayland error.
This commit checks the interface versions and print better error
messages.
2021-02-26 09:43:38 +11:00
Quantum
1111045546 [client] freetype: implement UTF-8 handling 2021-02-26 09:43:06 +11:00
Quantum
5a075744bd [client] fonts: add freetype font rendering backend 2021-02-26 09:43:06 +11:00
Quantum
2da81e0b5a [client] display correct log path on Windows
We moved it to %ProgramData%\Looking Glass (host), but the client still
says it's in %TEMP%.
2021-02-23 20:28:48 +11:00
Quantum
389d8824e2 [client] wayland: handle output scale changes
If the scale factor of an wl_output changes while the client is running,
the maximum scale factor is not updated. This may result in incorrect
scaling.

Therefore, when the scale factor is changed, we should generate a
resize event.
2021-02-23 20:28:25 +11:00
Geoffrey McRae
8771103abb [client] all: fix more maybe-uninitialized when -O3 is in use
Closes #475
2021-02-23 20:25:30 +11:00
Geoffrey McRae
9e2cfb9106 [client] core: fix reversed logic and document the rationale for it
During the refactor/rebase period with B3-next the conditional was
accidentally reversed. This would cause the cursor to be ungrabbed
simply when toggling capture mode instead of waiting for the cursor to
exit the window.
2021-02-23 20:19:35 +11:00
Geoffrey McRae
a8ab559de0 [client] core: increase autoCapture false exit detection sensitivity
Mouse move deltas greater then 10 are rare, let alone the 20 this code
now uses. Any movements that exceed 20 pixels will disable the exit
detection code path preventing rapid movements in FPV games from causing
the cursor to exit the window if autoCapture is enabled.
2021-02-23 20:06:44 +11:00
Geoffrey McRae
78f4249496 [client] core: remove unnecessary warp and update of cursor location
As we now are using our own backends instead of SDL, there is no longer
any need to warp back to the center of the window when in autoCapture
mode. This breaks the SDL ds backend behaviour, however as SDL is
planned to be removed this is not an issue.
2021-02-23 20:06:44 +11:00
Geoffrey McRae
9ae53aca70 [client] doc: update license output copyright date 2021-02-23 20:06:44 +11:00
Quantum
30b5287c38 [client] egl: add option to set initial scale algorithm
The option is egl:scale. The scale algorithm number is displayed on the
alert to make it easier to specify the number for the option.
2021-02-22 17:25:06 +11:00
Quantum
0512c88ea8 [client] egl: make scale algorithms toggleable
The $escape+S keybinding now cycles through the available scale algorithms.
This allows the user to switch between algorithms if the automatic detection
turns out to be problematic.

The algorithms are renumbered so that 0 can be LG_SCALE_AUTO.
2021-02-22 17:25:06 +11:00
Quantum
46758efc8f [client] cmake: build for nehalem when OPTIMIZE_FOR_NATIVE=NO
We need SSE intrinsics like _mm_stream_load_si128 which is only available
on CPUs of nehalem or newer.
2021-02-22 11:25:44 +11:00
Geoffrey McRae
e79661a924 [client] app: fix format-truncation false positive
This is fixed by using the `valloc_sprintf` function provided in
common/stringutils.h as the functionallity is literally identical.
2021-02-22 01:39:56 +11:00
Geoffrey McRae
28024de314 [client] egl: fix gcc false maybe-uninitialized positives 2021-02-22 01:38:26 +11:00
Quantum
63ec2dc01b [client] egl: destroy cached EGLImages when changing format
Reusing cached EGLImages while the frame format has changed will result
in visual artifacts. We should instead destroy the EGLImages and let
them be recreated.
2021-02-21 19:07:46 +11:00
Quantum
48be58378c [client] opengl: scale UI elements on high DPI displays
This is done by simply scaling up the rendered text bitmap.
2021-02-21 19:06:53 +11:00
Quantum
fd50426dda [client] egl: scale UI elements on high DPI displays
This is done by actually rendering the text at high DPI.
2021-02-21 19:06:53 +11:00