Commit graph

583 commits

Author SHA1 Message Date
Daniel Eklöf
6019129acc config: clean up particle_string_from_config() 2018-12-29 14:30:09 +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
1cb268f2e7 exposable: define an 'on_mouse' interface function 2018-12-29 12:55:51 +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
acda1a4b21 module: re-order function pointer declarations 2018-12-29 12:49:25 +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
cc654eda57 module/mpd: cleanup 2018-12-28 15:26:22 +01:00
Daniel Eklöf
97b279ff82 module/mpd: don't detach refresh thread
Instead, abort and join previous thread (if any), just before creating
a new one.

Abort/join the last one when destroying the module.

Note: we may end up with a dangling (non-joined) thread for a
while (for example, when state goes from playing -> paused/stopped).

It will however be joined eventually; either when state goes to
'playing' again, or when the module is destroyed.
2018-12-28 14:22:17 +01:00
Daniel Eklöf
cc59593f29 module/mpd: idle mask variable is unused, when we don't debug log 2018-12-28 14:15:03 +01:00
Daniel Eklöf
0103eff3a0 module/mpd: free album/artist/title before replacing them 2018-12-28 14:14:43 +01:00
Daniel Eklöf
f2a3deb362 particle/progress-bar: disable debug logging 2018-12-28 14:14:31 +01:00
Daniel Eklöf
64af167d66 module/mpd: disable debug logging 2018-12-28 14:14:21 +01:00
Daniel Eklöf
d8274c2c9c module/mpd: refresh thread only resets refresh_abort_fd if it's "ours"
That is, we only reset it if the module main thread haven't already
done so (and quite possibly created another eventfd).
2018-12-28 14:08:45 +01:00
Daniel Eklöf
b40069616c module/mpd: refresh_abort_fd now uses -1 to indicate there are is no active thread 2018-12-28 14:08:16 +01:00
Daniel Eklöf
ba31a557f5 module/mpd: refresh thread calls bar->refresh() directly
This is possible, since content() now calculates the correct 'elapsed'
time, based on the time the original elapsed value was received from
MPD.
2018-12-28 14:07:06 +01:00
Daniel Eklöf
f74f2ad031 module/mpd: elapsed and duration are now tracked in millseconds 2018-12-28 14:06:13 +01:00
Daniel Eklöf
3027b6cd9e particle/progress-bar: add debug log 2018-12-28 14:05:17 +01:00
Daniel Eklöf
b0f0a1e942 tag: add realtime unit MSECS (milliseconds) 2018-12-28 14:05:02 +01:00
Daniel Eklöf
13cc11e200 tag: refresh_in() *must* use the realtime unit 2018-12-28 14:04:35 +01:00
Daniel Eklöf
67bd38f5df module/mpd: implement refresh_in() 2018-12-28 12:47:18 +01:00
Daniel Eklöf
89ebfa0dbb module/mpd: remember *when* the 'elapsed' member was set.
This allows us to update the elapsed field without having to talk to
MPD.

In particular, it fixes a bug where we reported the same elapsed value
when we we're updated due to *other* modules calling bar->refresh().
2018-12-28 12:47:14 +01:00
Daniel Eklöf
adb70e9f35 particle/progress-bar: force-refresh realtime tags
When we're tracking a realtime tag, calculate the time left until the
next segment in the progress bar will get filled, and schedule a force
refresh.
2018-12-28 12:43:54 +01:00
Daniel Eklöf
20b3299afd tag: add a refresh_in() interface function
E.g. particles may use this to force a refresh after a certain amount
of time.

Note that it can only be used with 'realtime' tags.
2018-12-28 12:43:02 +01:00
Daniel Eklöf
5008008079 module: add a refresh_in() interface function
Modules can implement this to allow e.g. particles to force a refresh
after a certain amount of time.
2018-12-28 12:42:08 +01:00
Daniel Eklöf
1ed0dab6ad config: raise default battery poll interval from 30s to 60s 2018-12-28 12:41:38 +01:00
Daniel Eklöf
c2e53a6bf7 main: no need for EFD_NONBLOCK 2018-12-28 12:41:21 +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
904f9ff8e1 tag: all tag constructors must now be passed a module 'owner' 2018-12-28 12:40:41 +01:00
Daniel Eklöf
8d94202057 particle/progress-bar: renders a progrss-bar-like thingy 2018-12-27 14:22:05 +01:00
Daniel Eklöf
ce895ac44f particle/empty: placeholder particle, renders nothing
But may have margins.
2018-12-27 14:21:33 +01:00
Daniel Eklöf
99008c5ad9 module/mpd: "elapsed" tag is now a realtime tag (when state == playing) 2018-12-27 11:44:46 +01:00
Daniel Eklöf
025c6991a3 tag: add a new variant of int tags, with a realtime unit property
The idea is, consumers of a tag, can check the realtime property, and
if set to something other than TAG_REALTIME_NONE, schedule a realtime
update.

For example, it could be used to track song progress.
2018-12-27 11:43:27 +01:00
Daniel Eklöf
9a94c9c1f7 module/mpd: monitors MPD 2018-12-27 11:36:38 +01:00
Daniel Eklöf
3aa6b21056 particle/string: call particle_default_destroy() 2018-12-26 21:35:39 +01:00
Daniel Eklöf
ce85ccda56 particle/ramp: call particle_default_destroy() 2018-12-26 21:35:24 +01:00
Daniel Eklöf
20fb0c37b5 particle/map: call particle_default_destroy() 2018-12-26 21:35:05 +01:00
Daniel Eklöf
f5123afc72 particle/list: call particle_default_destroy() 2018-12-26 21:34:53 +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
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
ce68bdb59d exposable: add a 'width' member, set (at latest) in begin_expose() 2018-12-26 16:37:11 +01:00
Daniel Eklöf
a745436ee2 decoration: stack: stacks multiple decorations on top of each other 2018-12-26 15:59:48 +01:00
Daniel Eklöf
09cd27b688 decoration/underline: draws a line at the bottom of the particle 2018-12-26 15:59:16 +01:00
Daniel Eklöf
1c9a908a8f particle/string: draw decoration, if available 2018-12-26 15:31:49 +01:00
Daniel Eklöf
0e3dd72313 yml: bump anchor vector size 2018-12-26 15:31:37 +01:00
Daniel Eklöf
0094cc1269 config: load decorations. All particles may have one 2018-12-26 15:31:16 +01:00
Daniel Eklöf
0284f5ac85 decoration: configurable graphical effects, added to a particle 2018-12-26 15:30:47 +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
1929099ca4 module/backlight: new module 2018-12-26 12:44:17 +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