[Scummvm-cvs-logs] SF.net SVN: scummvm:[53767] scummvm/trunk

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Oct 24 20:34:08 CEST 2010


Revision: 53767
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53767&view=rev
Author:   m_kiewitz
Date:     2010-10-24 18:34:08 +0000 (Sun, 24 Oct 2010)

Log Message:
-----------
SDL/w32: add ability to hide console

feature is currently commented out - waiting till discussion has ended

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/sdl.cpp
    scummvm/trunk/base/commandLine.cpp

Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp	2010-10-24 17:42:45 UTC (rev 53766)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp	2010-10-24 18:34:08 UTC (rev 53767)
@@ -116,6 +116,26 @@
 }
 #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 @@
 	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());
 	}

Modified: scummvm/trunk/base/commandLine.cpp
===================================================================
--- scummvm/trunk/base/commandLine.cpp	2010-10-24 17:42:45 UTC (rev 53766)
+++ scummvm/trunk/base/commandLine.cpp	2010-10-24 18:34:08 UTC (rev 53767)
@@ -219,6 +219,11 @@
 	ConfMan.registerDefault("record_file_name", "record.bin");
 	ConfMan.registerDefault("record_temp_file_name", "record.tmp");
 	ConfMan.registerDefault("record_time_file_name", "record.time");
+
+#ifdef WIN32
+	// console hiding for win32
+	ConfMan.registerDefault("show_console", false);
+#endif
 }
 
 //
@@ -546,6 +551,12 @@
 			END_OPTION
 #endif
 
+#ifdef WIN32
+			// console hiding for win32
+			DO_LONG_OPTION_BOOL("show-console")
+			END_OPTION
+#endif
+
 unknownOption:
 			// If we get till here, the option is unhandled and hence unknown.
 			usage("Unrecognized option '%s'", argv[i]);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list