Commit Graph

4473 Commits

Author SHA1 Message Date
Camilla Löwy
683b7524d2 Improve documentation relating to key tokens
Shifted the documentation away from the term 'named keys' as something
different than keys that glfwGetKeyName will return a name for.  The
already existing term 'key token' should now be used to refer to the
GLFW_KEY_* constants.

The associated term 'named mouse button' was also replaced with
'supported mouse button'.

The parts explaining which key tokens will return a valid scancode from
glfwGetKeyScancode have hopefully been clarified.  This issue was
reported in #2055.

The GLFW_KEY_UNKNOWN constant has been moved out of the list of key
tokens to simplify and hopefully clarify the related documentation.

Various other keyboard key related edits were made, hopefully resulting
in improvements.

Related to #2055

(cherry picked from commit 9959dc69ca)
2023-12-07 18:04:48 +01:00
Camilla Löwy
356f56a166 Fix list of possible errors for glfwGetKeyName
(cherry picked from commit 557a633b2d)
2023-12-07 18:04:48 +01:00
Camilla Löwy
5f936a6276 Fix glfwGetKeyName not checking key token is valid
(cherry picked from commit b1517e5b3e)
2023-12-07 18:04:48 +01:00
Camilla Löwy
1c989eace3 Clarify documentation for glfwMakeContextCurrent
(cherry picked from commit 3f31519de8)
2023-12-07 18:04:48 +01:00
Camilla Löwy
c98860db9e Add assertions for context function invariants
Related to #2327

(cherry picked from commit 93d70cb6a8)
2023-12-07 18:04:48 +01:00
Camilla Löwy
cb0dafa7c0 Fix potential violation of invariant
The shared function for reading back context attributes,
_glfwRefreshContextAttribs, did not check whether the newly created
context had been successfully made current.  This violated the invariant
that the context TLS slot always points to a valid window and that its
context is current whenever _glfw.platform.getProcAddress is called.

Related to #2327

This was adapted to 3.3-stable from
fa0ea5c41f and
ddd92a4fa8.
2023-12-07 18:04:08 +01:00
Camilla Löwy
11f517e557 Fix return value on error for glfwGetKeyScancode
The documentation says it should be -1, not zero.

(cherry picked from commit 8c5471d6cd)
2023-12-07 17:33:52 +01:00
Camilla Löwy
2a4e26870b Fix remaining use of actions/checkout@v2
Related to #2255
2023-12-05 16:18:59 +01:00
Camilla Löwy
31f08cc7fc Wayland: Fix heuristics for what counts as events
The Wayland implementation of glfwWaitEvents* keeps waiting until it
sees evidence that a significant event has been processed.  However,
this included updating an animated cursor (not a significant event)
but did not include previously buffered Wayland events or libdecor
events (definitely significant events).

This commit corrects these cases.

(cherry picked from commit d097e35743)
2023-11-30 21:34:16 +01:00
Camilla Löwy
9809035ed2 Wayland: Fix protocol error on undecorated window
When setting the visibility of a libdecor frame on a compositor that
supports XDG decorations, libdecor 0.1 will update the geometry of the
XDG surface.  GLFW attempted to set the visibility before having told
libdecor what size the content area is.  This caused a Wayland protocol
error when libdecor attempted to set the window size to 0x0.

This commit adds setting the content area size for the libdecor frame
directly after creation, allowing libdecor to know what it's doing.

(cherry picked from commit 23e40548b1)
2023-11-30 21:34:06 +01:00
Camilla Löwy
7cc8879ab9 Wayland: Use Wayland to wait for libdecor to init
Much of libdecor is initialized only after certain events have been
received from the compositor and some parts of libdecor 0.1 are unsafe
to use until this delayed initialization has completed.

Since libdecor does not provide an API to query if or be notified when
this has happened, GLFW processed events until its newly created
libdecor frame had created its XDG shell objects.

This commit switches to using a generic Wayland sync point created just
after libdecor (and presumably its plugin) has set up its delayed
initialization, instead of relying on the more specific implementation
detail mentioned above.

It also makes this wait mandatory before the first libdecor frame is
created instead of a pre-condition for certain libdecor frame calls,
hopefully removing even more dependence on implementation details.

(cherry picked from commit 9fdc425931)
2023-11-30 21:31:58 +01:00
Doug Binks
89b149a56f Reorder credit
(cherry picked from commit 659d161446)
2023-11-28 22:19:11 +01:00
Grzesiek11
b52b074be5 Documentation: only named keys generate synthetic key releases
The current wording states that all keys have synthetic key release
events generated after focus is lost, but keys that aren't named
don't have any state held, so no such events are generated for them.

The new wording clarifies that only named keys have the events generated
for them.

(cherry picked from commit dbe810e403)
2023-11-28 22:19:08 +01:00
Camilla Löwy
b211975131 Update changelog and add credit
Related to #2229

(cherry picked from commit a87acd8c1f)
2023-11-28 22:18:36 +01:00
Camilla Löwy
2c09407bff Cleanup
(cherry picked from commit 2a4dd9c28f)
2023-11-28 22:17:40 +01:00
Michael Skec
7c7cc59889 Linux: Fix memory leak when inotify init failed
This introduces regex_compiled boolean to track whether the regex is
compiled successfully.

Closes #2229

(cherry picked from commit c992226a9c)
2023-11-28 22:16:53 +01:00
Camilla Löwy
6f9686f1f4 Fix unneccessary use of "must"
Passing a context-less window to a function that requires a context only
emits a harmless GLFW_NO_WINDOW_CONTEXT error.

(cherry picked from commit 0bd3e879e1)
2023-11-28 22:15:43 +01:00
Camilla Löwy
89bea58b18 Win32: Fix glfwWaitEventsTimeout ignoring messages
The bitmask passed to MsgWaitForMultipleObjects was missing
QS_SENDMESSAGE, causing glfwWaitEventsTimeout not to return when the
thread received messages sent from other threads.

Fixes #2408

(cherry picked from commit 509f4131be)
2023-11-28 22:15:23 +01:00
Camilla Löwy
ff156743ab Update Doxyfile template for Doxygen 1.9.7
This was adapted to 3.3-stable from
938a3c29b2.
2023-11-28 22:04:48 +01:00
Doug Binks
489339b837 Updated credit
(cherry picked from commit 3ed6e9d89a)
2023-11-27 17:12:44 +01:00
Doug Binks
af93f06259 Add credits
Related to #2386 and #2420

(cherry picked from commit 9a80225ddf)
2023-11-27 17:12:40 +01:00
Doug Binks
8ef347157a Updated changelog
(cherry picked from commit 46c2e35c55)
2023-11-27 17:10:50 +01:00
moritz-h
c754de5deb Win32: Add library name suffix to pkg-config file
Closes #2386

This was adapted to 3.3-stable from
93a3ba8080.
2023-11-27 17:01:35 +01:00
Andy Williams
bf429fb628 Fix macOS Print Screen
Many years ago this value was changed from F13 to Print Screen with
1ae9ce1e0a.  However, this was later
reverted to F13 with 5759d0fdf2.

This changes it back to Print Screen for consistency with other
platforms.

Closes #1786
Fixes #2169

(cherry picked from commit c940695eb0)
2023-11-16 22:50:41 +01:00
Camilla Löwy
8da6223c90 Wayland: Cleanup
Update naming and declarations to current standard.

(cherry picked from commit 3eaf1255b2)
2023-07-19 17:51:56 +02:00
Camilla Löwy
c3f15da23a Wayland: Merge function called once
This brings together the two halves of the cursor setting logic for the
fallback decorations.

(cherry picked from commit 6b48f2be97)
2023-07-19 17:51:53 +02:00
Camilla Löwy
1d766c8b39 Wayland: Fix fallback decorations emitting errors
A GLFW_CURSOR_UNAVAILABLE error would be emitted each time the cursor
moved over the fallback decorations if the standard cursor shape
appropriate for that part was missing on the system.

These errors served no useful purpose and have been removed.

(cherry picked from commit 00a663dafd)
2023-07-19 17:50:49 +02:00
TheBrokenRail
67d722788d Wayland: Fix detection of joysticks after init
Closes #2198

This was adapted to 3.3-stable from
0b94e1b29b and
3fa2360720.
2023-07-19 17:48:46 +02:00
Camilla Löwy
06a2ed38ea Fix glfwinfo output of Vulkan layer spec version
(cherry picked from commit f27daa34ad)
2023-07-19 17:44:21 +02:00
Camilla Löwy
0c2db4a23e Wayland: Add initial support for libdecor
This is partly based on the implementation of libdecor support in
PR #1693 by @ christianrauch.

Where available, the libdecor library is loaded at init and becomes the
preferred method for window decorations.  On compositors that support
XDG decorations, libdecor in turn uses those.  If not, libdecor has
a plug-in archtecture and may load additional libraries to either use
compositor-specific decorations or draw its own.

If necessary, support for libdecor can be disabled with the
GLFW_WAYLAND_LIBDECOR init hint.  This is mostly in case some part of
the dynamic loading or duplication of header material added here turns
out to cause problems with future versions of libdecor-0.so.0.

Fixes #1639
Closes #1693
Related to #1725

This was adapted to 3.3-stable from
fbdb53b9ca.
2023-07-19 17:23:25 +02:00
Camilla Löwy
1ad5df8032 Wayland: Simplify decoration side detection
This commit simplifies the detection of which element of a fallback
decorated window the pointer has entered.  Instead of looping through
the list of windows, the user pointer of fallback decoration surfaces is
set to the GLFW window object.

(cherry picked from commit cd466cf9fd)
2023-03-28 17:46:41 +02:00
Camilla Löwy
95b35c43c2 Wayland: Clean up enum value names
(cherry picked from commit 39f0e86228)
2023-03-28 17:44:56 +02:00
Camilla Löwy
e5d19c9fac Wayland: Simplify per-window ouput scales tracking
This replaces (one case of) manual management of weak links between
windows and monitors, both objects with complex life times, with
wl_object pointers used as opaque key values.

(cherry picked from commit efa9297a41)
2023-03-28 17:43:39 +02:00
Camilla Löwy
5ac970120a Wayland: Use tags to verify proxy ownership
This is in preparation for adding support for libdecor, which creates
its own proxies on our display.  It will likely also be helpful to some
people using native access on Wayland.

This is partly based on the implementation of libdecor support in
PR #1693 by @ christianrauch.

(cherry picked from commit 91c837ace5)
2023-03-28 17:38:33 +02:00
Camilla Löwy
677fbb0f82 Wayland: Remove duplicate setting of user data
The surface user data is already set by wl_surface_add_listener.

(cherry picked from commit 6d9083af03)
2023-03-28 17:36:29 +02:00
Camilla Löwy
a29b5f38c6 Wayland: Stop manually tracking interface versions
This is already tracked by the proxies we care about.

(cherry picked from commit 4cf510511c)
2023-03-28 17:36:22 +02:00
Camilla Löwy
1de73c0dc5 Wayland: Emit size event when setting aspect ratio
(cherry picked from commit c1a79c1c41)
2023-03-28 17:36:18 +02:00
Camilla Löwy
a6e3efbafc Wayland: Fix some missing window refresh events
(cherry picked from commit 8397b39afa)
2023-03-28 17:36:13 +02:00
Camilla Löwy
ba99e20f6a Wayland: Fix decorations not always being created
If a window was initially fullscreen then it would not get an XDG
decoration object.  If the window was later switched to windowed mode it
would then get fallback decorations instead of XDG ones.

(cherry picked from commit 735fc101f5)
2023-03-28 17:36:09 +02:00
Camilla Löwy
8522447792 Wayland: Simplify test for fallback decorations
The GLFW fallback decorations only exist when the window is visible,
decorated and in windowed mode.

(cherry picked from commit 228428fa4f)
2023-03-28 17:36:05 +02:00
Camilla Löwy
ba80e23dab Wayland: Pick more plausible default cursor size
This is not intended as a replacement for actually querying the desktop
for the correct size, but it appears to be a better fallback value.

(cherry picked from commit 82e77dbff4)
2023-03-28 17:36:01 +02:00
Juan Ramos
2178c3e536 Update to actions/checkout@v3
Fixes the following CI warning:

"Node.js 12 actions are deprecated. Please update the following
actions to use Node.js 16: actions/checkout@v2..."

Closes #2255

(cherry picked from commit 9a87635686)
2023-03-28 17:35:56 +02:00
Juan Ramos
1b4e126dc0 Remove CMAKE_LEGACY_CYGWIN_WIN32 CMake option
This was needed for compatibility with CMake versions before 2.8.4.

Related to #2256

(cherry picked from commit 30b91c8b60)
2023-03-28 17:27:25 +02:00
Camilla Löwy
71dfc3f65c Add support for manually running build workflow
(cherry picked from commit 8f470597d6)
2023-03-28 17:26:31 +02:00
Camilla Löwy
4a33051456 Update change log and add credit
Related to #2225

This was adapted to 3.3-stable from
57cbded076.
2023-01-07 23:45:04 +01:00
Takuro Ashie
b06a91e92b Wayland: Fix wrong array size for _GLFWofferWayland
Closes #2225

(cherry picked from commit 41d8da1cea)
2023-01-07 23:13:16 +01:00
Camilla Löwy
c7a5333873 Add window surface creation to glfwinfo
The glfwinfo tool now attempts Vulkan surface creation via
glfwCreateWindowSurface and reports the results.

(cherry picked from commit 0beadfdc66)
2022-11-23 21:42:56 +01:00
Camilla Löwy
05e28537a3 Remove Doxyfile tags deprecated by Doxygen 1.9.5
(cherry picked from commit d299d9f788)
2022-10-31 22:16:33 +01:00
Camilla Löwy
af3e14fbc2 Document X11 WM_CLASS hint behavior
Fixes #2180

(cherry picked from commit ed1d9e1ca7)
2022-10-31 22:13:27 +01:00
Camilla Löwy
d36d062d72 Win32: Remove unhelpful helper function
(cherry picked from commit ab3ea8ac9f)
2022-10-31 22:13:01 +01:00