81 Commits

Author SHA1 Message Date
Nikos Tsipinakis
0afdda11f3 Drop dependency on gtk3
As per discussion in #334 drop dependency on gtk3 and instead depend
only on gdk-pixbuf2 for icon loading.

The only gtk3 function used was gdk_cairo_set_source_pixbuf in order to
convert the loaded pixbufs into cairo surfaces for us to render. In
order to drop the dependency this step was bypassed by using pixbufs
export to png capability and importing it into cairo via a pngstream.
2017-12-22 22:27:08 +01:00
Benedikt Heine
35dbd00611
Merge pull request #428 from bebehei/refactor-notification_init
Refactor notification init
2017-12-18 00:55:59 +01:00
Benedikt Heine
1fc96e9691 Call XFlush after redrawing the window
The commit 7f335b7 introduced, that specific notifications did not time
out properly. Although these had been internally closed already, X11
still displayed them.
2017-11-29 12:46:39 +01:00
Benedikt Heine
eae071f330 Rename color_strings to colors
This is an antipattern and makes linelength increase for nothing
2017-11-25 10:58:25 +01:00
Benedikt Heine
0ad63d2c2c Don't indent switch labels 2017-11-25 02:16:45 +01:00
Benedikt Heine
5b2a6e57b7 curly braces style
Curly braces should start on a new line, after a method declaration, but
should continue on the same line after a control structure.
2017-11-25 02:15:30 +01:00
Benedikt Heine
bd8fd8b1d2 Improve whitespace handling 2017-11-25 01:38:28 +01:00
Benedikt Heine
fc4f0a4238 Refactor arguments into one line
Parameters should not cover an area. All arguments should be on a single
line (either horizontally or vertically).
2017-11-25 01:32:06 +01:00
Benedikt Heine
caa63d6275 Sort includes alphabetically 2017-11-25 01:28:03 +01:00
Benedikt Heine
744712ad77 Use enum for close reason 2017-11-16 18:05:46 +01:00
Benedikt Heine
5f51147263 Prefix urgency enum with URG_ 2017-11-16 17:12:30 +01:00
Benedikt Heine
23cae3110d Optimize out icon_overridden
There is no need save if the icon field should have precedence, as
setting raw_icon to NULL emphasizes the same.

Also freeing raw_icon saves unneccessary memory.
2017-10-31 12:49:16 +01:00
Benedikt Heine
a536e3f60b Force management of queues to queues.c 2017-10-29 20:38:40 +01:00
Benedikt Heine
e3881766c0 Refactor history_* functions to match queues namespace 2017-10-29 20:38:40 +01:00
Benedikt Heine
38e4bbb7bb Refactor notification_* functions to match queues namespace 2017-10-29 20:38:40 +01:00
Benedikt Heine
af9f6b8b7d Move maximum notification display count to x11
Decouple the x11 stuff from dunst.c, to be able to push update_lists to
queues.c in the next commit
2017-10-29 20:38:40 +01:00
Benedikt Heine
7f335b79d2 Uncouple dunst.h from queues.c again 2017-10-29 20:38:40 +01:00
Benedikt Heine
a7003e3616 Refactor: Move queue specific methods to queues.c 2017-10-29 20:38:40 +01:00
Benedikt Heine
e3528ef3ec Indent functions to standard 2017-10-22 10:40:39 +02:00
Benedikt Heine
956b5c6401 Use gint64 as microseconds for internal timeunit
time(NULL) is vulnerable against timeshifts by NTP, timezones,...

g_get_monotonic_time() is not, but counts its in microseconds with the
gint64 datatype. To prevent any conversion bugs, all internal
timeformats are now using a gint64 and only get converted during import
or export (DBus notification arrives, configuration reading, age
threshold display).
2017-10-07 17:46:21 +02:00
fhost
f4b595240a Add option to control how to ellipsize truncated lines 2017-09-19 20:03:16 +02:00
Benedikt Heine
759aa518d5 Refactor star scheme of pointers
To achieve a consistent scheme, all stars of the
pointers should be on the side of the variable and
not on the side of the type.

wrong: char* a
wrong: char * a
good:  char *a

This commit is generated by the following sed command
with manual fixes of all false positives.

find src \( -name '*.c' -or -name '*.h' \) -print0
| xargs -0 -n1 sed -i
's/\([a-zA-Z]\+[-_a-zA-Z0-9]*\)\s*\*\s\+
\([a-zA-Z]\+[-_a-zA-Z0-9]*\)/\1 *\2/g'
2017-09-06 23:14:25 +02:00
Benedikt Heine
a833b4a0f4 Fix memory leak in get_pixbuf_from_path
If the svg-file is not found, the string containing the svg ending is
never freed again.
2017-08-30 19:41:15 +02:00
George Angelopoulos
4d03acc454 replace 'folder' with 'path' in icon functionality
"folder" is more of a windows term. In unix we have paths and
directories.
2017-07-29 15:16:08 +02:00
Nikos Tsipinakis
86cbc1d34b Make icon set via rules take priority over raw icons
When a notification contains both a raw icon and an icon path according
to the GNOME notification specification the raw icon should take
priority over anything else.

If, however, a user uses the new_icon rule to set a custom icon on a
notification, that rule overwrote the icon path and not the raw icon
and as a result the raw icon was displayed in place of the user
specified one.

As a simple fix, a new icon_overridden boolean was added to the
notification struct indicating if a custom icon has been set. If so, the
icon path should take priority over the raw icon.

Fixes #339
2017-07-19 09:13:19 +03:00
Reto Schnyder
d9977cbb41 Handle clicks on release instead of press
This prevents the release event from going to the window behind if the
click closes the notification.
2017-06-29 20:04:14 +02:00
Reto Schnyder
e04bfe0a58 Allow middle click on notification to invoke action
A middle click on an notification with a single or default action will
invoke it. If there are multiple actions and no default, the context
menu is opened. If there are no actions, proceed similarly with URLs.
2017-06-29 19:38:54 +02:00
Nikos Tsipinakis
8b74a756c2 Redraw the window after an expose event
Expose events, according to the X11 documentation, signify when the
contents of a window region have been lost but until now we have been
ignoring this event for unknown reasons.

Handle this event by redrawing the window entirely. While this is not a
perfect solution, the optimal one would be to only redraw the
region that was lost, it's simpler to implement currently and better
than losing the contents of the window entirely.
2017-05-04 17:54:06 +03:00
Nikos Tsipinakis
52600cdfb0 Refactor monitor handling to keep track of all screens
Previously, we were getting screen info every time we tried to move the
window. To improve the situation, information about the available
screens is initialised once when dunst starts and further behaviour
depends on the compile-time options used.

If Xrandr is enabled, screen information is updated when an
XRRScreenChangeNotify event is received, meaning only when the screen
layout changes.

If Xinerama is enabled, screen information is only updated on startup.
This behaviour might be changed later.

If none are enabled, then dunst assumes only one screen and ignores all
multi-monitor options.
2017-04-02 18:27:12 +03:00
Nikos Tsipinakis
0a6b105f4a Move screen related code into a new file
Since we are adding Xrandr support to allow for automatic dpi detection,
split screen handling code into a new file as part of the effort to
simplify x.c
2017-04-02 18:27:12 +03:00
Nikos Tsipinakis
ebea092ddd Move x.{c,h} to a different subdirectory
x.c has grown into an unmaintainable blob. Moving it in its own
subdirectory is the first step to splitting it into submodules each of
which will have a well defined job so that a lot of the code can be
abstracted to improve readability and make it much easier to maintain.

This process will be done one small part at a time only when we need to
change significantly change a part of the file, there is no need to
break what already works.
2017-04-02 18:27:12 +03:00