Commit Graph

80 Commits

Author SHA1 Message Date
Camilla Löwy
738b1c73b5 Wayland: Remove superfluous global struct member
It seems unlikely that strlen will be a bottleneck when sending
clipboard contents.
2022-04-03 18:14:50 +02:00
Camilla Löwy
bb9d699ae6 Share X11 fd polling logic with Wayland
This moves the X11 polling implementation to a separate file where it
can be used by either the X11 or Wayland backend or both.

This code should be POSIX compatible where necessary but will use the
lower latency but non-standard polling functions ppoll or pollts where
those are available.

This commit is based on work by OlivierSohn and kovidgoyal.

Fixes #1281
Closes #1285
2022-03-03 22:23:57 +01:00
Camilla Löwy
1a7da42e6e Wayland: Fix text input not following key repeat
The manual key repeat implementation did not call text input.
2021-12-31 13:30:16 +01:00
Camilla Löwy
293d19a153 Wayland: Require xkbcommon 0.5.0 or greater
The Wayland backend now requires xkbcommon-compose, which was added in
version 0.5.0.  xkbcommon 0.5.0 was released in 2014.

This removes the non-composing fallback path for text input.
2021-12-31 13:27:22 +01:00
Camilla Löwy
17a9e34fbc Wayland: Implement key name support 2021-12-31 13:27:22 +01:00
Camilla Löwy
56a4cb0a3a Add runtime platform selection
This adds compile-time support for multiple platforms and runtime
detection of them.  Window system related platform functions are now
called from shared code via the function pointer struct _GLFWplatform.

The timer, thread and module loading platform functions are still called
directly by name and the implementation chosen at link-time.  These
functions are the same for any backend on a given OS, including the Null
backend.

The platforms are now enabled via CMake dependent options following the
GLFW_BUILD_<platform> pattern instead of a mix of automagic and ad-hoc
option names.  There is no longer any option for the Null backend as it
is now always enabled.

Much of the struct stitching work in platform.h was based on an earlier
experimental branch for runtime platform selection by @ronchaine.

Every platform function related to windows, contexts, monitors, input,
event processing and Vulkan have been renamed so that multiple sets of
them can exist without colliding.  Calls to these are now routed through
the _glfw.platform struct member.  These changes makes up most of this
commit.

For Wayland and X11 the client library loading and display creation is
used to detect a running compositor/server.  The XDG_SESSION_TYPE
environment variable is ignored for now, as X11 is still by far the more
complete implementation.

Closes #1655
Closes #1958
2021-10-13 21:47:11 +02:00
Camilla Löwy
b7d0c6037d Make dynamic module loading part of platform API
This is part of the preparations for runtime platform selection.
2021-10-12 12:54:36 +02:00
Camilla Löwy
efe764b492 Remove blank line before the end of some structs 2021-10-12 12:54:35 +02:00
Waris Boonyasiriwat
e7758c506d Wayland: Fix cursor offset when shape changes
The Wayland protocol spec[1] states that set_cursor must be called
with the serial number of the enter event.  However, GLFW is passing in
the serial number of the latest received event, which does not meet the
protocol spec.

[1] https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_pointer

As a result, set_cursor calls were simply ignored by the compositor.

This fix complies with the protocol more closely by specifically caching
the enter event serial, and using it for all set_cursor calls.

Fixes #1706
Closes #1899
2021-09-02 19:09:33 +02:00
Camilla Löwy
85348c67cd Wayland: Load functions for new atomic marshalling
The wayland-scanner program recently changed how it generates
marshalling, requiring a couple of new core functions.

Fixes #1949.
2021-08-19 18:55:35 +02:00
Camilla Löwy
dffe203c17 Wayland: Make libwayland-client dynamically loaded
The insight to use wayland.xml to resolve the difficult-to-redirect
interface symbols was gleaned from SDL.

Instead of compiling the code output of wayland-scanner separately it is
made part of the wl_init compilation unit.  This lets us do things like
transparently rename our copies of Wayland globals.

The OS version of wayland-client-protocol.h is no longer used by GLFW,
but it is presumably ABI compatible with the output of wayland-scanner.

Closes #1174.
Closes #1338.
Related to #1655.
Closes #1943.
2021-08-15 21:58:19 +02:00
Camilla Löwy
bcb8558189 Remove EGL and OSMesa struct member macros
Now that the EGL and OSMesa structs can be used safely by any platform,
the member macros serve no purpose.
2020-06-24 00:50:49 +02:00
Camilla Löwy
d7f7b0e1b5 EGL: Replace native handle macros with functions
This change is in preparation both for EGL_EXT_platform_base and runtime
GLFW platform selection.

Related to #1691.
2020-06-24 00:48:53 +02:00
Emmanuel Gil Peyrot
a9f674e719 Wayland: Don’t reload the cursor on every pointer motion
Previously, any pointer motion in the window decorations when using the
fallback implementation would obtain the wl_cursor again, and do the
attach danse for no benefit.

This will ultimately allow animated cursors to not reset to the first
frame on motion, once these will be implemented.
2019-11-21 13:52:37 +01:00
Corentin Wallez
3a37a08998 Fix -Wextra-semi warnings
Closes #1440.
2019-10-17 20:09:38 +02:00
Luflosi
d25248343e Use the correct type for a struct member
The `name` member in the `_GLFWmonitorWayland` struct is used in two places. It is assigned the value from a variable of type `uint32_t` and is compared to another variable of type `uint32_t`, so `name` should also have the same type.

Closes #1569.
2019-10-06 17:36:46 +02:00
Emmanuel Gil Peyrot
599fb3de34 Wayland: Remove wl_shell support
This protocol is part of the core Wayland, but it is pretty badly
designed and is missing quite a few features, and is in the process of
being phased out in compositors.  Its support in GLFW requires
duplicating pretty much every single window management codepath.

This bumps the required compositor versions to the ones which have
implemented xdg-shell, approximately two years ago, which seems sensible
to me.
2019-04-20 10:05:15 +02:00
Camilla Löwy
a337c56848 Start 3.4 2019-04-16 23:08:39 +02:00
Emmanuel Gil Peyrot
45bd991ea9 Wayland: Fix auto-iconify on kwin_wayland
We now keep track of the fullscreen and activated state and only iconify
if we were previously fullscreen and now we are either not fullscreen or
not activated anymore.

This is the proper way to do it, compared to the previous hack where we
didn’t iconify only if it was the first configure event received.
2019-02-15 18:12:09 +01:00
Emmanuel Gil Peyrot
c08abffc50 Wayland: Implement clipboard copy 2018-10-24 14:03:08 +02:00
Emmanuel Gil Peyrot
8b54e28c4e Wayland: Implement clipboard paste 2018-10-24 14:03:08 +02:00
Emmanuel Gil Peyrot
3c4b9a7eef Wayland: Add boilerplate for clipboard handling 2018-10-24 14:03:08 +02:00
Ricardo Vieira
92b3fd02e5 wayland: save serial from all input sources 2018-10-24 14:03:08 +02:00
Emmanuel Gil Peyrot
dcd2a19d90 Wayland: Add support for xdg-decoration
This allows compositors which prefer to draw the decorations around
clients to do so, rather than letting GLFW draw its own decorations.
The appearance is thus entirely subject to the compositor used, but
should generally be better than the current solid colour decorations we
have, which we continue to use when the compositor doesn’t support this
protocol or tells us to draw the decorations ourselves.

This new protocol has been tested against wlroots’s rootston compositor.

Fixes #1257.
2018-10-01 16:37:24 +02:00
Emmanuel Gil Peyrot
15cad02235 Wayland: Use HiDPI cursors for standard cursors 2018-09-11 14:28:44 +02:00
Emmanuel Gil Peyrot
321062833a Wayland: Load a bigger cursor theme for HiDPI 2018-09-11 14:28:44 +02:00
Emmanuel Gil Peyrot
5ea6e6cda2 Wayland: Add support for animated standard cursors 2018-09-09 13:12:20 +02:00
Emmanuel Gil Peyrot
dede6d6886 Wayland: Add a timerfd for animated cursors 2018-09-09 13:12:20 +02:00
Greg V
0a3c4f5d80 Add support for Wayland on FreeBSD and other OSes 2018-03-27 22:03:37 +02:00
Emmanuel Gil Peyrot
60e82ba472 Handle scaling factor (hidpi) correctly 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
9f7ec6b094 Implement window decorations 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
552e40a4be Add wl_subcompositor support 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
79e16baca3 Add wp_viewporter support 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
d6b9d00ceb Wayland: Handle monitor removal 2018-02-24 22:18:39 +01:00
Emmanuel Gil Peyrot
8bc0c5c2c0 Wayland: dlsym() xkb_keymap_key_repeats 2018-02-24 21:06:25 +01:00
Emmanuel Gil Peyrot
90f5edc0b8 Wayland: Use a timerfd for key repeat 2018-02-24 21:06:25 +01:00
Emmanuel Gil Peyrot
c14a35e21e Wayland: Obtain keyboard repeat_info
This had to bump the seat version, we now may get the seat name but we
don’t do anything with it.
2018-02-24 21:06:25 +01:00
Emmanuel Gil Peyrot
eb7c9994bf Prevent auto-iconify from firing on window creation 2018-01-29 03:59:47 +01:00
Emmanuel Gil Peyrot
73567ae5be Wayland: Add xdg-shell to the platform 2018-01-29 03:59:47 +01:00
Emmanuel Gil Peyrot
407a3e2860 Load libwayland-cursor at runtime 2018-01-29 02:34:10 +01:00
Emmanuel Gil Peyrot
5fbf4ddde8 Load libwayland-egl at runtime 2018-01-29 02:34:10 +01:00
Camilla Löwy
ee9dffcd66 Add GLFW_HOVERED for polling cursor hover state
This window attribute corresponds to the cursor enter/leave callback.

Fixes #1166.
2018-01-09 18:02:52 +01:00
Camilla Löwy
0e8c4ea7ce Add lock key modifier bits input mode
This adds the GLFW_MOD_CAPS_LOCK and GLFW_MOD_NUM_LOCK modifier bits.
Set the GLFW_LOCK_KEY_MODS input mode to enable these for all callbacks
that receive modifier bits.

Fixes #946.
2017-12-06 18:01:34 +01:00
Emmanuel Gil Peyrot
65166858ff Wayland: Add support for the idle-inhibit protocol
Closes #955.
2017-11-20 22:27:37 +01:00
Emmanuel Gil Peyrot
d18431338a Wayland: Disable the compose key on old xkbcommon 2017-11-20 18:24:30 +01:00
Emmanuel Gil Peyrot
a7a70cf34d Wayland: Add dynamic loading of libxkbcommon 2017-10-30 12:01:17 +00:00
Emmanuel Gil Peyrot
95e282d5a0 Wayland: Add transparency support
Closes #788.
2017-10-01 01:39:27 +01:00
Camilla Löwy
a3007b9b0e Rename thread source files
This to reflect that they now contain more than TLS.
2017-06-08 16:09:14 +02:00
Camilla Löwy
372e908682 Remove internal header inclusion guards
Inclusion of internal headers is already both centralized and follows
strict rules.  Inclusion guards are both an unneccessary maintenance
burden and may hide inclusion order bugs.
2017-05-25 19:35:13 +02:00
Emmanuel Gil Peyrot
0e0862cfc7 Wayland: Fix broken build
Regression caused by e9560ef021.
2017-03-03 17:51:40 +00:00