diff options
author | Shrey Aggarwal <shrey_agg> | 2022-02-09 03:40:48 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2022-02-09 03:40:48 +0300 |
commit | f021d467526af3f3fc839c0ca48acc61dd781d56 (patch) | |
tree | 81828b22b50b8764a82fb05a9b9837b81cacc649 /intern/ghost/intern/GHOST_SystemWin32.cpp | |
parent | 452a7f673190e5161c96ec8a53631a1c89d127b9 (diff) |
Cleanup: GHOST_ISystem::toggleConsole API
GHOST_ISystem::toggleConsole had a somewhat misleading name
it could be fed 4 different values, so it was not as much a
toggle as a set console window state.
This change renames `toggleConsole` to a more appropriately
named `setConsoleWindowState` and replaces the integer it had
to an enum so it's easy to tell what is being asked of it at
the call site.
Reviewed By: LazyDodo
Differential Revision: https://developer.blender.org/D14020
Diffstat (limited to 'intern/ghost/intern/GHOST_SystemWin32.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 923453d6c6f..2f5395fc8d0 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -170,7 +170,7 @@ GHOST_SystemWin32::~GHOST_SystemWin32() OleUninitialize(); if (isStartedFromCommandPrompt()) { - toggleConsole(1); + setConsoleWindowState(GHOST_kConsoleWindowStateShow); } } @@ -2221,31 +2221,30 @@ static bool isStartedFromCommandPrompt() return false; } -int GHOST_SystemWin32::toggleConsole(int action) +int GHOST_SystemWin32::setConsoleWindowState(GHOST_TConsoleWindowState action) { HWND wnd = GetConsoleWindow(); switch (action) { - case 3: // startup: hide if not started from command prompt - { + case GHOST_kConsoleWindowStateHideForNonConsoleLaunch: { if (!isStartedFromCommandPrompt()) { ShowWindow(wnd, SW_HIDE); m_consoleStatus = 0; } break; } - case 0: // hide + case GHOST_kConsoleWindowStateHide: ShowWindow(wnd, SW_HIDE); m_consoleStatus = 0; break; - case 1: // show + case GHOST_kConsoleWindowStateShow: ShowWindow(wnd, SW_SHOW); if (!isStartedFromCommandPrompt()) { DeleteMenu(GetSystemMenu(wnd, FALSE), SC_CLOSE, MF_BYCOMMAND); } m_consoleStatus = 1; break; - case 2: // toggle + case GHOST_kConsoleWindowStateToggle: ShowWindow(wnd, m_consoleStatus ? SW_HIDE : SW_SHOW); m_consoleStatus = !m_consoleStatus; if (m_consoleStatus && !isStartedFromCommandPrompt()) { |