mirror of https://github.com/libsdl-org/SDL.git
video: Move fullscreen windows via SDL_UpdateFullscreenMode()
Update the target display ID and use SDL_UpdateFullscreenMode() when moving a fullscreen window to handle the case where the target display has an existing fullscreen window.
This commit is contained in:
parent
c2f8a478d8
commit
e8076b78ef
|
|
@ -1323,6 +1323,9 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
||||||
mode = (SDL_DisplayMode *)SDL_GetWindowFullscreenMode(window);
|
mode = (SDL_DisplayMode *)SDL_GetWindowFullscreenMode(window);
|
||||||
if (mode != NULL) {
|
if (mode != NULL) {
|
||||||
window->fullscreen_exclusive = SDL_TRUE;
|
window->fullscreen_exclusive = SDL_TRUE;
|
||||||
|
} else {
|
||||||
|
/* Make sure the current mode is zeroed for fullscreen desktop. */
|
||||||
|
SDL_zero(window->current_fullscreen_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2190,21 +2193,9 @@ int SDL_SetWindowPosition(SDL_Window *window, int x, int y)
|
||||||
SDL_DisplayID displayID = GetDisplayForRect(x, y, 1, 1);
|
SDL_DisplayID displayID = GetDisplayForRect(x, y, 1, 1);
|
||||||
|
|
||||||
if (displayID != original_displayID) {
|
if (displayID != original_displayID) {
|
||||||
SDL_Rect bounds;
|
/* Set the new target display and update the fullscreen mode */
|
||||||
SDL_zero(bounds);
|
window->current_fullscreen_mode.displayID = displayID;
|
||||||
SDL_GetDisplayBounds(displayID, &bounds);
|
SDL_UpdateFullscreenMode(window, SDL_TRUE);
|
||||||
|
|
||||||
window->x = bounds.x;
|
|
||||||
window->y = bounds.y;
|
|
||||||
window->w = bounds.w;
|
|
||||||
window->h = bounds.h;
|
|
||||||
|
|
||||||
if (_this->SetWindowPosition) {
|
|
||||||
_this->SetWindowPosition(_this, window);
|
|
||||||
}
|
|
||||||
if (_this->SetWindowSize) {
|
|
||||||
_this->SetWindowSize(_this, window);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue