Commit graph

40 commits

Author SHA1 Message Date
Daniel Eklöf
dff3104c85 misc: make use of the xcb-aux library 2019-01-19 18:47:34 +01:00
Daniel Eklöf
9d5bbe0566 misc: xcb_connect() always returns a non-NULL pointer
Instead, we need to check if xcb_connection_has_error() says something
went wrong. We also need to call xcb_disconnect() on the disfunctional
XCB connection object.
2019-01-19 18:45:15 +01:00
Daniel Eklöf
b195c19599 bar: remove struct bar_run_context; store abort_fd in bar struct 2019-01-16 16:38:04 +01:00
Daniel Eklöf
77f8e6fa28 xcb: xcb_error() no longer prefixes error message with "XCB: " 2019-01-16 16:27:25 +01:00
Daniel Eklöf
fae2e5cb18 xcb: add xcb_error(), a generic describe-an-x-error function
By default, generates an error message with the major/minor opcodes,
the error code and sequence number.

If available, it will use xcb-errors to generate an even better
description.
2019-01-15 20:44:21 +01:00
Daniel Eklöf
7a8ba94a49 bar: xcb-errors is optional
With it available, we get better (more descriptive) X error
messages. But it's not fatal, and we don't require it.
2019-01-15 19:26:02 +01:00
Daniel Eklöf
b62e66ccb6 bar: log X(cb) errors 2019-01-15 19:17:22 +01:00
Daniel Eklöf
33d811ae78 bar: set correct window title 2019-01-15 19:17:02 +01:00
Daniel Eklöf
76d135e257 module: remove module_run_context
Store abort_fd directly in the module struct instead. This then allows
us to pass the module pointer as-is to the modules' run functions.
2019-01-13 15:34:59 +01:00
Daniel Eklöf
acdeff3b6e module: remove ready_fd
All modules are expected to handle a call to content() after having
been instantiated.

I.e. modules *cannot* even expect run() to have started running.
2019-01-13 15:25:39 +01:00
Daniel Eklöf
825b0a16f8 module: remove module->begin_expose()
Replace with module_begin_expose()
2019-01-13 14:58:30 +01:00
Daniel Eklöf
4c577766d1 module: remove module->expose() and module->end_expose()
Bar now calls exposable->expose() and exposable->destroy() directly
2019-01-13 14:55:21 +01:00
Daniel Eklöf
33cba8b0ba module: remove module_expose_context 2019-01-13 14:52:28 +01:00
Daniel Eklöf
9276724113 module: remove 'with' from expose-context 2019-01-13 14:33:58 +01:00
Daniel Eklöf
8dfe4af76b bar: call cairo_device_finish() on the surface's device
This fixes lots of memory leaks detected by valgrind.

Unsure if this is how you're supposed to shutdown cairo. You'd
think (from the documentation) that destroying the surface would (when
the refcount reaches 0) destroy the device too...
2019-01-09 18:50:26 +01:00
Daniel Eklöf
b2c9c386d9 bar: make sure modules (and particles and fonts!) are destroyed before cleanup
Before shutting down and destroying cairo and XCB, make sure the
modules, particles and fonts have been destroyed.

I.e. move module destruction from bar's destroy() to the end of bar's
run()
2019-01-09 18:50:26 +01:00
Daniel Eklöf
092e83680b bar: flush cairo surface before copying pixmap to bar window 2019-01-09 18:50:26 +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
3f226d8cce bar: detect XCB disconnect (and abort) 2019-01-07 18:27:28 +01:00
Daniel Eklöf
e159b596d9 bar: ignore XCB_MAPPING_NOTIFY events 2019-01-01 23:32:59 +01:00
Daniel Eklöf
94dbe3b892 bar: ignore events we're not interrested in 2019-01-01 20:35:36 +01:00
Daniel Eklöf
ba1c52d291 bar: remove unused variable 2019-01-01 20:29:48 +01:00
Daniel Eklöf
62997eda8c bar: run(): only return 0 if all modules exited with 0 2018-12-29 18:01:21 +01:00
Daniel Eklöf
6d082f9f99 bar: disable debug logging 2018-12-29 17:54:24 +01:00
Daniel Eklöf
421f1466df bar: reset cursor and return when mouse is at a border 2018-12-29 17:13:38 +01:00
Daniel Eklöf
abc4ff0402 bar: generate exposable ON_MOUSE_CLICK events on button release events 2018-12-29 16:23:27 +01:00
Daniel Eklöf
7670473735 bar: call exposable's on_mouse() on mouse motion events
For this to be doable, the bar no longer destroys the module's
exposables after rendering them. Instead, we keep them around, letting
them represent the "current" content of the bar.

Then, when we receive a mouse motion event, we can iterate the
exposables and calculate which one of them the mouse is over, and call
its on_mouse() function.
2018-12-29 12:56:10 +01:00
Daniel Eklöf
35d7b2bc4a bar: add EFD_CLOEXEC flag to 'ready' eventfd 2018-12-28 12:41:05 +01:00
Daniel Eklöf
1b50808da5 bar: set_cursor(): new interface function, to set the X cursor
Use this to explicitly set the initial/default cursor to "left_ptr"
2018-12-26 17:16:54 +01:00
Daniel Eklöf
5306ebd4ed bar: call refresh() after all modules have been loaded
This also means that modules do *not* have to call bar->refresh() just
before/after calling module_signal_ready().

As long as the module's initial state has been correctly/completely
set up before it calls module_signal_ready(), the module *only* has to
call bar->refresh() when it's state changes.
2018-12-26 11:48:09 +01:00
Daniel Eklöf
3413232ed6 module: add new function module_signal_ready() 2018-12-19 20:23:53 +01:00
Daniel Eklöf
a3eb7ebc08 bar: wait for all modules to have started up before continuing
After starting all the module threads, wait for all modules to have
signalled "ready" before continuing.

This will allow modules to do initial setup, and knowing that
content() will *not* be called until they've signalled "ready".
2018-12-19 19:41:25 +01:00
Daniel Eklöf
7f0f096ba4 module: begin_expose() and content() take a non-const module pointer 2018-12-19 19:03:19 +01:00
Daniel Eklöf
b3a3990347 bar: log *which* event that is unimplemented 2018-12-18 19:42:47 +01:00
Daniel Eklöf
452669d6de bar: lower case initial letter in log message 2018-12-18 19:37:03 +01:00
Daniel Eklöf
817ce49e3b bar: use log framework 2018-12-18 19:24:26 +01:00
Daniel Eklöf
8ae89820db bar: use log framework 2018-12-17 20:29:25 +01:00
Daniel Eklöf
921cda0a81 bar: make location configurable (top or bottom) 2018-11-17 11:54:14 +01:00
Daniel Eklöf
7c468c20c0 xcb: add xcb_init(): checks the x server + extensions, and caches atoms 2018-11-17 11:47:34 +01:00
Daniel Eklöf
8bf8a398b9 initial commit: wip 2018-11-17 11:30:33 +01:00