Commit: 27a239864f78aa1618bb735fae63e0cea2a829cc Author: Harley Acheson Date: Wed Apr 3 15:51:48 2019 +0200 Branches: master https://developer.blender.org/rB27a239864f78aa1618bb735fae63e0cea2a829cc
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 =================================================================== M intern/ghost/intern/GHOST_SystemWin32.cpp =================================================================== 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; } _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
