diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-06 08:20:24 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-06 08:20:32 +0300 |
commit | 4a03c76b436bf0fe27b33039b12f034b85b27341 (patch) | |
tree | b345c060fcea2debc08fa04d20ce48a5e69a4e22 /src/ui/documentwidget.c | |
parent | aacb723fa99bb59bd7dcf94d089fc004a171f82d (diff) |
macOS: Smooth inertia scrolling with trackpad
Requires a slightly tweaked SDL 2, though, when it comes to handling the scroll events.
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 48eb482f..6d3e7a9c 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -864,11 +864,16 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
864 | } | 864 | } |
865 | } | 865 | } |
866 | else if (ev->type == SDL_MOUSEWHEEL) { | 866 | else if (ev->type == SDL_MOUSEWHEEL) { |
867 | #if defined (iPlatformApple) | ||
868 | /* Momentum scrolling. */ | ||
869 | scroll_DocumentWidget_(d, -ev->wheel.y * get_Window()->pixelRatio); | ||
870 | #else | ||
867 | if (keyMods_Sym(SDL_GetModState()) == KMOD_PRIMARY) { | 871 | if (keyMods_Sym(SDL_GetModState()) == KMOD_PRIMARY) { |
868 | changeTextSize_DocumentWidget_(d, ev->wheel.y > 0 ? 10 : -10); | 872 | changeTextSize_DocumentWidget_(d, ev->wheel.y > 0 ? 10 : -10); |
869 | return iTrue; | 873 | return iTrue; |
870 | } | 874 | } |
871 | scroll_DocumentWidget_(d, -3 * ev->wheel.y * lineHeight_Text(default_FontId)); | 875 | scroll_DocumentWidget_(d, -3 * ev->wheel.y * lineHeight_Text(default_FontId)); |
876 | #endif | ||
872 | return iTrue; | 877 | return iTrue; |
873 | } | 878 | } |
874 | else if (ev->type == SDL_MOUSEMOTION) { | 879 | else if (ev->type == SDL_MOUSEMOTION) { |