diff options
author | Martin Kiewitz | 2010-10-24 18:34:08 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-10-24 18:34:08 +0000 |
commit | c9c9eafbbb791d1b754c053aac221979a39216e1 (patch) | |
tree | 880ff3133d8ed636b360c1f830fdfc698f403fec /backends/platform/sdl | |
parent | fa7e8a8eb382c37d35d9166dcd87646811e4a377 (diff) | |
download | scummvm-rg350-c9c9eafbbb791d1b754c053aac221979a39216e1.tar.gz scummvm-rg350-c9c9eafbbb791d1b754c053aac221979a39216e1.tar.bz2 scummvm-rg350-c9c9eafbbb791d1b754c053aac221979a39216e1.zip |
SDL/w32: add ability to hide console
feature is currently commented out - waiting till discussion has ended
svn-id: r53767
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 22fc561b0f..21c2c50d79 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -116,6 +116,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 +155,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()); } |