From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61525: 29.0.60; delete-frame will raise frames in another virtual desktop Date: Wed, 15 Feb 2023 16:41:41 +0100 Message-ID: References: Reply-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9412"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin) Cc: justksqsf@gmail.com To: 61525@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 15 16:42:24 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSJvL-0002Fv-RO for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Feb 2023 16:42:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSJv2-0001jx-Q9; Wed, 15 Feb 2023 10:42: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 1pSJv1-0001jJ-44 for bug-gnu-emacs@gnu.org; Wed, 15 Feb 2023 10:42:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSJv0-0003to-RK for bug-gnu-emacs@gnu.org; Wed, 15 Feb 2023 10:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pSJv0-00082z-NM for bug-gnu-emacs@gnu.org; Wed, 15 Feb 2023 10:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Feb 2023 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61525 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: 61525@debbugs.gnu.org, Kai Ma Original-Received: via spool by 61525-submit@debbugs.gnu.org id=B61525.167647572130919 (code B ref 61525); Wed, 15 Feb 2023 15:42:02 +0000 Original-Received: (at 61525) by debbugs.gnu.org; 15 Feb 2023 15:42:01 +0000 Original-Received: from localhost ([127.0.0.1]:33664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSJuy-00082c-S0 for submit@debbugs.gnu.org; Wed, 15 Feb 2023 10:42:01 -0500 Original-Received: from sonic311-31.consmr.mail.ir2.yahoo.com ([77.238.176.163]:45548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSJuq-00081c-2y for 61525@debbugs.gnu.org; Wed, 15 Feb 2023 10:41:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1676475705; bh=uLiHa7pghwO5a2ZgdQuZdFCnoCuj63WkMP9nA6MzL3g=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=gK1JmWZfkccCaEqFo40CE2gF8XEtxYi91K/NKkx67NXL8luHPIijMQAow89EsUJAPCClS8lnK1tsH5IuAmivwS6dnmLUYcjQH6KfgfHiS9f++lub2Jx0zU060U2pedjqvskzHJRCf7BMmF335ovcxT2rPxKRozzKnNYO8TfDXS2bvpQNgfjMffKzC4Cilf5WNXeMeo8vDh15HjmV3s7Tmwgi8fJjCx+mpMri1K3uHLe7a+bQlmamrxqHBGbYwISdDklu8uWbD1C/Bfj+JdpWLWGY7ZFmnGgLxy785Jctwpj1YrW8Mqrd2QpdL8wxVZa4p+IbKdCysWW5jfWl+wVyaA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1676475705; bh=/NoMubAb0+1mfY1+5YLsMyrLBO37ueasuxF0kEncZ6r=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=UCvtuYCa2K+5MIcfFzXZdA0Gu7tY87RVGqqRH3FOjM6nNjeAi4fuj0Wjp3psUz2Mfqk+uotMRJrB/vd1BEP/51bGbrpmw8Xns7yTbmI73X5/T5u7fefge/ifc9bAeIdUIIQJ3Pr6lctt733nDmTFSkF7oyHWIDIk2Xzz7ttg4V40iy2JpI4mml+YCH9V17qBZjbfJR1DZ025Jpn06bPaWATMG55jeKGsPo1OhNPjhtfw/ek4uXkZgAbfluuQjyyCOzRH7F/itwbCffUlOe3Rtnf2yCJT8BBU90IOsvrgbg8q+Xsr73K05L8kBvhLvGn+xiPEgMVhYvBzDeXkh3xcZA== X-YMail-OSG: NdM8zL0VM1nwb3O7dHTNPpguR_p4aIuyLVLIzWcjG6q4zK6vLyPH5BFB0POEyOO okBUPMYVrPJyK4jS_B8HZiVG5GdB9QBiGra70RRuf0ploKMAFLANiOegz7QvLFheTmdkoXFxz43g GrhXY20nh2dnNbBe98y5oeexazwlDw7y99y67UjAitmuLJGV5dKYdrvz8BrYerCH672h99tpYWBn x9ga7ImFxFnu57dUCGK3wzPWgPwK2T6rpbuhQ7PKZBwww47O9Op9y7_XayVBGuLvM4toKmmumeG5 0TGWmYnVnm70BdS.YYIIbEX82I0Icd8KoYMct8NDcUdVZU0xxxLswGelSJ62mAR3NbHwTc3Nezwj L2C279aqkmvhZAwWXiZ0CXozB6mrCJlEaDGAp2d1no.SjaGTMwI21bTCaz.fhKF2fofFEty09.DS Oe0k8dJaEtxbg67KjEBDbLT72mCFMPXaZBNQfnSRSyuUEl_GCwTZ5JcPtAMxUepW3N7dBR6IVFc_ IjXBWtccfszcw5lufZkChrNNZvRe23uwVRVCQM5bnUfXRPBYotOB8pbzmnEPhj6xiNfFk.qwA.FO OC88TOEDUrG8GwFJasX5BGVwWs4WhmLtDK8IpJR6.EuoCR9b09xDnrT_WMS58xpWFJBgW82hkzLf Npw8GHHuQOJqOPP7SDLTETtZktQHUQ7uFFJj507eMyqx1sShWh1N1d8Uxa_SJQ_x4UA1pDzD7JKV 6KnUXyvu5ZA4bjGFsOmcHztpRWzadcvRuvO8lKN7Q7X3zEchKLzKsXFinfpiUWn59iqQH8IMbDkz RKlnc8LKlhm6b9ru2JhD9VrFmjqsxcpslEuyXXD9AF X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Wed, 15 Feb 2023 15:41:45 +0000 Original-Received: by hermes--production-ir2-65c64dfd66-fhq4t (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID a8f82125e86db1c10b4afcb3a99308dc; Wed, 15 Feb 2023 15:41:42 +0000 (UTC) In-Reply-To: ("Daniel =?UTF-8?Q?Mart=C3=ADn?= via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\""'s message of "Wed, 15 Feb 2023 11:54:17 +0100") X-Mailer: WebService/1.1.21183 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255735 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Daniel Mart=C3=ADn via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > > One downside of removing raise_frame is that, after you press C-x 5 0, > you cannot start typing right away without first focusing on another > Emacs frame manually. People would consider this a regression from > previous versions and something that doesn't happen on GNU/Linux. > > A possibly better approach could be: > > Once the "other" frame to select is chosen by the code that is just > above in frame.c, call some Obj-C code that extracts the EmacsView and > makes it the first responder: > > EmacsView *view =3D FRAME_NS_VIEW (frame1); > [self makeFirstResponder:view]; > > I haven't tested this, but perhaps this makes the other frame receive > focus without switching desktops in a multi-desktop configuration. The attached patch avoids the unwanted side effects of raise-frame by making the other frame the key window, instead. Could you give it a try? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-NS-Do-not-raise-a-different-frame-when-closing-a-fra.patch >From 50cb6ed653b17bb5f712872f3f664e1273e498d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Wed, 15 Feb 2023 16:33:14 +0100 Subject: [PATCH] [NS] Do not raise a different frame when closing a frame * src/frame.h: Declare an NS-only function to make a frame the key window. * src/nsfns.m (ns_make_frame_key_window): Implement it. * src/frame.c (delete_frame): Call ns_make_frame_key_window instead of Fraise_frame. (Bug#61525) --- src/frame.c | 5 ++--- src/frame.h | 5 +++++ src/nsfns.m | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/frame.c b/src/frame.c index 983424b0bee..b2319a35aed 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2152,9 +2152,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* Under NS, there is no system mechanism for choosing a new window to get focus -- it is left to application code. So the portion of THIS application interfacing with NS - needs to know about it. We call Fraise_frame, but the - purpose is really to transfer focus. */ - Fraise_frame (frame1); + needs to make the frame we switch to the key window. */ + ns_make_frame_key_window (XFRAME (frame1)); #endif do_switch_frame (frame1, 1, Qnil); diff --git a/src/frame.h b/src/frame.h index b95b94c7685..2eb9de81f0a 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1380,6 +1380,11 @@ window_system_available (struct frame *f) extern void frame_size_history_plain (struct frame *, Lisp_Object); extern void frame_size_history_extra (struct frame *, Lisp_Object, int, int, int, int, int, int); +#ifdef NS_IMPL_COCOA +/* Implemented in nsfns.m. */ +extern void ns_make_frame_key_window (struct frame *f); +#endif + extern Lisp_Object Vframe_list; /* Value is a pointer to the selected frame. If the selected frame diff --git a/src/nsfns.m b/src/nsfns.m index 8804a7df7cf..cd41c6095a0 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -685,6 +685,11 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. SET_FRAME_GARBAGED (f); } +void ns_make_frame_key_window (struct frame *f) +{ + [[FRAME_NS_VIEW (f) window] makeKeyWindow]; +} + /* tabbar support */ static void ns_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) -- 2.34.1 --=-=-=--