Commit Graph

47 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
8b4f1ebbea Wayland: Fix window opacity on older systems
On systems lacking the EGL_EXT_present_opaque extension, some
compositors treat any buffer with an alpha channel as per-pixel
transparent.

This commit ignores any EGLConfig with an alpha channel if the extension
is missing and the window is created with GLFW_TRANSPARENT_FRAMEBUFFER
set to false.

This is technically not a breaking change since GLFW_ALPHA_BITS is not
a hard constraint, but it is still going to inconvenience anyone using
the framebuffer alpa channel to store other kinds of data.

Related to #1895

(cherry picked from commit ef6c9d8b4f)
2022-10-31 22:02:06 +01:00
Camilla Löwy
ad206bdaee Wayland: Fix crash if mouse connected after init
The cursor theme was only loaded if the chosen seat had a mouse
(wl_pointer) during initialization.  If a mouse was connected only after
glfwInit, there would be no cursor theme but the rest of the cursor
related code assumed one had already been loaded.

This also moves the details of cursor theme loading out into a separate
function to declutter platform init.

Because the original cursor theme loading code checked whether we got
a wl_shm, and because the rest of the code just assumes we have
a wl_shm, initialization will now fail if there isn't one.

Fixes #1450

(cherry picked from commit 71be34a6c3)
2022-10-31 21:11:11 +01:00
Camilla Löwy
2ca3bda1cc Update changelog and add credit
Related to #2042
Related to #2043

(cherry picked from commit 91a96ed434)
2022-10-31 20:59:10 +01:00
Camilla Löwy
0f341802e1 Win32: Fix right Shift scancode when using CJK IME
Fixes #2050

(cherry picked from commit 6dd526fb1a)
2022-07-15 00:11:23 +02:00
Camilla Löwy
8d989cdc41 Add credit
Related to #2150

(cherry picked from commit 8e725338bf)
2022-07-15 00:11:23 +02:00
Camilla Löwy
876a177f6c Update changelog and add credit
Related to #2113
Related to #2120

(cherry picked from commit dfb26023fc)
2022-07-15 00:11:23 +02:00
Camilla Löwy
9950cc52df Cocoa: Fix clearing of unrelated window style bits
Whenever GLFW changed the window style mask, a new mask was created
from scratch based on the attributes set on the GLFW window object.
This caused us to potentially clear unrelated window style bits.

This was always wrong but became a critical issue when Cocoa began
throwing an exception if an application cleared the
NSWindowStyleMaskFullScreen while the window is in macOS fullscreen.

This commit reworks all style mask editing so it only changes the
relevant bits, preserving all others.

This is only a narrow bug fix to prevent crashes, intended for the
stable branch.  Our interaction with macOS fullscreen is still very
poor.  The next step after this is a set of patches that improve the
interaction between the current API and macOS fullscreen.

Fixes #1886
Fixes #2110

(cherry picked from commit 0d599026d0)
2022-07-13 23:20:54 +02:00
Camilla Löwy
cdbcb8c5a7 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

(cherry picked from commit 0f5b095042)
2022-07-13 22:47:03 +02:00
Camilla Löwy
dea602623d 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

(cherry picked from commit ddd087d662)
2022-07-13 22:47:03 +02:00
Camilla Löwy
3ec59687f1 Add credit
Related to #2108

(cherry picked from commit d3ede7b684)
2022-07-12 20:29:22 +02:00
Camilla Löwy
416f7828ff 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

This is adapted to 3.3-stable from
2c204ab52e and
fd7e737216.
2022-07-12 20:27:34 +02:00
Camilla Löwy
4143d96228 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

(cherry picked from commit f843d53333)
2022-06-09 19:41:10 +02:00
Camilla Löwy
05422e2824 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

(cherry picked from commit 4cb36872a5)
2022-06-09 19:39:28 +02:00
Camilla Löwy
307ccd68a5 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

(cherry picked from commit 955fbd9d26)
2022-05-06 19:34:05 +02:00
Camilla Löwy
de550b60e5 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

(cherry picked from commit 07a5518c3e)
2022-05-06 19:34:05 +02:00
Camilla Löwy
802882f7cb 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

(cherry picked from commit 66a4882eb1)
2022-05-06 19:34:05 +02:00
Camilla Löwy
32df2ed716 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

(cherry picked from commit 03cfe957e7)
2022-05-06 19:34:04 +02:00
Camilla Löwy
45ce5ddd19 Fix button field names in input guide
Fixes #2056

(cherry picked from commit 46950a5e61)
2022-03-20 16:03:55 +01:00
Camilla Löwy
395f0a8b63 Update changelog and add credit
Related to #1951

(cherry picked from commit 1461c59aa2)
2022-03-20 16:03:30 +01:00
Camilla Löwy
5ccc756c56 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

(cherry picked from commit cd22e28495)
2022-03-13 16:17:25 +01:00
Camilla Löwy
ca1a98e7a2 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

(cherry picked from commit d3e4fcf8b7)
2022-03-13 16:07:11 +01:00
Camilla Löwy
dccec7fcae 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

(cherry picked from commit 7f6aa587f8)
2022-02-15 21:24:03 +01:00
Jason Francis
8ecb49d143 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

(cherry picked from commit 094aa6d3c7)
2021-12-24 01:59:16 +01:00
Camilla Löwy
e10def6de7 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

(cherry picked from commit fbfd7e65c8)
2021-12-08 20:05:32 +01:00
Camilla Löwy
18d7c241f8 Add credits and update changelog
(cherry picked from commit e40fa3bb94)
2021-12-08 20:02:50 +01:00
Camilla Löwy
689840f2eb Add credit
Related to #1998

(cherry picked from commit a30cd6acef)
2021-11-30 19:04:04 +01:00
Camilla Löwy
bfd9eaf092 Fix mappings for gamepads present at init
Joysticks already connected when GLFW was initalized did not get gamepad
mappings applied to them.

Regression introduced by 74a8ba26c3.

This change was backported without taking into account that 3.3.x does
not have on-demand joystick init.

Fixes #1996
2021-11-24 23:09:24 +01:00
Camilla Löwy
6eb24a49df Add credit
Related to #1994

(cherry picked from commit b55a517ae0)
2021-11-24 23:02:05 +01:00
Camilla Löwy
71316f843c Update changelog and add credit
Related to #1980

(cherry picked from commit 999962bd2f)
2021-10-28 12:40:42 +02:00
Camilla Löwy
85f37ada6d Move list of contributors to separate file
Fixes #1839

(cherry picked from commit 53d7622a3a)
2021-10-28 12:33:40 +02:00