diff options
| author | Po Lu | 2022-04-11 19:27:07 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-11 19:27:48 +0800 |
| commit | 07ee24d83debfeb0570a596fa27e7203bf55a4b3 (patch) | |
| tree | 5ecfd65e90dae55c793edb0d2c0ce84e354b60c8 /src | |
| parent | 11080420dd7f2c34bbebf797de6eb4d4a14dae35 (diff) | |
| download | emacs-07ee24d83debfeb0570a596fa27e7203bf55a4b3.tar.gz emacs-07ee24d83debfeb0570a596fa27e7203bf55a4b3.zip | |
Fix event source attribution for GTK input methods
* src/gtkutil.c (xg_im_context_commit): Use pending keystroke
source if it exists.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gtkutil.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index 4fc0edf8ace..718da171f49 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -6274,6 +6274,10 @@ xg_im_context_commit (GtkIMContext *imc, gchar *str, | |||
| 6274 | { | 6274 | { |
| 6275 | struct frame *f = user_data; | 6275 | struct frame *f = user_data; |
| 6276 | struct input_event ie; | 6276 | struct input_event ie; |
| 6277 | #ifdef HAVE_XINPUT2 | ||
| 6278 | struct xi_device_t *source; | ||
| 6279 | struct x_display_info *dpyinfo; | ||
| 6280 | #endif | ||
| 6277 | 6281 | ||
| 6278 | EVENT_INIT (ie); | 6282 | EVENT_INIT (ie); |
| 6279 | /* This used to use g_utf8_to_ucs4_fast, which led to bad results | 6283 | /* This used to use g_utf8_to_ucs4_fast, which led to bad results |
| @@ -6292,6 +6296,22 @@ xg_im_context_commit (GtkIMContext *imc, gchar *str, | |||
| 6292 | make_fixnum (SCHARS (ie.arg)), | 6296 | make_fixnum (SCHARS (ie.arg)), |
| 6293 | Qcoding, Qt, ie.arg); | 6297 | Qcoding, Qt, ie.arg); |
| 6294 | 6298 | ||
| 6299 | #ifdef HAVE_XINPUT2 | ||
| 6300 | dpyinfo = FRAME_DISPLAY_INFO (f); | ||
| 6301 | |||
| 6302 | /* There is no timestamp associated with commit events, so use the | ||
| 6303 | device that sent the last event to be filtered. */ | ||
| 6304 | if (dpyinfo->pending_keystroke_time) | ||
| 6305 | { | ||
| 6306 | dpyinfo->pending_keystroke_time = 0; | ||
| 6307 | source = xi_device_from_id (dpyinfo, | ||
| 6308 | dpyinfo->pending_keystroke_source); | ||
| 6309 | |||
| 6310 | if (source) | ||
| 6311 | ie.device = source->name; | ||
| 6312 | } | ||
| 6313 | #endif | ||
| 6314 | |||
| 6295 | XSETFRAME (ie.frame_or_window, f); | 6315 | XSETFRAME (ie.frame_or_window, f); |
| 6296 | ie.modifiers = 0; | 6316 | ie.modifiers = 0; |
| 6297 | ie.timestamp = 0; | 6317 | ie.timestamp = 0; |