Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/ghost/intern/GHOST_SystemWin32.cpp')
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 2a3eb74d1e2..1b43fa92bb2 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -52,6 +52,7 @@
#define _WIN32_IE 0x0501 /* shipped before XP, so doesn't impose additional requirements */
#endif
#include <shlobj.h>
+#include <tlhelp32.h>
// win64 doesn't define GWL_USERDATA
#ifdef WIN32
@@ -1056,11 +1057,16 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
* procedure of the top-level window being activated. If the windows use different input queues,
* the message is sent asynchronously, so the window is activated immediately.
*/
+ {
+ GHOST_ModifierKeys modifiers;
+ modifiers.clear();
+ system->storeModifierKeys(modifiers);
event = processWindowEvent(LOWORD(wParam) ? GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate, window);
/* WARNING: Let DefWindowProc handle WM_ACTIVATE, otherwise WM_MOUSEWHEEL
will not be dispatched to OUR active window if we minimize one of OUR windows. */
lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
break;
+ }
case WM_PAINT:
/* An application sends the WM_PAINT message when the system or another application
* makes a request to paint a portion of an application's window. The message is sent
@@ -1284,8 +1290,32 @@ int GHOST_SystemWin32::toggleConsole(int action)
{
case 3: //hide if no console
{
- CONSOLE_SCREEN_BUFFER_INFO csbi = {{0}};
- if(!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) || csbi.dwCursorPosition.X || csbi.dwCursorPosition.Y>1)
+ DWORD sp = GetCurrentProcessId();
+ HANDLE ptree = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ PROCESSENTRY32 e = {0}; e.dwSize = sizeof(PROCESSENTRY32);
+
+ if( Process32First(ptree, &e)) {
+ do { //Searches for Blender's PROCESSENTRY32
+ if (e.th32ProcessID == sp) {
+ sp = e.th32ParentProcessID;
+ Process32First(ptree, &e);
+ do { //Got parent id, searches for its PROCESSENTRY32
+ if (e.th32ProcessID == sp) {
+ if(strcmp("explorer.exe",e.szExeFile)==0)
+ { //If explorer, hide cmd
+ ShowWindow(GetConsoleWindow(),SW_HIDE);
+ m_consoleStatus = 0;
+ }
+ break;
+ }
+
+ } while( Process32Next(ptree, &e));
+ break;
+ }
+ } while( Process32Next(ptree, &e));
+ }
+
+ CloseHandle(ptree);
break;
}
case 0: //hide