Changing To Full Screen Sets The Window To An Unexpected Position

Update Edit: Apparently this is not related to SDL, as I tried doing the same thing with SFML and had the same problem. So, I don’t know, maybe my monitor or graphics card is the problem.

I’m using Windows 7 with Visual Studio 2015, linked against SDL 2.0.8

When I’m changing to full screen mode with a resolution of 1280x720, I’m experience odd behavior. It seems that it’s putting the window at a position off center, rather than at the top left of the screen. I am only able to move the mouse cursor within this region. What’s extra weird is that it works for many other resolutions. I thought it might be related to changing aspect ratios (my desktop is 1900x1200), but that’s not the case. 800x600 works fine, but 1280×960 does not, both of which are 4:3. 1280×800 also does not work, while 1440×900 does (both 16:10). 1024×576 works, and 1280×720, 1366×768, 1600×900 all do not. I even tried arbitrary window sizes like 400x400, which works, and 900x900 which doesn’t.

This graphic illustrates what I am seeing (though not necessarily to scale):

I’ve trimmed the source code down to as as basic as I could get, and it still occurs:

int main(int argc, char *args[]) {
	SDL_Event event;
	SDL_Window*	window;
	SDL_Surface* screenSurface;

	window = SDL_CreateWindow("Test",
				  SDL_WINDOWPOS_CENTERED,
				  SDL_WINDOWPOS_CENTERED,
				  1280, 720,
				  SDL_WINDOW_SHOWN);

	bool quit = false;
	bool isFullscreen = false;

	while (quit == false) {
		while (SDL_PollEvent(&event)) {
			switch (event.type) 	{

			case SDL_KEYDOWN:

				if (isFullscreen == false) {
					SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
				}
				else {
					SDL_SetWindowFullscreen(window, 0);
				}

				isFullscreen = !isFullscreen;

				break;

			case SDL_QUIT:
				quit = true;
				break;
			}
		}

		screenSurface = SDL_GetWindowSurface(window);
		SDL_UpdateWindowSurface(window);
	}

	SDL_DestroyWindow(window);
	SDL_Quit();

	return 0;
}

I’ve even tried downloading the SDL source code and loading it in my project with the debug symbols, but I’m still getting the same issue. Does anyone know what might be causing this behavior? It’s driving me nuts!

Can you change to the 1280x720 resolution in the Windows display settings?

Good question, I didn’t even think to try that! No, apparently I cannot. It gets the same results. I think my graphics card is to blame. Drivers are up to date, but it’s a pretty old card.