Chromium Code Reviews| Index: ui/events/cocoa/events_mac.mm |
| diff --git a/ui/events/cocoa/events_mac.mm b/ui/events/cocoa/events_mac.mm |
| index b9f010559ef392a0cf732d796760f1548884ee82..cb85adb64448375786303a580ebb5c27f0a6fbef 100644 |
| --- a/ui/events/cocoa/events_mac.mm |
| +++ b/ui/events/cocoa/events_mac.mm |
| @@ -6,6 +6,8 @@ |
| #include <Cocoa/Cocoa.h> |
| +#import "base/mac/mac_util.h" |
| +#import "base/mac/sdk_forward_declarations.h" |
| #include "base/logging.h" |
| #include "base/time/time.h" |
| #include "build/build_config.h" |
| @@ -130,14 +132,18 @@ int GetChangedMouseButtonFlagsFromNative( |
| } |
| gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& event) { |
| - // Empirically, a value of 0.1 is typical for one mousewheel click. Positive |
| - // values when scrolling up or to the left. Scrolling quickly results in a |
| - // higher delta per click, up to about 15.0. (Quartz documentation suggests |
| - // +/-10). |
| - // Multiply by 1000 to vaguely approximate WHEEL_DELTA on Windows (120). |
| - const CGFloat kWheelDeltaMultiplier = 1000; |
| - return gfx::Vector2d(kWheelDeltaMultiplier * [event deltaX], |
| - kWheelDeltaMultiplier * [event deltaY]); |
| + if (base::mac::IsOSLionOrLater() && [event hasPreciseScrollingDeltas]) { |
| + return gfx::Vector2d([event scrollingDeltaX], [event scrollingDeltaY]); |
|
Andre
2014/08/29 23:31:34
Scrolling feels pretty good on Magic Mouse without
tapted
2014/09/02 09:10:25
nit: It might be worth documenting what the number
Andre
2014/09/02 17:05:05
Done.
|
| + } else { |
| + // Empirically, a value of 0.1 is typical for one mousewheel click. Positive |
| + // values when scrolling up or to the left. Scrolling quickly results in a |
| + // higher delta per click, up to about 15.0. (Quartz documentation suggests |
| + // +/-10). |
| + // Multiply by 1000 to vaguely approximate WHEEL_DELTA on Windows (120). |
| + const CGFloat kWheelDeltaMultiplier = 1000; |
| + return gfx::Vector2d(kWheelDeltaMultiplier * [event deltaX], |
| + kWheelDeltaMultiplier * [event deltaY]); |
| + } |
| } |
| base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) { |