src/video/x11/SDL_x11window.c
changeset 6539 c76274e7f32a
parent 6501 2efafb933bd5
child 6540 44459e2f6e4d
equal deleted inserted replaced
6538:05cf19d1eb53 6539:c76274e7f32a
   915     Atom _NET_WM_ACTION_FULLSCREEN = data->videodata->_NET_WM_ACTION_FULLSCREEN;
   915     Atom _NET_WM_ACTION_FULLSCREEN = data->videodata->_NET_WM_ACTION_FULLSCREEN;
   916 
   916 
   917     if (X11_IsWindowMapped(_this, window)) {
   917     if (X11_IsWindowMapped(_this, window)) {
   918         XEvent e;
   918         XEvent e;
   919 
   919 
   920         if (!X11_IsActionAllowed(window, _NET_WM_ACTION_FULLSCREEN)) {
   920         if (!(window->flags & SDL_WINDOW_RESIZABLE)) {
   921             /* We aren't allowed to go into fullscreen mode... */
   921             /* Compiz refuses fullscreen toggle if we're not resizable, so update the hints so we
   922             if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) {
   922                can be resized to the fullscreen resolution (or reset so we're not resizable again) */
   923                 /* ...and we aren't resizable. Compiz refuses fullscreen toggle in this case. */
   923             XSizeHints *sizehints = XAllocSizeHints();
   924                 XSizeHints *sizehints = XAllocSizeHints();
   924             long flags = 0;
   925                 long flags = 0;
   925             XGetWMNormalHints(display, data->xwindow, sizehints, &flags);
   926                 XGetWMNormalHints(display, data->xwindow, sizehints, &flags);
   926             /* set the resize flags on */
   927                 /* set the resize flags on */
   927             if (fullscreen) {
       
   928                 /* we are going fullscreen so turn the flags off */
       
   929                 sizehints->flags &= ~(PMinSize | PMaxSize);
       
   930             } else {
       
   931                 /* Reset the min/max width height to make the window non-resizable again */
   928                 sizehints->flags |= PMinSize | PMaxSize;
   932                 sizehints->flags |= PMinSize | PMaxSize;
   929                 if (fullscreen) {
   933                 sizehints->min_width = sizehints->max_width = window->w;
   930                     /* we are going fullscreen so turn the flags off */
   934                 sizehints->min_height = sizehints->max_height = window->h;
   931                     sizehints->flags ^= (PMinSize | PMaxSize);
       
   932                 } else {
       
   933                     /* Reset the min/max width height to make the window non-resizable again */
       
   934                     sizehints->min_width = sizehints->max_width = window->w;
       
   935                     sizehints->min_height = sizehints->max_height = window->h;
       
   936                 }
       
   937                 XSetWMNormalHints(display, data->xwindow, sizehints);
       
   938                 XFree(sizehints);
       
   939             }
   935             }
   940         }
   936             XSetWMNormalHints(display, data->xwindow, sizehints);
   941         
   937             XFree(sizehints);
       
   938         }
       
   939 
   942         SDL_zero(e);
   940         SDL_zero(e);
   943         e.xany.type = ClientMessage;
   941         e.xany.type = ClientMessage;
   944         e.xclient.message_type = _NET_WM_STATE;
   942         e.xclient.message_type = _NET_WM_STATE;
   945         e.xclient.format = 32;
   943         e.xclient.format = 32;
   946         e.xclient.window = data->xwindow;
   944         e.xclient.window = data->xwindow;