]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix generation of mouse position lists on the tool and tab bars
authorPo Lu <luangruo@yahoo.com>
Tue, 18 Mar 2025 01:41:56 +0000 (09:41 +0800)
committerEshel Yaron <me@eshelyaron.com>
Thu, 20 Mar 2025 10:51:03 +0000 (12:51 +0200)
* src/keyboard.c (make_lispy_tty_position): Return whether an
internal border was hit.
(make_lispy_position): Only skip standard window and frame
detection process if so, as there are other scenarios where POSN
is nil but WINDOW_OR_FRAME is none the less expected to be
provided by the conditionals skipped.

(cherry picked from commit 5a4b9ca7364f225eff9b134ff06a49c46179366e)

src/keyboard.c

index e12013e13b71c634cf7c0e3cc4a331cff78db21a..89e7c4cac0365ac34d7c3923c0484cf97d1ed23b 100644 (file)
@@ -5616,9 +5616,12 @@ enum frame_border_side
    is any frame but WINDOW_OR_FRAME and R whose root is R, which is not
    decorated and has a 'drag-internal-border' parameter.  If we find a
    suitable frame, set WINDOW_OR_FRAME to it and POSN to the part of the
-   internal border corresponding to (MX, MY) on the frame found.  */
+   internal border corresponding to (MX, MY) on the frame found.
 
-static void
+   Value is 1 if MX and MY rest in one of R or its children's
+   decorations, and 0 otherwise.  */
+
+static int
 make_lispy_tty_position (struct frame *r, int mx, int my,
                         Lisp_Object *window_or_frame, Lisp_Object *posn)
 {
@@ -5678,7 +5681,10 @@ make_lispy_tty_position (struct frame *r, int mx, int my,
 
       XSETFRAME (*window_or_frame, f);
       *posn = builtin_lisp_symbol (internal_border_parts[part]);
+      return 1;
     }
+
+  return 0;
 }
 
 /* X and Y are frame-relative coordinates for a click or wheel event.
@@ -5761,10 +5767,9 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
 
   if (WINDOWP (window_or_frame) && is_tty_frame (f)
       && (is_tty_root_frame_with_visible_child (f)
-         || is_tty_child_frame (f)))
-    make_lispy_tty_position (root_frame (f), mx, my, &window_or_frame, &posn);
-
-  if (!NILP (posn))
+         || is_tty_child_frame (f))
+      && make_lispy_tty_position (root_frame (f), mx, my,
+                                 &window_or_frame, &posn))
     ;
   else if (WINDOWP (window_or_frame))
     {