From b3ceeb3f2a4240736840422c272204030d113083 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 6 Jan 2022 19:35:18 +0800 Subject: [PATCH] Generate TOUCH_END_EVENTs on NS when mwheel momentum is disabled * src/nsterm.m ([EmacsView mouseDown:]): Generate TOUCH_END_EVENTs on the first event whose momentum phase is not NSEventPhaseNone. --- src/nsterm.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m index 428d1a2fe22..a15dc47a226 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6519,6 +6519,22 @@ not_in_argv (NSString *arg) int x = 0, y = 0; int scrollUp = NO; + static bool end_flag = false; + + if (!ns_use_mwheel_momentum && !end_flag + && [theEvent momentumPhase] != NSEventPhaseNone) + { + emacs_event->kind = TOUCH_END_EVENT; + emacs_event->arg = Qnil; + end_flag = [theEvent momentumPhase] != NSEventPhaseNone; + XSETINT (emacs_event->x, lrint (p.x)); + XSETINT (emacs_event->y, lrint (p.y)); + EV_TRAILER (theEvent); + return; + } + + end_flag = [theEvent momentumPhase] != NSEventPhaseNone; + /* FIXME: At the top or bottom of the buffer we should * ignore momentum-phase events. */ if (! ns_use_mwheel_momentum -- 2.39.2