diff options
| author | Po Lu | 2022-04-12 08:41:19 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-12 08:41:19 +0800 |
| commit | 60f66cc2a29cfdfa1f5547bda874274b92a067e2 (patch) | |
| tree | 9aa23ab001a5dce6e3ba86da2af0cb74250eaca4 | |
| parent | 6a480c830bc8d313ca3052570487a65411c937c2 (diff) | |
| download | emacs-60f66cc2a29cfdfa1f5547bda874274b92a067e2.tar.gz emacs-60f66cc2a29cfdfa1f5547bda874274b92a067e2.zip | |
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.
| -rw-r--r-- | src/xterm.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c index 801a9641051..342f2b044f9 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -15812,7 +15812,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 15812 | int y = event->xbutton.y; | 15812 | int y = event->xbutton.y; |
| 15813 | 15813 | ||
| 15814 | window = window_from_coordinates (f, x, y, 0, true, true); | 15814 | window = window_from_coordinates (f, x, y, 0, true, true); |
| 15815 | tool_bar_p = EQ (window, f->tool_bar_window); | 15815 | tool_bar_p = (EQ (window, f->tool_bar_window) |
| 15816 | && (event->xbutton.type != ButtonRelease | ||
| 15817 | || f->last_tool_bar_item != -1)); | ||
| 15816 | 15818 | ||
| 15817 | if (tool_bar_p && event->xbutton.button < 4) | 15819 | if (tool_bar_p && event->xbutton.button < 4) |
| 15818 | handle_tool_bar_click | 15820 | handle_tool_bar_click |
| @@ -17200,7 +17202,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 17200 | int y = bv.y; | 17202 | int y = bv.y; |
| 17201 | 17203 | ||
| 17202 | window = window_from_coordinates (f, x, y, 0, true, true); | 17204 | window = window_from_coordinates (f, x, y, 0, true, true); |
| 17203 | tool_bar_p = EQ (window, f->tool_bar_window); | 17205 | /* Ignore button release events if the mouse |
| 17206 | wasn't previously pressed on the tool bar. | ||
| 17207 | We do this because otherwise selecting some | ||
| 17208 | text with the mouse and then releasing it on | ||
| 17209 | the tool bar doesn't stop selecting text, | ||
| 17210 | since the tool bar eats the button up | ||
| 17211 | event. */ | ||
| 17212 | tool_bar_p = (EQ (window, f->tool_bar_window) | ||
| 17213 | && (xev->evtype != XI_ButtonRelease | ||
| 17214 | || f->last_tool_bar_item != -1)); | ||
| 17204 | 17215 | ||
| 17205 | if (tool_bar_p && xev->detail < 4) | 17216 | if (tool_bar_p && xev->detail < 4) |
| 17206 | handle_tool_bar_click_with_device | 17217 | handle_tool_bar_click_with_device |