[WIP] Cleanup and refactor resource scale API#793
Draft
Sunderland93 wants to merge 6 commits intolinuxmint:masterfrom
Draft
[WIP] Cleanup and refactor resource scale API#793Sunderland93 wants to merge 6 commits intolinuxmint:masterfrom
Sunderland93 wants to merge 6 commits intolinuxmint:masterfrom
Conversation
This commit removes the DELEGATE_LAYOUT and the ABSOLUTE_ORIGIN_CHANGED allocation flags from Clutter, replacing the latter one with an internal boolean that's more useful and won't get in the way of optimizations and bugfixes. Since that leaves no more allocation flags, those are removed entirely, which also leaves no reason to keep the "allocation-changed" signal, so remove that, too.
Fix some issues with allocations and add an optimization to bail out of allocation cycles if only the absolute origin changed (we can do this because now we no longer need to notify all actors about the absolute origin change using the allocation flag).
For ClutterClones we need to apply a scale to the texture of the clone to ensure the painted texture of the source actor actually fits the allocation of the clone. We're doing this using the transformation matrix instead of using the scale_x/scale_y properties of ClutterActor to allow users to scale ClutterClones using that API independently. Now it's quite a bad idea to get the allocation boxes for calculating that scale using clutter_actor_get_allocation_box(), since that method will internally do an immediate relayout of the stage in case the actor isn't allocated. Another side effect of that approach is that it makes it impossible to invalidate the transform (which is needed for the next commit when we start caching those matrices) properly. So since we eventually allocate both the source actor and the clone ourselves anyway, we can simply use the allocation box inside clutter_clone_allocate() (which is definitely updated and valid at that point) to calculate the scale factor.
Add a clutter_actor_peek_stage_views() method and a stage-views-changed signal to ClutterActor. This doesn't invalidate the stage-views list on changes to the transformation of the actors yet, for that we need another new ClutterActor method to invalidate the custom transformations applied via the apply_transform() vfunc. Also things will get quite a bit more expensive when doing that (the transformation matrix will have to be put together more often), so we probably also want the caching of transformation matrices in place when we start doing that.
This commit changes the resource scale API to be based on ClutterActors new stage-views list. It also introduces proper support for actors like ClutterText where the allocation depends on the resource-scale, which allows getting the size and position perfect on the first frame.
Member
|
I remember when I did my big mutter/muffin refactor around 5.4 I stopped at the version I stopped at (3.36.* I think?) because I would have had to break a lot of third-party spices. I think because of allocate/paint arguments. I don't want to avoid doing what we need to here - I stopped short before because there were already many changes and I needed a cutoff point. But just beware of the impact these changes may have in cinnamon-spices-* repos also. In the past I made a list of impacted spices so I could raise awareness when I had to mass-break something. |
This was referenced Feb 8, 2026
|
I'm available to help with migrations on spices if needed. |
Contributor
Author
|
@anaximeno this would be pretty cool, since I have a very poor knowledge of JS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See individual commit messages
This is the preparation for https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285 which is needed to drive each output on it's own refresh rate.
It's also improves performance and quality on HiDPI displays.
Cinnamon part: linuxmint/cinnamon#13542
Cinnamon-Spices-Applets: linuxmint/cinnamon-spices-applets#8293