-
Notifications
You must be signed in to change notification settings - Fork 277
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
Minimizing new window flickering while painting #1134
Conversation
May have to add some extra sync mechanisms in the failing test |
82d55fc
to
b956805
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is passing, but there are several logs, so I'm assuming you're still going to clean it up
62e7e9f
to
acd40d3
Compare
98e3584
to
8d63ed3
Compare
Should be clean now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, I tested it and the flickering has disappeared completely, from opening the app or any of its "side windows".
I wonder whether we can diminish the timeouts just for the tests, because they started taking ~16s over 10s, but it's not a huge deal yet, so I'll just merge this as is.
\changelog-update |
Related issue
Closes #1129
Context / Background
Whenever we open a new BrowserWindow in the app (waiver manager, preferences) it will flicker for a while with a white background while the elements show and the colors change. This happens because the window opens before it's properly painted by its javascript code.
What change is being introduced by this PR?
Introducing a custom WindowReadyToShow ipc event that the windows send when they have at least applied the window theme. The browser window creation on main waits for this event to invoke the .show() method. Not using the default 'ready-to-show' event as that still led to a flicker.
On renderer, the JS function requestAnimationFrame is used as it sort of provides a callback to run after a window has been animated/painted, and that helped synchronize things.
Electron still has a bug on windows that leads to a small flicker https://www.github.com/electron/electron/issues/42523 but I've minimized it here so that it's less of a visual bother.
Before
After
How will this be tested?
Tests were modified to listen for the event as well, making sure it is sent and works.
I had to increase the test timeout because it's taking longer to repaint the window than usual now on the CI environment.