Commit Graph

5451 Commits

Author SHA1 Message Date
Camilla Löwy
fbdb53b9ca Wayland: Add initial support for libdecor
This is partly based on the implementation of libdecor support in
PR #1693 by @ christianrauch.

Where available, the libdecor library is loaded at init and becomes the
preferred method for window decorations.  On compositors that support
XDG decorations, libdecor in turn uses those.  If not, libdecor has
a plug-in archtecture and may load additional libraries to either use
compositor-specific decorations or draw its own.

If necessary, support for libdecor can be disabled with the
GLFW_WAYLAND_LIBDECOR init hint.  This is mostly in case some part of
the dynamic loading or duplication of header material added here turns
out to cause problems with future versions of libdecor-0.so.0.

Fixes #1639
Closes #1693
Related to #1725
2023-03-27 22:03:36 +02:00
Camilla Löwy
cd466cf9fd Wayland: Simplify decoration side detection
This commit simplifies the detection of which element of a fallback
decorated window the pointer has entered.  Instead of looping through
the list of windows, the user pointer of fallback decoration surfaces is
set to the GLFW window object.
2023-03-27 22:03:36 +02:00
Camilla Löwy
39f0e86228 Wayland: Clean up enum value names 2023-03-27 22:03:36 +02:00
Camilla Löwy
efa9297a41 Wayland: Simplify per-window ouput scales tracking
This replaces (one case of) manual management of weak links between
windows and monitors, both objects with complex life times, with
wl_object pointers used as opaque key values.
2023-03-27 22:03:36 +02:00
Camilla Löwy
91c837ace5 Wayland: Use tags to verify proxy ownership
This is in preparation for adding support for libdecor, which creates
its own proxies on our display.  It will likely also be helpful to some
people using native access on Wayland.

This is partly based on the implementation of libdecor support in
PR #1693 by @ christianrauch.
2023-03-27 22:03:36 +02:00
Camilla Löwy
6d9083af03 Wayland: Remove duplicate setting of user data
The surface user data is already set by wl_surface_add_listener.
2023-03-27 22:03:36 +02:00
Camilla Löwy
4cf510511c Wayland: Stop manually tracking interface versions
This is already tracked by the proxies we care about.
2023-03-27 22:03:36 +02:00
Camilla Löwy
c1a79c1c41 Wayland: Emit size event when setting aspect ratio 2023-03-27 22:03:36 +02:00
Camilla Löwy
8397b39afa Wayland: Fix some missing window refresh events 2023-03-27 22:03:36 +02:00
Camilla Löwy
735fc101f5 Wayland: Fix decorations not always being created
If a window was initially fullscreen then it would not get an XDG
decoration object.  If the window was later switched to windowed mode it
would then get fallback decorations instead of XDG ones.
2023-03-27 22:03:36 +02:00
Camilla Löwy
228428fa4f Wayland: Simplify test for fallback decorations
The GLFW fallback decorations only exist when the window is visible,
decorated and in windowed mode.
2023-03-27 22:03:36 +02:00
Camilla Löwy
82e77dbff4 Wayland: Pick more plausible default cursor size
This is not intended as a replacement for actually querying the desktop
for the correct size, but it appears to be a better fallback value.
2023-03-27 22:03:36 +02:00
Juan Ramos
9a87635686 Update to actions/checkout@v3
Fixes the following CI warning:

"Node.js 12 actions are deprecated. Please update the following
actions to use Node.js 16: actions/checkout@v2..."

Closes #2255
2023-03-03 14:47:15 +01:00
Camilla Löwy
2b580012da Add credit
Related to #2199
2023-03-03 14:46:43 +01:00
Yoshinori Sano
5c463a9070 Win32: Fix typo in error description
Closes #2199
2023-03-03 14:36:12 +01:00
Camilla Löwy
9b1f63bad9 Add credit
Closes #2256
2023-03-02 17:47:36 +01:00
Juan Ramos
1c9fcdc9df Simplify setting of GLFW_STANDALONE CMake variable
Use string(COMPARE EQUAL ...) instead of a whole if() statement.

Related to #2256
2023-03-02 17:44:18 +01:00
Juan Ramos
30b91c8b60 Remove CMAKE_LEGACY_CYGWIN_WIN32 CMake option
This was needed for compatibility with CMake versions before 2.8.4.

Related to #2256
2023-03-02 17:42:34 +01:00
Juan Ramos
e0ae1c45df Remove setting of CMake policy CMP0054
This policy is already set to NEW by requiring CMake 3.4.

Related to #2256
2023-03-02 17:40:32 +01:00
Camilla Löwy
8f470597d6 Add support for manually running build workflow 2023-01-26 18:41:46 +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
Takuro Ashie
b06a91e92b Wayland: Fix wrong array size for _GLFWofferWayland
Closes #2225

(cherry picked from commit 41d8da1cea)
2023-01-07 23:13:16 +01:00
Camilla Löwy
57cbded076 Add credit
Related to #2225
2022-12-16 13:44:59 +01:00
Takuro Ashie
41d8da1cea
Wayland: Fix wrong array size for _GLFWofferWayland
Closes #2225
2022-12-16 13:40:36 +01:00
TheBrokenRail
00967cbb8a
Linux: Fix joystick input being disabled
Closes #2192
2022-12-15 20:18:59 +01:00
Camilla Löwy
c7a5333873 Add window surface creation to glfwinfo
The glfwinfo tool now attempts Vulkan surface creation via
glfwCreateWindowSurface and reports the results.

(cherry picked from commit 0beadfdc66)
2022-11-23 21:42:56 +01:00
Camilla Löwy
05e28537a3 Remove Doxyfile tags deprecated by Doxygen 1.9.5
(cherry picked from commit d299d9f788)
2022-10-31 22:16:33 +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
d36d062d72 Win32: Remove unhelpful helper function
(cherry picked from commit ab3ea8ac9f)
2022-10-31 22:13:01 +01:00
Camilla Löwy
493df4a0b5 EGL: Cleanup
Both config parameters are "desired", but one is older and never had its
name updated.

This commit at least makes it clearer that they are similar.

(cherry picked from commit ab1b1edfd0)
2022-10-31 22:05:22 +01:00
Camilla Löwy
31b038663a EGL: Add better error for no stereo
(cherry picked from commit 93e93135f2)
2022-10-31 22:04:00 +01:00
Camilla Löwy
6fb86c089e EGL: Add better errors for client API mismatch
Because EGL ties client API support to configs, attempts to create
a context with an unavailable client API will fail with the unhelpful
"failed to find suitable config" error description.

This attempts to detect cases where there are usable configs for the
other client API and emit a hopefully more helpful error.

Related to #2173

(cherry picked from commit e057666642)
2022-10-31 22:03:56 +01:00
Camilla Löwy
bc36010350 Check if context creation APIs match when sharing
(cherry picked from commit 6b57e08bb0)
2022-10-31 22:03:47 +01:00
Camilla Löwy
bd13f55ca8 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.

(cherry picked from commit 2c0f34b60f)
2022-10-31 22:03:35 +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
1f675ab62f GLX: Add support for loading glvnd libGLX
(cherry picked from commit c18851f52e)
2022-10-31 21:57:21 +01:00
Camilla Löwy
ed55529ce8 EGL: Add support for loading glvnd libOpenGL
(cherry picked from commit 55aad3c37b)
2022-10-31 21:48:45 +01:00
Camilla Löwy
426c6ed6b1 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.

(cherry picked from commit 7d73629e50)
2022-10-31 21:48:04 +01:00
Camilla Löwy
1fe29e2c19 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.

(cherry picked from commit 2efc598d70)
2022-10-31 21:47:57 +01:00
TheChocolateOre
34bfb52641 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

(cherry picked from commit 2e12ef00bb)
2022-10-31 21:47:01 +01:00
Camilla Löwy
3670cd0561 Wayland: Remove unreachable code
This platform function is only called if the cursor is enabled.

(cherry picked from commit 3a5c726d1b)
2022-10-31 21:34:38 +01:00
Camilla Löwy
0ee9b7281b Wayland: Clean up pointer helper function order
(cherry picked from commit 7be6a2cabe)
2022-10-31 21:34:33 +01:00
Camilla Löwy
5f3e5542cf 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.

(cherry picked from commit a46f829de8)
2022-10-31 21:29:42 +01:00
Camilla Löwy
632d35e0d4 Wayland: Fix leaks of pointer related objects
(cherry picked from commit 03af6b3d4c)
2022-10-31 21:19:15 +01:00
Camilla Löwy
5189d52ae3 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.

(cherry picked from commit e85b645b8a)
2022-10-31 21:18:12 +01:00
Camilla Löwy
78edf2516e Wayland: Static function more static when static
(cherry picked from commit 26b85215c0)
2022-10-31 21:12:07 +01:00
Camilla Löwy
74090d30cd Wayland: Clean up cursor theme loading
(cherry picked from commit 6987294df9)
2022-10-31 21:12:01 +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
b08271d315 Wayland: Clean up shared memory buffer creation
(cherry picked from commit 7cc8b053b8)
2022-10-31 21:02:14 +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