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 19:00:17 -0400 Message-ID: <5C67F4CF-F798-4972-90DE-0489B1E10706@gmail.com> 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-36-239929134; micalg=sha1; protocol="application/pkcs7-signature" X-Trace: ger.gmane.org 1242688340 9285 80.91.229.12 (18 May 2009 23:12:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 May 2009 23:12:20 +0000 (UTC) Cc: 3303@emacsbugs.donarmstrong.com, Adrian Robert To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 19 01:12:13 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 1M6C0C-0002Gk-Tf for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 May 2009 01:12:13 +0200 Original-Received: from localhost ([127.0.0.1]:33032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M6C0C-0001S2-1z for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 May 2009 19:12:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M6C06-0001QF-TR for bug-gnu-emacs@gnu.org; Mon, 18 May 2009 19:12:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M6C01-0001Lg-Si for bug-gnu-emacs@gnu.org; Mon, 18 May 2009 19:12:06 -0400 Original-Received: from [199.232.76.173] (port=36871 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M6C01-0001Kz-4c for bug-gnu-emacs@gnu.org; Mon, 18 May 2009 19:12:01 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:55377) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M6Bzz-0004mc-T8 for bug-gnu-emacs@gnu.org; Mon, 18 May 2009 19:12:00 -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 n4INBuAU030717; Mon, 18 May 2009 16:11:57 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n4IN56eG028142; Mon, 18 May 2009 16:05:06 -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 23:05:06 +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.124268763126633 (code B ref 3303); Mon, 18 May 2009 23:05:06 +0000 Original-Received: (at 3303) by emacsbugs.donarmstrong.com; 18 May 2009 23:00:31 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail-qy0-f178.google.com (mail-qy0-f178.google.com [209.85.221.178]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n4IN0Qa2026611 for <3303@emacsbugs.donarmstrong.com>; Mon, 18 May 2009 16:00:27 -0700 Original-Received: by qyk8 with SMTP id 8so5720189qyk.19 for <3303@emacsbugs.donarmstrong.com>; Mon, 18 May 2009 16:00:21 -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=qQkL4+Y+zUpBTR9fa/S0m6bR4uOIJC0+O46A31bSGeI=; b=HoKLyhKVJhDluSXoNymBnfnCst9PmViCfp6XogXTlL2CEWinoPYDnpxwn+uvNaUWFr VecqGsUaunFEmUAVe1g6bZ2ab7rErQ6UEH44DJzW8xTAijM+II6H530c1cp2rGsDOd0h aaWqk7eqqERwfbqDwPTDb8EQIRGf+OvtKwFmo= 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=X9ONJ5iwxqhGFrUuCbFolneFlZ+0u7GyKc/W4yO3NuPCCR0/2Dy2ShPzB4ch64CzKY PIvTUtQuttT59HxuQs9AJgI/BCH+esLn0MAn46/HYD8ao2ITJMOMHXm5ASN/08vh1m5c E6eAWU8uEq9LoX8gdRh64GubCR9+mVsygy76M= Original-Received: by 10.224.2.75 with SMTP id 11mr6984906qai.3.1242687620361; Mon, 18 May 2009 16:00:20 -0700 (PDT) Original-Received: from SCARLETT.PSY.CMU.EDU (SCARLETT.PSY.CMU.EDU [128.2.249.106]) by mx.google.com with ESMTPS id 7sm343490qwb.46.2009.05.18.16.00.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 18 May 2009 16:00:19 -0700 (PDT) In-Reply-To: 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 19:12:06 -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:27995 Archived-At: --Apple-Mail-36-239929134 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On May 18, 2009, at 4:12 PM, Stefan Monnier wrote: >> Precisely for this reason is the patch not sufficient. > > I do not understand. > >> 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. > > Could you explain concretely why it's a problem. Well, if you have only hidden frames this way, you will receive no key events: (progn (make-frame-invisible (selected-frame) t) (make-frame) (delete-frame (selected-frame) t)) The Lisp level doesn't even see menu events. A little more investigation shows that we get the event in keyDown:, but we discard it in this code: if (![[self window] isKeyWindow]) { /* XXX: There is an occasional condition in which, when Emacs display updates a different frame from the current one, and temporarily selects it, then processes some interrupt-driven input (dispnew.c:3878), OS will send the event to the correct NSWindow, but for some reason that window has its first responder set to the NSView most recently updated (I guess), which is not the correct one. */ if ([[theEvent window] isKindOfClass: [EmacsWindow class]]) [(EmacsView *)[[theEvent window] delegate] keyDown: theEvent]; return; } The outer if condition is true, presumably for the weird reason stated in the comment. The inner if condition is false, so the event doesn't get passed on, and we just discard it. Sticking the "return" into the inner if helps. Of course I'm not so sure if that is the right fix. Even with this workaround/fix, now we're back to the other problem with this bit of code: (progn (make-frame-invisible (selected-frame) t) (make-frame) (delete-frame (selected-frame) t) (make-frame) (sit-for 0) (delete-frame (selected-frame) t)) This will leave a frame visible, i.e. in the last `delete-frame', the frame is deleted, but the other one is made visible. That happens because the FRAME_VISIBLE_P check in do_switch_frame does not return nil for frames that are actually supposed to be hidden. It shouldn't do that... f->visible and f->async_visible are both 1, even at the beginning of do_switch_frame. I don't understand why. Note that this does NOT happen if you run it without the `sit-for' call, e.g. in a single `progn' form. Ideas? --Apple-Mail-36-239929134 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIFxDCCAn0w ggHmoAMCAQICED6shx13jEDrq0eL8FRq5ykwDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA4MTIwOTAyMDgwMVoXDTA5MTIwOTAyMDgw MVowYjEQMA4GA1UEBBMHUmVpdHRlcjEOMAwGA1UEKhMFRGF2aWQxFjAUBgNVBAMTDURhdmlkIFJl aXR0ZXIxJjAkBgkqhkiG9w0BCQEWF2RhdmlkLnJlaXR0ZXJAZ21haWwuY29tMIGfMA0GCSqGSIb3 DQEBAQUAA4GNADCBiQKBgQDOdo6kAwlkBxUb8dj4saMbYg4SVng8CUePFn3cjjWrakBTbUVa4Z0n wlUxr7AitEeKhBy5nGhu96+jKUPrCwYNRCZ0l2ovvuGq4z1m1nZ5/c8WvFlVhieuxXMUfmb/O7D3 IojoX6iS8n5MNNU2IWNNT/AD3vOl6DKgOtOw4J9y+QIDAQABozQwMjAiBgNVHREEGzAZgRdkYXZp ZC5yZWl0dGVyQGdtYWlsLmNvbTAMBgNVHRMBAf8EAjAAMA0GCSqGSIb3DQEBBQUAA4GBAIjI8yEW wkiEfA9PMgpjnD6KyCXT0iZjHhW2PkR53yZZLUoTboHnKgsFwYp/gzzIL8J5cvZaRUyMUzXDufPP dRmxxCs2jXXLDD/8bvdvOuMzqgYoFA73fAfsC8S6qUL1PayZ90J8CZHNhDwqWqOA56T+DdKUegJT sqoHKh6OnypTMIIDPzCCAqigAwIBAgIB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