[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 41b30d9958: Fix mouse wheel DND scroll direction on Haiku
From: |
Po Lu |
Subject: |
master 41b30d9958: Fix mouse wheel DND scroll direction on Haiku |
Date: |
Wed, 20 Jul 2022 08:22:57 -0400 (EDT) |
branch: master
commit 41b30d99587bace3b08fa08393a197b8e2941f33
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix mouse wheel DND scroll direction on Haiku
* lisp/term/haiku-win.el (haiku-handle-drag-wheel): Record the
last wheel direction. If it differs, clear the click counter.
---
lisp/term/haiku-win.el | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el
index 4a8db7c321..9d9c31970d 100644
--- a/lisp/term/haiku-win.el
+++ b/lisp/term/haiku-win.el
@@ -467,6 +467,11 @@ take effect on menu items until the menu bar is updated
again."
The car is just that; cdr is the timestamp of the last wheel
movement.")
+(defvar haiku-last-wheel-direction nil
+ "Cons of two elements describing the direction the wheel last turned.
+The car is whether or not the movement was horizontal.
+The cdr is whether or not the movement was upwards or leftwards.")
+
(defun haiku-note-wheel-click (timestamp)
"Note that the mouse wheel was moved at TIMESTAMP during drag-and-drop.
Return the number of clicks that were made in quick succession."
@@ -490,15 +495,20 @@ FRAME is the frame on top of which the wheel moved.
X and Y are the frame-relative coordinates of the wheel movement.
HORIZONTAL is whether or not the wheel movement was horizontal.
UP is whether or not the wheel moved up (or left)."
- ;; FIXME: redisplay is very slow after this.
+ (when (not (equal haiku-last-wheel-direction
+ (cons horizontal up)))
+ (setq haiku-last-wheel-direction
+ (cons horizontal up))
+ (when (consp haiku-dnd-wheel-count)
+ (setcar haiku-dnd-wheel-count 0)))
(let ((function (cond
- ((and (not horizontal) up)
+ ((and (not horizontal) (not up))
mwheel-scroll-up-function)
((not horizontal)
mwheel-scroll-down-function)
- (up (if mouse-wheel-flip-direction
- mwheel-scroll-right-function
- mwheel-scroll-left-function))
+ ((not up) (if mouse-wheel-flip-direction
+ mwheel-scroll-right-function
+ mwheel-scroll-left-function))
(t (if mouse-wheel-flip-direction
mwheel-scroll-left-function
mwheel-scroll-right-function))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 41b30d9958: Fix mouse wheel DND scroll direction on Haiku,
Po Lu <=