]> git.eshelyaron.com Git - emacs.git/commitdiff
Show drag cursor on all window lines (mode, tab, header)
authorJared Finder <jared@finder.org>
Sat, 22 Feb 2025 22:25:37 +0000 (14:25 -0800)
committerEshel Yaron <me@eshelyaron.com>
Wed, 16 Apr 2025 07:36:11 +0000 (09:36 +0200)
* lisp/ruler-mode.el (ruler-mode-map): Remove down-mouse-1
binding that conflicts with dragging header line.
* src/xdisp.c (note_mode_line_or_margin_highlight): Renamed
to...
(note_line_or_margin_highlight): ...new name since it applies to
any window line (mode, tab, header).  Set drag cursor for window
top lines.
(note_mouse_highlight): Update call to new name (bug#76084).

(cherry picked from commit 8528249ee29b243772de48c7c44d07744adb3afc)

lisp/ruler-mode.el
src/xdisp.c

index 64568e06cc9058a7974efdc9fd645351e5f6157a..e196722a41344c36fca669271a90e4bb908fc5c3 100644 (file)
@@ -511,7 +511,6 @@ START-EVENT is the mouse click event."
 \f
 (defvar-keymap ruler-mode-map
   :doc "Keymap for `ruler-mode'."
-  "<header-line> <down-mouse-1>"   #'ignore
   "<header-line> <down-mouse-3>"   #'ignore
   "<header-line> <down-mouse-2>"   #'ruler-mode-mouse-grab-any-column
   "<header-line> S-<down-mouse-1>" #'ruler-mode-mouse-set-left-margin
index e1c09f2c165adc2ebb5a6c78c1ac502d3ceabd0e..9fa6dbfde5d0f305e998077a9b1434d6ae836b5e 100644 (file)
@@ -35873,15 +35873,15 @@ define_frame_cursor1 (struct frame *f, Emacs_Cursor cursor, Lisp_Object pointer)
 #endif
 }
 
-/* Take proper action when mouse has moved to the mode or header line
-   or marginal area AREA of window W, x-position X and y-position Y.
-   X is relative to the start of the text display area of W, so the
-   width of bitmap areas and scroll bars must be subtracted to get a
-   position relative to the start of the mode line.  */
+/* Take proper action when mouse has moved to one of the window's lines
+   (mode, tab, or header) or marginal area AREA of window W, x-position
+   X and y-position Y.  X is relative to the start of the text display
+   area of W, so the width of bitmap areas and scroll bars must be
+   subtracted to get a position relative to the start of a line.  */
 
 static void
-note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
-                                   enum window_part area)
+note_line_or_margin_highlight (Lisp_Object window, int x, int y,
+                              enum window_part area)
 {
   struct window *w = XWINDOW (window);
   struct frame *f = XFRAME (w->frame);
@@ -36017,9 +36017,13 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
       /* Change the mouse pointer according to what is under it.  */
       if (FRAME_WINDOW_P (f))
        {
-         bool draggable = (! WINDOW_BOTTOMMOST_P (w)
-                           || minibuf_level
-                           || NILP (Vresize_mini_windows));
+         bool draggable_window_bottom_line =
+           (area == ON_MODE_LINE && (! WINDOW_BOTTOMMOST_P (w)
+                                     || minibuf_level
+                                     || NILP (Vresize_mini_windows)));
+         bool draggable_window_top_line =
+           ((area == ON_HEADER_LINE || area == ON_TAB_LINE)
+            && ! WINDOW_TOPMOST_P (w));
 
          if (STRINGP (string))
            {
@@ -36038,11 +36042,12 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
                  map = Fget_text_property (pos, Qlocal_map, string);
                  if (!KEYMAPP (map))
                    map = Fget_text_property (pos, Qkeymap, string);
-                 if (!KEYMAPP (map) && draggable && area == ON_MODE_LINE)
+                 if (!KEYMAPP (map) && (draggable_window_top_line
+                                        || draggable_window_bottom_line))
                    cursor = FRAME_OUTPUT_DATA (f)->vertical_drag_cursor;
                }
            }
-         else if (draggable && area == ON_MODE_LINE)
+         else if (draggable_window_top_line || draggable_window_bottom_line)
            cursor = FRAME_OUTPUT_DATA (f)->vertical_drag_cursor;
          else if ((area == ON_MODE_LINE
                    && WINDOW_BOTTOMMOST_P (w)
@@ -36474,11 +36479,11 @@ note_mouse_highlight (struct frame *f, int x, int y)
     }
 #endif
 
-  /* Mouse is on the mode, header line or margin?  */
+  /* Mouse is on a line or margin?  */
   if (part == ON_MODE_LINE || part == ON_HEADER_LINE || part == ON_TAB_LINE
       || part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
     {
-      note_mode_line_or_margin_highlight (window, x, y, part);
+      note_line_or_margin_highlight (window, x, y, part);
 
 #ifdef HAVE_WINDOW_SYSTEM
       if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)