summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_win.cpp
diff options
context:
space:
mode:
authorminiak <milan.burda@gmail.com>2009-06-05 10:50:31 (GMT)
committerMarius Storm-Olsen <marius@trolltech.com>2009-06-05 10:50:31 (GMT)
commitf04af57ba71e8a4cd3c19f6e1a283290cc5280d4 (patch)
tree6dffe41ca3e9ec4394afaa4bad61f6e01d33ad22 /src/gui/kernel/qapplication_win.cpp
parent754f8968332e712d590a6ee984118536c0447348 (diff)
downloadQt-f04af57ba71e8a4cd3c19f6e1a283290cc5280d4.zip
Qt-f04af57ba71e8a4cd3c19f6e1a283290cc5280d4.tar.gz
Qt-f04af57ba71e8a4cd3c19f6e1a283290cc5280d4.tar.bz2
Fix for Qt issue #218037 - Add support for the WM_MOUSEHWHEEL message on Windows
Merge-request: 384 Reviewed-by: Marius Storm-Olsen <marius@trolltech.com>
Diffstat (limited to 'src/gui/kernel/qapplication_win.cpp')
-rw-r--r--src/gui/kernel/qapplication_win.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 7e97784..60f3edf 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1408,6 +1408,7 @@ static bool qt_is_translatable_mouse_event(UINT message)
return (message >= WM_MOUSEFIRST && message <= WM_MOUSELAST ||
message >= WM_XBUTTONDOWN && message <= WM_XBUTTONDBLCLK)
&& message != WM_MOUSEWHEEL
+ && message != WM_MOUSEHWHEEL
#ifndef Q_WS_WINCE
|| message >= WM_NCMOUSEMOVE && message <= WM_NCMBUTTONDBLCLK
@@ -1758,6 +1759,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
break;
case WM_MOUSEWHEEL:
+ case WM_MOUSEHWHEEL:
result = widget->translateWheelEvent(msg);
break;
@@ -2657,6 +2659,7 @@ bool qt_try_modal(QWidget *widget, MSG *msg, int& ret)
#endif
if ((type >= WM_MOUSEFIRST && type <= WM_MOUSELAST) ||
type == WM_MOUSEWHEEL || type == (int)WM95_MOUSEWHEEL ||
+ type == WM_MOUSEHWHEEL ||
type == WM_MOUSELEAVE ||
(type >= WM_KEYFIRST && type <= WM_KEYLAST)
#ifndef Q_WS_WINCE
@@ -3268,12 +3271,12 @@ bool QETWidget::translateWheelEvent(const MSG &msg)
state = translateButtonState(GET_KEYSTATE_WPARAM(msg.wParam), 0, 0);
int delta;
- if (msg.message == WM_MOUSEWHEEL)
+ if (msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL)
delta = (short) HIWORD (msg.wParam);
else
delta = (int) msg.wParam;
- Qt::Orientation orient = (state&Qt::AltModifier
+ Qt::Orientation orient = (msg.message == WM_MOUSEHWHEEL || state&Qt::AltModifier
#if 0
// disabled for now - Trenton's one-wheel mouse makes trouble...
// "delta" for usual wheels is +-120. +-240 seems to indicate
@@ -3287,6 +3290,13 @@ bool QETWidget::translateWheelEvent(const MSG &msg)
#endif
) ? Qt::Horizontal : Qt::Vertical;
+ // according to the MSDN documentation on WM_MOUSEHWHEEL:
+ // a positive value indicates that the wheel was rotated to the right;
+ // a negative value indicates that the wheel was rotated to the left.
+ // Qt defines this value as the exact opposite, so we have to flip the value!
+ if (msg.message == WM_MOUSEHWHEEL)
+ delta = -delta;
+
QPoint globalPos;
globalPos.rx() = (short)LOWORD (msg.lParam);