summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-08-28 23:57:41 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-08-28 23:57:41 +0000
commit4a6bacea0f8dcff959028f285bc533852da608b5 (patch)
tree7f49b429051e550f70917ccbcdd1c27bf86f5bdf /indra/llwindow
parentac4766d4354ee1945f1569a94d755e3e7c0cd566 (diff)
merge viewer/viewer_1-21 94170-94770 -> release
merge viewer/viewer_1-21-0 94830-95157 -> release Includes: QAR-786 Sandbox buildme for viewer + server Release Notes on the wiki! QAR-797 teleport failures (DEV-6198 / SVC-972) mergeme
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindowmacosx.cpp19
-rw-r--r--indra/llwindow/llwindowmacosx.h3
-rw-r--r--indra/llwindow/llwindowwin32.cpp26
3 files changed, 47 insertions, 1 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 72623a17f2..56a8a6af40 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -264,6 +264,7 @@ LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name
mWindowTitle[0] = title.length();
mEventHandlerUPP = NewEventHandlerUPP(staticEventHandler);
+ mMoveEventCampartorUPP = NewEventComparatorUPP(staticMoveEventComparator);
mGlobalHandlerRef = NULL;
mWindowHandlerRef = NULL;
@@ -1487,6 +1488,7 @@ void LLWindowMacOSX::adjustCursorDecouple(bool warpingMouse)
// llinfos << "adjustCursorDecouple: decoupling cursor" << llendl;
CGAssociateMouseAndMouseCursorPosition(false);
mCursorDecoupled = true;
+ FlushSpecificEventsFromQueue(GetCurrentEventQueue(), mMoveEventCampartorUPP, NULL);
mCursorIgnoreNextDelta = TRUE;
}
}
@@ -1914,6 +1916,23 @@ void LLWindowMacOSX::setupFailure(const std::string& text, const std::string& ca
OSMessageBox(text, caption, type);
}
+pascal Boolean LLWindowMacOSX::staticMoveEventComparator( EventRef event, void* data)
+{
+ UInt32 evtClass = GetEventClass (event);
+ UInt32 evtKind = GetEventKind (event);
+
+ if ((evtClass == kEventClassMouse) && ((evtKind == kEventMouseDragged) || (evtKind == kEventMouseMoved)))
+ {
+ return true;
+ }
+
+ else
+ {
+ return false;
+ }
+}
+
+
pascal OSStatus LLWindowMacOSX::staticEventHandler(EventHandlerCallRef myHandler, EventRef event, void* userData)
{
LLWindowMacOSX *self = (LLWindowMacOSX*)userData;
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 24cdb54a9e..799923d239 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -152,6 +152,7 @@ protected:
void destroyContext();
void setupFailure(const std::string& text, const std::string& caption, U32 type);
static pascal OSStatus staticEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData);
+ static pascal Boolean staticMoveEventComparator( EventRef event, void* data);
OSStatus eventHandler (EventHandlerCallRef myHandler, EventRef event);
void adjustCursorDecouple(bool warpingMouse = false);
void fixWindowSize(void);
@@ -170,6 +171,8 @@ protected:
EventHandlerUPP mEventHandlerUPP;
EventHandlerRef mGlobalHandlerRef;
EventHandlerRef mWindowHandlerRef;
+ EventComparatorUPP mMoveEventCampartorUPP;
+
Rect mOldMouseClip; // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse()
Str255 mWindowTitle;
double mOriginalAspectRatio;
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 526a6769a0..1aaf18e3b6 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -1387,10 +1387,20 @@ BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position)
return FALSE;
}
+ // Inform the application of the new mouse position (needed for per-frame
+ // hover/picking to function).
LLCoordGL gl_pos;
convertCoords(position, &gl_pos);
mCallbacks->handleMouseMove(this, gl_pos, (MASK)0);
+ // DEV-18951 VWR-8524 Camera moves wildly when alt-clicking.
+ // Because we have preemptively notified the application of the new
+ // mouse position via handleMouseMove() above, we need to clear out
+ // any stale mouse move events. RN/JC
+ MSG msg;
+ while (PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
+ { }
+
return SetCursorPos(screen_pos.mX, screen_pos.mY);
}
@@ -1943,6 +1953,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleMouseDown(window_imp, gl_coord, mask))
{
return 0;
@@ -1970,6 +1982,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleDoubleClick(window_imp, gl_coord, mask) )
{
return 0;
@@ -2000,6 +2014,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleMouseUp(window_imp, gl_coord, mask))
{
return 0;
@@ -2016,7 +2032,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->interruptLanguageTextInput();
}
- // Because we move the cursor position in tllviewerhe app, we need to query
+ // Because we move the cursor position in the llviewerapp, we need to query
// to find out where the cursor at the time the event is handled.
// If we don't do this, many clicks could get buffered up, and if the
// first click changes the cursor position, all subsequent clicks
@@ -2032,6 +2048,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleRightMouseDown(window_imp, gl_coord, mask))
{
return 0;
@@ -2058,6 +2076,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleRightMouseUp(window_imp, gl_coord, mask))
{
return 0;
@@ -2090,6 +2110,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleMiddleMouseDown(window_imp, gl_coord, mask))
{
return 0;
@@ -2116,6 +2138,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->convertCoords(window_coord, &gl_coord);
}
MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
if (window_imp->mCallbacks->handleMiddleMouseUp(window_imp, gl_coord, mask))
{
return 0;