diff options
| author | Stefan Monnier | 2024-01-09 11:34:05 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2024-01-09 11:34:05 -0500 |
| commit | ee2a8fd4cff84cd5bd672fdde8ec3e0800f132be (patch) | |
| tree | eb166d0d4e76d35f79c1c6f59641ce3e96853260 | |
| parent | 0a5ebd444a820308571a659005d094b2dd93fe3f (diff) | |
| download | emacs-ee2a8fd4cff84cd5bd672fdde8ec3e0800f132be.tar.gz emacs-ee2a8fd4cff84cd5bd672fdde8ec3e0800f132be.zip | |
(mouse-wheel-*-event): Minor cleanups
* lisp/mwheel.el (mwheel-event-button): Mark as obsolete alias.
Change all callers.
* lisp/edmacro.el (mouse-wheel-*-event): Move declarations to ...
(edmacro-fix-menu-commands): ... where we do know that they should
be defined. Obey `mouse-wheel-*-alternate-event`s as well.
| -rw-r--r-- | lisp/edmacro.el | 20 | ||||
| -rw-r--r-- | lisp/mwheel.el | 18 |
2 files changed, 19 insertions, 19 deletions
diff --git a/lisp/edmacro.el b/lisp/edmacro.el index 362ec0ecbb4..5bd0c1892e5 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el | |||
| @@ -720,17 +720,19 @@ This function assumes that the events can be stored in a string." | |||
| 720 | (setf (aref seq i) (logand (aref seq i) 127))) | 720 | (setf (aref seq i) (logand (aref seq i) 127))) |
| 721 | seq) | 721 | seq) |
| 722 | 722 | ||
| 723 | ;; These are needed in a --without-x build. | ||
| 724 | (defvar mouse-wheel-down-event) | ||
| 725 | (defvar mouse-wheel-up-event) | ||
| 726 | (defvar mouse-wheel-right-event) | ||
| 727 | (defvar mouse-wheel-left-event) | ||
| 728 | |||
| 729 | (defun edmacro-fix-menu-commands (macro &optional noerror) | 723 | (defun edmacro-fix-menu-commands (macro &optional noerror) |
| 730 | (if (vectorp macro) | 724 | (if (vectorp macro) |
| 731 | (let (result) | 725 | (let (result) |
| 732 | ;; Not preloaded in a --without-x build. | 726 | ;; Not preloaded in a --without-x build. |
| 733 | (require 'mwheel) | 727 | (require 'mwheel) |
| 728 | (defvar mouse-wheel-down-event) | ||
| 729 | (defvar mouse-wheel-up-event) | ||
| 730 | (defvar mouse-wheel-right-event) | ||
| 731 | (defvar mouse-wheel-left-event) | ||
| 732 | (defvar mouse-wheel-down-alternate-event) | ||
| 733 | (defvar mouse-wheel-up-alternate-event) | ||
| 734 | (defvar mouse-wheel-right-alternate-event) | ||
| 735 | (defvar mouse-wheel-left-alternate-event) | ||
| 734 | ;; Make a list of the elements. | 736 | ;; Make a list of the elements. |
| 735 | (setq macro (append macro nil)) | 737 | (setq macro (append macro nil)) |
| 736 | (dolist (ev macro) | 738 | (dolist (ev macro) |
| @@ -748,7 +750,11 @@ This function assumes that the events can be stored in a string." | |||
| 748 | (memq (event-basic-type ev) | 750 | (memq (event-basic-type ev) |
| 749 | (list mouse-wheel-down-event mouse-wheel-up-event | 751 | (list mouse-wheel-down-event mouse-wheel-up-event |
| 750 | mouse-wheel-right-event | 752 | mouse-wheel-right-event |
| 751 | mouse-wheel-left-event))) | 753 | mouse-wheel-left-event |
| 754 | mouse-wheel-down-alternate-event | ||
| 755 | mouse-wheel-up-alternate-event | ||
| 756 | mouse-wheel-right-alternate-event | ||
| 757 | mouse-wheel-left-alternate-event))) | ||
| 752 | nil) | 758 | nil) |
| 753 | (noerror nil) | 759 | (noerror nil) |
| 754 | (t | 760 | (t |
diff --git a/lisp/mwheel.el b/lisp/mwheel.el index b75b6f27d53..735adf42f68 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el | |||
| @@ -216,15 +216,9 @@ Also see `mouse-wheel-tilt-scroll'." | |||
| 216 | :type 'boolean | 216 | :type 'boolean |
| 217 | :version "26.1") | 217 | :version "26.1") |
| 218 | 218 | ||
| 219 | (defun mwheel-event-button (event) | 219 | ;; This function used to handle the `mouse-wheel` event which was |
| 220 | (let ((x (event-basic-type event))) | 220 | ;; removed in 2003 by commit 9eb28007fb27, thus making it obsolete. |
| 221 | ;; Map mouse-wheel events to appropriate buttons | 221 | (define-obsolete-function-alias 'mwheel-event-button #'event-basic-type "30.1") |
| 222 | (if (eq 'mouse-wheel x) | ||
| 223 | (let ((amount (car (cdr (cdr (cdr event)))))) | ||
| 224 | (if (< amount 0) | ||
| 225 | mouse-wheel-up-event | ||
| 226 | mouse-wheel-down-event)) | ||
| 227 | x))) | ||
| 228 | 222 | ||
| 229 | (defun mwheel-event-window (event) | 223 | (defun mwheel-event-window (event) |
| 230 | (posn-window (event-start event))) | 224 | (posn-window (event-start event))) |
| @@ -347,7 +341,7 @@ value of ARG, and the command uses it in subsequent scrolls." | |||
| 347 | (when (numberp amt) (setq amt (* amt (event-line-count event)))) | 341 | (when (numberp amt) (setq amt (* amt (event-line-count event)))) |
| 348 | (condition-case nil | 342 | (condition-case nil |
| 349 | (unwind-protect | 343 | (unwind-protect |
| 350 | (let ((button (mwheel-event-button event))) | 344 | (let ((button (event-basic-type event))) |
| 351 | (cond ((and (eq amt 'hscroll) (memq button (list mouse-wheel-down-event | 345 | (cond ((and (eq amt 'hscroll) (memq button (list mouse-wheel-down-event |
| 352 | mouse-wheel-down-alternate-event))) | 346 | mouse-wheel-down-alternate-event))) |
| 353 | (when (and (natnump arg) (> arg 0)) | 347 | (when (and (natnump arg) (> arg 0)) |
| @@ -434,7 +428,7 @@ See also `text-scale-adjust'." | |||
| 434 | (interactive (list last-input-event)) | 428 | (interactive (list last-input-event)) |
| 435 | (let ((selected-window (selected-window)) | 429 | (let ((selected-window (selected-window)) |
| 436 | (scroll-window (mouse-wheel--get-scroll-window event)) | 430 | (scroll-window (mouse-wheel--get-scroll-window event)) |
| 437 | (button (mwheel-event-button event))) | 431 | (button (event-basic-type event))) |
| 438 | (select-window scroll-window 'mark-for-redisplay) | 432 | (select-window scroll-window 'mark-for-redisplay) |
| 439 | (unwind-protect | 433 | (unwind-protect |
| 440 | (cond ((memq button (list mouse-wheel-down-event | 434 | (cond ((memq button (list mouse-wheel-down-event |
| @@ -450,7 +444,7 @@ See also `text-scale-adjust'." | |||
| 450 | "Increase or decrease the global font size according to the EVENT. | 444 | "Increase or decrease the global font size according to the EVENT. |
| 451 | This invokes `global-text-scale-adjust', which see." | 445 | This invokes `global-text-scale-adjust', which see." |
| 452 | (interactive (list last-input-event)) | 446 | (interactive (list last-input-event)) |
| 453 | (let ((button (mwheel-event-button event))) | 447 | (let ((button (event-basic-type event))) |
| 454 | (cond ((memq button (list mouse-wheel-down-event | 448 | (cond ((memq button (list mouse-wheel-down-event |
| 455 | mouse-wheel-down-alternate-event)) | 449 | mouse-wheel-down-alternate-event)) |
| 456 | (global-text-scale-adjust 1)) | 450 | (global-text-scale-adjust 1)) |