mwheel.el: Unconditionally use the wheel-up/down/...
events
The `mouse-wheel-DIR-event` vars were introduced because under X11
we get different `mouse-N` events depending on the users' mouse and
those same events can be used for other things for other rodents, so we
can't unconditionally treat those events as mouse-wheel events.
But this does not apply to the `wheel-up/down/...` events.
So hard code them.
* lisp/mwheel.el (mwheel--is-dir-p): Always consider the `wheel-DIR` events.
(mouse-wheel--setup-bindings): Always bind the `wheel-DIR` events.
* lisp/completion-preview.el (completion-preview--mouse-map):
Unconditionally bind the `wheel-DIR` events.
* lisp/edmacro.el (edmacro-fix-menu-commands): Hard code the
`wheel-DIR` events as mouse events regardless of `mouse-wheel-*-event`s.
* lisp/progmodes/flymake.el (flymake--mode-line-counter-map):
Do nothing, because it's already been done in commit e5be6c7ae3
.
* doc/lispref/commands.texi (Misc Events): Document the need to use
`wheel-up/down/left/right` unconditionally.
This commit is contained in:
parent
82f71e106a
commit
db8890b3c9
5 changed files with 42 additions and 26 deletions
|
@ -2562,23 +2562,24 @@ non-@code{nil}.
|
|||
@vindex mouse-wheel-up-event
|
||||
@vindex mouse-wheel-down-event
|
||||
The @code{wheel-up} and @code{wheel-down} events are generated only on
|
||||
some kinds of systems. On other systems, @code{mouse-4} and
|
||||
@code{mouse-5} are used instead. For portable code, use the variables
|
||||
@code{mouse-wheel-up-event}, @code{mouse-wheel-up-alternate-event},
|
||||
@code{mouse-wheel-down-event} and
|
||||
@code{mouse-wheel-down-alternate-event} defined in @file{mwheel.el} to
|
||||
determine what event types to expect from the mouse wheel.
|
||||
some kinds of systems. On other systems, other events like @code{mouse-4} and
|
||||
@code{mouse-5} are used instead. Portable code should handle both
|
||||
@code{wheel-up} and @code{wheel-down} events as well as the events
|
||||
specified in the variables @code{mouse-wheel-up-event} and
|
||||
@code{mouse-wheel-down-event}, defined in @file{mwheel.el}.
|
||||
|
||||
@vindex mouse-wheel-left-event
|
||||
@vindex mouse-wheel-right-event
|
||||
Similarly, some mice can generate @code{mouse-wheel-left-event} and
|
||||
@code{mouse-wheel-right-event} and can be used to scroll if
|
||||
@code{mouse-wheel-tilt-scroll} is non-@code{nil}. However, some mice
|
||||
also generate other events at the same time as they're generating
|
||||
these scroll events which may get in the way. The way to fix this is
|
||||
generally to unbind these events (for instance, @code{mouse-6} or
|
||||
@code{mouse-7}, but this is very hardware and operating system
|
||||
dependent).
|
||||
The same holds for the horizontal wheel movements which are usually
|
||||
represented by @code{wheel-left} and @code{wheel-right} events, but
|
||||
for which portable code should also obey the variables
|
||||
@code{mouse-wheel-left-event} and @code{mouse-wheel-right-event},
|
||||
defined in @file{mwheel.el}.
|
||||
However, some mice also generate other events at the same time as
|
||||
they're generating these scroll events which may get in the way.
|
||||
The way to fix this is generally to unbind these events (for instance,
|
||||
@code{mouse-6} or @code{mouse-7}, but this is very hardware and
|
||||
operating system dependent).
|
||||
|
||||
@cindex @code{pinch} event
|
||||
@item (pinch @var{position} @var{dx} @var{dy} @var{scale} @var{angle})
|
||||
|
|
7
etc/NEWS
7
etc/NEWS
|
@ -406,6 +406,13 @@ respectively, in addition to the existing translations 'C-x 8 / e' and
|
|||
|
||||
* Changes in Specialized Modes and Packages in Emacs 30.1
|
||||
|
||||
+++
|
||||
** Mwheel
|
||||
The 'wheel-up/down/left/right' events are now bound unconditionally,
|
||||
and the 'mouse-wheel-up/down/left/right-event' variables are thus
|
||||
used only to specify the 'mouse-4/5/6/7' events generated by
|
||||
legacy setup, such as 'xterm-mouse-mode' or X11 without XInput2.
|
||||
|
||||
+++
|
||||
** New command 'lldb'.
|
||||
Run the LLDB debugger, analogous to the 'gud-gdb' command.
|
||||
|
|
|
@ -135,6 +135,8 @@ If this option is nil, these commands do not display any message."
|
|||
"<down-mouse-1>" #'completion-preview-insert
|
||||
"C-<down-mouse-1>" #'completion-at-point
|
||||
"<down-mouse-2>" #'completion-at-point
|
||||
"<wheel-up>" #'completion-preview-prev-candidate
|
||||
"<wheel-down>" #'completion-preview-next-candidate
|
||||
(key-description (vector mouse-wheel-up-event))
|
||||
#'completion-preview-prev-candidate
|
||||
(key-description (vector mouse-wheel-up-alternate-event))
|
||||
|
|
|
@ -748,13 +748,14 @@ This function assumes that the events can be stored in a string."
|
|||
;; info is recorded in macros to make this possible.
|
||||
((or (mouse-event-p ev) (mouse-movement-p ev)
|
||||
(memq (event-basic-type ev)
|
||||
(list mouse-wheel-down-event mouse-wheel-up-event
|
||||
mouse-wheel-right-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)))
|
||||
`( ,mouse-wheel-down-event ,mouse-wheel-up-event
|
||||
,mouse-wheel-right-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
|
||||
wheel-down wheel-up wheel-left wheel-right)))
|
||||
nil)
|
||||
(noerror nil)
|
||||
(t
|
||||
|
|
|
@ -308,9 +308,11 @@ active window."
|
|||
(defmacro mwheel--is-dir-p (dir button)
|
||||
(declare (debug (sexp form)))
|
||||
(let ((custom-var (intern (format "mouse-wheel-%s-event" dir)))
|
||||
(custom-var-alt (intern (format "mouse-wheel-%s-alternate-event" dir))))
|
||||
(custom-var-alt (intern (format "mouse-wheel-%s-alternate-event" dir)))
|
||||
(event (intern (format "wheel-%s" dir))))
|
||||
(macroexp-let2 nil butsym button
|
||||
`(or (eq ,butsym ,custom-var)
|
||||
`(or (eq ,butsym ',event)
|
||||
(eq ,butsym ,custom-var)
|
||||
;; We presume here `button' is never nil.
|
||||
(eq ,butsym ,custom-var-alt)))))
|
||||
|
||||
|
@ -503,14 +505,16 @@ an event used for scrolling, such as `mouse-wheel-down-event'."
|
|||
((and (consp binding) (eq (cdr binding) 'text-scale))
|
||||
(dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
|
||||
mouse-wheel-down-alternate-event
|
||||
mouse-wheel-up-alternate-event))
|
||||
mouse-wheel-up-alternate-event
|
||||
'wheel-down 'wheel-up))
|
||||
(when event
|
||||
(mouse-wheel--add-binding `[,(append (car binding) (list event))]
|
||||
'mouse-wheel-text-scale))))
|
||||
((and (consp binding) (eq (cdr binding) 'global-text-scale))
|
||||
(dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
|
||||
mouse-wheel-down-alternate-event
|
||||
mouse-wheel-up-alternate-event))
|
||||
mouse-wheel-up-alternate-event
|
||||
'wheel-down 'wheel-up))
|
||||
(when event
|
||||
(mouse-wheel--add-binding `[,(append (car binding) (list event))]
|
||||
'mouse-wheel-global-text-scale))))
|
||||
|
@ -521,7 +525,8 @@ an event used for scrolling, such as `mouse-wheel-down-event'."
|
|||
mouse-wheel-down-alternate-event
|
||||
mouse-wheel-up-alternate-event
|
||||
mouse-wheel-left-alternate-event
|
||||
mouse-wheel-right-alternate-event))
|
||||
mouse-wheel-right-alternate-event
|
||||
'wheel-down 'wheel-up 'wheel-left 'wheel-right))
|
||||
(when event
|
||||
(dolist (key (mouse-wheel--create-scroll-keys binding event))
|
||||
(mouse-wheel--add-binding key 'mwheel-scroll))))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue