diff options
author | Geenz <geenz@geenzo.com> | 2013-03-11 10:16:22 -0400 |
---|---|---|
committer | Geenz <geenz@geenzo.com> | 2013-03-11 10:16:22 -0400 |
commit | 5caa7a465e73fc9cf70f5f2c5d147a509bd5e185 (patch) | |
tree | d0a5cbbd80b01478f78b62d5015e2677671b34de /indra/llwindow | |
parent | f3316f8aa2484a93a35b93a3dd4961b8bad7f751 (diff) |
Bug fixing and prep-work for IME support (along with refactored text input in general).
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llkeyboardmacosx.cpp | 4 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.h | 8 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.mm | 9 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 25 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.h | 1 |
5 files changed, 44 insertions, 3 deletions
diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp index d4c8214461..274e92c225 100644 --- a/indra/llwindow/llkeyboardmacosx.cpp +++ b/indra/llwindow/llkeyboardmacosx.cpp @@ -213,7 +213,7 @@ MASK LLKeyboardMacOSX::updateModifiers(const U32 mask) out_mask |= MASK_SHIFT; } - if(mask & MAC_CTRL_KEY || mask & MAC_CMD_KEY) + if(mask & (MAC_CTRL_KEY | MAC_CMD_KEY)) { out_mask |= MASK_CONTROL; } @@ -267,7 +267,7 @@ MASK LLKeyboardMacOSX::currentMask(BOOL for_mouse_event) if (mask & MAC_SHIFT_KEY) result |= MASK_SHIFT; if (mask & MAC_CTRL_KEY) result |= MASK_CONTROL; - if (mask & MAC_ALT_KEY) result |= MASK_ALT; + if (mask & MAC_ALT_KEY) result |= MASK_ALT; // For keyboard events, consider Command equivalent to Control if (!for_mouse_event) diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 6793666927..62c5b8298f 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -78,6 +78,7 @@ void removeGLView(GLViewRef view); // This is largely for easier interop between Obj-C and C++ (at least in the viewer's case due to the BOOL vs. BOOL conflict) void callKeyUp(unsigned short key, unsigned int mask); void callKeyDown(unsigned short key, unsigned int mask); +void callResetKeys(); void callUnicodeCallback(wchar_t character, unsigned int mask); void callRightMouseDown(float *pos, unsigned int mask); void callRightMouseUp(float *pos, unsigned int mask); @@ -104,6 +105,13 @@ void callHandleDragExited(std::string url); void callHandleDragUpdated(std::string url); void callHandleDragDropped(std::string url); +// LLPreeditor C bindings. +std::basic_string<wchar_t> getPreeditString(); +void getPreeditSelectionRange(int *position, int *length); +void getPreeditMarkedRange(int *position, int *length); +void handleUnicodeCharacter(wchar_t c); +void updatePreeditor(unsigned short *str); + NSWindowRef getMainAppWindow(); GLViewRef getGLView(); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index b288671219..e4e12f4b5c 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -332,7 +332,14 @@ NSWindowRef getMainAppWindow() return winRef; } -unsigned int getModifiers() +/* +GLViewRef getGLView() { + return [(LLAppDelegate*)[[NSApplication sharedApplication] delegate] glview]; +} +*/ + +unsigned int getModifiers() +{ return [NSEvent modifierFlags]; } diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 24f73c5631..2f6c2101ef 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -211,6 +211,11 @@ void callKeyDown(unsigned short key, unsigned int mask) gKeyboard->handleKeyDown(key, mask); } +void callResetKeys() +{ + gKeyboard->resetKeys(); +} + void callUnicodeCallback(wchar_t character, unsigned int mask) { gWindowImplementation->getCallbacks()->handleUnicodeChar(character, mask); @@ -370,6 +375,26 @@ void callQuitHandler() } } +std::basic_string<wchar_t> getPreeditString() +{ + return gWindowImplementation->getPreeditor()->getPreeditString(); +} + +void getPreeditSelectionRange(int *position, int *length) +{ + gWindowImplementation->getPreeditor()->getSelectionRange(position, length); +} + +void getPreeditMarkedRange(int *position, int *length) +{ + gWindowImplementation->getPreeditor()->getPreeditRange(position, length); +} + +void handleUnicodeCharacter(wchar_t c) +{ + gWindowImplementation->getPreeditor()->handleUnicodeCharHere(c); +} + void LLWindowMacOSX::updateMouseDeltas(float* deltas) { if (mCursorDecoupled) diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 14d6e70fb3..de0340cf74 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -120,6 +120,7 @@ public: void* getWindow() { return mWindow; } LLWindowCallbacks* getCallbacks() { return mCallbacks; } + LLPreeditor* getPreeditor() { return mPreeditor; } void updateMouseDeltas(float* deltas); void getMouseDeltas(float* delta); |