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: Sat, 04 Feb 2023 16:43:31 +0800 Message-ID: <87zg9t95xo.fsf@yahoo.com> References: <16B04B25-8EB8-4967-947B-C03DF3690ADF@medranocalvo.com> <831qn5vnvb.fsf@gnu.org> 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="29726"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61241@debbugs.gnu.org, =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 04 09:46:12 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 1pOEBX-0007Z1-SM for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Feb 2023 09:46:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOEBP-00043k-W5; Sat, 04 Feb 2023 03:46: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 1pOEBO-00043c-V9 for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 03:46: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 1pOEBO-0002t2-Mv for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 03:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOEBO-00025p-IV for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 03:46: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: Sat, 04 Feb 2023 08:46:02 +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.16755003608029 (code B ref 61241); Sat, 04 Feb 2023 08:46:02 +0000 Original-Received: (at 61241) by debbugs.gnu.org; 4 Feb 2023 08:46:00 +0000 Original-Received: from localhost ([127.0.0.1]:40655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOEBM-00025R-Bu for submit@debbugs.gnu.org; Sat, 04 Feb 2023 03:46:00 -0500 Original-Received: from sonic316-49.consmr.mail.ne1.yahoo.com ([66.163.187.175]:41591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOEBJ-000259-Pn for 61241@debbugs.gnu.org; Sat, 04 Feb 2023 03:45:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1675500350; bh=FoMFpQSaVpI4rK+MN5/2iVsDcPqMK1pJQ2kqIAzsPDs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=nEkEWkvYiMV1VRafbJozee0orQrKsgPYFQSRklXImdqmFIh+ZD+wb+McQYxr3NZHR4vhfH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VA cDte5_pjzs27VMENk0qhnhG7_rj1xj.qki.PazjA6W6DaYhTb4esWsbf_1n7joHFDOXXGGLrRXgG FZhKEJFJYETJ21UAfcAHMjbZ2qJbOYP7mUOLPr5NykfDJv_c6d1ZtHQGNZ_mmgbgBLrkabZ17D3n m1TScK2Sym_g_jDnJrPs7r6aM.LWiK0R3HxYJsBhEdx5oCqXttgK3WSdHy9nduxgaTNRax.IQ45Y bF97hpiw33Ph.1hXuARtaGkkYgMUrd8Fq6MfcskpV6215iBtguv2TRQWILBCqPoa._90WnPjSJIS lZg2NTDEWIYJdNbgvPbvJf9jPqi2G1RvSMQmIkWVZ3Kn942.jziSSNOsZ91OLOyKF0OVUlzL9A4h rhdzetLYlxeuJnVTOWGxIzgx0mg0NcNo.8bChAkGjHT0NwCNWjittvST..lLDn1rwV1OpfOiNhLV NPJOwCLQ6DjFfrF6cCOLxBy1tFittsvUrnNuuSjnkIhQYl0zIpjM0nuBAqgTQwYJypCT6vON7K4o wf4C0SNiM9IGoJhiMFeGm_FyU2YjHKuvnup.T5USlY X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.ne1.yahoo.com with HTTP; Sat, 4 Feb 2023 08:45:50 +0000 Original-Received: by hermes--production-sg3-9fc5746c8-xxb6k (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID f5c47ba08a3c39f87e5d8cf088747d7d; Sat, 04 Feb 2023 08:43:48 +0000 (UTC) In-Reply-To: <831qn5vnvb.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Feb 2023 10:25:12 +0200") 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:254760 Archived-At: Eli Zaretskii writes: >> From: Adri=C3=A1n Medra=C3=B1o Calvo >> >> Date: Thu, 2 Feb 2023 23:28:01 +0100 >>=20 >> For the implementation of `mouse-autoselect-window', the entered window >> is remembered and then compared when an mouse motion event is received. >> Up to Emacs 28, this value was stored in a static local variable named >> `last_mouse_window' in the block handling MotionNotify within >> `handle_one_xevent'. With the introduction of XInput 2, >> `handle_one_xevent' was adjusted to account for XI_Motion events, with >> the oversight that a new local static `last_mouse_window' variable was >> declared in the new handler block for XI_Motion. As a result, when >> Emacs receives motion events from XInput and XInput2 sources >> alternatively the value of each `last_mouse_window=E2=80=99 differs, lea= ding to >> the window under the motion sometimes not being selected, as the >> value `last_mouse_window' is out-of-date for the particular XInput >> version. >>=20 >> This bug impacts the GNU ELPA package EXWM. EXWM tries to extrapolate >> applicable Emacs functionality to X window management; among others >> assigns an Emacs buffer to each managed X window, and positions the X >> window over the Emacs window in which the buffer is displayed. When >> `mouse-autoselect-windows=E2=80=99 and the user moves the mouse pointer = over one >> X window managed by EXWM, this X window receives the mouse events and not >> Emacs, therefore the Emacs window is not selected. In order to overcome >> this, EXWM sends a synthetic MotionNotify event to Emacs. >>=20 >> The attached patch fixes the issue. Thanks. But first of all, Emacs is not at all prepared to receive both MotionNotify events and XI_Motion events on a frame at the same time in other areas as well, such as focus tracking. This is not possible under an X server. So EXWM should send XI_Motion events when the X server supports XInput 2 (they are Generic Events, and XCB lets you send them, though not Xlib because nobody has written a working event to wire function yet.) Or alternatively, why doesn't exwm just focus the window itself?