Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Improve speed of repaint on focus/unfocus #335

Merged
merged 8 commits into from
Mar 11, 2021

Conversation

IBBoard
Copy link
Owner

@IBBoard IBBoard commented Mar 11, 2021

GTK invalidates all GTK/CSS nodes when unfocusing refocusing. This is made worse by stacks, which are available (and invalidated) even when not the top item in the stack.

By dropping stacks and doing some other shuffles instead we seem to improve performance.

IBBoard added 8 commits March 6, 2021 19:43
This mainly loses the cross-fade animation, but makes it feel snappier.

We also have a minor bug where resizing while actions are visible
can't track the grid height, but who activates actions on a tweet and
*then* resizes the window? It all fixes itself after they toggle back
to the tweet.
Part of the slow-down is because GTK invalidates and recalculates ALL
of the widgets in the stack. But if we hide them then it doesn't need
to do that. So when the transition ends, hide all widgets we're not
showing.

Currently seems to behave the same, but with faster focus switching.
If the actions can't know the right height as we resize then the only
option is to stop showing the actions as we resize!
This is the harshest version of removing pages when we're not using
them. We only keep extra pages in the stack until we're done with them.
But the pages are still created and keep state, so they don't lose
positions etc

Also now pass the main window around so that we don't assume a
base/parent when it might not be set.

This won't work as-is with the libhandy redesign (because we need to
keep all of the main tabs as children so we populate the switcher).
Apparently GTK is "smart" and doesn't do the transitions if it doesn't
need to. This means that it spots our "add the impostor, change to it,
and then swap back" shuffle. BUT if we always had the impostor then
it (silently) swaps to the impostor and then happily transitions.
Although we call `show()`, GTK hasn't *actually* shown it yet, so it
can't grab focus. But it tries. Which kicks us to the top of the feed!

We now `connect_after` on size allocation (which happens when
the widget is shown) to wait until we're done.
Size allocate only happens once if the action box is shown, hidden and
shown again, so we need to hook on to other events.

Always pushing focus to the TweetListEntry and then moving it to the
RT button when necessary seems to work.
@IBBoard IBBoard merged commit 2077ede into master Mar 11, 2021
@IBBoard IBBoard deleted the bug204-slow-focus-painting-alt-alt branch March 11, 2021 19:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant