From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#10867: 26.3; XIM preedit/status font handling Date: Wed, 07 Oct 2020 06:20:45 +0200 Message-ID: <87blhe650i.fsf@gnus.org> References: <83bljl7ejw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21867"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Xuetian Weng , 10867@debbugs.gnu.org To: Yichao Yu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 07 06:21:15 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQ0x0-0005Z9-It for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Oct 2020 06:21:14 +0200 Original-Received: from localhost ([::1]:53012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQ0wz-0008HK-M3 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Oct 2020 00:21:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQ0wo-0008GQ-ML for bug-gnu-emacs@gnu.org; Wed, 07 Oct 2020 00:21:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43224) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQ0wo-0002oj-CV for bug-gnu-emacs@gnu.org; Wed, 07 Oct 2020 00:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kQ0wo-0005zs-8q for bug-gnu-emacs@gnu.org; Wed, 07 Oct 2020 00:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Oct 2020 04:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10867 X-GNU-PR-Package: emacs Original-Received: via spool by 10867-submit@debbugs.gnu.org id=B10867.160204446123025 (code B ref 10867); Wed, 07 Oct 2020 04:21:02 +0000 Original-Received: (at 10867) by debbugs.gnu.org; 7 Oct 2020 04:21:01 +0000 Original-Received: from localhost ([127.0.0.1]:54770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQ0wn-0005zJ-62 for submit@debbugs.gnu.org; Wed, 07 Oct 2020 00:21:01 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:39966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQ0wk-0005z5-Ki for 10867@debbugs.gnu.org; Wed, 07 Oct 2020 00:20:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+w4ExpUQ+SxdxT77qwIVeeh5whRraKxzvUoV3AsUZBQ=; b=XfbslEc1IYLCLO+g/VeHa9SUDC Qo/XH15VwbUBV6ockQTADedONH873h3Hb3qvvIlLCcOD/8ZoVYkpyW/kPmJECy3X31m4lPAdzMCXg 1RLp4o558NelKYgCvUrprYcMNQgq83nUQiAYG/MEE/rkqqt5XFFgGrJlFIlGkqpZg/jI=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQ0wY-000104-AT; Wed, 07 Oct 2020 06:20:52 +0200 X-Now-Playing: Jamie XX's _In Colour_: "Obvs" In-Reply-To: (Yichao Yu's message of "Fri, 21 Aug 2020 00:53:02 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:189971 Archived-At: Yichao Yu 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