diff options
Diffstat (limited to 'backends/platform/sdl/sdl.cpp')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 22fc561b0f..8725a7df8a 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -23,6 +23,9 @@ * */ +// Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + #if defined(WIN32) #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -79,7 +82,7 @@ #endif #if defined(MACOSX) || defined(IPHONE) -#include "CoreFoundation/CoreFoundation.h" +#include <CoreFoundation/CoreFoundation.h> #endif @@ -116,6 +119,26 @@ static AspectRatio getDesiredAspectRatio() { } #endif +#if defined(WIN32) + struct SdlConsoleHidingWin32 { + DWORD myPid; + DWORD myTid; + HWND consoleHandle; + }; + + // console hiding for win32 + static BOOL CALLBACK initBackendFindConsoleWin32Proc(HWND hWnd, LPARAM lParam) { + DWORD pid, tid; + SdlConsoleHidingWin32 *variables = (SdlConsoleHidingWin32 *)lParam; + tid = GetWindowThreadProcessId(hWnd, &pid); + if ((tid == variables->myTid) && (pid == variables->myPid)) { + variables->consoleHandle = hWnd; + return FALSE; + } + return TRUE; + } +#endif + void OSystem_SDL::initBackend() { assert(!_inited); @@ -135,6 +158,25 @@ void OSystem_SDL::initBackend() { if (joystick_num > -1) sdlFlags |= SDL_INIT_JOYSTICK; +#if 0 + // NEW CODE TO HIDE CONSOLE FOR WIN32 +#if defined(WIN32) + // console hiding for win32 + SdlConsoleHidingWin32 consoleHidingWin32; + consoleHidingWin32.consoleHandle = 0; + consoleHidingWin32.myPid = GetCurrentProcessId(); + consoleHidingWin32.myTid = GetCurrentThreadId(); + EnumWindows (initBackendFindConsoleWin32Proc, (LPARAM)&consoleHidingWin32); + + if (!ConfMan.getBool("show_console")) { + if (consoleHidingWin32.consoleHandle) { + // We won't find a window with our TID/PID in case we were started from command-line + ShowWindow(consoleHidingWin32.consoleHandle, SW_HIDE); + } + } +#endif +#endif + if (SDL_Init(sdlFlags) == -1) { error("Could not initialize SDL: %s", SDL_GetError()); } |