From b53770366bdc5a79c81a35b5c04bb7b1804f233f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 20 Oct 2013 23:00:28 +0200 Subject: SDL: Always initialize video subsystem in initSDL. --- backends/platform/gph/gph-backend.cpp | 8 +++++++- backends/platform/openpandora/op-backend.cpp | 8 +++++++- backends/platform/sdl/sdl.cpp | 16 +++++++++------- backends/platform/wince/wince-sdl.cpp | 5 ++++- 4 files changed, 27 insertions(+), 10 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp index 485780b472..7239fdb2b4 100644 --- a/backends/platform/gph/gph-backend.cpp +++ b/backends/platform/gph/gph-backend.cpp @@ -172,7 +172,7 @@ void OSystem_GPH::initSDL() { // Check if SDL has not been initialized if (!_initedSDL) { - uint32 sdlFlags = SDL_INIT_EVENTTHREAD; + uint32 sdlFlags = SDL_INIT_EVENTTHREAD | SDL_INIT_VIDEO; if (ConfMan.hasKey("disable_sdl_parachute")) sdlFlags |= SDL_INIT_NOPARACHUTE; @@ -180,6 +180,12 @@ void OSystem_GPH::initSDL() { if (SDL_Init(sdlFlags) == -1) error("Could not initialize SDL: %s", SDL_GetError()); + // Enable unicode support if possible + SDL_EnableUNICODE(1); + + // Disable OS cursor + SDL_ShowCursor(SDL_DISABLE); + _initedSDL = true; } } diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp index 354aa24b24..4350d697e2 100644 --- a/backends/platform/openpandora/op-backend.cpp +++ b/backends/platform/openpandora/op-backend.cpp @@ -160,7 +160,7 @@ void OSystem_OP::initSDL() { // Check if SDL has not been initialized if (!_initedSDL) { - uint32 sdlFlags = SDL_INIT_EVENTTHREAD; + uint32 sdlFlags = SDL_INIT_EVENTTHREAD | SDL_INIT_VIDEO; if (ConfMan.hasKey("disable_sdl_parachute")) sdlFlags |= SDL_INIT_NOPARACHUTE; @@ -168,6 +168,12 @@ void OSystem_OP::initSDL() { if (SDL_Init(sdlFlags) == -1) error("Could not initialize SDL: %s", SDL_GetError()); + // Enable unicode support if possible + SDL_EnableUNICODE(1); + + // Disable OS cursor + SDL_ShowCursor(SDL_DISABLE); + _initedSDL = true; } } diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 84187f9638..e8a7f7b9af 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -262,16 +262,15 @@ void OSystem_SDL::engineDone() { void OSystem_SDL::initSDL() { // Check if SDL has not been initialized if (!_initedSDL) { - uint32 sdlFlags = 0; + // We always initialize the video subsystem because we will need it to + // be initialized before the graphics managers to retrieve the desktop + // resolution, for example. WebOS also requires this initialization + // or otherwise the application won't start. + uint32 sdlFlags = SDL_INIT_VIDEO; + if (ConfMan.hasKey("disable_sdl_parachute")) sdlFlags |= SDL_INIT_NOPARACHUTE; -#if defined(WEBOS) || defined(USE_OPENGL) - // WebOS needs this flag or otherwise the application won't start. - // OpenGL SDL needs this to query the desktop resolution on startup. - sdlFlags |= SDL_INIT_VIDEO; -#endif - // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers) if (SDL_Init(sdlFlags) == -1) error("Could not initialize SDL: %s", SDL_GetError()); @@ -279,6 +278,9 @@ void OSystem_SDL::initSDL() { // Enable unicode support if possible SDL_EnableUNICODE(1); + // Disable OS cursor + SDL_ShowCursor(SDL_DISABLE); + _initedSDL = true; } } diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 3897731db4..ea2bc42301 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -563,7 +563,7 @@ void OSystem_WINCE3::setGraphicsModeIntern() { void OSystem_WINCE3::initSDL() { // Check if SDL has not been initialized if (!_initedSDL) { - uint32 sdlFlags = SDL_INIT_EVENTTHREAD; + uint32 sdlFlags = SDL_INIT_EVENTTHREAD | SDL_INIT_VIDEO; if (ConfMan.hasKey("disable_sdl_parachute")) sdlFlags |= SDL_INIT_NOPARACHUTE; @@ -579,6 +579,9 @@ void OSystem_WINCE3::initSDL() { // Enable unicode support if possible SDL_EnableUNICODE(1); + // Disable OS cursor + SDL_ShowCursor(SDL_DISABLE); + _initedSDL = true; } } -- cgit v1.2.3