X11: Add events related to maximizing a window (thanks, Andrei and Gergely!).
authorRyan C. Gordon <icculus@icculus.org>
Mon, 02 Feb 2015 01:21:02 -0500
changeset 9331 bb0b744fd1a6
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
--- a/src/video/x11/SDL_x11events.c	Mon Feb 02 01:05:41 2015 -0500
+++ b/src/video/x11/SDL_x11events.c	Mon Feb 02 01:21:02 2015 -0500
@@ -1108,15 +1108,25 @@
                    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;