Always set the size hints for consistent behavior with all window managers, and it wasn't resetting when switching back from fullscreen mode.
authorSam Lantinga <slouken@libsdl.org>
Wed, 03 Oct 2012 12:14:04 -0700
changeset 6539c76274e7f32a
parent 6538 05cf19d1eb53
child 6540 44459e2f6e4d
Always set the size hints for consistent behavior with all window managers, and it wasn't resetting when switching back from fullscreen mode.
src/video/x11/SDL_x11window.c
     1.1 --- a/src/video/x11/SDL_x11window.c	Wed Oct 03 12:04:30 2012 -0700
     1.2 +++ b/src/video/x11/SDL_x11window.c	Wed Oct 03 12:14:04 2012 -0700
     1.3 @@ -917,28 +917,26 @@
     1.4      if (X11_IsWindowMapped(_this, window)) {
     1.5          XEvent e;
     1.6  
     1.7 -        if (!X11_IsActionAllowed(window, _NET_WM_ACTION_FULLSCREEN)) {
     1.8 -            /* We aren't allowed to go into fullscreen mode... */
     1.9 -            if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) {
    1.10 -                /* ...and we aren't resizable. Compiz refuses fullscreen toggle in this case. */
    1.11 -                XSizeHints *sizehints = XAllocSizeHints();
    1.12 -                long flags = 0;
    1.13 -                XGetWMNormalHints(display, data->xwindow, sizehints, &flags);
    1.14 -                /* set the resize flags on */
    1.15 +        if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
    1.16 +            /* Compiz refuses fullscreen toggle if we're not resizable, so update the hints so we
    1.17 +               can be resized to the fullscreen resolution (or reset so we're not resizable again) */
    1.18 +            XSizeHints *sizehints = XAllocSizeHints();
    1.19 +            long flags = 0;
    1.20 +            XGetWMNormalHints(display, data->xwindow, sizehints, &flags);
    1.21 +            /* set the resize flags on */
    1.22 +            if (fullscreen) {
    1.23 +                /* we are going fullscreen so turn the flags off */
    1.24 +                sizehints->flags &= ~(PMinSize | PMaxSize);
    1.25 +            } else {
    1.26 +                /* Reset the min/max width height to make the window non-resizable again */
    1.27                  sizehints->flags |= PMinSize | PMaxSize;
    1.28 -                if (fullscreen) {
    1.29 -                    /* we are going fullscreen so turn the flags off */
    1.30 -                    sizehints->flags ^= (PMinSize | PMaxSize);
    1.31 -                } else {
    1.32 -                    /* Reset the min/max width height to make the window non-resizable again */
    1.33 -                    sizehints->min_width = sizehints->max_width = window->w;
    1.34 -                    sizehints->min_height = sizehints->max_height = window->h;
    1.35 -                }
    1.36 -                XSetWMNormalHints(display, data->xwindow, sizehints);
    1.37 -                XFree(sizehints);
    1.38 +                sizehints->min_width = sizehints->max_width = window->w;
    1.39 +                sizehints->min_height = sizehints->max_height = window->h;
    1.40              }
    1.41 +            XSetWMNormalHints(display, data->xwindow, sizehints);
    1.42 +            XFree(sizehints);
    1.43          }
    1.44 -        
    1.45 +
    1.46          SDL_zero(e);
    1.47          e.xany.type = ClientMessage;
    1.48          e.xclient.message_type = _NET_WM_STATE;