diff options
| author | Yichao Yu | 2020-12-28 04:17:43 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-12-28 04:17:43 +0100 |
| commit | 2a64de5e982fb8b868b76626ac2e92ddfafc9ca5 (patch) | |
| tree | 98812b40f684d8cdbf874e4466b55095da62371d /src | |
| parent | 40e9cec7d2b81d1dd1c7254acfdd5075f52040b5 (diff) | |
| download | emacs-2a64de5e982fb8b868b76626ac2e92ddfafc9ca5.tar.gz emacs-2a64de5e982fb8b868b76626ac2e92ddfafc9ca5.zip | |
Make XIM to work with non-CJK locales
* src/xfns.c (best_xim_style): Don't rely on supported_xim_styles
(bug#10867).
* src/xterm.c (x_draw_window_cursor): Adjust to modern input styles.
(xim_instantiate_callback): Ditto.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 29 | ||||
| -rw-r--r-- | src/xterm.c | 9 |
2 files changed, 5 insertions, 33 deletions
diff --git a/src/xfns.c b/src/xfns.c index abe293e903e..333385da62a 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -2321,24 +2321,6 @@ hack_wm_protocols (struct frame *f, Widget widget) | |||
| 2321 | static XFontSet xic_create_xfontset (struct frame *); | 2321 | static XFontSet xic_create_xfontset (struct frame *); |
| 2322 | static XIMStyle best_xim_style (XIMStyles *); | 2322 | static XIMStyle best_xim_style (XIMStyles *); |
| 2323 | 2323 | ||
| 2324 | |||
| 2325 | /* Supported XIM styles, ordered by preference. */ | ||
| 2326 | |||
| 2327 | static const XIMStyle supported_xim_styles[] = | ||
| 2328 | { | ||
| 2329 | XIMPreeditPosition | XIMStatusArea, | ||
| 2330 | XIMPreeditPosition | XIMStatusNothing, | ||
| 2331 | XIMPreeditPosition | XIMStatusNone, | ||
| 2332 | XIMPreeditNothing | XIMStatusArea, | ||
| 2333 | XIMPreeditNothing | XIMStatusNothing, | ||
| 2334 | XIMPreeditNothing | XIMStatusNone, | ||
| 2335 | XIMPreeditNone | XIMStatusArea, | ||
| 2336 | XIMPreeditNone | XIMStatusNothing, | ||
| 2337 | XIMPreeditNone | XIMStatusNone, | ||
| 2338 | 0, | ||
| 2339 | }; | ||
| 2340 | |||
| 2341 | |||
| 2342 | #if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT | 2324 | #if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT |
| 2343 | /* Create an X fontset on frame F with base font name BASE_FONTNAME. */ | 2325 | /* Create an X fontset on frame F with base font name BASE_FONTNAME. */ |
| 2344 | 2326 | ||
| @@ -2622,15 +2604,8 @@ xic_free_xfontset (struct frame *f) | |||
| 2622 | static XIMStyle | 2604 | static XIMStyle |
| 2623 | best_xim_style (XIMStyles *xim) | 2605 | best_xim_style (XIMStyles *xim) |
| 2624 | { | 2606 | { |
| 2625 | int i, j; | 2607 | /* Return the default style. This is what GTK3 uses and |
| 2626 | int nr_supported = ARRAYELTS (supported_xim_styles); | 2608 | should work fine with all modern input methods. */ |
| 2627 | |||
| 2628 | for (i = 0; i < nr_supported; ++i) | ||
| 2629 | for (j = 0; j < xim->count_styles; ++j) | ||
| 2630 | if (supported_xim_styles[i] == xim->supported_styles[j]) | ||
| 2631 | return supported_xim_styles[i]; | ||
| 2632 | |||
| 2633 | /* Return the default style. */ | ||
| 2634 | return XIMPreeditNothing | XIMStatusNothing; | 2609 | return XIMPreeditNothing | XIMStatusNothing; |
| 2635 | } | 2610 | } |
| 2636 | 2611 | ||
diff --git a/src/xterm.c b/src/xterm.c index 7f8728e47c4..b3632a375ad 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -9706,7 +9706,7 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, | |||
| 9706 | 9706 | ||
| 9707 | #ifdef HAVE_X_I18N | 9707 | #ifdef HAVE_X_I18N |
| 9708 | if (w == XWINDOW (f->selected_window)) | 9708 | if (w == XWINDOW (f->selected_window)) |
| 9709 | if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition)) | 9709 | if (FRAME_XIC (f)) |
| 9710 | xic_set_preeditarea (w, x, y); | 9710 | xic_set_preeditarea (w, x, y); |
| 9711 | #endif | 9711 | #endif |
| 9712 | } | 9712 | } |
| @@ -10389,11 +10389,8 @@ xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_ | |||
| 10389 | create_frame_xic (f); | 10389 | create_frame_xic (f); |
| 10390 | if (FRAME_XIC_STYLE (f) & XIMStatusArea) | 10390 | if (FRAME_XIC_STYLE (f) & XIMStatusArea) |
| 10391 | xic_set_statusarea (f); | 10391 | xic_set_statusarea (f); |
| 10392 | if (FRAME_XIC_STYLE (f) & XIMPreeditPosition) | 10392 | struct window *w = XWINDOW (f->selected_window); |
| 10393 | { | 10393 | xic_set_preeditarea (w, w->cursor.x, w->cursor.y); |
| 10394 | struct window *w = XWINDOW (f->selected_window); | ||
| 10395 | xic_set_preeditarea (w, w->cursor.x, w->cursor.y); | ||
| 10396 | } | ||
| 10397 | } | 10394 | } |
| 10398 | } | 10395 | } |
| 10399 | 10396 | ||