src/video/wayland/SDL_waylandwindow.c


Log

Author Commit Date CI Message
Frank Praznik 650612fd 2022-08-13T16:54:27 wayland: Eliminate excessive calls to SetFullscreen Eliminate excessive calls to SetFullscreen by removing the calls in the libdecor and xdg-toplevel config callbacks. These calls were being made there in case something explicitly called the window minimization function from within SDL, which unsets fullscreen, and as minimizing a window in Wayland is just a suggestion to the compositor and doesn't actually change the window state or communicate anything back to the application, it was necessary to call SetFullscreen in every call to the config functions just in case something minimized a window via SDL_MinimizeWindow() and later needed to restore it. GNOME in particular had issues when fullscreen set/unset operations were being hammered, leading to overlapping acks and commits when switching to fullscreen. With the new video system flag to disable unsetting fullscreen when minimizing a window, these calls in the configuration functions are no longer needed and can be removed. This significantly reduces calls to the SetFullscreen() function, reverts #6044 while fixing the issue, and fixes a similar problem when hiding and showing a window initially created with fullscreen flags.
Frank Praznik 74bdb211 2022-08-12T22:01:12 wayland: Don't roundtrip in ShowWindow unless restoring a hidden window Don't call the roundtrip in ShowWindow unless restoring a previously hidden window. This fixes a regression in GNOME when creating a window with the fullscreen flag set, as the fullscreen window will be positioned down the screen by the height of the top bar if the window is made fullscreen on the primary display and the roundtrip is called when initially displaying the window.
Cameron Gutman 1b08cd20 2022-08-12T18:55:05 wayland: Add roundtrip in SetWindowFullscreen() to get new size The video core assumes that window->w/h will be updated before returning from SetWindowFullscreen(). This is needed to generate a resize event with the correct window size when exiting fullscreen. The roundtrip allows us to receive the configure callback that informs us of the new window size before returning. Fixes #6043
Cameron Gutman 780b031b 2022-08-12T16:39:39 wayland: Avoid duplicate resize events when entering fullscreen
Frank Praznik dd2e3182 2022-08-06T12:31:06 wayland: Use libdecor visibility toggle for hiding/showing the window The current method of toggling the libdecor window visibility by destroying and recreating the frame results in a race where a use-after-free bug can manifest itself within libdecor when window visibility is toggled quickly. Instead, use the libdecor function for toggling visibility instead of destroying and recreating the frame every time.
Frank Praznik 3685c64e 2022-08-05T16:16:31 wayland: Round trip after window show/hide operations. Perform a round trip after showing/hiding the window to avoid protocol errors when ShowWindow() is called immediately after HideWindow().
Sebastian Krzyszkowiak 041666e6 2022-07-24T05:45:59 video: wayland: Don't switch to libdecor path for borderless windows We actually request CSD mode with xdg-decoration for borderless windows, so we get what we wanted there and there's no point in going into fallback paths.
Sebastian Krzyszkowiak 405d1f65 2022-07-24T10:16:20 video: wayland: Roundtrip after falling back to libdecor in xdg-decoration handler Otherwise libdecor doesn't have a chance to acquire xdg-toplevel after libdecor_new before we attempt to use it in Wayland_ShowWindow. Fixes #5952
David Gow 78bad667 2022-07-16T22:12:08 video: wayland: Resize the window before sending the SDL_RESIZE event Currently, the SDL_WINDOWEVENT_RESIZED event is sent before the actual window is resized (and various internal state, such as the desired GL/Vulkan backbuffer size, are updated). This makes sense, as SDL will discard a no-op resize, which would be the case if we had resized before sending the event (indeed, there are existing hacks to prevent this). However, this means that SDL_{GL,Vulkan}_GetDrawableSize() will still use the old size in the SDL_WINDOWEVENT_RESIZED handler. In the case of SDL_Renderer, this means the drawable size it uses will be wrong, and the viewport will get "updated" to the old value. This then results in bug #5899.
Frank Praznik c11bdeeb 2022-06-21T13:28:14 wayland: Round fractional backbuffer sizes halfway away from zero Use SDL_lroundf() to round fractional backbuffer sizes halfway away from zero, as this is the rounding method recommended by the forthcoming Wayland fractional scaling protocol.
Frank Praznik 4a3277b0 2022-05-19T15:13:02 wayland: Always commit window constraints before entering fullscreen XDG-toplevel min/max size values are double-buffered data and must be committed before entering the fullscreen state, or a max window size value smaller than the display dimensions may cause the compositor to incorrectly configure the fullscreen window size. This fixes windowed->fullscreen transitions on GNOME, where, previously, certain combinations of window flags and min/max size values could cause entering fullscreen mode to fail with odd window sizes and/or offsets due to the new max size values not being committed before entering fullscreen, causing the compositor to clamp to the old values. In the case of libdecor, it has its own layer of buffering on top of the xdg-toplevel surface for the min/max window dimensions, so both a frame commit and surface commit are required to set the state properly.
Frank Praznik 78698a0b 2022-05-17T12:37:16 wayland: Use a separate frame callback for setting the surface damage region Previously, the surface damage region was being set in the same callback used for preventing render hangs in the GL backend when the surface was not visible. This was not ideal, as the callback was never fired in the case of using a different render backend or having a swap interval of 0. Use a separate frame callback for setting the surface damage region to ensure that it fires reliably, regardless of the backend being used or swap interval.
Frank Praznik 146ea9b0 2022-05-16T18:18:55 wayland: Only set the surface opaque region if EGL transparency is disabled Check if the "SDL_VIDEO_EGL_ALLOW_TRANSPARENCY" hint is enabled and don't mark surfaces as opqaue if it is.
Frank Praznik e9d3dcea 2022-05-14T18:32:05 wayland: Unify integer and fractional output scaling Previously, scale values used by the displays and surfaces were always integers, with fractional scale values only being calculated when the backbuffer and viewport sizes were being determined. Now, if xdg-output is available, the fractional scale of output displays is calculated when the displays are enumerated and the true scale values of the output devices are used whenever possible. This unifies the integer and fractional scaling systems, allows for the use of more accurate scale values that minimize overdraw when windows straddle multiple outputs, and lays the groundwork for the pending Wayland scaling protocols that will report the preferred scale values per-surface instead of per-output.
Frank Praznik 4fde7dd8 2022-05-14T14:42:52 wayland: Refactor the Wayland mode emulation and viewport logic Compartmentalize the fullscreen mode emulation code blocks, unify the windowed/fullscreen viewport logic, consolidate all window geometry code into a central function to eliminate blocks of duplicate code and rename related variables and functions to more explicitly reflect their purpose.
Ethan Lee e4bb3c86 2022-05-11T18:13:44 wayland: Fix build for configs without libdecor
Ethan Lee 6f88cbe4 2022-05-11T16:04:34 wayland: Support xdg_decoration requesting client-side decorations. Don't be fooled by the diff size - this ended up being a big refactor of the shell surface management, masked only by some helper macros I wrote for the popup support. This change makes it so when xdg_decoration is supported, but CSD is requested, the system bails on xdg support entirely and resets all the windows to use libdecor instead. This transition isn't pretty, but once it's done it will be smooth if decorations are an OS toggle since libdecor will take things from there. In hindsight, we really should have designed libdecor to be passed a toplevel, having it manage that for us keeps causing major refactors for _every_ change.
Frank Praznik c8c59a21 2022-04-20T08:58:58 Fix a -Wshadow warning
Ethan Lee c37090f9 2022-04-18T12:30:08 wayland: Add support for TOOLTIP/POPUP_MENU
Frank Praznik 13393a1c 2022-04-15T14:28:07 video: Wayland: Clamp fullscreen window dimensions to desktop A scaled fullscreen window may exceed the bounds of the desktop. Clamp the window size to the desktop dimensions in fullscreen mode.
Frank Praznik c2093fab 2022-04-08T13:58:45 video: wayland: Set the surface damage region when using fullscreen viewports When using emulated display modes, the output size is often larger than the drawable buffer. As the surface damage region is automatically calculated from the smaller drawable buffer size, the damage region needs to be manually set to cover the entire viewport region or visual repaint artifacts can result.
Ethan Lee d1f7f9e3 2022-04-06T11:18:46 wayland: Pin the fake window position at (0, 0). I kind of thought it'd be nice to have it in the center, but this is an issue for applications that still assume global mouse and window positions are accessible. For example, this fixes cursor offset issues in UE5.
Ethan Lee 279aeb59 2022-04-06T01:32:57 wayland: Add a bug link for the detach FIXME
Ethan Lee 3ada694e 2022-04-06T01:18:03 wayland: Try to detach at the beginning of ShowWindow, just in case. It's possible that an external component (probably a GL/VK context) committed, so we need to cover our bases and detach in both HideWindow and ShowWindow. Fixes a crash in UE5 editor's pop-ups.
Ethan Lee dcfb7fff 2022-04-06T00:55:32 wayland: Evaluate WINDOWPOS_CENTERED_DISPLAY for move events Partially fixes the mouse cursor in UE5 editor. Imperfect because UE5 uses window position and global mouse state to get position, but of course we don't have global mouse and this is just to get the right display index so this still fails overall. We really need to make global mouse support a feature query...
Frank Praznik 4d1905c9 2022-03-29T13:34:14 video: wayland: Use viewports for non-fullscreen windows with fractional scaling Use viewports for non-fullscreen windows when the desktop uses fractional scaling and the window is flagged as DPI-aware to provide a backbuffer mapped as close to 1:1 output as possible. In the cases of odd window sizes the backbuffer may be a pixel off of scaling perfectly into the window size due to its scaled size being rounded off, but a minute amount of scaling during output is likely preferable to the large amounts of overdraw needed with integer scaled buffers.
Frank Praznik fa4c5198 2022-03-28T21:32:30 video: wayland: Expose more resolutions for mode emulation Expose as many emulated display modes as possible. They will currently display stretched to the display's native desktop aspect, but if an application requires a hardcoded resolution, it will work at minimum. Aside from the change in the emulated display mode list, the Wayland event handling code had to be updated to support separate scaling for the x and y axes, as square pixels are no longer guaranteed.
Frank Praznik 4d76c9cb 2022-03-25T20:35:07 video: wayland: Use wp-viewporter for fullscreen with non-native resolutions Wayland doesn't support mode switching, however Wayland compositors can support the wp_viewporter protocol, which allows for the mapping of arbitrarily sized buffer regions to output surfaces. Use this functionality, when available, for fullscreen output when using non-native display modes and/or when dealing with scaled desktops, which can incur significant overdraw without this extension. This also allows for the exposure of arbitrarily sized, emulated display modes, which can be useful for legacy compatability.
Simon McVittie b4d28085 2022-03-24T18:30:32 wayland: Don't overwrite error message from SDL_EGL_CreateSurface SDL_EGL_CreateSurface sets a more specific error message, so overwriting it would lose information. Signed-off-by: Simon McVittie <smcv@collabora.com>
Cameron Gutman 77a9ca6b 2022-01-26T18:26:07 wayland: Fix SDL_SetWindowSize() being dropped right after exiting fullscreen If we get a SDL_SetWindowSize() call right after SDL_SetWindowFullscreen() but before we've gotten a new configure event from the compositor, the attempt to set our window size will silently fail (when libdecor is enabled). Fix this by remembering that we need to commit a new size, so we can do that in decoration_frame_configure().
Ethan Lee 68a71f91 2022-01-25T11:18:04 wayland: Try to avoid committing before the window is shown
Ethan Lee f0e768da 2022-01-25T13:07:00 wayland: Call SetFullscreen directly in ShowWindow. This cuts out an extra flush when getting the first configure event.
Ethan Lee e2d74bcb 2022-01-25T11:16:09 wayland: Detach hidden surfaces in HideWindow, not ShowWindow
Ethan Lee e1b4761c 2022-01-20T14:10:56 wayland: Avoid calling SetFullscreen in libdecor ShowWindow. This caused some weird stuff to happen in the libdecor path, probably because the window hasn't actually been mapped yet. It ends up calling stuff that should not yet apply, and so fullscreen in particular would have a really messed up titlebar. The good news is, libdecor is good about tracking fullscreen state, so we can let the callback do this for us. Keep this for xdg_shell because we actually map the window ourselves, so we know this call is valid for that path.
Ethan Lee ed3442d7 2022-01-19T15:47:52 wayland: Fix building with SDL_OPENGL=OFF
Cameron Gutman d3952a8a 2022-01-16T15:14:33 wayland: Avoid spurious resize events
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Ethan Lee 4c9966ee 2021-12-16T10:22:27 wayland: Add a note for why we check 0,0 for fullscreen configurations
David Gow a709b5b6 2021-12-04T14:14:47 video: wayland: Handle 0x0 xdg_toplevel_configure in fullscreen The xdg_shell spec seems to state[1] that xdg_toplevel_configure events can always provide a 0×0 width/height to signal that the compositor doesn't care. SDL previously assumed the provided width/height was always valid for fullscreen windows, and so applied it as-is. This broke SDL applications on KDE/KWin 5.23, which now sends 0×0 configure events (and, in 5.23.3, 1×1 events for some reason), breaking all SDL applications in fullscreen[2]. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/6 [2]: https://bugs.kde.org/show_bug.cgi?id=444962#c6
Ethan Lee 63ae103c 2021-11-11T13:16:34 wayland: QTWAYLAND_CONTENT_ORIENTATION can support multiple values as bitmasks
Ethan Lee ae67c7d2 2021-11-09T01:30:00 Implemented SDL_SetWindowMouseRect() on Wayland
Väinö Mäkelä ad520573 2021-10-06T09:52:06 wayland: Only dispatch frame events in Wayland_GLES_SwapWindow Dispatching all events in Wayland_GLES_SwapWindow leads to resizes being acked before the program has a chance to handle the resize. This change reduces jumping on fullscreen transition with apps that call SDL_PollEvent before issuing any render calls.
Sam Lantinga 9672d581 2021-09-26T14:22:11 Need to check structure version before setting xdg_toplevel to NULL
Cacodemon345 b592e78f 2021-09-25T12:55:41 wayland: Expose xdg_toplevel to SysWM
Ethan Lee ae7ee2a5 2021-08-11T09:59:43 wayland: Ignore stateless/sizeless configs when starting in fullscreen mode
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.
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 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.
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
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 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 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 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
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
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
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 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.
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.