emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 60f66cc2a2: Fix selecting text and releasing the mouse buttons ab


From: Po Lu
Subject: master 60f66cc2a2: Fix selecting text and releasing the mouse buttons above the toolbar
Date: Mon, 11 Apr 2022 20:42:21 -0400 (EDT)

branch: master
commit 60f66cc2a29cfdfa1f5547bda874274b92a067e2
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix selecting text and releasing the mouse buttons above the toolbar
    
    * src/xterm.c (handle_one_xevent): Don't send ButtonRelease
    events to tool bars if there is no selected tool bar item.
---
 src/xterm.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 801a964105..342f2b044f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -15812,7 +15812,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                 int y = event->xbutton.y;
 
                 window = window_from_coordinates (f, x, y, 0, true, true);
-                tool_bar_p = EQ (window, f->tool_bar_window);
+                tool_bar_p = (EQ (window, f->tool_bar_window)
+                             && (event->xbutton.type != ButtonRelease
+                                 || f->last_tool_bar_item != -1));
 
                 if (tool_bar_p && event->xbutton.button < 4)
                  handle_tool_bar_click
@@ -17200,7 +17202,16 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                      int y = bv.y;
 
                      window = window_from_coordinates (f, x, y, 0, true, true);
-                     tool_bar_p = EQ (window, f->tool_bar_window);
+                     /* Ignore button release events if the mouse
+                        wasn't previously pressed on the tool bar.
+                        We do this because otherwise selecting some
+                        text with the mouse and then releasing it on
+                        the tool bar doesn't stop selecting text,
+                        since the tool bar eats the button up
+                        event.  */
+                     tool_bar_p = (EQ (window, f->tool_bar_window)
+                                   && (xev->evtype != XI_ButtonRelease
+                                       || f->last_tool_bar_item != -1));
 
                      if (tool_bar_p && xev->detail < 4)
                        handle_tool_bar_click_with_device



reply via email to

[Prev in Thread] Current Thread [Next in Thread]