mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Reinitialize event system (via SDL_INIT_VIDEO) in Graphics::setMode().
This commit is contained in:
@@ -165,20 +165,24 @@ namespace opengl
|
||||
|
||||
// Get caption.
|
||||
|
||||
// Special case for fullscreen -> windowed. Windows XP did not
|
||||
// work well with "normal" display mode change in this case.
|
||||
// The application window does leave fullscreen, but the desktop
|
||||
// resolution does not revert to the correct one. Restarting the
|
||||
// SDL video subsystem does the trick, though.
|
||||
if( currentMode.fullscreen && !fullscreen )
|
||||
// We need to restart the subsystem for two reasons:
|
||||
// 1) Special case for fullscreen -> windowed. Windows XP did not
|
||||
// work well with "normal" display mode change in this case.
|
||||
// The application window does leave fullscreen, but the desktop
|
||||
// resolution does not revert to the correct one. Restarting the
|
||||
// SDL video subsystem does the trick, though.
|
||||
// 2) Restart the event system (for whatever reason the event system
|
||||
// started and stopped with SDL_INIT_VIDEO, see:
|
||||
// http://sdl.beuc.net/sdl.wiki/Introduction_to_Events)
|
||||
// because the mouse position will not be able to exceed
|
||||
// the previous' video mode window size (i.e. alway
|
||||
// love.mouse.getX() < 800 when switching from 800x600 to a
|
||||
// higher resolution)
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
if(SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
||||
{
|
||||
// Restart.
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
if(SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
||||
{
|
||||
std::cout << "Could not init SDL_VIDEO: " << SDL_GetError() << std::endl;
|
||||
return false;
|
||||
}
|
||||
std::cout << "Could not init SDL_VIDEO: " << SDL_GetError() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set caption.
|
||||
|
||||
Reference in New Issue
Block a user