Commit Graph

4745 Commits

Author SHA1 Message Date
Camilla Löwy
6b57e08bb0 Check if context creation APIs match when sharing 2022-08-22 19:17:12 +02:00
Camilla Löwy
2c0f34b60f WGL: Fix count of displayable pixel formats
We only care about displayable pixel formats (as defined in
WGL_ARB_pixel_format) for window context creation.

This changes pixel format enumeration to ignore non-displayable formats,
which are specified to be listed after displayable ones, by always using
the return value of DescribePixelFormat as the pixel format count.
2022-08-22 19:15:41 +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
Camilla Löwy
c18851f52e GLX: Add support for loading glvnd libGLX 2022-07-29 19:14:04 +02:00
Camilla Löwy
55aad3c37b EGL: Add support for loading glvnd libOpenGL 2022-07-29 19:14:04 +02:00
Camilla Löwy
0f9a9578f3 Add window hints for initial position
This adds window hints for the initial position, in screen coordinates,
of a window.  The special value GLFW_ANY_POSITION means the window
manager will be allowed to position the window.

It is not possible to set window positions on Wayland and GLFW will
always behave as if these hints are set to GLFW_ANY_POSITION.

Fixes #1603
Fixes #1747
2022-07-29 11:50:13 +02:00
Camilla Löwy
7d73629e50 X11: Preserve unrelated values in WM_NORMAL_HINTS
This stops GLFW overwriting the whole WM_NORMAL_HINTS property every
time it updates size-related parts of it.
2022-07-28 22:50:17 +02:00
Camilla Löwy
2efc598d70 Fix native access macros being mutually exclusive
The documentation was updated with the introduction of run-time platform
selection, but the preprocessor logic was not.
2022-07-28 15:56:47 +02:00
TheChocolateOre
2e12ef00bb
Fix typos and other issues in docs
This fixes spelling, grammar and punctuation issues, missing words and
stray words across the documentation.  A confusing sentence was removed
from the tutorial.

Closes #2085
2022-07-28 15:56:18 +02:00
Camilla Löwy
3a60992a41 Wayland: Add error for unsupported feature 2022-07-25 18:02:57 +02:00
Camilla Löwy
3a5c726d1b Wayland: Remove unreachable code
This platform function is only called if the cursor is enabled.
2022-07-25 18:02:57 +02:00
Camilla Löwy
7be6a2cabe Wayland: Clean up pointer helper function order 2022-07-25 18:02:57 +02:00
Camilla Löwy
488008e0a2 Add cursor mode GLFW_CURSOR_CAPTURED
This adds a cursor mode that provides a visible cursor confined to the
content area of the window.

Fixes #58
2022-07-25 18:02:57 +02:00
Camilla Löwy
a46f829de8 Refactor cursor mode paths
This is the refactoring part of adding GLFW_CURSOR_CAPTURED, separated
out to help keep 3.3-stable similar to the main branch.

Related to #58.
2022-07-25 18:02:57 +02:00
Camilla Löwy
03af6b3d4c Wayland: Fix leaks of pointer related objects 2022-07-25 18:02:35 +02:00
Camilla Löwy
09ebf3f0bf Wayland: Fix error for missing protocol
A protocol not being available is not a platform error.  The platform is
doing fine; we're just sad that it lacks a feature we want.
2022-07-25 18:00:59 +02:00
Camilla Löwy
e85b645b8a Wayland: Clean up pointer locking
Shorten names and allow C99 declarations.  Replace helper function with
the NULL check it was hiding.  Separate cursor hiding from pointer
locking.
2022-07-25 17:53:04 +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
26b85215c0 Wayland: Static function more static when static 2022-07-22 18:00:40 +02:00
Camilla Löwy
6987294df9 Wayland: Clean up cursor theme loading 2022-07-15 16:17:12 +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
7cc8b053b8 Wayland: Clean up shared memory buffer creation 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
Björn Hempel
c424fe5589 Linux: Fix joystick without buttons being ignored
Joysticks in Linux without buttons were ignored by device enumeration.
Remove the mandatory button attribute from detection.

Fixes #2042
Closes #2043
2022-07-15 15:50:06 +02:00
Camilla Löwy
c50d53160f Make events test window appear on Wayland 2022-07-13 21:54:55 +02:00
Camilla Löwy
40b5a8a37c Wayland: Fix reappearing key repeat
If the key or character callback performs actions that indirectly
updates the key repeat timer, those changes would be undone once the key
callback returned.

This fixes the order of operations so that key repeat is fully set up
before the key related events are emitted.
2022-07-13 21:54:55 +02:00
Camilla Löwy
9180923ea0 Wayland: Clean up key repeat logic 2022-07-13 21:54:55 +02:00
Camilla Löwy
a1a73ee862 Wayland: Make text input logic static
Since the seat listener was moved into wl_window.c there is no reason
for text input to have external linkage.
2022-07-13 21:51:04 +02:00
Camilla Löwy
e47cb7c1e2 Wayland: Update state before emitting events 2022-07-13 20:47:10 +02:00
Camilla Löwy
4df24735ef Wayland: Do not emit events for destroyed window
During platform window destruction, all of its callbacks have already
been removed, so emitting events for it does nothing.
2022-07-13 20:47:10 +02:00
Camilla Löwy
d77aaa770f Wayland: Fix non-standard struct initialization 2022-07-13 12:53:25 +02:00
Camilla Löwy
aa80d24d01 Documentation work
Fixes #1596
2022-07-12 19:08:01 +02:00
Camilla Löwy
fd7e737216 Linux: Fix duplicate joystick objects
This fixes a regression introduced by
2c204ab52e.  This broke the check for
whether there is already a GLFW joystick object for a given input
device, making it always fail.
2022-07-12 11:53:13 +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
2796e61af7 Documentation work 2022-07-11 20:54:22 +02:00
Camilla Löwy
88a39006e3 Wayland: Cleanup 2022-07-11 20:54:21 +02:00
Camilla Löwy
5c948a6e6e Wayland: Fix comment typo 2022-07-11 20:54:21 +02:00
Camilla Löwy
8e725338bf Add credit
Related to #2150
2022-07-11 20:54:03 +02:00
JoelNiemela
060631c965 Fix typos in docs
Closes #2150
2022-07-11 20:52:43 +02:00
Camilla Löwy
36f0bf00a9 Cocoa: Fix build failure on OS X 10.11
The NSWindowCollectionBehaviorFullScreenNone enum value is missing from
system headers on 10.11 despite the documentation claiming it was added
in 10.7.

Unfortunately Apple has taken down all API release notes for versions
prior to 10.14.

This fixes a build failure introduced with
98d6e8485b.
2022-07-08 16:07:11 +02:00
Camilla Löwy
84e165ef64 Win32: Work around warnings on MSVC 19.32.x 2022-07-08 00:24:03 +02:00
Camilla Löwy
2db528d8cd Cocoa: Cleanup 2022-07-07 23:48:43 +02:00
Camilla Löwy
78b19548d9 Documentation work
Related to #2113
Related to #2120
2022-07-07 23:48:43 +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
Nikita Fediuchin
9b7713cf92 Cocoa: Fix search path for private Vulkan loader
According to both Apple and LunarG, a private copy of the macOS Vulkan
loader libvulkan.1.dylib should be placed in the Frameworks directory
of the bundle and not its main executable directory.

This commit updates the dynamic loading path accordingly.

Fixes #2113
Closes #2120
2022-07-07 23:48:16 +02:00
Camilla Löwy
3b3d58df47 Add support for VK_KHR_portability_enumeration
The use of this extension is required to enable the MoltenVK physical
device as of Vulkan SDK 1.3.216.0.  This is because MoltenVK is still
very (very) slightly non-conformant.
2022-07-07 23:48:16 +02:00
Camilla Löwy
510a08cde2 Update glad to include Vulkan 1.3
Also add the VK_KHR_portability_enumeration extension, which will be
needed on macOS.
2022-07-07 23:48:16 +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
6f8ec4075b Cocoa: Fix GLFW_MAXIMIZED for nonresizable windows
The reasoning here is that glfwRestoreWindow will change nothing for
a windowed non-resizable window on Cocoa, and silently refusing to
maximize seems slightly more like something other platforms would do.

This is possibly either the right thing to do or the wrong one.
2022-07-07 22:24:09 +02:00
Camilla Löwy
98d6e8485b Cocoa: Disable macOS fullscreen when non-resizable
Windows with GLFW_RESIZABLE set to false should not be resizable by the
user.
2022-07-07 22:23:54 +02:00