From ba2429163af92b510d26444bb33f9f9d941c6dda Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 18 Jul 2019 18:37:45 +0300 Subject: SL-11592 [Win] Ability to bind extra mouse buttons for push to talk --- indra/llwindow/llmousehandler.h | 2 ++ indra/llwindow/llwindowcallbacks.cpp | 10 ++++++ indra/llwindow/llwindowcallbacks.h | 2 ++ indra/llwindow/llwindowwin32.cpp | 64 ++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h index d825a3424c..8e6fbdb4e3 100644 --- a/indra/llwindow/llmousehandler.h +++ b/indra/llwindow/llmousehandler.h @@ -50,6 +50,8 @@ public: CLICK_LEFT, CLICK_MIDDLE, CLICK_RIGHT, + CLICK_BUTTON4, + CLICK_BUTTON5, CLICK_DOUBLELEFT } EClickType; diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp index 94c725fc7e..c01f574375 100644 --- a/indra/llwindow/llwindowcallbacks.cpp +++ b/indra/llwindow/llwindowcallbacks.cpp @@ -98,6 +98,16 @@ BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL po return FALSE; } +BOOL LLWindowCallbacks::handleOtherMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) +{ + return FALSE; +} + +BOOL LLWindowCallbacks::handleOtherMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) +{ + return FALSE; +} + BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated) { return FALSE; diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h index 4d753024fe..9304446f8f 100644 --- a/indra/llwindow/llwindowcallbacks.h +++ b/indra/llwindow/llwindowcallbacks.h @@ -49,6 +49,8 @@ public: virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + virtual BOOL handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); + virtual BOOL handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); virtual BOOL handleActivate(LLWindow *window, BOOL activated); virtual BOOL handleActivateApp(LLWindow *window, BOOL activating); virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 66b8bf8aee..25286ee61c 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2539,6 +2539,70 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ } } break; + case WM_XBUTTONDOWN: + { + window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONDOWN"); + LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); + S32 button = GET_XBUTTON_WPARAM(w_param); + if (LLWinImm::isAvailable() && window_imp->mPreeditor) + { + window_imp->interruptLanguageTextInput(); + } + + // Because we move the cursor position in tllviewerhe app, 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 + // will occur at the wrong location. JC + if (window_imp->mMousePositionModified) + { + LLCoordWindow cursor_coord_window; + window_imp->getCursorPosition(&cursor_coord_window); + gl_coord = cursor_coord_window.convert(); + } + else + { + gl_coord = window_coord.convert(); + } + 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->handleOtherMouseDown(window_imp, gl_coord, mask, button)) + { + return 0; + } + } + break; + + case WM_XBUTTONUP: + { + window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONUP"); + LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); + S32 button = GET_XBUTTON_WPARAM(w_param); + // Because we move the cursor position in the llviewer app, 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 + // will occur at the wrong location. JC + if (window_imp->mMousePositionModified) + { + LLCoordWindow cursor_coord_window; + window_imp->getCursorPosition(&cursor_coord_window); + gl_coord = cursor_coord_window.convert(); + } + else + { + gl_coord = window_coord.convert(); + } + 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->handleOtherMouseUp(window_imp, gl_coord, mask, button)) + { + return 0; + } + } + break; case WM_MOUSEWHEEL: { -- cgit v1.2.3 From a0bf70b41d84c50da081917f0ec842cca973f45b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 18 Jul 2019 19:18:02 +0300 Subject: SL-11592 [Mac] Ability to bind extra mouse buttons for push to talk --- indra/llwindow/llopenglview-objc.mm | 4 ++-- indra/llwindow/llwindowmacosx-objc.h | 4 ++-- indra/llwindow/llwindowmacosx.cpp | 24 +++++++++++++++++++----- indra/llwindow/llwindowwin32.cpp | 6 ++++-- 4 files changed, 27 insertions(+), 11 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 1990499459..decbd15efc 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -444,7 +444,7 @@ attributedStringInfo getSegments(NSAttributedString *str) NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; mMousePos[0] = mPoint.x; mMousePos[1] = mPoint.y; - callMiddleMouseDown(mMousePos, [theEvent modifierFlags]); + callOtherMouseDown(mMousePos, [theEvent modifierFlags], [theEvent buttonNumber]); } - (void) otherMouseUp:(NSEvent *)theEvent @@ -452,7 +452,7 @@ attributedStringInfo getSegments(NSAttributedString *str) NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow]; mMousePos[0] = mPoint.x; mMousePos[1] = mPoint.y; - callMiddleMouseUp(mMousePos, [theEvent modifierFlags]); + callOtherMouseUp(mMousePos, [theEvent modifierFlags], [theEvent buttonNumber]); } - (void) rightMouseDragged:(NSEvent *)theEvent diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 99af161102..0f77ebe7a4 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -150,8 +150,8 @@ void callWindowHide(); void callWindowUnhide(); void callWindowDidChangeScreen(); void callDeltaUpdate(float *delta, unsigned int mask); -void callMiddleMouseDown(float *pos, unsigned int mask); -void callMiddleMouseUp(float *pos, unsigned int mask); +void callOtherMouseDown(float *pos, unsigned int mask, int button); +void callOtherMouseUp(float *pos, unsigned int mask, int button); void callFocus(); void callFocusLost(); void callModifier(unsigned int mask); diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 3554f90be8..6749b3be3b 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -417,7 +417,7 @@ void callDeltaUpdate(float *delta, MASK mask) gWindowImplementation->updateMouseDeltas(delta); } -void callMiddleMouseDown(float *pos, MASK mask) +void callOtherMouseDown(float *pos, MASK mask, int button) { LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); @@ -426,10 +426,17 @@ void callMiddleMouseDown(float *pos, MASK mask) gWindowImplementation->getMouseDeltas(deltas); outCoords.mX += deltas[0]; outCoords.mY += deltas[1]; - gWindowImplementation->getCallbacks()->handleMiddleMouseDown(gWindowImplementation, outCoords, mask); + if (button == 3) + { + gWindowImplementation->getCallbacks()->handleMiddleMouseDown(gWindowImplementation, outCoords, mask); + } + else + { + gWindowImplementation->getCallbacks()->handleOtherMouseDown(gWindowImplementation, outCoords, mask, button); + } } -void callMiddleMouseUp(float *pos, MASK mask) +void callOtherMouseUp(float *pos, MASK mask, int button) { LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); @@ -437,8 +444,15 @@ void callMiddleMouseUp(float *pos, MASK mask) float deltas[2]; gWindowImplementation->getMouseDeltas(deltas); outCoords.mX += deltas[0]; - outCoords.mY += deltas[1]; - gWindowImplementation->getCallbacks()->handleMiddleMouseUp(gWindowImplementation, outCoords, mask); + outCoords.mY += deltas[1]; + if (button == 3) + { + gWindowImplementation->getCallbacks()->handleMiddleMouseUp(gWindowImplementation, outCoords, mask); + } + else + { + gWindowImplementation->getCallbacks()->handleOtherMouseUp(gWindowImplementation, outCoords, mask, button); + } } void callModifier(MASK mask) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 25286ee61c..5fe907d240 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2567,7 +2567,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ 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->handleOtherMouseDown(window_imp, gl_coord, mask, button)) + // Windows uses numbers 1 and 2 for buttons, remap to 4, 5 + if (window_imp->mCallbacks->handleOtherMouseDown(window_imp, gl_coord, mask, button + 3)) { return 0; } @@ -2597,7 +2598,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ 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->handleOtherMouseUp(window_imp, gl_coord, mask, button)) + // Windows uses numbers 1 and 2 for buttons, remap to 4, 5 + if (window_imp->mCallbacks->handleOtherMouseUp(window_imp, gl_coord, mask, button + 3)) { return 0; } -- cgit v1.2.3 From c5bcb31d00cdac597ce6e406c253ba456e9436c8 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 19 Jul 2019 13:40:17 +0300 Subject: SL-11592 [Mac] Fixed mouse buttons ids for correct handling. --- indra/llwindow/llmousehandler.cpp | 8 ++++++++ indra/llwindow/llwindowmacosx.cpp | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llmousehandler.cpp b/indra/llwindow/llmousehandler.cpp index bea66e763c..d5fa65fe4b 100644 --- a/indra/llwindow/llmousehandler.cpp +++ b/indra/llwindow/llmousehandler.cpp @@ -38,6 +38,10 @@ BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType cli case CLICK_RIGHT: handled = handleRightMouseDown(x, y, mask); break; case CLICK_MIDDLE: handled = handleMiddleMouseDown(x, y, mask); break; case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; + case CLICK_BUTTON4: + case CLICK_BUTTON5: + LL_INFOS() << "Handle mouse button " << clicktype + 1 << " down." << LL_ENDL; + break; default: LL_WARNS() << "Unhandled enum." << LL_ENDL; } @@ -50,6 +54,10 @@ BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType cli case CLICK_RIGHT: handled = handleRightMouseUp(x, y, mask); break; case CLICK_MIDDLE: handled = handleMiddleMouseUp(x, y, mask); break; case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; + case CLICK_BUTTON4: + case CLICK_BUTTON5: + LL_INFOS() << "Handle mouse button " << clicktype + 1 << " up." << LL_ENDL; + break; default: LL_WARNS() << "Unhandled enum." << LL_ENDL; } diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 6749b3be3b..d9b95d311a 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -426,13 +426,14 @@ void callOtherMouseDown(float *pos, MASK mask, int button) gWindowImplementation->getMouseDeltas(deltas); outCoords.mX += deltas[0]; outCoords.mY += deltas[1]; - if (button == 3) + + if (button == 2) { gWindowImplementation->getCallbacks()->handleMiddleMouseDown(gWindowImplementation, outCoords, mask); } else { - gWindowImplementation->getCallbacks()->handleOtherMouseDown(gWindowImplementation, outCoords, mask, button); + gWindowImplementation->getCallbacks()->handleOtherMouseDown(gWindowImplementation, outCoords, mask, button + 1); } } @@ -445,13 +446,13 @@ void callOtherMouseUp(float *pos, MASK mask, int button) gWindowImplementation->getMouseDeltas(deltas); outCoords.mX += deltas[0]; outCoords.mY += deltas[1]; - if (button == 3) + if (button == 2) { gWindowImplementation->getCallbacks()->handleMiddleMouseUp(gWindowImplementation, outCoords, mask); } else { - gWindowImplementation->getCallbacks()->handleOtherMouseUp(gWindowImplementation, outCoords, mask, button); + gWindowImplementation->getCallbacks()->handleOtherMouseUp(gWindowImplementation, outCoords, mask, button + 1); } } -- cgit v1.2.3 From 52c9f57819fe541980d0f2668afa31376f1bb29e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 25 Sep 2019 16:48:36 -0400 Subject: DRTVWR-476: Track change to NSView in Xcode 11's 10.15 SDK. --- indra/llwindow/llopenglview-objc.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 33eed7227a..247e6f8186 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -825,7 +825,7 @@ attributedStringInfo getSegments(NSAttributedString *str) [super setMarkedText:aString selectedRange:selectedRange replacementRange:replacementRange]; if ([aString length] == 0) // this means Input Widow becomes empty { - [_window orderOut:_window]; // Close this to avoid empty Input Window + [self.window orderOut:self.window]; // Close this to avoid empty Input Window } } @@ -849,7 +849,7 @@ attributedStringInfo getSegments(NSAttributedString *str) (mKeyPressed >= 0xF700 && mKeyPressed <= 0xF8FF)) { // this is case a) of above comment - [_window orderOut:_window]; // to avoid empty Input Window + [self.window orderOut:self.window]; // to avoid empty Input Window } } -- cgit v1.2.3