From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65116: 29.1; query-replace-read-args fails reading second arg in detached minibuf Date: Sun, 14 Jan 2024 08:21:13 +0200 Message-ID: <83le8sfnae.fsf@gnu.org> References: <831qalivwr.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33249"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, acm@muc.de, 65116@debbugs.gnu.org To: Jim Rees Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 14 07:22:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rOtt4-0008RW-7Y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Jan 2024 07:22:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOtsi-000740-NB; Sun, 14 Jan 2024 01:22:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOtsg-00073I-SA for bug-gnu-emacs@gnu.org; Sun, 14 Jan 2024 01:22:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOtsg-0006o2-Jm for bug-gnu-emacs@gnu.org; Sun, 14 Jan 2024 01:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rOtsf-00048I-Iw for bug-gnu-emacs@gnu.org; Sun, 14 Jan 2024 01:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Jan 2024 06:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65116 X-GNU-PR-Package: emacs Original-Received: via spool by 65116-submit@debbugs.gnu.org id=B65116.170521330015857 (code B ref 65116); Sun, 14 Jan 2024 06:22:01 +0000 Original-Received: (at 65116) by debbugs.gnu.org; 14 Jan 2024 06:21:40 +0000 Original-Received: from localhost ([127.0.0.1]:41532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOtsK-00047f-3u for submit@debbugs.gnu.org; Sun, 14 Jan 2024 01:21:40 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39074) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOtsH-00047R-Rw for 65116@debbugs.gnu.org; Sun, 14 Jan 2024 01:21:39 -0500 Original-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 1rOtsC-0006TF-Mn; Sun, 14 Jan 2024 01:21:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jVt2E8gPNQgmD/H+nqTJM4y3pykSSrVt8e37vJeT26c=; b=LffFhLRcT/na dsyzv2vGz2ekTqdxLSLMhRKpC7u+dCFvjj2XsS9ngi20MyxmczMGxN84T63QFh2U7X+ECe5rGIY2W ETJbV3DHJHH0fNp62ubcAt64hX5DpGEE38ly9TPz9XnNccMg30lmoLENeMozD+JTHgq4ZN3hOjiEC +3WZP6Bjq93UQjFT1aSQGwsPpzpKmAXcQBpWTw0s15cM5G25Lio2X5/AcYTVGEZYQfNBRYhcotw0M +UkW/ZG17+zWwxzC6Hw4BIcKFjwXnkHll74tGu4DdzR+s4bqtT0OiTQDlL4EgyHL4xBqyF+IutUNf 8wTQvu3jkMS25Xhcwb2nNA==; In-Reply-To: (message from Jim Rees on Sat, 13 Jan 2024 17:53:17 -0600) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:278179 Archived-At: > Date: Sat, 13 Jan 2024 17:53:17 -0600 > From: Jim Rees > Cc: Eli Zaretskii , Po Lu , > 65116@debbugs.gnu.org > > Yes that fixed it. Thanks. Can you please revert that change, and instead test the patch below? It was recently installed on the master branch of Emacs. diff --git a/src/xterm.c b/src/xterm.c index 77d6550..fe39817 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -13370,13 +13370,12 @@ xi_focus_handle_for_device (struct x_display_info *dpyinfo, frame's user time. */ x_display_set_last_user_time (dpyinfo, event->time, event->send_event, false); - device->focus_frame = NULL; /* So, unfortunately, the X Input Extension is implemented such - that means XI_Leave events will not have their focus field - set if the core focus is transferred to another window after - an entry event that pretends to (or really does) set the + that XI_Leave events will not have their focus field set if + the core focus is transferred to another window after an + entry event that pretends to (or really does) set the implicit focus. In addition, if the core focus is set, but the extension focus on the client pointer is not, all XI_Enter events will have their focus fields set, despite not @@ -28805,6 +28804,33 @@ x_focus_frame (struct frame *f, bool noactivate) friends being set. */ block_input (); +#ifdef HAVE_GTK3 + /* read_minibuf assumes that calling Fx_focus_frame on a frame that + is already selected won't move the focus elsewhere, and thereby + disrupt any focus redirection to e.g. a minibuffer frame that + might be activated between that call being made and the + consequent XI_FocusIn/Out events arriving. This is true whether + the focus is ultimately transferred back to the frame it was + initially on or not. + + GTK 3 moves the keyboard focus to the edit widget's window + whenever it receives a FocusIn event targeting the outer window. + This operation gives rise to a FocusOut event that clears + device->focus_frame, which in turn prompts xi_handle_focus_change + to clear the display's focus frame. The next FocusIn event + destined for the same frame registers as a new focus, which + cancels any focus redirection from that frame. + + To prevent this chain of events from disrupting focus redirection + when the minibuffer is activated twice in rapid succession while + configured to redirect focus to a minibuffer frame, ignore frames + which hold the input focus and are connected to a minibuffer + window. (bug#65116)*/ + + if (f == dpyinfo->x_focus_frame && !FRAME_HAS_MINIBUF_P (f)) + return; +#endif /* HAVE_GTK3 */ + if (FRAME_X_EMBEDDED_P (f)) /* For Xembedded frames, normally the embedder forwards key events. See XEmbed Protocol Specification at