summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-09-10 19:49:15 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-09-10 19:49:15 +0300
commit98b28e58813035df597d01e18657b73a94635ecd (patch)
treebf24036cf4f292477ded7e13ed9f6866fd042673 /indra/llwindow
parentb31a93baa83dc232e331a0420800fcb6d7faa2d3 (diff)
SL-11910 [Win] Horizontal scroll
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llmousehandler.h1
-rw-r--r--indra/llwindow/llwindowcallbacks.cpp4
-rw-r--r--indra/llwindow/llwindowcallbacks.h1
-rw-r--r--indra/llwindow/llwindowwin32.cpp36
4 files changed, 42 insertions, 0 deletions
diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h
index 8e6fbdb4e3..1dcd0348d8 100644
--- a/indra/llwindow/llmousehandler.h
+++ b/indra/llwindow/llmousehandler.h
@@ -66,6 +66,7 @@ public:
virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
+ virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) = 0;
virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) = 0;
virtual const std::string& getName() const = 0;
diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp
index c01f574375..be61e1e16c 100644
--- a/indra/llwindow/llwindowcallbacks.cpp
+++ b/indra/llwindow/llwindowcallbacks.cpp
@@ -130,6 +130,10 @@ void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks)
{
}
+void LLWindowCallbacks::handleScrollHWheel(LLWindow *window, S32 clicks)
+{
+}
+
void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height)
{
}
diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h
index 9304446f8f..3b18648138 100644
--- a/indra/llwindow/llwindowcallbacks.h
+++ b/indra/llwindow/llwindowcallbacks.h
@@ -56,6 +56,7 @@ public:
virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
virtual void handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask);
virtual void handleScrollWheel(LLWindow *window, S32 clicks);
+ virtual void handleScrollHWheel(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/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 8fefb119bc..3c69aa98c4 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -2662,6 +2662,42 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
return 0;
}
*/
+ case WM_MOUSEHWHEEL:
+ {
+ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEHWHEEL");
+ static short h_delta = 0;
+
+ RECT client_rect;
+
+ // eat scroll events that occur outside our window, since we use mouse position to direct scroll
+ // instead of keyboard focus
+ // NOTE: mouse_coord is in *window* coordinates for scroll events
+ POINT mouse_coord = {(S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param)};
+
+ if (ScreenToClient(window_imp->mWindowHandle, &mouse_coord)
+ && GetClientRect(window_imp->mWindowHandle, &client_rect))
+ {
+ // we have a valid mouse point and client rect
+ if (mouse_coord.x < client_rect.left || client_rect.right < mouse_coord.x
+ || mouse_coord.y < client_rect.top || client_rect.bottom < mouse_coord.y)
+ {
+ // mouse is outside of client rect, so don't do anything
+ return 0;
+ }
+ }
+
+ S16 incoming_h_delta = HIWORD(w_param);
+ h_delta += incoming_h_delta;
+
+ // If the user rapidly spins the wheel, we can get messages with
+ // large deltas, like 480 or so. Thus we need to scroll more quickly.
+ if (h_delta <= -WHEEL_DELTA || WHEEL_DELTA <= h_delta)
+ {
+ window_imp->mCallbacks->handleScrollHWheel(window_imp, h_delta / WHEEL_DELTA);
+ h_delta = 0;
+ }
+ return 0;
+ }
// Handle mouse movement within the window
case WM_MOUSEMOVE:
{