diff options
| author | Eli Zaretskii | 2015-06-30 18:59:21 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-06-30 18:59:21 +0300 |
| commit | edd09381c618125d8aa23c9414034fbeee176305 (patch) | |
| tree | 009641f2aad95cc9852b06b036a4e6a9f143be94 | |
| parent | 881c4790266c42805ac1b9a5f1bbe13d3dd23478 (diff) | |
| download | emacs-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.texi | 13 | ||||
| -rw-r--r-- | etc/NEWS | 9 | ||||
| -rw-r--r-- | lisp/mouse-drag.el | 2 | ||||
| -rw-r--r-- | lisp/mouse.el | 6 | ||||
| -rw-r--r-- | lisp/ruler-mode.el | 2 | ||||
| -rw-r--r-- | lisp/textmodes/artist.el | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 4 |
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}. | |||
| 2018 | You should design @var{body} to return when it sees the up-event that | 2018 | You should design @var{body} to return when it sees the up-event that |
| 2019 | indicates the release of the button, or whatever kind of event means | 2019 | indicates the release of the button, or whatever kind of event means |
| 2020 | it is time to stop tracking. | 2020 | it is time to stop tracking. |
| 2021 | |||
| 2022 | The @code{track-mouse} form causes Emacs to generate mouse motion | ||
| 2023 | events by binding the variable @code{mouse-tracking} to a | ||
| 2024 | non-@code{nil} value. If that variable has the special value | ||
| 2025 | @code{dragging}, it additionally instructs the display engine to | ||
| 2026 | refrain from changing the shape of the mouse pointer. This is | ||
| 2027 | desirable in Lisp programs that require mouse dragging across large | ||
| 2028 | portions of Emacs display, which might otherwise cause the mouse | ||
| 2029 | pointer to change its shape according to the display portion it hovers | ||
| 2030 | on (@pxref{Pointer Shape}). Therefore, Lisp programs that need the | ||
| 2031 | mouse pointer to retain its original shape during dragging should bind | ||
| 2032 | @code{track-mouse} to the value @code{dragging} at the beginning of | ||
| 2033 | their @var{body}. | ||
| 2021 | @end defspec | 2034 | @end defspec |
| 2022 | 2035 | ||
| 2023 | The usual purpose of tracking mouse motion is to indicate on the screen | 2036 | The usual purpose of tracking mouse motion is to indicate on the screen |
| @@ -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. | ||
| 820 | The `track-mouse' form no longer refrains from changing the shape of | ||
| 821 | the mouse pointer for the entire time the body of that form is | ||
| 822 | executed. Lisp programs that use `track-mouse' for dragging across | ||
| 823 | large portions of the Emacs display, and want to avoid changes in the | ||
| 824 | pointer shape during dragging, should bind the variable `track-mouse' | ||
| 825 | to 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 |
| 819 | has any effect. (This change was made in Emacs 24.4 but was not | 828 | has any effect. (This change was made in Emacs 24.4 but was not |
| 820 | advertised at the time.) | 829 | 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: | |||
| 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 | |||
| 29105 | define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) | 29105 | define_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)); |