summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-06-30 18:59:21 +0300
committerEli Zaretskii <eliz@gnu.org>2015-06-30 18:59:21 +0300
commitedd09381c618125d8aa23c9414034fbeee176305 (patch)
tree009641f2aad95cc9852b06b036a4e6a9f143be94
parent881c4790266c42805ac1b9a5f1bbe13d3dd23478 (diff)
downloademacs-edd09381c618125d8aa23c9414034fbeee176305.tar.gz
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'.
-rw-r--r--doc/lispref/frames.texi13
-rw-r--r--etc/NEWS9
-rw-r--r--lisp/mouse-drag.el2
-rw-r--r--lisp/mouse.el6
-rw-r--r--lisp/ruler-mode.el2
-rw-r--r--lisp/textmodes/artist.el3
-rw-r--r--src/xdisp.c4
7 files changed, 36 insertions, 3 deletions
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index ddf81f3e805..79b5172ae0b 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index 1f8cbbc1b98..389de167fc6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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.)
diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index 88838edaaed..945c305db7d 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -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)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 7854d32eb20..9bb00cb105e 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -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
diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index f0b012ed2f1..4f68909ed4c 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -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)))
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index 14cf402a971..a29418e6f84 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -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
diff --git a/src/xdisp.c b/src/xdisp.c
index 25eed01ecfc..5bef44c6e51 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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));