src/video/x11/SDL_x11window.c
changeset 6475 71d39944810b
parent 6473 a5adb68266d0
child 6477 1e99ebaf0b14
     1.1 --- a/src/video/x11/SDL_x11window.c	Thu Sep 27 13:22:34 2012 -0700
     1.2 +++ b/src/video/x11/SDL_x11window.c	Thu Sep 27 13:23:34 2012 -0700
     1.3 @@ -996,13 +996,14 @@
     1.4      unsigned long xattrmask = 0;
     1.5      XSetWindowAttributes xattr;
     1.6      XEvent ev;
     1.7 -    int x = 0;
     1.8 -    int y = 0;
     1.9 +    SDL_Rect rect;
    1.10  
    1.11      if ( data->fswindow ) {
    1.12          return;  /* already fullscreen, I hope. */
    1.13      }
    1.14  
    1.15 +    X11_GetDisplayBounds(_this, _display, &rect);
    1.16 +
    1.17      /* Ungrab the input so that we can move the mouse around */
    1.18      XUngrabPointer(display, CurrentTime);
    1.19  
    1.20 @@ -1020,7 +1021,8 @@
    1.21      xattr.colormap = data->colormap;
    1.22      xattrmask |= CWColormap;
    1.23  
    1.24 -    data->fswindow = XCreateWindow(display, root, x, y, w, h, 0,
    1.25 +    data->fswindow = XCreateWindow(display, root,
    1.26 +                                   rect.x, rect.y, rect.w, rect.h, 0,
    1.27                                     displaydata->depth, InputOutput,
    1.28                                     visual, xattrmask, &xattr);
    1.29  
    1.30 @@ -1048,9 +1050,9 @@
    1.31      //XIfEvent(display, &ev, &isConfigureNotify, (XPointer)&data->xwindow);
    1.32  
    1.33      /* Center actual window within our cover-the-screen window. */
    1.34 -    x += (w - window->w) / 2;
    1.35 -    y += (h - window->h) / 2;
    1.36 -    XReparentWindow(display, data->xwindow, data->fswindow, x, y);
    1.37 +    rect.x += (rect.w - window->w) / 2;
    1.38 +    rect.y += (rect.h - window->h) / 2;
    1.39 +    XReparentWindow(display, data->xwindow, data->fswindow, rect.x, rect.y);
    1.40      XRaiseWindow(display, data->xwindow);
    1.41  
    1.42      /* Make sure the fswindow is in view by warping mouse to the corner */
    1.43 @@ -1058,9 +1060,9 @@
    1.44      XFlush(display);
    1.45  
    1.46      /* Center mouse in the window. */
    1.47 -    x += (window->w / 2);
    1.48 -    y += (window->h / 2);
    1.49 -    XWarpPointer(display, None, root, 0, 0, 0, 0, x, y);
    1.50 +    rect.x += (window->w / 2);
    1.51 +    rect.y += (window->h / 2);
    1.52 +    XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y);
    1.53  
    1.54      /* Wait to be mapped, filter Unmap event out if it arrives. */
    1.55      XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow);