X11: Add events related to maximizing a window (thanks, Andrei and Gergely!).
authorRyan C. Gordon
Mon, 02 Feb 2015 01:21:02 -0500
changeset 9331bb0b744fd1a6
parent 9330 26eb20aad02f
child 9332 e29fec41a2c6
X11: Add events related to maximizing a window (thanks, Andrei and Gergely!).

Fixes Bugzilla #1447.
src/video/x11/SDL_x11events.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Mon Feb 02 01:05:41 2015 -0500
     1.2 +++ b/src/video/x11/SDL_x11events.c	Mon Feb 02 01:21:02 2015 -0500
     1.3 @@ -1108,15 +1108,25 @@
     1.4                     without ever mapping / unmapping them, so we handle that here,
     1.5                     because they use the NETWM protocol to notify us of changes.
     1.6                   */
     1.7 -                Uint32 flags = X11_GetNetWMState(_this, xevent.xproperty.window);
     1.8 -				if ((flags^data->window->flags) & SDL_WINDOW_HIDDEN ||
     1.9 -					(flags^data->window->flags) & SDL_WINDOW_FULLSCREEN ) {
    1.10 -                    if (flags & SDL_WINDOW_HIDDEN) {
    1.11 -                        X11_DispatchUnmapNotify(data);
    1.12 -                    } else {
    1.13 -                        X11_DispatchMapNotify(data);
    1.14 +                const Uint32 flags = X11_GetNetWMState(_this, xevent.xproperty.window);
    1.15 +                const Uint32 changed = flags ^ data->window->flags;
    1.16 +
    1.17 +                if ((changed & SDL_WINDOW_HIDDEN) || (changed & SDL_WINDOW_FULLSCREEN)) {
    1.18 +                     if (flags & SDL_WINDOW_HIDDEN) {
    1.19 +                         X11_DispatchUnmapNotify(data);
    1.20 +                     } else {
    1.21 +                         X11_DispatchMapNotify(data);
    1.22                      }
    1.23                  }
    1.24 +
    1.25 +                if (changed & SDL_WINDOW_MAXIMIZED) {
    1.26 +                    if (flags & SDL_WINDOW_MAXIMIZED) {
    1.27 +                        SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
    1.28 +                    } else {
    1.29 +                        SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0);
    1.30 +                    }
    1.31 +                 }
    1.32 +
    1.33              }
    1.34          }
    1.35          break;