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

Slideshow Image Loading Improvements #241

Closed
1 of 2 tasks
Qwerty-Space opened this issue Sep 16, 2021 · 1 comment · Fixed by #242
Closed
1 of 2 tasks

Slideshow Image Loading Improvements #241

Qwerty-Space opened this issue Sep 16, 2021 · 1 comment · Fixed by #242

Comments

@Qwerty-Space
Copy link

Qwerty-Space commented Sep 16, 2021

This issue is a....

  • Bug
  • Other kind of issue (Please describe in detail)

Current Behavior

Multiple images are loaded at runtime when using the slideshow feature

Desired Behavior

Load additional images after runtime, as needed. Perhaps implementing a --slideshow-cache argument for pre-loading a few ahead. Must bear in mind discarding used images if the cache is the same size as the entire folder.

@JezerM
Copy link

JezerM commented Sep 16, 2021

Ok, there's a solution to this, currently implemented in my PR, #235.

image_path = NULL;
update_arguments(argc, argv, longopts, optstring, true);

if (image_path != NULL) {
    if (!is_directory(image_path)) {
        pthread_mutex_lock(&redraw_mutex);
        img = load_image(image_path, image_raw_format);
        pthread_mutex_unlock(&redraw_mutex);
    }
    free(image_path);
}
free(image_raw_format);

Here, when you send a --image path_to_some_image message to the API, this will load the image as it is right now. If you send it again, the image will be loaded as it is right now, not as it was before. So, replacing the current array with something like this should solve this "static" problem.

Also, doing this at short intervals is dangerous, laggy and could crash; that's why I didn't go with this idea before, but an advice should be enough.

Raymo111 added a commit to JezerM/i3lock-color that referenced this issue Jan 10, 2022
Raymo111 added a commit that referenced this issue Jan 10, 2022
* Slideshow images are now loaded when needed

* Required slideshow images are loaded randomly as well

Co-authored-by: Raymond Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants