1191 Commits

Author SHA1 Message Date
lulivi
cbfe8c0d61 Add xresources config wrapper
Created a wrapper script to customize theme variables (colors,
fonts, etc) according with your X resources file (~/.Xresources).

As dunst is not a X exclusive notification daemon, this script
could be a workarround to solve this.

Related with: #357
2018-07-15 00:14:04 +00:00
Nikos Tsipinakis
74bbc96db2
Merge pull request #521 from bebehei/paths-for-icons
Implement paths for icons
2018-06-24 11:19:06 +03:00
Benedikt Heine
a2b383ec0b Add Tests for tilde expansion in icons 2018-06-23 23:49:25 +02:00
Nikos Tsipinakis
8b2d5c49ba
Merge pull request #523 from bebehei/xfreegc
Fix X11 memoryleak for round corners
2018-06-23 16:51:11 +03:00
Benedikt Heine
0e5034b02a Fix X11 memoryleak for round corners
When using round corners, the shape_gc in x_win_round_corners never got
freed. This created a memory leak in x11 itself and let the X process
create more load while becoming sluggish in some situations.

From the docs, XFreeGC actually could return an int and could throw a
BadGC error. Neither of them are important to catch in our situation:

- Having a look into the Xlib sourcecode, XFreeGC returns always 1.
- As we don't overwrite the shape_gc or do any other destoying calls,
  the BadGC can't happen in this code.
2018-06-22 11:55:34 +02:00
Benedikt Heine
646a35d2da Do not search absolute paths in the icon_path
The icon_path has no point for searching an absolute filename. It was
actually meant to avoid the complex lookup algorithm of the icon theme
spec. And the iconname in this case should be actually just the icon's
basename when searching the path.

Concatenating icons like `~/testimg.png` with all icon paths has no
point and also an additional suffix has no point.
2018-06-19 10:37:08 +02:00
Benedikt Heine
42cc561569 Implement tilde replacing in icon names 2018-06-19 10:24:24 +02:00
Nikos Tsipinakis
7bcb287ca2
Merge pull request #517 from bebehei/typos
Fix typos
2018-06-12 12:30:58 +03:00
Benedikt Heine
0a057450fe Fix typos 2018-06-11 14:10:07 +02:00
Nikos Tsipinakis
a0f21f5c26 Stop trying to setup round corners with 0 radius
If corner_radius is 0 we do not need to do the entire process of setting
up the shaped window.
2018-05-29 11:36:51 +03:00
Nikos Tsipinakis
15c252afb0
Merge pull request #420 from dj95/feature/round_corners
Added: support for round corners
2018-05-28 14:03:32 +03:00
Benedikt Heine
aab9fef78c Simplify corner arcs in X11 code 2018-05-28 13:41:31 +03: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
71791c17e2
Merge pull request #515 from bebehei/maint-addr
Update maintainer addresses
2018-05-15 18:10:10 +03:00
Benedikt Heine
aed3fd30c0 Link the License in README 2018-05-15 17:01:08 +02:00
Benedikt Heine
d4ffa0e0ad Update maintainer addresses 2018-05-15 16:57:37 +02:00
Benedikt Heine
de89328359
Merge pull request #496 from dunst-project/refactor-drawing
Drawing refactor
2018-05-14 11:22:52 +02: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
119340c07d Remove unused and superfluous macro definitions 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
5761ef1c09 Fix segfault with startup_notification
As it currently stands notification_init uses xctx.color to initialize
the notification colors which means that it depends on x11 having been
previously initialized and crashes otherwise. This bug was introduced in
04b327f where draw_setup() was after the startup notification was
created.

As a temporary fix the notification creation was moved under draw_setup
but for a long term solution we should look into removing these xctx
dependencies.
2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
1fe80a5db8 Refactor x event to use g_source_add_unix_fd
According to the glib docs we should use g_source_add_unix_fd rather
than g_source_add_poll. Additionally, this helps us with memory
management since we don't have to handle the allocation of dpy_pollfd.
2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
adc075bf2c Cleanup x.h prototypes 2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
90dd111970 Refactor x11 event source to handle multiple windows
Move the code to register the x11 event source under x_win_create so
multiple windows can be created and be properly registered as the event
source.

One more missing piece is that the callback functions are still using
the global win variable and not getting the window from the source.
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
bec02ef6a0 Fix wrong return value in x11 event dispatch
According to glib docs the dispatch function should be G_SOURCE_REMOVE
or G_SOURCE_CONTINUE. Since this was worked properly until now I assume
we were lucky enough that true == G_SOURCE_CONTINUE but it may not
always be the case.
2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
2a1c4946b5 Add log message when failing to load an icon 2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
806ba9b978 Add xpm to supported icon extensions
The freedesktop icon spec specifies that xpm image files should be
supported for backwards compatibility.
2018-05-14 09:31:53 +03:00
Nikos Tsipinakis
dffe1e1a5a Fix dunst losing on-top status on WM restart
Subscribe to receive window creation events on the root window and raise
the window when that happens to ensure dunst is on top.
We do not raise the window when another override redirect window is
created to avoid being on top of things like screen lockers.

Fixes #160
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
a2863d5312 Move window-related fields to dedicated struct
The first step in allowing dunst to have multiple windows.
2018-05-14 09:30:42 +03:00
Nikos Tsipinakis
ce5c49f0e8 Remove dead code from XEvent handler
According to the X11 docs XSelectionNotify event is generated from a
response to the ConvertSelection protocol which we don't use.
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
Nikos Tsipinakis
f02626e1a7 Increase the number of entries in the stack trace in test-valgrind
The default seems to hide a lot of detail when the malloc call is very
deep inside a library and not in dunst code itself.
2018-05-14 09:11:25 +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
Benedikt Heine
3f7de41732 Add tests for icon.c 2018-05-14 09:11:25 +03:00