Fixed fullscreen origin for multi-head displays
This commit is contained in:
parent
1401f159d0
commit
2c07f9f35b
2 changed files with 17 additions and 19 deletions
|
@ -151,9 +151,8 @@ X11_InitModes(_THIS)
|
||||||
*/
|
*/
|
||||||
if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) {
|
if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) {
|
||||||
xinerama = XineramaQueryScreens(data->display, &screencount);
|
xinerama = XineramaQueryScreens(data->display, &screencount);
|
||||||
if (!xinerama) screencount = ScreenCount(data->display);
|
|
||||||
}
|
}
|
||||||
else {
|
if (!xinerama) {
|
||||||
screencount = ScreenCount(data->display);
|
screencount = ScreenCount(data->display);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -807,14 +806,11 @@ X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (_this->windows) {
|
|
||||||
rect->x = 0;
|
rect->x = 0;
|
||||||
rect->y = 0;
|
rect->y = 0;
|
||||||
rect->w = _this->windows->w;
|
rect->w = sdl_display->current_mode.w;
|
||||||
rect->h = _this->windows->h;
|
rect->h = sdl_display->current_mode.h;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_X11 */
|
#endif /* SDL_VIDEO_DRIVER_X11 */
|
||||||
|
|
|
@ -996,13 +996,14 @@ X11_BeginWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _
|
||||||
unsigned long xattrmask = 0;
|
unsigned long xattrmask = 0;
|
||||||
XSetWindowAttributes xattr;
|
XSetWindowAttributes xattr;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
int x = 0;
|
SDL_Rect rect;
|
||||||
int y = 0;
|
|
||||||
|
|
||||||
if ( data->fswindow ) {
|
if ( data->fswindow ) {
|
||||||
return; /* already fullscreen, I hope. */
|
return; /* already fullscreen, I hope. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
X11_GetDisplayBounds(_this, _display, &rect);
|
||||||
|
|
||||||
/* Ungrab the input so that we can move the mouse around */
|
/* Ungrab the input so that we can move the mouse around */
|
||||||
XUngrabPointer(display, CurrentTime);
|
XUngrabPointer(display, CurrentTime);
|
||||||
|
|
||||||
|
@ -1020,7 +1021,8 @@ X11_BeginWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _
|
||||||
xattr.colormap = data->colormap;
|
xattr.colormap = data->colormap;
|
||||||
xattrmask |= CWColormap;
|
xattrmask |= CWColormap;
|
||||||
|
|
||||||
data->fswindow = XCreateWindow(display, root, x, y, w, h, 0,
|
data->fswindow = XCreateWindow(display, root,
|
||||||
|
rect.x, rect.y, rect.w, rect.h, 0,
|
||||||
displaydata->depth, InputOutput,
|
displaydata->depth, InputOutput,
|
||||||
visual, xattrmask, &xattr);
|
visual, xattrmask, &xattr);
|
||||||
|
|
||||||
|
@ -1048,9 +1050,9 @@ X11_BeginWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _
|
||||||
//XIfEvent(display, &ev, &isConfigureNotify, (XPointer)&data->xwindow);
|
//XIfEvent(display, &ev, &isConfigureNotify, (XPointer)&data->xwindow);
|
||||||
|
|
||||||
/* Center actual window within our cover-the-screen window. */
|
/* Center actual window within our cover-the-screen window. */
|
||||||
x += (w - window->w) / 2;
|
rect.x += (rect.w - window->w) / 2;
|
||||||
y += (h - window->h) / 2;
|
rect.y += (rect.h - window->h) / 2;
|
||||||
XReparentWindow(display, data->xwindow, data->fswindow, x, y);
|
XReparentWindow(display, data->xwindow, data->fswindow, rect.x, rect.y);
|
||||||
XRaiseWindow(display, data->xwindow);
|
XRaiseWindow(display, data->xwindow);
|
||||||
|
|
||||||
/* Make sure the fswindow is in view by warping mouse to the corner */
|
/* Make sure the fswindow is in view by warping mouse to the corner */
|
||||||
|
@ -1058,9 +1060,9 @@ X11_BeginWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _
|
||||||
XFlush(display);
|
XFlush(display);
|
||||||
|
|
||||||
/* Center mouse in the window. */
|
/* Center mouse in the window. */
|
||||||
x += (window->w / 2);
|
rect.x += (window->w / 2);
|
||||||
y += (window->h / 2);
|
rect.y += (window->h / 2);
|
||||||
XWarpPointer(display, None, root, 0, 0, 0, 0, x, y);
|
XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y);
|
||||||
|
|
||||||
/* Wait to be mapped, filter Unmap event out if it arrives. */
|
/* Wait to be mapped, filter Unmap event out if it arrives. */
|
||||||
XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow);
|
XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue