bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10867: 26.3; XIM preedit/status font handling


From: Lars Ingebrigtsen
Subject: bug#10867: 26.3; XIM preedit/status font handling
Date: Wed, 07 Oct 2020 06:20:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Yichao Yu <yyc1992@gmail.com> writes:

>> Thanks.  Can someone with access to a system with this issue and
>> sufficient knowledge of what's going on please review this patch?

[...]

> All in all, the following patch fixes all the issues cleanly.
> Note that this is exactly what gtk3 does
> (https://github.com/GNOME/gtk/blob/de04aaf82db8d694af7d42ab6bb2e26d3ef0c947/modules/input/gtkimcontextxim.c#L183),
> i.e. it does not accept either XIMPreeditPosition or XIMStatusArea.

The patch was mangled by the mailer, apparently, but I've respun it
below.  It doesn't seem to introduce any regressions, but I'm not using
XIM, so that's no surprise.

Like Eli said, it would be nice if somebody with more XIM knowledge
could give this patch a look before we apply it to Emacs 28.

diff --git a/src/xfns.c b/src/xfns.c
index 46e4bd73a6..5eba34c710 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 2e0407aff4..0a242ad214 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9704,7 +9704,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
     }
@@ -10387,11 +10387,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);
              }
        }
 


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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