Subject: bug#24091: 24.5; High CPU usage at startup while hidden

From: Ken Raeburn <[email-masked]>
Date: Mon, 16 Jan 2017 18:36:05 -0500

On Jan 14, 2017, at 02:52, Eli Zaretskii <[email-masked]> wrote:

>> From: [email-masked]
>> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],  [email-masked],  [email-masked]
>> Date: Fri, 13 Jan 2017 20:38:02 -0500
>> 
>> We left things inconclusive, but revisiting this now, I see no reason
>> against simply removing this waiting loop:
> 
> Are you saying that the loop has no purpose at all?  If it does, what
> will happen with the code which needs that loop?  E.g., AFAIK some
> stuff is impossible to do without the frame actually being shown on
> display.
> 
> But maybe I'm wrong.  Ken, can you comment on this, please?

As I understand it, from the function’s comments and stuff I’ve read so far about the X11 and window manager protocols, the function already cannot guarantee that the window is visible when it returns, it can only request of the window manager that it make the window visible, which may or may not happen soon.  In that sense, I think Noam’s right and we could just discard the loop.

On the other hand, there are probably environments and situations (depending on the use of virtual desktops, choice of window manager, etc) where the current code does, in fact, wait for the window to appear, and won’t any more if we remove the loop.  Given that we should redraw things on expose events anyway, I’m not sure it'll matter, unless someone’s following up a call to make-frame-visible with some other action that needs to be delayed until after the window is actually visible.  I think it’s probably worth trying it to see if any differences are noticed under any of the environments people are using.

Ken