diff options
| author | Po Lu | 2022-03-04 09:42:33 +0800 |
|---|---|---|
| committer | Po Lu | 2022-03-04 09:43:52 +0800 |
| commit | 6058daedf72d1170738e69a3b23f2c4c2a163ca7 (patch) | |
| tree | 8747294cfed5a682c4453c7cc24128d38425fc45 /src | |
| parent | 4df7bb9c0112007d321815d00c9dca8b44b4c9b7 (diff) | |
| download | emacs-6058daedf72d1170738e69a3b23f2c4c2a163ca7.tar.gz emacs-6058daedf72d1170738e69a3b23f2c4c2a163ca7.zip | |
Pass core scroll wheel events outside the edit widget to Emacs on GTK
* src/xterm.c (x_construct_mouse_click): Translate coordinates
if the event window is not the edit widget window.
(handle_one_xevent): Treat core scroll wheel events specially,
if mouse_or_wdesc_frame did not find the frame.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c index 2563fb31a5e..b9a4328c292 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6813,6 +6813,10 @@ x_construct_mouse_click (struct input_event *result, | |||
| 6813 | const XButtonEvent *event, | 6813 | const XButtonEvent *event, |
| 6814 | struct frame *f) | 6814 | struct frame *f) |
| 6815 | { | 6815 | { |
| 6816 | int x = event->x; | ||
| 6817 | int y = event->y; | ||
| 6818 | Window dummy; | ||
| 6819 | |||
| 6816 | /* Make the event type NO_EVENT; we'll change that when we decide | 6820 | /* Make the event type NO_EVENT; we'll change that when we decide |
| 6817 | otherwise. */ | 6821 | otherwise. */ |
| 6818 | result->kind = MOUSE_CLICK_EVENT; | 6822 | result->kind = MOUSE_CLICK_EVENT; |
| @@ -6824,8 +6828,16 @@ x_construct_mouse_click (struct input_event *result, | |||
| 6824 | ? up_modifier | 6828 | ? up_modifier |
| 6825 | : down_modifier)); | 6829 | : down_modifier)); |
| 6826 | 6830 | ||
| 6827 | XSETINT (result->x, event->x); | 6831 | /* If result->window is not the frame's edit widget (which can |
| 6828 | XSETINT (result->y, event->y); | 6832 | happen with GTK+ scroll bars, for example), translate the |
| 6833 | coordinates so they appear at the correct position. */ | ||
| 6834 | if (event->window != FRAME_X_WINDOW (f)) | ||
| 6835 | XTranslateCoordinates (FRAME_X_DISPLAY (f), | ||
| 6836 | event->window, FRAME_X_WINDOW (f), | ||
| 6837 | x, y, &x, &y, &dummy); | ||
| 6838 | |||
| 6839 | XSETINT (result->x, x); | ||
| 6840 | XSETINT (result->y, y); | ||
| 6829 | XSETFRAME (result->frame_or_window, f); | 6841 | XSETFRAME (result->frame_or_window, f); |
| 6830 | result->arg = Qnil; | 6842 | result->arg = Qnil; |
| 6831 | return Qnil; | 6843 | return Qnil; |
| @@ -11275,6 +11287,35 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 11275 | } | 11287 | } |
| 11276 | 11288 | ||
| 11277 | #ifdef USE_GTK | 11289 | #ifdef USE_GTK |
| 11290 | if (!f) | ||
| 11291 | { | ||
| 11292 | f = x_any_window_to_frame (dpyinfo, event->xbutton.window); | ||
| 11293 | |||
| 11294 | if (event->xbutton.button > 3 | ||
| 11295 | && event->xbutton.button < 9 | ||
| 11296 | && f) | ||
| 11297 | { | ||
| 11298 | if (ignore_next_mouse_click_timeout) | ||
| 11299 | { | ||
| 11300 | if (event->type == ButtonPress | ||
| 11301 | && event->xbutton.time > ignore_next_mouse_click_timeout) | ||
| 11302 | { | ||
| 11303 | ignore_next_mouse_click_timeout = 0; | ||
| 11304 | x_construct_mouse_click (&inev.ie, &event->xbutton, f); | ||
| 11305 | } | ||
| 11306 | if (event->type == ButtonRelease) | ||
| 11307 | ignore_next_mouse_click_timeout = 0; | ||
| 11308 | } | ||
| 11309 | else | ||
| 11310 | x_construct_mouse_click (&inev.ie, &event->xbutton, f); | ||
| 11311 | |||
| 11312 | *finish = X_EVENT_DROP; | ||
| 11313 | goto OTHER; | ||
| 11314 | } | ||
| 11315 | else | ||
| 11316 | f = NULL; | ||
| 11317 | } | ||
| 11318 | |||
| 11278 | if (f && xg_event_is_for_scrollbar (f, event, false)) | 11319 | if (f && xg_event_is_for_scrollbar (f, event, false)) |
| 11279 | f = 0; | 11320 | f = 0; |
| 11280 | #endif | 11321 | #endif |