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:
authorNathan Letwory <nathan@letworyinteractive.com>2011-05-02 12:07:24 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2011-05-02 12:07:24 +0400
commitd197ec74e31c0a90b440246e5c48dd0644055740 (patch)
tree0623a838e26a1cb1c84b807b1abdb1b6051ebc94 /intern
parent17451136390980fc26e971cd7fb8308a509bb22d (diff)
Fix [#26981] Command window is not opening in 2.57.0
Reported by Thomas Engel Fix [#26938] Blender Zoom not working after startup (Windows) Reported by Ilija Boshkov by applying patch [#26881] Fix for console disappearing in debug mode [Windows] Submitted by Alexander Kuznetsov (AlexK) The patch moves console toggling code into GHOST and improves on the toggling behaviour. The patch changes handling of WM_SYSCOMMAND so that alt-key toggling isn't a problem anymore.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_C-api.h12
-rw-r--r--intern/ghost/GHOST_ISystem.h10
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp6
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp47
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h15
5 files changed, 87 insertions, 3 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index be8dc138797..75837239c4a 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -845,6 +845,18 @@ extern GHOST_TUns8* GHOST_getClipboard(int selection);
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
+
+/**
+ * Toggles console
+ * @action 0 - Hides
+ * 1 - Shows
+ * 2 - Toggles
+ * 3 - Hides if it runs not from command line
+ * * - Does nothing
+ * @return current status (1 -visible, 0 - hidden)
+ */
+extern int GHOST_toggleConsole(int action);
+
#ifdef __cplusplus
}
#endif
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 38c732153d7..69e10070be5 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -355,6 +355,16 @@ public:
*/
virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0;
+ /**
+ * Toggles console
+ * @action 0 - Hides
+ * 1 - Shows
+ * 2 - Toggles
+ * 3 - Hides if it runs not from command line
+ * * - Does nothing
+ * @return current status (1 -visible, 0 - hidden)
+ */
+ virtual int toggleConsole(int action) = 0;
/***************************************************************************************
** Access to clipboard.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index a1e1bafa82f..7ba8d7db411 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -877,3 +877,9 @@ void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
GHOST_ISystem* system = GHOST_ISystem::getSystem();
system->putClipboard(buffer, selection);
}
+
+int GHOST_toggleConsole(int action)
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ return system->toggleConsole(action);
+}
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index dc16711b532..c901c402716 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -174,6 +174,8 @@ GHOST_SystemWin32::GHOST_SystemWin32()
GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n");
m_displayManager->initialize();
+ m_consoleStatus = 1;
+
// Check if current keyboard layout uses AltGr and save keylayout ID for
// specialized handling if keys like VK_OEM_*. I.e. french keylayout
// generates VK_OEM_8 for their exclamation key (key left of right shift)
@@ -186,6 +188,7 @@ GHOST_SystemWin32::~GHOST_SystemWin32()
{
// Shutdown COM
OleUninitialize();
+ toggleConsole(1);
}
@@ -847,7 +850,14 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
* a dead key that is pressed while holding down the alt key.
* To prevent the sound, DefWindowProc must be avoided by return
*/
- return 0;
+ break;
+ case WM_SYSCOMMAND:
+ /* The WM_SYSCHAR message is sent to the window when system commands such as
+ * maximize, minimize or close the window are triggered. Also it is sent when ALT
+ * button is press for menu. To prevent this we must return preventing DefWindowProc.
+ */
+ if(wParam==SC_KEYMENU) return 0;
+ break;
////////////////////////////////////////////////////////////////////////
// Tablet events, processed
////////////////////////////////////////////////////////////////////////
@@ -1047,8 +1057,12 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
* DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY
* message. WM_DESTROY is used to free the allocated memory object associated with the window.
*/
+ break;
case WM_KILLFOCUS:
- /* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus. */
+ /* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.
+ * We want to prevent this if a window is still active and it loses focus to nowhere*/
+ if(!wParam && hwnd==GetActiveWindow())
+ SetFocus(hwnd);
case WM_SHOWWINDOW:
/* The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. */
case WM_WINDOWPOSCHANGING:
@@ -1196,3 +1210,32 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
return;
}
}
+
+int GHOST_SystemWin32::toggleConsole(int action)
+{
+ switch(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)
+ break;
+ }
+ case 0: //hide
+ ShowWindow(GetConsoleWindow(),SW_HIDE);
+ m_consoleStatus = 0;
+ break;
+ case 1: //show
+ ShowWindow(GetConsoleWindow(),SW_SHOW);
+ m_consoleStatus = 1;
+ break;
+ case 2: //toggle
+ ShowWindow(GetConsoleWindow(),m_consoleStatus?SW_HIDE:SW_SHOW);
+ m_consoleStatus=!m_consoleStatus;
+ break;
+
+ };
+
+
+ return m_consoleStatus;
+}
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index d79b9a22b69..2dad3a6f44d 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -415,6 +415,17 @@ protected:
* Initiates WM_INPUT messages from keyboard
*/
GHOST_TInt32 initKeyboardRawInput(void);
+
+ /**
+ * Toggles console
+ * @action 0 - Hides
+ * 1 - Shows
+ * 2 - Toggles
+ * 3 - Hides if it runs not from command line
+ * * - Does nothing
+ * @return current status (1 -visible, 0 - hidden)
+ */
+ int toggleConsole(int action);
/** The current state of the modifier keys. */
GHOST_ModifierKeys m_modifierKeys;
@@ -431,6 +442,9 @@ protected:
/** stores keyboard layout. */
HKL m_keylayout;
+ /** Console status */
+ int m_consoleStatus;
+
/** handle for user32.dll*/
HMODULE user32;
#ifdef NEED_RAW_PROC
@@ -471,6 +485,5 @@ inline void GHOST_SystemWin32::handleKeyboardChange(void)
}
}
}
-
#endif // _GHOST_SYSTEM_WIN32_H_