|
|
e54a86 |
From 77a9ca6ba0ae1973d7bc255a4d785e7f1ba3d111 Mon Sep 17 00:00:00 2001
|
|
|
e54a86 |
From: Cameron Gutman <aicommander@gmail.com>
|
|
|
e54a86 |
Date: Wed, 26 Jan 2022 18:26:07 -0600
|
|
|
e54a86 |
Subject: [PATCH 08/11] wayland: Fix SDL_SetWindowSize() being dropped right
|
|
|
e54a86 |
after exiting fullscreen
|
|
|
e54a86 |
|
|
|
e54a86 |
If we get a SDL_SetWindowSize() call right after SDL_SetWindowFullscreen() but
|
|
|
e54a86 |
before we've gotten a new configure event from the compositor, the attempt to
|
|
|
e54a86 |
set our window size will silently fail (when libdecor is enabled).
|
|
|
e54a86 |
|
|
|
e54a86 |
Fix this by remembering that we need to commit a new size, so we can do that
|
|
|
e54a86 |
in decoration_frame_configure().
|
|
|
e54a86 |
---
|
|
|
e54a86 |
src/video/wayland/SDL_waylandwindow.c | 5 ++++-
|
|
|
e54a86 |
src/video/wayland/SDL_waylandwindow.h | 1 +
|
|
|
e54a86 |
2 files changed, 5 insertions(+), 1 deletion(-)
|
|
|
e54a86 |
|
|
|
e54a86 |
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
|
|
|
e54a86 |
index 4c3c60aac..635546af4 100644
|
|
|
e54a86 |
--- a/src/video/wayland/SDL_waylandwindow.c
|
|
|
e54a86 |
+++ b/src/video/wayland/SDL_waylandwindow.c
|
|
|
e54a86 |
@@ -414,9 +414,10 @@ decoration_frame_configure(struct libdecor_frame *frame,
|
|
|
e54a86 |
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
|
|
e54a86 |
scale_factor = driverdata->scale_factor;
|
|
|
e54a86 |
}
|
|
|
e54a86 |
- } else if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
|
|
|
e54a86 |
+ } else if (!(window->flags & SDL_WINDOW_RESIZABLE) || (floating && wind->floating_resize_pending)) {
|
|
|
e54a86 |
width = window->windowed.w;
|
|
|
e54a86 |
height = window->windowed.h;
|
|
|
e54a86 |
+ wind->floating_resize_pending = SDL_FALSE;
|
|
|
e54a86 |
} else {
|
|
|
e54a86 |
/* This will never set 0 for width/height unless the function returns false */
|
|
|
e54a86 |
if (!libdecor_configuration_get_content_size(configuration, frame, &width, &height)) {
|
|
|
e54a86 |
@@ -1424,6 +1425,8 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window)
|
|
|
e54a86 |
if (data->shell.libdecor &&
|
|
|
e54a86 |
wind->shell_surface.libdecor.frame &&
|
|
|
e54a86 |
!libdecor_frame_is_floating(wind->shell_surface.libdecor.frame)) {
|
|
|
e54a86 |
+ /* Commit the resize when we re-enter floating state */
|
|
|
e54a86 |
+ wind->floating_resize_pending = SDL_TRUE;
|
|
|
e54a86 |
return;
|
|
|
e54a86 |
}
|
|
|
e54a86 |
#endif
|
|
|
e54a86 |
diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h
|
|
|
e54a86 |
index e8d7d6299..90e4d8cf6 100644
|
|
|
e54a86 |
--- a/src/video/wayland/SDL_waylandwindow.h
|
|
|
e54a86 |
+++ b/src/video/wayland/SDL_waylandwindow.h
|
|
|
e54a86 |
@@ -87,6 +87,7 @@ typedef struct {
|
|
|
e54a86 |
|
|
|
e54a86 |
float scale_factor;
|
|
|
e54a86 |
SDL_bool needs_resize_event;
|
|
|
e54a86 |
+ SDL_bool floating_resize_pending;
|
|
|
e54a86 |
} SDL_WindowData;
|
|
|
e54a86 |
|
|
|
e54a86 |
extern void Wayland_ShowWindow(_THIS, SDL_Window *window);
|
|
|
e54a86 |
--
|
|
|
e54a86 |
2.34.1
|
|
|
e54a86 |
|