diff options
| author | Po Lu | 2022-02-04 13:13:06 +0800 |
|---|---|---|
| committer | Po Lu | 2022-02-04 13:13:49 +0800 |
| commit | a42df6542ac8b66d7a05c2746b2045d1e7df252b (patch) | |
| tree | 8e6e2183ea2e6ff791149fea6aceb7b6169d433d /src | |
| parent | a654985bca4c48472bd17a2723fc93bcd5e27d6c (diff) | |
| download | emacs-a42df6542ac8b66d7a05c2746b2045d1e7df252b.tar.gz emacs-a42df6542ac8b66d7a05c2746b2045d1e7df252b.zip | |
Fix toggling `x-gtk-use-native-input'.
* lisp/term/x-win.el (x-internal-focus-input-context):
(x-gtk-use-native-input-watcher): Update for changes to
`x-internal-focus-input-context'.
* src/xfns.c (Fx_internal_focus_input_context): New parameter
`focus'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/xfns.c b/src/xfns.c index deaf4204a9f..4b10f5035a7 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -8567,18 +8567,28 @@ DEFUN ("x-gtk-debug", Fx_gtk_debug, Sx_gtk_debug, 1, 1, 0, | |||
| 8567 | #endif /* USE_GTK */ | 8567 | #endif /* USE_GTK */ |
| 8568 | 8568 | ||
| 8569 | DEFUN ("x-internal-focus-input-context", Fx_internal_focus_input_context, | 8569 | DEFUN ("x-internal-focus-input-context", Fx_internal_focus_input_context, |
| 8570 | Sx_internal_focus_input_context, 1, 1, 0, | 8570 | Sx_internal_focus_input_context, 2, 2, 0, |
| 8571 | doc: /* Focus and set the client window of FRAME's GTK input context. | 8571 | doc: /* Focus and set the client window of FRAME's GTK input context. |
| 8572 | If FOCUS is nil, focus out and remove the client window instead. | ||
| 8572 | This should be called from a variable watcher for `x-gtk-use-native-input'. */) | 8573 | This should be called from a variable watcher for `x-gtk-use-native-input'. */) |
| 8573 | (Lisp_Object frame) | 8574 | (Lisp_Object focus, Lisp_Object frame) |
| 8574 | { | 8575 | { |
| 8575 | #ifdef USE_GTK | 8576 | #ifdef USE_GTK |
| 8576 | struct frame *f = decode_window_system_frame (frame); | 8577 | struct frame *f = decode_window_system_frame (frame); |
| 8577 | GtkWidget *widget = FRAME_GTK_OUTER_WIDGET (f); | 8578 | GtkWidget *widget = FRAME_GTK_OUTER_WIDGET (f); |
| 8578 | 8579 | ||
| 8579 | gtk_im_context_focus_in (FRAME_X_OUTPUT (f)->im_context); | 8580 | if (!NILP (focus)) |
| 8580 | gtk_im_context_set_client_window (FRAME_X_OUTPUT (f)->im_context, | 8581 | { |
| 8581 | gtk_widget_get_window (widget)); | 8582 | gtk_im_context_focus_in (FRAME_X_OUTPUT (f)->im_context); |
| 8583 | gtk_im_context_set_client_window (FRAME_X_OUTPUT (f)->im_context, | ||
| 8584 | gtk_widget_get_window (widget)); | ||
| 8585 | } | ||
| 8586 | else | ||
| 8587 | { | ||
| 8588 | gtk_im_context_focus_out (FRAME_X_OUTPUT (f)->im_context); | ||
| 8589 | gtk_im_context_set_client_window (FRAME_X_OUTPUT (f)->im_context, | ||
| 8590 | NULL); | ||
| 8591 | } | ||
| 8582 | #endif | 8592 | #endif |
| 8583 | 8593 | ||
| 8584 | return Qnil; | 8594 | return Qnil; |