Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window flickering during resize #7898

Open
friedrich opened this issue Apr 8, 2024 · 3 comments
Open

Window flickering during resize #7898

friedrich opened this issue Apr 8, 2024 · 3 comments

Comments

@friedrich
Copy link

The client area of the window intermittently becomes transparent during resize, which causes flickering. See video. Possibly related to #969.

Untitled.mov

I explored some ways to fix the problem, but am uncertain on how to proceed. Any one of the following code changes fixes or strongly reduces flickering:

  • Enable vsync by removing the call to surface.set_swap_interval in alacritty/src/display/mod.rs
  • Sleep for 10 ms right after the call to self.surface.resize in alacritty/src/display/mod.rs
  • Call window_context.draw during WinitEvent::AboutToWait instead of WindowEvent::RedrawRequested in alacritty/src/event.rs

Changing .with_transparent(true) to .with_transparent(false) in alacritty/src/display/window.rs helps a bit, since the window does not become transparent, bit it still flickers, exposing the system window color instead.

System

OS: macOS 14.4.1
Version: alacritty 0.13.2 (bb8ea18), alacritty 0.14.0-dev (d4f2f85)

@kchibisov
Copy link
Member

Is example from https://github.com/rust-windowing/winit flickers? Also, is example from github.com/rust-windowing/glutin/ flickers?

@friedrich
Copy link
Author

No, they don't. The problem seems to be related to glutin, but the glutin example has vsync enabled and also renders in AboutToWait.

If I change the glutin example such that vsync is disabled and if I move the render call to RedrawRequested, it flickers exactly like alacritty does.

@kchibisov
Copy link
Member

I feel like it's a macOS sync issue or something like that. Because the RedrawRequested is essentially a drawRect during resize, well, more or less, so if it flickers it could be some sync issue on apple side?

And with e.g. AboutToWait it's when events are cleared, thus it likely stretches the content because the resize is not issued at the drawRect, but then we submit the right buffer so it looks ok-ish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants