summaryrefslogtreecommitdiff
path: root/indra/llwindow/llopenglview-objc.mm
diff options
context:
space:
mode:
authorrider <rider@lindenlab.com>2015-11-07 12:09:08 -0800
committerrider <rider@lindenlab.com>2015-11-07 12:09:08 -0800
commit5449ae73b337c026afa93e99a47b670c28c8eb80 (patch)
treebae887138049d30a89435d09772783e57386bf25 /indra/llwindow/llopenglview-objc.mm
parentbd817f6f422991c2653493436c7845e75ea9d855 (diff)
MAINT-5754: Finish key modifier experiment. Still not working.
Diffstat (limited to 'indra/llwindow/llopenglview-objc.mm')
-rw-r--r--indra/llwindow/llopenglview-objc.mm24
1 files changed, 23 insertions, 1 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index 7bb20240d2..81e90accb7 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -28,6 +28,18 @@
#include "llwindowmacosx-objc.h"
#import "llappdelegate-objc.h"
+
+
+//---------------------------
+// Coppied from indra_constants.h
+//#include "indra_constats.h"
+const uint32_t MASK_CONTROL = 0x0001; // Mapped to cmd on Macs
+const uint32_t MASK_ALT = 0x0002;
+const uint32_t MASK_SHIFT = 0x0004;
+//const uint32_t MASK_MAC_CONTROL = 0x0008; // Un-mapped Ctrl key on Macs, not used on Windows
+
+//---------------------------
+
@implementation NSScreen (PointConversion)
+ (NSScreen *)currentScreenForMouseLocation
@@ -70,7 +82,17 @@ void extractKeyDataFromEvent (NSEvent *theEvent, NativeKeyEventData * eventData)
}
eventData->mKeyEvent = NativeKeyEventData::KEYUNKNOWN;
eventData->mKeyCode = [theEvent keyCode];
- eventData->mKeyModifiers = [theEvent modifierFlags];
+
+ unsigned int modifiers = [theEvent modifierFlags];
+
+ if (modifiers & (NSAlphaShiftKeyMask | NSShiftKeyMask))
+ modifiers |= MASK_SHIFT;
+ if (modifiers & NSAlternateKeyMask)
+ modifiers |= MASK_ALT;
+ if (modifiers & NSControlKeyMask)
+ modifiers |= MASK_CONTROL;
+
+ eventData->mKeyModifiers = modifiers;
eventData->mScanCode = [theEvent keyCode ];
eventData->mKeyboardType = 0;
}