Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Some fixes for SDL_MaximizeWindow().
Browse files Browse the repository at this point in the history
Fixes Bugzilla #1441.
  • Loading branch information
icculus committed Aug 3, 2013
1 parent 0dcad14 commit c774416
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/video/SDL_video.c
Expand Up @@ -1756,6 +1756,8 @@ SDL_MaximizeWindow(SDL_Window * window)
return;
}

// !!! FIXME: should this check if the window is resizable?

if (_this->MaximizeWindow) {
_this->MaximizeWindow(_this, window);
}
Expand Down
7 changes: 7 additions & 0 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -239,6 +239,13 @@ - (void)windowDidResize:(NSNotification *)aNotification
or resizing from a corner */
SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MOVED, x, y);
SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);

const BOOL zoomed = [_data->nswindow isZoomed];
if (!zoomed) {
SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
} else if (zoomed) {
SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
}
}

- (void)windowDidMiniaturize:(NSNotification *)aNotification
Expand Down
16 changes: 7 additions & 9 deletions src/video/x11/SDL_x11window.c
Expand Up @@ -878,6 +878,12 @@ SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized)
Atom _NET_WM_STATE_MAXIMIZED_VERT = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT;
Atom _NET_WM_STATE_MAXIMIZED_HORZ = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ;

if (maximized) {
window->flags |= SDL_WINDOW_MAXIMIZED;
} else {
window->flags &= ~SDL_WINDOW_MAXIMIZED;
}

if (X11_IsWindowMapped(_this, window)) {
XEvent e;

Expand All @@ -895,15 +901,7 @@ SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized)
XSendEvent(display, RootWindow(display, displaydata->screen), 0,
SubstructureNotifyMask | SubstructureRedirectMask, &e);
} else {
Uint32 flags;

flags = window->flags;
if (maximized) {
flags |= SDL_WINDOW_MAXIMIZED;
} else {
flags &= ~SDL_WINDOW_MAXIMIZED;
}
X11_SetNetWMState(_this, data->xwindow, flags);
X11_SetNetWMState(_this, data->xwindow, window->flags);
}
XFlush(display);
}
Expand Down

0 comments on commit c774416

Please sign in to comment.