X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc93670d3b2b69ea2cdd799444b57dce24b8be94..122c9be08511589c49fe1c6f6e5291d41994d3fc:/src/mac/app.cpp diff --git a/src/mac/app.cpp b/src/mac/app.cpp index 0c8413941f..465ef52384 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -1757,6 +1757,44 @@ long wxMacTranslateKey(unsigned char key, unsigned char code) return retval; } +int wxKeyCodeToMacModifier(wxKeyCode key) +{ + switch (key) + { + case WXK_START: + case WXK_MENU: + return cmdKey; + + case WXK_SHIFT: + return shiftKey; + + case WXK_CAPITAL: + return alphaLock; + + case WXK_ALT: + return optionKey; + + case WXK_CONTROL: + return controlKey; + + default: + return 0; + } +} + +bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below +{ +// TODO: Have it use HID Manager on OSX... +//if OS X > 10.2 (i.e. 10.2.x) +//a known apple bug prevents the system from determining led +//states with GetKeys... can only determine caps lock led + return !!(GetCurrentKeyModifiers() & wxKeyCodeToMacModifier(key)); +//else +// KeyMapByteArray keymap; +// GetKeys((BigEndianLong*)keymap); +// return !!(BitTst(keymap, (sizeof(KeyMapByteArray)*8) - iKey)); +} + #if !TARGET_CARBON void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr ) {