emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2a64de5: Make XIM to work with non-CJK locales


From: Lars Ingebrigtsen
Subject: master 2a64de5: Make XIM to work with non-CJK locales
Date: Sun, 27 Dec 2020 22:20:23 -0500 (EST)

branch: master
commit 2a64de5e982fb8b868b76626ac2e92ddfafc9ca5
Author: Yichao Yu <yyc1992@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 src/xfns.c  | 29 ++---------------------------
 src/xterm.c |  9 +++------
 2 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index abe293e..333385d 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2321,24 +2321,6 @@ hack_wm_protocols (struct frame *f, Widget widget)
 static XFontSet xic_create_xfontset (struct frame *);
 static XIMStyle best_xim_style (XIMStyles *);
 
-
-/* Supported XIM styles, ordered by preference.  */
-
-static const XIMStyle supported_xim_styles[] =
-{
-  XIMPreeditPosition | XIMStatusArea,
-  XIMPreeditPosition | XIMStatusNothing,
-  XIMPreeditPosition | XIMStatusNone,
-  XIMPreeditNothing | XIMStatusArea,
-  XIMPreeditNothing | XIMStatusNothing,
-  XIMPreeditNothing | XIMStatusNone,
-  XIMPreeditNone | XIMStatusArea,
-  XIMPreeditNone | XIMStatusNothing,
-  XIMPreeditNone | XIMStatusNone,
-  0,
-};
-
-
 #if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
 /* Create an X fontset on frame F with base font name BASE_FONTNAME.  */
 
@@ -2622,15 +2604,8 @@ xic_free_xfontset (struct frame *f)
 static XIMStyle
 best_xim_style (XIMStyles *xim)
 {
-  int i, j;
-  int nr_supported = ARRAYELTS (supported_xim_styles);
-
-  for (i = 0; i < nr_supported; ++i)
-    for (j = 0; j < xim->count_styles; ++j)
-      if (supported_xim_styles[i] == xim->supported_styles[j])
-       return supported_xim_styles[i];
-
-  /* Return the default style.  */
+  /* Return the default style. This is what GTK3 uses and
+     should work fine with all modern input methods.  */
   return XIMPreeditNothing | XIMStatusNothing;
 }
 
diff --git a/src/xterm.c b/src/xterm.c
index 7f8728e..b3632a3 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,
 
 #ifdef HAVE_X_I18N
       if (w == XWINDOW (f->selected_window))
-       if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition))
+       if (FRAME_XIC (f))
          xic_set_preeditarea (w, x, y);
 #endif
     }
@@ -10389,11 +10389,8 @@ xim_instantiate_callback (Display *display, XPointer 
client_data, XPointer call_
                create_frame_xic (f);
                if (FRAME_XIC_STYLE (f) & XIMStatusArea)
                  xic_set_statusarea (f);
-               if (FRAME_XIC_STYLE (f) & XIMPreeditPosition)
-                 {
-                   struct window *w = XWINDOW (f->selected_window);
-                   xic_set_preeditarea (w, w->cursor.x, w->cursor.y);
-                 }
+               struct window *w = XWINDOW (f->selected_window);
+               xic_set_preeditarea (w, w->cursor.x, w->cursor.y);
              }
        }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]