Don't block changes in mouse pointer inside 'track-mouse'

* etc/NEWS:
* doc/lispref/frames.texi (Mouse Tracking): Document the special
effect of setting 'track-mouse' to 'dragging'.

* lisp/textmodes/artist.el (artist-mouse-draw-continously):
* lisp/ruler-mode.el (ruler-mode-mouse-drag-any-column-iteration):
* lisp/mouse-drag.el (mouse-drag-throw):
* lisp/mouse.el (mouse-drag-line): Set 'track-mouse' to 'dragging'
to avoid changes in the shape of the mouse pointer.

* src/xdisp.c (define_frame_cursor1): Don't change the mouse
pointer shape when do_mouse_tracking has the value of 'dragging',
not just any non-nil value.  (Bug#20934)
(syms_of_xdisp): DEFSYM 'dragging'.
This commit is contained in:
Eli Zaretskii 2015-06-30 18:59:21 +03:00
parent 881c479026
commit edd09381c6
7 changed files with 36 additions and 3 deletions

View file

@ -2018,6 +2018,19 @@ The value of @code{track-mouse} is that of the last form in @var{body}.
You should design @var{body} to return when it sees the up-event that
indicates the release of the button, or whatever kind of event means
it is time to stop tracking.
The @code{track-mouse} form causes Emacs to generate mouse motion
events by binding the variable @code{mouse-tracking} to a
non-@code{nil} value. If that variable has the special value
@code{dragging}, it additionally instructs the display engine to
refrain from changing the shape of the mouse pointer. This is
desirable in Lisp programs that require mouse dragging across large
portions of Emacs display, which might otherwise cause the mouse
pointer to change its shape according to the display portion it hovers
on (@pxref{Pointer Shape}). Therefore, Lisp programs that need the
mouse pointer to retain its original shape during dragging should bind
@code{track-mouse} to the value @code{dragging} at the beginning of
their @var{body}.
@end defspec
The usual purpose of tracking mouse motion is to indicate on the screen

View file

@ -815,6 +815,15 @@ This means that you can't use `make-local-variable' and expect them to
** `inhibit-point-motion-hooks' now defaults to t and is obsolete.
+++
** `track-mouse' no longer freezes the shape of the mouse pointer.
The `track-mouse' form no longer refrains from changing the shape of
the mouse pointer for the entire time the body of that form is
executed. Lisp programs that use `track-mouse' for dragging across
large portions of the Emacs display, and want to avoid changes in the
pointer shape during dragging, should bind the variable `track-mouse'
to the special value `dragging' in the body of the form.
** The optional `predicate' argument of `lisp-complete-symbol' no longer
has any effect. (This change was made in Emacs 24.4 but was not
advertised at the time.)

View file

@ -222,6 +222,8 @@ To test this function, evaluate:
(col-scrolling-p (mouse-drag-should-do-col-scrolling)))
(select-window start-window)
(track-mouse
;; Don't change the mouse pointer shape while we drag.
(setq track-mouse 'dragging)
(while (progn
(setq event (read-event)
end (event-end event)

View file

@ -468,8 +468,10 @@ must be one of the symbols `header', `mode', or `vertical'."
(setq dragged t)
(adjust-window-trailing-edge window growth nil t))
(setq last-position position))))))
;; Start tracking.
(setq track-mouse t)
;; Start tracking. The special value 'dragging' signals the
;; display engine to freeze the mouse pointer shape for as long
;; as we drag.
(setq track-mouse 'dragging)
;; Loop reading events and sampling the position of the mouse.
(setq exitfun
(set-transient-map

View file

@ -437,6 +437,8 @@ the mouse has been clicked."
(let ((drags 0)
event)
(track-mouse
;; Signal the display engine to freeze the mouse pointer shape.
(setq track-mouse 'dragging)
(while (mouse-movement-p (setq event (read-event)))
(setq drags (1+ drags))
(when (eq window (posn-window (event-end event)))

View file

@ -4965,6 +4965,9 @@ The event, EV, is the mouse event."
(artist-no-rb-set-point1 x1 y1))
(unwind-protect
(track-mouse
;; We don't want flickering of mouse pointer shape while we
;; drag the mouse.
(setq track-mouse 'dragging)
(while (or (mouse-movement-p ev)
(member 'down (event-modifiers ev)))
(setq ev-start-pos (artist-coord-win-to-buf

View file

@ -29105,7 +29105,7 @@ static void
define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer)
{
/* Do not change cursor shape while dragging mouse. */
if (!NILP (do_mouse_tracking))
if (EQ (do_mouse_tracking, Qdragging))
return;
if (!NILP (pointer))
@ -30727,6 +30727,8 @@ They are still logged to the *Messages* buffer. */);
DEFSYM (Qarrow, "arrow");
/* also Qtext */
DEFSYM (Qdragging, "dragging");
DEFSYM (Qinhibit_free_realized_faces, "inhibit-free-realized-faces");
list_of_error = list1 (list2 (Qerror, Qvoid_variable));