diff options
author | Geenz <geenz@geenzo.com> | 2013-02-22 16:41:49 -0500 |
---|---|---|
committer | Geenz <geenz@geenzo.com> | 2013-02-22 16:41:49 -0500 |
commit | 4a935b68151f9d6951a1d1312a3437a8e8150f41 (patch) | |
tree | d9d4967eb7e72eb896952b1f5aba7568b28ea685 | |
parent | e17d69d1d16c607aa304936ebf2ab151684f9c76 (diff) |
Fix inconsistent handling of Control, Alt, and Shift keys through a new modifier update callback.
-rw-r--r-- | indra/llwindow/llkeyboard.h | 5 | ||||
-rw-r--r-- | indra/llwindow/llkeyboardheadless.cpp | 7 | ||||
-rw-r--r-- | indra/llwindow/llkeyboardheadless.h | 3 | ||||
-rw-r--r-- | indra/llwindow/llkeyboardmacosx.cpp | 5 | ||||
-rw-r--r-- | indra/llwindow/llkeyboardmacosx.h | 1 | ||||
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 3 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.h | 1 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 5 |
8 files changed, 28 insertions, 2 deletions
diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index c155c1b362..92449c123f 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -82,6 +82,11 @@ public: virtual BOOL handleKeyUp(const U16 key, MASK mask) = 0; virtual BOOL handleKeyDown(const U16 key, MASK mask) = 0; + +#ifdef LL_DARWIN + // We only actually use this for OS X. + virtual void handleModifier(MASK mask) = 0; +#endif // LL_DARWIN // Asynchronously poll the control, alt, and shift keys and set the // appropriate internal key masks. diff --git a/indra/llwindow/llkeyboardheadless.cpp b/indra/llwindow/llkeyboardheadless.cpp index c87617c9ff..a1b6b294e0 100644 --- a/indra/llwindow/llkeyboardheadless.cpp +++ b/indra/llwindow/llkeyboardheadless.cpp @@ -45,6 +45,13 @@ BOOL LLKeyboardHeadless::handleKeyUp(const U16 key, const U32 mask) MASK LLKeyboardHeadless::currentMask(BOOL for_mouse_event) { return MASK_NONE; } +#ifdef LL_DARWIN +void LLKeyboardHeadless::handleModifier(MASK mask) +{ + +} +#endif + void LLKeyboardHeadless::scanKeyboard() { for (S32 key = 0; key < KEY_COUNT; key++) diff --git a/indra/llwindow/llkeyboardheadless.h b/indra/llwindow/llkeyboardheadless.h index 4e666f8ce8..8ed28ace90 100644 --- a/indra/llwindow/llkeyboardheadless.h +++ b/indra/llwindow/llkeyboardheadless.h @@ -40,6 +40,9 @@ public: /*virtual*/ void resetMaskKeys(); /*virtual*/ MASK currentMask(BOOL for_mouse_event); /*virtual*/ void scanKeyboard(); +#ifdef LL_DARWIN + /*virtual*/ void handleModifier(MASK mask); +#endif }; #endif diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp index 59cc2acaec..d4c8214461 100644 --- a/indra/llwindow/llkeyboardmacosx.cpp +++ b/indra/llwindow/llkeyboardmacosx.cpp @@ -198,6 +198,11 @@ 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 diff --git a/indra/llwindow/llkeyboardmacosx.h b/indra/llwindow/llkeyboardmacosx.h index 6e1f4d3b96..f9d014ab70 100644 --- a/indra/llwindow/llkeyboardmacosx.h +++ b/indra/llwindow/llkeyboardmacosx.h @@ -49,6 +49,7 @@ public: /*virtual*/ void resetMaskKeys(); /*virtual*/ MASK currentMask(BOOL for_mouse_event); /*virtual*/ void scanKeyboard(); + /*virtual*/ void handleModifier(MASK mask); protected: MASK updateModifiers(const U32 mask); diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index b79b7b3fa5..3a6225eab5 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -345,6 +345,7 @@ - (void)flagsChanged:(NSEvent *)theEvent { mModifiers = [theEvent modifierFlags]; + callModifier([theEvent modifierFlags]); } - (void) mouseDown:(NSEvent *)theEvent @@ -433,8 +434,6 @@ callMouseExit(); } - - - (NSPoint)convertToScreenFromLocalPoint:(NSPoint)point relativeToView:(NSView *)view { NSScreen *currentScreen = [NSScreen currentScreenForMouseLocation]; diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index ebc1633f9d..32d1a4d9a2 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -95,6 +95,7 @@ void callMiddleMouseDown(float *pos, unsigned int mask); void callMiddleMouseUp(float *pos, unsigned int mask); void callFocus(); void callFocusLost(); +void callModifier(unsigned int mask); #include <string> void callHandleDragEntered(std::string url); diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 2e86759ec0..9ce19bd977 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -337,6 +337,11 @@ void callMiddleMouseUp(float *pos, MASK mask) gWindowImplementation->getCallbacks()->handleMiddleMouseUp(gWindowImplementation, outCoords, mask); } +void callModifier(MASK mask) +{ + gKeyboard->handleModifier(mask); +} + void callHandleDragEntered(std::string url) { gWindowImplementation->handleDragNDrop(url, LLWindowCallbacks::DNDA_START_TRACKING); |