Commit Graph

19 Commits

Author SHA1 Message Date
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