summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-03-29 05:52:26 +0800
committerErik Kundiman <erik@megapahit.org>2025-03-29 05:52:26 +0800
commit1c5777bd52bc581841d832b52572370395f86ff7 (patch)
tree25867742f8be6accd9bc5aaffa0b2acb21ac95b4 /indra/llwindow
parent7bb1791be2a2f41a381736e3f2ca2a5ccde37063 (diff)
parent8eff224c121f8e08514b28326d4c886e4acd35ab (diff)
Merge tag 'Second_Life_Release#8eff224c-2025.03' into 2025.03
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindowmacosx.cpp86
1 files changed, 75 insertions, 11 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 7749f03d38..c97e014e46 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -280,6 +280,10 @@ void callResetKeys()
bool callUnicodeCallback(wchar_t character, unsigned int mask)
{
+ if (!gWindowImplementation)
+ {
+ return false;
+ }
NativeKeyEventData eventData;
memset(&eventData, 0, sizeof(NativeKeyEventData));
@@ -301,7 +305,7 @@ bool callUnicodeCallback(wchar_t character, unsigned int mask)
void callFocus()
{
- if (gWindowImplementation)
+ if (gWindowImplementation && gWindowImplementation->getCallbacks())
{
gWindowImplementation->getCallbacks()->handleFocus(gWindowImplementation);
}
@@ -309,7 +313,7 @@ void callFocus()
void callFocusLost()
{
- if (gWindowImplementation)
+ if (gWindowImplementation && gWindowImplementation->getCallbacks())
{
gWindowImplementation->getCallbacks()->handleFocusLost(gWindowImplementation);
}
@@ -317,6 +321,10 @@ void callFocusLost()
void callRightMouseDown(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -330,6 +338,10 @@ void callRightMouseDown(float *pos, MASK mask)
void callRightMouseUp(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -343,6 +355,10 @@ void callRightMouseUp(float *pos, MASK mask)
void callLeftMouseDown(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -356,6 +372,10 @@ void callLeftMouseDown(float *pos, MASK mask)
void callLeftMouseUp(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -370,6 +390,10 @@ void callLeftMouseUp(float *pos, MASK mask)
void callDoubleClick(float *pos, MASK mask)
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
if (gWindowImplementation->allowsLanguageInput())
{
gWindowImplementation->interruptLanguageTextInput();
@@ -383,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);
}
@@ -391,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]);
@@ -404,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]);
@@ -425,6 +457,10 @@ void callScrollMoved(float deltaX, float deltaY)
void callMouseExit()
{
+ if (!gWindowImplementation)
+ {
+ return;
+ }
gWindowImplementation->getCallbacks()->handleMouseLeave(gWindowImplementation);
}
@@ -476,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]);
@@ -501,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]);
@@ -525,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))
{
@@ -556,7 +620,7 @@ void callQuitHandler()
void getPreeditSelectionRange(int *position, int *length)
{
- if (gWindowImplementation->getPreeditor())
+ if (gWindowImplementation && gWindowImplementation->getPreeditor())
{
gWindowImplementation->getPreeditor()->getSelectionRange(position, length);
}
@@ -564,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);
}
@@ -572,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);
}
@@ -581,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);
}
@@ -591,7 +655,7 @@ bool handleUnicodeCharacter(wchar_t c)
void resetPreedit()
{
- if (gWindowImplementation->getPreeditor())
+ if (gWindowImplementation && gWindowImplementation->getPreeditor())
{
gWindowImplementation->getPreeditor()->resetPreedit();
}
@@ -601,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();
@@ -624,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;