Subject: bug#30699: 26.0.91; buffer contents flicker on macOS frames when frames are resized

From: Alan Third <[email-masked]>
Date: Tue, 6 Mar 2018 22:55:02 +0000

On Mon, Mar 05, 2018 at 09:53:37PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 5 Mar 2018 19:23:31 +0000
> > From: Alan Third <[email-masked]>
> > Cc: Aaron Jensen <[email-masked]>, [email-masked]
> > 
> > > We already have double-buffering on X, perhaps it can be implemented
> > > on macOS as well.
> > 
> > We could do something similar using NSDisableScreenUpdates and
> > NSEnableScreenUpdates:
> > 
> > https://developer.apple.com/documentation/appkit/1473676-nsdisablescreenupdates?language=objc
> > 
> > We should be able to wrap it round redisplay. Where would that be
> > done?
> 
> I don't think I understand the meaning of "wrap it round redisplay" to
> answer that.  Is the feature you mention significantly different from
> what we use for double-buffering on X?  If not, you can use the same
> model.

I don’t know how we handle double buffering on X, but if it’s anything
like my previous experiences of double buffering, this is different.

NS already uses double buffering, the issue here is that we want the
screen blank and subsequent drawing of the frame to appear as one
atomic action, but right now we see them as two actions.

In theory if you call NSDisableScreenUpdates before the blanking of
the frame, then call NSEnableScreenUpdates after drawing the contents
of the frame, both should appear as one action (we don’t see the blank
frame at all).

I’ve tried adding calls to NSDisableScreenUpdates and
NSEnableScreenUpdates in redisplay_internal, just to see if it works,
but I couldn’t get it to work at all: I always saw the blanked frame.
Either these functions don’t work as advertised or there’s something
else going on. It’s quite probable I’ve misunderstood
redisplay_internal.
-- 
Alan Third