aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow
diff options
context:
space:
mode:
authorMcCabe Maxsted2011-03-09 20:37:53 -0700
committerMcCabe Maxsted2011-03-09 20:37:53 -0700
commit16ce373d14199b94729caffcb099d8a6bd37f882 (patch)
treebd513a4f6107d57f7f7a5fe1552852f8fccc277f /linden/indra/llwindow
parentFixed windows compile error (diff)
downloadmeta-impy-16ce373d14199b94729caffcb099d8a6bd37f882.zip
meta-impy-16ce373d14199b94729caffcb099d8a6bd37f882.tar.gz
meta-impy-16ce373d14199b94729caffcb099d8a6bd37f882.tar.bz2
meta-impy-16ce373d14199b94729caffcb099d8a6bd37f882.tar.xz
#787: Horizontal mouse scrolling support, patch by Kakurady Drakenar
Diffstat (limited to 'linden/indra/llwindow')
-rw-r--r--linden/indra/llwindow/llmousehandler.cpp6
-rw-r--r--linden/indra/llwindow/llmousehandler.h1
-rw-r--r--linden/indra/llwindow/llwindow.cpp4
-rw-r--r--linden/indra/llwindow/llwindow.h1
-rw-r--r--linden/indra/llwindow/llwindowmacosx.cpp31
-rw-r--r--linden/indra/llwindow/llwindowsdl.cpp5
-rw-r--r--linden/indra/llwindow/llwindowwin32.cpp16
7 files changed, 57 insertions, 7 deletions
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
57 } 57 }
58 return handled; 58 return handled;
59} 59}
60
61BOOL LLMouseHandler::handleHScrollWheel(S32 x, S32 y, S32 clicks)
62{
63 BOOL handled = FALSE;
64 return handled;
65}
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:
67 67
68 virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; 68 virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0;
69 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; 69 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
70 virtual BOOL handleHScrollWheel(S32 x, S32 y, S32 clicks);
70 virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0; 71 virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0;
71 virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; 72 virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; };
72 virtual const std::string& getName() const = 0; 73 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)
155{ 155{
156} 156}
157 157
158void LLWindowCallbacks::handleHScrollWheel(LLWindow *window, S32 clicks)
159{
160}
161
158void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height) 162void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height)
159{ 163{
160} 164}
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:
69 virtual BOOL handleActivateApp(LLWindow *window, BOOL activating); 69 virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
70 virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); 70 virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
71 virtual void handleScrollWheel(LLWindow *window, S32 clicks); 71 virtual void handleScrollWheel(LLWindow *window, S32 clicks);
72 virtual void handleHScrollWheel(LLWindow *window, S32 clicks);
72 virtual void handleResize(LLWindow *window, S32 width, S32 height); 73 virtual void handleResize(LLWindow *window, S32 width, S32 height);
73 virtual void handleFocus(LLWindow *window); 74 virtual void handleFocus(LLWindow *window);
74 virtual void handleFocusLost(LLWindow *window); 75 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
2384 HIPoint location = {0.0f, 0.0f}; 2384 HIPoint location = {0.0f, 0.0f};
2385 UInt32 modifiers = 0; 2385 UInt32 modifiers = 0;
2386 UInt32 clickCount = 1; 2386 UInt32 clickCount = 1;
2387 EventMouseWheelAxis wheelAxis = kEventMouseWheelAxisX;
2387 long wheelDelta = 0; 2388 long wheelDelta = 0;
2388 LLCoordScreen inCoords; 2389 LLCoordScreen inCoords;
2389 LLCoordGL outCoords; 2390 LLCoordGL outCoords;
@@ -2393,6 +2394,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
2393 GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(location), NULL, &location); 2394 GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(location), NULL, &location);
2394 GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers); 2395 GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers);
2395 GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(wheelDelta), NULL, &wheelDelta); 2396 GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(wheelDelta), NULL, &wheelDelta);
2397 GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(wheelAxis), NULL, &wheelAxis);
2396 GetEventParameter(event, kEventParamClickCount, typeUInt32, NULL, sizeof(clickCount), NULL, &clickCount); 2398 GetEventParameter(event, kEventParamClickCount, typeUInt32, NULL, sizeof(clickCount), NULL, &clickCount);
2397 2399
2398 inCoords.mX = llround(location.x); 2400 inCoords.mX = llround(location.x);
@@ -2501,14 +2503,31 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
2501 2503
2502 case kEventMouseWheelMoved: 2504 case kEventMouseWheelMoved:
2503 { 2505 {
2504 static S32 z_delta = 0; 2506 switch (wheelAxis){
2507 case kEventMouseWheelAxisX:
2505 2508
2506 z_delta += wheelDelta; 2509 static S32 wheel_x_delta = 0;
2507 2510
2508 if (z_delta <= -WHEEL_DELTA || WHEEL_DELTA <= z_delta) 2511 wheel_x_delta += wheelDelta;
2509 { 2512
2510 mCallbacks->handleScrollWheel(this, -z_delta / WHEEL_DELTA); 2513 if (wheel_x_delta <= -WHEEL_DELTA || WHEEL_DELTA <= wheel_x_delta)
2511 z_delta = 0; 2514 {
2515 mCallbacks->handleHScrollWheel(this, wheel_x_delta / WHEEL_DELTA);
2516 wheel_x_delta = 0;
2517 }
2518 break;
2519 case kEventMouseWheelAxisY:
2520
2521 static S32 wheel_y_delta = 0;
2522
2523 wheel_y_delta += wheelDelta;
2524
2525 if (wheel_y_delta <= -WHEEL_DELTA || WHEEL_DELTA <= wheel_y_delta)
2526 {
2527 mCallbacks->handleScrollWheel(this, -wheel_y_delta / WHEEL_DELTA);
2528 wheel_y_delta = 0;
2529 }
2530 break;
2512 } 2531 }
2513 } 2532 }
2514 result = noErr; 2533 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()
1731 mCallbacks->handleScrollWheel(this, -1); 1731 mCallbacks->handleScrollWheel(this, -1);
1732 else if (event.button.button == 5) // mousewheel down...thanks to X11 for making SDL consider these "buttons". 1732 else if (event.button.button == 5) // mousewheel down...thanks to X11 for making SDL consider these "buttons".
1733 mCallbacks->handleScrollWheel(this, 1); 1733 mCallbacks->handleScrollWheel(this, 1);
1734 1734 else if (event.button.button == 6)
1735 mCallbacks->handleHScrollWheel(this, -1);
1736 else if (event.button.button == 7)
1737 mCallbacks->handleHScrollWheel(this, 1);
1735 break; 1738 break;
1736 } 1739 }
1737 1740
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_
2259 } 2259 }
2260 return 0; 2260 return 0;
2261 } 2261 }
2262#ifdef WM_MOUSEHWHEEL
2263 case WM_MOUSEHWHEEL:
2264 {
2265 window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEHWHEEL");
2266 static short z_delta = 0;
2267
2268 z_delta += HIWORD(w_param);
2269
2270 if (z_delta <= -WHEEL_DELTA || WHEEL_DELTA <= z_delta)
2271 {
2272 window_imp->mCallbacks->handleHScrollWheel(window_imp, z_delta / WHEEL_DELTA);
2273 z_delta = 0;
2274 }
2275 return 0;
2276 }
2277#endif //WM_MOUSEHWHEEL
2262 /* 2278 /*
2263 // TODO: add this after resolving _WIN32_WINNT issue 2279 // TODO: add this after resolving _WIN32_WINNT issue
2264 case WM_MOUSELEAVE: 2280 case WM_MOUSELEAVE: