summaryrefslogtreecommitdiff
path: root/src/pgtkim.c
diff options
context:
space:
mode:
authorYichao Yu <yyc1992@gmail.com>2021-01-30 23:20:08 +0900
committerYuuki Harano <masm+github@masm11.me>2021-01-30 23:20:08 +0900
commit563a0d94c379292bd88e83f18560ed21c497cea9 (patch)
treeb2fb6a1f72bcad0ec80e89505ee23a4a8d41d878 /src/pgtkim.c
parente9608601e5d5f45be36a8f833a98230086e628a8 (diff)
downloademacs-563a0d94c379292bd88e83f18560ed21c497cea9.tar.gz
Add support for setting cursor location using Gtk IM Context
The existing XIC implementation doesn't work when using Gtk IM Context. Instead, `gtk_im_context_set_cursor_location` should be used to update the cursor information for the input method. * src/pgtkim.c (pgtk_im_set_cursor_location): New function to tell gtk cursor location. * src/pgtkterm.c (pgtk_draw_window_cursor): Remove invalid code and add new code to call the function. * src/pgtkterm.h: Add the function declaration.
Diffstat (limited to 'src/pgtkim.c')
-rw-r--r--src/pgtkim.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pgtkim.c b/src/pgtkim.c
index 68f83d2c6e1..ba69a27501a 100644
--- a/src/pgtkim.c
+++ b/src/pgtkim.c
@@ -210,6 +210,18 @@ pgtk_im_filter_keypress (struct frame *f, GdkEventKey * ev)
return false;
}
+void
+pgtk_im_set_cursor_location (struct frame *f, int x, int y, int width,
+ int height)
+{
+ struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+ if (dpyinfo->im.context != NULL && dpyinfo->im.focused_frame == f)
+ {
+ GdkRectangle area = { x, y, width, height };
+ gtk_im_context_set_cursor_location (dpyinfo->im.context, &area);
+ }
+}
+
static void
pgtk_im_use_context (struct pgtk_display_info *dpyinfo, bool use_p)
{