summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowmacosx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow/llwindowmacosx.cpp')
-rw-r--r--indra/llwindow/llwindowmacosx.cpp95
1 files changed, 80 insertions, 15 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index f26d692363..c97e014e46 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -38,6 +38,7 @@
#include "lldir.h"
#include "indra_constants.h"
+
#include <OpenGL/OpenGL.h>
#include <Carbon/Carbon.h>
#include <CoreServices/CoreServices.h>
@@ -279,6 +280,10 @@ void callResetKeys()
bool callUnicodeCallback(wchar_t character, unsigned int mask)
{
+ if (!gWindowImplementation)
+ {
+ return false;
+ }
NativeKeyEventData eventData;
memset(&eventData, 0, sizeof(NativeKeyEventData));
@@ -300,7 +305,7 @@ bool callUnicodeCallback(wchar_t character, unsigned int mask)
void callFocus()
{
- if (gWindowImplementation)
+ if (gWindowImplementation && gWindowImplementation->getCallbacks())
{
gWindowImplementation->getCallbacks()->handleFocus(gWindowImplementation);
}
@@ -308,7 +313,7 @@ void callFocus()
void callFocusLost()
{
- if (gWindowImplementation)
+ if (gWindowImplementation && gWindowImplementation->getCallbacks())
{
gWindowImplementation->getCallbacks()->handleFocusLost(gWindowImplementation);
}
@@ -316,6 +321,10 @@ void callFocusLost()
void callRightMouseDown(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -329,6 +338,10 @@ void callRightMouseDown(float *pos, MASK mask)
void callRightMouseUp(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -342,6 +355,10 @@ void callRightMouseUp(float *pos, MASK mask)
void callLeftMouseDown(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -355,6 +372,10 @@ void callLeftMouseDown(float *pos, MASK mask)
void callLeftMouseUp(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -369,6 +390,10 @@ void callLeftMouseUp(float *pos, MASK mask)
void callDoubleClick(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -382,7 +407,7 @@ void callDoubleClick(float *pos, MASK mask)
void callResize(unsigned int width, unsigned int height)
{
- if (gWindowImplementation != NULL)
+ if (gWindowImplementation && gWindowImplementation->getCallbacks())
{
gWindowImplementation->getCallbacks()->handleResize(gWindowImplementation, width, height);
}
@@ -390,6 +415,10 @@ void callResize(unsigned int width, unsigned int height)
void callMouseMoved(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
LLCoordGL outCoords;
outCoords.mX = ll_round(pos[0]);
outCoords.mY = ll_round(pos[1]);
@@ -403,6 +432,10 @@ void callMouseMoved(float *pos, MASK mask)
void callMouseDragged(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
LLCoordGL outCoords;
outCoords.mX = ll_round(pos[0]);
outCoords.mY = ll_round(pos[1]);
@@ -424,6 +457,10 @@ void callScrollMoved(float deltaX, float deltaY)
void callMouseExit()
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
gWindowImplementation->getCallbacks()->handleMouseLeave(gWindowImplementation);
}
@@ -475,11 +512,19 @@ void callWindowDidChangeScreen()
void callDeltaUpdate(float *delta, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
gWindowImplementation->updateMouseDeltas(delta);
}
void callOtherMouseDown(float *pos, MASK mask, int button)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
LLCoordGL outCoords;
outCoords.mX = ll_round(pos[0]);
outCoords.mY = ll_round(pos[1]);
@@ -500,6 +545,10 @@ void callOtherMouseDown(float *pos, MASK mask, int button)
void callOtherMouseUp(float *pos, MASK mask, int button)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
LLCoordGL outCoords;
outCoords.mX = ll_round(pos[0]);
outCoords.mY = ll_round(pos[1]);
@@ -524,27 +573,43 @@ void callModifier(MASK mask)
void callHandleDragEntered(std::string url)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
gWindowImplementation->handleDragNDrop(url, LLWindowCallbacks::DNDA_START_TRACKING);
}
void callHandleDragExited(std::string url)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
gWindowImplementation->handleDragNDrop(url, LLWindowCallbacks::DNDA_STOP_TRACKING);
}
void callHandleDragUpdated(std::string url)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
gWindowImplementation->handleDragNDrop(url, LLWindowCallbacks::DNDA_TRACK);
}
void callHandleDragDropped(std::string url)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
gWindowImplementation->handleDragNDrop(url, LLWindowCallbacks::DNDA_DROPPED);
}
void callQuitHandler()
{
- if (gWindowImplementation)
+ if (gWindowImplementation && gWindowImplementation->getCallbacks())
{
if(gWindowImplementation->getCallbacks()->handleCloseRequest(gWindowImplementation))
{
@@ -555,7 +620,7 @@ void callQuitHandler()
void getPreeditSelectionRange(int *position, int *length)
{
- if (gWindowImplementation->getPreeditor())
+ if (gWindowImplementation && gWindowImplementation->getPreeditor())
{
gWindowImplementation->getPreeditor()->getSelectionRange(position, length);
}
@@ -563,7 +628,7 @@ void getPreeditSelectionRange(int *position, int *length)
void getPreeditMarkedRange(int *position, int *length)
{
- if (gWindowImplementation->getPreeditor())
+ if (gWindowImplementation && gWindowImplementation->getPreeditor())
{
gWindowImplementation->getPreeditor()->getPreeditRange(position, length);
}
@@ -571,7 +636,7 @@ void getPreeditMarkedRange(int *position, int *length)
void setPreeditMarkedRange(int position, int length)
{
- if (gWindowImplementation->getPreeditor())
+ if (gWindowImplementation && gWindowImplementation->getPreeditor())
{
gWindowImplementation->getPreeditor()->markAsPreedit(position, length);
}
@@ -580,7 +645,7 @@ void setPreeditMarkedRange(int position, int length)
bool handleUnicodeCharacter(wchar_t c)
{
bool success = false;
- if (gWindowImplementation->getPreeditor())
+ if (gWindowImplementation && gWindowImplementation->getPreeditor())
{
success = gWindowImplementation->getPreeditor()->handleUnicodeCharHere(c);
}
@@ -590,7 +655,7 @@ bool handleUnicodeCharacter(wchar_t c)
void resetPreedit()
{
- if (gWindowImplementation->getPreeditor())
+ if (gWindowImplementation && gWindowImplementation->getPreeditor())
{
gWindowImplementation->getPreeditor()->resetPreedit();
}
@@ -600,7 +665,7 @@ void resetPreedit()
// This largely mirrors the old implementation, only sans the carbon parameters.
void setMarkedText(unsigned short *unitext, unsigned int *selectedRange, unsigned int *replacementRange, long text_len, attributedStringInfo segments)
{
- if (gWindowImplementation->getPreeditor())
+ if (gWindowImplementation && gWindowImplementation->getPreeditor())
{
LLPreeditor *preeditor = gWindowImplementation->getPreeditor();
preeditor->resetPreedit();
@@ -623,7 +688,7 @@ void setMarkedText(unsigned short *unitext, unsigned int *selectedRange, unsigne
void getPreeditLocation(float *location, unsigned int length)
{
- if (gWindowImplementation->getPreeditor())
+ if (gWindowImplementation && gWindowImplementation->getPreeditor())
{
LLPreeditor *preeditor = gWindowImplementation->getPreeditor();
LLCoordGL coord;
@@ -1060,7 +1125,7 @@ F32 LLWindowMacOSX::getGamma()
&greenGamma,
&blueMin,
&blueMax,
- &blueGamma) == noErr)
+ &blueGamma) == kCGErrorSuccess)
{
// So many choices...
// Let's just return the green channel gamma for now.
@@ -1111,7 +1176,7 @@ bool LLWindowMacOSX::setGamma(const F32 gamma)
&greenGamma,
&blueMin,
&blueMax,
- &blueGamma) != noErr)
+ &blueGamma) != kCGErrorSuccess)
{
return false;
}
@@ -1126,7 +1191,7 @@ bool LLWindowMacOSX::setGamma(const F32 gamma)
gamma,
blueMin,
blueMax,
- gamma) != noErr)
+ gamma) != kCGErrorSuccess)
{
return false;
}
@@ -1178,7 +1243,7 @@ bool LLWindowMacOSX::setCursorPosition(const LLCoordWindow position)
newPosition.y = screen_pos.mY;
CGSetLocalEventsSuppressionInterval(0.0);
- if(CGWarpMouseCursorPosition(newPosition) == noErr)
+ if(CGWarpMouseCursorPosition(newPosition) == kCGErrorSuccess)
{
result = true;
}