Commit Graph

4495 Commits

Author SHA1 Message Date
Camilla Löwy
bfa24c9f2d Fix glfwGetKeyName incorrectly emitting error
glfwGetKeyName emitted GLFW_INVALID_VALUE when passed GLFW_KEY_UNKNOWN
and any scancode not associated with a key token on that platform.

This causes physical keys with no associated key token to emit
GLFW_INVALID_VALUE when the key and scancode are passed directly from
the key event to glfwGetKeyName.  This breaks the promise made in the
reference documentation for glfwGetKeyName.

This commit removes that error for the whole range of valid scancodes.

Fixes #1785
Fixes #2214

This was adapted to 3.3-stable from
86bf5698ec.
2024-02-05 16:25:27 +01:00
Camilla Löwy
20bd0329a5 Clarify event test reporting of keys
Reshuffled line to group key-related items together.  Omitted key code
output for unknown keys to put focus on the (lack of) name.

(cherry picked from commit d81fcb93f1)
2024-02-05 16:25:27 +01:00
Camilla Löwy
fafcba3824 Wayland: Clean up pointer axis handler
(cherry picked from commit 9afbcb442b)
2024-02-05 16:25:27 +01:00
Camilla Löwy
7554375d6d Update CODEOWNERS file
(cherry picked from commit cf29ff2b9d)
2024-02-02 13:27:42 +01:00
Camilla Löwy
dbe2d7cb4a Set timeout for build GH workflow jobs
This is in order to catch and stop any malfunctioning job.

This was adapted to 3.3-stable from
d5461d2927ac712ded603f7f133f18e9a02caeb4.
2024-02-02 13:26:50 +01:00
Camilla Löwy
76227fa519 Fix missing error in docs for glfwCreateWindow
The GLFW_NO_WINDOW_CONTEXT error can be emitted if the window passed in
for context sharing does not have a context.

Fixes #2456

(cherry picked from commit 73948e6c0f)
2024-01-14 23:57:45 +01:00
Camilla Löwy
0161cde6f3 Add build- prefix to .gitignore
(cherry picked from commit 5a9ea8f99f)
2024-01-14 23:57:44 +01:00
Camilla Löwy
c710d2c05d Wayland: Fix segfault on termination
A segfault could occur during termination if libdecor was found but no
windows were created between initialization and termination.  The wait
for libdecor to finish its initialization was only performed before
window creation, not at termination.

Regression introduced by 9fdc425931.

This was adapted to 3.3-stable from
4e8c4901e9.
2024-01-14 23:57:44 +01:00
Camilla Löwy
a943d9ac17 Add credit
I lost track of the existing PR #2254 when fixing #2161 with
5e4496cb42.

Closes #2254

(cherry picked from commit ab09dc8fb1)
2024-01-14 23:57:44 +01:00
Camilla Löwy
7998629ad2 Linux: Fix regfree being called on invalid data
This was caused by a careless merge that did not take the differences
between the branches into account.

Regression introduced by 7c7cc59889.

Fixes #2464
2024-01-14 23:56:09 +01:00
Camilla Löwy
9ba47ca13a Start 3.3.10 2024-01-14 23:27:14 +01:00
Camilla Löwy
e2c9264546 Update changelog
These are changes since the release of 3.3.8 but not since 3.3, and
mistakenly did not get changelog entries when merged to 3.3-stable.
2023-12-12 19:00:27 +01:00
Camilla Löwy
7b60753aeb Cocoa: Fix segfault querying joystick elements
It is reportedly possible for IOHIDDeviceCopyMatchingElements to return
NULL on macOS 13 if the application lacks input monitoring permissions.

This commit only prevents the segfault.  More work will be needed to
correctly handle this situation, including Game Controller support.

Related to #2320
Closes #2321

(cherry picked from commit 2c1d31009f)
2023-12-12 18:48:53 +01:00
Camilla Löwy
628385e99e Update changelog and add credit
Related to #2348

(cherry picked from commit ea3ea62708)
2023-12-12 16:06:10 +01:00
lo-v-ol
217c269d66 EGL: Fix GLFW_CONTEXT_NO_ERROR on Mesa
Mesa EGL requires the context version to be set to 2.0 or greater before
EGL_CONTEXT_OPENGL_NO_ERROR_KHR in the attribute list.

Without this, context creation via Mesa EGL with
EGL_CONTEXT_OPENGL_NO_ERROR_KHR set fails with EGL_BAD_ATTRIBUTE.

Fixes #2348

(cherry picked from commit eeeb56eb23)
2023-12-12 16:04:57 +01:00
Camilla Löwy
6ea5bf9032 Fix Markdown formatting for changelog entry
(cherry picked from commit 378e5fc814)
2023-12-12 16:03:37 +01:00
Camilla Löwy
1fab407e44 Update changelog and add credit
Related to #2377
Related to #2405

This was adapted to 3.3-stable from
7b152019da.
2023-12-12 16:02:47 +01:00
FuzzyQuills
7cdd41170b Cocoa: No NSWindowStyleMaskResizable in fullscreen
On macOS 10.15 Catalina and earlier, not having the resizable bit
cleared in NSWindowStyleMask in fullscreen leads to windows minimising
when clicked anywhere in the content area.

On all tested macOS versions it also causes the fullscreen window to be
resizable by the user.

Regression introduced by 0d599026d0.

Fixes #2377
Closes #2405

(cherry picked from commit 8e9a5d29a8)
2023-12-12 15:58:33 +01:00
Camilla Löwy
e0de6ea513 EGL: Only use EGL_EXT_present_opaque on Wayland
The EGL_EXT_present_opaque extension is primarily a workaround meant for
Wayland, even if the language in it doesn't mention this.  GLFW
previously always enabled this extension where supported.  This caused
issues on X11 when running the Nvidia binary blob.

This commit ensures the extension is only enabled on Wayland.

Fixes #2365

This was adapted to 3.3-stable from
46cebb5081.
2023-12-07 18:04:48 +01:00
Camilla Löwy
79d957ca18 Add credit
Fixes #2397

(cherry picked from commit 68edc66aa4)
2023-12-07 18:04:48 +01:00
Camilla Löwy
63bba49e31 Cocoa: Fix compilation error on OS X 10.8
The occlusion state parts of NSWindow are OS X 10.9+ only but we still
(technically) support building for only 10.8.

Fixes #2161

(cherry picked from commit 5e4496cb42)
2023-12-07 18:04:48 +01:00
Peter Johnson
80d45cdfd7 Win32: Fix invalid hat bit mask being accepted
It is reportedly possible to get opposing directions of an XInput DPad
bit mask set simultaneously with some controllers.

This commit ensures that those values are not passed on to other parts
of GLFW.

This commit is based on the PR #2291 by @ PeterJohnson but with the
following changes:
 - moved XInput-specific special case to XInput implementation
 - attempt to preserve data by only masking out the invalid axis
 - admin (credit, changelog, commit message)

Closes #2291

(cherry picked from commit 52405a9d59)
2023-12-07 18:04:48 +01:00
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