29 Commits

Author SHA1 Message Date
Benedikt Heine
bbbddad3a7 Use structs for notifications 2018-09-16 02:58:31 +02:00
Benedikt Heine
c944949e36 Pack types from x.c into structs 2018-09-16 02:58:13 +02:00
Benedikt Heine
4c26ab442a Use the first waiting notification to generate xmore
Using the last notification from displayed creates confusion about
nonexisting notifications.
2018-09-13 12:08:41 +02:00
Benedikt Heine
a229363dbd Simplify colored_layout codepaths 2018-07-07 11:54:41 +02:00
Benedikt Heine
d5fd674d2f Simplify corner arcs in cairo 2018-05-28 13:36:45 +03:00
dj95
a3034d5f62 Implement support for round corners 2018-05-28 13:36:45 +03:00
Nikos Tsipinakis
4891710af3 Refactor window_x11 struct to be opaque
This removes window accesses from outside the x.c file which will allow
us to abstract the window struct to implement multiple outputs in the
future.
2018-05-14 10:39:46 +03:00
Nikos Tsipinakis
54face5956 Fix unchecked corner case in icon_position check
In the case that cl->icon is not NULL we assume that icon_position is
either left or right but this might not always be the case in the
future.
2018-05-14 09:31:53 +03:00
Benedikt Heine
b6283724b9 Prefix the separator enum 2018-05-14 09:31:53 +03:00
Benedikt Heine
1d58d2ec87 Canonify invalid enum values handling 2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
c29b1a39fb Refactor window positioning and surface rendering into x.c
Move the double-buffering implementation and the x_win_call move into
x.c so we only need to call x_display_surface for each draw.

This isolates all uses of the cairo context and root surface outside of
x.c which will help to add support for other display servers.
2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
72aab3daf4 Refactor window creation and destruction
Move the main window reference from xctx to draw.c and at the same time
make each X11 function that modifies the window require the pointer as a
parameter. This makes it easier to implement features that require
multiple windows.
2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
43c7078ccc Break down long function prototypes 2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
21948122e0 Refactor render_background to return the layout width
Rather than calculating the width of the subsurface we are drawing on
everywhere simply add a return pointer to render_background.

This commit also fixes a bug where the text and icon where drawn more to
the right than usual (according to frame_width) which was caused because
we added the frame_width to the draw position while we are drawing in a
subsurface that already accounts for it.
2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
7043af2e64 Rename h variable to more descriptive name
Rename h to cl_h.
2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
5e7f58203e Refactor hacky floating point casts
Avoid casting an int to a double for a calculation only to cast it back,
instead prefer to use integer operations where appropriate.
2018-05-14 09:30:54 +03:00
Nikos Tsipinakis
4e57e1db1c Move separator drawing to render_background 2018-05-14 09:30:42 +03:00
Nikos Tsipinakis
c26445aa5d Split content drawing from render_layout 2018-05-14 09:30:42 +03:00
Nikos Tsipinakis
d35807deaa Move height calculation out of render_layout 2018-05-14 09:30:42 +03:00
Nikos Tsipinakis
781267f30d Split background drawing from render_layout 2018-05-14 09:30:42 +03:00
Nikos Tsipinakis
562dbe3918 Pass cairo surface to render_layout 2018-05-14 09:30:42 +03:00
Nikos Tsipinakis
f513d8417f Move positioning logic out of x_win_move 2018-05-14 09:30:42 +03:00
Nikos Tsipinakis
4faa9cbaaa Isolate GdkPixbuf usage to icon.c
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.
2018-05-14 09:30:42 +03:00
Nikos Tsipinakis
e52b1ae495 Rename draw functions
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.
2018-05-14 09:29:45 +03:00
Benedikt Heine
3bfc77864f Refactor GdkPixbuf loading
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.
2018-05-14 09:11:25 +03:00
Nikos Tsipinakis
651be8eee9 Avoid using dimensions struct for unrelated uses
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.
2018-05-14 09:11:25 +03:00
Nikos Tsipinakis
a7fd3cb0ec Move geometry handling to settings
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.
2018-05-14 09:11:25 +03:00
Nikos Tsipinakis
466f95eb91 Move drawing functions to draw.c
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.
2018-05-06 13:47:24 +03:00
Nikos Tsipinakis
045ec98c0e Setup initial file for draw.c
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.
2018-05-06 13:47:24 +03:00