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>2010-09-16 03:19:21 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2010-09-16 03:19:21 +0400
commitd6baea457e51c1443d68eb4ca5393e7de9981c02 (patch)
treed3463939cfb87bf0cd76f2d34426076c1199be7a /intern
parentd08a40450e35c8083a205a1921fa4f8dd1836ae8 (diff)
Partial fix [#21395] Command key for keyboard mapping not functional
Reported by Andy Braham. Handle VK_LWIN and VK_RWIN (The infamous Windows keys). Note, these are not separate, so handled as one command key.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_Types.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp35
2 files changed, 24 insertions, 15 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index f7d0425aec8..f926e72119f 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -283,8 +283,8 @@ typedef enum {
GHOST_kKeyRightControl,
GHOST_kKeyLeftAlt,
GHOST_kKeyRightAlt,
- GHOST_kKeyCommand, // APPLE only!
- GHOST_kKeyGrLess , // German PC only!
+ GHOST_kKeyCommand, // Command key on Apple, Windows key(s) on Windows
+ GHOST_kKeyGrLess , // German PC only!
GHOST_kKeyCapsLock,
GHOST_kKeyNumLock,
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 33c7a7f15a2..dceecb53dd2 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -287,17 +287,6 @@ GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) const
{
- /*
- GetKeyState and GetAsyncKeyState only work with Win95, Win98, NT4,
- Terminal Server and Windows 2000.
- But on WinME it always returns zero. These two functions are simply
- skipped by Millenium Edition!
-
- Official explanation from Microsoft:
- Intentionally disabled.
- It didn't work all that well on some newer hardware, and worked less
- well with the passage of time, so it was fully disabled in ME.
- */
if (m_separateLeftRight && m_separateLeftRightInitialized) {
bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0;
keys.set(GHOST_kModifierKeyLeftShift, down);
@@ -311,6 +300,12 @@ GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) cons
keys.set(GHOST_kModifierKeyLeftControl, down);
down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0;
keys.set(GHOST_kModifierKeyRightControl, down);
+ bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0;
+ bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0;
+ if(lwindown || rwindown)
+ keys.set(GHOST_kModifierKeyCommand, true);
+ else
+ keys.set(GHOST_kModifierKeyCommand, false);
}
else {
bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0;
@@ -322,6 +317,12 @@ GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) cons
down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0;
keys.set(GHOST_kModifierKeyLeftControl, down);
keys.set(GHOST_kModifierKeyRightControl, down);
+ bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0;
+ bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0;
+ if(lwindown || rwindown)
+ keys.set(GHOST_kModifierKeyCommand, true);
+ else
+ keys.set(GHOST_kModifierKeyCommand, false);
}
return GHOST_kSuccess;
}
@@ -376,8 +377,8 @@ GHOST_TSuccess GHOST_SystemWin32::init()
wc.cbClsExtra= 0;
wc.cbWndExtra= 0;
wc.hInstance= ::GetModuleHandle(0);
- wc.hIcon = ::LoadIcon(wc.hInstance, "APPICON");
-
+ wc.hIcon = ::LoadIcon(wc.hInstance, "APPICON");
+
if (!wc.hIcon) {
::LoadIcon(NULL, IDI_APPLICATION);
}
@@ -670,6 +671,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
+ case VK_LWIN:
+ case VK_RWIN:
if (!system->m_separateLeftRightInitialized) {
// Check whether this system supports separate left and right keys
switch (wParam) {
@@ -691,6 +694,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
(HIBYTE(::GetKeyState(VK_RMENU)) != 0) ?
true : false;
break;
+ case VK_LWIN:
+ case VK_RWIN:
+ system->m_separateLeftRight = true;
+ break;
}
system->m_separateLeftRightInitialized = true;
}
@@ -714,6 +721,8 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
case VK_SHIFT:
case VK_CONTROL:
case VK_MENU:
+ case VK_LWIN:
+ case VK_RWIN:
system->processModifierKeys(window);
// Bypass call to DefWindowProc
return 0;