GNU bug report logs - #3303
delete-frame raises old (invisible) frame

Previous Next

Packages: emacs, ns;

Reported by: David Reitter <david.reitter <at> gmail.com>

Date: Sat, 16 May 2009 01:15:04 UTC

Severity: normal

Merged with 3204

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: David Reitter <david.reitter <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Adrian Robert <adrian.b.robert <at> gmail.com>, 3303 <at> debbugs.gnu.org
Subject: bug#3303: delete-frame raises old (invisible) frame
Date: Mon, 18 May 2009 19:00:17 -0400
[Message part 1 (text/plain, inline)]
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?
[smime.p7s (application/pkcs7-signature, attachment)]

This bug report was last modified 13 years and 288 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.