-
Notifications
You must be signed in to change notification settings - Fork 111
[WIP] Cleanup and refactor resource scale API #793
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
base: master
Are you sure you want to change the base?
[WIP] Cleanup and refactor resource scale API #793
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.
|
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. |
|
I'm available to help with migrations on spices if needed. |
|
@anaximeno this would be pretty cool, since I have a very poor knowledge of JS |
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