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

Pause Rendering #7

Open
shakna-israel opened this issue Aug 3, 2020 · 2 comments
Open

Pause Rendering #7

shakna-israel opened this issue Aug 3, 2020 · 2 comments

Comments

@shakna-israel
Copy link

Would it be possible to use SDL_WINDOWEVENT_HIDDEN and SDL_WINDOWEVENT_EXPOSED/SDL_WINDOWEVENT_SHOWN to pause rendering when the background isn't in view, and so save same cycles/battery?

I think it might work during the poll loop watching for the quit event, at a glance.

@glouw
Copy link
Owner

glouw commented Aug 5, 2020

I had a look, but not much luck. Seems like the background is always visible according to SDL2

@Theldus
Copy link

Theldus commented Feb 8, 2022

Hi,
Maybe you can take a similar approach to what Anipaper does: instead of dealing with SDL2 for this, use X11:

From time to time (in a separate thread or not), get the position of all non-minimized windows and calculate the area (with overlap, the Line Sweep algorithm does this) of all of them: if the occupied area reaches a certain threshold (say, 70% of the entire screen), the program pauses, otherwise resumes execution.

The main idea is that if the wallpaper is only partially visible (either through multiple windows covering the screen or through a full-screen window), the wallpaper does not need to be animated.

You can check the polling thread here and the calculation of the area used here.


Sorry to bother you on a relatively old issue, but I like paperview a lot, so I feel obligated to say something when I have something to contribute.

Anyway, paperview's performance is already amazing as it is, so I don't know if it's worth adding more complexity to the code.

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

No branches or pull requests

3 participants