aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-06-30 18:59:21 +0300
committerEli Zaretskii2015-06-30 18:59:21 +0300
commitedd09381c618125d8aa23c9414034fbeee176305 (patch)
tree009641f2aad95cc9852b06b036a4e6a9f143be94
parent881c4790266c42805ac1b9a5f1bbe13d3dd23478 (diff)
downloademacs-edd09381c618125d8aa23c9414034fbeee176305.tar.gz
emacs-edd09381c618125d8aa23c9414034fbeee176305.zip
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}.
2018You should design @var{body} to return when it sees the up-event that 2018You should design @var{body} to return when it sees the up-event that
2019indicates the release of the button, or whatever kind of event means 2019indicates the release of the button, or whatever kind of event means
2020it is time to stop tracking. 2020it is time to stop tracking.
2021
2022The @code{track-mouse} form causes Emacs to generate mouse motion
2023events by binding the variable @code{mouse-tracking} to a
2024non-@code{nil} value. If that variable has the special value
2025@code{dragging}, it additionally instructs the display engine to
2026refrain from changing the shape of the mouse pointer. This is
2027desirable in Lisp programs that require mouse dragging across large
2028portions of Emacs display, which might otherwise cause the mouse
2029pointer to change its shape according to the display portion it hovers
2030on (@pxref{Pointer Shape}). Therefore, Lisp programs that need the
2031mouse pointer to retain its original shape during dragging should bind
2032@code{track-mouse} to the value @code{dragging} at the beginning of
2033their @var{body}.
2021@end defspec 2034@end defspec
2022 2035
2023The usual purpose of tracking mouse motion is to indicate on the screen 2036The 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
815 815
816** `inhibit-point-motion-hooks' now defaults to t and is obsolete. 816** `inhibit-point-motion-hooks' now defaults to t and is obsolete.
817 817
818+++
819** `track-mouse' no longer freezes the shape of the mouse pointer.
820The `track-mouse' form no longer refrains from changing the shape of
821the mouse pointer for the entire time the body of that form is
822executed. Lisp programs that use `track-mouse' for dragging across
823large portions of the Emacs display, and want to avoid changes in the
824pointer shape during dragging, should bind the variable `track-mouse'
825to the special value `dragging' in the body of the form.
826
818** The optional `predicate' argument of `lisp-complete-symbol' no longer 827** The optional `predicate' argument of `lisp-complete-symbol' no longer
819has any effect. (This change was made in Emacs 24.4 but was not 828has any effect. (This change was made in Emacs 24.4 but was not
820advertised at the time.) 829advertised 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:
222 (col-scrolling-p (mouse-drag-should-do-col-scrolling))) 222 (col-scrolling-p (mouse-drag-should-do-col-scrolling)))
223 (select-window start-window) 223 (select-window start-window)
224 (track-mouse 224 (track-mouse
225 ;; Don't change the mouse pointer shape while we drag.
226 (setq track-mouse 'dragging)
225 (while (progn 227 (while (progn
226 (setq event (read-event) 228 (setq event (read-event)
227 end (event-end event) 229 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'."
468 (setq dragged t) 468 (setq dragged t)
469 (adjust-window-trailing-edge window growth nil t)) 469 (adjust-window-trailing-edge window growth nil t))
470 (setq last-position position)))))) 470 (setq last-position position))))))
471 ;; Start tracking. 471 ;; Start tracking. The special value 'dragging' signals the
472 (setq track-mouse t) 472 ;; display engine to freeze the mouse pointer shape for as long
473 ;; as we drag.
474 (setq track-mouse 'dragging)
473 ;; Loop reading events and sampling the position of the mouse. 475 ;; Loop reading events and sampling the position of the mouse.
474 (setq exitfun 476 (setq exitfun
475 (set-transient-map 477 (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."
437 (let ((drags 0) 437 (let ((drags 0)
438 event) 438 event)
439 (track-mouse 439 (track-mouse
440 ;; Signal the display engine to freeze the mouse pointer shape.
441 (setq track-mouse 'dragging)
440 (while (mouse-movement-p (setq event (read-event))) 442 (while (mouse-movement-p (setq event (read-event)))
441 (setq drags (1+ drags)) 443 (setq drags (1+ drags))
442 (when (eq window (posn-window (event-end event))) 444 (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."
4965 (artist-no-rb-set-point1 x1 y1)) 4965 (artist-no-rb-set-point1 x1 y1))
4966 (unwind-protect 4966 (unwind-protect
4967 (track-mouse 4967 (track-mouse
4968 ;; We don't want flickering of mouse pointer shape while we
4969 ;; drag the mouse.
4970 (setq track-mouse 'dragging)
4968 (while (or (mouse-movement-p ev) 4971 (while (or (mouse-movement-p ev)
4969 (member 'down (event-modifiers ev))) 4972 (member 'down (event-modifiers ev)))
4970 (setq ev-start-pos (artist-coord-win-to-buf 4973 (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
29105define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) 29105define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer)
29106{ 29106{
29107 /* Do not change cursor shape while dragging mouse. */ 29107 /* Do not change cursor shape while dragging mouse. */
29108 if (!NILP (do_mouse_tracking)) 29108 if (EQ (do_mouse_tracking, Qdragging))
29109 return; 29109 return;
29110 29110
29111 if (!NILP (pointer)) 29111 if (!NILP (pointer))
@@ -30727,6 +30727,8 @@ They are still logged to the *Messages* buffer. */);
30727 DEFSYM (Qarrow, "arrow"); 30727 DEFSYM (Qarrow, "arrow");
30728 /* also Qtext */ 30728 /* also Qtext */
30729 30729
30730 DEFSYM (Qdragging, "dragging");
30731
30730 DEFSYM (Qinhibit_free_realized_faces, "inhibit-free-realized-faces"); 30732 DEFSYM (Qinhibit_free_realized_faces, "inhibit-free-realized-faces");
30731 30733
30732 list_of_error = list1 (list2 (Qerror, Qvoid_variable)); 30734 list_of_error = list1 (list2 (Qerror, Qvoid_variable));