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
path: root/intern
diff options
context:
space:
mode:
authorHarley Acheson <harley>2019-04-03 16:51:48 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-03 16:51:48 +0300
commit27a239864f78aa1618bb735fae63e0cea2a829cc (patch)
tree997d35acc2d293c236a93f0d1359e9e2e4afde92 /intern
parent4f26d2348c41d6c7b9d32d3b8372a6253750fc22 (diff)
UI: remove close button from Windows console window.
This way you can't accidentally close Blender when toggling the console window to be visible. When Blender is started from the command promt the close button remains. Differential Revision: https://developer.blender.org/D4627
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index a82d54470af..bf12f049283 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1704,7 +1704,7 @@ static bool isStartedFromCommandPrompt()
}
/* When we're starting from a wrapper we need to compare with parent process ID. */
- if (pid == (start_from_launcher ? ppid : GetCurrentProcessId()))
+ if (pid != (start_from_launcher ? ppid : GetCurrentProcessId()))
return true;
}
@@ -1713,30 +1713,37 @@ static bool isStartedFromCommandPrompt()
int GHOST_SystemWin32::toggleConsole(int action)
{
+ HWND wnd = GetConsoleWindow();
+
switch (action) {
case 3: // startup: hide if not started from command prompt
{
- if (isStartedFromCommandPrompt()) {
- ShowWindow(GetConsoleWindow(), SW_HIDE);
+ if (!isStartedFromCommandPrompt()) {
+ ShowWindow(wnd, SW_HIDE);
m_consoleStatus = 0;
}
break;
}
case 0: // hide
- ShowWindow(GetConsoleWindow(), SW_HIDE);
+ ShowWindow(wnd, SW_HIDE);
m_consoleStatus = 0;
break;
case 1: // show
- ShowWindow(GetConsoleWindow(), SW_SHOW);
+ ShowWindow(wnd, SW_SHOW);
+ if (!isStartedFromCommandPrompt()) {
+ DeleteMenu(GetSystemMenu(wnd, FALSE), SC_CLOSE, MF_BYCOMMAND);
+ }
m_consoleStatus = 1;
break;
case 2: // toggle
- ShowWindow(GetConsoleWindow(), m_consoleStatus ? SW_HIDE : SW_SHOW);
+ ShowWindow(wnd, m_consoleStatus ? SW_HIDE : SW_SHOW);
m_consoleStatus = !m_consoleStatus;
+ if (m_consoleStatus && !isStartedFromCommandPrompt()) {
+ DeleteMenu(GetSystemMenu(wnd, FALSE), SC_CLOSE, MF_BYCOMMAND);
+ }
break;
}
-
return m_consoleStatus;
}