Commit Graph

34 Commits

Author SHA1 Message Date
Camilla Löwy
ed1d9e1ca7 Document X11 WM_CLASS hint behavior
Fixes #2180
2022-09-15 22:25:10 +02:00
Camilla Löwy
c812b9d87c Add conditional compilation for platform units
This is a step towards being able to compile GLFW manually without
needing to duplicate a lot of platform- or OS-specific logic.
2022-09-15 22:24:39 +02:00
Camilla Löwy
ef6c9d8b4f 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
2022-08-01 19:19:51 +02:00
Michael Pennington
b9ed25d2e9 Wayland: Add GLFW_WAYLAND_APP_ID window hint
This adds a window hint string for the xdg_toplevel::app_id, which is
used by desktop environments to connect windows with application icons
and other information.  This is similar to the WM_CLASS property on X11.

A few very minor fixes were done by @elmindreda during merge.

Fixes #2121
Closes #2122
2022-07-24 17:51:54 +02:00
Camilla Löwy
71be34a6c3 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
2022-07-15 16:17:12 +02:00
Camilla Löwy
91a96ed434 Update changelog and add credit
Related to #2042
Related to #2043
2022-07-15 16:17:12 +02:00
Camilla Löwy
6dd526fb1a Win32: Fix right Shift scancode when using CJK IME
Fixes #2050
2022-07-11 20:54:22 +02:00
Camilla Löwy
8e725338bf Add credit
Related to #2150
2022-07-11 20:54:03 +02:00
Camilla Löwy
dfb26023fc Update changelog and add credit
Related to #2113
Related to #2120
2022-07-07 23:48:42 +02:00
Camilla Löwy
0d599026d0 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
2022-07-07 23:47:48 +02:00
Camilla Löwy
0f5b095042 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
2022-06-20 00:57:17 +02:00
Camilla Löwy
ddd087d662 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
2022-06-20 00:57:17 +02:00
Camilla Löwy
d3ede7b684 Add credit
Related to #2108
2022-06-10 00:14:05 +02:00
Camilla Löwy
2c204ab52e 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
2022-06-08 22:14:38 +02:00
Camilla Löwy
f843d53333 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
2022-04-21 15:56:01 +02:00
Camilla Löwy
4cb36872a5 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
2022-04-03 20:09:42 +02:00
Camilla Löwy
955fbd9d26 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
2022-03-18 00:45:12 +01:00
Camilla Löwy
07a5518c3e 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
2022-03-18 00:45:04 +01:00
Camilla Löwy
66a4882eb1 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
2022-03-18 00:23:20 +01:00
Camilla Löwy
03cfe957e7 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
2022-03-18 00:19:01 +01:00
Camilla Löwy
46950a5e61 Fix button field names in input guide
Fixes #2056
2022-03-13 15:27:25 +01:00
Camilla Löwy
1461c59aa2 Update changelog and add credit
Related to #1951
2022-03-10 20:04:56 +01:00
Camilla Löwy
cd22e28495 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
2022-03-03 22:16:59 +01:00
Camilla Löwy
d3e4fcf8b7 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
2022-03-02 19:38:41 +01:00
Camilla Löwy
ad01c1b614 Win32: Fix key name code changing global key state
This prevents glfwInit from potentially clobbering the dead key state
for other applications.

Closes #2018
2022-03-02 19:38:41 +01:00
Camilla Löwy
7f6aa587f8 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
2022-02-02 19:20:32 +01:00
Jason Francis
094aa6d3c7 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
2021-12-24 00:55:31 +01:00
Camilla Löwy
fbfd7e65c8 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
2021-12-01 21:13:00 +01:00
Camilla Löwy
e40fa3bb94 Add credits and update changelog 2021-12-01 20:23:04 +01:00
Camilla Löwy
a30cd6acef Add credit
Related to #1998
2021-11-25 23:24:39 +01:00
Camilla Löwy
b55a517ae0 Add credit
Related to #1994
2021-11-22 21:32:34 +01:00
Camilla Löwy
999962bd2f Update changelog and add credit
Related to #1980
2021-10-27 23:14:19 +02:00
Camilla Löwy
76a5f781db Add glfwInitVulkanLoader
This removes the GLFW_VULKAN_STATIC CMake option and the
_GLFW_VULKAN_STATIC configuration macro and replaces them with the
glfwInitVulkanLoader function, allowing a single library binary to
provide both behaviors.

This is based on the design from PR #1374 by @pmuetschard.

Closes #1374
Closes #1890
2021-10-27 18:22:05 +02:00
Camilla Löwy
53d7622a3a Move list of contributors to separate file
Fixes #1839
2021-10-27 18:19:38 +02:00