Subject: Re: bug#3303: delete-frame raises old (invisible) frame

From: Stefan Monnier <[email-masked]>
Date: Mon, 18 May 2009 16:12:32 -0400

>>> [ 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.

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.

        Stefan

PS: Another problem I see is that I don't think raise-frame should make
an invisible frame visible.  It's right for iconified frames, but
I don't think it's right for invisible frames.  I.e. a patch like the
one below might be a good change (not for 23.1, tho, obviously).

=== modified file 'src/frame.c'
--- src/frame.c	2009-05-05 14:50:29 +0000
+++ src/frame.c	2009-05-18 20:09:22 +0000
@@ -2020,7 +2020,7 @@
   if (FRAME_TERMCAP_P (f))
     /* On a text-only terminal select FRAME.  */
     Fselect_frame (frame, Qnil);
-  else
+  else if (FRAME_ICONIFIED_P (f))
     /* Do like the documentation says. */
     Fmake_frame_visible (frame);