diff options
author | Graham Linden <graham@lindenlab.com> | 2013-09-09 13:10:45 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2013-09-09 13:10:45 -0700 |
commit | e8bd9afbe6fab36bb7016cee8c3f3a745e9bd02d (patch) | |
tree | b1b5dfe66cd2013c33e8141844aff7d5c2479843 /indra/llwindow/llkeyboardmacosx.cpp | |
parent | 93df4ff2fea7378ab5b5ac069c2fec808ec5027b (diff) | |
parent | 55ae6a7962cdc9a9d7d087fbc529d30db9c37013 (diff) |
Merge viewer-release 3.6.5 Cocoa
Diffstat (limited to 'indra/llwindow/llkeyboardmacosx.cpp')
-rwxr-xr-x | indra/llwindow/llkeyboardmacosx.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp index 7f8f303517..85bb7b9aeb 100755 --- a/indra/llwindow/llkeyboardmacosx.cpp +++ b/indra/llwindow/llkeyboardmacosx.cpp @@ -30,7 +30,7 @@ #include "llkeyboardmacosx.h" #include "llwindowcallbacks.h" -#include <Carbon/Carbon.h> +#include "llwindowmacosx-objc.h" LLKeyboardMacOSX::LLKeyboardMacOSX() { @@ -162,23 +162,25 @@ LLKeyboardMacOSX::LLKeyboardMacOSX() void LLKeyboardMacOSX::resetMaskKeys() { - U32 mask = GetCurrentEventKeyModifiers(); + U32 mask = getModifiers(); // MBW -- XXX -- This mirrors the operation of the Windows version of resetMaskKeys(). // It looks a bit suspicious, as it won't correct for keys that have been released. // Is this the way it's supposed to work? + + // We apply the modifier masks directly within getModifiers. So check to see which masks we've applied. - if(mask & shiftKey) + if(mask & MAC_SHIFT_KEY) { mKeyLevel[KEY_SHIFT] = TRUE; } - if(mask & (controlKey)) + if(mask & MAC_CTRL_KEY) { mKeyLevel[KEY_CONTROL] = TRUE; } - if(mask & optionKey) + if(mask & MAC_ALT_KEY) { mKeyLevel[KEY_ALT] = TRUE; } @@ -196,22 +198,27 @@ static BOOL translateKeyMac(const U16 key, const U32 mask, KEY &outKey, U32 &out } */ +void LLKeyboardMacOSX::handleModifier(MASK mask) +{ + updateModifiers(mask); +} + MASK LLKeyboardMacOSX::updateModifiers(const U32 mask) { // translate the mask MASK out_mask = 0; - if(mask & shiftKey) + if(mask & MAC_SHIFT_KEY) { out_mask |= MASK_SHIFT; } - if(mask & (controlKey | cmdKey)) + if(mask & (MAC_CTRL_KEY | MAC_CMD_KEY)) { out_mask |= MASK_CONTROL; } - if(mask & optionKey) + if(mask & MAC_ALT_KEY) { out_mask |= MASK_ALT; } @@ -231,7 +238,7 @@ BOOL LLKeyboardMacOSX::handleKeyDown(const U16 key, const U32 mask) { handled = handleTranslatedKeyDown(translated_key, translated_mask); } - + return handled; } @@ -255,18 +262,18 @@ BOOL LLKeyboardMacOSX::handleKeyUp(const U16 key, const U32 mask) MASK LLKeyboardMacOSX::currentMask(BOOL for_mouse_event) { MASK result = MASK_NONE; - U32 mask = GetCurrentEventKeyModifiers(); + U32 mask = getModifiers(); - if (mask & shiftKey) result |= MASK_SHIFT; - if (mask & controlKey) result |= MASK_CONTROL; - if (mask & optionKey) result |= MASK_ALT; + if (mask & MAC_SHIFT_KEY) result |= MASK_SHIFT; + if (mask & MAC_CTRL_KEY) result |= MASK_CONTROL; + if (mask & MAC_ALT_KEY) result |= MASK_ALT; // For keyboard events, consider Command equivalent to Control if (!for_mouse_event) { - if (mask & cmdKey) result |= MASK_CONTROL; + if (mask & MAC_CMD_KEY) result |= MASK_CONTROL; } - + return result; } |