Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Some fixes for SDL_MaximizeWindow().

Fixes Bugzilla #1441.
  • Loading branch information
icculus committed Aug 3, 2013
1 parent 0dcad14 commit c77441676d1823707141fad53295cee1b38b53fb
Showing with 16 additions and 9 deletions.
  1. +2 −0 src/video/SDL_video.c
  2. +7 −0 src/video/cocoa/SDL_cocoawindow.m
  3. +7 −9 src/video/x11/SDL_x11window.c
@@ -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);
}
@@ -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
@@ -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;

@@ -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);
}

0 comments on commit c774416

Please sign in to comment.