Cleans up the clutter in draw and since only a single icon function is
called externally from icon.c it'll make things easier if we ever decide
to switch icon libraries.
Remove prefixes used to distinguish between X and draw functions in x.c,
this is obviously no longer necessary. Additionally, add appropriate
layout_ and color_ prefixes to the relevant functions.
Rename both functions to make clear, what the difference between the
previous functions _from_file and _from_path is. Also remove the
superfluous `== NULL` checks as these don't match dunst's current style.
The `dimension_t` struct was used in many different places and even held
on the geometry info at some point which is counter-intuitive as it's
best to have each struct serve a single purpose.
Change the value of geometry in settings from an unparsed string to a
struct containing the properly parsed geometry info. Since we depend on
X11 for geometry parsing this (unfortunately) introduces an X11
dependency on the settings module, this can only be resolved if we
implement our own parsing.
Copy-paste all the drawing functions from x.c to draw.c. In the spirit
of making changes easily traceable the minimal amount of changes
required to make the functions work was made. Further improvement (like
removing the cairo-xlib dependency) will be done in later commits.
Setup the initial template for draw.c to be between X11 calls and the
rest of the codebase. This prepares the file to move all the drawing
related function here in the next commit.
On Linux, CLOCK_MONOTONIC has got a bug. It does not count
onwards during sleep, albeit required by POSIX. This behavior
is reasoned with the requirement for poll().
Also the GLib people are sticking to this behavior in their
g_get_monotonic_time() function.
So we have to use a drop in replacement, which respects CLOCK_BOOTTIME
on Linux, as this is the clock, what would be CLOCK_MONOTONIC on POSIX
systems.
The PropertyNotify handling has been changed in the dropgtk branch to
ignore XEvents, when redrawing was unnecessary. But when the fullscreen
state of a window changes, we can't ignore the event, because it didn't
change the screen.
Additionally, there had been a mistake in the handling of the cur_screen:
The xctx.cur_screen field will only get updated, when the application is
visible and gets redrawn. Therefore, when a PropertyNotify event arrived
while the application had been hidden and the screens do not match
anymore, wake_up() will be called albeit being unnecessary.
Calling x_win_draw() when the screens change is also the preferable
solution over wake_up(), as there is nothing subject to change in the
queues when the displays change.
This file was added in the logging PR probably by accident or as a
result of `git add --all` (which is why its usage is discouraged).
This should have really been caught during code review but accidents
happen!
According to the docs in the GSourceFuncs, the timeout_ parameter can be
NULL. But when it's NULL, it would be equivalent to an invocation to
return -1 as timeout_ and FALSE as return value. This is exactly the
same, what we're doing if timeout_ is not NULL.