yambar/particles
Daniel Eklöf 15ed0e043b
particle/string: don’t thrash the text-run cache
a5bbf0b769 introduced text-run
shaping.

Do avoid having to re-shape non-changing strings every time the bar is
refreshed, the *particle* (i.e. not the exposable) caches the last
shaped text-run.

Then, in expose(), it then assumes that that cached text-run is
the *same* text-run as returned from begin_expose().

This is true in most cases, but *not* when a single particle is
re-used to instantiate multiple exposables, as is commonly done by
modules generating dynlists. For example, the i3/sway module.

This fixes it, by making the cache growable, and by adding a “lock” to
each cache entry.

The lock is set in begin_expose(), to indicate that this particular
cache entry is needed in expose().

If we can’t find a matching cache entry, we first try to find a free
“slot” by searching for either unused, or used-but-not-locked cache
entries.

If that fails, we grow the cache and add a new entry.

In expose(), we unset the lock.

Closes #47
2021-05-25 21:36:14 +02:00
..
dynlist.c cairo: replace cairo with pixman in decos, particles and modules 2019-09-22 01:56:58 +02:00
dynlist.h particle/dynlist: link particle-sdk PRIVATE:ly 2019-01-13 21:45:49 +01:00
empty.c cairo: replace cairo with pixman in decos, particles and modules 2019-09-22 01:56:58 +02:00
list.c particle/list: assert sub particles where instantiated correctly 2020-11-25 20:41:09 +01:00
map.c particle/map: don’t return NULL from instantiate() 2020-11-25 20:41:09 +01:00
meson.build meson: particles: data-driven foreach loop, and link map against dynlist 2020-11-25 20:41:09 +01:00
progress-bar.c particle/progress-bar: handle tag_for_name() failing 2020-11-25 20:41:10 +01:00
ramp.c particle/ramp: clamp min/max/value 2021-04-22 11:44:09 +02:00
string.c particle/string: don’t thrash the text-run cache 2021-05-25 21:36:14 +02:00