diff options
| author | Po Lu | 2023-01-17 18:54:22 +0800 |
|---|---|---|
| committer | Po Lu | 2023-01-17 18:54:22 +0800 |
| commit | 96015c9c8cc1720e8ee7cd9cea4de48126dd9122 (patch) | |
| tree | c15ccc0ed7d94c1ba11d9ff70e11ff3b33b35d24 /src | |
| parent | b9025c507a3a7dae4de19b18cafaa09b18183832 (diff) | |
| download | emacs-96015c9c8cc1720e8ee7cd9cea4de48126dd9122.tar.gz emacs-96015c9c8cc1720e8ee7cd9cea4de48126dd9122.zip | |
Make tool bar highlight work correctly during touch events
* src/xterm.c (handle_one_xevent): Before activating the tool
bar in response to a touch event, set the mouse highlight to
that location. After the touch ends, clear the mouse highlight.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/xterm.c b/src/xterm.c index 6ae7e97f45a..1373045393a 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -24300,7 +24300,32 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 24300 | 24300 | ||
| 24301 | if (tool_bar_p) | 24301 | if (tool_bar_p) |
| 24302 | { | 24302 | { |
| 24303 | handle_tool_bar_click (f, x, y, true, 0); | 24303 | /* Call note_mouse_highlight on the tool bar |
| 24304 | item. Otherwise, get_tool_bar_item will | ||
| 24305 | return 1. | ||
| 24306 | |||
| 24307 | This is not necessary when mouse-highlight is | ||
| 24308 | nil. */ | ||
| 24309 | |||
| 24310 | if (!NILP (Vmouse_highlight)) | ||
| 24311 | { | ||
| 24312 | note_mouse_highlight (f, x, y); | ||
| 24313 | |||
| 24314 | /* Always allow future mouse motion to | ||
| 24315 | update the mouse highlight, no matter | ||
| 24316 | where it is. */ | ||
| 24317 | memset (&dpyinfo->last_mouse_glyph, 0, | ||
| 24318 | sizeof dpyinfo->last_mouse_glyph); | ||
| 24319 | dpyinfo->last_mouse_glyph_frame = f; | ||
| 24320 | } | ||
| 24321 | |||
| 24322 | handle_tool_bar_click_with_device (f, x, y, true, 0, | ||
| 24323 | (source | ||
| 24324 | ? source->name : Qt)); | ||
| 24325 | |||
| 24326 | /* Flush any changes made by that to the front | ||
| 24327 | buffer. */ | ||
| 24328 | x_flush_dirty_back_buffer_on (f); | ||
| 24304 | 24329 | ||
| 24305 | /* Record the device and the touch ID on the | 24330 | /* Record the device and the touch ID on the |
| 24306 | frame. That way, Emacs knows when to dismiss | 24331 | frame. That way, Emacs knows when to dismiss |
| @@ -24468,8 +24493,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 24468 | == xev->detail)) | 24493 | == xev->detail)) |
| 24469 | { | 24494 | { |
| 24470 | if (f->last_tool_bar_item != -1) | 24495 | if (f->last_tool_bar_item != -1) |
| 24471 | handle_tool_bar_click (f, xev->event_x, xev->event_y, | 24496 | handle_tool_bar_click_with_device (f, xev->event_x, |
| 24472 | false, 0); | 24497 | xev->event_y, |
| 24498 | false, 0, | ||
| 24499 | (source | ||
| 24500 | ? source->name | ||
| 24501 | : Qnil)); | ||
| 24502 | |||
| 24503 | /* Cancel any outstanding mouse highlight. */ | ||
| 24504 | note_mouse_highlight (f, -1, -1); | ||
| 24505 | x_flush_dirty_back_buffer_on (f); | ||
| 24473 | 24506 | ||
| 24474 | /* Now clear the tool bar device. */ | 24507 | /* Now clear the tool bar device. */ |
| 24475 | FRAME_OUTPUT_DATA (f)->tool_bar_touch_device = 0; | 24508 | FRAME_OUTPUT_DATA (f)->tool_bar_touch_device = 0; |