diff options
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llkeyboardmacosx.cpp | 4 | ||||
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 7 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.h | 9 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.mm | 9 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 33 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.h | 1 |
6 files changed, 58 insertions, 5 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/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 735ef77cce..6ea523ea05 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -484,16 +484,19 @@ - (BOOL) becomeFirstResponder { - NSLog(@"Window gained focus!"); callFocus(); return true; } - (BOOL) resignFirstResponder { - NSLog(@"Window lost focus!"); callFocus(); return true; } +- (void) close +{ + callQuitHandler(); +} + @end diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 1724b85724..f3d6d2b1f1 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -79,6 +79,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); @@ -97,6 +98,7 @@ void callMiddleMouseUp(float *pos, unsigned int mask); void callFocus(); void callFocusLost(); void callModifier(unsigned int mask); +void callQuitHandler(); #include <string> void callHandleDragEntered(std::string url); @@ -104,6 +106,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 9b57cd27cd..b859f236d4 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -337,7 +337,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 2faebe5dd9..34cc371526 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); @@ -362,6 +367,34 @@ void callHandleDragDropped(std::string url) gWindowImplementation->handleDragNDrop(url, LLWindowCallbacks::DNDA_DROPPED); } +void callQuitHandler() +{ + if(gWindowImplementation->getCallbacks()->handleCloseRequest(gWindowImplementation)) + { + gWindowImplementation->getCallbacks()->handleQuit(gWindowImplementation); + } +} + +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); |