From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Reitter Newsgroups: gmane.emacs.bugs Subject: bug#3303: delete-frame raises old (invisible) frame Date: Mon, 18 May 2009 11:08:39 -0400 Message-ID: References: <2C87549A-2553-4477-BF77-6258A1CC32BE@gmail.com> <6A510E91-6262-44CF-AA62-315DECB52EF6@gmail.com> <90E34251-C034-4169-91FE-22A28C94901F@gmail.com> <73A0DAB1-9D16-4E35-A9F7-E9E4CCEACC50@gmail.com> Reply-To: David Reitter , 3303@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v935.3) Content-Type: multipart/signed; boundary=Apple-Mail-21-211631399; micalg=sha1; protocol="application/pkcs7-signature" X-Trace: ger.gmane.org 1242661828 20865 80.91.229.12 (18 May 2009 15:50:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 May 2009 15:50:28 +0000 (UTC) Cc: 3303@emacsbugs.donarmstrong.com To: Adrian Robert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 18 17:50:20 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M656X-0007hn-7p for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 May 2009 17:50:18 +0200 Original-Received: from localhost ([127.0.0.1]:56067 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M656W-0008TJ-QK for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 May 2009 11:50:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M64oz-0001pH-Be for bug-gnu-emacs@gnu.org; Mon, 18 May 2009 11:32:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M64ot-0001oN-Hp for bug-gnu-emacs@gnu.org; Mon, 18 May 2009 11:32:07 -0400 Original-Received: from [199.232.76.173] (port=56865 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M64or-0001o8-Om for bug-gnu-emacs@gnu.org; Mon, 18 May 2009 11:32:02 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:54008) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M64or-0001GG-5j for bug-gnu-emacs@gnu.org; Mon, 18 May 2009 11:32:01 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n4IFVuga025454; Mon, 18 May 2009 08:31:57 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n4IFF3PE020230; Mon, 18 May 2009 08:15:03 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: David Reitter Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 18 May 2009 15:15:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 3303 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 3303-submit@emacsbugs.donarmstrong.com id=B3303.124265933518767 (code B ref 3303); Mon, 18 May 2009 15:15:03 +0000 Original-Received: (at 3303) by emacsbugs.donarmstrong.com; 18 May 2009 15:08:55 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail-fx0-f160.google.com (mail-fx0-f160.google.com [209.85.220.160]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n4IF8oWm018759 for <3303@emacsbugs.donarmstrong.com>; Mon, 18 May 2009 08:08:51 -0700 Original-Received: by fxm4 with SMTP id 4so4511536fxm.1 for <3303@emacsbugs.donarmstrong.com>; Mon, 18 May 2009 08:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:mime-version:subject:date:references :x-mailer; bh=dmoFnpD2KJccYkvx1yd4yfcD6X0PPDV7/st32/i7P1g=; b=YvfjAeHOVTheE0uxgtyJzMm/RTIF1WscNZiE9Lxy/eXxbGSDZKDVUp+XJLtvCRDr0+ vXifWyuKpsOazAu9OyA/JSqKntnxV5okOc+APVlYDW934Lr2ZpbxfmzlA0kaic/dYYSB W2HeZ+3N1kd2ihjJaDmAJiotQkAPrEG/JW5Eg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type:mime-version:subject :date:references:x-mailer; b=Rz1xnDwUoy+lpCY6BkFzbxV7a7eOkRHAKUCHNe4ZmWImSmVUT9Wu2JemhxPzoP7eky WjBNKl4aQoT0ezm9PuaFFY+bBTjPI6ChJZ/6tTteW42sZi7p8cJcMWfKshQgArT88gX3 Z2LN5d/q1M3Fk4fzvtdW1NwNI89h+G3TPWygo= Original-Received: by 10.103.193.12 with SMTP id v12mr4144677mup.23.1242659324182; Mon, 18 May 2009 08:08:44 -0700 (PDT) Original-Received: from ?192.168.1.42? (pool-71-162-19-47.pitbpa.east.verizon.net [71.162.19.47]) by mx.google.com with ESMTPS id e9sm258527muf.2.2009.05.18.08.08.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 18 May 2009 08:08:43 -0700 (PDT) In-Reply-To: <73A0DAB1-9D16-4E35-A9F7-E9E4CCEACC50@gmail.com> X-Mailer: Apple Mail (2.935.3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Mon, 18 May 2009 11:32:07 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:27971 Archived-At: --Apple-Mail-21-211631399 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On May 18, 2009, at 4:05 AM, Adrian Robert wrote: > > On May 18, 2009, at 10:33 AM, Stefan Monnier wrote: > >>> There is no behavior built into the NS window manager to choose >>> another >>> application window to be active after the active one has been >>> removed -- >>> this is left to application code. >> >> [ So, nothing gets focus? Keyboard events are just dropped on the >> floor >> in such a case? Sounds odd: it should be easy for Apple to provide >> a sensible default behavior without any negative impact. ] > > Yes, KB events only get sent to a focused window, except for menu > shortcut invocations. It might be that in NSDocument-based apps > (which Emacs.app isn't, but would be conceptually similar to if 1- > buffer=1-frame) the NSDocument architecture would autofocus the most > recently available doc window, but I guess NeXT/Apple decided not to > make assumptions otherwise about sensible focus-sequencing. Precisely for this reason is the patch not sufficient. When there is a hidden frame, and you delete the only other existing frame, we end up in a situation where there is no key window to receive the event, and all events (including menu items) are simply dropped. I've experimented with NSWindow's makeKeyWindow, which should leave the order of the windows so the frame stays hidden. However, this alone doesn't do the job. Events still get dropped when you do (progn (make-frame-invisible (selected-frame) t) (make-frame) (delete-frame (selected-frame) t)) Note that I had to add FRAME_SAMPLE_VISIBILITY compared to the last patch I sent. diff --git a/src/frame.c b/src/frame.c index de857af..144b8ac 100644 --- a/src/frame.c +++ b/src/frame.c @@ -778,6 +778,9 @@ affects all frames on the same terminal device. */) is dead. The value of NORECORD is passed as argument to Fselect_window. */ +#ifdef HAVE_NS +extern void x_make_key_frame (struct frame *f); +#endif Lisp_Object do_switch_frame (frame, track, for_deletion, norecord) @@ -868,8 +871,12 @@ do_switch_frame (frame, track, for_deletion, norecord) #ifdef NS_IMPL_COCOA /* term gets no other notification of this */ + FRAME_SAMPLE_VISIBILITY (XFRAME (selected_frame)); if (for_deletion) - Fraise_frame(Qnil); + if (FRAME_VISIBLE_P (XFRAME (selected_frame))) + Fraise_frame(Qnil); + else + x_make_key_frame(XFRAME (selected_frame)); #endif /* We want to make sure that the next event generates a frame-switch diff --git a/src/nsterm.m b/src/nsterm.m index 7e3028a..0994f7d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -910,6 +910,20 @@ ns_raise_frame (struct frame *f) } +void +x_make_key_frame (struct frame *f) +/* -------------------------------------------------------------------------- + Make window active + -------------------------------------------------------------------------- */ +{ + NSView *view = FRAME_NS_VIEW (f); + check_ns (); + BLOCK_INPUT; + [[view window] makeKeyWindow]; + UNBLOCK_INPUT; +} + + static void ns_lower_frame (struct frame *f) /* -------------------------------------------------------------------------- --Apple-Mail-21-211631399 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIFxDCCAn0w ggHmoAMCAQICED6shx13jEDrq0eL8FRq5ykwDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA4MTIwOTAyMDgwMVoXDTA5MTIwOTAyMDgw MVowYjEQMA4GA1UEBBMHUmVpdHRlcjEOMAwGA1UEKhMFRGF2aWQxFjAUBgNVBAMTDURhdmlkIFJl aXR0ZXIxJjAkBgkqhkiG9w0BCQEWF2RhdmlkLnJlaXR0ZXJAZ21haWwuY29tMIGfMA0GCSqGSIb3 DQEBAQUAA4GNADCBiQKBgQDOdo6kAwlkBxUb8dj4saMbYg4SVng8CUePFn3cjjWrakBTbUVa4Z0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