Commit graph

81 commits

Author SHA1 Message Date
Daniel Eklöf
452c4b6015 plugins: export a const function pointer interface struct 2019-01-26 18:32:04 +01:00
Daniel Eklöf
2b3d432164 cmake: we don't *really* need 3.13 2019-01-20 13:07:38 +01:00
Daniel Eklöf
498a3e3d78 particle/string: free glyphs and clusters in destroy() 2019-01-20 10:06:17 +01:00
Daniel Eklöf
5a0d192ec1 particle/string: re-use glyphs calculated in begin_expose()
In begin_expose(), we call cairo_scaled_font_text_to_glyphs()
with (x,y) = (0,0), in order to calculate the glyph extents (needed
for width calculation).

Then, in expose(), we called it again, but with correct (x,y) offsets.

Simplify this, by caching the glyphs from begin_expose(). Then, in
expose(), simply adjust the glyph offsets before calling
cairo_show_text_glyphs().
2019-01-20 10:02:13 +01:00
Daniel Eklöf
bfa9ce9970 particle/ramp: value is *also* offsetted by the minimum value 2019-01-19 20:17:26 +01:00
Daniel Eklöf
04f7f3485f particle/string: don't cut in the middle of an utf-8 multibyte
When limiting a string (due to it exceeding it's max length), make
sure not to cut it in the middle of an utf-8 multibyte, as this
results in an invalid utf-8 string.
2019-01-17 20:44:51 +01:00
Daniel Eklöf
09270c4670 particle/string: handle conversion failures in cairo_scaled_font_text_to_glyphs()
In particular, use cairo_scaled_font_text_to_glyphs() to calculate the
extents, since the cairo_scaled_font_text_extents() will leave the
scaled font in an error state, which is impossible to recuperate from.
2019-01-17 20:18:46 +01:00
Daniel Eklöf
c868a4ac46 particle/list: disable debug 2019-01-15 19:15:57 +01:00
Daniel Eklöf
8f58e161bc particle/string: disable debug 2019-01-15 19:15:48 +01:00
Daniel Eklöf
0d591fe5a1 allow plugins to be compiled into the f00bar main binary 2019-01-14 20:57:03 +01:00
Daniel Eklöf
c6b83ac7dc particles: cmake: compact CMakeLists.txt by using foreach() 2019-01-13 21:55:42 +01:00
Daniel Eklöf
c6ce536cff particle/string: explicitly link against cairo
Because it's the right thing to do. It worked without it, since the
f00bar main binary is linked with -rdynamic (to give plugins access to
core functions).
2019-01-13 21:49:24 +01:00
Daniel Eklöf
bc9c33c187 particle/dynlist: link particle-sdk PRIVATE:ly 2019-01-13 21:45:49 +01:00
Daniel Eklöf
2f83ed1fc3 particle/dynlist: compile as a shared library 2019-01-13 21:43:56 +01:00
Daniel Eklöf
4eee71eaf4 particles: cmake: header files have been removed 2019-01-13 17:41:48 +01:00
Daniel Eklöf
4a26664d8d particles: remove config-verify.h from particle.h 2019-01-13 17:41:39 +01:00
Daniel Eklöf
07b1615a41 particles: get rid of struct particle_info
Since this struct only contained function pointers, make all particles
export those functions directly.

The plugin manager now defines a particle interface struct, and fills
it it by dlsym:ing the functions that used to be in particle_info.
2019-01-13 17:03:35 +01:00
Daniel Eklöf
74b0722d2f particles: remove header files 2019-01-13 16:49:46 +01:00
Daniel Eklöf
8dc278aaf2 config: pass a struct with inheritable values
For now, font and foreground color
2019-01-13 14:13:14 +01:00
Daniel Eklöf
7776135454 particles: caller of from_conf() must provide base particle instance 2019-01-13 13:25:14 +01:00
Daniel Eklöf
8bc6a0b783 oarticles: don't assume particle content is a dictionary
This is done by having each particle implement a top-level verifier
function.
2019-01-13 12:47:20 +01:00
Daniel Eklöf
e471c2357d cmake: set _GNU_SOURCE globally, and only once 2019-01-13 11:40:09 +01:00
Daniel Eklöf
71515e4079 config: conf_verify_dict() now assumes attr list is NULL-terminated 2019-01-13 11:37:05 +01:00
Daniel Eklöf
45280416ff modules, particles: type-specific filename prefix
Instead of naming the shared libraries libfoo.so, add a type-specific
prefix: module_foo.so, or particle_foo.so
2019-01-13 11:26:31 +01:00
Daniel Eklöf
307a1f5ec8 particles: all particles can have a decoration 2019-01-13 11:16:52 +01:00
Daniel Eklöf
311193751c particles: install target 2019-01-13 11:14:57 +01:00
Daniel Eklöf
47018104da particles: compile as shared libraries (plugins) 2019-01-13 11:13:47 +01:00
Daniel Eklöf
7b98ea2b7c particle/string: expose info through the new struct particle_info struct 2019-01-13 10:49:10 +01:00
Daniel Eklöf
9f8000b047 particle/ramp: expose info through the new struct particle_info struct 2019-01-13 10:40:47 +01:00
Daniel Eklöf
21e28315e3 particle/progress-bar: expose info through the new struct particle_info struct 2019-01-13 10:38:25 +01:00
Daniel Eklöf
73b8bf1346 particle/map: expose info through the new struct particle_info struct 2019-01-13 10:34:15 +01:00
Daniel Eklöf
6379b1939f particle/list: expose info through the new struct particle_info struct 2019-01-12 22:56:00 +01:00
Daniel Eklöf
0f8f21510a particle/empty: expose info through the new struct particle_info struct 2019-01-12 22:48:23 +01:00
Daniel Eklöf
75bdd2ad3c config: use dashes, '-', instead of underscores, '_' in attribute names 2019-01-12 10:32:52 +01:00
Daniel Eklöf
558f75a54b module/particle: remove cairo context from begin_expose() 2019-01-09 18:50:26 +01:00
Daniel Eklöf
f6977417e0 font: use font-config to load font
This allows us to a) move away from cairo's "toy" API, and b) let the
user specify font options in a single font "name" string:

  Serif:size=10:weight=bold:slant=italic

This also allows us to simplify the font code significantly (except
for the fontconfig parts...); the font no longer sets itself in a
cairo surface - font users do that; the font simply returns a
cairo_scaled_font_t.

Furthermore, font_clone() has now been simplified to basically just
refcount the scaled font. I.e. there's no need to run the full
constructor and lookup and instantiate the cairo scaled font again.
2019-01-09 18:50:16 +01:00
Daniel Eklöf
52f13dec3d dynlist: move to particles folder 2018-12-29 22:13:00 +01:00
Daniel Eklöf
86425fbe48 config: all particles now take a 'on_click_template' argument 2018-12-29 21:23:27 +01:00
Daniel Eklöf
3eebdbb5b0 particle/ramp: fix on_mouse() regression
Now that we have a wrapper exposable, we need to implement
on_mouse(). In it, we need to check if we have our own on-click
handler, or else, check if mouse is inside the sub-exposable, or in
the left- or right margin.
2018-12-29 21:18:07 +01:00
Daniel Eklöf
e4fab9a20b particle/map: fix on_mouse() regression
Now that we have a wrapper exposable, we need to implement
on_mouse(). In it, we need to check if we have our own on-click
handler, or else, check if mouse is inside the sub-exposable, or in
the left- or right margin.
2018-12-29 21:17:08 +01:00
Daniel Eklöf
22507ae26c particle: add utility function to render a particle's decoration 2018-12-29 21:00:03 +01:00
Daniel Eklöf
6f5572ff6b particle/map: implement left/right margin
This is done by wrapping the selected particle/exposable in a
ramp-specific exposable. This way, we can add the margins before
delegating begin_expose() and expose() to the selected exposable.
2018-12-29 20:54:41 +01:00
Daniel Eklöf
a3322b0a8a particle/ramp: implement left/right margin
This is done by wrapping the selected particle/exposable in a
ramp-specific exposable. This way, we can add the margins before
delegating begin_expose() and expose() to the selected exposable.
2018-12-29 20:50:23 +01:00
Daniel Eklöf
5fc29f7bbe particles: name private structs and variables consistently 2018-12-29 20:40:25 +01:00
Daniel Eklöf
3135f1d36d particle: all particles now take margin arguments
Ramp and map however, doesn't allow any values other than 0 (yet).
2018-12-29 20:33:38 +01:00
Daniel Eklöf
1f182b862e particle/progress-bar: allow user to configure an on-click handler
Since we're typically interrested in *where* (on the progress-bar) the
user clicked, we need a way to pass the clicked position to the
handler.

Normally, the on-click handler is expanded when a particle
instantiates its exposable. At this point, we (obviously) don't have
the click position.

This is solved by expanding the handler a second time, when the bar is
clicked.

Thus, the user can use the "{where}" tag in the click handler. "where"
will be expanded to a percentage value (0-100).
2018-12-29 17:36:34 +01:00
Daniel Eklöf
bd365405d7 particle/list: remove excessive debug output 2018-12-29 17:14:49 +01:00
Daniel Eklöf
7da09530b8 particle/string: tags_expand_template() now returns NULL if template is NULL 2018-12-29 17:12:11 +01:00
Daniel Eklöf
6857b99c56 particle/list: tags_expand_template() now returns NULL if template is NULL 2018-12-29 17:11:54 +01:00
Daniel Eklöf
85801a5deb particle/string: expand on_click handler before passing to exposable 2018-12-29 17:10:10 +01:00