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

Minimizing new window flickering while painting #1134

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

araujoarthur0
Copy link
Collaborator

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
flicker

After
flicker2

How will this be tested?

Tests were modified to listen for the event as well, making sure it is sent and works.

@araujoarthur0
Copy link
Collaborator Author

May have to add some extra sync mechanisms in the failing test

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

Successfully merging this pull request may close these issues.

Windows flicker when opening
1 participant