summaryrefslogtreecommitdiff
path: root/indra/llwindow/llkeyboardmacosx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow/llkeyboardmacosx.cpp')
-rwxr-xr-xindra/llwindow/llkeyboardmacosx.cpp37
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;
}