4898 Commits

Author SHA1 Message Date
Camilla Löwy
b00e6a8a88 Update to actions/checkout@v5 from v4
This is necessary due to the deprecation of Node.js 20 on Github Action
runners.
2026-03-30 20:11:56 +02:00
Camilla Löwy
51683a6f1c Use C99 booleans for Khronos API extensions 2026-03-27 14:36:35 +01:00
Camilla Löwy
55fd451d5f Wayland: Remove unused struct member
The libdecor initialization sync callback was saved in the library
struct but never meaningfully used.
2026-03-27 14:35:28 +01:00
Camilla Löwy
1929088dd9 Make the empty events test somewhat plausible
The empty events test now makes slightly more plausible use of
glfwPostEmptyEvent.  As a side-effect, the test now also works as
intended on Wayland.
2026-03-20 16:06:29 +01:00
Camilla Löwy
3130c004e1 Wayland: Fix missing flush in glfwHideWindow 2026-03-20 16:06:29 +01:00
Camilla Löwy
bb8048122a Wayland: Fix glfwPostEmptyEvent leaking a proxy
The client-side proxy of the callback from each call to wl_display_sync
was never destroyed.

Fixes #2836
2026-03-20 16:04:12 +01:00
Camilla Löwy
50b0a135a5 Wayland: Fix deadlock causing timeout
If the frame was processed by wl_display_dispatch_queue_pending, this
would be treated as no frame having been received.

Oops.

This bug was introduced by fdd14e65b1.
2026-03-13 17:20:44 +01:00
Camilla Löwy
fdd14e65b1 Wayland: Fix EGL buffer swap blocking indefinitely
When the swap interval was nonzero, EGL on Wayland would wait
indefinitely for a frame callback on a suspended window, causing
applications that call eglSwapBuffers to halt.

This re-implements the wait for a surface frame so that we can add
a reasonable timeout, while setting the EGL swap interval to zero.  That
allows applications to make progress despite the window being suspended.

Some insights for how to structure this workaround were gleaned from
dri2_wl_swap_buffers_with_damage in Mesa.

This initial implementation still has a race between glfwHideWindow and
glfwSwapBuffers when rendering on a separate thread.  This could lead to
a window becoming visible again after being hidden on the main thread.

Related to #1350
Fixes #2582
Fixes #2640
Fixes #2719
Fixes #2723
Fixes #2800
Fixes #2827
2026-03-06 14:31:27 +01:00
Camilla Löwy
54b18d5547 Fix cleanup on success in threaded rendering test 2026-03-06 14:31:26 +01:00
Camilla Löwy
05f57c0bee Wayland: Improve support for discrete scrolling
This adds support for high-resolution scroll input scaled to match
legacy discrete scroll input.  It is available on compositors that
support wl_seat version 8 or later.

High-resolution "discrete" values now replace non-scaled scroll
values when available.
2026-03-06 14:31:26 +01:00
Camilla Löwy
0d15b54c7a Use C99 booleans in config structs 2026-03-06 14:31:26 +01:00
Camilla Löwy
f472380d7e Use C99 isfinite instead of various ad-hoc tests 2026-03-06 14:31:26 +01:00
Camilla Löwy
1839271de4 Wayland: Remove last traces of legacy Unicode path
The legacy keysym-to-Unicode path is only used on X11 since
21fea01161, but the file was still
included in Wayland-only builds.
2026-03-06 14:31:26 +01:00
Camilla Löwy
aa5047709d POSIX: Include helper header via platform glue 2026-03-06 14:31:25 +01:00
Camilla Löwy
bae8aa6e7d macOS: Fix Vulkan loader loading for Null platform 2026-03-06 14:31:25 +01:00
Camilla Löwy
c5c0b69149 Fix pkgconfig dependency lists treated as strings
All other parts of the file correctly treated these variables as lists.
2026-03-06 14:31:25 +01:00
Camilla Löwy
29cd880ab5 macOS: Clarify separation between Cocoa and macOS
The timer code uses no part of Cocoa and is in turn used by other
backends than Cocoa on macOS.

The macOS timer code is now labeled macOS.  Cocoa-specific files are now
consistently labeled Cocoa, not macOS.
2026-03-06 14:31:25 +01:00
Yan Pujante
3d89365fdb Added Emscripten external platform (comment) 2026-02-28 15:40:56 +00:00
Camilla Löwy
7c9ea95233 Null: Disable Vulkan on macOS for the moment
This only affects builds on macOS where only the Null platform is
enabled.
2026-02-13 15:36:08 +01:00
Camilla Löwy
abfbf07830 Null: Fix dynamic library name selection
The name selection for the Vulkan loader and the EGL and client
libraries used the GLFW platform macros instead of the platform's own
macros.  This caused the selection to be incorrect when building only
the Null platform on any platform but Linux (where it only accidentally
worked due to being the default case).

OSMesa was already using the correct method.
2026-02-13 15:25:06 +01:00
Camilla Löwy
99cdcfb0a4 Wayland: Unify pointer input paths
This reduces pointer frame support to a small amount of plumbing.
2026-02-13 14:44:10 +01:00
Camilla Löwy
001f94eaa7 Wayland: Add support for pointer event frames
This adds support for wl_seat version 5, which adds pointer frames.
This allows two-dimensional scroll input to be emitted as single events
instead of one event per axis per motion.

It's also the the foundation for future enhancements like properly
scaled discrete scroll events and server-side key repeat.

Fixes #2494
2026-02-13 14:44:09 +01:00
Camilla Löwy
3f14b6feed EGL: Try eglGetProcAddress before fallback method
This order matches what is done for every other context creation API
that has a similar fallback method.
2026-02-13 14:44:09 +01:00
Camilla Löwy
f0b2992b3a Allow NULL argument to _glfwPlatformFreeModule
This matches the behavior of _glfw_free and the public API, simplifying
cleanup code.
2026-02-13 14:43:07 +01:00
Camilla Löwy
b579ea6792 Wayland: Fix libwayland-client not unloaded 2026-02-13 13:25:36 +01:00
Camilla Löwy
a3095e1aa5 X11: Fix libXext not unloaded at termination 2026-02-13 13:25:36 +01:00
Camilla Löwy
a98badf088 Wayland: Fix key repeat on very old compositors
The client-side key repeat timer fd was only created for wl_seat version
4 or later, but was then used unconditionally during event processing.

Rather than have this mechanism do nothing in a more correct way on
wl_seat version 3 or earlier (which is very old by now), this commit
creates the key repeat timer fd and then sets (hopefully gentle)
hardcoded repeat delay and rate.
2026-02-13 13:25:35 +01:00
Camilla Löwy
c4684b288d Remove some pointless comments 2026-02-13 13:25:35 +01:00
Camilla Löwy
232164f62b Wayland: Remove duplicate cursor state
The shared window struct already tracks the current cursor.
2026-02-05 17:28:32 +01:00
Camilla Löwy
abb9db0d75 Wayland: Fix fallback decoration button input
Fallback decoration mouse button actions were performed for both press
and release events.  The requests made using a mouse button release
serials were presumably (and correctly) discarded by the compositor.

This commit removes the generation of these nuisance requests.
2026-02-05 17:25:11 +01:00
Camilla Löwy
0aa77a9a3a Wayland: Release input devices where possible
On systems with wl_seat verison 3 or later, use release instead of
destroy on input devices when they are disconnected.
2026-02-04 18:08:37 +01:00
Camilla Löwy
7b370d8df0 Wayland: Simplify pointer surface state
Track which surface contains the pointer with one piece of state instead
of three partially overlapping ones.
2026-02-04 18:08:37 +01:00
Camilla Löwy
f871f14d5e Add update flag to timeout test
Redrawing the window contents for every possible event is not
a reasonable thing for an application to do.  The test should be whether
redrawing on demand plus periodic updates works with near-idle CPU use
and no extra input latency.

This change incidentally makes the test well-behaved on Wayland, where
it was previously broken due to every EGL buffer swap causing an event
to be received.
2026-02-04 18:07:19 +01:00
Camilla Löwy
bafb134769 Documentation work
Elaborate on what 'work' means in the context of joystick input.
2026-01-27 20:51:00 +01:00
Camilla Löwy
2d7ae8f2d0 Wayland: Cleanup
This is only a semantic change.  The values are the same.
2026-01-15 21:09:01 +01:00
Camilla Löwy
96e0f49395 X11: Place argument assertion after platform check
This lets automated testing check that GLFW_NOT_INITIALIZED is emitted
for every public function.
2026-01-14 21:03:13 +01:00
Camilla Löwy
9352d8fe93 X11: Cleanup 2026-01-14 18:26:50 +01:00
Camilla Löwy
a228a8b447 X11: Fix window made non-floating by being hidden
The previous implementation was based on the incorrect assumption that
the _NET_WM_STATE_ABOVE state is always retained on unmapped windows.
According to EWMH the WM should remove the _NET_WM_STATE property when
a window is unmapped.

This commit moves the adding of _NET_WM_STATE_ABOVE to before mapping
the window during glfwShowWindow.  The logic for removing
_NET_WM_STATE_ABOVE from hidden windows is retained, as EWMH still
allows WMs to leave the window property on unmapped window.

Fixes #2276
2026-01-12 21:26:42 +01:00
Camilla Löwy
dbadda2683 Formatting 2025-12-05 13:33:10 +01:00
Camilla Löwy
08449b7183 Linux: Add missing header for ioctl
Fixes #2778
2025-12-04 20:30:12 +01:00
Camilla Löwy
1ce855b0b1 Wayland: Fix missing checks for optional protocol 2025-12-04 20:30:12 +01:00
Camilla Löwy
ebff6606ee Simplify test for shared library build 2025-11-17 22:57:23 +01:00
Doug Binks
162896e5b9 Wayland: free modules at end of terminate function
- Fixes #2744
2025-11-14 16:35:47 +00:00
Doug Binks
936307558e X11: Clamp w,h in glfwSetWindowSize to >= 1
-  prevents BadValue error and program exit
2025-11-08 10:37:52 +00:00
Drew Weymouth
4df5129529 X11: check crtcInfo for NULL when polling monitors 2025-11-07 17:39:26 +00:00
Ivor Wanders
6de70d8252 X11: Prevent BadWindow when creating small windows
The glfwCreateWindow function ensures that the width and height are
at least greater or equal than zero, but on X11 it is invalid to
create a window with dimensions that equal zero, see [1].

This change ensures that the dimensions passed to XCreateWindow are
at least 1 by 1.

This issue was detected in [2], where a call to glfwCreateWindow
was done to request a 1x1 window, with a _glfw.x11.contentScaleX of
less than 1.0 (0.958333) this results in a request for a 0x0 window
which then causes an BadWindow error from X11.

[1]: e003f52661/specs/libX11/CH03.xml (L1333-1337)
[2]: https://github.com/WerWolv/ImHex/pull/2390
2025-11-07 17:24:35 +00:00
knokko
8e15281d34 Add glfwGetGLXFBConfig native access function
This adds the glfwGetGLXFBConfig function for querying the GLXFBConfig
the GLXWindow of a window.

This commit is a squashed and modified version of PR #1925 by knokko.
The following changes were made by elmindreda:

The function signature was changed to handle GLXFBConfig being an opaque
value in core GLX.  The function error checks were fixed and updated.
The struct member name was changed.  The struct member clearing on
context destruction was removed.  All documentation snippets were
updated.

Closes #1925
2025-09-01 16:05:26 +02:00
Camilla Löwy
621e99d53e Add glfwGetEGLConfig native access function
This adds the glfwGetEGLConfig function for querying the EGLConfig of
the EGLSurface of a window.

This is a re-implementation of the PR #2045 by knokko, slightly
redesigned to handle EGLConfig being an opaque type in core EGL.

Closes #2045
2025-09-01 16:05:24 +02:00
Camilla Löwy
1a0b7827d4 EGL: Fix error return value for glfwGetEGLSurface
This is a semantic fix only.  The behavior is unchanged.
2025-08-29 19:27:21 +02:00
Camilla Löwy
4c64184455 Remove title member from window config
The window title is already available in the window struct.
2025-08-29 19:27:21 +02:00