summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowmacosx.cpp
diff options
context:
space:
mode:
authorGeenz <geenz@geenzo.com>2012-12-29 06:59:43 -0500
committerGeenz <geenz@geenzo.com>2012-12-29 06:59:43 -0500
commitbd152c1fb75c4a8d4b9271896c44243ca8759e58 (patch)
treece85602e2ca58b894524e1a3fc426a0d138f41b4 /indra/llwindow/llwindowmacosx.cpp
parentc8aa1fb7c8ed44886599ea4e04eed403392e2e34 (diff)
Huge amount of refactoring to use Cocoa here:
- Updated to .xib format. To produce a new nib (which is required after changing the xib file), use "ibtool SecondLife.xib --compile SecondLife.nib" within the newview directory. - xib file now defines the viewer's window. VIews are still being pragmatically added to the main window. This may change in the future. - LLAppViewer's main loop has been slightly refactored to be executed on a timer for OS X. This probably needs a bit more work. - Event handling still needs more work to work within a timer based event loop. It works fairly sporadically at the moment, as if events are being dropped between timer executions, at least for the mouse. - Carbon has been purged from the viewer's startup, and from LLWindow entirely. There's likely still a few odds and ends fragmented throughout the viewer and its dependencies. Need to track these down. - LLAppViewerMacOSX now uses NSApplicationMain, and also implements the NSApplicationDelegate protocol in LLAppDelegate. - Fullscreen support has been implemented for OS X 10.7+ This is still a work in progress, however at this stage everything needed for a functional viewer is (mostly) complete. From here, it's mostly just bug hunting and fixing.
Diffstat (limited to 'indra/llwindow/llwindowmacosx.cpp')
-rw-r--r--indra/llwindow/llwindowmacosx.cpp133
1 files changed, 4 insertions, 129 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 1fb8bea802..a616b2df2d 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -38,7 +38,6 @@
#include "lldir.h"
#include "indra_constants.h"
-#include <Carbon/Carbon.h>
#include <OpenGL/OpenGL.h>
extern BOOL gDebugWindowProc;
@@ -342,7 +341,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
if (mWindow == NULL)
{
LL_INFOS("Window") << "Creating window..." << LL_ENDL;
- mWindow = createNSWindow(x, y, width, height);
+ mWindow = getMainAppWindow();
LL_INFOS("Window") << "Registering key callbacks..." << LL_ENDL;
registerKeyDownCallback(mWindow, callKeyDown);
registerKeyUpCallback(mWindow, callKeyUp);
@@ -361,9 +360,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
if(mContext == NULL)
{
LL_INFOS("Window") << "Creating GL view..." << LL_ENDL;
+ // Our OpenGL view is already defined within SecondLife.xib.
+ // Get the view instead.
mGLView = createOpenGLView(mWindow);
registerResizeEventCallback(mGLView, callResize);
- mContext = getCGLContextObj(mWindow);
+ mContext = getCGLContextObj(mGLView);
// Since we just created the context, it needs to be set up.
glNeedsInit = TRUE;
}
@@ -577,132 +578,6 @@ void LLWindowMacOSX::gatherInput()
stopDockTileBounce();
}
- EventRecord evt;
- while(WaitNextEvent(everyEvent, &evt, 0, NULL))
- {
- // printf("WaitNextEvent returned true, event is %d.\n", evt.what);
- switch(evt.what)
- {
- case mouseDown:
- {
- short part;
- WindowRef window;
- long selectResult;
- part = FindWindow(evt.where, &window);
- switch ( part )
- {
- case inMenuBar:
- selectResult = MenuSelect(evt.where);
-
- HiliteMenu(0);
- break;
- }
- }
- break;
-
- case kHighLevelEvent:
- AEProcessAppleEvent (&evt);
- break;
-
- case updateEvt:
- // We shouldn't be getting these regularly (since our window will be buffered), but we need to handle them correctly...
- BeginUpdate((WindowRef)evt.message);
- EndUpdate((WindowRef)evt.message);
- break;
-
- }
- }
- /*
- U32 event = getLatestEvent(mWindow);
- switch (event) {
- case 0:
- // Nothing's happened since our last handled event.
- break;
-
- case 1:
- {
- gKeyboard->handleKeyDown(getKeyDown(mWindow), getModifiers(mWindow));
- mCallbacks->handleUnicodeChar(getLastCharacter(mWindow), gKeyboard->currentMask(FALSE)); // currentMask has the appropriately translated modifiers.
- mLastModifiers = gKeyboard->currentMask(FALSE);
- }
- break;
-
- case 2:
- gKeyboard->handleKeyUp(getKeyUp(mWindow), getModifiers(mWindow));
- mLastModifiers = gKeyboard->currentMask(FALSE);
- break;
-
- case 3:
- break;
-
- case 4:
- {
- LLCoordScreen inCoords;
- LLCoordGL outCoords;
- float* mouseCoords = getMouseDown(mWindow);
- inCoords.mX = llround(mouseCoords[0]);
- inCoords.mY = llround(mouseCoords[1]);
- convertCoords(inCoords, &outCoords);
- mCallbacks->handleMouseDown(this, outCoords, getModifiers(mWindow));
- mLastModifiers = gKeyboard->currentMask(FALSE);
- }
- break;
- case 5:
- {
- LLCoordScreen inCoords;
- LLCoordGL outCoords;
- float* mouseCoords = getMouseUp(mWindow);
- inCoords.mX = llround(mouseCoords[0]);
- inCoords.mY = llround(mouseCoords[1]);
- convertCoords(inCoords, &outCoords);
- mCallbacks->handleMouseUp(this, outCoords, getModifiers(mWindow));
- mLastModifiers = gKeyboard->currentMask(FALSE);
- }
- break;
- case 6:
- {
- LLCoordScreen inCoords;
- LLCoordGL outCoords;
- float* mouseCoords = getRightMouseDown(mWindow);
- inCoords.mX = llround(mouseCoords[0]);
- inCoords.mY = llround(mouseCoords[1]);
- convertCoords(inCoords, &outCoords);
- mCallbacks->handleRightMouseDown(this, outCoords, getModifiers(mWindow));
- mLastModifiers = gKeyboard->currentMask(FALSE);
- }
- break;
- case 7:
- {
- LLCoordScreen inCoords;
- LLCoordGL outCoords;
- float* mouseCoords = getRightMouseDown(mWindow);
- inCoords.mX = llround(mouseCoords[0]);
- inCoords.mY = llround(mouseCoords[1]);
- convertCoords(inCoords, &outCoords);
- mCallbacks->handleRightMouseDown(this, outCoords, getModifiers(mWindow));
- mLastModifiers = gKeyboard->currentMask(FALSE);
- }
- break;
- case 8: // Double click
- {
- LLCoordScreen inCoords;
- LLCoordGL outCoords;
- float* mouseCoords = getRightMouseDown(mWindow);
- inCoords.mX = llround(mouseCoords[0]);
- inCoords.mY = llround(mouseCoords[1]);
- convertCoords(inCoords, &outCoords);
- mCallbacks->handleDoubleClick(this, outCoords, getModifiers(mWindow));
- mLastModifiers = gKeyboard->currentMask(FALSE);
- }
- break;
- case 10: // Text input (for IMEs)
-
- break;
- default:
- break;
-
- }*/
-
updateCursor();
}