src/video/x11/SDL_x11window.c
changeset 5981 75caa8a7d559
parent 5535 96594ac5fd1a
child 6023 6279958d571d
equal deleted inserted replaced
5980:612b41c44af1 5981:75caa8a7d559
    82     if (window->flags & SDL_WINDOW_MAXIMIZED) {
    82     if (window->flags & SDL_WINDOW_MAXIMIZED) {
    83         atoms[count++] = data->_NET_WM_STATE_MAXIMIZED_VERT;
    83         atoms[count++] = data->_NET_WM_STATE_MAXIMIZED_VERT;
    84         atoms[count++] = data->_NET_WM_STATE_MAXIMIZED_HORZ;
    84         atoms[count++] = data->_NET_WM_STATE_MAXIMIZED_HORZ;
    85     }
    85     }
    86     return count;
    86     return count;
    87 }
       
    88 
       
    89 static void
       
    90 X11_GetDisplaySize(_THIS, SDL_Window * window, int *w, int *h)
       
    91 {
       
    92     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
       
    93     SDL_DisplayData *displaydata =
       
    94         (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
       
    95     XWindowAttributes attr;
       
    96 
       
    97     XGetWindowAttributes(data->display, RootWindow(data->display, displaydata->screen), &attr);
       
    98     if (window->flags & SDL_WINDOW_FULLSCREEN) {
       
    99         /* The bounds when this window is visible is the fullscreen mode */
       
   100         SDL_DisplayMode fullscreen_mode;
       
   101         if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
       
   102             attr.width = fullscreen_mode.w;
       
   103             attr.height = fullscreen_mode.h;
       
   104         }
       
   105     }
       
   106     if (w) {
       
   107         *w = attr.width;
       
   108     }
       
   109     if (h) {
       
   110         *h = attr.height;
       
   111     }
       
   112 }
    87 }
   113 
    88 
   114 static int
    89 static int
   115 SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
    90 SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
   116 {
    91 {
   318     xattr.override_redirect = False;
   293     xattr.override_redirect = False;
   319     xattr.background_pixel = 0;
   294     xattr.background_pixel = 0;
   320     xattr.border_pixel = 0;
   295     xattr.border_pixel = 0;
   321 
   296 
   322     if (visual->class == DirectColor) {
   297     if (visual->class == DirectColor) {
   323         Status status;
       
   324         XColor *colorcells;
   298         XColor *colorcells;
   325         int i;
   299         int i;
   326         int ncolors;
   300         int ncolors;
   327         int rmax, gmax, bmax;
   301         int rmax, gmax, bmax;
   328         int rmask, gmask, bmask;
   302         int rmask, gmask, bmask;
   755 void
   729 void
   756 X11_SetWindowPosition(_THIS, SDL_Window * window)
   730 X11_SetWindowPosition(_THIS, SDL_Window * window)
   757 {
   731 {
   758     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   732     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   759     Display *display = data->videodata->display;
   733     Display *display = data->videodata->display;
   760     int x, y;
       
   761 
   734 
   762     XMoveWindow(display, data->xwindow, window->x, window->y);
   735     XMoveWindow(display, data->xwindow, window->x, window->y);
   763     XFlush(display);
   736     XFlush(display);
   764 }
   737 }
   765 
   738 
   950     Colormap colormap = data->colormap;
   923     Colormap colormap = data->colormap;
   951     XColor *colorcells;
   924     XColor *colorcells;
   952     int ncolors;
   925     int ncolors;
   953     int rmask, gmask, bmask;
   926     int rmask, gmask, bmask;
   954     int rshift, gshift, bshift;
   927     int rshift, gshift, bshift;
   955     int i, j;
   928     int i;
   956 
   929 
   957     if (visual->class != DirectColor) {
   930     if (visual->class != DirectColor) {
   958         SDL_SetError("Window doesn't have DirectColor visual");
   931         SDL_SetError("Window doesn't have DirectColor visual");
   959         return -1;
   932         return -1;
   960     }
   933     }