unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Yichao Yu <yyc1992@gmail.com>
Cc: Xuetian Weng <wengxt@gmail.com>, 10867@debbugs.gnu.org
Subject: bug#10867: 26.3; XIM preedit/status font handling
Date: Wed, 07 Oct 2020 06:20:45 +0200	[thread overview]
Message-ID: <87blhe650i.fsf@gnus.org> (raw)
In-Reply-To: <CAMvDr+Q1psTH0ZuS_P2dbQ5aYroBaQeX5cKEdN_xaiUz1z=0qQ@mail.gmail.com> (Yichao Yu's message of "Fri, 21 Aug 2020 00:53:02 -0400")

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	other threads:[~2020-10-07  4:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-22 11:41 bug#10867: 23.4 must export LC_CTYPE to zh_CN.UTF-8 or similar CJK locale to use X input method Weng Xuetian
2020-08-02 19:03 ` bug#10867: 26.3; XIM preedit/status font handling Yichao Yu
2020-08-02 20:07   ` Yichao Yu
2020-08-08  8:00     ` Eli Zaretskii
2020-08-21  4:53       ` Yichao Yu
2020-10-07  4:20         ` Lars Ingebrigtsen [this message]
2020-12-28  3:19           ` Lars Ingebrigtsen
2020-12-28  3:26             ` Yichao Yu
2020-12-28  3:28               ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blhe650i.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=10867@debbugs.gnu.org \
    --cc=wengxt@gmail.com \
    --cc=yyc1992@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).