From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Amos Bird Newsgroups: gmane.emacs.bugs Subject: bug#47377: [PATCH] Fix preeditarea reporting wrong spot Date: Thu, 25 Mar 2021 14:57:13 +0800 Message-ID: <87k0pv4t6e.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26472"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.10; emacs 28.0.50 To: 47377@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 25 07:56:12 2021 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 1lPJud-0006l2-UO for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Mar 2021 07:56:11 +0100 Original-Received: from localhost ([::1]:37264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPJuc-0005Pc-Dp for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Mar 2021 02:56:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPJuU-0005PP-JQ for bug-gnu-emacs@gnu.org; Thu, 25 Mar 2021 02:56:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lPJuU-00032g-Bu for bug-gnu-emacs@gnu.org; Thu, 25 Mar 2021 02:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lPJuU-0001C3-9b for bug-gnu-emacs@gnu.org; Thu, 25 Mar 2021 02:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Amos Bird Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Mar 2021 06:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47377 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16166553164531 (code B ref -1); Thu, 25 Mar 2021 06:56:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Mar 2021 06:55:16 +0000 Original-Received: from localhost ([127.0.0.1]:36972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPJtk-0001B0-0Q for submit@debbugs.gnu.org; Thu, 25 Mar 2021 02:55:16 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:38836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPJth-0001As-TE for submit@debbugs.gnu.org; Thu, 25 Mar 2021 02:55:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPJth-0005Er-L4 for bug-gnu-emacs@gnu.org; Thu, 25 Mar 2021 02:55:13 -0400 Original-Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:44867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lPJte-0002Sw-It for bug-gnu-emacs@gnu.org; Thu, 25 Mar 2021 02:55:13 -0400 Original-Received: by mail-pj1-x102c.google.com with SMTP id kk2-20020a17090b4a02b02900c777aa746fso514670pjb.3 for ; Wed, 24 Mar 2021 23:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=user-agent:from:to:subject:date:message-id:mime-version; bh=6YvifRIQ1levGM2Qsfh72QPgWzvUFQeV4sdI7faFJ+c=; b=jKwBGiG+5vFgNbiu4Zka/9WdS7URBNNu4VzRB6aZHLnOiQdvum3N8JPGJ9ZVqhrYVZ 0sgRM4D7euhhahINoukRG7NHtgOpm87hyDgZ4VyMKtP3b5anMklug320MfeDjAYEB+mH SqIoBBlb62eHLhXd0zbJYl+P3kb0YqpaA1oXluyhPlQbKITjcImSapfEEaXfwRp+0cBS M2eOvbRX7jibwAor1zlzL/iBoO7wpTyprplbl7czpIVgVnSLgpUMk9FPuRKfjKxelbC6 WoyzAmvw8jMvO6qroo2XOG+VJyJNwCaOgUa49m/B+NTALhSTv0sXPNB3xJWP000C7pM1 Or1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version; bh=6YvifRIQ1levGM2Qsfh72QPgWzvUFQeV4sdI7faFJ+c=; b=SMwwbWDjH5yPfvV40ittncJ68HUjEesK9UriEU3NZA3RIODVYTaAR936+GypK5sF01 KM7DOAv9Fg1/xKhl2F9o80QfxyssFi7PovJxNWHYQWlzSG/KVB4L5s5RlBWRK6PKrG8g wWggfcnlXZN8VE1VvSenN4vedHh7LNczz39TnHUABbVIChW/2iDG1n+B+IrvLBG49PDt MIxf5fLQeCKRXbarb6V1MZXcF9Yoeq+MOhqTpLTlL5REmgWZI9UNs/U9KVLjxzonqe9Y uAtmS1Nqyahmim2kUtrxm97UWP4dFoc0xvDxg7KaUlAHkiSHUGUkVpYM/mtUFWeuExVQ LYVQ== X-Gm-Message-State: AOAM531kb3w6iCV9nsQTf/X5nfzeWQZYYOuPJyBWBQTg96e7pUzrPQz1 oNj3M4ciaRV2Bjv8X0e89inK7EAkSKJQYQ== X-Google-Smtp-Source: ABdhPJzMz7lGQabjALSKD8vsW8AXtkavnoZIVWKZlFr7+lRwU6ls9d5VHI/c7J/J3HEuYu374m4Q6g== X-Received: by 2002:a17:90a:516:: with SMTP id h22mr7047536pjh.222.1616655308063; Wed, 24 Mar 2021 23:55:08 -0700 (PDT) Original-Received: from localhost ([103.112.79.202]) by smtp.gmail.com with ESMTPSA id j35sm4702547pgj.45.2021.03.24.23.55.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 23:55:07 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=amosbird@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:202985 Archived-At: --=-=-= Content-Type: text/plain; format=flowed This patch adjust the x position of preeditarea with both left fringe and left margin, which prevents IME preedit box (such as fcitx) from placing at the wrong position in GUI emacs. This fixes the bug described in https://lists.defectivebydesign.org/archive/html/emacs-devel/2017-02/msg00817.html I've already assigned the form for contributing to emacs. regards, Amos --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-preeditarea-reporting-wrong-spot.patch >From 769adf8858c067e779c07087f53048455ff1c7f3 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Thu, 25 Mar 2021 14:50:46 +0800 Subject: [PATCH] Fix preeditarea reporting wrong spot. This patch adjust the x position of preeditarea with both left fringe and left margin, which prevents IME preedit box (such as fcitx) from placing at the wrong position in GUI emacs. --- src/xfns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xfns.c b/src/xfns.c index d90644819b..0507dc8f61 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2783,7 +2783,7 @@ xic_set_preeditarea (struct window *w, int x, int y) XVaNestedList attr; XPoint spot; - spot.x = WINDOW_TO_FRAME_PIXEL_X (w, x) + WINDOW_LEFT_FRINGE_WIDTH (w); + spot.x = WINDOW_TO_FRAME_PIXEL_X (w, x) + WINDOW_LEFT_FRINGE_WIDTH (w) + WINDOW_LEFT_MARGIN_WIDTH(w); spot.y = WINDOW_TO_FRAME_PIXEL_Y (w, y) + FONT_BASE (FRAME_FONT (f)); attr = XVaCreateNestedList (0, XNSpotLocation, &spot, NULL); XSetICValues (FRAME_XIC (f), XNPreeditAttributes, attr, NULL); -- 2.31.0 --=-=-=--