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

ShadowEffect: Delay cache drop for switching shadow sizes performance improvements #2061

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

Conversation

leolost2605
Copy link
Member

@leolost2605 leolost2605 commented Sep 19, 2024

Fixes #2060

Idk if this is a good and/or common way to do this but it should work 🤷

The reasoning here is that during the workspace switch animation the actor width and/or height often changes by one pixel back and forth. This would cause the shadow to be dropped and created again multiple times during a switch. By keeping them in the cache for 5 seconds before dropping them we can avoid this. While a second or so would be enough for a single switch the whole feel is a lot smoother when trying to switch over multiple workspaces in one go.

@leolost2605 leolost2605 requested a review from a team September 19, 2024 21:57
}

private static void queue_shadow_drop (string key) {
shadows_marked_for_dropping[key] = Timeout.add_seconds (5, () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
shadows_marked_for_dropping[key] = Timeout.add_seconds (5, () => {
shadows_marked_for_dropping[key] = Timeout.add_seconds_once (5, () => {

Copy link
Member Author

@leolost2605 leolost2605 Oct 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The *_once functions unfortunately do not get the data refd by vala (because they have no destroy notify) and since vala unrefs it and it's also not used anywhere else, it gets immediately freed. This causes a crash when the timeout runs.

@leolost2605 leolost2605 changed the title ShadwoEffect: Delay cache drop for switching shadow sizes performance improvements ShadowEffect: Delay cache drop for switching shadow sizes performance improvements Oct 13, 2024
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.

Gala.ShadowEffect has performance issues
2 participants