diff -r 1df8027101c5 src/video/SDL_video.c --- a/src/video/SDL_video.c mar jun 19 19:24:32 2012 -0300 +++ b/src/video/SDL_video.c dom jun 24 13:45:49 2012 -0300 @@ -910,7 +910,7 @@ int i, dist; int closest = -1; int closest_dist = 0x7FFFFFFF; - SDL_Point center; + SDL_Point center, tl, br; SDL_Point delta; SDL_Rect rect; @@ -936,11 +936,15 @@ /* Find the display containing the window */ center.x = window->x + window->w / 2; center.y = window->y + window->h / 2; + tl.x = window->x; + tl.y = window->y; + br.x = window->x+window->w; + br.y = window->y+window->h; for (i = 0; i < _this->num_displays; ++i) { SDL_VideoDisplay *display = &_this->displays[i]; SDL_GetDisplayBounds(i, &rect); - if (display->fullscreen_window == window || SDL_EnclosePoints(¢er, 1, &rect, NULL)) { + if (display->fullscreen_window == window || (SDL_EnclosePoints(&tl, 1, &rect, NULL) && SDL_EnclosePoints(&br, 1, &rect, NULL)) ) { return i; } @@ -1181,12 +1185,20 @@ displayIndex = SDL_GetIndexOfDisplay(display); SDL_GetDisplayBounds(displayIndex, &bounds); - if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISCENTERED(x)) { + if (SDL_WINDOWPOS_ISCENTERED(x)) { window->x = bounds.x + (bounds.w - w) / 2; } - if (SDL_WINDOWPOS_ISUNDEFINED(y) || SDL_WINDOWPOS_ISCENTERED(y)) { + if (SDL_WINDOWPOS_ISCENTERED(y)) { window->y = bounds.y + (bounds.h - h) / 2; } + + if (SDL_WINDOWPOS_ISUNDEFINED(x) ) { + window->x = bounds.x; + } + if (SDL_WINDOWPOS_ISUNDEFINED(y) ) { + window->y = bounds.y; + } + } window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN); window->brightness = 1.0f; diff -r 1df8027101c5 src/video/x11/SDL_x11modes.c --- a/src/video/x11/SDL_x11modes.c mar jun 19 19:24:32 2012 -0300 +++ b/src/video/x11/SDL_x11modes.c dom jun 24 13:45:49 2012 -0300 @@ -151,6 +151,7 @@ if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) { xinerama = XineramaQueryScreens(data->display, &screencount); if (!xinerama) screencount = ScreenCount(data->display); + else screencount += 1; } else { screencount = ScreenCount(data->display); @@ -190,8 +191,14 @@ } #if SDL_VIDEO_DRIVER_X11_XINERAMA if (xinerama) { - mode.w = xinerama[screen].width; - mode.h = xinerama[screen].height; + if (screen < screencount -1) { + mode.w = xinerama[screen].width; + mode.h = xinerama[screen].height; + } + else { + mode.w = DisplayWidth(data->display, 0); + mode.h = DisplayHeight(data->display, 0); + } } else { mode.w = DisplayWidth(data->display, screen); @@ -216,7 +223,15 @@ if (xinerama) { displaydata->screen = 0; displaydata->use_xinerama = xinerama_major * 100 + xinerama_minor; - displaydata->xinerama_info = xinerama[screen]; + if (screen < screencount -1) { + displaydata->xinerama_info = xinerama[screen]; + } + else { + displaydata->xinerama_info.x_org = 0; + displaydata->xinerama_info.y_org = 0; + displaydata->xinerama_info.width = mode.w; + displaydata->xinerama_info.height = mode.h; + } } else displaydata->screen = screen; #else @@ -445,13 +460,13 @@ #if SDL_VIDEO_DRIVER_X11_XINERAMA if (data->use_xinerama) { /* Add the full (both screens combined) xinerama mode only on the display that starts at 0,0 */ - if (!data->xinerama_info.x_org && !data->xinerama_info.y_org && + /*if (!data->xinerama_info.x_org && !data->xinerama_info.y_org && (screen_w > data->xinerama_info.width || screen_h > data->xinerama_info.height)) { mode.w = screen_w; mode.h = screen_h; mode.refresh_rate = 0; SDL_AddDisplayMode(sdl_display, &mode); - } + }*/ /* Add the head xinerama mode */ mode.w = data->xinerama_info.width; @@ -623,7 +638,6 @@ /* check current mode so we can avoid uneccessary mode changes */ get_real_resolution(display, data, &real_w, &real_h, &real_rate); - #if SDL_VIDEO_DRIVER_X11_XINERAMA if (w == real_w && h == real_h && (data->use_xinerama || !rate || rate == real_rate)) { return;