Skip to content

Commit

Permalink
wayland: Maximize/Restore should set the relevant window flags.
Browse files Browse the repository at this point in the history
Also, Maximize should be ignored for fixed-size windows.
  • Loading branch information
flibitijibibo authored and icculus committed May 2, 2021
1 parent 006378b commit c69fde3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/video/wayland/SDL_waylandwindow.c
Expand Up @@ -850,6 +850,11 @@ Wayland_RestoreWindow(_THIS, SDL_Window * window)
SDL_WindowData *wind = window->driverdata;
const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata;

/* Set this flag now even if we never actually maximized, eventually
* ShowWindow will take care of it along with the other window state.
*/
window->flags &= ~SDL_WINDOW_MAXIMIZED;

/* Note that xdg-shell does NOT provide a way to unset minimize! */
if (viddata->shell.xdg) {
if (wind->shell_surface.xdg.roleobj.toplevel == NULL) {
Expand Down Expand Up @@ -894,6 +899,15 @@ Wayland_MaximizeWindow(_THIS, SDL_Window * window)
SDL_WindowData *wind = window->driverdata;
SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;

if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
return;
}

/* Set this flag now even if we don't actually maximize yet, eventually
* ShowWindow will take care of it along with the other window state.
*/
window->flags |= SDL_WINDOW_MAXIMIZED;

if (viddata->shell.xdg) {
if (wind->shell_surface.xdg.roleobj.toplevel == NULL) {
return; /* Can't do anything yet, wait for ShowWindow */
Expand Down

0 comments on commit c69fde3

Please sign in to comment.