Commit Graph

335 Commits

Author SHA1 Message Date
OlegAckbar
ee45edf818
Merge 305fcbbf94 into 63a7e8b7f8 2025-08-20 22:52:33 -04:00
Camilla Löwy
7ef6efeb66 Wayland: Fix cursor position after a modal
If a modal surface like the window menu was active, clicking on the GLFW
window content area to close it would correctly emit the cursor enter
event but would not propagate the cursor position from the event.
2025-08-18 20:58:12 +02:00
Camilla Löwy
3cf9f6726d Wayland: Fix fallback decoration cursor updating
When a click through to the fallback decorations caused the end of
a modal like the window menu, the cursor shape would not be updated
until the next time the cursor moved.

This commit adds an update of the cursor for the pointer enter event for
fallback decoration surfaces, in addition to the updates at pointer
motion events.
2025-08-18 18:06:46 +02:00
Camilla Löwy
bfa1c424e5 Wayland: Fix fallback decoration menu placement
The fallback decorations would place the menu at the wrong position, by
not translating the last decoration surface position into toplevel
surface coordinates.

This also limits the menu to the caption area of the top decoration
surface, similar to how other toolkits work.
2025-08-18 18:06:46 +02:00
Doug Binks
0d2d85d19c Revert "Wayland: Keyboard leave event handler now processes key repeats" 2025-08-15 11:27:59 +02:00
Jan Hendrik Farr
768e81a0eb Wayland: Fix key repeat halting
Key repeat shoud only be halted when the repeating key
is released, not when another key is released.
2025-08-14 15:35:04 +02:00
Camilla Löwy
161fb1b6f6 Wayland: Fix fallback decoration scroll events
The fallback decorations would emit scroll events as if scrolling had
occurred over the content area of the window.
2025-08-12 17:11:27 +02:00
Camilla Löwy
645a35a38e Wayland: Cleanup 2025-08-12 17:11:27 +02:00
Camilla Löwy
7523b0e6bd Wayland: Move fallback decoration pointer logic
Decluttered the wl_pointer handlers by moving the bulk of fallback
decoration related logic to separate functions.
2025-08-12 17:11:26 +02:00
Camilla Löwy
5190a30d8a Wayland: Move fallback decoration struct member
The cursorPreviousName member was only used for the fallback decorations
but was not grouped with other related members.
2025-08-12 17:11:26 +02:00
Camilla Löwy
ddbb8e0f2c Wayland: Fix fallback decoration cursor position
If fallback decorations were in use, pointer motion over a decoration
surface would cause glfwGetCursorPos to provide incorrect cursor
positions.

The cursor position is now only updated when the pointer is over the
content area of the window, similar to libdecor and XDG decorations.
2025-08-12 17:11:24 +02:00
Camilla Löwy
5245180c56 Formatting 2025-08-12 17:10:43 +02:00
Doug Binks
7b51a8eb31 Wayland: Keyboard leave event handler now processes key repeats
- Fixes #2736
2025-08-10 18:27:44 +02:00
Camilla Löwy
ac10768495 Wayland: Fix memory leaks in data offer reading
The buffer storing the contents of the data offer being read could leak
if buffer reallocation or reading from the pipe failed.
2025-07-18 12:31:07 +02:00
Doug Binks
feb2a6b728 Wayland: Reset key repeat timer on window destruction
Windows with keyboard focus may have an active key repeat timer.
This should be reset when the window is closed, or key repeat events
could be sent to a NULL window were it not for the quickfix in PR #2732.

Fixes #2741
Probably the source of #2727
2025-07-17 17:24:19 +02:00
Jan Schürkamp
506c11ba43
Wayland: Ignore key repeat events when no window has keyboard focus (#2732)
* Wayland: Ignore key repeat events when no window has keyboard focus
2025-07-05 19:16:08 +02:00
LocalSpook
21fea01161 Wayland: Replace _glfwKeySym2Unicode with xkbcommon
libxkbcommon already provides functions to convert keysyms to codepoints
and UTF-8. The library has offered these functions since 0.5.0[1], so
using them won't cause any compatibility problems.

[1] https://xkbcommon.org/doc/0.5.0/group__keysyms.html

Closes #2444
2024-11-29 12:05:20 +01:00
OlegAckbar
305fcbbf94
Wayland: unset output for fullscreen set operation 2024-06-24 22:39:43 +03:00
Camilla Löwy
b35641f4a3 Wayland: Cleanup 2024-04-12 18:27:53 +02:00
Camilla Löwy
64906f8e64 Wayland: Cleanup 2024-04-12 18:25:06 +02:00
Camilla Löwy
51b6434ac4 Wayland: Fix possible segfault on drag enter
Found with Clang static analysis.
2024-04-11 19:12:17 +02:00
Camilla Löwy
68dcea0d7f Place assertions for handles after init check
This lets automated testing check that GLFW_NOT_INITIALIZED is emitted
for every public function.
2024-03-28 16:53:04 +01:00
Camilla Löwy
38ec7abd3b Fix missing assertions for native access functions 2024-03-28 16:53:04 +01:00
Camilla Löwy
42dc1ffaee Wayland: Fix leak of surface scaling objects 2024-03-28 16:53:04 +01:00
Camilla Löwy
d24ee9953f Start 3.5 2024-02-29 15:42:28 +01:00
Camilla Löwy
af5d250553 Wayland: Remove separate window title copy 2024-02-19 14:20:52 +01:00
Camilla Löwy
690a15f929 Wayland: Implement GLFW_RESIZABLE for XDG toplevel
This implements GLFW_RESIZABLE for all paths where we manage our own
xdg_toplevel, namely XDG decorations and fallback decorations.

Fixes #2203
2024-02-16 00:13:33 +01:00
Camilla Löwy
b61f3fc479 Wayland: Fix invalid size protocol error
This could happen when resizing a window with fallback decorations.

Fixes #2204
2024-02-16 00:13:32 +01:00
Camilla Löwy
a650c69cff Wayland: Decide final window size in one place 2024-02-16 00:12:50 +01:00
Camilla Löwy
2b3f919b60 Wayland: Add support for fractional scaling
This adds basic support for fractional-scale-v1.

Note that this introduces a potential discrepancy between window and
monitor content scales.
2024-02-14 22:35:46 +01:00
Camilla Löwy
a9cc7c7260 Add GLFW_SCALE_FRAMEBUFFER window hint
This adds the GLFW_SCALE_FRAMEBUFFER window hint, enabling control of
framebuffer scaling across Wayland and macOS.  On macOS, this window
hint is a new name for GLFW_COCOA_RETINA_FRAMEBUFFER, and both hint
names will modify the same hint.

This is now a more symmetric counterpart to GLFW_SCALE_TO_MONITOR and,
weirdly, they each apply neatly to half of the supported platforms.

This commit is mostly documentation updates to better integrate and
contrast these two scaling mechanisms.
2024-02-14 22:35:46 +01:00
Camilla Löwy
77ced84e9c Use C99 instead of hard-coded indices 2024-02-13 17:36:35 +01:00
Camilla Löwy
9953f7ead1 Wayland: Cache framebuffer size
The calculation of framebuffer size is about to get more complicated
with the introduction of fractional-scale-v1, so only do it in one
place.

This is also a tiny preparation for eventually behaving better towards
wl_egl_window_resize.
2024-02-12 13:06:59 +01:00
Camilla Löwy
1be7bc546b Wayland: Clean up data types related to scales 2024-02-12 13:06:59 +01:00
Camilla Löwy
4c283e4a3c Wayland: Be more specific about scales
We are about to introduce another scaling method (fractional-scale-v1),
so it will become more important to be specific about what scales are
used where and what their units are.

This removes 'content scale' from window and monitor structs.  A monitor
(output) now has just a 'scale', which becomes a 'buffer scale' when
applied to a window.  A window now has a list of 'output scales' to
select its buffer scale from.  Content scales are calculated from the
respective monitor or window when queried, even if the calculation right
now is to just return the same value as before.
2024-02-12 13:06:59 +01:00
Camilla Löwy
e25c1cc74f Wayland: Make fallback concepts more distinct 2024-02-12 13:06:59 +01:00
Camilla Löwy
72164e6921 Wayland: Remove fallback decoration edge enum 2024-02-12 13:06:32 +01:00
Camilla Löwy
4baeadbd66 Wayland: Put fallback decorations behind a boolean 2024-02-11 12:32:27 +01:00
Camilla Löwy
6ac0835ad2 Wayland: Cleanup 2024-02-09 14:33:13 +01:00
Camilla Löwy
ea6dd72c71 Wayland: Fix GLFW_HOVERED for fallback decorations
When using the fallback decorations, GLFW_HOVERED was true also when the
cursor was over one of the window decorations.

This also disentangles the GLFW_HOVERED state from the fallback
decorations.  Because GLFW_HOVERED should have had the same behavior as
GLFW_MAIN_WINDOW, the latter has been removed.
2024-02-09 14:33:01 +01:00
Camilla Löwy
5e97447dd5 Wayland: Clarify fallback decoration struct name
We now have three window decoration paths in the Wayland backend:
libdecor decorations, XDG decorations and fallback decorations.

This makes it clearer when code relates to the fallback decoration path,
which should increasingly (hopefully) not get used.
2024-02-09 14:22:23 +01:00
Camilla Löwy
d3a7362430 Wayland: Separate window and framebuffer resizing 2024-02-09 14:01:57 +01:00
Camilla Löwy
a360198f8f Wayland: Implement glfwFocusWindow
This implements window focus requests via the xdg-activation-v1
protocol.  These requests will likely only work when another window of
the same application already has input focus, but that isn't unlike the
behavior of other platforms.

The GLFW_FEATURE_UNAVAILABLE error has been removed from this function
for now.

Related to #2284
Related to #2306
Related to #2439
2024-02-09 13:52:54 +01:00
Camilla Löwy
94310c5281 Wayland: Move listener to correct section 2024-01-30 20:20:42 +01:00
Camilla Löwy
bdedec9932 Wayland: Fix formatting of attention request 2024-01-30 20:20:42 +01:00
Jan Schürkamp
9317970243 Wayland: Implement glfwRequestWindowAttention
This implements window attention requests via the xdg-activation-v1
protocol.

This was updated by @ elmindreda to work with recent Wayland related
 changes to the main branch:
 - Switched to current way of handling Wayland protocol files
 - Added the xdg-activation-v1.xml protocol file to deps/wayland
 - Added missing macros to rename protocol interface globals

The protocol file was copied from wayland-protocols 1.33.

Closes #2287
2024-01-30 20:20:42 +01:00
Camilla Löwy
51920ede68 Wayland: Fix compilation on FreeBSD
The list of compile-time dependencies on FreeBSD lacked evdev-proto.

Unlike on Linux, the input-event-codes.h header file was not implicitly
included on FreeBSD.

Fixes #2445
2024-01-30 20:20:42 +01:00
Camilla Löwy
86bf5698ec Fix glfwGetKeyName incorrectly emitting error
glfwGetKeyName emitted GLFW_INVALID_VALUE when passed GLFW_KEY_UNKNOWN
and any scancode not associated with a key token on that platform.

This causes physical keys with no associated key token to emit
GLFW_INVALID_VALUE when the key and scancode are passed directly from
the key event to glfwGetKeyName.  This breaks the promise made in the
reference documentation for glfwGetKeyName.

This commit removes that error for the whole range of valid scancodes.

Fixes #1785
2024-01-30 20:14:57 +01:00
Camilla Löwy
9afbcb442b Wayland: Clean up pointer axis handler 2024-01-29 21:05:35 +01:00
Camilla Löwy
8e6c8d7eff Remove reminders to use C89 for some source files
This is part of removing support for VS versions older than VS 2013.
See #2465 for details and feedback.

Related to #2465
2024-01-15 20:17:18 +01:00