From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Date: Mon, 06 Feb 2023 09:40:50 +0800 Message-ID: <87cz6n8tb1.fsf@yahoo.com> References: Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15479"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61241@debbugs.gnu.org, Eli Zaretskii To: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 06 02:44:18 2023 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 1pOqYM-0003po-Dt for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Feb 2023 02:44:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOqY8-0006B5-LR; Sun, 05 Feb 2023 20:44:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOqY6-0006Ae-Q2 for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 20:44:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOqY6-0005lS-C9 for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 20:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOqY6-0003D7-1P for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 20:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 01:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61241 X-GNU-PR-Package: emacs Original-Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.167564779012274 (code B ref 61241); Mon, 06 Feb 2023 01:44:01 +0000 Original-Received: (at 61241) by debbugs.gnu.org; 6 Feb 2023 01:43:10 +0000 Original-Received: from localhost ([127.0.0.1]:46912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOqXF-0003Bu-RJ for submit@debbugs.gnu.org; Sun, 05 Feb 2023 20:43:10 -0500 Original-Received: from sonic310-52.consmr.mail.ne1.yahoo.com ([66.163.186.233]:38670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOqXE-0003Bi-AB for 61241@debbugs.gnu.org; Sun, 05 Feb 2023 20:43:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1675647782; bh=M3SdR62SISfBFy42BLX/R9+LiwlY7rglf7gGMDbxa+U=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=rVuJFgHSlmEIVZGw6piklrv/fk3KMQScMdNenO8aSw8LEVdsPtZEoBu8UjkSbstfSkqwDrEga5C+DrrCT6ug8d+kiTh1lhwrHKi96DLUgVNfzt4QHBpyad3GneE/c/rtooIquazsNdiXYUEekxFLI41I5balFh8/TUTC2UdgEY+/ag0u469sqiRGFgrc6H8GJqF6fMK1hLwi7bUDLDgovLCnV929rt/O7bJudOCXAI/jOUDCKAY9tKsa07J3U6FNMMRmUtGT12+xZzCPCm8gBS9TWbblJRK9F/6//GU88YuFgnYiiDjMHW3p17ping7a5VAuaYl545z7KhWo9bpXSw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1675647782; bh=pugiWmt7D3Dn6n9q+N3XnMrHbDL0+nORimd9sUaX2JH=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=uUplEJVcDYNoulmMP3Pg/wXptYKo0RsI7+SBGz/hTs9TctYGuH9oub2aijC5i/fXldpchnibuv+w9TgL1W5DJU9/eMzPrGxvUpvAMEgv2rJiG56aD0YouYphIl4mj5m5RU5Vwm3oLLAW9pTYKuWSoGj35+dSg3qGunQqdjQAYB5mHcACRzSfQZEg1jXTfR0ksph+y3KyHXB7X3QSx3iOUUAhAxWpVjkIN4WPn8DAny4nbX+FcxZR6O33q9gCOzBv4VEGs71Pn3WJbAalyZxcnKjhCSk9B+w7GRqg70D9mhnIEL0dcwi0nlBwVLTFWxVfCguAAsY2Am1HAXyW3JzjiQ== X-YMail-OSG: M_bzul4VM1mAirP8VvfNkcU3PL6yiYVub9NLZ1ZYa8mvuCSW7UTBk2ekyDmQ0Nl LNX8ORgJKNXmj4tX0_94sJwPlarv2p4rZDefDZHlmzdEZYFqONv9olXuC0I2I3O0aAxhpklXmCuY edbGh3sUa1a8VtZ4U7h7V3SpSV43iqd73HMVPIVZqjU.N1VyuGCxmJp8dORReasXJbUXrrwOKjmt 7E5yCKK0VpxN7da6dN6pjpqBIusRzlzy9ujnxkukuGBOxPBSzxrwNcz3f.pOnrgss83Aac_ffLjD 20gnzVNbHCLBQOGcw2hATInmE_x1rtwxHpav3soM67tB5IY0HZYTb1JeIPFcaE3vNQBM9JbotOgO nKMY_87va1v4Jz2heUAFg2yzNlariboEd7RJvs0.nUrePDXI2KEZAqvTAtetTs9CuggTamWBLVSs MhRKaGffvzyojmTuxzTrDeSGv3YFgC__IZLiwie2cjiuwzfFvin8dRGsLYda2uC9J.GHxmCL5nzn v.sAaF9_PEiXyPlpb0.Z5ANzE65uXBQz2ouDlAGSBTLLrCLK1CwDLFZ8nplgeniHDNZ8gNPQeB5y 2sB_wD_ScIzRVq1ebLnvNnhPDMiB6MScjyxPknbgf3iknDdOPlz7IaiWwD0J0HnhU90UEjtYHClC JSNG34oex57JB2LcKFNzCB016UvhanKoiuNE1ggwHWBibIh7seLYsxAEHqZXINmLvrCkMIBabHaa 2z4gAEmj5PLaCEUctp4PTOt5C3SLDHw_qXhh8bAaGujwmqCJQHr7fr98xNskarfFSnzak_krYs2N dVb5qJ1uFQAc8slFb1ydM1x_5a9s9LwZd53j_fF1ad X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ne1.yahoo.com with HTTP; Mon, 6 Feb 2023 01:43:02 +0000 Original-Received: by hermes--production-sg3-9fc5746c8-ltdwf (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 06bc1d5ec0ef53e786357aa6b0c6aa60; Mon, 06 Feb 2023 01:40:59 +0000 (UTC) In-Reply-To: ("=?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo"'s message of "Sun, 5 Feb 2023 20:04:42 +0100") X-Mailer: WebService/1.1.21161 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254914 Archived-At: Adri=C3=A1n Medra=C3=B1o Calvo writes: > Thank you. I thought already about fixing this in EXWM by sending the > XI_Motion event when Emacs uses XInput 2 (as you propose below), but > thought that other users might be in a similar situation. For example, > a user using xdotool (I must say that I don't know whether xdotool > relies on XInput, XInput 2, XTest or something else, but for the sake > of this example please assume the former) would observe the same > behaviour as us. These tools should use the record or test extensions, which will not have these problems. > If I understand correctly, an XInput 2 enabled Emacs must handle > regular events as well because some of its frames might be in > terminals supporting only Xinput 1. If that's the case, would it be > possible to drop/reject corresponding regular events > (e.g. MotionNotifiy) on terminals supporting XInput 2? If that's not > possible, I=E2=80=99d say it=E2=80=99s better applying the patch (or simi= lar) so that, > even while unsupported, we do a best effort in reducing inconsistency. XInput 1.x is not supported by Emacs. You probably mean the X11 core protocol. It is ok for MotionNotify events to arrive on a display that has not selected for input extension events, since Emacs does not keep track of much state globally across displays. But once they do on a display that has, then a lot can go wrong. > I'll implement your suggestion in EXWM shortly, in any case before > Emacs 29 is released. How can I detect whether Emacs uses XInput 2 in > a particular terminal? The function `x-server-input-extension-version'. > (I=E2=80=99m not sure whether I understand your question, please clarify = if > you think I missed it.) Just focusing the X window (and selecting the > related Emacs window) is not enough for integrating > `mouse-autoselect-window', precisely because `last_mouse_window' gets > out-of-sync, leading to the user being unable to select back the last > Emacs window by moving the mouse over it. A possible solution to this > would be to expose `last_mouse_window' to Lisp > (e.g. `mouse-autoselect-last-window'); presumably EXWM could then set > its value as part of the above steps and have focus follow the > pointer. I=E2=80=99d say this is my preferred solution, what do you think > about this? Sounds reasonable, except it is too late in the Emacs 29 release cycle to implement this there.