wayland: Remove duplicate code

Wayland_SetWindowSize() can be simplified with the common CommitWindowGeometry() function.
This commit is contained in:
Frank Praznik 2022-09-06 17:08:27 -04:00 committed by Sam Lantinga
parent 78f843f741
commit 97a5e74449
1 changed files with 1 additions and 23 deletions

View File

@ -2156,11 +2156,7 @@ Wayland_SetWindowMaximumSize(_THIS, SDL_Window * window)
void Wayland_SetWindowSize(_THIS, SDL_Window * window) void Wayland_SetWindowSize(_THIS, SDL_Window * window)
{ {
SDL_VideoData *data = _this->driverdata;
SDL_WindowData *wind = window->driverdata; SDL_WindowData *wind = window->driverdata;
#ifdef HAVE_LIBDECOR_H
struct libdecor_state *state;
#endif
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
/* we must not resize the window while we have a static (non-floating) size */ /* we must not resize the window while we have a static (non-floating) size */
@ -2175,29 +2171,11 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window)
/* Update the window geometry. */ /* Update the window geometry. */
ConfigureWindowGeometry(window); ConfigureWindowGeometry(window);
CommitWindowGeometry(window);
#ifdef HAVE_LIBDECOR_H
if (WINDOW_IS_LIBDECOR(data, window) && wind->shell_surface.libdecor.frame) {
state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window));
libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL);
libdecor_state_free(state);
}
#endif
/* windowed is unconditionally set, so we can trust it here */ /* windowed is unconditionally set, so we can trust it here */
wind->floating_width = window->windowed.w; wind->floating_width = window->windowed.w;
wind->floating_height = window->windowed.h; wind->floating_height = window->windowed.h;
/* Update the geometry which may have been set by a hack in Wayland_HandleResize */
if (
#ifdef HAVE_LIBDECOR_H
!WINDOW_IS_LIBDECOR(data, window) &&
#endif
data->shell.xdg &&
wind->shell_surface.xdg.surface) {
xdg_surface_set_window_geometry(wind->shell_surface.xdg.surface, 0, 0,
GetWindowWidth(window), GetWindowHeight(window));
}
} }
void Wayland_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h) void Wayland_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h)