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

Add style transition API #539

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

Add style transition API #539

wants to merge 25 commits into from

Conversation

donadigo
Copy link
Contributor

@donadigo donadigo commented May 18, 2019

Adds a new method to the DBus API called transition_from_snapshot for apps (and primarily the switchboard plug) to be able to create a smooth stylesheet transition. The transition will not happen when animations are disabled but the snapshot will still be created and added (that is it will stay for 200ms and hide without any animations).

The code should be quite optimized for the task, I previously used a simple Cogl.Texture.get_data for creating a static texture but it turned out to be quite long to execute: transferring pixel data from GPU to CPU took ~15ms on my machine which is little bit above 60FPS but there were longer runs that caused visible lag when creating textures for maximized windows. We now copy the texture directly on the GPU which takes about ~2ms.

Update: the code has been updated to Cogl2 and to automatically transition when the style changes, however there still seems to be the problem of some elements flickering while transitioning. I think this is a matter of timing things correctly.

@danirabbit danirabbit added this to In progress in Prefer Dark Style via automation May 18, 2019
@danirabbit
Copy link
Member

danirabbit commented May 18, 2019

I guess an obvious question is, what about Wayland? Do we get window IDs like this once we move away from X?

I think we should also think about the abuse perspective. I'm not sure it's a good idea to have the API endpoint be the same for an app to request the transition of any window it can guess the ID of and for the whole desktop to be affected when no argument is supplied. An App should probably only be able to effect itself

@donadigo
Copy link
Contributor Author

donadigo commented May 18, 2019

  1. No one knows. See Wayland: design window communication API #68. I'm not sure if mutter will do anything about this but it seems like there's no standard for those things either. I also don't know how mutter on wayland handles window ID's.

  2. We can optionally move part of the current method and get the PID of who's calling it and create the effect for windows based on PID.

@donadigo
Copy link
Contributor Author

@danrabbit updated.

@cassidyjames
Copy link
Contributor

cassidyjames commented Jan 24, 2020

Does this need to be an external API at all? Can't Gala just listen to the setting and do this transition automatically? Edit: I guess the use of an API is that each app could request this whenever, i.e. Code could request it when changing its style?

@donadigo
Copy link
Contributor Author

@cassidyjames yeah that and if gala listened to that setting you have to account for the fact that the signal could fire later than the theme change, causing a jarring flick before the actual transition. That's why it's safer to have the app call before actually changing the setting. If we had a Gtk fork / patch then perhaps that would be possible to do automatically.

@donadigo
Copy link
Contributor Author

Branch updated to use the newest Cogl2 API and updated to master.

@donadigo
Copy link
Contributor Author

Ready for review again.

@danirabbit
Copy link
Member

Hm, I can't really see that this smooths anything out for me. Is there something I need to do other than install this branch and restart my session?

@donadigo
Copy link
Contributor Author

donadigo commented Dec 3, 2020

@danrabbit hm, that's weird. Installing the branch & restarting should be enough. Is the transition like instant, or do you see at least some trace of the animation?

src/DBus.vala Outdated Show resolved Hide resolved
@cassidyjames
Copy link
Contributor

cassidyjames commented Jul 17, 2021

@donadigo would it be possible to resolve conflicts here? I'm not sure why we weren't seeing it work in the past, but now that we have all the other dark style bits merged in, it's working for me. This would be an incredibly nice effect.

@cassidyjames cassidyjames requested a review from a team July 20, 2021 20:11
Prefer Dark Style automation moved this from In progress to Needs Review Jul 25, 2021
Copy link
Member

@JoseExposito JoseExposito left a comment

Choose a reason for hiding this comment

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

I didn't notice there was a PR open with this functionality, definitely something really cool to have!
It's most likely something related to my set up, but I'm seeing some noise in the panel and shadows:

gala.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Prefer Dark Style
  
Needs Review
Development

Successfully merging this pull request may close these issues.

None yet

6 participants