]> git.eshelyaron.com Git - emacs.git/commitdiff
Generate TOUCH_END_EVENTs on NS when mwheel momentum is disabled
authorPo Lu <luangruo@yahoo.com>
Thu, 6 Jan 2022 11:35:18 +0000 (19:35 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 6 Jan 2022 11:35:18 +0000 (19:35 +0800)
* src/nsterm.m ([EmacsView mouseDown:]): Generate
TOUCH_END_EVENTs on the first event whose momentum phase is not
NSEventPhaseNone.

src/nsterm.m

index 428d1a2fe2292bf8991c9e8cc3159c7a6f79aad2..a15dc47a226b9697bb76703264d91d977c338fc6 100644 (file)
@@ -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