From 16ce373d14199b94729caffcb099d8a6bd37f882 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 9 Mar 2011 20:37:53 -0700 Subject: #787: Horizontal mouse scrolling support, patch by Kakurady Drakenar --- linden/indra/llui/lllineeditor.cpp | 5 +++ linden/indra/llui/lllineeditor.h | 1 + linden/indra/llui/llscrollbar.cpp | 5 +++ linden/indra/llui/llscrollbar.h | 1 + linden/indra/llui/llscrollcontainer.cpp | 17 ++++++++ linden/indra/llui/llscrollcontainer.h | 1 + linden/indra/llui/llview.cpp | 41 ++++++++++++++++++ linden/indra/llui/llview.h | 2 + linden/indra/llwindow/llmousehandler.cpp | 6 +++ linden/indra/llwindow/llmousehandler.h | 1 + linden/indra/llwindow/llwindow.cpp | 4 ++ linden/indra/llwindow/llwindow.h | 1 + linden/indra/llwindow/llwindowmacosx.cpp | 31 +++++++++++--- linden/indra/llwindow/llwindowsdl.cpp | 5 ++- linden/indra/llwindow/llwindowwin32.cpp | 16 +++++++ linden/indra/newview/llagent.cpp | 6 ++- linden/indra/newview/llagent.h | 1 + linden/indra/newview/llfloateranimpreview.cpp | 12 ++++++ linden/indra/newview/llfloateranimpreview.h | 1 + linden/indra/newview/llfloaterimagepreview.cpp | 16 +++++++ linden/indra/newview/llfloaterimagepreview.h | 1 + linden/indra/newview/lltool.cpp | 7 ++++ linden/indra/newview/lltool.h | 1 + linden/indra/newview/llviewerwindow.cpp | 58 ++++++++++++++++++++++++++ linden/indra/newview/llviewerwindow.h | 2 + 25 files changed, 234 insertions(+), 8 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index a3785e4..76b8927 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp @@ -1034,6 +1034,11 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) return handled; } +BOOL LLLineEditor::handleHScrollWheel(S32 x, S32 y, S32 clicks) +{ + mScrollHPos = llclamp(mScrollHPos + clicks * 3, 0, mText.length()); + return TRUE; +} BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) diff --git a/linden/indra/llui/lllineeditor.h b/linden/indra/llui/lllineeditor.h index f9e0621..d217859 100644 --- a/linden/indra/llui/lllineeditor.h +++ b/linden/indra/llui/lllineeditor.h @@ -90,6 +90,7 @@ public: /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleHScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); diff --git a/linden/indra/llui/llscrollbar.cpp b/linden/indra/llui/llscrollbar.cpp index 65086d8..11e6239 100644 --- a/linden/indra/llui/llscrollbar.cpp +++ b/linden/indra/llui/llscrollbar.cpp @@ -426,6 +426,11 @@ BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) changeLine( clicks * mStepSize, TRUE ); return TRUE; } +BOOL LLScrollbar::handleHScrollWheel(S32 x, S32 y, S32 clicks) +{ + changeLine( clicks * mStepSize, TRUE ); + return TRUE; +} BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg) diff --git a/linden/indra/llui/llscrollbar.h b/linden/indra/llui/llscrollbar.h index 0bbf866..6969662 100644 --- a/linden/indra/llui/llscrollbar.h +++ b/linden/indra/llui/llscrollbar.h @@ -69,6 +69,7 @@ public: virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + virtual BOOL handleHScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg); diff --git a/linden/indra/llui/llscrollcontainer.cpp b/linden/indra/llui/llscrollcontainer.cpp index 6f037e2..8737a70 100644 --- a/linden/indra/llui/llscrollcontainer.cpp +++ b/linden/indra/llui/llscrollcontainer.cpp @@ -239,6 +239,23 @@ BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks ) return TRUE; } +BOOL LLScrollableContainerView::handleHScrollWheel( S32 x, S32 y, S32 clicks ) +{ + for( S32 i = SCROLLBAR_COUNT - 1; i >= 0; i++ ) + { + // Note: tries horizontal and then vertical + + // Pretend the mouse is over the scrollbar + if( mScrollbar[i]->handleScrollWheel( 0, 0, clicks ) ) + { + return TRUE; + } + } + + // Eat scroll wheel event (to avoid scrolling nested containers?) + return TRUE; +} + BOOL LLScrollableContainerView::needsToScroll(S32 x, S32 y, LLScrollableContainerView::SCROLL_ORIENTATION axis) const { if(mScrollbar[axis]->getVisible()) diff --git a/linden/indra/llui/llscrollcontainer.h b/linden/indra/llui/llscrollcontainer.h index 70fc908..c18a0db 100644 --- a/linden/indra/llui/llscrollcontainer.h +++ b/linden/indra/llui/llscrollcontainer.h @@ -91,6 +91,7 @@ public: virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual BOOL handleKeyHere(KEY key, MASK mask); virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + virtual BOOL handleHScrollWheel( S32 x, S32 y, S32 clicks ); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp index d4eda8f..507c5f5 100644 --- a/linden/indra/llui/llview.cpp +++ b/linden/indra/llui/llview.cpp @@ -960,6 +960,19 @@ BOOL LLView::handleScrollWheel(S32 x, S32 y, S32 clicks) return handled; } +BOOL LLView::handleHScrollWheel(S32 x, S32 y, S32 clicks) +{ + BOOL handled = FALSE; + if( getVisible() && getEnabled() ) + { + handled = childrenHandleHScrollWheel( x, y, clicks ) != NULL; + if( !handled && blockMouseEvent(x, y) ) + { + handled = TRUE; + } + } + return handled; +} BOOL LLView::handleRightMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = childrenHandleRightMouseDown( x, y, mask ) != NULL; @@ -1032,6 +1045,34 @@ LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) return handled_view; } +LLView* LLView::childrenHandleHScrollWheel(S32 x, S32 y, S32 clicks) +{ + LLView* handled_view = NULL; + if (getVisible() && getEnabled() ) + { + for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + { + LLView* viewp = *child_it; + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if (viewp->pointInView(local_x, local_y) + && viewp->getVisible() + && viewp->getEnabled() + && viewp->handleHScrollWheel( local_x, local_y, clicks )) + { + if (sDebugMouseHandling) + { + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; + } + + handled_view = viewp; + break; + } + } + } + return handled_view; +} + LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) { LLView* handled_view = NULL; diff --git a/linden/indra/llui/llview.h b/linden/indra/llui/llview.h index 1c8ab31..9243f4f 100644 --- a/linden/indra/llui/llview.h +++ b/linden/indra/llui/llview.h @@ -473,6 +473,7 @@ public: /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ BOOL handleHScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); // Display mToolTipMsg if no child handles it. @@ -613,6 +614,7 @@ protected: LLView* childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask); LLView* childrenHandleDoubleClick(S32 x, S32 y, MASK mask); LLView* childrenHandleScrollWheel(S32 x, S32 y, S32 clicks); + LLView* childrenHandleHScrollWheel(S32 x, S32 y, S32 clicks); LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask); LLView* childrenHandleRightMouseUp(S32 x, S32 y, MASK mask); diff --git a/linden/indra/llwindow/llmousehandler.cpp b/linden/indra/llwindow/llmousehandler.cpp index ae2f147..e3ea979 100644 --- a/linden/indra/llwindow/llmousehandler.cpp +++ b/linden/indra/llwindow/llmousehandler.cpp @@ -57,3 +57,9 @@ BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType cli } return handled; } + +BOOL LLMouseHandler::handleHScrollWheel(S32 x, S32 y, S32 clicks) +{ + BOOL handled = FALSE; + return handled; +} diff --git a/linden/indra/llwindow/llmousehandler.h b/linden/indra/llwindow/llmousehandler.h index 7bd0f2e..1a4ea65 100644 --- a/linden/indra/llwindow/llmousehandler.h +++ b/linden/indra/llwindow/llmousehandler.h @@ -67,6 +67,7 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; + virtual BOOL handleHScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; virtual const std::string& getName() const = 0; diff --git a/linden/indra/llwindow/llwindow.cpp b/linden/indra/llwindow/llwindow.cpp index 53ca68d..6ac42b2 100644 --- a/linden/indra/llwindow/llwindow.cpp +++ b/linden/indra/llwindow/llwindow.cpp @@ -155,6 +155,10 @@ void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks) { } +void LLWindowCallbacks::handleHScrollWheel(LLWindow *window, S32 clicks) +{ +} + void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height) { } diff --git a/linden/indra/llwindow/llwindow.h b/linden/indra/llwindow/llwindow.h index 5e93ab3..cbcfc5a 100644 --- a/linden/indra/llwindow/llwindow.h +++ b/linden/indra/llwindow/llwindow.h @@ -69,6 +69,7 @@ public: virtual BOOL handleActivateApp(LLWindow *window, BOOL activating); virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); virtual void handleScrollWheel(LLWindow *window, S32 clicks); + virtual void handleHScrollWheel(LLWindow *window, S32 clicks); virtual void handleResize(LLWindow *window, S32 width, S32 height); virtual void handleFocus(LLWindow *window); virtual void handleFocusLost(LLWindow *window); diff --git a/linden/indra/llwindow/llwindowmacosx.cpp b/linden/indra/llwindow/llwindowmacosx.cpp index 99daa4d..93bff99 100644 --- a/linden/indra/llwindow/llwindowmacosx.cpp +++ b/linden/indra/llwindow/llwindowmacosx.cpp @@ -2384,6 +2384,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e HIPoint location = {0.0f, 0.0f}; UInt32 modifiers = 0; UInt32 clickCount = 1; + EventMouseWheelAxis wheelAxis = kEventMouseWheelAxisX; long wheelDelta = 0; LLCoordScreen inCoords; LLCoordGL outCoords; @@ -2393,6 +2394,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(location), NULL, &location); GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers); GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(wheelDelta), NULL, &wheelDelta); + GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(wheelAxis), NULL, &wheelAxis); GetEventParameter(event, kEventParamClickCount, typeUInt32, NULL, sizeof(clickCount), NULL, &clickCount); inCoords.mX = llround(location.x); @@ -2501,14 +2503,31 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e case kEventMouseWheelMoved: { - static S32 z_delta = 0; + switch (wheelAxis){ + case kEventMouseWheelAxisX: - z_delta += wheelDelta; + static S32 wheel_x_delta = 0; - if (z_delta <= -WHEEL_DELTA || WHEEL_DELTA <= z_delta) - { - mCallbacks->handleScrollWheel(this, -z_delta / WHEEL_DELTA); - z_delta = 0; + wheel_x_delta += wheelDelta; + + if (wheel_x_delta <= -WHEEL_DELTA || WHEEL_DELTA <= wheel_x_delta) + { + mCallbacks->handleHScrollWheel(this, wheel_x_delta / WHEEL_DELTA); + wheel_x_delta = 0; + } + break; + case kEventMouseWheelAxisY: + + static S32 wheel_y_delta = 0; + + wheel_y_delta += wheelDelta; + + if (wheel_y_delta <= -WHEEL_DELTA || WHEEL_DELTA <= wheel_y_delta) + { + mCallbacks->handleScrollWheel(this, -wheel_y_delta / WHEEL_DELTA); + wheel_y_delta = 0; + } + break; } } result = noErr; diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp index f7d7587..edfe33b 100644 --- a/linden/indra/llwindow/llwindowsdl.cpp +++ b/linden/indra/llwindow/llwindowsdl.cpp @@ -1731,7 +1731,10 @@ void LLWindowSDL::gatherInput() mCallbacks->handleScrollWheel(this, -1); else if (event.button.button == 5) // mousewheel down...thanks to X11 for making SDL consider these "buttons". mCallbacks->handleScrollWheel(this, 1); - + else if (event.button.button == 6) + mCallbacks->handleHScrollWheel(this, -1); + else if (event.button.button == 7) + mCallbacks->handleHScrollWheel(this, 1); break; } diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp index 7bc9a3b..dacee34 100644 --- a/linden/indra/llwindow/llwindowwin32.cpp +++ b/linden/indra/llwindow/llwindowwin32.cpp @@ -2259,6 +2259,22 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ } return 0; } +#ifdef WM_MOUSEHWHEEL + case WM_MOUSEHWHEEL: + { + window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEHWHEEL"); + static short z_delta = 0; + + z_delta += HIWORD(w_param); + + if (z_delta <= -WHEEL_DELTA || WHEEL_DELTA <= z_delta) + { + window_imp->mCallbacks->handleHScrollWheel(window_imp, z_delta / WHEEL_DELTA); + z_delta = 0; + } + return 0; + } +#endif //WM_MOUSEHWHEEL /* // TODO: add this after resolving _WIN32_WINNT issue case WM_MOUSELEAVE: diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index 515d588..871c90d 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp @@ -4043,7 +4043,11 @@ void LLAgent::handleScrollWheel(S32 clicks) } } } - +void LLAgent::handleHScrollWheel(S32 clicks) +{ + const F32 RAD_PER_CLICK = -F_PI / 16.0f; + cameraOrbitAround(RAD_PER_CLICK * clicks); +} //----------------------------------------------------------------------------- // getCameraMinOffGround() diff --git a/linden/indra/newview/llagent.h b/linden/indra/newview/llagent.h index fe50bf5..cea55fb 100644 --- a/linden/indra/newview/llagent.h +++ b/linden/indra/newview/llagent.h @@ -163,6 +163,7 @@ public: void endAnimationUpdateUI(); void setKey(const S32 direction, S32 &key); // sets key to +1 for +direction, -1 for -direction void handleScrollWheel(S32 clicks); // mousewheel driven zoom + void handleHScrollWheel(S32 clicks); void setAvatarObject(LLVOAvatar *avatar); diff --git a/linden/indra/newview/llfloateranimpreview.cpp b/linden/indra/newview/llfloateranimpreview.cpp index 232530c..6d7f350 100644 --- a/linden/indra/newview/llfloateranimpreview.cpp +++ b/linden/indra/newview/llfloateranimpreview.cpp @@ -617,6 +617,18 @@ BOOL LLFloaterAnimPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) } //----------------------------------------------------------------------------- +// handleHScrollWheel() +//----------------------------------------------------------------------------- +BOOL LLFloaterAnimPreview::handleHScrollWheel(S32 x, S32 y, S32 clicks) +{ + const F32 RAD_PER_CLICK = -F_PI / 16.0f; + mAnimPreview->rotate(RAD_PER_CLICK * clicks, 0); + mAnimPreview->requestUpdate(); + + return TRUE; +} + +//----------------------------------------------------------------------------- // onMouseCaptureLost() //----------------------------------------------------------------------------- void LLFloaterAnimPreview::onMouseCaptureLost() diff --git a/linden/indra/newview/llfloateranimpreview.h b/linden/indra/newview/llfloateranimpreview.h index e8f79e2..0107165 100644 --- a/linden/indra/newview/llfloateranimpreview.h +++ b/linden/indra/newview/llfloateranimpreview.h @@ -80,6 +80,7 @@ public: BOOL handleMouseUp(S32 x, S32 y, MASK mask); BOOL handleHover(S32 x, S32 y, MASK mask); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + BOOL handleHScrollWheel(S32 x, S32 y, S32 clicks); void onMouseCaptureLost(); void refresh(); diff --git a/linden/indra/newview/llfloaterimagepreview.cpp b/linden/indra/newview/llfloaterimagepreview.cpp index aa8a94f..e792f8c 100644 --- a/linden/indra/newview/llfloaterimagepreview.cpp +++ b/linden/indra/newview/llfloaterimagepreview.cpp @@ -616,6 +616,22 @@ BOOL LLFloaterImagePreview::handleScrollWheel(S32 x, S32 y, S32 clicks) return TRUE; } +BOOL LLFloaterImagePreview::handleHScrollWheel(S32 x, S32 y, S32 clicks) +{ + const F32 RAD_PER_CLICK = -F_PI / 16.0f; + + if (mPreviewRect.pointInRect(x, y) && mAvatarPreview) + { + mAvatarPreview->rotate(RAD_PER_CLICK * clicks, 0); + mAvatarPreview->refresh(); + + mSculptedPreview->rotate(RAD_PER_CLICK * clicks, 0); + mSculptedPreview->refresh(); + } + + return TRUE; +} + //----------------------------------------------------------------------------- // onMouseCaptureLost() //----------------------------------------------------------------------------- diff --git a/linden/indra/newview/llfloaterimagepreview.h b/linden/indra/newview/llfloaterimagepreview.h index 6a4de3d..1ccfeb4 100644 --- a/linden/indra/newview/llfloaterimagepreview.h +++ b/linden/indra/newview/llfloaterimagepreview.h @@ -115,6 +115,7 @@ public: BOOL handleMouseUp(S32 x, S32 y, MASK mask); BOOL handleHover(S32 x, S32 y, MASK mask); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + BOOL handleHScrollWheel(S32 x, S32 y, S32 clicks); static void onMouseCaptureLostImagePreview(LLMouseHandler*); static void setUploadAmount(S32 amount) { sUploadAmount = amount; } diff --git a/linden/indra/newview/lltool.cpp b/linden/indra/newview/lltool.cpp index 6a3ada0..df2191b 100644 --- a/linden/indra/newview/lltool.cpp +++ b/linden/indra/newview/lltool.cpp @@ -104,6 +104,13 @@ BOOL LLTool::handleScrollWheel(S32 x, S32 y, S32 clicks) return FALSE; } +BOOL LLTool::handleHScrollWheel(S32 x, S32 y, S32 clicks) +{ + // by default, didn't handle it + // llinfos << "LLTool::handleScrollWheel" << llendl; + return FALSE; +} + BOOL LLTool::handleDoubleClick(S32 x,S32 y,MASK mask) { // llinfos << "LLTool::handleDoubleClick" << llendl; diff --git a/linden/indra/newview/lltool.h b/linden/indra/newview/lltool.h index f954a8c..26e6623 100644 --- a/linden/indra/newview/lltool.h +++ b/linden/indra/newview/lltool.h @@ -62,6 +62,7 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + virtual BOOL handleHScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index 920d42e..b4ef3ff 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp @@ -1134,6 +1134,10 @@ void LLViewerWindow::handleScrollWheel(LLWindow *window, S32 clicks) { handleScrollWheel( clicks ); } +void LLViewerWindow::handleHScrollWheel(LLWindow *window, S32 clicks) +{ + handleHScrollWheel( clicks ); +} void LLViewerWindow::handleWindowBlock(LLWindow *window) { @@ -2486,6 +2490,60 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) return; } +void LLViewerWindow::handleHScrollWheel(S32 clicks) +{ + LLView::sMouseHandlerMessage.clear(); + + gMouseIdleTimer.reset(); + + // Hide tooltips + if( mToolTip ) + { + mToolTip->setVisible( FALSE ); + } + + LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); + if( mouse_captor ) + { + S32 local_x; + S32 local_y; + mouse_captor->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y ); + mouse_captor->handleHScrollWheel(local_x, local_y, clicks); + if (LLView::sDebugMouseHandling) + { + llinfos << "Tilt Wheel handled by captor " << mouse_captor->getName() << llendl; + } + return; + } + + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + if (top_ctrl) + { + S32 local_x; + S32 local_y; + top_ctrl->screenPointToLocal( mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y ); + if (top_ctrl->handleHScrollWheel(local_x, local_y, clicks)) return; + } + + if (mRootView->handleHScrollWheel(mCurrentMousePoint.mX, mCurrentMousePoint.mY, clicks) ) + { + if (LLView::sDebugMouseHandling) + { + llinfos << "Tilt Wheel" << LLView::sMouseHandlerMessage << llendl; + } + return; + } + else if (LLView::sDebugMouseHandling) + { + llinfos << "Tilt Wheel not handled by view" << llendl; + } + + + gAgent.handleHScrollWheel(clicks); + + return; +} + void LLViewerWindow::moveCursorToCenter() { S32 x = mVirtualWindowRect.getWidth() / 2; diff --git a/linden/indra/newview/llviewerwindow.h b/linden/indra/newview/llviewerwindow.h index d26d820..fd159e1 100644 --- a/linden/indra/newview/llviewerwindow.h +++ b/linden/indra/newview/llviewerwindow.h @@ -172,6 +172,7 @@ public: /*virtual*/ void handleMenuSelect(LLWindow *window, S32 menu_item); /*virtual*/ BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height); /*virtual*/ void handleScrollWheel(LLWindow *window, S32 clicks); + /*virtual*/ void handleHScrollWheel(LLWindow *window, S32 clicks); /*virtual*/ BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ void handleWindowBlock(LLWindow *window); /*virtual*/ void handleWindowUnblock(LLWindow *window); @@ -266,6 +267,7 @@ public: BOOL handleKey(KEY key, MASK mask); void handleScrollWheel (S32 clicks); + void handleHScrollWheel (S32 clicks); // Hide normal UI when a logon fails, re-show everything when logon is attempted again void setNormalControlsVisible( BOOL visible ); -- cgit v1.1