summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_mac.mm
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-10-09 11:35:16 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-10-09 11:35:16 (GMT)
commit6a5be55e5f96758daeca44899bc8598c76c214e7 (patch)
tree84d1c808bd491a29bbd265e515563ef79dbc3213 /src/gui/kernel/qapplication_mac.mm
parentb8eb2784a1c1a9812d09fca7c8722624f12dbd1c (diff)
parent2caa16ff98348b043ecc3598e5b9af4a2e2ae3bc (diff)
downloadQt-6a5be55e5f96758daeca44899bc8598c76c214e7.zip
Qt-6a5be55e5f96758daeca44899bc8598c76c214e7.tar.gz
Qt-6a5be55e5f96758daeca44899bc8598c76c214e7.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/gui/kernel/qapplication_mac.mm')
-rw-r--r--src/gui/kernel/qapplication_mac.mm26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index a95ae9d..f9c8aa3 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1708,12 +1708,30 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
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));
+ // Carbon only), has not. So we introduce acceleration here to be consistent.
+ // The acceleration is trying to respect both pixel based and line scrolling,
+ // which turns out to be rather difficult.
+ int linesToScroll = mdelt > 0 ? 1 : -1;
+ static QTime t;
+ int elapsed = t.elapsed();
+ t.restart();
+ if (elapsed < 20)
+ linesToScroll *= 120;
+ else if (elapsed < 30)
+ linesToScroll *= 60;
+ else if (elapsed < 50)
+ linesToScroll *= 30;
+ else if (elapsed < 100)
+ linesToScroll *= 6;
+ else if (elapsed < 200)
+ linesToScroll *= 3;
+ else if (elapsed < 300)
+ linesToScroll *= 2;
+
if (axis == kEventMouseWheelAxisX)
- wheel_deltaX = mdelt * scrollFactor;
+ wheel_deltaX = linesToScroll * 120;
else
- wheel_deltaY = mdelt * scrollFactor;
+ wheel_deltaY = linesToScroll * 120;
}
}