mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
wayland: Only restore windowed constraints in configuration events
In some cases, the fullscreen deadline handler can be hit before the associated configure event is received, resulting in the constraints being erroneously restored. The state is doubled buffered, so it shouldn't interfere with the pending fullscreen dimensions, but it isn't correct behavior. According to the spec, calls to set/unset fullscreen will always have an associated configure event, and the constraints will be reapplied as needed there.
This commit is contained in:
@@ -474,7 +474,6 @@ static void fullscreen_deadline_handler(void *data, struct wl_callback *callback
|
|||||||
|
|
||||||
if (window && window->driverdata) {
|
if (window && window->driverdata) {
|
||||||
window->driverdata->fullscreen_deadline_count--;
|
window->driverdata->fullscreen_deadline_count--;
|
||||||
SetMinMaxDimensions(window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_callback_destroy(callback);
|
wl_callback_destroy(callback);
|
||||||
@@ -1983,24 +1982,6 @@ int Wayland_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOpe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fullscreen_configure_handler(void *data, struct wl_callback *callback, uint32_t callback_data)
|
|
||||||
{
|
|
||||||
/* Get the window from the ID as it may have been destroyed */
|
|
||||||
SDL_WindowID windowID = (SDL_WindowID)((uintptr_t)data);
|
|
||||||
SDL_Window *window = SDL_GetWindowFromID(windowID);
|
|
||||||
|
|
||||||
if (window && window->driverdata && window->driverdata->is_fullscreen) {
|
|
||||||
ConfigureWindowGeometry(window);
|
|
||||||
CommitLibdecorFrame(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_callback_destroy(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct wl_callback_listener fullscreen_configure_listener = {
|
|
||||||
fullscreen_configure_handler
|
|
||||||
};
|
|
||||||
|
|
||||||
int Wayland_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window,
|
int Wayland_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window,
|
||||||
SDL_VideoDisplay *display, SDL_bool fullscreen)
|
SDL_VideoDisplay *display, SDL_bool fullscreen)
|
||||||
{
|
{
|
||||||
@@ -2041,9 +2022,8 @@ int Wayland_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window,
|
|||||||
wind->fullscreen_was_positioned = SDL_TRUE;
|
wind->fullscreen_was_positioned = SDL_TRUE;
|
||||||
SetFullscreen(window, output);
|
SetFullscreen(window, output);
|
||||||
} else {
|
} else {
|
||||||
/* Queue a configure event */
|
ConfigureWindowGeometry(window);
|
||||||
struct wl_callback *cb = wl_display_sync(_this->driverdata->display);
|
CommitLibdecorFrame(window);
|
||||||
wl_callback_add_listener(cb, &fullscreen_configure_listener, (void *)((uintptr_t)window->id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2447,6 +2427,8 @@ void Wayland_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
|||||||
* Calling this on a custom surface is informative, so the size must
|
* Calling this on a custom surface is informative, so the size must
|
||||||
* always be passed through.
|
* always be passed through.
|
||||||
*/
|
*/
|
||||||
|
FlushFullscreenEvents(window);
|
||||||
|
|
||||||
if (!(window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED)) ||
|
if (!(window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED)) ||
|
||||||
wind->shell_surface_type == WAYLAND_SURFACE_CUSTOM) {
|
wind->shell_surface_type == WAYLAND_SURFACE_CUSTOM) {
|
||||||
wind->requested.width = window->floating.w;
|
wind->requested.width = window->floating.w;
|
||||||
|
Reference in New Issue
Block a user