summaryrefslogtreecommitdiff
path: root/src/pgtkterm.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/pgtkterm.c
parente9608601e5d5f45be36a8f833a98230086e628a8 (diff)
downloademacs-563a0d94c379292bd88e83f18560ed21c497cea9.tar.gz
emacs-563a0d94c379292bd88e83f18560ed21c497cea9.tar.bz2
emacs-563a0d94c379292bd88e83f18560ed21c497cea9.zip
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/pgtkterm.c')
-rw-r--r--src/pgtkterm.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 44e1f3e2966..5d1716adcb8 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -2878,6 +2878,7 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
int y, enum text_cursor_kinds cursor_type,
int cursor_width, bool on_p, bool active_p)
{
+ struct frame *f = XFRAME (w->frame);
PGTK_TRACE ("draw_window_cursor: %d, %d, %d, %d, %d, %d.",
x, y, cursor_type, cursor_width, on_p, active_p);
if (on_p)
@@ -2922,11 +2923,15 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x,
}
}
-#ifdef HAVE_X_I18N
if (w == XWINDOW (f->selected_window))
- if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition))
- xic_set_preeditarea (w, x, y);
-#endif
+ {
+ int frame_x =
+ WINDOW_TO_FRAME_PIXEL_X (w, x) + WINDOW_LEFT_FRINGE_WIDTH (w);
+ int frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, y);
+ pgtk_im_set_cursor_location (f, frame_x, frame_y,
+ w->phys_cursor_width,
+ w->phys_cursor_height);
+ }
}
}