Commit graph

21 commits

Author SHA1 Message Date
Daniel Eklöf
d0360f2de1
particle: reset signals and signal mask when executing an on-click handler 2020-11-25 20:41:09 +01:00
Daniel Eklöf
03a5c8746f
fcft: adjust to fcft-2.0 API changes
* font_*() -> fcft_*()
* struct font -> struct fcft_font
* struct glyph -> struct fcft_glyph
* enum subpixel_order -> enum fcft_subpixel
2020-04-22 11:50:29 +02:00
Daniel Eklöf
288428ca22
particle: add missing argument to debug log 2019-09-23 18:34:23 +02:00
Daniel Eklöf
384e9d0849
particle: add on-click handler to debug log message 2019-09-23 18:33:57 +02: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
48da200924 particle: ignore write() return value
We're in a subprocess about to exit anyway, with stdout/stderr
typically closed. We can't do anything but ignore write() failures.

Fixes building with -D_FORTIFY_SOURCE=2
2019-05-04 11:26:58 +02:00
Daniel Eklöf
bec50782b8 particle: improve error handling in on-click handler
* Make sure to _exit() in all forked code paths that doesn't end in a
  successful exec()
* Report errno to parent process on failure so that we can log it

The second point is implemented by a) manually double forking instead
of calling daemon(), and b) using a pipe in the inner fork to be able
to wait for the child process to either succeed in its exec() call, or
write errno to the pipe on failure.

This fixes hangs and crashes when e.g. the binary we're trying to
execute doesn't exist.
2019-04-23 19:02:21 +02:00
Daniel Eklöf
2123956b14 particle: refactor command line tokenization 2019-03-07 21:31:30 +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
ae5029826b cmake: break out bar stuff to separate CMakeLists.txt 2019-02-07 12:06:16 +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
22507ae26c particle: add utility function to render a particle's decoration 2018-12-29 21:00:03 +01:00
Daniel Eklöf
ed86061532 particle: refactor 2018-12-29 17:04:39 +01:00
Daniel Eklöf
620017860e particle: handle ON_MOUSE_CLICK
If a particle has an on-click handler, execute it when we receive an
ON_MOUSE_CLICK event.

This is done by first tokenizing the command string. We currently
handle one level of quotes, but no escape characters.

Then, fork(). Main process waits for child to finish. Child daemonizes
and then execvp() the tokenized argument vector.
2018-12-29 16:24:22 +01:00
Daniel Eklöf
cecab625ac particle: implement a default on_mouse handler
Which changes the cursor to a hand when there's a non-NULL on-click
handler.
2018-12-29 14:40:45 +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
e8d8bf70d3 exposable: add a "common" constructor and default destructor 2018-12-29 12:51:31 +01:00
Daniel Eklöf
4d173326e4 particle: remove 'parent' (it wasn't used anyway) 2018-12-29 12:49:00 +01:00
Daniel Eklöf
1427d6a98b particle: provide a default destroy() function
This allows us to destroy the associated decoration.
2018-12-26 21:34:19 +01:00
Daniel Eklöf
f65a18b655 particle: initialize 'deco' member to NULL
Fixes valgrind warnings about uninitialized variable. This happened
for every particle that did *not* have a decoration.
2018-12-26 21:33:35 +01:00
Daniel Eklöf
8bf8a398b9 initial commit: wip 2018-11-17 11:30:33 +01:00