]> code.delx.au - gnu-emacs/commitdiff
Don't block changes in mouse pointer inside 'track-mouse'
authorEli Zaretskii <eliz@gnu.org>
Tue, 30 Jun 2015 15:59:21 +0000 (18:59 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 30 Jun 2015 15:59:21 +0000 (18:59 +0300)
* 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'.

doc/lispref/frames.texi
etc/NEWS
lisp/mouse-drag.el
lisp/mouse.el
lisp/ruler-mode.el
lisp/textmodes/artist.el
src/xdisp.c

index ddf81f3e805cab24f78e1150d5c9c296ba0af18f..79b5172ae0bae85b83bcbc8a7ffb0d92b8527063 100644 (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
index 1f8cbbc1b98979dc2560a4eda84bd6626acee737..389de167fc62582535e6c723349e35f7c1053293 100644 (file)
--- 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.)
index 88838edaaede2035d6324790bbce94964f180a0d..945c305db7dcb2da7d807d6a0e8b87f911459aef 100644 (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)
index 7854d32eb20421a4d7078da5bea26fb183cf019f..9bb00cb105e33b907e13c657b8423dda2afdefad 100644 (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
index f0b012ed2f141eb355c5a9b655bf2c1aa2b7bf6f..4f68909ed4ccf9ff4566f39dc93935dc7f434c52 100644 (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)))
index 14cf402a971622e4e8d9e58c1b1831ff04e50811..a29418e6f840a7758044c06d8cfaa46ed18f64dc 100644 (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
index 25eed01ecfc6cc318b08fc24be5262e83d98c418..5bef44c6e51d3c86d282b28246160c0185f0754a 100644 (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));