summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_mac.mm
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-10-02 06:40:17 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-10-02 06:40:17 (GMT)
commit17dc26e3e7a65b6eb0c0980a76c8fbe7bd37c690 (patch)
treeee9a982c144fb636ec22cdf7dd27de37725ff320 /src/gui/kernel/qapplication_mac.mm
parentb148b182b5b48d60c2b57d8b74ad0f30272bb578 (diff)
parent7ea326d796a6d2ecb13b961c576c82a797d84706 (diff)
downloadQt-17dc26e3e7a65b6eb0c0980a76c8fbe7bd37c690.zip
Qt-17dc26e3e7a65b6eb0c0980a76c8fbe7bd37c690.tar.gz
Qt-17dc26e3e7a65b6eb0c0980a76c8fbe7bd37c690.tar.bz2
Merge commit 'qt-mainline/4.6' into kinetic-declarativeui
Conflicts: configure.exe
Diffstat (limited to 'src/gui/kernel/qapplication_mac.mm')
-rw-r--r--src/gui/kernel/qapplication_mac.mm31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index a656c7f..a95ae9d 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -960,7 +960,18 @@ struct QMacAppleEventTypeSpec {
{ kCoreEventClass, kAEQuitApplication },
{ kCoreEventClass, kAEOpenDocuments }
};
+
#ifndef QT_MAC_USE_COCOA
+
+#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
+enum
+{
+ kEventMouseScroll = 11,
+ kEventParamMouseWheelSmoothVerticalDelta = 'saxy',
+ kEventParamMouseWheelSmoothHorizontalDelta = 'saxx',
+};
+#endif
+
/* watched events */
static EventTypeSpec app_events[] = {
{ kEventClassQt, kEventQtRequestWindowChange },
@@ -1675,13 +1686,15 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
// (actually two events; one for horizontal and one for vertical).
// As a results of this, and to make sure we dont't receive duplicate events,
// we try to detect when this happend by checking the 'compatibilityEvent'.
+ const int scrollFactor = 4 * 8;
SInt32 mdelt = 0;
GetEventParameter(event, kEventParamMouseWheelSmoothHorizontalDelta, typeSInt32, 0,
sizeof(mdelt), 0, &mdelt);
- wheel_deltaX = mdelt;
+ wheel_deltaX = mdelt * scrollFactor;
+ mdelt = 0;
GetEventParameter(event, kEventParamMouseWheelSmoothVerticalDelta, typeSInt32, 0,
sizeof(mdelt), 0, &mdelt);
- wheel_deltaY = mdelt;
+ wheel_deltaY = mdelt * scrollFactor;
GetEventParameter(event, kEventParamEventRef, typeEventRef, 0,
sizeof(compatibilityEvent), 0, &compatibilityEvent);
} else if (ekind == kEventMouseWheelMoved) {
@@ -1693,10 +1706,14 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
EventMouseWheelAxis axis;
GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, 0,
sizeof(axis), 0, &axis);
+
+ // The 'new' event has acceleration applied by the OS, while the old (on
+ // Carbon only), has not. So we introduce acceleration here to be consistent:
+ int scrollFactor = 120 * qMin(5, qAbs(mdelt));
if (axis == kEventMouseWheelAxisX)
- wheel_deltaX = mdelt * 120;
+ wheel_deltaX = mdelt * scrollFactor;
else
- wheel_deltaY = mdelt * 120;
+ wheel_deltaY = mdelt * scrollFactor;
}
}
@@ -2649,7 +2666,11 @@ int QApplication::keyboardInputInterval()
void QApplication::setWheelScrollLines(int n)
{
- QApplicationPrivate::wheel_scroll_lines = n;
+ Q_UNUSED(n);
+ // On Mac, acceleration is handled by the OS. Multiplying wheel scroll
+ // deltas with n will not be as cross platform as one might think! So
+ // we choose to go native in this case (and let wheel_scroll_lines == 1).
+ // QApplicationPrivate::wheel_scroll_lines = n;
}
int QApplication::wheelScrollLines()