Commit Graph

2875 Commits

Author SHA1 Message Date
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
Björn Hempel
388d0cf7c2 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

(cherry picked from commit c424fe5589)
2022-10-31 20:58:19 +01:00
Camilla Löwy
dea9914692 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.

(cherry picked from commit 40b5a8a37c)
2022-10-31 20:57:20 +01:00
Camilla Löwy
1acd67eeb6 Wayland: Clean up key repeat logic
(cherry picked from commit 9180923ea0)
2022-10-31 20:57:02 +01:00
Camilla Löwy
a8d543f1f8 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.

(cherry picked from commit a1a73ee862)
2022-10-31 20:56:39 +01:00
Camilla Löwy
ca5ccd819d Wayland: Update state before emitting events
(cherry picked from commit e47cb7c1e2)
2022-10-31 20:56:17 +01:00
Camilla Löwy
41bb7b8617 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.

(cherry picked from commit 4df24735ef)
2022-10-31 20:54:45 +01:00
Camilla Löwy
ccbbada181 Wayland: Fix non-standard struct initialization
(cherry picked from commit d77aaa770f)
2022-10-31 20:54:34 +01:00
Camilla Löwy
0f341802e1 Win32: Fix right Shift scancode when using CJK IME
Fixes #2050

(cherry picked from commit 6dd526fb1a)
2022-07-15 00:11:23 +02:00
Camilla Löwy
5937eec914 Wayland: Cleanup
(cherry picked from commit 88a39006e3)
2022-07-15 00:11:23 +02:00
Camilla Löwy
20d11f7f97 Wayland: Fix comment typo
(cherry picked from commit 5c948a6e6e)
2022-07-15 00:11:23 +02:00
Camilla Löwy
2f3c6aa150 Cocoa: Cleanup
(cherry picked from commit 2db528d8cd)
2022-07-15 00:11:23 +02:00
Nikita Fediuchin
1e49024e76 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

(cherry picked from commit 9b7713cf92)
2022-07-15 00:11:23 +02:00
Camilla Löwy
9950cc52df 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

(cherry picked from commit 0d599026d0)
2022-07-13 23:20:54 +02:00
Camilla Löwy
e50ee39eac 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.

(cherry picked from commit 6f8ec4075b)
2022-07-13 23:16:01 +02:00
Camilla Löwy
70a024232a Cocoa: Disable macOS fullscreen when non-resizable
Windows with GLFW_RESIZABLE set to false should not be resizable by the
user.

This is adapted to 3.3-stable from
98d6e8485b and
36f0bf00a9.
2022-07-13 23:14:20 +02:00
Camilla Löwy
0cd8813e82 Wayland: Do not decorate fullscreen windows
If a fullscreen window with GLFW_DECORATED set had its XDG decorations
changed to client mode by the compositor, it would seemingly receive
GLFW fallback decorations as if it was windowed mode.

This is possibly related to #2001.

(cherry picked from commit da6713cd09)
2022-07-13 22:48:35 +02:00
Camilla Löwy
e541b7969a Wayland: Only create EGL window if using EGL
(cherry picked from commit d578c2ddfe)
2022-07-13 22:48:35 +02:00
Camilla Löwy
be333cf0fd Wayland: Cleanup
This moves what is effectively showing the window to where that is done
on other platforms, i.e. last in the platform CreateWindow function.

(cherry picked from commit 74b4ceb835)
2022-07-13 22:48:35 +02:00
Camilla Löwy
758d4b1987 Wayland: Make function behavior match name
The logic that checks the decorated attribute belongs on the outside
along with other related checks (fullscreen, monitor, decoration mode).

(cherry picked from commit c4fbe80d90)
2022-07-13 22:48:35 +02:00
Camilla Löwy
1ac6fbc499 Wayland: Remove premature surface commit calls
Note that the handling of configure events, acks and commits is still
not ideal.  This is just a small step in, hopefully, a good direction.

Fullscreen toggling via glfwSetWindowMonitor now works on Weston, but
mostly incidentally.

(cherry picked from commit be7f4513c0)
2022-07-13 22:48:35 +02:00
Camilla Löwy
75b37bd2d7 Wayland: Rename function to its purpose
(cherry picked from commit 47193f15de)
2022-07-13 22:48:35 +02:00
Camilla Löwy
7b65ecf77c Wayland: Use enum type to store enum value
(cherry picked from commit 80dc0533cf)
2022-07-13 22:48:35 +02:00
Camilla Löwy
aef1d4584f Wayland: Fix transition to server-side decorations
(cherry picked from commit 29b7669bc6)
2022-07-13 22:48:35 +02:00
Camilla Löwy
17959aad33 Wayland: Fix GLFW_DECORATED for XDG decorations
On a compositor that supports server-side decorations, they were always
enabled in windowed mode, even if GLFW_DECORATED was cleared.

(cherry picked from commit f35e2274cb)
2022-07-13 22:48:35 +02:00
Camilla Löwy
8f9ddfe3c2 Wayland: Fix map before XDG decoration configure
If the xdg_toplevel has a decoration, we need to wait for its first
configure event as well before we are allowed to attach the first
buffer.

It seems racy to assume that this will always happen inside the first
surface configure sequence, so this commit makes that condition
explicit.  This may turn out to have been overly defensive.

(cherry picked from commit 3203599cac)
2022-07-13 22:48:35 +02:00
Camilla Löwy
4c7f6ada0c Wayland: Store and act on XDG decoration mode
Refer to the XDG decoration mode (or the lack of one) directly instead
of setting a boolean in a struct meant for the fallback decorations.

This makes things a bit more verbose but is in preparation for
a refactoring of all decoration paths.

(cherry picked from commit 2df0ce07fa)
2022-07-13 22:48:35 +02:00
Camilla Löwy
c807f386c2 Wayland: Fix mapping failure on wlroots compositor
When showing a window that had already been shown once (and so already
had its shell objects), GLFW would attach a new buffer and commit it
before waiting for the next configure event.  This was a violation of
the XDG shell protocol.

This was allowed to work as intended on GNOME and KDE without error.
However wlroots based compositors would (correctly) emit an error.

Unfortunately, I haven't been able to find a way to get both KDE, GNOME
and Sway to send the configure event we need in order to map the
wl_surface again while keeping our existing shell objects, so with this
commit we now create them for each call to glfwShowWindow and destroy
them for each call to glfwHideWindow.

Fixes #1268

(cherry picked from commit 83a134a92f)
2022-07-13 22:48:35 +02:00
Camilla Löwy
fae1d349d3 Wayland: Rename fallback decoration functions
We are soon going to have three kinds of decorations; XDG, libdecor and
our last resort fallback ones.

(cherry picked from commit eb9c3bee71)
2022-07-13 22:48:35 +02:00
Camilla Löwy
593b85380e Wayland: Remove function only called once
(cherry picked from commit 0cd1916de3)
2022-07-13 22:48:35 +02:00
Camilla Löwy
a0259b9426 Wayland: Fix maximized state lost while hidden
If a window was created as maximized, or created as hidden and then
iconified or maximized before first being shown, that state was lost and
the window was shown as restored.

(cherry picked from commit 77819c0c54)
2022-07-13 22:48:35 +02:00
Camilla Löwy
e79d6fe40a Wayland: Fix events emitted before ack_configure
Window iconfication and maximization events were being emitted before
xdg_surface::configure, making it possible for user code to indirectly
commit surface changes from those event callbacks before
xdg_surface::ack_configure.

This postpones those events until after the ack has been sent.

(cherry picked from commit 85f5a51912)
2022-07-13 22:48:35 +02:00
Camilla Löwy
498a4d0635 Wayland: Fix missing error reporting
(cherry picked from commit 9ad9f5c52a)
2022-07-13 22:48:35 +02:00
Camilla Löwy
35fd90aff1 Wayland: Cleanup
Make Wayland code use 'native' in the same senses as the rest of GLFW.

(cherry picked from commit 5002522f73)
2022-07-13 22:48:35 +02:00
Camilla Löwy
6b9087c575 Wayland: Fix error from glfwSetWindowAspectRatio
The aspect ratio was applied during resize but any call to
glfwSetWindowAspectRatio emitted a GLFW_FEATURE_UNIMPLEMENTED error.

(cherry picked from commit 91f18fb576)
2022-07-13 22:48:35 +02:00
Camilla Löwy
48e0e0acf5 Wayland: Fix reporting of monitor scale changes
Content scale events would be emitted when a window surface entered or
left an output, but not when one of a window's current outputs had its
scale changed.

(cherry picked from commit e37ba80b13)
2022-07-13 22:48:35 +02:00
Camilla Löwy
557da4cdc4 Wayland: Fix duplicate monitor connection events
GLFW would report a monitor as connected each time its wl_output
received an update, for example if its scale changed.

This would also cause the monitor to be added to the monitor array
again, causing glfwTerminate to segfault when it attempted to destroy
its already destroyed wl_output.

(cherry picked from commit c3ad3d49ed)
2022-07-13 22:48:35 +02:00
Camilla Löwy
50ea41cb04 Wayland: Add support for wl_output::name
We now use wl_output::name as the GLFW monitor name, on compositors that
provide this event.

(cherry picked from commit 209f6cf093)
2022-07-13 22:48:28 +02:00
Camilla Löwy
2529e663d7 Wayland: Cleanup
(cherry picked from commit 33d37782c6)
2022-07-13 22:47:03 +02:00
Camilla Löwy
8b26801a30 Wayland: Fix toggling of server-side decorations
This is a temporary local fix to have updates to GLFW_DECORATED mostly
work as intended.  The whole decoration state machine needs to be
restructured, but not by this commit.

(cherry picked from commit 229d628ec4)
2022-07-13 22:47:03 +02:00
Camilla Löwy
e04a7d152a Wayland: Remove duplicate fullscreen check
This check is already performed in shared code.

(cherry picked from commit c28d420060)
2022-07-13 22:47:03 +02:00
Camilla Löwy
8de0c1cdc1 Wayland: Cleanup
(cherry picked from commit 18df0baea6)
2022-07-13 22:47:03 +02:00
Camilla Löwy
fead23153e Wayland: Fix size limits for fallback decorations
The size limits set on our XDG surface did not include the sizes of the
fallback decorations on all sides, when in use.  This led to its content
area being too small.

Related to #2127

(cherry picked from commit a7b6f35500)
2022-07-13 22:47:03 +02:00
Camilla Löwy
cdbcb8c5a7 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

(cherry picked from commit 0f5b095042)
2022-07-13 22:47:03 +02:00
Camilla Löwy
4ba1208239 Wayland: Rename window frame size constants
(cherry picked from commit 24cdc5afda)
2022-07-13 22:47:03 +02:00
Camilla Löwy
941744a59a Wayland: Remove unused code path
(cherry picked from commit 75295f4878)
2022-07-13 22:47:03 +02:00
Camilla Löwy
f454410b79 Wayland: Cleanup
(cherry picked from commit 040712ce99)
2022-07-13 22:47:03 +02:00
Camilla Löwy
5feaa33529 Wayland: Remove superfluous comments
These are just repeating parts of the identifier.

(cherry picked from commit 2877fea550)
2022-07-13 22:47:03 +02:00
Camilla Löwy
e894bf71a2 Wayland: Fix resize events before ack_configure
The surface was resized and the size event was emitted before we had
sent xdg_surface::ack_configure.  If user code then called some GLFW
function that commited the surface, those changes would all get applied
to the wrong configure event.

This postpones size changes until after the ack.

(cherry picked from commit e33db6d7aa)
2022-07-13 22:47:03 +02:00
Camilla Löwy
ebe2b648ea Wayland: Add tracking of XDG fullscreen state
(cherry picked from commit afb127769a)
2022-07-13 22:47:03 +02:00
Camilla Löwy
51018f19d0 Wayland: Use named constants for version checks
The wayland-scanner output provides really nice, self-documenting
version macros, so we should use them whenever possible.

(cherry picked from commit ed39ff43f9)
2022-07-13 22:47:03 +02:00
Camilla Löwy
1ad9c2d5dd Wayland: Cleanup
(cherry picked from commit 98c9961f32)
2022-07-13 22:47:03 +02:00
Camilla Löwy
1c4284e449 Wayland: Fix glfwInit closing stdin on failure
If platform initialization failed before either timer fd member had been
set to -1 or a valid fd, termination would close stdin.

(cherry picked from commit 3bbb41eacc)
2022-07-13 22:47:03 +02:00
Camilla Löwy
608007673f Wayland: Fix duplicate window content scale events
The window content scale event was emitted every time the window content
area was resized, even if its scale had not changed.

(cherry picked from commit 0b76e3a6f1)
2022-07-13 22:47:03 +02:00
Camilla Löwy
589385aada Wayland: Fix glfwSetWindowSize resizing fs windows
glfwSetWindowSize would change the size of fullscreen mode windows as
if they were windowed mode.

(cherry picked from commit 6857995498)
2022-07-13 22:47:03 +02:00
Camilla Löwy
15050f5711 Wayland: Fix missing fullscreen code path
glfwRestoreWindow assumed it was only called in windowed mode.

(cherry picked from commit fdc72edf81)
2022-07-13 22:47:03 +02:00
Camilla Löwy
562eca6f28 Wayland: Fix maximization by user being ignored
The internal maximization state was not updated when an event was
received that the user had changed the maximization state of a window,
and no maximization events were emitted.

This affected both the GLFW_MAXIMIZED attribute and glfwRestoreWindow.

(cherry picked from commit f39ffefb6a)
2022-07-13 22:47:03 +02:00
Camilla Löwy
dea602623d 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

(cherry picked from commit ddd087d662)
2022-07-13 22:47:03 +02:00
Emmanuel Gil Peyrot
581fed38be Wayland: Remove support for wl_shell
This is adapted to 3.3-stable from
599fb3de34 and
27295b508f.
2022-07-13 22:40:46 +02:00
Camilla Löwy
9f8ec83411 Wayland: Cleanup
(cherry picked from commit 523fdf50c1)
2022-07-12 20:29:22 +02:00
Camilla Löwy
631da8cc2f X11: Fix previous error handler not being restored
GLFW did not restore the previous Xlib error handler when removing its
own, instead resetting to the default handler.

This commit saves and restores the previous error handler.

None of this is thread-safe or could ever be.

Fixes #2108

(cherry picked from commit 26920a1a38)
2022-07-12 20:29:22 +02:00
Camilla Löwy
416f7828ff 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

This is adapted to 3.3-stable from
2c204ab52e and
fd7e737216.
2022-07-12 20:27:34 +02:00
Camilla Löwy
6de6446aca Wayland: Fix missing lock key modifier bits
The modifier bits for lock keys were only set when the corresponding key
was reported as held down or latched, but not when it was released and
locked.

(cherry picked from commit e9c58bc181)
2022-06-10 17:11:25 +02:00
Camilla Löwy
2a6d25d1aa Win32: Add comment clarifying use of ToUnicode
Fixes #2100

(cherry picked from commit 62e175ef9f)
2022-06-10 17:11:13 +02:00
Camilla Löwy
f4e36e5389 Win32: Make monitor area retrieval more consistent
The rest of this file uses GetMonitorInfoW to retrieve this information.

(cherry picked from commit 7dfd84c458)
2022-06-10 17:11:13 +02:00
Camilla Löwy
b9ea733ca8 Move last bits of window setup to platform code
This avoids glfwCreateWindow emitting GLFW_PLATFORM_ERROR on Wayland
because shared code was calling unimplemented or unavailable platform
functions during final setup.

It also makes it consistent with the final setup of full screen windows.

This is adapted to 3.3-stable from
09653b8c54.
2022-06-10 17:11:01 +02:00
Camilla Löwy
c8be8606f0 Win32: Fix message reported by VS 2022
(cherry picked from commit acf0c10e7a)
2022-06-09 19:55:34 +02:00
Camilla Löwy
1b3b2108e3 Win32: Remove superfluous cast
(cherry picked from commit 80e31ce9e1)
2022-06-09 19:55:30 +02:00
Camilla Löwy
65b8c4a46b X11: Fix segfault on malformed INCR response
The code assumed that at least some data would be received via the INCR
mechanism and that, as a result, the string buffer would be allocated.

Bug found by Clang static analysis.

(cherry picked from commit 23e6e8e4b7)
2022-06-09 19:55:18 +02:00
Camilla Löwy
946312fe93 X11: Fix returned clipboard string freed too early
The clipboard string should not be freed on SelectionClear.  The user
may have received it from glfwGetClipboardString and it should remain
valid until the next call to a public clipboard string function.

(cherry picked from commit f60547ac80)
2022-06-09 19:53:23 +02:00
Camilla Löwy
53d40878c8 X11: Fix OSMesa library not being unloaded
(cherry picked from commit a8d8b760fb)
2022-06-09 19:49:15 +02:00
Camilla Löwy
6dd9bf0bef Wayland: Fix OSMesa library not being unloaded
(cherry picked from commit 2d281d7928)
2022-06-09 19:48:31 +02:00
Camilla Löwy
6d08e52bcf Cocoa: Fix EGL and OSMesa not being unloaded
(cherry picked from commit 89514cf0fc)
2022-06-09 19:47:36 +02:00
Camilla Löwy
3d9d4e311c Win32: Fix OSMesa library not being unloaded
(cherry picked from commit 10e9033a29)
2022-06-09 19:42:44 +02:00
Camilla Löwy
af612103d0 Fix order of error checks in glfwSetGammaRamp
Initialization should be checked before arguments.

(cherry picked from commit 29523dbfbf)
2022-06-09 19:41:56 +02:00
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
2b504e41d5 Wayland: Clean up listener struct initialization
Adapt style to match the rest of the project.

(cherry picked from commit 0f38382e25)
2022-06-09 19:34:29 +02:00
Camilla Löwy
50d5de7cd4 Wayland: Make data offer reading a generic utility
This will be needed for drag and drop reception as well.

(cherry picked from commit f010335b8c)
2022-06-09 19:32:18 +02:00
Camilla Löwy
4d0e98d90c Wayland: Move window related code to window module
The Wayland backend was the only one where half the window and input
related code was in the init module.  As those bits want to share more
utility code with the window module, the interface between them grows.

To prevent that, this gathers nearly all window and input related code
into the window module.

This is adapted to 3.3-stable from
b7a3af9b79.
2022-06-09 19:29:12 +02:00
Camilla Löwy
c0c0d172a1 Wayland: Remove check for error that cannot happen
Famous last words.

(cherry picked from commit 967282c2e6)
2022-05-06 19:34:06 +02:00
Camilla Löwy
9e852ec39e Wayland: Remove error reporting of external bugs
Not sure that GLFW should be reporting that another client has made an
invalid receive request.

(cherry picked from commit 8d216054ad)
2022-05-06 19:34:06 +02:00
Camilla Löwy
4d68daedc9 Wayland: Clean up clipboard writing
(cherry picked from commit 34418951cc)
2022-05-06 19:34:06 +02:00
Camilla Löwy
ea1b6b9638 Move URI list parsing to shared code
This will soon be used by the Wayland backend.

(cherry picked from commit ad4a9e42f0)
2022-05-06 19:34:06 +02:00
Camilla Löwy
f145e1f930 Wayland: Add strerror output to error descriptions
(cherry picked from commit e0889736fd)
2022-05-06 19:34:06 +02:00
Camilla Löwy
915e43885c Wayland: Clean up clipboard reading
(cherry picked from commit c132135332)
2022-05-06 19:34:06 +02:00
Camilla Löwy
857fae4920 Wayland: Simplify clipboard string allocation
(cherry picked from commit 4651165272)
2022-05-06 19:34:06 +02:00
Camilla Löwy
a31c648127 Wayland: Improve handling of pending data offers
The code assumed that all data offers were selections that supported
plaintext UTF-8.

The initial data offer events are now handled almost tolerably.  Only
selection data offers are used for clipboard string and only if they
provide plaintext UTF-8.  Drag and drop data offers are now rejected as
soon as they enter a surface.

Related to #2040

(cherry picked from commit 8d87be1268)
2022-05-06 19:34:06 +02:00
Camilla Löwy
c89899a428 Wayland: Return our clipboard without roundtrips
(cherry picked from commit 89d3ea8d69)
2022-05-06 19:34:06 +02:00
Camilla Löwy
75b27849f6 Wayland: Fix error paths not closing sending fd
Whatever error happens on our end, we should still close the fd so the
other end can move on.

(cherry picked from commit 990dc4b388)
2022-05-06 19:34:05 +02:00
Camilla Löwy
f51ec79951 Wayland: Rename listener user data parameters
(cherry picked from commit a4460b694e)
2022-05-06 19:34:05 +02:00
Camilla Löwy
3599fe4a78 Wayland: Clean up pointer declarations
Adapt style to match the rest of the project.

(cherry picked from commit 4506175023)
2022-05-06 19:34:05 +02:00