src/video/wayland


Log

Author Commit Date CI Message
Aleksey Rybalkin 402b86f2 2021-08-15T14:41:56 waylandevents: prevent segfault if xkb compose table is not found this can happen e.g. on pure wayland system where there is no X11 locales for xkbcommon to find.
David Gow fbc36490 2021-08-14T22:29:05 Use the new SDL_clamp() macro where sensible There were a few places throughout the SDL code where values were clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp() macro, use this instead.
Andrei Alexeyev 68ca35c3 2021-08-11T21:40:46 wayland: fix memleak in output listener
Ethan Lee ae7ee2a5 2021-08-11T09:59:43 wayland: Ignore stateless/sizeless configs when starting in fullscreen mode
Cameron Gutman 6ae227d0 2021-08-08T23:27:08 x11/wayland: fix screensaver suspension via D-Bus b08b1bde introduced a subtle bug. Despite not using D-Bus types directly, the code used the SDL_USE_LIBDBUS definition set by SDL_dbus.h to conditionally compile calls SDL_DBus_ScreensaverTickle() and SDL_DBus_ScreensaverInhibit(). As a result, it still compiled without SDL_dbus.h included, but screensaver suspension silently failed to work. The D-Bus stuff could probably use some tweaks to be harder to accidentally break, but for now just restore the header includes.
Sebastian Krzyszkowiak 2e6dac87 2021-08-09T01:47:42 wayland: Add a hint to allow disabling libdecor use Useful for testing xdg-shell path with compositors like Weston.
Cameron Gutman 092a20d9 2021-08-08T16:47:34 wayland: Avoid busy waiting for vsync
Ethan Lee 7be970db 2021-08-06T19:51:27 wayland: Avoid setting floating width/height when re-entering fullscreen
Ethan Lee 10979d37 2021-08-05T12:42:03 wayland: Always assume configure is wrong for non-resizable windows. Configure events from compositors have an extremely annoying habit of giving us completely bogus sizes, from all sorts of places. Thankfully, the protocol gives us the ability to completely ignore the width/height and just stick with what we know, so for all windows that are not meant to be resized, pretend we never even got the width/height at all, the compositor is required to respect our dimensions whether they match configure's suggestion or not.
Cameron Gutman b08b1bde 2021-08-03T22:50:58 linux: remove d-bus lazy init dead code Lazy init in X11/Wayland is dead code since dbdbae4
Ethan Lee 32f909f7 2021-08-03T13:30:57 wayland: Remove redundant waylanddyn.h includes. All files including waylanddyn.h already include waylandvideo.h first.
Ethan Lee 124405a0 2021-08-03T13:17:19 wayland: Fix building without Vulkan support
Ethan Lee 7082fb04 2021-08-02T22:42:28 wayland: Only dispatch on fullscreen set when the window is visible. Fixes hang-on-startup described in #4572.
Ethan Lee 0f5b8a99 2021-08-02T19:48:31 wayland: For libdecor, dispatch immediately after setting fullscreen Reference: #4578
Ethan Lee 4562da62 2021-08-02T16:40:56 wayland: Make libdecor configure match xdg_toplevel
Ethan Lee 1fb1aa19 2021-08-02T12:57:28 wayland: Keep the fullscreen check for maximize/restore events
Ethan Lee 584673a5 2021-08-02T12:51:23 wayland: Don't ignore configs for non-fullscreen, non-resizable windows. This was causing configure events to not inform SDL of window size changes, even when they were based on resizes that we fully expected. The result was fullscreen->windowed not working at all, because it would retain the desktop resolution instead of reverting to the floating size that it had before moving to fullscreen mode. Fixes Super Hexagon fullscreen toggling.
Sebastian Krzyszkowiak 25067298 2021-08-02T08:15:10 wayland: Flush in SetWindowFullscreen The flush has been removed in e5f9fae034df8ca305241c5a666e7702fcf9958f. Unfortunately, even though ideally the flush shouldn't be necessary, our resize sequence isn't... well, perfect, and removing that flush causes tons of troubles. We're also still flushing in other paths where the window size can be changed by the compositor and where we may potentially have to obey that change, like in Wayland_MaximizeWindow. This also removes the hack introduced in 7f261d3b7667978ced93a4fdc6aec2380df3d87f, which introduces problems with protocol violations and seems to not be necessary when flushing.
Sebastian Krzyszkowiak ea28187c 2021-08-02T08:07:23 wayland: Hack surface resize into compliance with set_window_geometry We have issues with correct resize sequence and happen to commit old-sized buffers even after configure event for the new size has been already acknowledged. While the reason for that stays unknown, let's at least workaround the problem by faking window geometry into expected size. This does not fix visual glitch on e.g. fullscreen toggling, but having a split-second glitch is still a much better outcome than being terminated by the compositor for protocol violation.
Sebastian Krzyszkowiak b5210cac 2021-08-02T13:47:32 wayland: Initialize floating size at window creation This allows the windowed size to be restored for windows initially created already in non-floating state.
Ethan Lee dab33844 2021-08-02T11:58:47 wayland: Fix a warning in handle_configure_xdg_toplevel
Ethan Lee 754aa2d3 2021-08-02T11:55:02 Mostly revert cfcdfb7be9f5c97a51ddef9ad3677a604856266b. This was causing window changes to completely break, resulting in broken decorations and bizarre frame timing, I don't know what exactly it's doing but it's not good. Kept the libdecor_frame_is_floating logic, at least.
Ethan Lee 8803589f 2021-08-02T12:05:06 wayland: Avoid redundant SetWindowBordered for libdecor
Sebastian Krzyszkowiak b4c4060a 2021-08-02T04:52:25 wayland: Clean up Wayland_HandlePendingResize Commit 871c11191bfc7214061a3da37c112522a102ddf5 removed delayed resize handling, but it left the whole structure untouched that now became unnecessary. To help with code clarity, get rid of the structure where pending resize state used to be stored and pass all the data directly to Wayland_HandlePendingResize (now renamed to Wayland_HandleResize, since it's not "pending" anymore but applied immediately)
Sebastian Krzyszkowiak 9bb24ad0 2021-08-02T05:49:35 wayland: Always call Wayland_SetWindowBordered when showing the window Otherwise our windows have no window decoration on compositors that support xdg-decoration-unstable-v1, but default to client-side mode. Contrary to what the comment was stating, there is nothing in the protocol that would make redundant calls to zxdg_toplevel_decoration_v1::set_mode problematic.
Christian Rauch cfcdfb7b 2021-08-01T18:14:53 libdecor: use same fullscreen/maximised restore logic as for xdg-toplevel
Christian Rauch 42452f8c 2021-08-01T13:51:30 wayland: store and restore floating states Some Wayland compositors send (0,0) as "suggested" configure event sizes to indicate that the client has to decide on its own which sizes to used. This is commonly done when restoring from maximised, fullscreen or tiles states to fullscreen. We now store the last known floating states in a new set of variables and restore them when we receive such a (0,0) configure event.
Sebastian Krzyszkowiak 54aea244 2021-08-01T05:36:12 wayland: Disable key repeat when repeat rate equals 0 This fixes a crash on pressing keyboard button when compositor sends zero as repeat rate, indicating that key repeat should be disabled. From Wayland protocol spec: > Negative values for either rate or delay are illegal. A rate of zero > will disable any repeating (regardless of the value of delay).
Ethan Lee e5594e66 2021-07-30T16:03:01 wayland: Prefer our SSD implementation if available
Ethan Lee 71897cc1 2021-07-30T15:51:43 wayland: Always trigger a resize when handling a configure event. When we removed the OpenGL resize workaround it introduced a problem for fullscreen windows in particular: When leaving fullscreen we tried to send a resize event, but UpdateFullscreenMode would send a SIZE_CHANGED immediately after, deleting our resize event and causing the following configure event's resize to be ignored. This timing issue resulted in fullscreen windows not being resized at all when becoming a floating window. By always forcing resize events from configure events, we ensure that RESIZED always makes it through. SetWindowSize-type changes should be unaffected as they do not fire configure events.
Ethan Lee c20ab7da 2021-07-30T00:22:50 wayland: Fix GetWindowWMInfo for <2.0.15
Christian Rauch f20a8581 2021-07-29T00:13:17 commit after setting/unsetting limits
Sam Lantinga 9984891b 2021-07-29T14:46:24 Use the wl_touch object as a touch ID on Wayland (thanks @russelltg!) This fixes https://github.com/libsdl-org/SDL/issues/4517
Ethan Lee 74162b74 2021-07-29T13:27:31 wayland: Add support for text-input-unstable-v3
Ethan Lee ad310d39 2021-07-28T12:31:25 wayland: libdecor support for SetWindowModalFor
Ethan Lee 93976ade 2021-07-28T12:22:09 wayland: libdecor support for GetWindowWMInfo
David Gow 1fb4429b 2021-07-28T21:50:48 wayland: Avoid a pointer→TouchID cast warning As of [1], SDL now compiles with a warning in SDL_waylandevents.c on 32-bit systems under gcc 10.3.0: /tmp/SDL/src/video/wayland/SDL_waylandevents.c: In function 'seat_handle_capabilities': /tmp/SDL/src/video/wayland/SDL_waylandevents.c:958:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 958 | SDL_AddTouch((SDL_TouchID)seat, SDL_TOUCH_DEVICE_DIRECT, "wayland_touch"); | ^ /tmp/SDL/src/video/wayland/SDL_waylandevents.c:964:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 964 | SDL_DelTouch((SDL_TouchID)seat); | ^ This is due to SDL_TouchID always being 32-bit, but seat being a pointer which is (obviously) only 32-bit on 32-bit systems. The conversion is therefore harmless, so silence it with an extra cast via intptr_t. This is what the cocoa backend does (and is similar to what the Win32 backend does, except with size_t). Fixes: 03c19efbd1 ("Added support for multiple seats with touch input on Wayland") [1]: https://github.com/libsdl-org/SDL/commit/03c19efbd17f72f70ee021de6d2549eb0be3bb56
David Gow 18303c92 2021-07-28T18:06:34 Wayland: Fix building with --disable-wayland-shared with libdecor. When wayland is not dynamically loaded (--enable-wayland-shared=no) libdecor.h is not included unless SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC is set, so it fails to build. We can't simply move the libdecor.h include above the #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC block, as libdecor.h itself #includes wayland headers we need to replace with #defines. Instead, duplicate the #include. Fixes https://github.com/libsdl-org/SDL/issues/4543 Note that this doesn't fix any of the underlying issues of libdecor being treated as part of wayland, it just fixes the build. A better solution would probably be to decouple the wayland dynamic loading from the libdecor dynamic loading completely, though that is a lot more work...
David Gow 21cba924 2021-07-28T16:54:23 wayland: Don't create zxdg toplevel decoration twice Each window can have at most one zxdg toplevel decoration, but as of [1], we accidentally create two. (If libdecor is not in use). This causes wayland windows with server-side decorations (e.g. on KDE/KWin) to crash with the message: zxdg_decoration_manager_v1@7: error 1: decoration has been already constructed This extra zxdg_decoration_manager_v1.get_toplevel_decoration() call was introduced while deprecating wl-shell and xdg-shell-stable[1] support, and possibly was a bad interaction with [2], which moved the decoration creation around. Fixes: 6aae5b44f8 ("Remove wl-shell and xdg-shell-unstable-v6 support (#4323)") [1]: https://github.com/libsdl-org/SDL/pull/4323 [2]: https://github.com/libsdl-org/SDL/pull/4374
Ethan Lee 7b239edb 2021-07-28T01:00:00 wayland: Assign frame_callback on window creation. Fixes a crash when creating and destroying a window without calling SwapWindow.
Ethan Lee 03185e74 2021-07-27T18:35:00 wayland: Tag/Check wl_output objects as well, fixes crashes when libdecor is in use
Ryan C. Gordon 871c1119 2021-07-27T18:24:09 wayland: handle pending resizes immediately, not on SwapWindow. This was originally a workaround for an old Mesa bug, since fixed, apparently, and causes other problems. Fixes #4326.
Ethan Lee a3eb297e 2021-07-27T17:17:19 wayland: Rework enter/leave and update_scale_factor to avoid bogus wl_output data. Also remove get_window_scale_factor() which was just pointless indirection.
Simon Zeni 6aae5b44 2021-07-27T17:12:26 Remove wl-shell and xdg-shell-unstable-v6 support (#4323) * wayland-protocol: update wayland.xml to 1.19.0 * wayland: remove shell_surface field from SDL_SysWMinfo * wayland: remove wl_shell support * waypand-protocols: update xdg-shell.xml to 1.20 * wayland: remove xdg-shell-unstable-v6 support * wayland: deprecate wl shell surface syswm info, add xdg surface
Christian Rauch ac904b8e 2021-06-21T01:25:25 wayland: ignore resize in fullscreen or maximised mode
Christian Rauch ee062c64 2021-05-19T00:13:39 wayland: implement toggling decorations
Christian Rauch 2b3cf36f 2021-05-22T00:49:10 wayland: forward window events
Christian Rauch 48066984 2021-04-05T14:09:03 wayland: enable/disable ACTION_RESIZE for fullscreen
Christian Rauch 9e6fcbe7 2020-06-11T22:10:28 wayland: client-side decoration
Christian Rauch e5f9fae0 2021-05-16T23:19:45 wayland: don't flush after setting fullscreen
Sam Lantinga 03c19efb 2021-07-24T15:25:50 Added support for multiple seats with touch input on Wayland This fixes bug https://github.com/libsdl-org/SDL/issues/4517
Sam Lantinga f1633127 2021-07-24T13:41:55 Added a window flash operation to be explicit about window flash behavior
Sam Lantinga e1c3a250 2021-07-24T12:11:27 Changed SDL_FlashWindow() so it doesn't take a flash count, and added the hint SDL_HINT_WINDOW_FLASH_COUNT to control behavior on Windows
meyraud705 4ada14a2 2021-07-21T13:39:10 Replace libc functions to SDL equivalent in wayland video subsystem Wayland video subsystem uses a mix of libc and SDL function. This patch switches libc functions to SDL ones and fixes a mismatch in memory allocation/dealoccation of SDL_Cursor in SDL_waylandmouse.c (calloc on line 201 and SDL_free on line 313) which caused memory corruption if custom memory allocator where provided to SDL.
Ethan Lee 7f261d3b 2021-06-15T00:35:13 wayland: Fix returning to a window from fullscreen without calling SetWindowSize
Ethan Lee eb15b4e9 2021-06-11T23:40:09 wayland: Drop SwapWindow calls for hidden windows
Ethan Lee d956636c 2021-06-04T18:39:47 wayland: Implement FlashWindow
Ethan Lee 2af3f64e 2021-06-02T14:37:09 wayland: Activate the window on first ShowWindow, if possible
Ethan Lee 151f9538 2021-06-02T11:41:44 wayland: Implement RaiseWindow with xdg-activation
Ethan Lee d3244035 2021-05-17T01:24:35 wayland: Add support for maximized/restored events
Ethan Lee f2f451a5 2021-05-10T13:29:54 wayland: Call SetWindowBordered at the end of ShowWindow
Ethan Lee efbb6ff9 2021-05-10T12:42:28 wayland: Create the server decorations after the toplevel has been configured
Henk Kalkwater 889cebb7 2021-05-05T14:08:30 Wayland touch inputs send normalized coords Resolves #4361
Nicolas Caramelli 31637dde 2021-05-04T14:59:29 Generic check for desktop GL and EGL on Linux systems
Ethan Lee c69fde34 2021-05-02T16:43:01 wayland: Maximize/Restore should set the relevant window flags. Also, Maximize should be ignored for fixed-size windows.
Christian Rauch 006378b9 2021-05-02T18:30:32 fix NULL frame_callback access
Christian Rauch 424bbaec 2021-05-01T18:53:12 wayland: destroy frame callback when window is destroyed
Ethan Lee 20928550 2021-05-01T09:00:24 wayland: Guard surface_frame_listener for OpenGL, document why it exists
Ethan Lee 3d47ddc4 2021-05-01T08:57:37 wayland: Use refresh_rate to calculate max_wait in SwapWindow
Ryan C. Gordon c54c16d3 2021-04-30T13:19:36 wayland: don't hang in SDL_GL_SwapBuffers if the compositor is ghosting us. If you hide a window on Mutter, for example, the compositor never requests new frames, which will cause Mesa to block forever in eglSwapBuffers to satisfy the swap interval. We now always set the swap interval to 0 and manage this ourselves, handing the frame to Wayland when it requests a new one, and timing out at 10fps just to keep apps moving if the compositor wants no frames at all. My understanding is that other protocols are coming that might improve upon this solution, but for now it solves the total hang. Fixes #4335.
Ethan Lee 8e3ec34d 2021-04-20T12:40:40 wayland: Refactor toplevel mapping, implement HideWindow
Mathieu Eyraud a5825576 2021-04-21T13:39:31 Fix error handling of wayland message box Zenity return a small integer on success which may be the same as EXIT_FAILURE. Use a bigger integer for error reporting from child process.
Mathieu Eyraud 12dd412b 2021-04-21T13:31:15 Fix icon of wayland message box Also add some comments and silence a warning. Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
meyraud705 d0cf3b75 2021-04-20T18:26:02 Return correct button id
meyraud705 1fd95c53 2021-04-20T18:15:09 Disable pango markup in wayland massage box Zenity support pango markup, add --no-markup to disable it.
meyraud705 0cd0e9ba 2021-04-20T17:49:21 Reimplement wayland message box function with execvp. Previous version used 'popen' which required to sanitize user provided text. Not sanitizing text could cause failure if user provided text included a " or command injection with `cmd`.
Ethan Lee 509228c4 2021-04-18T22:26:27 wayland: Implement GetDisplayDPI
Ethan Lee fcbfe33c 2021-04-18T09:45:22 wayland: Implement SetWindowModalFor
Ethan Lee 213bfc19 2021-04-18T09:36:54 wayland: Implement RestoreWindow for xdg/zxdg
Ethan Lee 0f518002 2021-04-18T09:33:57 wayland: Removed unused GetDisplayModes/SetDisplayMode functions
Ethan Lee 46df195b 2021-04-18T09:33:06 wayland: Implement GetDisplayBounds
Ethan Lee ed24c345 2021-04-16T21:35:50 wayland: Implement basic window move events via wl_surface_listener. This unearthed an unspeakably large amount of bugs in the wl_output enumerator, notably the fact that the wl_output user pointer was to temporary memory! This was "fixed" in e862856, and was then pointed out as a leak in 4183211, which was undone in d9ba204. The busted fix was correct that the malloc was an issue, but wrong about _why_; SDL_AddVideoDisplay copies by value and does not reuse the pointer, so generally you want your VideoDisplay to be on the stack, but of course the callbacks don't allow that, so a malloc was a workaround. But we can do better and just host our temporary display inside WaylandOutputData because that will be persistent while also not leaking. Wait, wasn't I talking about move events? Right, that: wl_surface_listener does at least give us the ability to know what monitor we're on, even though we have no idea where we are on the monitor. All we need to do is check the wl_output against the display list and then push a move event that both indicates the correct display while also not being _too_ much of a lie (but enough of a lie to where our event doesn't get discarded as "undefined" or whatever). The index check for the video display is what spawned the great nightmare you see before you; aside from the bugfix this is actually a really basic patch.
Luis Cáceres 5c78df9c 2021-04-14T00:56:50 Support key composing (i.e. dead keys) in Wayland driver (#4296) Based on an old patch by chw from the old Bugzilla issue tracker. Authored-by: chw Co-authored-by: Sam Lantinga <slouken@libsdl.org>
Ethan Lee f88d91d5 2021-04-12T23:47:23 wayland: Minor whitespace fix
Ethan Lee d785dab5 2021-04-12T23:37:53 wayland: Add unscaled resolutions to the display mode list
Ethan Lee dfcd5fbc 2021-04-08T21:57:58 wayland: Set the keymap in keyboard_handle_modifiers
Ethan Lee c59d4dcd 2021-04-08T15:32:33 wayland: Dramatically lower the timeout when reading/writing pipes
Ethan Lee cf124963 2021-04-08T15:29:54 wayland: Fall back to clipboard source data if offer came up empty
Ethan Lee 282c0524 2021-04-08T14:59:04 wayland: Another strlen->SDL_strlen
Ethan Lee bec133d7 2021-04-08T14:16:32 wayland: Use SDL_strlen instead of strlen
Ethan Lee e28d9785 2021-04-08T14:16:21 wayland: Minor whitespace cleanup in clipboard.c
Ethan Lee 875f839d 2021-04-08T14:14:46 wayland: A bunch of clipboard safety fixes. Also removed Wayland_get_data_device because it was a pointless getter function.
Ethan Lee 7510245a 2021-04-08T14:08:35 wayland: Create the data_device only after both device_manager and input exist. There is no guarantee on what order the Wayland interfaces will come in, but the callbacks were assuming that wl_data_device_manager would could before wl_seat. This would cause certain desktops to not have any data_device to work with, meaning certain features like the clipboard would silently no-op.
David Edmundson 6fd37194 2021-04-07T16:03:41 wayland: Fix leaked zxdg_decoration_manager
David Edmundson f6a09ef1 2021-04-07T16:16:23 wayland: Drop support for kwin specific decoration management KWin has supported the shared and formalised zxdg_decoration since Plasma 5.16 which came out mid 2019. Whilst it made sense to support them both for a while, it should not be needed for future SDL releases.
Ethan Lee a92cca1a 2021-04-07T16:44:10 wayland: Use the window's display to get wl_output rather than fullscreen_mode. Because Wayland only supports FULLSCREEN_DESKTOP, fullscreen_mode never gets assigned at all, meaning driverdata is always NULL! Depending on what the compositor does this can lead to dramatically different results. GNOME was fine without this, but Plasma would trip an event that unintentionally unset the fullscreen mode and caused the game to fire a configure event _every frame_, and of course the configure would send the fullscreen_mode output which was still empty. The fix is to just use the SDL_VideoDisplay directly, which will always have a valid wl_output.
Ethan Lee c7e29a9e 2021-04-06T18:10:40 wayland: Fix toggling fullscreen with fixed-size windows
meyraud705 413a2306 2021-04-04T10:47:06 NULL passed to strcmp in Wayland_ShowMessageBox
Ryan C. Gordon dbdbae44 2021-04-02T14:35:11 linux: (de)initialize d-bus at init and quit. Previously we had different subsystems quitting it, in conflict, and risked multiple threads racing to init it at the same time. Fixes #3643.
Ethan Lee eeee7308 2021-03-29T16:57:03 wayland: Implement IME support. Note that this is purely to make it possible to enter text that requires composition - for example, before this commit Kanji input didn't work at all. The big problem this still has is that we need the window position, and this is still not implemented. Once we have this information we can do the equivalent of XTranslateCoordinates to put the rectangle where we want it.