From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Resent-From: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Feb 2023 22:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 61241@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167537689821343 (code B ref -1); Thu, 02 Feb 2023 22:29:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Feb 2023 22:28:18 +0000 Received: from localhost ([127.0.0.1]:36096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNi41-0005YA-Ji for submit@debbugs.gnu.org; Thu, 02 Feb 2023 17:28:18 -0500 Received: from lists.gnu.org ([209.51.188.17]:55830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNi3y-0005Y2-Te for submit@debbugs.gnu.org; Thu, 02 Feb 2023 17:28:15 -0500 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 1pNi3y-0004lB-JG for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 17:28:14 -0500 Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1pNi3w-00059v-5h for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 17:28:14 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4P7D2D3gRfz9sbn for ; Thu, 2 Feb 2023 23:28:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=medranocalvo.com; s=MBO0001; t=1675376884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=g/kY5kWZ6N5rlOGuKZGOgZBsLYudXRzPmvVV2qEMN04=; b=bSbYh4jvy2rBPnivsiheiIBaTUdQFkDersd2VGHNZYZcy5syJdFjrnRBL7gOjd/aL8ZzRm ugLE9pr+eimqQCF2rC/HAhFLPCm4I7HKrIUqdxxW+wVF8b6cvRqFmo0qq0wbXkJsdqszyq r93UY7q/g5B3wa52JFlcEKOJYzX2KgwYLybHvYxyRzosetFo+pu+LHlduN8oxrbUwC3cHs P6Km0EdrpMqc7zLY0uCPuP9+bPp0Jb2pIzxPUugjQIudlIApdQcvinb8HI8XvvychpvtTX dNgr8jKp+egw5xoJBnnia30Kgno70WbS4UYEHNDiTWIHFltLm7MJmYfFXC0jug== From: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Content-Type: multipart/mixed; boundary="Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E" Mime-Version: 1.0 Message-Id: <16B04B25-8EB8-4967-947B-C03DF3690ADF@medranocalvo.com> Date: Thu, 2 Feb 2023 23:28:01 +0100 Received-SPF: pass client-ip=2001:67c:2050:0:465::102; envelope-from=adrian@medranocalvo.com; helo=mout-p-102.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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, = leading 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. 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. The attached patch fixes the issue. Thank you, Adri=C3=A1n Medra=C3=B1o Calvo. --Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E Content-Disposition: attachment; filename=0001-Fix-mouse-autoselect-window-for-alternating-XInput-a.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Fix-mouse-autoselect-window-for-alternating-XInput-a.patch" Content-Transfer-Encoding: quoted-printable =46rom=20e16d6ddbfdc4110fbbbcf763cff5a72b0f0df92c=20Mon=20Sep=2017=20= 00:00:00=202001=0AMessage-Id:=20= =0AFrom:=20=3D?UTF-8?q?Adri=3DC3=3DA1n=3D20Medra=3DC3=3DB1o=3D20Cal= vo?=3D=0A=20=0ADate:=20Wed,=201=20Feb=202023=20= 00:00:00=20+0000=0ASubject:=20[PATCH]=20Fix=20`mouse-autoselect-window'=20= for=20alternating=20XInput=20and=0A=20XInput=202=20events=0A=0A*=20= src/xterm.c=20(handle_one_xevent):=20Move=20`last_mouse_window'=20to=0A= main=20function=20scope=20to=20share=20value=20between=20XInput=20and=20= XInput=202=0Ahandlers.=0A---=0A=20src/xterm.c=20|=206=20+++---=0A=201=20= file=20changed,=203=20insertions(+),=203=20deletions(-)=0A=0Adiff=20= --git=20a/src/xterm.c=20b/src/xterm.c=0Aindex=206a4b84babe4..dd20c8c7fe5=20= 100644=0A---=20a/src/xterm.c=0A+++=20b/src/xterm.c=0A@@=20-18364,6=20= +18364,9=20@@=20handle_one_xevent=20(struct=20x_display_info=20*dpyinfo,=0A= =20=20=20GdkDisplay=20*gdpy=20=3D=20gdk_x11_lookup_xdisplay=20= (dpyinfo->display);=0A=20#endif=0A=20=20=20int=20dx,=20dy;=0A+=20=20/*=20= Holds=20the=20last=20window=20the=20mouse=20moved=20over,=20used=20for=0A= +=20=20=20=20=20`mouse-autoselect-window'=20*/=0A+=20=20static=20= Lisp_Object=20last_mouse_window;=0A=20=0A=20=20=20/*=20Avoid=20warnings=20= when=20SAFE_ALLOCA=20is=20not=20actually=20used.=20=20*/=0A=20#if=20= defined=20HAVE_XINPUT2=20||=20defined=20HAVE_XKB=20||=20defined=20= HAVE_X_I18N=0A@@=20-20677,8=20+20680,6=20@@=20handle_one_xevent=20= (struct=20x_display_info=20*dpyinfo,=0A=20=09=09&&=20(f=20=3D=3D=20= XFRAME=20(selected_frame)=0A=20=09=09=20=20=20=20||=20!NILP=20= (focus_follows_mouse)))=0A=20=09=20=20=20=20=20=20{=0A-=09=09static=20= Lisp_Object=20last_mouse_window;=0A-=0A=20=09=09if=20(xmotion.window=20= !=3D=20FRAME_X_WINDOW=20(f))=0A=20=09=09=20=20{=0A=20=09=09=20=20=20=20= x_translate_coordinates=20(f,=20xmotion.x_root,=20xmotion.y_root,=0A@@=20= -22587,7=20+22588,6=20@@=20handle_one_xevent=20(struct=20x_display_info=20= *dpyinfo,=0A=20=09=09=20=20=20=20=20=20&&=20(f=20=3D=3D=20XFRAME=20= (selected_frame)=0A=20=09=09=09=20=20||=20!NILP=20= (focus_follows_mouse)))=0A=20=09=09=20=20=20=20{=0A-=09=09=20=20=20=20=20= =20static=20Lisp_Object=20last_mouse_window;=0A=20=09=09=20=20=20=20=20=20= Lisp_Object=20window=20=3D=20window_from_coordinates=20(f,=20ev.x,=20= ev.y,=200,=20false,=20false);=0A=20=0A=20=09=09=20=20=20=20=20=20/*=20A=20= window=20will=20be=20autoselected=20only=20when=20it=20is=20not=0A--=20=0A= 2.39.1=0A=0A= --Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii In GNU Emacs 29.0.60 (build 1, x86_64-apple-darwin22.2.0, cairo version 1.17.6) of 2023-01-26 built on amcmac Repository revision: f8c95d1a7681e861fc22d2a040cda0ddfe23eff4 Repository branch: master Windowing system distributor 'The X.Org Foundation', version = 11.0.12101006 System Description: macOS 13.2 Configured using: 'configure --prefix=3D/Volumes/sys/repos/emacs-cairo/rel --without-makeinfo --without-dbus --without-ns --with-x-toolkit=3Dno --with-cairo = PKG_CONFIG_PATH=3D/opt/X11/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgco= nfig:/usr/local/opt/fontconfig/lib/pkgconfig:/usr/local/opt/ncurses/lib/pk= gconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/Cellar/jpeg/9d/lib= /pkgconfig:/usr/local/Cellar/libtiff/4.3.0/lib/pkgconfig:/usr/local/opt/ha= rfbuzz/lib/pkgconfig/:/usr/local/opt/harfbuzz/lib/pkgconfig/ 'CFLAGS=3D-Og -g3' --without-jpeg --without-gif --without-xpm --without-tiff' Configured features: ACL CAIRO FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE OLDXMENU PDUMPER PNG RSVG SQLITE3 THREADS WEBP X11 XDBE XIM XINPUT2 ZLIB Important settings: value of $LC_ALL: en_US.UTF-8 value of $LANG: en_US value of $XMODIFIERS: @im=3Dexwm-xim locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads kqueue lcms2 dynamic-setting system-font-setting font-render-setting cairo xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 38318 8147) (symbols 48 5108 0) (strings 32 12656 2131) (string-bytes 1 362604) (vectors 16 10252) (vector-slots 8 147251 15877) (floats 8 42 19) (intervals 56 263 0) (buffers 976 10))= --Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E-- From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Feb 2023 08:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo , Po Lu Cc: 61241@debbugs.gnu.org Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.167549913029368 (code B ref 61241); Sat, 04 Feb 2023 08:26:01 +0000 Received: (at 61241) by debbugs.gnu.org; 4 Feb 2023 08:25:30 +0000 Received: from localhost ([127.0.0.1]:40626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pODrW-0007dc-7y for submit@debbugs.gnu.org; Sat, 04 Feb 2023 03:25:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pODrU-0007dN-67 for 61241@debbugs.gnu.org; Sat, 04 Feb 2023 03:25:28 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pODrK-0007xT-KF; Sat, 04 Feb 2023 03:25:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=IMLBMPxPD+a82926Ns8H97w5Y0vipT9p36Rd5Havhx4=; b=P8Pxe8ZKIjgtfF6NEV3j gJw4Wt6dczllA8huARVEIR8g4QGt/mP4Ph1Vui3Zs6kIDBBGbZhqLHryzT7lH1wgrkRztlCC2Jn1z BP3B8Pcz7oUquPwnMRW2RUR6zewgbUL+vjSg0oeko5PKQXInUidIB2PsdF4o7aIMB7lhRegPRJwl8 WJmj5xQDgNfupBolQ3kH8i29FqNnZN2cc/mJRP7AtkEMsd8cIwGMNKffW49I7g5jpfrZFYp3XfrEI ytjJKwWmYWtCoRRkUjB9cSqyZL7v6MgIxfU+X9NG1xO7pNhlCou4Hz6/EN6+sb1Ql7vEEW3HTbkJc My0oJWvK9srEKg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pODr8-0000ct-C6; Sat, 04 Feb 2023 03:25:18 -0500 Date: Sat, 04 Feb 2023 10:25:12 +0200 Message-Id: <831qn5vnvb.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <16B04B25-8EB8-4967-947B-C03DF3690ADF@medranocalvo.com> (adrian@medranocalvo.com) References: <16B04B25-8EB8-4967-947B-C03DF3690ADF@medranocalvo.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Adrián Medraño Calvo > > Date: Thu, 2 Feb 2023 23:28:01 +0100 > > 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’ differs, leading 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. > > 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’ 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. > > The attached patch fixes the issue. > > Thank you, > Adrián Medraño Calvo. > > From e16d6ddbfdc4110fbbbcf763cff5a72b0f0df92c Mon Sep 17 00:00:00 2001 > Message-Id: > From: =?UTF-8?q?Adri=C3=A1n=20Medra=C3=B1o=20Calvo?= > > Date: Wed, 1 Feb 2023 00:00:00 +0000 > Subject: [PATCH] Fix `mouse-autoselect-window' for alternating XInput and > XInput 2 events > > * src/xterm.c (handle_one_xevent): Move `last_mouse_window' to > main function scope to share value between XInput and XInput 2 > handlers. > --- > src/xterm.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/xterm.c b/src/xterm.c > index 6a4b84babe4..dd20c8c7fe5 100644 > --- a/src/xterm.c > +++ b/src/xterm.c > @@ -18364,6 +18364,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, > GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display); > #endif > int dx, dy; > + /* Holds the last window the mouse moved over, used for > + `mouse-autoselect-window' */ > + static Lisp_Object last_mouse_window; > > /* Avoid warnings when SAFE_ALLOCA is not actually used. */ > #if defined HAVE_XINPUT2 || defined HAVE_XKB || defined HAVE_X_I18N > @@ -20677,8 +20680,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, > && (f == XFRAME (selected_frame) > || !NILP (focus_follows_mouse))) > { > - static Lisp_Object last_mouse_window; > - > if (xmotion.window != FRAME_X_WINDOW (f)) > { > x_translate_coordinates (f, xmotion.x_root, xmotion.y_root, > @@ -22587,7 +22588,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, > && (f == XFRAME (selected_frame) > || !NILP (focus_follows_mouse))) > { > - static Lisp_Object last_mouse_window; > Lisp_Object window = window_from_coordinates (f, ev.x, ev.y, 0, false, false); > > /* A window will be autoselected only when it is not > -- > 2.39.1 Po Lu, any comments, or should this go in? From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 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 X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 61241@debbugs.gnu.org, =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.16755003608029 (code B ref 61241); Sat, 04 Feb 2023 08:46:02 +0000 Received: (at 61241) by debbugs.gnu.org; 4 Feb 2023 08:46:00 +0000 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 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+McQYxr3NZHR4vhfHyzgc0x2Xv02lmsKdFgPVegsRF35JuM5Hzzulg0kQ9FIPLSPogM2fbdSSk1oX5WOAgRjpfXnj5dLhsWGbs5XOWDyHWalB37tffLxktmAj/vGZwf5RSTb+tPvZaVASsv0KbuWNqsfOYzgWO6jQ2+KV2KWX161tuX6IOtWPPvJwltqoB0Ojq1J1fV59BD3MkHgTqzZYcMyDCoCJ8Aj5w3KkAChS8UDyHAxiSO9DGgxy4oGFpjiL18sM8T8emHQIrwnDoR13f9dMbqL0Xxrg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1675500350; bh=RK7k4r29ujDXWOjEVn9kDA3GJdVLSdE3gm+8VjYF76a=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=ek+TAt8MJsnX82sK53ie0o1X4rYR/EOXW9sWvHh3JQPf7jRVzLBoqydLwHqvsG0fVsTAtLzC0j0bmdodWMdI8pQDAXgd781eHY7wEUP1u0rp4A74OCLKo5IkFcfJvi44ole9z44DPRulupK9DdBcXOabQlhWUlaAgBlIy2oCIXeUT7k65t4Gf9k/vsHwk4QfCVrAHzCLLNC31mfR2vPtaA2xJqV4IYBxjyR+xXbJSW1G7E3viwZSBXgGyeeVRYxx0UX/AT80VeN2tMfLYkmi5dm5FAiyWgSY/JzZ3ezj7Y3MJDNcq0wXgPqL/Q3lhwygDrQsoka7NxUxnPjUtHSspA== X-YMail-OSG: iNf7ykQVM1lIkeh8Ki_GnxAhaJ.GgGwmcQ8uAu0nSRF9UStI4UKYjln5n4s2LUx b04G1qoxg1KOQm8ZrN5DFSzj4jCMJoxhEPflrfr_dFkQIR4UoR65JHsazI88ICKpDd77zHDXNynf blFnJ6x6Cjodq6k9Rea8V1FaE68rQxHkCsEqM4lIfmFQYxuIhEqLW4.tutTRm2r3DY5ciPAKl7wr r9zDSL4ux6ezIn8.cTyTexY83Dnakh4iN6nwbAQ6Vz0WeZ_NbyCUeWzBeeWZaYoGEN1Bs1707NVA 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.T5USlYGmu2tV4Sr83WUSXC6NbJByOGxzobPGJfkQ XagJyGX0OjkVMpzYWuosqumbUbE47pF1wyN1p8lcTM2vMJXwFRRXEtyB.8vwfAXoq3S8HDpfZlgq 5PMehLSDAg58N6eI9q_fUFu2kPmmCCLC8LwVMnTPjNmgjONiydNmBC_BKsjyZWPsqLhK0YoJJKoK rt92SnyFHbd8L4kiwzRIY9qKPmS97rLOwrYnVp6Kr13dSVNyCX7ZlkCK1l57XP9eWeXlbNakBAQc uf_M_lKQ4l59ZqRKgwVuR2CFLlZtRAApzG.MmK3nOhrcuSjbr_EhK9h.IkRGSsGf70nFquZRtKAA tiIYnzIxuAhoBa78MFVs2._9XlUR7aMTN9MgoObyueWxElPvQ.2fqzlxtRCuJ3czEOtGTBmBnWJ1 W_MAuWsSNo0dfiIWhBwtNLfWAEkadIYn.hNPj3su_sHHQn5_hahPlAhL0m.U7bVlwDWzwnmL_PO_ 5Lc560.bK2v6j3HIv9GX5r3xNw9GNmHlT.iEDhhkElgoxDxhnUhnNAaO.PqH6JkddaUs.Wp9P3Dz i_RR7vPmI1OoibvzvOoFtrEwZl8AdhDOqEUkv7FfcMgx8YWcbVsCTvSHZMI.e300Yqs3SEvB4jUo 2nIZ1_yvs6aMEZxPhCQkLViaA1A5Kt8iuIMdHB0hnG7K89GASElO_V7ize30aGn8gtAAXKZOiMzC ppFTpTZtcRvzssFxlnvV47nYAi_2y9_Tpd_s01AgJqONd3OGvlSz9IpAVbxFJ4zl.8ar_rNvoFld IReTm.0nFYfN6ryuvqCc14OyYM92SRp1rLfLjD6wusL_oBNCvl_ICx.sh8ulF9OfBMC5VBT84Out GEErQ0xvvXX1tKaHC6PN2Qp7V2VPmi5nw6vK2RPZ4mANqz1.CQVjI9vO046DLRUK2nh6rOp17HFv GNg8kELRzOCBe7x.PeTIjHPEolFpYM7SogFNVycVL25N9WzF7A3jZ3konVwl08t.YSlFBa1iygn8 rcj1LvfB1dCXLA9kx4ihaUv_yqdwL7IPy3TC5rjXKCSsAj1rKmty4SQAJTNB14b7iKD209sKw4z0 UhDTow7SAS4fQgdQpRmyps2c5zP5ddzbOEd9y8pOVomW6UOQDknQO8huMe1U_pki7e.gCxfH3eIF SDL1DdPspAk_Otr.0YOLdKN.Euocf33tKx2cNZb0VN0OR35mzisfINimSBEVOIEvYkjWy2gyrSkw nPgqxj3xnBkrFnj0AiMdSjzct0_WGmu7waK_mHqYafqu10By_1FM15SI1foIrR29jRCR5qmITZ41 oQWwPsJt21BphiPH_MhylXkZV2peh8b.NIzeYP7ZKmzNUWjDFTxqHpI.g58yxmHivjqYSXGLI1K_ J2ev2PpUdmLqs0ZLR8BQk5D.5qLaQ_VwySnf_h7b9AYvAN.pVGsCb22pBcjux9yedCO8IqHb6vne KzZivJtnVOWo- X-Sonic-MF: 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 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) From: Po Lu In-Reply-To: <831qn5vnvb.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Feb 2023 10:25:12 +0200") References: <16B04B25-8EB8-4967-947B-C03DF3690ADF@medranocalvo.com> <831qn5vnvb.fsf@gnu.org> Date: Sat, 04 Feb 2023 16:43:31 +0800 Message-ID: <87zg9t95xo.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.21161 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 2169 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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? From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 References: <16B04B25-8EB8-4967-947B-C03DF3690ADF@medranocalvo.com> In-Reply-To: <16B04B25-8EB8-4967-947B-C03DF3690ADF@medranocalvo.com> Resent-From: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 19:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu Cc: 61241@debbugs.gnu.org, Eli Zaretskii Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.167562390620347 (code B ref 61241); Sun, 05 Feb 2023 19:06:01 +0000 Received: (at 61241) by debbugs.gnu.org; 5 Feb 2023 19:05:06 +0000 Received: from localhost ([127.0.0.1]:46462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkK2-0005I6-8d for submit@debbugs.gnu.org; Sun, 05 Feb 2023 14:05:06 -0500 Received: from mout-p-201.mailbox.org ([80.241.56.171]:43270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOkJz-0005HV-Or for 61241@debbugs.gnu.org; Sun, 05 Feb 2023 14:05:04 -0500 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4P8zNR1KBmz9scb; Sun, 5 Feb 2023 20:04:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=medranocalvo.com; s=MBO0001; t=1675623895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GBimI4n+cxD9ETfPeRbtOp3WfPI9BpFBkL/B5pBeAAA=; b=FipYDGhDwbznLRdji5PV6LnLmwdBb3puCKu6FtQX0uX3pa+rZ0FHP/2/7B+AkblQE/C98M qrwXoWNpvysZnwsYL03eVEt4Vmr2oN+jfTA/Sc+0U3cX4lUbTxuK2198igBjuptFitAyWS 8jtuo3SJEWgRYwuxtggyB2hxXaRkOLsfAXMROMhmiG9mPO4FWDP+BAvClBeSFqja3UEFDd xVYsjeQRChbX7EBTvKww8UEJKqCkMjyLGrNaAoawfs3xF4lsqdaJU7ULAxximg1VU8YIRF oIJiKqCrUhFrqRlR0BvQQiSPwdM5WpDd6x4CGBtFou6YmACxtw4Mc2ngUlzA4w== Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Mime-Version: 1.0 (1.0) Message-Id: Date: Sun, 5 Feb 2023 20:04:42 +0100 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) =EF=BB=BF Please see below. > Am 04.02.2023 um 09:45 schrieb Po Lu : > =EF=BB=BFEli Zaretskii writes: >=20 >>> From: Adri=C3=A1n Medra=C3=B1o Calvo >>> >>> Date: Thu, 2 Feb 2023 23:28:01 +0100 >>> 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. >>> 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 o= ver one >>> X window managed by EXWM, this X window receives the mouse events and no= t >>> Emacs, therefore the Emacs window is not selected. In order to overcome= >>> this, EXWM sends a synthetic MotionNotify event to Emacs. >>> The attached patch fixes the issue. >=20 > 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. >=20 > This is not possible under an X server. Thank you. I thought already about fixing this in EXWM by sending the XI_Mot= ion event when Emacs uses XInput 2 (as you propose below), but thought that o= ther users might be in a similar situation. For example, a user using xdotoo= l (I must say that I don't know whether xdotool relies on XInput, XInput 2, X= Test or something else, but for the sake of this example please assume the f= ormer) would observe the same behaviour as us. If I understand correctly, an XInput 2 enabled Emacs must handle regular eve= nts 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 correspon= ding regular events (e.g. MotionNotifiy) on terminals supporting XInput 2? I= f that's not possible, I=E2=80=99d say it=E2=80=99s better applying the patc= h (or similar) so that, even while unsupported, we do a best effort in reduc= ing inconsistency. > 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.) I'll implement your suggestion in EXWM shortly, in any case before Emacs 29 i= s released. How can I detect whether Emacs uses XInput 2 in a particular ter= minal? > Or alternatively, why doesn't exwm just focus the window itself? (I=E2=80=99m not sure whether I understand your question, please clarify if y= ou think I missed it.) Just focusing the X window (and selecting the related= Emacs window) is not enough for integrating `mouse-autoselect-window', prec= isely because `last_mouse_window' gets out-of-sync, leading to the user bein= g 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 valu= e as part of the above steps and have focus follow the pointer. I=E2=80=99d s= ay this is my preferred solution, what do you think about this? From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 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 X-GNU-PR-Keywords: To: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Cc: 61241@debbugs.gnu.org, Eli Zaretskii Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.167564779012274 (code B ref 61241); Mon, 06 Feb 2023 01:44:01 +0000 Received: (at 61241) by debbugs.gnu.org; 6 Feb 2023 01:43:10 +0000 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 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_fF1adoZWGS.Nn5anmyhE6lQsKxW11.2o4S6ueCe WqjyE.Q_6YseEMkDYmHL5ksx1hxMB80HRmPqI8OH2ILeSw0j.oeWVe8Nt0NoXE1pOzYayjX5Uies p9j66eXeNsTuQYY66R4cK6b8MT7Vl0zSnHyMTfePZhGrgymLudUWMFBXkyH7YqIVdU7gF6EbxYw1 sFoCayUXORplUh1YqhNHjmapER7Xftforiy1PfW6QoRuBuC91.YuHdwcgqFEuqj8kllHszH3lp_G OBy.AZwwsy8j4Pdlu.wX.hTv2KhakkGl0n6pebL8hdNVWvLCmpqi2WWDmpkzfXB27CxkZUfFEbd9 eXdjmzzfzJN3vuujSMCb7HcMVr37vqf5NNrq5OuL62.v2cBWlgUiQjj8QeLA_TK5IyCgwirVKBDE 28DsO8x2YEwHzhZmh5cjdWMVt7iZMjo5QCu1uYC.uCbLh7VtPUiTveHRiD7M5jZHB82Xvjt_ynE7 weWU2jJiEAlpnyO9sEYSvY_dSQ46cSqpjp5cychQTHX5oB01MTnZH8E6fGlKPrPazZfJg3RcLGh7 Dp.tm8E7z6Uv53kQuYRf8gNkT75936btazmfYzrPA4n7VHqL0ism9IELvg2FiGUVvI6ZLQYwLyiQ BFV38dr1U2JNxSbn8sRzmekyCQ8pzr1EFVfN80NJCpEL.TflsDy.cqMMH9TZepG8CzDoH0eO694J .I3Bp2UI2tXSMAyOxMDxA3bnzY7mXmIqVkAwrdvTHVCfKnutm2d7AADz8W2DFf3SldIEL10jz6hg QWF7_kp1WfFXBNIU.rbtb1s1rBzUvZOxUUwN9W6XnricoGWMBb2gM7Oi4zrIj3XSDHqwYgTnamPC 1UhLwHF9wbIbnKDCBcdlZoPindGwkx9.05fdzlXs36VG9kmjOuA20dskmLLlaFDQCqoThUQvUXXc ohzH2_Vn2T1bVgc_D2veJKM1gMRfOtPFnZraMzr2WE7R5UwUhPNQJK3bqmPCsmaThfhh6Xh20Y32 ylciDujGkQKrC0XzEWmSZtY0YokBjDjog148FrJPF_R8NYJ09LSV44PeIaWKaYZMA_cxPi_Wlqii QDX8WCM4c0wjrTd3lUur9md073Mf8KFVt5brauWi0G6QaebzIjVOAj0BkNbm7ySrkLJjPyndUjhg zrcxNgl7pC5paDKeNXHO1druhgV08x5ERNq5Q_JK7MOf470ks9zbALstTGWbLChzyYOHir4DMHi6 ZpD6o_Eu582XU_yL78X6Hk9OrOuFQ1XRN5u2LDR0Nv0vpVvsnilnxFJ_9R7NmTZ2QgjvYv7ZXLdg BO8te2wRuNh4MtHA0.12NLHtToCtueIPqvXLP.gnmCHj1IpmejFoP4KPBAZay53GD2qL4Z71bqfD Cs79CAZpWPa2xcMg46M.bhPl8U8kUDZE.kFcnuTYfIPGMBWsZcjFQp61_kfkJ.o470zuGpYwN4ca .9zc- X-Sonic-MF: 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 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) From: Po Lu 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") References: Date: Mon, 06 Feb 2023 09:40:50 +0800 Message-ID: <87cz6n8tb1.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.21161 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 2431 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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. From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Resent-From: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Aug 2023 05:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu Cc: 61241@debbugs.gnu.org, Eli Zaretskii Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.169268318313176 (code B ref 61241); Tue, 22 Aug 2023 05:47:02 +0000 Received: (at 61241) by debbugs.gnu.org; 22 Aug 2023 05:46:23 +0000 Received: from localhost ([127.0.0.1]:58316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYKDe-0003QR-D5 for submit@debbugs.gnu.org; Tue, 22 Aug 2023 01:46:22 -0400 Received: from mout-p-101.mailbox.org ([80.241.56.151]:51478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYKDY-0003Py-S5 for 61241@debbugs.gnu.org; Tue, 22 Aug 2023 01:46:20 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4RVJHK5qD8z9sSq; Tue, 22 Aug 2023 07:46:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=medranocalvo.com; s=MBO0001; t=1692683165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qBUYaK5Oh0dd4yEJzZnYBufeKjwV+OCHpRMYdKXmTMk=; b=mA2nVFTTUxwS5oUZ3lZem4t92IT/o2So9GzIoRQ4l4G6DHAGTi/OXffYBwRuKRmrX0NgpW 7lnc0JNjLgfSS2thJmVeGYAwWofnAWVf4+A7eOb4hdwerC5x+u1pKKJj9y09qmA9eaVH5s 4lwhOQjhtePnmnH49aB9QaJ7+2YMz4+8P+DRvDs9t/PuJPQFVBKCtduN9hhdlO71ArkPAE xlmSkE6KkA6rkHgVNGIbP7+vQ7/I3CN/WU7I3oTt7eGzsr+kJPs2yWihLdTOXYkZnplQlN QiKUDqerYgaxl+zRr/0oMOD4RM0BZAiQxoV+9D6yAgf2TeTFp/Ayf2aNNWHnTw== From: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_A89BDDC9-8F3E-4A55-B82D-6D39E16121D8" Mime-Version: 1.0 Date: Tue, 22 Aug 2023 07:45:53 +0200 In-Reply-To: <87cz6n8tb1.fsf@yahoo.com> References: <87cz6n8tb1.fsf@yahoo.com> X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Apple-Mail=_A89BDDC9-8F3E-4A55-B82D-6D39E16121D8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Dear Po Lu, > On 6. Feb 2023, at 02:40, Po Lu wrote: >=20 > Adri=C3=A1n Medra=C3=B1o Calvo writes: >=20 >> 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. >=20 > These tools should use the record or test extensions, which will not > have these problems. I=E2=80=99ve tried implementing your suggestion to send an XI_Motion = event to Emacs when the mouse enters the X window managed by EXWM=E2=80=94= to no avail: 1. Using SendEvent: XI2 events are GenericEvents, Xorg disallows sending = GenericEvents within SendEvent. The following seem to be the cause: - = https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/dix/events.c#L55= 17, and especially - = https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/dix/events.c#L55= 41 2. Using XTest: although undocumented (as far as I could see), XTest = does support sending XI device events. The issue is that EXWM wants to, = when entering a managed X window, send XI_Motion events to Emacs as well = so as to trick it into thinking that the pointer entered the Emacs = window corresponding to the mentioned X window; which marks this Emacs = window the last Emacs window the pointer was over. The last think is = critical for focus-follows-mouse to work on EXWM. The obstacle I find = with XTest is that XTest just mimics moving the pointer so, when moving = the pointer to an X window and then using XTest to simulate moving the = pointer there (again), nothing changes: the XI_Motion events are again = sent to this topmost X Window. I couldn=E2=80=99t think of a way of = having the XTest events lead to XI_Motion reaching Emacs in such a = situation.=20 3. I also tried using XWrapPointer which of course does not help as it = generates no motion events. Can you think of a way forward? >> 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 = similar) so that, >> even while unsupported, we do a best effort in reducing = inconsistency. >=20 > XInput 1.x is not supported by Emacs. You probably mean the X11 core > protocol. >=20 > 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. >=20 > But once they do on a display that has, then a lot can go wrong. >=20 >> 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? >=20 > The function `x-server-input-extension-version'. >=20 >> (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? >=20 > Sounds reasonable, except it is too late in the Emacs 29 release cycle > to implement this there. I prepared a patch (attached below) introducing a new lisp variable = holding the last "mouse-autoselected=E2=80=9D window. With this patch = EXWM can simply select the Emacs window corresponding to the managed X = window and set it as last =E2=80=9Cmouse-autoselected=E2=80=9D window; = mouse-autoselect works normally after that. No more sending Motion = events. Using a single variable introduces a significant change, though: when = `mouse-autoselect-window=E2=80=99 is enabled and emacs runs in different = terminals, =E2=80=9Cmouse-autoselecting=E2=80=9D a window on a terminal = changes the last =E2=80=9Cmouse-autoselected=E2=80=9D window for all = other terminals. Slightly moving the mouse in a different terminal = (within a single Emacs window) will =E2=80=9Cmouse-autoselect=E2=80=9D = that window, whereas that would not have been the case before this = patch, as the last =E2=80=9Cmouse-autoselected=E2=80=9D window was = terminal-specific. It=E2=80=99s not clear to me whether this behaviour = will be beneficial, neutral or unacceptable. Moreover, this behaviour = is consistent with the behaviour introduced in the first patch I sent, = where I proposed to merge the last =E2=80=9Cmouse-autoselected=E2=80=9D = window for Motion and XI_Motion events (other terminals were not = affected). Please let me know your thoughts. Regards, Adri=C3=A1n. --Apple-Mail=_A89BDDC9-8F3E-4A55-B82D-6D39E16121D8 Content-Disposition: attachment; filename=0001-Expose-last-window-under-pointer-to-Lisp.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Expose-last-window-under-pointer-to-Lisp.patch" Content-Transfer-Encoding: quoted-printable =46rom=20d845f06a8155a35fe93769e600b79b951f723863=20Mon=20Sep=2017=20= 00:00:00=202001=0AMessage-ID:=20= =0AFrom:=20=3D?UTF-8?q?Adri=3DC3=3DA1n=3D20Medra=3DC3=3DB1o=3D20Cal= vo?=3D=0A=20=0ADate:=20Tue,=2015=20Aug=202023=20= 00:00:00=20+0000=0ASubject:=20[PATCH]=20Expose=20last=20window=20under=20= pointer=20to=20Lisp=0A=0A*=20src/xdisp.c=20(syms_of_xdisp):=20Add=20= defvar=0A`Vmouse_autoselect_window_last_window'.=0A*=20src/haikuterm.c=20= (haiku_read_socket):=0A*=20src/msdos.c=20(dos_rawgetc):=0A*=20= src/nsterm.m=20([EmacsView=20mouseMoved:]):=0A*=20src/pgtkterm.c=20= (motion_notify_event):=0A*=20src/w32inevt.c=20(do_mouse_event):=0A*=20= src/w32term.c=20(w32_read_socket):=0A*=20src/xterm.c=20= (handle_one_xevent):=20Use=20it=20replacing=20static=0A= `last_mouse_window'.=0A=0A*=20lisp/window.el=20= (mouse-autoselect-window-window)=0A= (mouse-autoselect-window-previous-window):=20Rename=20variable.=0A---=0A=20= lisp/window.el=20=20|=20=208=20+++++---=0A=20src/haikuterm.c=20|=20=205=20= ++---=0A=20src/msdos.c=20=20=20=20=20|=20=206=20++----=0A=20src/nsterm.m=20= =20=20=20|=20=205=20++---=0A=20src/pgtkterm.c=20=20|=20=205=20++---=0A=20= src/w32inevt.c=20=20|=20=207=20++-----=0A=20src/w32term.c=20=20=20|=20=20= 5=20++---=0A=20src/xdisp.c=20=20=20=20=20|=20=207=20+++++++=0A=20= src/xterm.c=20=20=20=20=20|=2011=20++++-------=0A=209=20files=20changed,=20= 28=20insertions(+),=2031=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/window.el=20b/lisp/window.el=0Aindex=2016f16a75418..b2677ea99f3=20= 100644=0A---=20a/lisp/window.el=0A+++=20b/lisp/window.el=0A@@=20-10391,8=20= +10391,10=20@@=20mouse-autoselect-window-position-1=0A=20(defvar=20= mouse-autoselect-window-position=20nil=0A=20=20=20"Last=20mouse=20= position=20recorded=20by=20delayed=20window=20autoselection.")=0A=20=0A= -(defvar=20mouse-autoselect-window-window=20nil=0A+(defvar=20= mouse-autoselect-window-previous-window=20nil=0A=20=20=20"Last=20window=20= recorded=20by=20delayed=20window=20autoselection.")=0A= +(define-obsolete-variable-alias=20'mouse-autoselect-window-window=0A+=20= =20'mouse-autoselect-window-previous-window=20"29.1")=0A=20=0A=20(defvar=20= mouse-autoselect-window-state=20nil=0A=20=20=20"When=20non-nil,=20= special=20state=20of=20delayed=20window=20autoselection.=0A@@=20-10425,7=20= +10427,7=20@@=20mouse-autoselect-window-start=0A=20means=20suspend=20= autoselection."=0A=20=20=20;;=20Record=20values=20for=20MOUSE-POSITION,=20= WINDOW,=20and=20SUSPEND.=0A=20=20=20(setq=20= mouse-autoselect-window-position=20mouse-position)=0A-=20=20(when=20= window=20(setq=20mouse-autoselect-window-window=20window))=0A+=20=20= (when=20window=20(setq=20mouse-autoselect-window-previous-window=20= window))=0A=20=20=20(setq=20mouse-autoselect-window-state=20(when=20= suspend=20'suspend))=0A=20=20=20;;=20Install=20timer=20which=20runs=20= `mouse-autoselect-window-select'=20after=0A=20=20=20;;=20= `mouse-autoselect-window'=20seconds.=0A@@=20-10473,7=20+10475,7=20@@=20= mouse-autoselect-window-select=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(and=20(>=3D=20mouse-autoselect-window=200)=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20If=20= `mouse-autoselect-window'=20is=20non-negative,=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20;;=20select=20window=20if=20it's=20= the=20same=20as=20before.=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(eq=20window=20mouse-autoselect-window-window))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(eq=20window=20= mouse-autoselect-window-previous-window))=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20;;=20Otherwise=20select=20window=20iff=20the=20mouse=20= is=20at=20the=20same=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ;;=20position=20as=20before.=20=20Observe=20that=20the=20first=20test=0A=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20after=20starting=20= autoselection=20usually=20fails=20since=20the=0Adiff=20--git=20= a/src/haikuterm.c=20b/src/haikuterm.c=0Aindex=208733b82fb2b..8341fd4cc53=20= 100644=0A---=20a/src/haikuterm.c=0A+++=20b/src/haikuterm.c=0A@@=20= -3471,11=20+3471,10=20@@=20haiku_read_socket=20(struct=20terminal=20= *terminal,=20struct=20input_event=20*hold_quit)=0A=20=0A=20=09=09if=20= (!NILP=20(Vmouse_autoselect_window))=0A=20=09=09=20=20{=0A-=09=09=20=20=20= =20static=20Lisp_Object=20last_mouse_window;=0A=20=09=09=20=20=20=20= Lisp_Object=20window=20=3D=20window_from_coordinates=20(f,=20b->x,=20= b->y,=200,=200,=200);=0A=20=0A=20=09=09=20=20=20=20if=20(WINDOWP=20= (window)=0A-=09=09=09&&=20!EQ=20(window,=20last_mouse_window)=0A+=09=09=09= &&=20!EQ=20(window,=20Vmouse_autoselect_window_last_window)=0A=20=09=09=09= &&=20!EQ=20(window,=20selected_window)=0A=20=09=09=09&&=20= !popup_activated_p=0A=20=09=09=09&&=20!MINI_WINDOW_P=20(XWINDOW=20= (selected_window))=0A@@=20-3486,7=20+3485,7=20@@=20haiku_read_socket=20= (struct=20terminal=20*terminal,=20struct=20input_event=20*hold_quit)=0A=20= =09=09=09inev2.frame_or_window=20=3D=20window;=0A=20=09=09=20=20=20=20=20= =20}=0A=20=0A-=09=09=20=20=20=20last_mouse_window=20=3D=20window;=0A+=09=09= =20=20=20=20Vmouse_autoselect_window_last_window=20=3D=20window;=0A=20=09= =09=20=20}=0A=20=0A=20=09=09if=20(f->auto_raise)=0Adiff=20--git=20= a/src/msdos.c=20b/src/msdos.c=0Aindex=2075a39045cee..333fd9d59e6=20= 100644=0A---=20a/src/msdos.c=0A+++=20b/src/msdos.c=0A@@=20-2652,8=20= +2652,6=20@@=20dos_rawgetc=20(void)=0A=20=09=20=20/*=20Generate=20= SELECT_WINDOW_EVENTs=20when=20needed.=20=20*/=0A=20=09=20=20if=20(!NILP=20= (Vmouse_autoselect_window))=0A=20=09=20=20=20=20{=0A-=09=20=20=20=20=20=20= static=20Lisp_Object=20last_mouse_window;=0A-=0A=20=09=20=20=20=20=20=20= mouse_window=20=3D=20window_from_coordinates=0A=20=09=09(SELECTED_FRAME=20= (),=20mouse_last_x,=20mouse_last_y,=200,=200,=200);=0A=20=09=20=20=20=20=20= =20/*=20A=20window=20will=20be=20selected=20only=20when=20it=20is=20not=0A= @@=20-2661,7=20+2659,7=20@@=20dos_rawgetc=20(void)=0A=20=09=09=20not=20= in=20it.=20=20A=20minibuffer=20window=20will=20be=20selected=20iff=0A=20=09= =09=20it=20is=20active.=20=20*/=0A=20=09=20=20=20=20=20=20if=20(WINDOWP=20= (mouse_window)=0A-=09=09=20=20&&=20!EQ=20(mouse_window,=20= last_mouse_window)=0A+=09=09=20=20&&=20!EQ=20(mouse_window,=20= Vmouse_autoselect_window_last_window)=0A=20=09=09=20=20&&=20!EQ=20= (mouse_window,=20selected_window))=0A=20=09=09{=0A=20=09=09=20=20= event.kind=20=3D=20SELECT_WINDOW_EVENT;=0A@@=20-2671,7=20+2669,7=20@@=20= dos_rawgetc=20(void)=0A=20=09=09=20=20kbd_buffer_store_event=20(&event);=0A= =20=09=09}=0A=20=09=20=20=20=20=20=20/*=20Remember=20the=20last=20window=20= where=20we=20saw=20the=20mouse.=20=20*/=0A-=09=20=20=20=20=20=20= last_mouse_window=20=3D=20mouse_window;=0A+=09=20=20=20=20=20=20= Vmouse_autoselect_window_last_window=20=3D=20mouse_window;=0A=20=09=20=20= =20=20}=0A=20=0A=20=09=20=20previous_help_echo_string=20=3D=20= help_echo_string;=0Adiff=20--git=20a/src/nsterm.m=20b/src/nsterm.m=0A= index=20c809c0b824a..060898bb842=20100644=0A---=20a/src/nsterm.m=0A+++=20= b/src/nsterm.m=0A@@=20-7530,12=20+7530,11=20@@=20-=20(void)mouseMoved:=20= (NSEvent=20*)e=0A=20=20=20if=20(!NILP=20(Vmouse_autoselect_window))=0A=20= =20=20=20=20{=0A=20=20=20=20=20=20=20NSTRACE_MSG=20= ("mouse_autoselect_window");=0A-=20=20=20=20=20=20static=20Lisp_Object=20= last_mouse_window;=0A=20=20=20=20=20=20=20Lisp_Object=20window=0A=20=09=3D= =20window_from_coordinates=20(emacsframe,=20pt.x,=20pt.y,=200,=200,=20= 0);=0A=20=0A=20=20=20=20=20=20=20if=20(WINDOWP=20(window)=0A-=20=20=20=20= =20=20=20=20=20=20&&=20!EQ=20(window,=20last_mouse_window)=0A+=20=20=20=20= =20=20=20=20=20=20&&=20!EQ=20(window,=20= Vmouse_autoselect_window_last_window)=0A=20=20=20=20=20=20=20=20=20=20=20= &&=20!EQ=20(window,=20selected_window)=0A=20=09=20=20&&=20!MINI_WINDOW_P=20= (XWINDOW=20(selected_window))=0A=20=20=20=20=20=20=20=20=20=20=20&&=20= (!NILP=20(focus_follows_mouse)=0A@@=20-7548,7=20+7547,7=20@@=20-=20= (void)mouseMoved:=20(NSEvent=20*)e=0A=20=20=20=20=20=20=20=20=20=20=20= EV_TRAILER2=20(e);=0A=20=20=20=20=20=20=20=20=20}=0A=20=20=20=20=20=20=20= /*=20Remember=20the=20last=20window=20where=20we=20saw=20the=20mouse.=20=20= */=0A-=20=20=20=20=20=20last_mouse_window=20=3D=20window;=0A+=20=20=20=20= =20=20Vmouse_autoselect_window_last_window=20=3D=20window;=0A=20=20=20=20= =20}=0A=20=0A=20=20=20dragging=20=3D=20(e.type=20=3D=3D=20= NSEventTypeLeftMouseDragged);=0Adiff=20--git=20a/src/pgtkterm.c=20= b/src/pgtkterm.c=0Aindex=20e767e15cc07..b343bd99fbe=20100644=0A---=20= a/src/pgtkterm.c=0A+++=20b/src/pgtkterm.c=0A@@=20-5889,7=20+5889,6=20@@=20= motion_notify_event=20(GtkWidget=20*widget,=20GdkEvent=20*event,=0A=20=09= =20=20=20=20=20also=20when=20the=20target=20window=20is=20on=20another=20= frame.=20=20*/=0A=20=09=20=20&&=20(f=20=3D=3D=20XFRAME=20= (selected_frame)=20||=20!NILP=20(focus_follows_mouse)))=0A=20=09{=0A-=09=20= =20static=20Lisp_Object=20last_mouse_window;=0A=20=09=20=20Lisp_Object=20= window=20=3D=20window_from_coordinates=0A=20=09=20=20=20=20(f,=20= event->motion.x,=20event->motion.y,=200,=20false,=20false);=0A=20=0A@@=20= -5902,7=20+5901,7=20@@=20motion_notify_event=20(GtkWidget=20*widget,=20= GdkEvent=20*event,=0A=20=09=20=20=20=20=20autoselection=20the=20window=20= is=20usually=20the=20window's=20text=0A=20=09=20=20=20=20=20area=20= including=20the=20margins.=20=20*/=0A=20=09=20=20if=20(WINDOWP=20= (window)=0A-=09=20=20=20=20=20=20&&=20!EQ=20(window,=20= last_mouse_window)=0A+=09=20=20=20=20=20=20&&=20!EQ=20(window,=20= Vmouse_autoselect_window_last_window)=0A=20=09=20=20=20=20=20=20&&=20!EQ=20= (window,=20selected_window))=0A=20=09=20=20=20=20{=0A=20=09=20=20=20=20=20= =20inev.ie.kind=20=3D=20SELECT_WINDOW_EVENT;=0A@@=20-5910,7=20+5909,7=20= @@=20motion_notify_event=20(GtkWidget=20*widget,=20GdkEvent=20*event,=0A=20= =09=20=20=20=20}=0A=20=0A=20=09=20=20/*=20Remember=20the=20last=20window=20= where=20we=20saw=20the=20mouse.=20=20*/=0A-=09=20=20last_mouse_window=20= =3D=20window;=0A+=09=20=20Vmouse_autoselect_window_last_window=20=3D=20= window;=0A=20=09}=0A=20=0A=20=20=20=20=20=20=20if=20= (!note_mouse_movement=20(f,=20&event->motion))=0Adiff=20--git=20= a/src/w32inevt.c=20b/src/w32inevt.c=0Aindex=2029717954cfd..c800291c2f8=20= 100644=0A---=20a/src/w32inevt.c=0A+++=20b/src/w32inevt.c=0A@@=20-467,7=20= +467,6=20@@=20do_mouse_event=20(MOUSE_EVENT_RECORD=20*event,=0A=20=09=09= struct=20input_event=20*emacs_ev)=0A=20{=0A=20=20=20static=20DWORD=20= button_state=20=3D=200;=0A-=20=20static=20Lisp_Object=20= last_mouse_window;=0A=20=20=20DWORD=20but_change,=20mask,=20flags=20=3D=20= event->dwEventFlags;=0A=20=20=20int=20i;=0A=20=0A@@=20-502,7=20+501,7=20= @@=20do_mouse_event=20(MOUSE_EVENT_RECORD=20*event,=0A=20=09=09=20=20=20= not=20in=20it.=20=20A=20minibuffer=20window=20will=20be=20selected=20iff=0A= =20=09=09=20=20=20it=20is=20active.=20=20*/=0A=20=09=09if=20(WINDOWP=20= (mouse_window)=0A-=09=09=20=20=20=20&&=20!EQ=20(mouse_window,=20= last_mouse_window)=0A+=09=09=20=20=20=20&&=20!EQ=20(mouse_window,=20= Vmouse_autoselect_window_last_window)=0A=20=09=09=20=20=20=20&&=20!EQ=20= (mouse_window,=20selected_window))=0A=20=09=09=20=20{=0A=20=09=09=20=20=20= =20struct=20input_event=20event;=0A@@=20-514,10=20+513,8=20@@=20= do_mouse_event=20(MOUSE_EVENT_RECORD=20*event,=0A=20=09=09=20=20=20=20= event.timestamp=20=3D=20movement_time;=0A=20=09=09=20=20=20=20= kbd_buffer_store_event=20(&event);=0A=20=09=09=20=20}=0A-=09=09= last_mouse_window=20=3D=20mouse_window;=0A+=09=09= Vmouse_autoselect_window_last_window=20=3D=20mouse_window;=0A=20=09=20=20= =20=20=20=20}=0A-=09=20=20=20=20else=0A-=09=20=20=20=20=20=20= last_mouse_window=20=3D=20Qnil;=0A=20=0A=20=09=20=20=20=20= previous_help_echo_string=20=3D=20help_echo_string;=0A=20=09=20=20=20=20= help_echo_string=20=3D=20help_echo_object=20=3D=20help_echo_window=20=3D=20= Qnil;=0Adiff=20--git=20a/src/w32term.c=20b/src/w32term.c=0Aindex=20= 2899e82b295..f9d86637024=20100644=0A---=20a/src/w32term.c=0A+++=20= b/src/w32term.c=0A@@=20-5333,7=20+5333,6=20@@=20w32_read_socket=20= (struct=20terminal=20*terminal,=0A=20=09=09=20=20=20=20=20=20||=20(!NILP=20= (focus_follows_mouse)=0A=20=09=09=09=20=20&&=20!FRAME_NO_ACCEPT_FOCUS=20= (f))))=0A=20=09=09{=0A-=09=09=20=20static=20Lisp_Object=20= last_mouse_window;=0A=20=09=09=20=20Lisp_Object=20window=20=3D=20= window_from_coordinates=0A=20=09=09=20=20=20=20(f,=20LOWORD=20= (msg.msg.lParam),=20HIWORD=20(msg.msg.lParam),=200,=200,=200);=0A=20=0A= @@=20-5342,7=20+5341,7=20@@=20w32_read_socket=20(struct=20terminal=20= *terminal,=0A=20=09=09=20=20=20=20=20not=20in=20it.=20=20Minibuffer=20= window=20will=20be=20selected=0A=20=09=09=20=20=20=20=20only=20when=20it=20= is=20active.=20=20*/=0A=20=09=09=20=20if=20(WINDOWP=20(window)=0A-=09=09=20= =20=20=20=20=20&&=20!EQ=20(window,=20last_mouse_window)=0A+=09=09=20=20=20= =20=20=20&&=20!EQ=20(window,=20Vmouse_autoselect_window_last_window)=0A=20= =09=09=20=20=20=20=20=20&&=20!EQ=20(window,=20selected_window))=0A=20=09=09= =20=20=20=20{=0A=20=09=09=20=20=20=20=20=20inev.kind=20=3D=20= SELECT_WINDOW_EVENT;=0A@@=20-5350,7=20+5349,7=20@@=20w32_read_socket=20= (struct=20terminal=20*terminal,=0A=20=09=09=20=20=20=20}=0A=20=0A=20=09=09= =20=20/*=20Remember=20the=20last=20window=20where=20we=20saw=20the=20= mouse.=20=20*/=0A-=09=09=20=20last_mouse_window=20=3D=20window;=0A+=09=09= =20=20Vmouse_autoselect_window_last_window=20=3D=20window;=0A=20=09=09}=0A= =20=0A=20=09=20=20=20=20=20=20if=20(!w32_note_mouse_movement=20(f,=20= &msg.msg))=0Adiff=20--git=20a/src/xdisp.c=20b/src/xdisp.c=0Aindex=20= 9cddcfeda27..dc0cbb658f6=20100644=0A---=20a/src/xdisp.c=0A+++=20= b/src/xdisp.c=0A@@=20-36854,6=20+36854,13=20@@=20syms_of_xdisp=20(void)=0A= =20of=20your=20window=20manager.=20=20*/);=0A=20=20=20= Vmouse_autoselect_window=20=3D=20Qnil;=0A=20=0A+=20=20DEFVAR_LISP=20= ("mouse-autoselect-window-last-window",=0A+=09=20=20=20=20=20=20=20= Vmouse_autoselect_window_last_window,=0A+=20=20=20=20doc:=20/*=20Last=20= window=20entered=20by=20the=20the=20mouse=20pointer.=0A+This=20variable=20= is=20tracked=20only=20when=20both=20`mouse-autoselect-window'=20and=0A= +`focus-follows-mouse'=20are=20non-nil.=20*/);=0A+=20=20= Vmouse_autoselect_window_last_window=20=3D=20Qnil;=0A+=0A=20=20=20= DEFVAR_LISP=20("auto-resize-tab-bars",=20Vauto_resize_tab_bars,=0A=20=20=20= =20=20doc:=20/*=20Non-nil=20means=20automatically=20resize=20tab-bars.=0A= =20This=20dynamically=20changes=20the=20tab-bar's=20height=20to=20the=20= minimum=20height=0Adiff=20--git=20a/src/xterm.c=20b/src/xterm.c=0Aindex=20= 5840b15bcb7..36ba3103a70=20100644=0A---=20a/src/xterm.c=0A+++=20= b/src/xterm.c=0A@@=20-20681,8=20+20681,6=20@@=20handle_one_xevent=20= (struct=20x_display_info=20*dpyinfo,=0A=20=09=09&&=20(f=20=3D=3D=20= XFRAME=20(selected_frame)=0A=20=09=09=20=20=20=20||=20!NILP=20= (focus_follows_mouse)))=0A=20=09=20=20=20=20=20=20{=0A-=09=09static=20= Lisp_Object=20last_mouse_window;=0A-=0A=20=09=09if=20(xmotion.window=20= !=3D=20FRAME_X_WINDOW=20(f))=0A=20=09=09=20=20{=0A=20=09=09=20=20=20=20= x_translate_coordinates=20(f,=20xmotion.x_root,=20xmotion.y_root,=0A@@=20= -20702,7=20+20700,7=20@@=20handle_one_xevent=20(struct=20x_display_info=20= *dpyinfo,=0A=20=09=09=20=20=20autoselection=20the=20window=20is=20= usually=20the=20window's=20text=0A=20=09=09=20=20=20area=20including=20= the=20margins.=20=20*/=0A=20=09=09if=20(WINDOWP=20(window)=0A-=09=09=20=20= =20=20&&=20!EQ=20(window,=20last_mouse_window)=0A+=09=09=20=20=20=20&&=20= !EQ=20(window,=20Vmouse_autoselect_window_last_window)=0A=20=09=09=20=20=20= =20&&=20!EQ=20(window,=20selected_window))=0A=20=09=09=20=20{=0A=20=09=09= =20=20=20=20inev.ie.kind=20=3D=20SELECT_WINDOW_EVENT;=0A@@=20-20710,7=20= +20708,7=20@@=20handle_one_xevent=20(struct=20x_display_info=20*dpyinfo,=0A= =20=09=09=20=20}=0A=20=0A=20=09=09/*=20Remember=20the=20last=20window=20= where=20we=20saw=20the=20mouse.=20=20*/=0A-=09=09last_mouse_window=20=3D=20= window;=0A+=09=09Vmouse_autoselect_window_last_window=20=3D=20window;=0A=20= =09=20=20=20=20=20=20}=0A=20=0A=20=20=20=20=20=20=20=20=20=20=20=20=20if=20= (!x_note_mouse_movement=20(f,=20&xmotion,=20Qnil))=0A@@=20-22593,7=20= +22591,6=20@@=20handle_one_xevent=20(struct=20x_display_info=20*dpyinfo,=0A= =20=09=09=20=20=20=20=20=20&&=20(f=20=3D=3D=20XFRAME=20(selected_frame)=0A= =20=09=09=09=20=20||=20!NILP=20(focus_follows_mouse)))=0A=20=09=09=20=20=20= =20{=0A-=09=09=20=20=20=20=20=20static=20Lisp_Object=20= last_mouse_window;=0A=20=09=09=20=20=20=20=20=20Lisp_Object=20window=20=3D= =20window_from_coordinates=20(f,=20ev.x,=20ev.y,=200,=20false,=20false);=0A= =20=0A=20=09=09=20=20=20=20=20=20/*=20A=20window=20will=20be=20= autoselected=20only=20when=20it=20is=20not=0A@@=20-22605,7=20+22602,7=20= @@=20handle_one_xevent=20(struct=20x_display_info=20*dpyinfo,=0A=20=09=09= =09=20autoselection=20the=20window=20is=20usually=20the=20window's=20= text=0A=20=09=09=09=20area=20including=20the=20margins.=20=20*/=0A=20=09=09= =20=20=20=20=20=20if=20(WINDOWP=20(window)=0A-=09=09=09=20=20&&=20!EQ=20= (window,=20last_mouse_window)=0A+=09=09=09=20=20&&=20!EQ=20(window,=20= Vmouse_autoselect_window_last_window)=0A=20=09=09=09=20=20&&=20!EQ=20= (window,=20selected_window))=0A=20=09=09=09{=0A=20=09=09=09=20=20= inev.ie.kind=20=3D=20SELECT_WINDOW_EVENT;=0A@@=20-22616,7=20+22613,7=20= @@=20handle_one_xevent=20(struct=20x_display_info=20*dpyinfo,=0A=20=09=09= =09}=0A=20=0A=20=09=09=20=20=20=20=20=20/*=20Remember=20the=20last=20= window=20where=20we=20saw=20the=20mouse.=20=20*/=0A-=09=09=20=20=20=20=20= =20last_mouse_window=20=3D=20window;=0A+=09=09=20=20=20=20=20=20= Vmouse_autoselect_window_last_window=20=3D=20window;=0A=20=09=09=20=20=20= =20}=0A=20=0A=20=09=09=20=20if=20(!x_note_mouse_movement=20(f,=20&ev,=20= source=20?=20source->name=20:=20Qnil))=0A--=20=0A2.41.0=0A=0A= --Apple-Mail=_A89BDDC9-8F3E-4A55-B82D-6D39E16121D8-- From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Aug 2023 07:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Cc: 61241@debbugs.gnu.org, Eli Zaretskii Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.169268756421549 (code B ref 61241); Tue, 22 Aug 2023 07:00:01 +0000 Received: (at 61241) by debbugs.gnu.org; 22 Aug 2023 06:59:24 +0000 Received: from localhost ([127.0.0.1]:58436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYLMJ-0005bU-MH for submit@debbugs.gnu.org; Tue, 22 Aug 2023 02:59:23 -0400 Received: from sonic313-10.consmr.mail.ne1.yahoo.com ([66.163.185.33]:35202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYLMH-0005bD-56 for 61241@debbugs.gnu.org; Tue, 22 Aug 2023 02:59:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1692687552; bh=Cp++GIWQ9YayqjTSeaT0fcrOVLhGDUDGAT8D1v2mNqU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=HFSPVfWd8UWF/QM2zQwMVsEV9vqVc9bnCEeRrbZCuLn+/U8PHDxuDd6L/vcDEwRU7cCzmdsZo0/8VerZG3rXAZMaukkMUFTr5fX8d6YHM2dqELq71NNVLiXWBt92coz2jDnKyw97oo/UKPCMp3Wb2Cw7YNhDwlsIzdVr9EEpmkoT76JWAHq1YwNzkoIcHu923lzCI0y/Ujs6LnKKZQ+DSYjBwa+UG0Fl/p7FAOmnLz7pB5stLJcksog8fvdXhwZDar/QXgaYn2tv2tXHSNIMiU19y8ZlDRDB+xIpVKmKzSVmLU0p7Ez/QgbaTnU8dvSETNFqkCScjs0XFdqw4xoW5A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1692687552; bh=4kUtHh/qEMQ+IbXaHQ77D5OTJWejojSt/APJ2ryrnag=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=n91D2OjIAhgPu07gCcMBgg4Lv/0micCCCj0svg1gx68puiYjpcsMOUrBXX/rLtlQVED+MjqgncnH9mu/vDRahxRY0VH73M9kve2Qcwx7yJW8yF5zOaRPVs8ZcwzCWYAc/6XyoyYG0Ogn8d4IC2BVTUGy4DZaSXkKsQWjB7m/xpsNBfnzAo+RxN07Jxw0DS2KPU0R2nT+hW5ytVdRXvKLhoCbEeEMeqMk0043PhBGVhzg01brC3hqX9mFSUJPnE9RkIvIK8gQ1ZjztlSFl48/Yx64Ia0wUEuB9Hqe26pbrvASfLo1chnkeivYYpDSx5VP/NWRQrzEsJH/wASY/xsV1A== X-YMail-OSG: PL2OBtsVM1nwOT6JjSxaOBDwCcbYXbjw5upwb43c1qH8JBTE_hDYVu0RZAKvAU4 UIaNlgRtSpqDK6f7vJvZ15BJyzr2CcQtCz4dkW3in4d0q9OGbATMVrW.awTllxIqPp0cvI8Nfnhi pTZeVsMnY0G2DQ792DC51d4JRlp1x8WTKSL15.PBUZ6u5nZ575hn8qskD3BlHCHw6ClV9xiKdiuH sUMwfbY22GllBWqdAihmD3f_LqcH1QkZALwGo.sGRHuFvT1bHr6Tcw0oUQ9o8PuH9PjEgqVdKWqa NEjZYZozHG2ZmCh7tFp2TIP79PsBovz4vFaG5QBcDz0OaRDSPOy4.e8yjD8yTczkdIDw89ekhGYU jYryJ9Kp9n708kMPmVwj_2kZFsZAVx.BHdKywiiMa.m8ftyyrNF.5MaR6t7QgH2ghlKsDCoWNubv 71nkU_7uaW3refuYkblST.zhsRPGneTUzdM30NMasuep7wafRzfPMvj8bhulfsOpTrSgeYwsF_CN fOhazDa7id9wmL0942r97vzl7MHGOjeE_GYzxkT6GEA.Itg5pYcB9TC2kkcoHAUoIXp3kdLpF6Xf VPD5l4ja2K3BfcdtRBjZBkBPsUkdR80V4Tg32oX65Msd467IrG1J1xR11cKI8ceDTBsFbVWmiERh XJZC2y5iTv9eRqWdhGSE9jYr1OdkiC5mOJCkHbWzu9TwdIJoggAu4sqSVfoxaa0hgMqtIgTVTxan RG6SIwxKLFZxkRJu7YcD3FnjCGinycAsoRSLO3V7sGCq.IohdZOPQtLbUlFBZb1osz_IL3XVkgwy q.VLNPhYfhuQTK5zs20xoFDIpf8iIXqZKkiXynOczA_7KqQZmNB1Au3yOpmFfKlxDlQ1A5RV9RIS vbmVBABLXQG9522t8_vpitqSp_XB2kPhxPE5J9EiHkaHqvcu3l6X2tD4xsCeqhiPQLkUVjsQLeXm OGV5EvWjbSHhDRNlBClLM.CV6mCay.BrQ.0gjFMERAYGNKXPM8x5N9Sz72eV56L_f933pGZjLldo WUoY21KGwHW5p7THcOld06KWtTZ1_TiUyce3JsCDXnlRkJpfrKF96Glnk_UfDww_Cv14lRwRXbGN 1Czj3qSw2SxtmDQ65PkwDLHF9ZAgW8QpBq.c6UOvYGUH3eJVmwBecWsn16f8uU4Z8eaD4UiLvoVa mzOHfZ_JrVnaL2FmYdkKWUgSfh0i.NRPpADRWY_Yu9yqytAVjLqcXD9O0iyJffDlLDNXCYYmuWU0 fLApqq4AAxLStK62WhrJv226J2Qpsbnp0UH3UnA94bPEbIsm0DnfOaf_HnW2xOgEPwMjz3wv4ent fKL1tqgHNSz9cVhpHbyc1tdpQ3QkQSlWq9gQRBTx5PqXRKmAKS7xwlhCpAKknlEc77FmA_BOgksZ iRF9eQLNyYWhLRhBOfBfMITXOXB4mfXcGUAvAl0_zA38Ij5b_nsA_eq9rzge35Dk8Ic4THrLErpp qxDBkGmm57WnStIsgZ2CysM9NQKTmYjZSFWmLOPRxfiyRkS3l4.hcfU6jS.7GeKSBSHSz3JpCuIk 5ZPdaqGt68kzI5Patid7V3eOBz1cHcclJuQbXZl6nlaL8e2BDhnMQowAY5XrxiDVHusMb8Hr6x1L RHUXlM5.pqBqTycTewHhZOYwyfeGuc178squQ84CdQ5JRF0g6M0efvLpjGM0.mUYhGXkVMYxGcms 683DOvXrgRHMyXH6AQnm1fLdkbexAlhrs.4qcBGkd8jS1DmITfUs4oThXofct2EEZ4YoTDJ9klKG d0UwMtpm4XzeQdePUfyNayu5UV0z0hnRdwyRFaEaKF6z5zbCv6cF9tQxax0WkPVpo38PDfqLRMy5 0_r5FpK3tKLQAJJRyRXqFrhb2UNsUlq6J7TSe8Bjl13wYz6caUJQ4I8NeBqVCx40fNoyFIxfRQ0t iW_IVgYPKowL2xf1qtD8yUff33vKtBXjfZJAjFosr6X0Nth1WcLumFsTvDao1tXAqqrq8ovHPP5n kTc.ypwpTg63KygSmvjEn8InuvjA9GXHEVC9E.mFxyrfaqCMZfba4YtZGR8p.P2TXWhARfptvzmD KLsrsE4_MTYiJQdo0PGIrn9IDMld7IaYF7UW8p.7gaqT2FW9jQ.y.JAF7rYKHgN.ZLEJbtYT3L3u OfzvE2A3itAm0ld3krxmYW1HFXhBCwOHWezjNBC8Tq7fGw0A8ECQ7qb2BJNGFgV1RGGQEHq1SFud KNBF8h87JO_SEvTiKkvvwIwYLqHZUU86DXcjc6MMg0YSzQL2nN85WHVj2OEPnr.sow0BXp4w- X-Sonic-MF: X-Sonic-ID: 26765c9f-83a9-45ca-aebe-545b64a604b1 Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Tue, 22 Aug 2023 06:59:12 +0000 Received: by hermes--production-sg3-69654d8bd-gltbk (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 890266537ffbdcdf1f91171a06dbb85a; Tue, 22 Aug 2023 06:59:05 +0000 (UTC) From: Po Lu In-Reply-To: ("=?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo"'s message of "Tue, 22 Aug 2023 07:45:53 +0200") References: <87cz6n8tb1.fsf@yahoo.com> Date: Tue, 22 Aug 2023 14:59:00 +0800 Message-ID: <87msyj8swb.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.21732 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 2028 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Adri=C3=A1n Medra=C3=B1o Calvo writes: > I prepared a patch (attached below) introducing a new lisp variable > holding the last "mouse-autoselected=E2=80=9D window. With this patch EX= WM > can simply select the Emacs window corresponding to the managed X > window and set it as last =E2=80=9Cmouse-autoselected=E2=80=9D window; > mouse-autoselect works normally after that. No more sending Motion > events. > > Using a single variable introduces a significant change, though: when > `mouse-autoselect-window=E2=80=99 is enabled and emacs runs in different > terminals, =E2=80=9Cmouse-autoselecting=E2=80=9D a window on a terminal c= hanges the > last =E2=80=9Cmouse-autoselected=E2=80=9D window for all other terminals.= Slightly > moving the mouse in a different terminal (within a single Emacs > window) will =E2=80=9Cmouse-autoselect=E2=80=9D that window, whereas that= would not > have been the case before this patch, as the last =E2=80=9Cmouse-autosele= cted=E2=80=9D > window was terminal-specific. It=E2=80=99s not clear to me whether this > behaviour will be beneficial, neutral or unacceptable. Moreover, this > behaviour is consistent with the behaviour introduced in the first > patch I sent, where I proposed to merge the last =E2=80=9Cmouse-autoselec= ted=E2=80=9D > window for Motion and XI_Motion events (other terminals were not > affected). Thanks. Taking into account your experiences with the TEST extension, I'm inclined towards believing that such a change is TRT, but the variable should be made terminal-local instead. (Emacs Lisp does provide such a facility.) Also, there are a few difficulties with the patch you attached. First of all, it obsoletes an existing variable without due reason, and that should be avoided. Secondly, :version specifiers within the patch should be revised to mention Emacs 30, since such a large change is not apposite for the release branch. Finally, you missed the new terminal backend introduced in Emacs 30, src/androidterm.c. From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Resent-From: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 May 2025 15:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu Cc: 61241@debbugs.gnu.org, Eli Zaretskii Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.174715138631283 (code B ref 61241); Tue, 13 May 2025 15:50:02 +0000 Received: (at 61241) by debbugs.gnu.org; 13 May 2025 15:49:46 +0000 Received: from localhost ([127.0.0.1]:32770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uErt2-00088U-LW for submit@debbugs.gnu.org; Tue, 13 May 2025 11:49:45 -0400 Received: from out-189.mta1.migadu.com ([95.215.58.189]:28061) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uErsu-000889-QC for 61241@debbugs.gnu.org; Tue, 13 May 2025 11:49:41 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=medranocalvo.com; s=key1; t=1747151369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=M8Nk14CfhSXjaOqautKSncUXuJQ+EEzG1cVuO7hGLag=; b=L5a+0fq5TcGmz77+kIUujYqKwJNlc+JnDtILvfJCP0AHghgkNcmy8zPi7XuwGFmTipdi6L cWuwALx4UmZonXAFrqeBoVRvLW0E8iL3VHAkHmV0KZGs4KXKu8OSTZHB8eY5CmwLfoSR/h 7sGSlqMsSyE0MrrJKg05OKVKeD52fRqUCF0q++qVkal5Xsbyu0roN0/WtJwEc8aAeK5+ki Cm0nEeWcrWY5iC61zDqTeRXUfX4FcONgUdIKh8ok1iB+QPu5A+mo49xTDxJ+tz9+SsTc1D zR0rpcTuppY/ghu96K8CXb2LH/IO4KPrm9eV0IXOUoxtdYYs/m+GxbyDTM5fNg== From: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Message-Id: <0C98B803-0870-4B97-8497-D7B04CD93420@medranocalvo.com> Content-Type: multipart/mixed; boundary="Apple-Mail=_E6FEBF1E-9B98-4B7C-8D1B-277B8032A353" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Date: Tue, 13 May 2025 17:49:16 +0200 In-Reply-To: <87msyj8swb.fsf@yahoo.com> References: <87cz6n8tb1.fsf@yahoo.com> <87msyj8swb.fsf@yahoo.com> X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Apple-Mail=_E6FEBF1E-9B98-4B7C-8D1B-277B8032A353 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 22. Aug 2023, at 08:59, Po Lu wrote: >=20 > Thanks. Taking into account your experiences with the TEST extension, > I'm inclined towards believing that such a change is TRT, but the > variable should be made terminal-local instead. (Emacs Lisp does > provide such a facility.) >=20 > Also, there are a few difficulties with the patch you attached. First > of all, it obsoletes an existing variable without due reason, and that > should be avoided. Secondly, :version specifiers within the patch > should be revised to mention Emacs 30, since such a large change is = not > apposite for the release branch. >=20 > Finally, you missed the new terminal backend introduced in Emacs 30, > src/androidterm.c. Dear Po Lu, in the summer of 2024 I implemented a patch incorporating your = suggestions. A couple of days ago I had a new look with the intention of finally = submitting it. The patch corrects most of the issues you pointed out back then: = nothing is touched in lisp/window.el, the variable is made terminal-local and it = is implemented for androidterm as well. I don=E2=80=99t know how to = indicate the :version for this terminal-local variable in the C code =E2=80=93or whether = it=E2=80=99s possible=E2=80=93, please indicate how to do so (or simply edit the patch, as you prefer). A surprise emerged while rebasing to master: I discovered that since = commit 2e8ef0910412aef8f9f1beba7c942473ad8602bb ("Protect against GCing = of last_mouse_window=E2=80=9D) all `last_mouse_window` of different = terminals were merged into a single global variable. This is equivalent to my proposal in = "Expose last window under pointer to Lisp=E2=80=9D of 2023-08-22. This commit solves = the original issue and, if you find it satisfactory, would allow to happily close = this ticket. If you still think that implementing it as a terminal-local variable is = necessary or preferable, I=E2=80=99m attaching the patch I described above. Note = that I revert the changes introduced in 2e8ef09104 in my patch (please review = attentively). Thank you for your patience and, as always, thank you for your work in = Emacs. Kind regards, Adri=C3=A1n. --Apple-Mail=_E6FEBF1E-9B98-4B7C-8D1B-277B8032A353 Content-Disposition: attachment; filename=0001-Expose-last-entered-window-to-Lisp.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Expose-last-entered-window-to-Lisp.patch" Content-Transfer-Encoding: quoted-printable =46rom=205d4bda0f540262b5c9bab2e16c3c43a93bd0b4f9=20Mon=20Sep=2017=20= 00:00:00=202001=0AMessage-ID:=20= <5d4bda0f540262b5c9bab2e16c3c43a93bd0b4f9.1747150994.git.adrian@medranocal= vo.com>=0AFrom:=20=3D?UTF-8?q?Adri=3DC3=3DA1n=3D20Medra=3DC3=3DB1o=3D20Cal= vo?=3D=0A=20=0ADate:=20Tue,=2015=20Aug=202023=20= 17:45:26=20+0200=0ASubject:=20[PATCH]=20Expose=20last=20entered=20window=20= to=20Lisp=0A=0A*=20keyboard.h=20(struct=20kboard):=20Add=20= Vmouse_autoselect_window_last_window.=0A*=20keyboard.c=20(init_kboard):=20= Set=20a=20default=20for=0A=20=20Vmouse_autoselect_window_last_window.=0A= (mark_kboards):=20Mark=20Vmouse_autoselect_window_last_window.=0A*=20= xdisp.c=20(syms_of_xdisp)=20:=20= Declare=0A=20=20terminal-local.=0A*=20src/androidterm.c=20= (handle_one_android_event):=0A*=20src/haikuterm.c=20(haiku_read_socket):=0A= *=20src/msdos.c=20(dos_rawgetc):=0A*=20src/nsterm.m=20([EmacsView=20= mouseMoved:]):=0A*=20src/pgtkterm.c=20(motion_notify_event):=0A*=20= src/w32inevt.c=20(do_mouse_event):=0A*=20src/w32term.c=20= (w32_read_socket):=0A*=20src/xterm.c=20(handle_one_xevent):=20Set=20it.=0A= *=20src/window.c=20(last_mouse_window):=20Remove=20variable.=0A---=0A=20= src/androidterm.c=20|=20=206=20++++--=0A=20src/haikuterm.c=20=20=20|=20=20= 6=20++++--=0A=20src/keyboard.c=20=20=20=20|=20=202=20++=0A=20= src/keyboard.h=20=20=20=20|=20=208=20++++++++=0A=20src/msdos.c=20=20=20=20= =20=20=20|=20=208=20++++++--=0A=20src/nsterm.m=20=20=20=20=20=20|=20=207=20= ++++---=0A=20src/pgtkterm.c=20=20=20=20|=20=206=20++++--=0A=20= src/w32inevt.c=20=20=20=20|=2012=20++++++++----=0A=20src/w32term.c=20=20=20= =20=20|=20=206=20++++--=0A=20src/window.c=20=20=20=20=20=20|=20=206=20= ------=0A=20src/window.h=20=20=20=20=20=20|=20=203=20---=0A=20= src/xdisp.c=20=20=20=20=20=20=20|=20=205=20+++++=0A=20src/xterm.c=20=20=20= =20=20=20=20|=2012=20++++++++----=0A=2013=20files=20changed,=2057=20= insertions(+),=2030=20deletions(-)=0A=0Adiff=20--git=20= a/src/androidterm.c=20b/src/androidterm.c=0Aindex=20= 884d8f8d718..a90a5bc27ce=20100644=0A---=20a/src/androidterm.c=0A+++=20= b/src/androidterm.c=0A@@=20-1207,7=20+1207,8=20@@=20= handle_one_android_event=20(struct=20android_display_info=20*dpyinfo,=0A=20= =09=09=20autoselection=20the=20window=20is=20usually=20the=20window's=20= text=0A=20=09=09=20area=20including=20the=20margins.=20=20*/=0A=20=09=20=20= =20=20=20=20if=20(WINDOWP=20(window)=0A-=09=09=20=20&&=20!EQ=20(window,=20= last_mouse_window)=0A+=09=09=20=20&&=20!EQ=20(window,=20KVAR=20= (dpyinfo->terminal->kboard,=0A+=09=09=09=09=09= Vmouse_autoselect_window_last_window))=0A=20=09=09=20=20&&=20!EQ=20= (window,=20selected_window))=0A=20=09=09{=0A=20=09=09=20=20inev.ie.kind=20= =3D=20SELECT_WINDOW_EVENT;=0A@@=20-1215,7=20+1216,8=20@@=20= handle_one_android_event=20(struct=20android_display_info=20*dpyinfo,=0A=20= =09=09}=0A=20=0A=20=09=20=20=20=20=20=20/*=20Remember=20the=20last=20= window=20where=20we=20saw=20the=20mouse.=20=20*/=0A-=09=20=20=20=20=20=20= last_mouse_window=20=3D=20window;=0A+=09=20=20=20=20=20=20= kset_mouse_autoselect_window_last_window=20(dpyinfo->terminal->kboard,=0A= +=09=09=09=09=09=09=09window);=0A=20=09=20=20=20=20}=0A=20=0A=20=09=20=20= if=20(!android_note_mouse_movement=20(f,=20&event->xmotion))=0Adiff=20= --git=20a/src/haikuterm.c=20b/src/haikuterm.c=0Aindex=20= 5c0863d3509..ec23eab58d5=20100644=0A---=20a/src/haikuterm.c=0A+++=20= b/src/haikuterm.c=0A@@=20-3565,7=20+3565,8=20@@=20haiku_read_socket=20= (struct=20terminal=20*terminal,=20struct=20input_event=20*hold_quit)=0A=20= =09=09=20=20=20=20Lisp_Object=20window=20=3D=20window_from_coordinates=20= (f,=20b->x,=20b->y,=200,=200,=200,=200);=0A=20=0A=20=09=09=20=20=20=20if=20= (WINDOWP=20(window)=0A-=09=09=09&&=20!EQ=20(window,=20last_mouse_window)=0A= +=09=09=09&&=20!EQ=20(window,=20KVAR=20(terminal->kboard,=0A+=09=09=09=09= =09=20=20=20=20=20=20Vmouse_autoselect_window_last_window))=0A=20=09=09=09= &&=20!EQ=20(window,=20selected_window)=0A=20=09=09=09&&=20= !popup_activated_p=0A=20=09=09=09&&=20!MINI_WINDOW_P=20(XWINDOW=20= (selected_window))=0A@@=20-3576,7=20+3577,8=20@@=20haiku_read_socket=20= (struct=20terminal=20*terminal,=20struct=20input_event=20*hold_quit)=0A=20= =09=09=09inev2.frame_or_window=20=3D=20window;=0A=20=09=09=20=20=20=20=20= =20}=0A=20=0A-=09=09=20=20=20=20last_mouse_window=20=3D=20window;=0A+=09=09= =20=20=20=20/*=20Remember=20the=20last=20window=20where=20we=20saw=20the=20= mouse.=20=20*/=0A+=09=09=20=20=20=20= kset_mouse_autoselect_window_last_window=20(terminal->kboard,=20window);=0A= =20=09=09=20=20}=0A=20=0A=20=09=09if=20(f->auto_raise)=0Adiff=20--git=20= a/src/keyboard.c=20b/src/keyboard.c=0Aindex=205db11ad6379..3df1b4dabb2=20= 100644=0A---=20a/src/keyboard.c=0A+++=20b/src/keyboard.c=0A@@=20-12763,6=20= +12763,7=20@@=20init_kboard=20(KBOARD=20*kb,=20Lisp_Object=20type)=0A=20=20= =20kset_local_function_key_map=20(kb,=20Fmake_sparse_keymap=20(Qnil));=0A= =20=20=20Fset_keymap_parent=20(KVAR=20(kb,=20Vlocal_function_key_map),=20= Vfunction_key_map);=0A=20=20=20kset_default_minibuffer_frame=20(kb,=20= Qnil);=0A+=20=20kset_mouse_autoselect_window_last_window=20(kb,=20Qnil);=0A= =20}=0A=20=0A=20/*=20Allocate=20and=20basically=20initialize=20keyboard=0A= @@=20-14219,6=20+14220,7=20@@=20mark_kboards=20(void)=0A=20=20=20=20=20=20= =20mark_object=20(KVAR=20(kb,=20Vdefault_minibuffer_frame));=0A=20=20=20=20= =20=20=20mark_object=20(KVAR=20(kb,=20echo_string));=0A=20=20=20=20=20=20= =20mark_object=20(KVAR=20(kb,=20echo_prompt));=0A+=20=20=20=20=20=20= mark_object=20(KVAR=20(kb,=20Vmouse_autoselect_window_last_window));=0A=20= =20=20=20=20}=0A=20=0A=20=20=20for=20(union=20buffered_input_event=20= *event=20=3D=20kbd_fetch_ptr;=0Adiff=20--git=20a/src/keyboard.h=20= b/src/keyboard.h=0Aindex=205e04b54eb74..faa5691961a=20100644=0A---=20= a/src/keyboard.h=0A+++=20b/src/keyboard.h=0A@@=20-182,6=20+182,9=20@@=20= #define=20KVAR(kboard,=20field)=20((kboard)->field=20##=20_)=0A=20=0A=20=20= =20=20=20/*=20If=20we=20have=20a=20prompt=20string=20specified=20by=20= the=20user,=20this=20is=20it.=20=20*/=0A=20=20=20=20=20Lisp_Object=20= echo_prompt_;=0A+=0A+=20=20=20=20/*=20Last=20window=20entered=20by=20the=20= mouse=20pointer.=20=20*/=0A+=20=20=20=20Lisp_Object=20= Vmouse_autoselect_window_last_window_;=0A=20=20=20};=0A=20=0A=20INLINE=20= void=0A@@=20-224,6=20+227,11=20@@=20kset_window_system=20(struct=20= kboard=20*kb,=20Lisp_Object=20val)=0A=20{=0A=20=20=20kb->Vwindow_system_=20= =3D=20val;=0A=20}=0A+INLINE=20void=0A= +kset_mouse_autoselect_window_last_window=20(struct=20kboard=20*kb,=20= Lisp_Object=20val)=0A+{=0A+=20=20= kb->Vmouse_autoselect_window_last_window_=20=3D=20val;=0A+}=0A=20=0A=20= union=20buffered_input_event=0A=20{=0Adiff=20--git=20a/src/msdos.c=20= b/src/msdos.c=0Aindex=20ec36d0b2df3..01c87034019=20100644=0A---=20= a/src/msdos.c=0A+++=20b/src/msdos.c=0A@@=20-2677,6=20+2677,8=20@@=20= dos_rawgetc=20(void)=0A=20=09=20=20/*=20Generate=20SELECT_WINDOW_EVENTs=20= when=20needed.=20=20*/=0A=20=09=20=20if=20(!NILP=20= (Vmouse_autoselect_window))=0A=20=09=20=20=20=20{=0A+=09=20=20=20=20=20=20= struct=20tty_display_info=20*dpyinfo=20=3D=20FRAME_DISPLAY_INFO=20(f);=0A= +=0A=20=09=20=20=20=20=20=20mouse_window=20=3D=20window_from_coordinates=0A= =20=09=09(SELECTED_FRAME=20(),=20mouse_last_x,=20mouse_last_y,=200,=200,=20= 0,=200);=0A=20=09=20=20=20=20=20=20/*=20A=20window=20will=20be=20= selected=20only=20when=20it=20is=20not=0A@@=20-2684,7=20+2686,8=20@@=20= dos_rawgetc=20(void)=0A=20=09=09=20not=20in=20it.=20=20A=20minibuffer=20= window=20will=20be=20selected=20iff=0A=20=09=09=20it=20is=20active.=20=20= */=0A=20=09=20=20=20=20=20=20if=20(WINDOWP=20(mouse_window)=0A-=09=09=20=20= &&=20!EQ=20(mouse_window,=20last_mouse_window)=0A+=09=09=20=20&&=20!EQ=20= (window,=20KVAR=20(dpyinfo->terminal->kboard,=0A+=09=09=09=09=09= Vmouse_autoselect_window_last_window))=0A=20=09=09=20=20&&=20!EQ=20= (mouse_window,=20selected_window))=0A=20=09=09{=0A=20=09=09=20=20= event.kind=20=3D=20SELECT_WINDOW_EVENT;=0A@@=20-2694,7=20+2697,8=20@@=20= dos_rawgetc=20(void)=0A=20=09=09=20=20kbd_buffer_store_event=20(&event);=0A= =20=09=09}=0A=20=09=20=20=20=20=20=20/*=20Remember=20the=20last=20window=20= where=20we=20saw=20the=20mouse.=20=20*/=0A-=09=20=20=20=20=20=20= last_mouse_window=20=3D=20mouse_window;=0A+=09=20=20=20=20=20=20= kset_mouse_autoselect_window_last_window=20(dpyinfo->terminal->kboard,=0A= +=09=09=09=09=09=09=09window);=0A=20=09=20=20=20=20}=0A=20=0A=20=09=20=20= previous_help_echo_string=20=3D=20help_echo_string;=0Adiff=20--git=20= a/src/nsterm.m=20b/src/nsterm.m=0Aindex=205514a693c86..2cebf9312ca=20= 100644=0A---=20a/src/nsterm.m=0A+++=20b/src/nsterm.m=0A@@=20-7754,12=20= +7754,12=20@@=20-=20(void)mouseMoved:=20(NSEvent=20*)e=0A=20=20=20if=20= (!NILP=20(Vmouse_autoselect_window))=0A=20=20=20=20=20{=0A=20=20=20=20=20= =20=20NSTRACE_MSG=20("mouse_autoselect_window");=0A-=20=20=20=20=20=20= static=20Lisp_Object=20last_mouse_window;=0A=20=20=20=20=20=20=20= Lisp_Object=20window=0A=20=09=3D=20window_from_coordinates=20= (emacsframe,=20pt.x,=20pt.y,=200,=200,=200,=200);=0A=20=0A=20=20=20=20=20= =20=20if=20(WINDOWP=20(window)=0A-=20=20=20=20=20=20=20=20=20=20&&=20!EQ=20= (window,=20last_mouse_window)=0A+=09=20=20&&=20!EQ=20(window,=20KVAR=20= (dpyinfo->terminal->kboard,=0A+=09=09=09=20=20= Vmouse_autoselect_window_last_window))=0A=20=20=20=20=20=20=20=20=20=20=20= &&=20!EQ=20(window,=20selected_window)=0A=20=09=20=20&&=20!MINI_WINDOW_P=20= (XWINDOW=20(selected_window))=0A=20=20=20=20=20=20=20=20=20=20=20&&=20= (!NILP=20(focus_follows_mouse)=0A@@=20-7772,7=20+7772,8=20@@=20-=20= (void)mouseMoved:=20(NSEvent=20*)e=0A=20=20=20=20=20=20=20=20=20=20=20= EV_TRAILER2=20(e);=0A=20=20=20=20=20=20=20=20=20}=0A=20=20=20=20=20=20=20= /*=20Remember=20the=20last=20window=20where=20we=20saw=20the=20mouse.=20=20= */=0A-=20=20=20=20=20=20last_mouse_window=20=3D=20window;=0A+=20=20=20=20= =20=20kset_mouse_autoselect_window_last_window=20= (dpyinfo->terminal->kboard,=0A+=09=09=09=09=09=09window);=0A=20=20=20=20=20= }=0A=20=0A=20=20=20dragging=20=3D=20(e.type=20=3D=3D=20= NSEventTypeLeftMouseDragged);=0Adiff=20--git=20a/src/pgtkterm.c=20= b/src/pgtkterm.c=0Aindex=20a2e23a5616b..ad6cb769da7=20100644=0A---=20= a/src/pgtkterm.c=0A+++=20b/src/pgtkterm.c=0A@@=20-5972,7=20+5972,8=20@@=20= motion_notify_event=20(GtkWidget=20*widget,=20GdkEvent=20*event,=0A=20=09= =20=20=20=20=20autoselection=20the=20window=20is=20usually=20the=20= window's=20text=0A=20=09=20=20=20=20=20area=20including=20the=20margins.=20= =20*/=0A=20=09=20=20if=20(WINDOWP=20(window)=0A-=09=20=20=20=20=20=20&&=20= !EQ=20(window,=20last_mouse_window)=0A+=09=20=20=20=20=20=20&&=20!EQ=20= (window,=20KVAR=20(dpyinfo->terminal->kboard,=0A+=09=09=09=09=20=20=20=20= Vmouse_autoselect_window_last_window))=0A=20=09=20=20=20=20=20=20&&=20= !EQ=20(window,=20selected_window))=0A=20=09=20=20=20=20{=0A=20=09=20=20=20= =20=20=20inev.ie.kind=20=3D=20SELECT_WINDOW_EVENT;=0A@@=20-5980,7=20= +5981,8=20@@=20motion_notify_event=20(GtkWidget=20*widget,=20GdkEvent=20= *event,=0A=20=09=20=20=20=20}=0A=20=0A=20=09=20=20/*=20Remember=20the=20= last=20window=20where=20we=20saw=20the=20mouse.=20=20*/=0A-=09=20=20= last_mouse_window=20=3D=20window;=0A+=09=20=20= kset_mouse_autoselect_window_last_window=20(dpyinfo->terminal->kboard,=0A= +=09=09=09=09=09=09=20=20=20=20window);=0A=20=09}=0A=20=0A=20=20=20=20=20= =20=20if=20(!note_mouse_movement=20(f,=20&event->motion))=0Adiff=20--git=20= a/src/w32inevt.c=20b/src/w32inevt.c=0Aindex=20b0e6b5a9286..aa102373b3c=20= 100644=0A---=20a/src/w32inevt.c=0A+++=20b/src/w32inevt.c=0A@@=20-499,6=20= +499,8=20@@=20do_mouse_event=20(MOUSE_EVENT_RECORD=20*event,=0A=20=09=20=20= =20=20/*=20Generate=20SELECT_WINDOW_EVENTs=20when=20needed.=20=20*/=0A=20= =09=20=20=20=20if=20(!NILP=20(Vmouse_autoselect_window))=0A=20=09=20=20=20= =20=20=20{=0A+=09=20=20=20=20=20=20=20=20struct=20tty_display_info=20= *dpyinfo=20=3D=20FRAME_DISPLAY_INFO=20(f);=0A+=0A=20=09=09Lisp_Object=20= mouse_window=20=3D=20window_from_coordinates=20(f,=20mx,=20my,=0A=20=09=09= =09=09=09=09=09=09=20=20=20=200,=200,=200,=200);=0A=20=09=09/*=20A=20= window=20will=20be=20selected=20only=20when=20it=20is=20not=0A@@=20= -506,7=20+508,8=20@@=20do_mouse_event=20(MOUSE_EVENT_RECORD=20*event,=0A=20= =09=09=20=20=20not=20in=20it.=20=20A=20minibuffer=20window=20will=20be=20= selected=20iff=0A=20=09=09=20=20=20it=20is=20active.=20=20*/=0A=20=09=09= if=20(WINDOWP=20(mouse_window)=0A-=09=09=20=20=20=20&&=20!EQ=20= (mouse_window,=20last_mouse_window)=0A+=09=09=20=20=20=20&&=20!EQ=20= (window,=20KVAR=20(dpyinfo->terminal->kboard,=0A+=09=09=09=09=09=20=20= Vmouse_autoselect_window_last_window))=0A=20=09=09=20=20=20=20&&=20!EQ=20= (mouse_window,=20selected_window))=0A=20=09=09=20=20{=0A=20=09=09=20=20=20= =20struct=20input_event=20event;=0A@@=20-518,10=20+521,11=20@@=20= do_mouse_event=20(MOUSE_EVENT_RECORD=20*event,=0A=20=09=09=20=20=20=20= event.timestamp=20=3D=20movement_time;=0A=20=09=09=20=20=20=20= kbd_buffer_store_event=20(&event);=0A=20=09=09=20=20}=0A-=09=09= last_mouse_window=20=3D=20mouse_window;=0A+=0A+=09=09/*=20Remember=20the=20= last=20window=20where=20we=20saw=20the=20mouse.=20=20*/=0A+=09=09= kset_mouse_autoselect_window_last_window=20(dpyinfo->terminal->kboard,=0A= +=09=09=09=09=09=09=09=20=20window);=0A=20=09=20=20=20=20=20=20}=0A-=09=20= =20=20=20else=0A-=09=20=20=20=20=20=20last_mouse_window=20=3D=20Qnil;=0A=20= =0A=20=09=20=20=20=20previous_help_echo_string=20=3D=20help_echo_string;=0A= =20=09=20=20=20=20help_echo_string=20=3D=20help_echo_object=20=3D=20= help_echo_window=20=3D=20Qnil;=0Adiff=20--git=20a/src/w32term.c=20= b/src/w32term.c=0Aindex=205613ade01ce..f22528e4f5e=20100644=0A---=20= a/src/w32term.c=0A+++=20b/src/w32term.c=0A@@=20-5452,7=20+5452,8=20@@=20= w32_read_socket=20(struct=20terminal=20*terminal,=0A=20=09=09=20=20=20=20= =20not=20in=20it.=20=20Minibuffer=20window=20will=20be=20selected=0A=20=09= =09=20=20=20=20=20only=20when=20it=20is=20active.=20=20*/=0A=20=09=09=20=20= if=20(WINDOWP=20(window)=0A-=09=09=20=20=20=20=20=20&&=20!EQ=20(window,=20= last_mouse_window)=0A+=09=09=20=20=20=20=20=20&&=20!EQ=20(window,=20KVAR=20= (dpyinfo->terminal->kboard,=0A+=09=09=09=09=09=20=20=20=20= Vmouse_autoselect_window_last_window))=0A=20=09=09=20=20=20=20=20=20&&=20= !EQ=20(window,=20selected_window))=0A=20=09=09=20=20=20=20{=0A=20=09=09=20= =20=20=20=20=20inev.kind=20=3D=20SELECT_WINDOW_EVENT;=0A@@=20-5460,7=20= +5461,8=20@@=20w32_read_socket=20(struct=20terminal=20*terminal,=0A=20=09= =09=20=20=20=20}=0A=20=0A=20=09=09=20=20/*=20Remember=20the=20last=20= window=20where=20we=20saw=20the=20mouse.=20=20*/=0A-=09=09=20=20= last_mouse_window=20=3D=20window;=0A+=09=09=20=20= kset_mouse_autoselect_window_last_window=20(dpyinfo->terminal->kboard,=0A= +=09=09=09=09=09=09=09=20=20=20=20window);=0A=20=09=09}=0A=20=0A=20=09=20= =20=20=20=20=20if=20(!w32_note_mouse_movement=20(f,=20&msg.msg))=0Adiff=20= --git=20a/src/window.c=20b/src/window.c=0Aindex=20= 1ac004af5e0..cc68b17b60a=20100644=0A---=20a/src/window.c=0A+++=20= b/src/window.c=0A@@=20-106,9=20+106,6=20@@=0A=20=20=20=20shown=20as=20= the=20selected=20window=20when=20the=20minibuffer=20is=20selected.=20=20= */=0A=20Lisp_Object=20minibuf_selected_window;=0A=20=0A-/*=20Non-nil=20= means=20it=20is=20the=20window=20containing=20the=20last=20mouse=20= movement.=20=20*/=0A-Lisp_Object=20last_mouse_window;=0A-=0A=20/*=20= Incremented=20for=20each=20window=20created.=20=20*/=0A=20static=20= EMACS_INT=20sequence_number;=0A=20=0A@@=20-8788,8=20+8785,6=20@@=20= init_window_once=20(void)=0A=20=0A=20=20=20minibuf_selected_window=20=3D=20= Qnil;=0A=20=20=20staticpro=20(&minibuf_selected_window);=0A-=20=20= last_mouse_window=20=3D=20Qnil;=0A-=20=20staticpro=20= (&last_mouse_window);=0A=20=20=20old_selected_window=20=3D=20Qnil;=0A=20=20= =20staticpro=20(&old_selected_window);=0A=20=0A@@=20-8808,7=20+8803,6=20= @@=20init_window_once=20(void)=0A=20=20=20PDUMPER_RESET_LV=20= (selected_window,=20Qnil);=0A=20=20=20PDUMPER_RESET_LV=20(Vwindow_list,=20= Qnil);=0A=20=20=20PDUMPER_RESET_LV=20(minibuf_selected_window,=20Qnil);=0A= -=20=20PDUMPER_RESET_LV=20(last_mouse_window,=20Qnil);=0A=20=0A=20=20=20= /*=20Hack:=20if=20mode_line_in_non_selected_windows=20is=20true=20(which=20= it=20may=0A=20=20=20=20=20=20be,=20if=20we're=20restoring=20from=20a=20= dump)=20the=20guts=20of=0Adiff=20--git=20a/src/window.h=20b/src/window.h=0A= index=202266fc7814c..7d59f297fcf=20100644=0A---=20a/src/window.h=0A+++=20= b/src/window.h=0A@@=20-1116,9=20+1116,6=20@@=20#define=20= WINDOW_TEXT_TO_FRAME_PIXEL_X(W,=20X)=09\=0A=20=0A=20extern=20Lisp_Object=20= minibuf_selected_window;=0A=20=0A-/*=20Non-nil=20means=20it=20is=20the=20= window=20containing=20the=20last=20mouse=20movement.=20=20*/=0A-=0A= -extern=20Lisp_Object=20last_mouse_window;=0A=20=0A=20extern=20= Lisp_Object=20make_window=20(void);=0A=20extern=20Lisp_Object=20= window_from_coordinates=20(struct=20frame=20*,=20int,=20int,=0Adiff=20= --git=20a/src/xdisp.c=20b/src/xdisp.c=0Aindex=20886f070753f..b8e0740e7ea=20= 100644=0A---=20a/src/xdisp.c=0A+++=20b/src/xdisp.c=0A@@=20-38079,6=20= +38079,11=20@@=20syms_of_xdisp=20(void)=0A=20of=20your=20window=20= manager.=20=20*/);=0A=20=20=20Vmouse_autoselect_window=20=3D=20Qnil;=0A=20= =0A+=20=20DEFVAR_KBOARD=20("mouse-autoselect-window-last-window",=20= Vmouse_autoselect_window_last_window,=0A+=20=20=20=20doc:=20/*=20Last=20= window=20entered=20by=20the=20the=20mouse=20pointer.=0A+This=20variable=20= is=20tracked=20only=20when=20both=20`mouse-autoselect-window'=20and=0A= +`focus-follows-mouse'=20are=20non-nil.=20*/);=0A+=0A=20=20=20= DEFVAR_LISP=20("auto-resize-tab-bars",=20Vauto_resize_tab_bars,=0A=20=20=20= =20=20doc:=20/*=20Non-nil=20means=20automatically=20resize=20tab-bars.=0A= =20This=20dynamically=20changes=20the=20tab-bar's=20height=20to=20the=20= minimum=20height=0Adiff=20--git=20a/src/xterm.c=20b/src/xterm.c=0Aindex=20= b21efd5a2a2..850e19339d7=20100644=0A---=20a/src/xterm.c=0A+++=20= b/src/xterm.c=0A@@=20-21301,7=20+21301,8=20@@=20handle_one_xevent=20= (struct=20x_display_info=20*dpyinfo,=0A=20=09=09=20=20=20autoselection=20= the=20window=20is=20usually=20the=20window's=20text=0A=20=09=09=20=20=20= area=20including=20the=20margins.=20=20*/=0A=20=09=09if=20(WINDOWP=20= (window)=0A-=09=09=20=20=20=20&&=20!EQ=20(window,=20last_mouse_window)=0A= +=09=09=20=20=20=20&&=20!EQ=20(window,=20KVAR=20= (dpyinfo->terminal->kboard,=0A+=09=09=09=09=09=20=20= Vmouse_autoselect_window_last_window))=0A=20=09=09=20=20=20=20&&=20!EQ=20= (window,=20selected_window))=0A=20=09=09=20=20{=0A=20=09=09=20=20=20=20= inev.ie.kind=20=3D=20SELECT_WINDOW_EVENT;=0A@@=20-21309,7=20+21310,8=20= @@=20handle_one_xevent=20(struct=20x_display_info=20*dpyinfo,=0A=20=09=09= =20=20}=0A=20=0A=20=09=09/*=20Remember=20the=20last=20window=20where=20= we=20saw=20the=20mouse.=20=20*/=0A-=09=09last_mouse_window=20=3D=20= window;=0A+=09=09kset_mouse_autoselect_window_last_window=20= (dpyinfo->terminal->kboard,=0A+=09=09=09=09=09=09=09=20=20window);=0A=20=09= =20=20=20=20=20=20}=0A=20=0A=20=20=20=20=20=20=20=20=20=20=20=20=20if=20= (!x_note_mouse_movement=20(f,=20&xmotion,=20Qnil))=0A@@=20-23232,7=20= +23234,8=20@@=20handle_one_xevent=20(struct=20x_display_info=20*dpyinfo,=0A= =20=09=09=09=20autoselection=20the=20window=20is=20usually=20the=20= window's=20text=0A=20=09=09=09=20area=20including=20the=20margins.=20=20= */=0A=20=09=09=20=20=20=20=20=20if=20(WINDOWP=20(window)=0A-=09=09=09=20=20= &&=20!EQ=20(window,=20last_mouse_window)=0A+=09=09=09=20=20&&=20!EQ=20= (window,=20KVAR=20(dpyinfo->terminal->kboard,=0A+=09=09=09=09=09=09= Vmouse_autoselect_window_last_window))=0A=20=09=09=09=20=20&&=20!EQ=20= (window,=20selected_window))=0A=20=09=09=09{=0A=20=09=09=09=20=20= inev.ie.kind=20=3D=20SELECT_WINDOW_EVENT;=0A@@=20-23243,7=20+23246,8=20= @@=20handle_one_xevent=20(struct=20x_display_info=20*dpyinfo,=0A=20=09=09= =09}=0A=20=0A=20=09=09=20=20=20=20=20=20/*=20Remember=20the=20last=20= window=20where=20we=20saw=20the=20mouse.=20=20*/=0A-=09=09=20=20=20=20=20= =20last_mouse_window=20=3D=20window;=0A+=09=09=20=20=20=20=20=20= kset_mouse_autoselect_window_last_window=20(dpyinfo->terminal->kboard,=0A= +=09=09=09=09=09=09=09=20=20=20=20=20=20=20=20window);=0A=20=09=09=20=20=20= =20}=0A=20=0A=20=09=09=20=20if=20(!x_note_mouse_movement=20(f,=20&ev,=20= source=20?=20source->name=20:=20Qnil))=0A--=20=0A2.49.0=0A=0A= --Apple-Mail=_E6FEBF1E-9B98-4B7C-8D1B-277B8032A353-- From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 May 2025 09:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: luangruo@yahoo.com, =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Cc: 61241@debbugs.gnu.org Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.174807765829439 (code B ref 61241); Sat, 24 May 2025 09:08:01 +0000 Received: (at 61241) by debbugs.gnu.org; 24 May 2025 09:07:38 +0000 Received: from localhost ([127.0.0.1]:56966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uIkqv-0007ej-RN for submit@debbugs.gnu.org; Sat, 24 May 2025 05:07:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50428) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uIkqt-0007eD-1J for 61241@debbugs.gnu.org; Sat, 24 May 2025 05:07:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uIkqn-0000ka-9B; Sat, 24 May 2025 05:07:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ZrWfKqt0DgFcW3Y8X5E4IgzqEn6iSc3zTeWmlgXPQhs=; b=LLOCaszpdbBNb9rT3P8K vl6lQszGkX9XSELB6HLOj+gXc8H6KLwaVovWUTChKzD51pAOCLYLaTOc9UY4ExwtPJDEkJjTwUBKX 8b/NAmPTFjYr0Ly5972LfSstppEStNOheSdy35jOT1vT8IRhmF0/zoyaYzs2t6tLJr7kY7jIlflsB dm+Yy60D4U0Tx6OXVV9CT9AzhDrxXdINwMBkOR7yZjyloDkBamgpC60Uv29Fn23rVXhXQI1Kdvq/f I8XGHKb6Ov3Z4Y3CpsFOtZi98kl3ZtVZTKjGRyuGu17KJvKvo4Q4XvwUF7Nq+Qv4GENf9rM3rqKE7 Uy2T+wQ1Rzeg/Q==; Date: Sat, 24 May 2025 12:07:27 +0300 Message-Id: <86wma61ink.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <0C98B803-0870-4B97-8497-D7B04CD93420@medranocalvo.com> (message from =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo on Tue, 13 May 2025 17:49:16 +0200) References: <87cz6n8tb1.fsf@yahoo.com> <87msyj8swb.fsf@yahoo.com> <0C98B803-0870-4B97-8497-D7B04CD93420@medranocalvo.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Po Lu, any comments? > From: Adrián Medraño Calvo > Date: Tue, 13 May 2025 17:49:16 +0200 > Cc: Eli Zaretskii , > 61241@debbugs.gnu.org > > > On 22. Aug 2023, at 08:59, Po Lu wrote: > > > > Thanks. Taking into account your experiences with the TEST extension, > > I'm inclined towards believing that such a change is TRT, but the > > variable should be made terminal-local instead. (Emacs Lisp does > > provide such a facility.) > > > > Also, there are a few difficulties with the patch you attached. First > > of all, it obsoletes an existing variable without due reason, and that > > should be avoided. Secondly, :version specifiers within the patch > > should be revised to mention Emacs 30, since such a large change is not > > apposite for the release branch. > > > > Finally, you missed the new terminal backend introduced in Emacs 30, > > src/androidterm.c. > > Dear Po Lu, > > in the summer of 2024 I implemented a patch incorporating your suggestions. > A couple of days ago I had a new look with the intention of finally submitting > it. The patch corrects most of the issues you pointed out back then: nothing > is touched in lisp/window.el, the variable is made terminal-local and it is > implemented for androidterm as well. I don’t know how to indicate the :version > for this terminal-local variable in the C code –or whether it’s possible–, > please indicate how to do so (or simply edit the patch, as you prefer). > > A surprise emerged while rebasing to master: I discovered that since commit 2e8ef0910412aef8f9f1beba7c942473ad8602bb ("Protect against GCing of > last_mouse_window”) all `last_mouse_window` of different terminals were merged > into a single global variable. This is equivalent to my proposal in "Expose last > window under pointer to Lisp” of 2023-08-22. This commit solves the original > issue and, if you find it satisfactory, would allow to happily close this ticket. > > If you still think that implementing it as a terminal-local variable is necessary > or preferable, I’m attaching the patch I described above. Note that I revert the > changes introduced in 2e8ef09104 in my patch (please review attentively). > > Thank you for your patience and, as always, thank you for your work in Emacs. > > Kind regards, > Adrián. From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Jun 2025 08:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: luangruo@yahoo.com Cc: 61241@debbugs.gnu.org, adrian@medranocalvo.com Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.174928446917923 (code B ref 61241); Sat, 07 Jun 2025 08:22:02 +0000 Received: (at 61241) by debbugs.gnu.org; 7 Jun 2025 08:21:09 +0000 Received: from localhost ([127.0.0.1]:46741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNond-0004f0-7H for submit@debbugs.gnu.org; Sat, 07 Jun 2025 04:21:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47094) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uNonb-0004eF-D5 for 61241@debbugs.gnu.org; Sat, 07 Jun 2025 04:21:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uNonV-0003jF-Ke; Sat, 07 Jun 2025 04:21:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Tk7yyRCBtplugKfegLQpH/c+9cn3w39v4Rq6PbhSzDc=; b=feuV/e7XgXgKcoL89fVb xV+wN8uPQwXnjcY8p6qNLxYdlSRSROPddzWxDeRfAvp1Cv9+smoXeWISiN9oTwWBLfgePMBCckDdj mHO5y6K/uPusjUs5Lz0oU7itnv1Gc3ReSz0jniC0ihduWFbUVMSG5hhJ1ENaeCsyU5f8IsTOvasvX uNwYu01Vc+mAc8ynHpWHTDleNjQxE1bV502Uk/6xV7kkI6biiP7QWOaqNQBB2UamoDXU0c9cca/99 ig7DpbkPjSaajw0/7dQiQernPxKtCMMQgh7I/otH29zgR/aI7XeZBecPodSfZR2GJJGJ0W24zGcG0 wrZgQ8WUr29DTg==; Date: Sat, 07 Jun 2025 11:20:59 +0300 Message-Id: <868qm4j72s.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <86wma61ink.fsf@gnu.org> (message from Eli Zaretskii on Sat, 24 May 2025 12:07:27 +0300) References: <87cz6n8tb1.fsf@yahoo.com> <87msyj8swb.fsf@yahoo.com> <0C98B803-0870-4B97-8497-D7B04CD93420@medranocalvo.com> <86wma61ink.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! Po Lu, please respond. > Cc: 61241@debbugs.gnu.org > Date: Sat, 24 May 2025 12:07:27 +0300 > From: Eli Zaretskii > > Po Lu, any comments? > > > From: Adrián Medraño Calvo > > Date: Tue, 13 May 2025 17:49:16 +0200 > > Cc: Eli Zaretskii , > > 61241@debbugs.gnu.org > > > > > On 22. Aug 2023, at 08:59, Po Lu wrote: > > > > > > Thanks. Taking into account your experiences with the TEST extension, > > > I'm inclined towards believing that such a change is TRT, but the > > > variable should be made terminal-local instead. (Emacs Lisp does > > > provide such a facility.) > > > > > > Also, there are a few difficulties with the patch you attached. First > > > of all, it obsoletes an existing variable without due reason, and that > > > should be avoided. Secondly, :version specifiers within the patch > > > should be revised to mention Emacs 30, since such a large change is not > > > apposite for the release branch. > > > > > > Finally, you missed the new terminal backend introduced in Emacs 30, > > > src/androidterm.c. > > > > Dear Po Lu, > > > > in the summer of 2024 I implemented a patch incorporating your suggestions. > > A couple of days ago I had a new look with the intention of finally submitting > > it. The patch corrects most of the issues you pointed out back then: nothing > > is touched in lisp/window.el, the variable is made terminal-local and it is > > implemented for androidterm as well. I don’t know how to indicate the :version > > for this terminal-local variable in the C code –or whether it’s possible–, > > please indicate how to do so (or simply edit the patch, as you prefer). > > > > A surprise emerged while rebasing to master: I discovered that since commit 2e8ef0910412aef8f9f1beba7c942473ad8602bb ("Protect against GCing of > > last_mouse_window”) all `last_mouse_window` of different terminals were merged > > into a single global variable. This is equivalent to my proposal in "Expose last > > window under pointer to Lisp” of 2023-08-22. This commit solves the original > > issue and, if you find it satisfactory, would allow to happily close this ticket. > > > > If you still think that implementing it as a terminal-local variable is necessary > > or preferable, I’m attaching the patch I described above. Note that I revert the > > changes introduced in 2e8ef09104 in my patch (please review attentively). > > > > Thank you for your patience and, as always, thank you for your work in Emacs. > > > > Kind regards, > > Adrián. > > > > From unknown Mon Jun 23 16:46:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Jun 2025 13:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 61241@debbugs.gnu.org, =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Received: via spool by 61241-submit@debbugs.gnu.org id=B61241.17493032884490 (code B ref 61241); Sat, 07 Jun 2025 13:35:02 +0000 Received: (at 61241) by debbugs.gnu.org; 7 Jun 2025 13:34:48 +0000 Received: from localhost ([127.0.0.1]:47375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNth9-0001AL-QV for submit@debbugs.gnu.org; Sat, 07 Jun 2025 09:34:48 -0400 Received: from sonic303-21.consmr.mail.ne1.yahoo.com ([66.163.188.147]:41103) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uNth6-0001A3-RJ for 61241@debbugs.gnu.org; Sat, 07 Jun 2025 09:34:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1749303279; bh=TsMrX1VsujUK+A4+Yi8S0H/tSTwm9lZ5a6YILF9s/Z4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=hxAKhtLavHVyos1miohvEf9YWH7JwntjtxVDm+0A2cjc8mJNq9zSGZRw3lA+S0pQBTGOT661GwLE6myE70gCNMiAYqfDx0amvLrSdbGU7P07jOe7bioHgovqSnfFWp1os7Piuuy6lVwEyEsm3vwpglOkIX6KjAl12SqULWDwGGRdKeqyq4PXJ/Hfe4d6fJGN4UiKnb1JJimkOnmgI5PVRG4PXEEScXsoilp2hhzWmuuaC/2hPYZD0fe5iy7zM/I2gqm2OE6K0VFlIhoVlEF6bLaJKZwHtj5jN1YotLvLsmU371QUIy481rheaClQUhmzPVK8UjsBTsr59mmGwSXd5A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1749303279; bh=7labCvXuz5HkmCMqvgXfofW0nJo/+0tS5kfvaIYxs+F=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=EobRoABXAFOIVf69q0BXwrZYtY2crUQwmKwkd5oVi7r+LPS97YsCLPecluo7Ml4RM3Vad1Ws3jTV22/V+fso9bHeRVrYcuypUQ43fG+iB33cyXL8+oz0cv+52tIndkp+YIPY/er/QNh2pNg+sBrRfM/Fu05ioHIP3rroT0+Qs1FcEEwCLuemhk8T6kSxNkdILTyJDRZyKyuR3hTDqfw3wMheh7P2JPiVHlrVX6q4OshGqE5EYNtD0qR6V9VFI6IOVJ41ZrfiqLs1YDSdguL4yz0svn5MM0nPUm2bXLFdBoZF7mLu7hYRWt86wazvrOpNaE1nc1ua0AJgIY9ytvBeQw== X-YMail-OSG: 0nrrTcwVM1k5.QF1Wb47sQZ0kAJpHnyVSWlJB_g7rvmK8SE7ZnCreXbD3foqdwv 08.JcqagbF_klBIoNS95gfGTs3ex9Mi0QtM9jmHuv4mKOxl_viEY8XtnTTewiwCOo7JCcjA1PDti ck8VHrkzeOAHDQdn_I._TiYdsujkVdmroPEJqE8.hkO31klByqGEyxdvvn0Zs6n30ZWweihQHu8F s78Y3K2zXiMeNcEasYCygITXKGc4krTViADTfDsXJT1wMvFyNxGKZ6_hSGr30FbpzTWfSWLAhYYd 0zT98wXBsl5bCealG.QLANYGIp6wmVGxNZtmVt_tYpDtbZxn4OnPYBMVAa.gLEsW6yd88.4.s9rM IC5yhkoV80bbmqoLXImkPgsyDUdJtIWhTBe3Qc3OLMFOe2dly0258BYFUifKX4lKRZbdS.vseV0R FnN7pY840PiGv_4tMPTp7LltyGB5ukHlAPOpe8q4LBleJM7RCFuv0jov8PlGVUxkyKjyDMIh824i sCkcnYce.EWpKEXgsVFc_Qk4m3bAQbj3_vH71bG_z2zarYjPfzZ0VZC2QCTMwxkBKyBo3Oim8_Dq wSScLYgzRg.jitCqEaDNIIZ7NBk7D_PgUrUu74.nWEQmslMnjAfsJBM0kURF9l4LHZK5Fd3OTadh tksDpMQQqM5cjollCQ0hIPvPTwbRUuEqY1tfFyZbZZd8l9eksW05K3NoV71kBhgSsLKzvrICrzaB LduTjKnh2Nt4V6dyAY3efTrE6m4wRwLTYm48apsfeX4ehFgfJ9CA3QnMgbVseZfFHb0QMEeF.ho2 8AIF.fUrbmCJWWLAM8ScjYXplc5fJPz9SkQpniUcUVqhyUkslGQNMjZKVjA0i.fqXjTw2JYBiE2Z HvQDgNgyz2PBigR47bvezQzor4WGB7Ja_3QD8EJ22Bb6rcoVMCmH.TLTAq9.taKJeJPgrVAlbIRq iI.ZxVwUX0VM_tiL_.bnSklTfHZWs.TNjQCyc3ybwXA9gKrEGx_H5op1tqhT.Ndbx3HUlpaXr3ly QaePF5b19lzHceUrUoPNj0EOB1VIlb8JPO1hmlkNHfR33qRawg42zgEQLZsgyvykgtR1tPpcs4pw euycjPoOeai950b9Wuu6F6tUNQOhNfWp_kGajzu0CJRMNcClGCV2BidglnlqTT8idEh0uMCDLtGQ 96lRfZR.Io8_UgVuFstLg3oZH8fxcl77t4Bsb0bF4UxPPF26XgjE6yKeHL_63zD8VklxutbEWIWd 67no5ZBd9bBsnKX3pO6A4hPgrpXY4GrwqFh9YePDPmKdWs44BBGdC2h0f.umyenzV.wr3CTLL8od k.GUAbFxQXmtVHGNWlhsv7Vk66VEosmVMZKQ0EbvvRLLyU5xvSSdu5u7TQD_WgI_D_QKZTOk8pTR 1G8ikd0R1PVucQwuVOSGuzMb3SA0YhOtFgl5l6PUArHNAYYjVtzDeaG.lgwze7cP.r04kde.LIwn faP0XDSVpZ9SwREh2XLyd5pe_jb85BO5ygqzFTx0zltLjLOI_WdGe_hz1vVQ9rzwaU_wEnUOEG5K tsKHkc6ltkX8S965ygA2FW4WZH4L.X.otX9JDWuK3G.ibnsREgaVNl2InS4nys6L7jiJAO1wkzFg GoC6frkapgX0so0nvqPTq30uiMsRsOAsVc6GnfEhYom5htA5keX77Wf63c7t9eeaUUlj4bowC0dX KuZQt4VyvsjTpB_268fIEngwxedG_3cWmuO37ah6zFRCHRHH0_TNrUmaa8o7lIoVPXcW6XWaKXpq sl.jMjlNtINCKOPCQ9q81GrSThlyCkHiQnd02thaIEVher6WXtKnNPUyKKliTjKe4CFalp_w3u5r lCJi.EE5PtePEZAVlUlPHtLaArKg.YyCaKLGaLOgYkM8uASl8Z96zubsG6rOJ7NEXLFNVEr2_tF. FbDNb1lLMxgo7u1vf7u2bGihY_WYrdi07Asp6IuTpMV.RhZhUfi0Us_QT7_k9BPMrK6urh2Ezkbt BK8scM7tEyRN1fl8o_UvsSZ2DgjTNhIKu5msZp3So27nOC8ObletpInY_0LJS3oMh.jLO9dzL4Mi KVxU8Zdvvj98sf9keiN7VckLx64Nww.F3l3VA2Fz3Y_KsqiLgapqQ0QW7RdffxIoAlnREWJCkZQt 3f1.9Ikbhj0SsELAFi6uACo00HubMgEtky6hB98Q72ShWK8CrYrTClLbZDWTK9Rjdf5MtqZoV6p_ 5DBf3bc_6Z36L8S71jkuljmlGE4SdS9usL5cioCxxnl6KOINj0i9wqmTvQhF3fJGk X-Sonic-MF: X-Sonic-ID: aac1e851-8f3f-41db-a296-75bf1ab82c25 Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ne1.yahoo.com with HTTP; Sat, 7 Jun 2025 13:34:39 +0000 Received: by hermes--production-sg3-cdfd77c9c-tzjrq (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 97c21fd5f413ad809ac64a8a652cd2ee; Sat, 07 Jun 2025 13:34:35 +0000 (UTC) From: Po Lu In-Reply-To: <86wma61ink.fsf@gnu.org> References: <87cz6n8tb1.fsf@yahoo.com> <87msyj8swb.fsf@yahoo.com> <0C98B803-0870-4B97-8497-D7B04CD93420@medranocalvo.com> <86wma61ink.fsf@gnu.org> Date: Sat, 07 Jun 2025 21:34:30 +0800 Message-ID: <877c1nsmjd.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.23956 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 321 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: > Po Lu, any comments? I believe it should be alright to close this ticket now. P.S. I anticipate being mostly unavailable for Emacs development over the course of this month. I'll try to revisit all of the correspondence I have missed at the close of this period. My apologies. From unknown Mon Jun 23 16:46:33 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: =?UTF-8?Q?Adri=C3=A1n_?= =?UTF-8?Q?Medra=C3=B1o?= Calvo Subject: bug#61241: closed (Re: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2) Message-ID: References: <865xgys9qn.fsf@gnu.org> <16B04B25-8EB8-4967-947B-C03DF3690ADF@medranocalvo.com> X-Gnu-PR-Message: they-closed 61241 X-Gnu-PR-Package: emacs Reply-To: 61241@debbugs.gnu.org Date: Sat, 14 Jun 2025 14:02:05 +0000 Content-Type: multipart/mixed; boundary="----------=_1749909725-30822-1" This is a multi-part message in MIME format... ------------=_1749909725-30822-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and = XInput 2 which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 61241@debbugs.gnu.org. --=20 61241: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D61241 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1749909725-30822-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 61241-done) by debbugs.gnu.org; 14 Jun 2025 14:01:36 +0000 Received: from localhost ([127.0.0.1]:39659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uQRRu-0007ja-Qc for submit@debbugs.gnu.org; Sat, 14 Jun 2025 10:01:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53870) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uQRRn-0007an-AM for 61241-done@debbugs.gnu.org; Sat, 14 Jun 2025 10:01:31 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uQRRh-0004y7-NU; Sat, 14 Jun 2025 10:01:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=svg3O5OHmmXa+gh3E+qdsveg7GTzC9qarTW2wuJiPTg=; b=R5kYP5jfSY4dvxtKSYoH mHTCA0eOkgAKG8aoeWYTU9pkiRaspfVTkEMIeKXVpCwsW9mfBRuUmXB6I24qGdx4b1NDWHQ9h8jLh BVRyrZgDsqiSHxHxJEXEaaRcdx5MXWTSYLfP1KktPuZ14J4PEXV8H96W4XkYtgWt9n/4KdW8J3M0v PEC+B3nI8cKy1P8llOinPxu/Ca/XIECK2W6OpMV7mtyKV/arJDBqPrgtWr0lE2H3QyTQjM0eDXCyq 1KLn5H1DTqm123H6c5vWRMchFfCbbgH0S/4Uuwojd1A9gkpTODUwa39SboJK8Cz9zpw+5WCK2keWb I7HXMsSpRpDSfA==; Date: Sat, 14 Jun 2025 17:01:20 +0300 Message-Id: <865xgys9qn.fsf@gnu.org> From: Eli Zaretskii To: Po Lu In-Reply-To: <877c1nsmjd.fsf@yahoo.com> (message from Po Lu on Sat, 07 Jun 2025 21:34:30 +0800) Subject: Re: bug#61241: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 References: <87cz6n8tb1.fsf@yahoo.com> <87msyj8swb.fsf@yahoo.com> <0C98B803-0870-4B97-8497-D7B04CD93420@medranocalvo.com> <86wma61ink.fsf@gnu.org> <877c1nsmjd.fsf@yahoo.com> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61241-done Cc: 61241-done@debbugs.gnu.org, adrian@medranocalvo.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Po Lu > Cc: Adrin Medrao Calvo , > 61241@debbugs.gnu.org > Date: Sat, 07 Jun 2025 21:34:30 +0800 > > Eli Zaretskii writes: > > > Po Lu, any comments? > > I believe it should be alright to close this ticket now. Done. ------------=_1749909725-30822-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 2 Feb 2023 22:28:18 +0000 Received: from localhost ([127.0.0.1]:36096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNi41-0005YA-Ji for submit@debbugs.gnu.org; Thu, 02 Feb 2023 17:28:18 -0500 Received: from lists.gnu.org ([209.51.188.17]:55830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNi3y-0005Y2-Te for submit@debbugs.gnu.org; Thu, 02 Feb 2023 17:28:15 -0500 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 1pNi3y-0004lB-JG for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 17:28:14 -0500 Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1pNi3w-00059v-5h for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 17:28:14 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4P7D2D3gRfz9sbn for ; Thu, 2 Feb 2023 23:28:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=medranocalvo.com; s=MBO0001; t=1675376884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=g/kY5kWZ6N5rlOGuKZGOgZBsLYudXRzPmvVV2qEMN04=; b=bSbYh4jvy2rBPnivsiheiIBaTUdQFkDersd2VGHNZYZcy5syJdFjrnRBL7gOjd/aL8ZzRm ugLE9pr+eimqQCF2rC/HAhFLPCm4I7HKrIUqdxxW+wVF8b6cvRqFmo0qq0wbXkJsdqszyq r93UY7q/g5B3wa52JFlcEKOJYzX2KgwYLybHvYxyRzosetFo+pu+LHlduN8oxrbUwC3cHs P6Km0EdrpMqc7zLY0uCPuP9+bPp0Jb2pIzxPUugjQIudlIApdQcvinb8HI8XvvychpvtTX dNgr8jKp+egw5xoJBnnia30Kgno70WbS4UYEHNDiTWIHFltLm7MJmYfFXC0jug== From: =?utf-8?Q?Adri=C3=A1n_Medra=C3=B1o_Calvo?= Content-Type: multipart/mixed; boundary="Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E" Mime-Version: 1.0 Subject: 29.0.60; Incoherent last_mouse_window (xterm.c) between XInput and XInput 2 Message-Id: <16B04B25-8EB8-4967-947B-C03DF3690ADF@medranocalvo.com> Date: Thu, 2 Feb 2023 23:28:01 +0100 To: bug-gnu-emacs@gnu.org Received-SPF: pass client-ip=2001:67c:2050:0:465::102; envelope-from=adrian@medranocalvo.com; helo=mout-p-102.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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, = leading 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. 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. The attached patch fixes the issue. Thank you, Adri=C3=A1n Medra=C3=B1o Calvo. --Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E Content-Disposition: attachment; filename=0001-Fix-mouse-autoselect-window-for-alternating-XInput-a.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Fix-mouse-autoselect-window-for-alternating-XInput-a.patch" Content-Transfer-Encoding: quoted-printable =46rom=20e16d6ddbfdc4110fbbbcf763cff5a72b0f0df92c=20Mon=20Sep=2017=20= 00:00:00=202001=0AMessage-Id:=20= =0AFrom:=20=3D?UTF-8?q?Adri=3DC3=3DA1n=3D20Medra=3DC3=3DB1o=3D20Cal= vo?=3D=0A=20=0ADate:=20Wed,=201=20Feb=202023=20= 00:00:00=20+0000=0ASubject:=20[PATCH]=20Fix=20`mouse-autoselect-window'=20= for=20alternating=20XInput=20and=0A=20XInput=202=20events=0A=0A*=20= src/xterm.c=20(handle_one_xevent):=20Move=20`last_mouse_window'=20to=0A= main=20function=20scope=20to=20share=20value=20between=20XInput=20and=20= XInput=202=0Ahandlers.=0A---=0A=20src/xterm.c=20|=206=20+++---=0A=201=20= file=20changed,=203=20insertions(+),=203=20deletions(-)=0A=0Adiff=20= --git=20a/src/xterm.c=20b/src/xterm.c=0Aindex=206a4b84babe4..dd20c8c7fe5=20= 100644=0A---=20a/src/xterm.c=0A+++=20b/src/xterm.c=0A@@=20-18364,6=20= +18364,9=20@@=20handle_one_xevent=20(struct=20x_display_info=20*dpyinfo,=0A= =20=20=20GdkDisplay=20*gdpy=20=3D=20gdk_x11_lookup_xdisplay=20= (dpyinfo->display);=0A=20#endif=0A=20=20=20int=20dx,=20dy;=0A+=20=20/*=20= Holds=20the=20last=20window=20the=20mouse=20moved=20over,=20used=20for=0A= +=20=20=20=20=20`mouse-autoselect-window'=20*/=0A+=20=20static=20= Lisp_Object=20last_mouse_window;=0A=20=0A=20=20=20/*=20Avoid=20warnings=20= when=20SAFE_ALLOCA=20is=20not=20actually=20used.=20=20*/=0A=20#if=20= defined=20HAVE_XINPUT2=20||=20defined=20HAVE_XKB=20||=20defined=20= HAVE_X_I18N=0A@@=20-20677,8=20+20680,6=20@@=20handle_one_xevent=20= (struct=20x_display_info=20*dpyinfo,=0A=20=09=09&&=20(f=20=3D=3D=20= XFRAME=20(selected_frame)=0A=20=09=09=20=20=20=20||=20!NILP=20= (focus_follows_mouse)))=0A=20=09=20=20=20=20=20=20{=0A-=09=09static=20= Lisp_Object=20last_mouse_window;=0A-=0A=20=09=09if=20(xmotion.window=20= !=3D=20FRAME_X_WINDOW=20(f))=0A=20=09=09=20=20{=0A=20=09=09=20=20=20=20= x_translate_coordinates=20(f,=20xmotion.x_root,=20xmotion.y_root,=0A@@=20= -22587,7=20+22588,6=20@@=20handle_one_xevent=20(struct=20x_display_info=20= *dpyinfo,=0A=20=09=09=20=20=20=20=20=20&&=20(f=20=3D=3D=20XFRAME=20= (selected_frame)=0A=20=09=09=09=20=20||=20!NILP=20= (focus_follows_mouse)))=0A=20=09=09=20=20=20=20{=0A-=09=09=20=20=20=20=20= =20static=20Lisp_Object=20last_mouse_window;=0A=20=09=09=20=20=20=20=20=20= Lisp_Object=20window=20=3D=20window_from_coordinates=20(f,=20ev.x,=20= ev.y,=200,=20false,=20false);=0A=20=0A=20=09=09=20=20=20=20=20=20/*=20A=20= window=20will=20be=20autoselected=20only=20when=20it=20is=20not=0A--=20=0A= 2.39.1=0A=0A= --Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii In GNU Emacs 29.0.60 (build 1, x86_64-apple-darwin22.2.0, cairo version 1.17.6) of 2023-01-26 built on amcmac Repository revision: f8c95d1a7681e861fc22d2a040cda0ddfe23eff4 Repository branch: master Windowing system distributor 'The X.Org Foundation', version = 11.0.12101006 System Description: macOS 13.2 Configured using: 'configure --prefix=3D/Volumes/sys/repos/emacs-cairo/rel --without-makeinfo --without-dbus --without-ns --with-x-toolkit=3Dno --with-cairo = PKG_CONFIG_PATH=3D/opt/X11/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgco= nfig:/usr/local/opt/fontconfig/lib/pkgconfig:/usr/local/opt/ncurses/lib/pk= gconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/Cellar/jpeg/9d/lib= /pkgconfig:/usr/local/Cellar/libtiff/4.3.0/lib/pkgconfig:/usr/local/opt/ha= rfbuzz/lib/pkgconfig/:/usr/local/opt/harfbuzz/lib/pkgconfig/ 'CFLAGS=3D-Og -g3' --without-jpeg --without-gif --without-xpm --without-tiff' Configured features: ACL CAIRO FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE OLDXMENU PDUMPER PNG RSVG SQLITE3 THREADS WEBP X11 XDBE XIM XINPUT2 ZLIB Important settings: value of $LC_ALL: en_US.UTF-8 value of $LANG: en_US value of $XMODIFIERS: @im=3Dexwm-xim locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads kqueue lcms2 dynamic-setting system-font-setting font-render-setting cairo xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 38318 8147) (symbols 48 5108 0) (strings 32 12656 2131) (string-bytes 1 362604) (vectors 16 10252) (vector-slots 8 147251 15877) (floats 8 42 19) (intervals 56 263 0) (buffers 976 10))= --Apple-Mail=_00C787AB-0549-46AC-9266-563CC5017C8E-- ------------=_1749909725-30822-1--