Skip to content

Commit

Permalink
X11: Add events related to maximizing a window (thanks, Andrei and Ge…
Browse files Browse the repository at this point in the history
…rgely!).

Fixes Bugzilla #1447.
  • Loading branch information
icculus committed Feb 2, 2015
1 parent ece8d2b commit 56edbb4
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -1108,15 +1108,25 @@ X11_DispatchEvent(_THIS)
without ever mapping / unmapping them, so we handle that here,
because they use the NETWM protocol to notify us of changes.
*/
Uint32 flags = X11_GetNetWMState(_this, xevent.xproperty.window);
if ((flags^data->window->flags) & SDL_WINDOW_HIDDEN ||
(flags^data->window->flags) & SDL_WINDOW_FULLSCREEN ) {
if (flags & SDL_WINDOW_HIDDEN) {
X11_DispatchUnmapNotify(data);
} else {
X11_DispatchMapNotify(data);
const Uint32 flags = X11_GetNetWMState(_this, xevent.xproperty.window);
const Uint32 changed = flags ^ data->window->flags;

if ((changed & SDL_WINDOW_HIDDEN) || (changed & SDL_WINDOW_FULLSCREEN)) {
if (flags & SDL_WINDOW_HIDDEN) {
X11_DispatchUnmapNotify(data);
} else {
X11_DispatchMapNotify(data);
}
}

if (changed & SDL_WINDOW_MAXIMIZED) {
if (flags & SDL_WINDOW_MAXIMIZED) {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
} else {
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
}
}

}
}
break;
Expand Down

0 comments on commit 56edbb4

Please sign in to comment.