summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowwin32.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-01-08 16:33:43 -0500
committerLoren Shih <seraph@lindenlab.com>2010-01-08 16:33:43 -0500
commitd9b83077867f6171743c934caf868d8e961152c4 (patch)
tree0dca320e442f8844fbdb522666453a0673f9e822 /indra/llwindow/llwindowwin32.cpp
parenta2d4b740ed1e633b1e479157b74fe3181beeaa2b (diff)
parent0a3781673f7e95110d33df0332a4abe238f4c769 (diff)
automated merge viewer2.0->viewer2.0
Diffstat (limited to 'indra/llwindow/llwindowwin32.cpp')
-rw-r--r--indra/llwindow/llwindowwin32.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 3b9c840e72..b591111b75 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -2184,7 +2184,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
{
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONUP");
LLFastTimer t2(FTM_MOUSEHANDLER);
- // Because we move the cursor position in tllviewerhe app, we need to query
+ // 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
@@ -2214,7 +2214,27 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEWHEEL");
static short z_delta = 0;
- z_delta += HIWORD(w_param);
+ 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_z_delta = HIWORD(w_param);
+ z_delta += incoming_z_delta;
// cout << "z_delta " << z_delta << endl;
// current mouse wheels report changes in increments of zDelta (+120, -120)