diff options
author | Geenz <geenz@geenzo.com> | 2013-01-01 11:32:53 -0500 |
---|---|---|
committer | Geenz <geenz@geenzo.com> | 2013-01-01 11:32:53 -0500 |
commit | ddb48d51d996b18063b111faa3b7e709160074d9 (patch) | |
tree | f64cab16299cec07756dea34823ab3749b4d1ec3 /indra/llwindow/llwindowmacosx-objc.mm | |
parent | 7a1593c083a7ed6e3d6589d5dd656354d748b8ce (diff) |
More things in this commit:
- Removed the callback system in favor of simply defining functions in a header to later be implemented in whichever file is most convenient for what we want to do (i.e., calling LLWindow callbacks within LLWindowMacOSX, setting cursors in llwindowmacosx-objc.mm, etc.)
- Viewer shutdown now works appropriately
- Added a bit of debugging code to test if a key has been handled by the UI or not (useful for tracking down the mystery of the enter key not being handled)
- Setup a cocoa quit handler within the application delegate that intercepts any termination requests
Diffstat (limited to 'indra/llwindow/llwindowmacosx-objc.mm')
-rw-r--r-- | indra/llwindow/llwindowmacosx-objc.mm | 74 |
1 files changed, 15 insertions, 59 deletions
diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 07efc25ea6..f3972303f1 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -255,6 +255,15 @@ void convertScreenToWindow(NSWindowRef window, float *coord) coord[1] = point.y; } +void convertScreenToView(NSWindowRef window, float *coord) +{ + NSRect point; + point.origin.x = coord[0]; + point.origin.y = coord[1]; + point.origin = [(LLNSWindow*)window convertScreenToBase:point.origin]; + point.origin = [[(LLNSWindow*)window contentView] convertPoint:point.origin fromView:nil]; +} + void convertWindowToScreen(NSWindowRef window, float *coord) { NSPoint point; @@ -265,73 +274,20 @@ void convertWindowToScreen(NSWindowRef window, float *coord) coord[1] = point.y; } -void registerKeyUpCallback(NSWindowRef window, std::tr1::function<void(unsigned short, unsigned int)> callback) -{ - [(LLNSWindow*)window registerKeyUpCallback:callback]; -} - -void registerKeyDownCallback(NSWindowRef window, std::tr1::function<void(unsigned short, unsigned int)> callback) -{ - [(LLNSWindow*)window registerKeyDownCallback:callback]; -} - -void registerUnicodeCallback(NSWindowRef window, std::tr1::function<void(wchar_t, unsigned int)> callback) -{ - [(LLNSWindow*)window registerUnicodeCallback:callback]; -} - -void registerMouseUpCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerMouseUpCallback:callback]; -} - -void registerMouseDownCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerMouseDownCallback:callback]; -} - -void registerRightMouseUpCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerRightMouseUpCallback:callback]; -} - -void registerRightMouseDownCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerRightMouseDownCallback:callback]; -} - -void registerDoubleClickCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerDoubleClickCallback:callback]; -} - -void registerResizeEventCallback(GLViewRef glview, ResizeCallback callback) -{ - [(LLOpenGLView*)glview registerResizeCallback:callback]; -} - -void registerMouseMovedCallback(NSWindowRef window, MouseCallback callback) -{ - [(LLNSWindow*)window registerMouseMovedCallback:callback]; -} - -void registerScrollCallback(NSWindowRef window, ScrollWheelCallback callback) -{ - [(LLNSWindow*)window registerScrollCallback:callback]; -} - -void registerMouseExitCallback(NSWindowRef window, VoidCallback callback) +void closeWindow(NSWindowRef window) { - [(LLNSWindow*)window registerMouseExitCallback:callback]; + [(LLNSWindow*)window close]; } -void registerDeltaUpdateCallback(NSWindowRef window, MouseCallback callback) +void removeGLView(GLViewRef view) { - [(LLNSWindow*)window registerDeltaUpdateCallback:callback]; + [(LLOpenGLView*)view removeFromSuperview]; + [(LLOpenGLView*)view release]; } NSWindowRef getMainAppWindow() { + [(LLNSWindow*)winRef setAcceptsMouseMovedEvents:TRUE]; return winRef; } |