src/video/x11/SDL_x11window.c
changeset 5246 58265e606e4e
parent 5243 3a8a452b49f0
child 5262 b530ef003506
     1.1 --- a/src/video/x11/SDL_x11window.c	Thu Feb 10 14:36:09 2011 -0800
     1.2 +++ b/src/video/x11/SDL_x11window.c	Thu Feb 10 14:44:25 2011 -0800
     1.3 @@ -90,7 +90,7 @@
     1.4  {
     1.5      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
     1.6      SDL_DisplayData *displaydata =
     1.7 -        (SDL_DisplayData *) window->display->driverdata;
     1.8 +        (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
     1.9      XWindowAttributes attr;
    1.10  
    1.11      XGetWindowAttributes(data->display, RootWindow(data->display, displaydata->screen), &attr);
    1.12 @@ -259,7 +259,7 @@
    1.13  {
    1.14      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    1.15      SDL_DisplayData *displaydata =
    1.16 -        (SDL_DisplayData *) window->display->driverdata;
    1.17 +        (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
    1.18      Display *display = data->display;
    1.19      int screen = displaydata->screen;
    1.20      Visual *visual;
    1.21 @@ -328,19 +328,19 @@
    1.22      xattr.colormap = XCreateColormap(display, RootWindow(display, screen), visual, AllocNone);
    1.23  
    1.24      if (oldstyle_fullscreen
    1.25 -        || window->x == SDL_WINDOWPOS_CENTERED) {
    1.26 +        || SDL_WINDOWPOS_ISCENTERED(window->x)) {
    1.27          X11_GetDisplaySize(_this, window, &x, NULL);
    1.28          x = (x - window->w) / 2;
    1.29 -    } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
    1.30 +    } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
    1.31          x = 0;
    1.32      } else {
    1.33          x = window->x;
    1.34      }
    1.35      if (oldstyle_fullscreen
    1.36 -        || window->y == SDL_WINDOWPOS_CENTERED) {
    1.37 +        || SDL_WINDOWPOS_ISCENTERED(window->y)) {
    1.38          X11_GetDisplaySize(_this, window, NULL, &y);
    1.39          y = (y - window->h) / 2;
    1.40 -    } else if (window->y == SDL_WINDOWPOS_UNDEFINED) {
    1.41 +    } else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) {
    1.42          y = 0;
    1.43      } else {
    1.44          y = window->y;
    1.45 @@ -377,8 +377,8 @@
    1.46              sizehints->flags = PMaxSize | PMinSize;
    1.47          }
    1.48          if (!oldstyle_fullscreen
    1.49 -            && window->x != SDL_WINDOWPOS_UNDEFINED
    1.50 -            && window->y != SDL_WINDOWPOS_UNDEFINED) {
    1.51 +            && !SDL_WINDOWPOS_ISUNDEFINED(window->x)
    1.52 +            && !SDL_WINDOWPOS_ISUNDEFINED(window->y)) {
    1.53              sizehints->x = x;
    1.54              sizehints->y = y;
    1.55              sizehints->flags |= USPosition;
    1.56 @@ -713,14 +713,14 @@
    1.57      oldstyle_fullscreen = X11_IsWindowOldFullscreen(_this, window);
    1.58  
    1.59      if (oldstyle_fullscreen
    1.60 -        || window->x == SDL_WINDOWPOS_CENTERED) {
    1.61 +        || SDL_WINDOWPOS_ISCENTERED(window->x)) {
    1.62          X11_GetDisplaySize(_this, window, &x, NULL);
    1.63          x = (x - window->w) / 2;
    1.64      } else {
    1.65          x = window->x;
    1.66      }
    1.67      if (oldstyle_fullscreen
    1.68 -        || window->y == SDL_WINDOWPOS_CENTERED) {
    1.69 +        || SDL_WINDOWPOS_ISCENTERED(window->y)) {
    1.70          X11_GetDisplaySize(_this, window, NULL, &y);
    1.71          y = (y - window->h) / 2;
    1.72      } else {
    1.73 @@ -777,7 +777,7 @@
    1.74  {
    1.75      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
    1.76      SDL_DisplayData *displaydata =
    1.77 -        (SDL_DisplayData *) window->display->driverdata;
    1.78 +        (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
    1.79      Display *display = data->videodata->display;
    1.80      Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE;
    1.81      Atom _NET_WM_STATE_MAXIMIZED_VERT = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT;
    1.82 @@ -832,7 +832,7 @@
    1.83  {
    1.84      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
    1.85      SDL_DisplayData *displaydata =
    1.86 -        (SDL_DisplayData *) window->display->driverdata;
    1.87 +        (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
    1.88      Display *display = data->videodata->display;
    1.89   
    1.90      XIconifyWindow(display, data->xwindow, displaydata->screen);