-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Milestone
Description
On X11/xfce4 (both git HEAD a few days ago and SDL 2.0.16) whenever SDL_SetWindowSize
is called immediately after exiting fullscreen it moves the window to 0,0 on the display. Test case:
#include <SDL2/SDL.h>
int main(int argc, char **argv) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, 0);
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, 0);
SDL_Event e;
while (1) {
while (SDL_PollEvent(&e) != 0) {
if (e.type == SDL_QUIT) {
return 0;
}
if (e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_F1) {
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
}
if (e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_F2) {
SDL_SetWindowFullscreen(window, 0);
SDL_SetWindowSize(window, 800, 600); //Comment to avoid the bug
}
}
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);
}
}
Press F1 to fullscreen then F2 to leave.
According to comments on #2518 it seems the same bug happens on Mac due to a Mac-specific change that was apparently backed out (676c3a9).
Also, the bug doesn't happen on Windows but a very similar bug does, where recentering the window while fullscreened causes it to move to 0,0 when leaving fullscreen. I'll file it separately.