Subject: Re: bug#48413: 28.0.50; emacs does not repaint the window after switching workspaces in Xmonad

From: martin rudalics <[email-masked]>
Date: Fri, 14 May 2021 17:56:41 +0200

>> Can you please try the attached patch and tell me whether it improves or
 >> breaks things.
 >
 > Yes, it fixes things - frame is repainted correctly now.
 >
 > My attempt was similar, but I included more code alongside SET_FRAME_VISIBLE (same as in Expose handler):
 >
 > +              block_input ();
 > +             SET_FRAME_VISIBLE (f, 1);
 > +             if (FRAME_X_DOUBLE_BUFFERED_P (f))
 > +                font_drop_xrender_surfaces (f);
 > +              f->output_data.x->has_been_visible = true;
 > +              SET_FRAME_GARBAGED (f);
 > +              unblock_input ();
 >
 > I'm not very familiar with Emacs frame internals - we don't need all these here?

If I only knew.  If you come up with a patch that works OK for you and
does not break the

(defvar frame (make-frame))
(make-frame-invisible frame)
(frame-visible-p frame)

scenario (where the latter returns 'icon) I want to fix here, I'll
happily install that.

 >> Relying on these for setting visibility will fail for anyone who doesn't
 >> send us an Expose event.
 >
 > I agree, feels a little fragile.

It apparently has not bitten us so far but the Xlib manual is not very
clear in this regard.

martin