=> 556f803123480b35bc06c2171a0482e7111e457f
[1mdiff --git a/sdl2-macos-mouse-scrolling-patch.diff b/sdl2-macos-mouse-scrolling.diff[m [1msimilarity index 67%[m [1mrename from sdl2-macos-mouse-scrolling-patch.diff[m [1mrename to sdl2-macos-mouse-scrolling.diff[m [1mindex 633243ed..e2f30c24 100644[m [1m--- a/sdl2-macos-mouse-scrolling-patch.diff[m [1m+++ b/sdl2-macos-mouse-scrolling.diff[m [36m@@ -1,6 +1,6 @@[m diff -r 4f06c06b6d19 src/events/SDL_mouse.c[m --- a/src/events/SDL_mouse.c Wed Aug 05 15:28:51 2020 +0200[m [31m-+++ b/src/events/SDL_mouse.c Tue Sep 15 07:54:17 2020 +0300[m [32m+[m[32m+++ b/src/events/SDL_mouse.c Tue Nov 10 12:16:06 2020 +0200[m @@ -642,8 +642,8 @@[m event.wheel.preciseX = x;[m event.wheel.preciseY = y;[m [36m@@ -14,8 +14,8 @@[m [mdiff -r 4f06c06b6d19 src/events/SDL_mouse.c[m }[m diff -r 4f06c06b6d19 src/video/cocoa/SDL_cocoamouse.m[m --- a/src/video/cocoa/SDL_cocoamouse.m Wed Aug 05 15:28:51 2020 +0200[m [31m-+++ b/src/video/cocoa/SDL_cocoamouse.m Tue Sep 15 07:54:17 2020 +0300[m [31m-@@ -424,8 +424,8 @@[m [32m+[m[32m+++ b/src/video/cocoa/SDL_cocoamouse.m Tue Nov 10 12:16:06 2020 +0200[m [32m+[m[32m@@ -424,10 +424,16 @@[m }[m [m SDL_MouseID mouseID = mouse->mouseID;[m [36m@@ -25,4 +25,12 @@[m [mdiff -r 4f06c06b6d19 src/video/cocoa/SDL_cocoamouse.m[m + CGFloat y = [event scrollingDeltaY];[m SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL;[m [m [32m+[m[32m+ /* HACK: Make a distinction between precise and imprecise scrolling.[m [32m+[m[32m+ Trackpad seems to be mouseID 0. */[m [32m+[m[32m+ if (![event hasPreciseScrollingDeltas]) {[m [32m+[m[32m+ mouseID = 1;[m [32m+[m[32m+ }[m [32m+[m[32m+[m if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) {[m [32m+[m[32m if ([event isDirectionInvertedFromDevice] == YES) {[m [32m+[m[32m direction = SDL_MOUSEWHEEL_FLIPPED;[m [1mdiff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c[m [1mindex a4bf38dc..c71758be 100644[m [1m--- a/src/ui/documentwidget.c[m [1m+++ b/src/ui/documentwidget.c[m [36m@@ -1891,21 +1891,32 @@[m [mstatic iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e[m }[m }[m #if defined (iPlatformApple)[m [31m- /* Momentum scrolling. */[m [31m- stop_Anim(&d->scrollY);[m [31m- scroll_DocumentWidget_(d, -ev->wheel.y * get_Window()->pixelRatio * acceleration);[m [31m-#else[m [31m- if (keyMods_Sym(SDL_GetModState()) == KMOD_PRIMARY) {[m [31m- postCommandf_App("zoom.delta arg:%d", ev->wheel.y > 0 ? 10 : -10);[m [31m- return iTrue;[m [32m+[m[32m /* On macOS, we handle both trackpad and mouse events. We expect SDL to identify[m [32m+[m[32m which device is sending the event. */[m [32m+[m[32m if (ev->wheel.which == 0) { /* Trackpad with precise scrolling w/inertia. */[m [32m+[m[32m stop_Anim(&d->scrollY);[m [32m+[m[32m scroll_DocumentWidget_(d, -ev->wheel.y * get_Window()->pixelRatio * acceleration);[m }[m [31m- smoothScroll_DocumentWidget_([m [31m- d,[m [31m- -3 * ev->wheel.y * lineHeight_Text(paragraph_FontId) * acceleration,[m [31m- smoothDuration_DocumentWidget_ *[m [31m- (!isFinished_Anim(&d->scrollY) && pos_Anim(&d->scrollY) < 0.25f ? 0.5f : 1.0f));[m [31m- /* accelerated speed for repeated wheelings */[m [32m+[m[32m else[m [32m+[m[32m#endif[m [32m+[m[32m /* Traditional mouse wheel. */ {[m [32m+[m[32m#if defined (iPlatformApple)[m [32m+[m[32m /* Disregard wheel acceleration applied by the OS. */[m [32m+[m[32m const int amount = iSign(ev->wheel.y);[m [32m+[m[32m#else[m [32m+[m[32m const int amount = ev->wheel.y;[m #endif[m [32m+[m[32m if (keyMods_Sym(SDL_GetModState()) == KMOD_PRIMARY) {[m [32m+[m[32m postCommandf_App("zoom.delta arg:%d", amount > 0 ? 10 : -10);[m [32m+[m[32m return iTrue;[m [32m+[m[32m }[m [32m+[m[32m smoothScroll_DocumentWidget_([m [32m+[m[32m d,[m [32m+[m[32m -3 * amount * lineHeight_Text(paragraph_FontId) * acceleration,[m [32m+[m[32m smoothDuration_DocumentWidget_ *[m [32m+[m[32m (!isFinished_Anim(&d->scrollY) && pos_Anim(&d->scrollY) < 0.25f ? 0.5f : 1.0f));[m [32m+[m[32m /* accelerated speed for repeated wheelings */[m [32m+[m[32m }[m iChangeFlags(d->flags, noHoverWhileScrolling_DocumentWidgetFlag, iTrue);[m return iTrue;[m }[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).