Commit graph

32 commits

Author SHA1 Message Date
Daniel Eklöf
f9dad99db8
particle/ramp: clamp min/max/value
Make sure that:

* min <= max
* min <= value <= max

Fixes a crash when the tag’s value was out-of-bounds.

Closes #45
2021-04-22 11:44:09 +02:00
Daniel Eklöf
31c015c680
particle/ramp: handle tag_for_name() failing 2020-11-25 20:41:10 +01:00
Daniel Eklöf
44db9304c5
particle/ramp: assert sub particles where instantiated correctly 2020-11-25 20:41:09 +01:00
Daniel Eklöf
c11fee4ce3
cairo: replace cairo with pixman in decos, particles and modules
All decoration, particle and module interfaces now takes a
pixman_image_t parameter, and all drawing is done using pixman APIs.

The wayland/xcb backends implement a new interface functions,
get_pixman_image(), that should return a pixman image instance that is
suitable for rendering.

In the wayland backend, the image uses the same backing data as the
cairo surface.

In the XCB backend, we create a new image each time, and then blit it
to the cairo surface at commit time.
2019-09-22 01:56:58 +02:00
Daniel Eklöf
95385863ae
particle: remove cairo context from begin_expose() 2019-09-22 00:55:06 +02:00
Daniel Eklöf
ea38ab3b2f particle/module: pass a cairo context to all begin_expose() 2019-02-28 20:10:26 +01:00
Daniel Eklöf
6bba9200cf particles: use calloc() instead of malloc()
In cases where it makes sense, use calloc() instead of malloc():

* When allocating large objects with many members, many for which
  NULL/0 is a good default value.
* Arrays etc where we explicitly initialize to NULL anyway.
2019-02-09 11:05:12 +01:00
Daniel Eklöf
452c4b6015 plugins: export a const function pointer interface struct 2019-01-26 18:32:04 +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
0d591fe5a1 allow plugins to be compiled into the f00bar main binary 2019-01-14 20:57:03 +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
71515e4079 config: conf_verify_dict() now assumes attr list is NULL-terminated 2019-01-13 11:37:05 +01:00
Daniel Eklöf
47018104da particles: compile as shared libraries (plugins) 2019-01-13 11:13:47 +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
558f75a54b module/particle: remove cairo context from begin_expose() 2019-01-09 18:50:26 +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
22507ae26c particle: add utility function to render a particle's decoration 2018-12-29 21:00:03 +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
5164d1d6ea particle: add an 'on_click_template' to base constructor.
This is intended to be a format-like string, with the possibility to
use tag formatters.

The expanded string will later be passed to the system() call.
2018-12-29 14:36:18 +01:00
Daniel Eklöf
ce85ccda56 particle/ramp: call particle_default_destroy() 2018-12-26 21:35:24 +01:00
Daniel Eklöf
052513c736 particle/ramp: don't use floating point arithmetic 2018-12-26 12:44:26 +01:00
Daniel Eklöf
a588c78e57 particle/ramp: use log framework 2018-12-18 19:37:37 +01:00
Daniel Eklöf
a9681dd19c cleanup 2018-12-16 17:08:38 +01:00
Daniel Eklöf
47b36bdd35 particle/ramp: new particle, selects one particle from a list
The ramp particle is configured with a tag name and a list of
particles.

At instantiation time, a single particle is selected from the list,
depending on the tag value and it's minimum and maximum values.

I.e. this particle acts kind of like a progress bar.
2018-12-16 16:20:45 +01:00