=> fb3889c6021013b6dc028cae0f4392bc0bcf0eae
[1mdiff --git a/src/macos.m b/src/macos.m[m [1mindex 911f5e3a..4ad267c1 100644[m [1m--- a/src/macos.m[m [1m+++ b/src/macos.m[m [36m@@ -429,12 +429,48 @@[m [mstatic void trackSwipe_(NSEvent *event) {[m #endif[m [m static int swipeDir_ = 0;[m [32m+[m[32mstatic int preventTapGlitch_ = 0;[m [m static iBool processScrollWheelEvent_(NSEvent *event) {[m const iBool isPerPixel = (event.hasPreciseScrollingDeltas != 0);[m const iBool isInertia = (event.momentumPhase & (NSEventPhaseBegan | NSEventPhaseChanged)) != 0;[m const iBool isEnded = event.scrollingDeltaX == 0.0f && event.scrollingDeltaY == 0.0f && !isInertia;[m const iWindow *win = &get_MainWindow()->base;[m [32m+[m[32m if (isPerPixel) {[m [32m+[m[32m /* On macOS 12.1, stopping ongoing inertia scroll with a tap seems to sometimes produce[m [32m+[m[32m spurious large scroll events. */[m [32m+[m[32m switch (preventTapGlitch_) {[m [32m+[m[32m case 0:[m [32m+[m[32m if (isInertia && event.momentumPhase == NSEventPhaseChanged) {[m [32m+[m[32m preventTapGlitch_++;[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m preventTapGlitch_ = 0;[m [32m+[m[32m }[m [32m+[m[32m break;[m [32m+[m[32m case 1:[m [32m+[m[32m if (event.scrollingDeltaY == 0 && event.momentumPhase == NSEventPhaseEnded) {[m [32m+[m[32m preventTapGlitch_++;[m [32m+[m[32m }[m [32m+[m[32m break;[m [32m+[m[32m case 2:[m [32m+[m[32m if (event.scrollingDeltaY == 0 && event.momentumPhase == 0 && isEnded) {[m [32m+[m[32m preventTapGlitch_++;[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m preventTapGlitch_ = 0;[m [32m+[m[32m }[m [32m+[m[32m break;[m [32m+[m[32m case 3:[m [32m+[m[32m if (event.scrollingDeltaY != 0 && event.momentumPhase == 0 && !isInertia) {[m [32m+[m[32m preventTapGlitch_ = 0;[m [32m+[m[32m // printf("SPURIOUS\n"); fflush(stdout);[m [32m+[m[32m return iTrue;[m [32m+[m[32m }[m [32m+[m[32m preventTapGlitch_ = 0;[m [32m+[m[32m break;[m [32m+[m[32m }[m [32m+[m[32m }[m /* Post corresponding MOUSEWHEEL events. */[m SDL_MouseWheelEvent e = { .type = SDL_MOUSEWHEEL };[m e.timestamp = SDL_GetTicks();[m [36m@@ -464,7 +500,8 @@[m [mstatic iBool processScrollWheelEvent_(NSEvent *event) {[m e.x = -event.scrollingDeltaX;[m e.y = iSign(event.scrollingDeltaY);[m }[m [31m-// printf("#### dx:%d dy:%d phase:%ld end:%d\n", e.x, e.y, (long) event.momentumPhase, isEnded); fflush(stdout);[m [32m+[m[32m // printf("#### [%d] dx:%d dy:%d phase:%ld inertia:%d end:%d\n", preventTapGlitch_, e.x, e.y, (long) event.momentumPhase,[m [32m+[m[32m // isInertia, isEnded); fflush(stdout);[m SDL_PushEvent((SDL_Event *) &e);[m #if 0[m /* On macOS, we handle both trackpad and mouse events. We expect SDL to identify[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).