(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.
This commit is contained in:
parent
0a5ebd444a
commit
ee2a8fd4cf
2 changed files with 19 additions and 19 deletions
|
@ -720,17 +720,19 @@ This function assumes that the events can be stored in a string."
|
|||
(setf (aref seq i) (logand (aref seq i) 127)))
|
||||
seq)
|
||||
|
||||
;; These are needed in a --without-x build.
|
||||
(defvar mouse-wheel-down-event)
|
||||
(defvar mouse-wheel-up-event)
|
||||
(defvar mouse-wheel-right-event)
|
||||
(defvar mouse-wheel-left-event)
|
||||
|
||||
(defun edmacro-fix-menu-commands (macro &optional noerror)
|
||||
(if (vectorp macro)
|
||||
(let (result)
|
||||
;; Not preloaded in a --without-x build.
|
||||
(require 'mwheel)
|
||||
(defvar mouse-wheel-down-event)
|
||||
(defvar mouse-wheel-up-event)
|
||||
(defvar mouse-wheel-right-event)
|
||||
(defvar mouse-wheel-left-event)
|
||||
(defvar mouse-wheel-down-alternate-event)
|
||||
(defvar mouse-wheel-up-alternate-event)
|
||||
(defvar mouse-wheel-right-alternate-event)
|
||||
(defvar mouse-wheel-left-alternate-event)
|
||||
;; Make a list of the elements.
|
||||
(setq macro (append macro nil))
|
||||
(dolist (ev macro)
|
||||
|
@ -748,7 +750,11 @@ This function assumes that the events can be stored in a string."
|
|||
(memq (event-basic-type ev)
|
||||
(list mouse-wheel-down-event mouse-wheel-up-event
|
||||
mouse-wheel-right-event
|
||||
mouse-wheel-left-event)))
|
||||
mouse-wheel-left-event
|
||||
mouse-wheel-down-alternate-event
|
||||
mouse-wheel-up-alternate-event
|
||||
mouse-wheel-right-alternate-event
|
||||
mouse-wheel-left-alternate-event)))
|
||||
nil)
|
||||
(noerror nil)
|
||||
(t
|
||||
|
|
|
@ -216,15 +216,9 @@ Also see `mouse-wheel-tilt-scroll'."
|
|||
:type 'boolean
|
||||
:version "26.1")
|
||||
|
||||
(defun mwheel-event-button (event)
|
||||
(let ((x (event-basic-type event)))
|
||||
;; Map mouse-wheel events to appropriate buttons
|
||||
(if (eq 'mouse-wheel x)
|
||||
(let ((amount (car (cdr (cdr (cdr event))))))
|
||||
(if (< amount 0)
|
||||
mouse-wheel-up-event
|
||||
mouse-wheel-down-event))
|
||||
x)))
|
||||
;; This function used to handle the `mouse-wheel` event which was
|
||||
;; removed in 2003 by commit 9eb28007fb27, thus making it obsolete.
|
||||
(define-obsolete-function-alias 'mwheel-event-button #'event-basic-type "30.1")
|
||||
|
||||
(defun mwheel-event-window (event)
|
||||
(posn-window (event-start event)))
|
||||
|
@ -347,7 +341,7 @@ value of ARG, and the command uses it in subsequent scrolls."
|
|||
(when (numberp amt) (setq amt (* amt (event-line-count event))))
|
||||
(condition-case nil
|
||||
(unwind-protect
|
||||
(let ((button (mwheel-event-button event)))
|
||||
(let ((button (event-basic-type event)))
|
||||
(cond ((and (eq amt 'hscroll) (memq button (list mouse-wheel-down-event
|
||||
mouse-wheel-down-alternate-event)))
|
||||
(when (and (natnump arg) (> arg 0))
|
||||
|
@ -434,7 +428,7 @@ See also `text-scale-adjust'."
|
|||
(interactive (list last-input-event))
|
||||
(let ((selected-window (selected-window))
|
||||
(scroll-window (mouse-wheel--get-scroll-window event))
|
||||
(button (mwheel-event-button event)))
|
||||
(button (event-basic-type event)))
|
||||
(select-window scroll-window 'mark-for-redisplay)
|
||||
(unwind-protect
|
||||
(cond ((memq button (list mouse-wheel-down-event
|
||||
|
@ -450,7 +444,7 @@ See also `text-scale-adjust'."
|
|||
"Increase or decrease the global font size according to the EVENT.
|
||||
This invokes `global-text-scale-adjust', which see."
|
||||
(interactive (list last-input-event))
|
||||
(let ((button (mwheel-event-button event)))
|
||||
(let ((button (event-basic-type event)))
|
||||
(cond ((memq button (list mouse-wheel-down-event
|
||||
mouse-wheel-down-alternate-event))
|
||||
(global-text-scale-adjust 1))
|
||||
|
|
Loading…
Add table
Reference in a new issue