Skip to content

Re-render CImageElements on fitMode change#96

Merged
vaxerski merged 2 commits into
hyprwm:mainfrom
Vruk11:main
Jun 23, 2026
Merged

Re-render CImageElements on fitMode change#96
vaxerski merged 2 commits into
hyprwm:mainfrom
Vruk11:main

Conversation

@Vruk11

@Vruk11 Vruk11 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

When calling to set a Hyprpaper wallpaper with Hyprctl using the same image path but a different fit_mode value for two monitors one after the other, it eventually fails because of a lack of a check in CImageElement for cached assets.
This PR attempts to fix that by simply comparing the fitMode values to decide if the asset should be reused or instead rerendered.

I'm sorry if this is not correct fully, the correct solution to the overall problem, or up to a standard for this library since I don't know it well at all.

the cached texture bakes in the fit mode, but the cache key was just the path
(plus the svg/icon size), so two image elements sharing a path with different
fit modes collided on one cache entry and the second drew with the first's fit.
shows up with hyprpaper putting one image on two monitors with different fit_mode.

this keys on the fit mode instead of guarding the cache hit, so get() returns the
right entry and the in-flight dedup for elements sharing path and fit mode stays.
the original if (ASSET) path is restored. adds a unit test.
@UncleJ4ck

UncleJ4ck commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@Vruk11 your repro found this. pushed a cache-key version to UncleJ4ck:fold-into-96 that keys the cache string on the fit mode and keeps your original if (ASSET). if you want it in this PR, add my fork as a remote and merge that branch into yours.

@Vruk11

Vruk11 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@UncleJ4ck Thank you, merged your branch as suggested.

@vaxerski vaxerski merged commit 7d2bfc2 into hyprwm:main Jun 23, 2026
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants