Commit Graph

3051 Commits

Author SHA1 Message Date
Camilla Löwy
29b7669bc6 Wayland: Fix transition to server-side decorations 2022-06-21 21:49:06 +02:00
Camilla Löwy
f35e2274cb Wayland: Fix GLFW_DECORATED for XDG decorations
On a compositor that supports server-side decorations, they were always
enabled in windowed mode, even if GLFW_DECORATED was cleared.
2022-06-21 21:49:06 +02:00
Camilla Löwy
3203599cac Wayland: Fix map before XDG decoration configure
If the xdg_toplevel has a decoration, we need to wait for its first
configure event as well before we are allowed to attach the first
buffer.

It seems racy to assume that this will always happen inside the first
surface configure sequence, so this commit makes that condition
explicit.  This may turn out to have been overly defensive.
2022-06-21 21:49:06 +02:00
Camilla Löwy
2df0ce07fa Wayland: Store and act on XDG decoration mode
Refer to the XDG decoration mode (or the lack of one) directly instead
of setting a boolean in a struct meant for the fallback decorations.

This makes things a bit more verbose but is in preparation for
a refactoring of all decoration paths.
2022-06-21 21:49:06 +02:00
Camilla Löwy
83a134a92f Wayland: Fix mapping failure on wlroots compositor
When showing a window that had already been shown once (and so already
had its shell objects), GLFW would attach a new buffer and commit it
before waiting for the next configure event.  This was a violation of
the XDG shell protocol.

This was allowed to work as intended on GNOME and KDE without error.
However wlroots based compositors would (correctly) emit an error.

Unfortunately, I haven't been able to find a way to get both KDE, GNOME
and Sway to send the configure event we need in order to map the
wl_surface again while keeping our existing shell objects, so with this
commit we now create them for each call to glfwShowWindow and destroy
them for each call to glfwHideWindow.

Fixes #1268
2022-06-21 21:49:05 +02:00
Camilla Löwy
eb9c3bee71 Wayland: Rename fallback decoration functions
We are soon going to have three kinds of decorations; XDG, libdecor and
our last resort fallback ones.
2022-06-21 21:47:35 +02:00
Camilla Löwy
0cd1916de3 Wayland: Remove function only called once 2022-06-21 21:47:35 +02:00
Camilla Löwy
77819c0c54 Wayland: Fix maximized state lost while hidden
If a window was created as maximized, or created as hidden and then
iconified or maximized before first being shown, that state was lost and
the window was shown as restored.
2022-06-21 21:47:35 +02:00
Camilla Löwy
e52046955d Wayland: Cleanup 2022-06-21 21:47:35 +02:00
Camilla Löwy
55fcfb1bb6 Wayland: Fix error for setting GLFW_FLOATING 2022-06-21 21:47:35 +02:00
Camilla Löwy
203002ef2c Wayland: Fix latent bug for glfwGetWindowTitle 2022-06-21 21:47:35 +02:00
Camilla Löwy
85f5a51912 Wayland: Fix events emitted before ack_configure
Window iconfication and maximization events were being emitted before
xdg_surface::configure, making it possible for user code to indirectly
commit surface changes from those event callbacks before
xdg_surface::ack_configure.

This postpones those events until after the ack has been sent.
2022-06-21 21:47:35 +02:00
Camilla Löwy
9ad9f5c52a Wayland: Fix missing error reporting 2022-06-21 21:47:32 +02:00
Camilla Löwy
5002522f73 Wayland: Cleanup
Make Wayland code use 'native' in the same senses as the rest of GLFW.
2022-06-21 21:44:15 +02:00
Camilla Löwy
91f18fb576 Wayland: Fix error from glfwSetWindowAspectRatio
The aspect ratio was applied during resize but any call to
glfwSetWindowAspectRatio emitted a GLFW_FEATURE_UNIMPLEMENTED error.
2022-06-21 20:46:06 +02:00
Camilla Löwy
e37ba80b13 Wayland: Fix reporting of monitor scale changes
Content scale events would be emitted when a window surface entered or
left an output, but not when one of a window's current outputs had its
scale changed.
2022-06-21 20:46:06 +02:00
Camilla Löwy
c3ad3d49ed Wayland: Fix duplicate monitor connection events
GLFW would report a monitor as connected each time its wl_output
received an update, for example if its scale changed.

This would also cause the monitor to be added to the monitor array
again, causing glfwTerminate to segfault when it attempted to destroy
its already destroyed wl_output.
2022-06-21 20:46:06 +02:00
Camilla Löwy
209f6cf093 Wayland: Add support for wl_output::name
We now use wl_output::name as the GLFW monitor name, on compositors that
provide this event.
2022-06-21 20:44:52 +02:00
Camilla Löwy
33d37782c6 Wayland: Cleanup 2022-06-21 16:00:33 +02:00
Camilla Löwy
229d628ec4 Wayland: Fix toggling of server-side decorations
This is a temporary local fix to have updates to GLFW_DECORATED mostly
work as intended.  The whole decoration state machine needs to be
restructured, but not by this commit.
2022-06-21 16:00:33 +02:00
Camilla Löwy
c28d420060 Wayland: Remove duplicate fullscreen check
This check is already performed in shared code.
2022-06-21 16:00:20 +02:00
Camilla Löwy
18df0baea6 Wayland: Cleanup 2022-06-20 00:57:17 +02:00
Camilla Löwy
a7b6f35500 Wayland: Fix size limits for fallback decorations
The size limits set on our XDG surface did not include the sizes of the
fallback decorations on all sides, when in use.  This led to its content
area being too small.

Related to #2127
2022-06-20 00:57:17 +02:00
Camilla Löwy
0f5b095042 Wayland: Fix erratic fallback decoration behavior
The handler for xdg_toplevel::configure treated the provided size as the
content area size when instead it is the size of the bounding rectangle
of the wl_surface and all its subsurfaces.

This caused the fallback decorations to try positioning themselves
outside themselves, causing feedback loops during interactive resizing.

Fixes #1991
Fixes #2115
Closes #2127
Related to #1914
2022-06-20 00:57:17 +02:00
Camilla Löwy
24cdc5afda Wayland: Rename window frame size constants 2022-06-20 00:57:17 +02:00
Camilla Löwy
75295f4878 Wayland: Remove unused code path 2022-06-20 00:57:17 +02:00
Camilla Löwy
040712ce99 Wayland: Cleanup 2022-06-20 00:57:17 +02:00
Camilla Löwy
2877fea550 Wayland: Remove superfluous comments
These are just repeating parts of the identifier.
2022-06-20 00:57:17 +02:00
Camilla Löwy
e33db6d7aa Wayland: Fix resize events before ack_configure
The surface was resized and the size event was emitted before we had
sent xdg_surface::ack_configure.  If user code then called some GLFW
function that commited the surface, those changes would all get applied
to the wrong configure event.

This postpones size changes until after the ack.
2022-06-20 00:57:17 +02:00
Camilla Löwy
afb127769a Wayland: Add tracking of XDG fullscreen state 2022-06-20 00:57:17 +02:00
Camilla Löwy
ed39ff43f9 Wayland: Use named constants for version checks
The wayland-scanner output provides really nice, self-documenting
version macros, so we should use them whenever possible.
2022-06-20 00:57:17 +02:00
Camilla Löwy
98c9961f32 Wayland: Cleanup 2022-06-20 00:57:17 +02:00
Camilla Löwy
3bbb41eacc Wayland: Fix glfwInit closing stdin on failure
If platform initialization failed before either timer fd member had been
set to -1 or a valid fd, termination would close stdin.
2022-06-20 00:57:17 +02:00
Camilla Löwy
0b76e3a6f1 Wayland: Fix duplicate window content scale events
The window content scale event was emitted every time the window content
area was resized, even if its scale had not changed.
2022-06-20 00:57:17 +02:00
Camilla Löwy
6857995498 Wayland: Fix glfwSetWindowSize resizing fs windows
glfwSetWindowSize would change the size of fullscreen mode windows as
if they were windowed mode.
2022-06-20 00:57:17 +02:00
Camilla Löwy
fdc72edf81 Wayland: Fix missing fullscreen code path
glfwRestoreWindow assumed it was only called in windowed mode.
2022-06-20 00:57:17 +02:00
Camilla Löwy
f39ffefb6a Wayland: Fix maximization by user being ignored
The internal maximization state was not updated when an event was
received that the user had changed the maximization state of a window,
and no maximization events were emitted.

This affected both the GLFW_MAXIMIZED attribute and glfwRestoreWindow.
2022-06-20 00:57:17 +02:00
Camilla Löwy
ddd087d662 Wayland: Fix behavior of leaving full screen mode
These changes make GLFW fullscreen more consistent, but unfortunately
also make GLFW even more oblivious to user-initiated XDG shell
fullscreen changes.

Fixes #1995
2022-06-20 00:57:17 +02:00
Camilla Löwy
523fdf50c1 Wayland: Cleanup 2022-06-20 00:57:17 +02:00
Camilla Löwy
a465c1c32e Win32: Simplify window class handling
By using window class atoms, we only need to mention each window class
name once, also removing the need to define _GLFW_WNDCLASSNAME.  It can
still be defined by the user as before.
2022-06-09 18:39:37 +02:00
Camilla Löwy
2ae3e0c8d7 Win32: Add separate window class for helper window
The current window procedure needs to deal with messages both for user
created windows and the hidden helper window.

This commit separates out the device message handling of the helper
window, allowing both window procedures to be less complicated.
2022-06-08 23:56:20 +02:00
Camilla Löwy
ad3dbeb65f Add basic assertions for event API arguments 2022-06-08 22:14:38 +02:00
Camilla Löwy
26920a1a38 X11: Fix previous error handler not being restored
GLFW did not restore the previous Xlib error handler when removing its
own, instead resetting to the default handler.

This commit saves and restores the previous error handler.

None of this is thread-safe or could ever be.

Fixes #2108
2022-06-08 22:14:38 +02:00
Camilla Löwy
736a88b067 Fix return type of functions returning bool values 2022-06-08 22:14:38 +02:00
Camilla Löwy
2c204ab52e Fix joystick user pointer NULL during disconnect
The joystick code did not distinguish between the allocation status of
the GLFW joystick object and whether it is connection to an OS level
joystick object.

These are now tracked separately.

Fixes #2092
2022-06-08 22:14:38 +02:00
Camilla Löwy
e9c58bc181 Wayland: Fix missing lock key modifier bits
The modifier bits for lock keys were only set when the corresponding key
was reported as held down or latched, but not when it was released and
locked.
2022-06-08 19:20:01 +02:00
Camilla Löwy
62e175ef9f Win32: Add comment clarifying use of ToUnicode
Fixes #2100
2022-05-06 19:19:25 +02:00
Camilla Löwy
7dfd84c458 Win32: Make monitor area retrieval more consistent
The rest of this file uses GetMonitorInfoW to retrieve this information.
2022-04-28 21:58:44 +02:00
Camilla Löwy
09653b8c54 Move last bits of window setup to platform code
This avoids glfwCreateWindow emitting GLFW_FEATURE_UNAVAILABLE or
GLFW_FEATURE_UNIMPLEMENTED on Wayland because shared code was calling
unimplemented or unavailable platform functions during final setup.

It also makes it consistent with the final setup of full screen windows.
2022-04-28 21:58:06 +02:00
Camilla Löwy
72642ea0d1 Simplify struct stitching for sync primitives
There will not currently be more than one set of threading or timer APIs
selected regardless of how many window systems are enabled, so there is
no need for this extra complexity.
2022-04-28 21:54:25 +02:00
Camilla Löwy
8f050b5655 Wayland: Add support for older wayland-scanner
Versions of wayland-scanner prior to 1.17.91 named every global array of
wl_interface pointers 'types', making it impossible to combine several
unmodified private-code files into a single compilation unit.

This overrides that name with a macro for each file, allowing them to
coexist.

Fixes #2016
Closes #2032
2022-04-28 21:54:24 +02:00
Camilla Löwy
acf0c10e7a Win32: Fix message reported by VS 2022 2022-04-28 21:54:24 +02:00
Camilla Löwy
80e31ce9e1 Win32: Remove superfluous cast 2022-04-28 21:54:24 +02:00
Camilla Löwy
23e6e8e4b7 X11: Fix segfault on malformed INCR response
The code assumed that at least some data would be received via the INCR
mechanism and that, as a result, the string buffer would be allocated.

Bug found by Clang static analysis.
2022-04-28 21:19:08 +02:00
Camilla Löwy
f60547ac80 X11: Fix returned clipboard string freed too early
The clipboard string should not be freed on SelectionClear.  The user
may have received it from glfwGetClipboardString and it should remain
valid until the next call to a public clipboard string function.
2022-04-28 21:18:49 +02:00
Camilla Löwy
a8d8b760fb X11: Fix OSMesa library not being unloaded 2022-04-28 21:17:39 +02:00
Camilla Löwy
2d281d7928 Wayland: Fix OSMesa library not being unloaded 2022-04-28 21:16:06 +02:00
Camilla Löwy
89514cf0fc Cocoa: Fix EGL and OSMesa not being unloaded 2022-04-28 21:14:11 +02:00
Camilla Löwy
10e9033a29 Win32: Fix OSMesa library not being unloaded 2022-04-28 21:12:36 +02:00
Camilla Löwy
29523dbfbf Fix order of error checks in glfwSetGammaRamp
Initialization should be checked before arguments.
2022-04-21 15:57:15 +02:00
Camilla Löwy
f843d53333 Fix glfwMakeContextCurrent using uninitialized TLS
Issue reported by danhambleton on the GLFW forum:
https://discourse.glfw.org/t/posix-thread-local-storage-tls-error-when-making-context-current/2034
2022-04-21 15:56:01 +02:00
Camilla Löwy
4cb36872a5 Wayland: Add support for file drop events
This adds support for file path drop events in text/uri-list format.

It is based on work by Pilzschaf in #2040.

Closes #2040
2022-04-03 20:09:42 +02:00
Camilla Löwy
0f38382e25 Wayland: Clean up listener struct initialization
Adapt style to match the rest of the project.
2022-04-03 20:09:42 +02:00
Camilla Löwy
f010335b8c Wayland: Make data offer reading a generic utility
This will be needed for drag and drop reception as well.
2022-04-03 20:09:42 +02:00
Camilla Löwy
b7a3af9b79 Wayland: Move window related code to window module
The Wayland backend was the only one where half the window and input
related code was in the init module.  As those bits want to share more
utility code with the window module, the interface between them grows.

To prevent that, this gathers nearly all window and input related code
into the window module.
2022-04-03 20:09:42 +02:00
Camilla Löwy
967282c2e6 Wayland: Remove check for error that cannot happen
Famous last words.
2022-04-03 20:09:41 +02:00
Camilla Löwy
8d216054ad Wayland: Remove error reporting of external bugs
Not sure that GLFW should be reporting that another client has made an
invalid receive request.
2022-04-03 20:09:41 +02:00
Camilla Löwy
34418951cc Wayland: Clean up clipboard writing 2022-04-03 20:09:41 +02:00
Camilla Löwy
ad4a9e42f0 Move URI list parsing to shared code
This will soon be used by the Wayland backend.
2022-04-03 20:09:39 +02:00
Camilla Löwy
e0889736fd Wayland: Add strerror output to error descriptions 2022-04-03 19:45:09 +02:00
Camilla Löwy
c132135332 Wayland: Clean up clipboard reading 2022-04-03 19:45:09 +02:00
Camilla Löwy
4651165272 Wayland: Simplify clipboard string allocation 2022-04-03 19:45:09 +02:00
Camilla Löwy
8d87be1268 Wayland: Improve handling of pending data offers
The code assumed that all data offers were selections that supported
plaintext UTF-8.

The initial data offer events are now handled almost tolerably.  Only
selection data offers are used for clipboard string and only if they
provide plaintext UTF-8.  Drag and drop data offers are now rejected as
soon as they enter a surface.

Related to #2040
2022-04-03 19:45:09 +02:00
Camilla Löwy
89d3ea8d69 Wayland: Return our clipboard without roundtrips 2022-04-03 19:45:09 +02:00
Camilla Löwy
990dc4b388 Wayland: Fix error paths not closing sending fd
Whatever error happens on our end, we should still close the fd so the
other end can move on.
2022-04-03 19:45:09 +02:00
Camilla Löwy
a4460b694e Wayland: Rename listener user data parameters 2022-04-03 19:45:09 +02:00
Camilla Löwy
4506175023 Wayland: Clean up pointer declarations
Adapt style to match the rest of the project.
2022-04-03 19:44:56 +02:00
Camilla Löwy
ba11e60859 Wayland: Rename data transfer parameters
No rationale beyond personal preference.
2022-04-03 18:14:50 +02:00
Camilla Löwy
2d45681bc3 Wayland: Fix phrasing and type of error messages 2022-04-03 18:14:50 +02:00
Camilla Löwy
4c110bba41 Wayland: Fix partial writes of clipboard string
The string pointer used to write the contents of our clipboard data
offer was never updated, causing it to repeat parts of the beginning of
the string until the correct number of bytes had been written.
2022-04-03 18:14:50 +02:00
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
b386371f57 Wayland: Fix double free on data source error
If data source creation fails, the string containing the data for it
would be freed a second time during termination.
2022-04-03 18:14:50 +02:00
Camilla Löwy
9c95cfb9f1 Wayland: Fix handling of clipboard set to self
Passing any part of the result of glfwGetClipboardString to
glfwSetClipboardString would result in, at best, a use-after-free error.
2022-04-03 18:14:50 +02:00
Camilla Löwy
920d110b6c Fix missing newline 2022-04-03 18:14:50 +02:00
Camilla Löwy
554cbdb205 POSIX: Fix data type of return values 2022-04-03 18:14:50 +02:00
Camilla Löwy
955fbd9d26 Cocoa: Fix AirPlay causing harmless init error
Emitting an error for one specific type of failure in retrieving the
correct name for a display is not very useful, especially when
initialization is otherwise unaffected.

There should be a path for information like that but this isn't it.

Fixes #1791
2022-03-18 00:45:12 +01:00
Camilla Löwy
07a5518c3e Win32: Fix using executable instance and not ours
Operations that take an instance handle should be passed the handle of
whatever module we are inside instead of blindly passing the handle of
the executable.

This commit makes GLFW retrieve its own instance on initialization.

This makes the most difference for window classes, which are
per-instance.  Using the executable instance led to name conflicts if
there were several copies of GLFW in a single process.

Note that having this is still a bad idea unless you know what things to
avoid, and those things are mostly platform-specific.  This is partly
because the library wasn't designed for it and partly because it needs
to save, update and restore various per-process and per-session settings
like current context and video mode.

However, multiple simultaneous copies of GLFW in a single Win32 process
should now at least initialize, like is already the case on other
platforms.

Fixes #469
Fixes #1296
Fixes #1395
Related to #927
Related to #1885
2022-03-18 00:45:04 +01:00
Camilla Löwy
66a4882eb1 Add checks for some invalid values to public API
There were no checks for invalid values or asserts for all invalid NULL
pointers to glfwSetWindowIcon or glfwCreateCursor.

Fixes #1862
2022-03-18 00:23:20 +01:00
Camilla Löwy
8d9231fe5e Win32: Fix glfwGetKeyScancode for GLFW_KEY_PAUSE
The bug described in 03cfe957e7 was
already present for another key where modifiers changes its scancode.

Related to #1993
2022-03-18 00:22:20 +01:00
Camilla Löwy
03cfe957e7 Win32: Fix scancode and key for Alt+PrtSc events
Alt+PrtSc emits a different scancode than just PrtSc.  Since the GLFW
API assumes each key corresponds to only one scancode, this cannot be
added to the keycodes array.

Instead we replace the scancode at the point of entry.

Fixes #1993
2022-03-18 00:19:01 +01:00
Camilla Löwy
3ee5031fd7 Add shared min and max functions for int 2022-03-15 22:22:13 +01:00
Camilla Löwy
9cc252a406 Revert ad01c1b614
This change broke key names for dead keys, because that depends on
the effect on the global state of simulating two key presses.

Issue found by CTest tests.

Reverts #2018
2022-03-13 16:01:41 +01:00
Slemmie
b54fb0af10 X11: Fix undefined behavior in bit shift of int
Closes #1951
2022-03-10 19:58:41 +01:00
Camilla Löwy
8f9ff8503e Formatting 2022-03-10 19:36:10 +01:00
Camilla Löwy
aa803f7de5 Win32: Update rationale for reimplementation
It is true that plain MinGW lacks this header, but that is not the main
reason for reimplementing IsWindowsVersionOrGreater.
2022-03-10 19:35:23 +01:00
Camilla Löwy
34573798f4 Win32: Rename Windows 10 macros for clarity
This switches the Windows 10 version helper macros to include the
version numbers listed in MSDN requirements sections.
2022-03-10 19:32:21 +01:00
Camilla Löwy
8ff9ed92b4 Win32: Fix calls to encoding compatibility macros
Calls to Unicode specific functions should be made explicit.
2022-03-10 19:31:28 +01:00
Camilla Löwy
723f3eb40d Win32: Fix maximization showing a hidden window
The normal way of maximizing a window also makes it visible.  This
implements window maximization manually for when the window passed to
glfwMaximizeWindow is hidden.

This will very likely not be forward-compatible and should be replaced.
2022-03-10 19:30:20 +01:00
Camilla Löwy
367d06deaf Win32: Fix scale fixup losing initial position
The window content scale correction at creation overwrote the inital,
more pleasant placement of the window by CW_USEDEFAULT, if the window
was created with GLFW_MAXIMIZED set.  This is because the translation
to screen coordinates was done using the current position, not the
position from the restored window rect.
2022-03-10 17:10:55 +01:00
Camilla Löwy
a730acf8e5 Win32: Fix rect of undecorated maximized windows
A window created maximized and undecorated would cover the whole monitor
Windows placed it on instead of just that monitor's workarea.

This commit adjusts the maximized rect to cover just the workarea,
similar to how undecorated windows that become maximized are handled
during WM_GETMINMAXINFO.

Fixes #1806
2022-03-10 17:07:55 +01:00
Camilla Löwy
adc202d2c3 POSIX: Fix undeclared function warning on Cygwin 2022-03-04 13:37:38 +01:00
Camilla Löwy
d78b0a4ead X11: Fix sonames for loaded libraries on NetBSD
The NetBSD sonames for X11 and related libraries is more stable than on
OpenBSD but the version numbers are still bumped more often than their
Linux counterparts, even excluding the one-time version bump across all
X11 related libraries.

This commit moves to using version-less sonames for X11 and related
libraries on NetBSD, which will hopefully be more forward-compatible
than hard-coding NetBSD-specific sonames.

This may not be the correct long-term solution but it runs now.

Binaries also appear to need an LD_LIBRARY_PATH or rpath entry of
/usr/X11R7/lib in order for the libraries to be found by dlopen.

Tested on NetBSD 9.2.
2022-03-04 00:00:59 +01:00
Camilla Löwy
71742d9a27 Wayland: Improve event processing with timeout
If the polling was interrupted by a signal or by incomplete or unrelated
data on any file descriptor, handleEvents could return before the full
timeout had elapsed.

This retries the Wayland prepare-to-read and poll until the full timeout
has elapsed or until any event was processed.  Unfortunately, due to how
the Wayland client API is designed, this also includes the delete_id
for the frame callback created by eglSwapBuffers.

This means glfwWaitEvents* are still not fully functional on Wayland.
See #1911 for more details.
2022-03-03 22:58:09 +01:00
Camilla Löwy
a32cbf6d4f Wayland: Fix glfwPostEmptyEvent not always working
The display sync requests in glfwPostEmptyEvent could just accumulate as
the display was never flushed on secondary threads.

This adds a proper flush after each sync request.

Fixes #1520
Closes #1521
2022-03-03 22:24:09 +01:00
Camilla Löwy
7ce1f3e1cf Formatting 2022-03-03 22:24:09 +01: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
203a7c59d2 Wayland: Cancel display fd read before callbacks
Cancel the prepared-to-read state on the calling thread before starting
to call back to user code.

Emitting close requests here is not a good choice but that is for
a future commit to address.
2022-03-03 22:16:59 +01:00
Camilla Löwy
3c2913dcb9 Wayland: Fix potential incomplete display flushing
The flushing of a Wayland display may need to be done in several steps,
signalled by it failing with EAGAIN.
2022-03-03 22:16:59 +01:00
Camilla Löwy
84b0923fe6 X11: Use lower-latency poll where available
This uses ppoll for waiting on file descriptors with a timeout, where
that function has been available a while.  On NetBSD, which will be
getting ppoll in the next release, the equivalent pollts is used.

This commit is based on work by OlivierSohn and kovidgoyal.

Related to #1281
Related to #1285
2022-03-03 22:16:59 +01:00
Camilla Löwy
cd22e28495 X11: Fix empty event race condition with a pipe
There is a seemingly unavoidable race condition when waiting for data on
the X11 display connection, as long as any other thread is also making
Xlib calls.  The event data we are waiting for could be read by the
other thread as part of looking for the reply to its request, before our
poll has begun.

This commit replaces the X11 event sent by glfwPostEmptyEvent with
writing to an unnamed pipe.  The race condition remains if other Xlib
calls are made on other threads, but glfwPostEmptyEvent should now be
race-free.

This commit is based on work by pcwalton, OlivierSohn, kovidgoyal and
joaodasilva.

Closes #2033
Related to #379
Related to #1281
Related to #1285
2022-03-03 22:16:59 +01:00
Camilla Löwy
363d471441 Cleanup 2022-03-03 22:16:59 +01:00
Camilla Löwy
87970b7f26 X11: Fix glfwWaitEvents* ignoring joystick events
The data available on the X11 connection may be a reply or an internal
event for an X11 extension.  Previously the check for whether an event
was available for us was done outside waitForEvent.  This prevented data
available on other file descriptors from breaking the outer wait loop.

This commit moves the check for whether an event is available into the
wait functions, where there is enough knowledge to limit the check to
the X11 connection.

Related to #932
2022-03-03 22:16:49 +01:00
Camilla Löwy
1e987cb92e X11: Fix joystick events causing busy waiting
On Linux, the inotify descriptor was included in the set used for
select, but could not break the outer loop, leading to busy waiting
until timeout or the correct X11 event arrived.

This commit adds a new function for waiting just on X11 events.

Fixes #1872
2022-03-03 22:15:42 +01:00
Camilla Löwy
92b5c67b50 X11: Retry poll when failed with EINTR or EAGAIN
Both of these errors should just lead to local retry.
2022-03-02 19:59:08 +01:00
Camilla Löwy
d3e4fcf8b7 X11: Fix event polling when event fd > 1023
This replaces select with poll for checking for data on event file
descriptors, as select cannot handle file descriptors larger than 1023.

Closes #2024
2022-03-02 19:38:41 +01:00
Camilla Löwy
ad01c1b614 Win32: Fix key name code changing global key state
This prevents glfwInit from potentially clobbering the dead key state
for other applications.

Closes #2018
2022-03-02 19:38:41 +01:00
Camilla Löwy
789d2924c0 Formatting
Make it clear that context attribute helper macros are macros.
2022-03-02 19:38:41 +01:00
Camilla Löwy
2e656afc49 GLX: Fix context creation failing unnecessarily
Regression introduced with 3bb5c459d6.
2022-03-02 19:38:41 +01:00
Camilla Löwy
20adc18aa5 Wayland: Clean up monitor scale update 2022-03-02 19:38:41 +01:00
Camilla Löwy
152f50cd01 Wayland: Fix error type for allocation failure 2022-02-11 13:11:54 +01:00
Camilla Löwy
4a68926bfd Wayland: Remove unnecessary NULL checks
It is fine to pass NULL to _glfw_free.
2022-02-11 13:11:08 +01:00
Camilla Löwy
a28adba06a Wayland: Fix multiple copies of single constant 2022-02-11 13:11:08 +01:00
Camilla Löwy
97da62a027 Cocoa: Clarify comments on compatibility macros 2022-02-09 22:13:14 +01:00
Camilla Löwy
7f6aa587f8 Cocoa: Fix deprecation warning for kUTTypeURL
We switched to kUTTypeURL when NSURLPboardType was deprecated, as the
official replacement symbol NSPasteboardTypeURL was not available on
every version of macOS supported by GLFW.

kUTTypeURL has now also been deprecated.

This commit moves to a compile-time choice between NSURLPboardType and
NSPasteboardTypeURL depending on the minimum targeted macOS version.

Fixes #2003
2022-02-02 19:20:32 +01:00
Camilla Löwy
df8d7bc892 Wayland: Clean up modifier key event handler
Adapt style and naming to match the rest of the project.
2021-12-31 13:32:25 +01:00
Camilla Löwy
0ce611958e Wayland: Clean up key translation
Adapt style and naming to match the rest of the project.
2021-12-31 13:32:25 +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
bf99587005 Wayland: Clean up key event handler
Adapt style and naming to match the rest of the project.
2021-12-31 13:27:22 +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
b70259e52d Wayland: Clean up text input
Adapt style and naming to match the rest of the project.
2021-12-31 13:27:22 +01:00
Camilla Löwy
fe7be39793 Clean up internal Unicode code point handling
Call code points by their name and store them as uint32_t.
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
cb22c54119 Move UTF-8 encoding to shared code
This will be used by the Wayland code too.
2021-12-31 13:27:22 +01:00
Camilla Löwy
37b7540db9 Wayland: Fix keys reported as wrong or unknown key 2021-12-31 13:27:18 +01:00
Camilla Löwy
715b874db3 Wayland: Fix GLFW_VISIBLE affecting full screen
Full screen window creation was not ignoring the GLFW_VISIBLE hint.
2021-12-31 13:13:21 +01:00
Camilla Löwy
25c521cbe5 Wayland: Fix missing damage event on window show
By definition a hidden window on Wayland does not have valid framebuffer
contents.

This adds a window damage (refresh) event when a window is shown, to
request an initial frame for the now visible window.
2021-12-31 13:13:21 +01:00
Camilla Löwy
c05acf6246 Wayland: Fix window not visible after initial swap
A window created with GLFW_VISIBLE set was not made visible by the
initial buffer swap during context attribute refresh.

Regression introduced by @elmindreda in
094aa6d3c7.
2021-12-31 01:32:18 +01:00
Camilla Löwy
12c2ccd609 Wayland: Remove window monitor array pre-alloc
The array will be allocated by surfaceHandleEnter when needed.
2021-12-31 01:32:18 +01:00
Camilla Löwy
216ea3d735 Wayland: Remove superfluous initialize to NULL
The whole window struct has already been cleared to zero.
2021-12-31 01:32:18 +01:00
Camilla Löwy
c1ecd4673e Wayland: Move window title cloning to creation 2021-12-31 01:32:18 +01:00
Camilla Löwy
7bede13b1d Wayland: Gather framebuffer transparency logic 2021-12-31 01:32:18 +01:00
Camilla Löwy
a3d1633e1d Wayland: Move surface creation function
This needs to be after createXdgSurface, which it will soon be calling.
2021-12-31 01:32:18 +01:00
Camilla Löwy
3f5dfeaf29 Wayland: Fix repeated key not released on defocus
Platform code should not generate key events with GLFW_REPEAT.
GLFW_PRESS is translated into GLFW_REPEAT by shared code based on the
key state cache.

This confused the automatic key release logic into not generating an
event with GLFW_RELEASE for a key being repeated when the window lost
input focus.
2021-12-31 01:32:18 +01:00
Camilla Löwy
850893a39f Wayland: Control key repeat via timerfd state
The key repeat logic is now controlled only via the key repeat timerfd.
2021-12-31 01:32:18 +01:00
Camilla Löwy
79e7e65c9d Wayland: Clean up event pump
Adapt style to the rest of the project.
2021-12-31 01:31:30 +01:00
Emmanuel Gil Peyrot
855d338a65 Wayland: Use correct action on fallback decoration
We were previously storing the pointer position only when on the main
window, so when the user clicked on a fallback decoration it would use
the last position of the cursor on the main window, instead of the
position in the decoration surface.

Fixes part of #1991.
2021-12-30 19:04:10 +01:00
Camilla Löwy
7d060ba4f1 X11: Fix sonames for loaded libraries on OpenBSD
The OpenBSD ports tree assigns its own soname version numbers, so the
hardcoded sonames GLFW uses to load libraries on non-macOS Unices are
often incorrect.  Instead OpenBSD recommends that run-time loading
should leave out the version numbers entirely.  The OpenBSD ld.so then
finds the correct library.

This upstreams the ports tree fixes for Xcursor and EGL, and adds the
corresponding fix for all other run-time loaded library sonames.

Tested on OpenBSD 7.0.

This issue was initially reported on IRC.
2021-12-24 01:14:23 +01:00
Jason Francis
094aa6d3c7 Wayland: Fix window hiding
Corrects the protocol violation when creating an xdg_surface from a
wl_surface that already has a buffer due to EGL buffer swaps.

This commit is based on PR #1731 by @ghost, but adapted and altered:
 - The XDG surface and role are now only created when a window is shown
   to prevent application lists from showing command-line applications
   with off-screen-only windows
 - The special case of Wayland+EGL buffer swap is now in the EGL code
   to mirror how X11 is handled
 - Adaption to run-time platform selection and separate credits file

Fixes #1492
Closes #1731
2021-12-24 00:55:31 +01:00
Camilla Löwy
e24fe4b189 Wayland: Fix key repeat continuing when refocused
If a window lost input focus while a key was held down, the key repeat
mechanism would resume once the window regained focus.
2021-12-22 14:51:05 +01:00
Camilla Löwy
c2f0a0ae59 Wayland: Fix duplicate focus event on activation 2021-12-22 14:51:04 +01:00
Emmanuel Gil Peyrot
6281f498c8 EGL: Use EGL_EXT_present_opaque when available
This extensions allows GLFW to instruct the driver to ignore the alpha
bits, even in formats which contain them.  This makes it possible to use
the alpha bits as extra storage, without it affecting the end result
getting displayed to the user.

Fixes #1434
Fixes #1803
2021-12-14 18:35:30 +01:00
Emmanuel Gil Peyrot
68879081cb Wayland: Continue poll() if timerfd can’t be read
In the case the key repeat timerfd was interrupted before read(), the
cursor timerfd wasn’t read at all even when it could.

Related to #1711
2021-12-14 09:33:16 +01:00
Stone Tickle
963e728881 Wayland: Set O_NONBLOCK on repeat timerfd
Fixes #1710
Fixes #1711
2021-12-14 09:28:34 +01:00
Camilla Löwy
900848ad0c X11: Add extension header paths to CMake target
The way the X11 find module is written, these paths can differ from the
base X11 header path, even if they very rarely do.

Fixes #1999
2021-12-09 20:05:07 +01:00
Camilla Löwy
53d86c64d7 Win32: Handle content scale error on creation
Only apply the content scale to the initial size of the window if
content scale retrieval succeeded.

Related to #1615.
2021-12-01 21:13:00 +01:00
Camilla Löwy
fbfd7e65c8 Win32: Fix bad content scale on monitor disconnect
The monitor handle could have become invalid just before the call to
GetDpiForMonitor.  It was possible for both window and monitor content
scale queries.

This ensures both that an appropriate error is emitted and that the
retrieved values are zero on error.

Fixes #1615
2021-12-01 21:13:00 +01:00
Camilla Löwy
d1efa32983 Formatting 2021-12-01 21:13:00 +01:00
Camilla Löwy
79de08db06 Cleanup 2021-12-01 21:12:53 +01:00
Stephen Gutekanst
9cd4d2fa20 X11: Fix undefined behavior in glfwSetWindowIcon
The conversion of window icon image data involves unsigned char color
values being promoted to int and then shifted to the left by 24.  For
32-bit ints this is just far enough to trigger undefined behavior.

It worked by accident because of how current compilers translate this
piece of code.

This was caught by @slimsag while working on [Zig bindings for GLFW][1],
and diagnosed together with @Andoryuuta, as described [in an
article][2].  Zig has UBSan enabled by default, which caught this
undefined behavior.

[1]: https://github.com/hexops/mach-glfw
[2]: https://devlog.hexops.com/2021/perfecting-glfw-for-zig-and-finding-undefined-behavior#finding-lurking-undefined-behavior-in-6-year-old-glfw-code

Thanks to Maato, martinhath, dcousens, drfuchs and Validark for helping
to refine the solution.

This commit message was rewritten by @elmindreda to hopefully reflect
the conclusions of the pull request thread.

Related to hexops/mach#20
Closes #1986
2021-12-01 19:05:39 +01:00
Camilla Löwy
706d1f1653 Gather Null specific platform selection logic
The more specific error description is now used whatever the desired
platform is, when a binary only supports the Null platform.
2021-11-25 23:24:39 +01:00
Camilla Löwy
b3a98f8555 Update comments for global mutable data 2021-11-25 23:24:39 +01:00
Jan Ekström
544790666b Cocoa: Use MACH_PORT_NULL for default IOKit port
Looking into the definition of kIOMainPortDefault, the following
description can be found:

When specifying a main port to IOKit functions, the NULL argument
indicates "use the default". This is a synonym for NULL, if you'd
rather use a named constant.

Thus, we do not have to utilize an external symbol for the identifier
of the default main IOKit port, but MACH_PORT_NULL suffice. This
simplifies compatibility between macOS versions as the symbol was
renamed with macOS 12.0.

Fixes #1985
Closes #1994
2021-11-22 21:30:53 +01:00
Josh Codd
f75c251dec Cocoa: Fix deprecation of kIOMasterPortDefault
This adds a workaround for kIOMasterPortDefault having been deprecated
in favor of kIOMainPortDefault in macOS 12.0.

Closes #1980
2021-10-27 23:09:40 +02:00
Camilla Löwy
2a78a2cf82 Refactor platform selection for clarity? 2021-10-27 18:22:06 +02:00
Camilla Löwy
76a5f781db Add glfwInitVulkanLoader
This removes the GLFW_VULKAN_STATIC CMake option and the
_GLFW_VULKAN_STATIC configuration macro and replaces them with the
glfwInitVulkanLoader function, allowing a single library binary to
provide both behaviors.

This is based on the design from PR #1374 by @pmuetschard.

Closes #1374
Closes #1890
2021-10-27 18:22:05 +02:00
Camilla Löwy
db91507956 Remove saving a function pointer only used once
This removes the global struct member for
vkEnumerateInstanceExtensionProperties, which is only used in the same
function that fetches the function from the loader.

The pattern is now more in line with how other single uses of Vulkan
functions are structures, such as window surface creation.
2021-10-27 18:22:05 +02:00
Camilla Löwy
ee6ff939a5 Fix invalid pointer conversions
C does not allow conversions between data pointers and function
pointers.

Yes, the name of the macro is reserved.  That's something for a future
commit to fix.

Fixes #1703
2021-10-27 18:22:05 +02:00
Camilla Löwy
68534cc2ce Null: Remove unused function 2021-10-27 18:22:05 +02:00
Camilla Löwy
4005f70eef WGL: Limit DWM swap interval hack to Vista and 7
This hack breaks when switching a window to fullscreen, if the OpenGL
ICD detects this and switches its swapchain to exclusive mode.

This limits the hack to Windows Vista and 7.  This hack was added
because of vsync jitter under DWM on Windows 7 and I have been unable
to reproduce it on any later version.

Is this change causing any problems on any version of Windows?  Please
open an issue!

Fixes #1072
2021-10-27 18:22:05 +02:00
luz paz
0fe96ec202 Fix various typos
Found via `codespell -q 3 -S ./deps -L fo,numer,te,uint,wille`

Closes #1965
2021-10-25 23:39:06 +02:00
Camilla Löwy
3d52f7e345 Limit scope of some loop counters in C99 files 2021-10-25 23:39:06 +02:00
Camilla Löwy
f4d0365a5a Use switch statement instead of if-else-chain
Related to #1739
2021-10-25 23:39:06 +02:00
Ioannis Tsakpinis
727db55c3a
Fix context API checks in native access functions 2021-10-23 16:20:18 +03: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
ff9d9515f6 Remove typedefs only used in one place 2021-10-12 12:54:37 +02:00
Camilla Löwy
36ea36736d Cocoa: Change helper function suffix to Cocoa
This makes it clearer which platform a helper function belongs to.
2021-10-12 12:54:37 +02:00
Camilla Löwy
09f9773e6f Cocoa: Make timer functions backend independent
This is work towards allowing the Null backend to build for macOS
using the Darwin timer API, without the Cocoa backend being enabled.
2021-10-12 12:54:37 +02:00
Camilla Löwy
bdfe6b09af Win32: Make timer functions backend independent
This is work towards allowing the Null backend to build for Windows
using the Win32 timer API, without the Win32 backend being enabled.
2021-10-12 12:54:37 +02:00
Camilla Löwy
b6834bf2a1 Win32: Remove timeGetTime fallback for timer
The performance counter API is guaranteed to succeed on Windows XP and
later so there is no need for a fallback.

This removes our last dependency on winmm.
2021-10-12 12:54:37 +02:00
Camilla Löwy
35f3b58c21 Win32: Make thread functions backend independent
This is work towards allowing the Null backend to build for Windows
using the Win32 threading API, without the Win32 backend being enabled.
2021-10-12 12:54:36 +02:00
Camilla Löwy
f5758d75d0 Remove context creation backend headers
These headers come from when GLFW only supported a single context
creation API at a time, chosen at compile-time.

Since EGL and OSMesa are now always enabled and the platform-specific
APIs are tied to their specific window system, there is no reason to
keep these declarations separate from the internal.h and *_platform.h
header files.
2021-10-12 12:54:36 +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
e31deedc99 Make timer init part of platform API
This is part of runtime platform selection because the null backend
needs the timer implementation for the current OS.
2021-10-12 12:54:36 +02:00
Camilla Löwy
6d51b39106 Select mapping platform name at runtime
This is done in preparation for runtime platform selection.
2021-10-12 12:54:35 +02:00
Camilla Löwy
d0776e04a3 Null: Add non-functional EGL support
This is done in preparation for runtime platform selection, to make sure
every platform can build with EGL enabled.

It may be possible to add support for things like the ANGLE null
platform later.
2021-10-12 12:54:35 +02:00
Camilla Löwy
8b8d10bc01 Move library dependency logic to src directory
This finally eliminates the glfw_INCLUDE_DIRS and glfw_LIBRARIES CMake
variables entirely.
2021-10-12 12:54:35 +02:00
Camilla Löwy
0a9488e3f0 Remove configuration header 2021-10-12 12:54:35 +02:00
Camilla Löwy
efe764b492 Remove blank line before the end of some structs 2021-10-12 12:54:35 +02:00
Camilla Löwy
cca9008db2 Make native access functions verify context API
The native access functions for context handles did not verify that the
context had been created with the same API the function was for.

This makes these functions emit GLFW_NO_WINDOW_CONTEXT on API mismatch.
2021-10-12 12:54:35 +02:00
Camilla Löwy
6ed5294223 Cocoa: Fix unresponsive cursor after cursor warp
This is a companion to 157ebb80aa and
fixes the same issue for calls to glfwSetCursorPos.

Related to #1962
2021-09-12 20:01:34 +02:00
Ioannis Tsakpinis
157ebb80aa Cocoa: Fix unresponsive cursor after ungrab
There is a suppression interval (0.25 seconds by default) after a call
to CGWarpMouseCursorPosition, during which local hardware events
(keyboard and mouse) are ignored. GLFW already calls
CGEventSourceSetLocalEventsSuppressionInterval with a value of 0.0, but
it doesn't help in this case, there is still a short delay before the
cursor can be moved. Moving the CGAssociateMouseAndMouseCursorPosition
call after the cursor position has been restored, fixes the issue.

Closes #1962
2021-09-10 18:52:47 +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
4cbe743b74 Wayland: Fix standard cursor name selection
Regression introduced by 08e5a17063.
2021-09-02 18:30:41 +02:00
Koray Kilinc
216d5e8402 Wayland: Fix some keys not repeating
According to the libxkbcommon documentation[1], xkb_keymap_key_repeats
requires keymap and keycode as input:

int xkb_keymap_key_repeats( struct xkb_keymap * keymap,
			    xkb_keycode_t key)

However, in inputChar in wl_input.c we are passing in xkb_keysym_t,
which was a type mismatch.

This results in some keys not repeating when they should and vice versa.

[1] https://xkbcommon.org/doc/current/group__components.html#ga9d7f998efeca98b3afc7c257bbac90a8

Closes #1908.
2021-08-31 20:48:12 +02:00
Camilla Löwy
22b586b3d8 Add pluggable heap allocator
This adds the glfwInitAllocator function for specifying a custom memory
allocator to use instead of the C runtime library.

The allocator is a struct of type GLFWallocator with fields
corresponding to malloc, realloc and free, while the internal API
corresponds to calloc, realloc and free.

Heap allocation calls are filtered before reaching the user-provided
functions, so deallocation of NULL and allocations of zero bytes are not
passed on, reallocating NULL is transformed into an allocation and
reallocating to size zero is transformed into deallocation.

The clearing of a new block to zero is performed by the internal
calloc-like function.

Closes #544.
Fixes #1628.
Closes #1947.
2021-08-25 21:00:10 +02:00
Richard Boldiš
2ac7e20aaf Win32: Fix invalid preprocessor command 'warning'
The GCCism #warning had snuck into the Win32 platform code.

Merges #1953.
2021-08-24 23:24:14 +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
071d7c0f46 X11: Fix function returning before cleanup
The _glfwPlatformSetWindowFloating function would return without freeing
the state array if the window was already in the requested state.
2021-08-16 21:27:40 +02:00
Camilla Löwy
d83849792b Add override variable for CMake library type
This adds the GLFW_LIBRARY_TYPE CMake cache variable, which allows users
and higher-level projects to set what type of library GLFW is built as.

When not empty, this value overrides the standard BUILD_SHARED_LIBS
option for GLFW while still allowing it to control the type of other
libraries in a larger project.

This also allows building GLFW as an object library without adding dummy
source files (as required by Xcode) or producing unused library
binaries.

Projects using CMake 3.12 or later can link the resulting GLFW object
library normally using target_link_libraries.

Fixes #279.
Related to #1307.
Closes #1497.
Closes #1574.
Closes #1928.
2021-08-15 22:44:43 +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