534 Commits

Author SHA1 Message Date
Benedikt Heine
8579b3ed6b Add assertion macro to return values
Just recently, I started using g_return_val_if_fail as a brief assertion
checker. It'll also exit the function with a specified return value.

But actually this introduces some weird behavior. It's configurable by
environment variables and it'll print out a log message, if the
expression didn't validate properly. But some of these assertions are
actually ment to be silent.

Using a simple macro makes it simple to structure the assertions and its
return values in a block at the start of a function or anywhere else.
2019-01-07 15:30:42 +01:00
Benedikt Heine
56f2adb106 Manually convert GdkPixbuf to cairo surfaces
As already noted in the code comment, we all knew that the in memory
conversion to a PNG stream is a cumbersome technique. But it was worth
to remove the GTK dependency.

After finding out, that gdk_pixbuf_new_from_data can actually use a
GVariant and share its memory without allocating new memory, I poked
the cairo docs for a similar technique.

There is cairo_image_surface_create_for_data, which would achieve the
same, but cairo uses another color byte order. So we have to manually
copy and reassemble the bytes.

It may look like a big rise in complexity, but actually, it's straight
forward copying pixel by pixel and changing the byte's order.

And the gdk_pixbuf_to_cairo_surface is 33x faster.
2019-01-07 00:45:34 +01:00
Benedikt Heine
5ebedab78b Fix maybe uninitialized variable 2018-12-29 14:38:59 +01:00
Benedikt Heine
63f455276f Print correct ID for foreign DBus service
By providing an additional layer of pointers, the printed PID was
actually the value at the PID's memory position. 🙈
2018-12-29 14:38:59 +01:00
Benedikt Heine
57a6baae85 Test FDN Daemon info 2018-12-29 14:38:59 +01:00
Benedikt Heine
ae58207f9b Use binary search for functions 2018-12-29 14:38:58 +01:00
Benedikt Heine
c35801b3ab Use a macro for method callbacks 2018-12-29 14:36:50 +01:00
Benedikt Heine
4fbb8fa75b Prefix dbus callbacks with dbus_cb_ 2018-12-29 14:31:31 +01:00
Benedikt Heine
b10bb292c6 Simplify DBus notification assembly 2018-12-29 14:31:31 +01:00
Benedikt Heine
52885ca6ad Use a hashtable for notification actions
As g_strv_contains is only available in GLib >= 2.44, we have to bump
the GLib requirements and the CI distros, too.
2018-12-29 14:30:55 +01:00
Benedikt Heine
db350883cc Improve extract_urls 2018-12-27 20:59:47 +01:00
Benedikt Heine
ecfe64c4bd Cleanup unused macros 2018-11-26 19:54:21 +01:00
Benedikt Heine
7e81506226 Remove colors field from xctx
The xctx color field is a full duplicate of the settings logic.
Only logic included in xctx color fields, are the frame colors, which
fall back to the global frame setting. So, this required to handle it
directly in settings.c
2018-11-26 19:54:07 +01:00
Benedikt Heine
3e205ff159 Use notification_colors struct in settings 2018-11-26 18:17:00 +01:00
Benedikt Heine
c3cd623f41 Use notification_colors struct for notification colors 2018-11-26 17:31:46 +01:00
Benedikt Heine
7ba6ca910f
Merge pull request #551 from bebehei/queues-tests
Queues tests
2018-11-26 10:50:58 +01:00
Benedikt Heine
93f6eb58a3 Remove n->start tests
These aren't used anymore. Any notification which gets moved from
waiting to displayed, will have set the start field with the current
monotonic time.

So testing start == 0 won't ever succeed in
queues_notification_is_finished, as the tested notification is contained
in the displayed queue. So the start field never will be 0.

Also there's no semantics for start being 0 in dunst actually
implemented.
2018-11-24 15:22:18 +01:00
Benedikt Heine
d96a29fed5 Move field definition on top of function (readability) 2018-11-24 15:22:18 +01:00
Benedikt Heine
711b11c92f Merge queue_update and queue_check_timeouts 2018-11-24 15:22:18 +01:00
Benedikt Heine
9878de312b Do not mark the waiting notification as shown
Notifications listed in the waiting queue are never shown
🙈
2018-11-24 15:22:18 +01:00
Benedikt Heine
475d829733 Fix notification seeping when displayed isn't full
Only if the queue is full, dunst should swap the most important
notifications from waiting with the least important notifications from
displayed.
2018-11-24 15:22:18 +01:00
Benedikt Heine
662b22e5de Test sleep times for get_next_datachange 2018-11-24 15:22:18 +01:00
Benedikt Heine
140278a36f Introduce a status structure 2018-11-24 15:22:18 +01:00
Benedikt Heine
fb5926b6fa Add tests for queue teardown 2018-11-24 15:22:18 +01:00
Benedikt Heine
e04003e291 Add Framework for queues tests 2018-11-24 15:22:18 +01:00
Benedikt Heine
cb16fe9d96 Fix DoS in notification_format_message
When using a format with a trailing % character, dunst ends in an
endless loop, searching for a % char, while pointing exactly with the
haystack on the % character.

Increasing the substring pointer will shift the pointer forwards onto
the actual NULL character and stop the loop.
2018-11-24 15:22:18 +01:00
Nikos Tsipinakis
5f3960b171 Fix id replacement not assigning id if no notification has it
In previous releases when a replace request came in with an id that
doesn't exist we created a new notification with it anyway.
This is used by some to imitate the behaviour of `stack_tag` and while
not recommended (as it will break if another notification gets assigned
that id) we want to avoid such subtle breakages without consideration.

This bug was introduced in d879d70da060ea78fe735d62249a0afdf3e61bc8.
2018-11-24 15:22:18 +01:00
Benedikt Heine
28f30d182b Rename queues teardown function
Make it consistent with the queues_init function
2018-11-23 13:50:46 +01:00
Benedikt Heine
e82b7bfb2d Use return value as success indicator 2018-11-21 10:55:44 +01:00
Benedikt Heine
92543cce22 Remove GLib requirement check
The requirement for GLib above 2.36 is already included in the
configuration file. So this type check is redundant.
2018-11-20 19:50:15 +01:00
Benedikt Heine
ed341dfca3 Add S2US macro 2018-11-15 15:17:48 +01:00
Benedikt Heine
9b45a111f1 Sort includes alphabetically 2018-11-15 15:17:48 +01:00
Benedikt Heine
feb62a0c4c Remove displaced comment 2018-11-15 15:17:48 +01:00
Benedikt Heine
a6abfdf7c5 Include all local files relatively 2018-11-15 15:17:48 +01:00
Benedikt Heine
eba6913faa Test version number in unittests
Enforces a version number as intended in the Makefile. This check is
necessary, as there is no ability to check via Macros for an empty
string.
2018-11-12 15:32:58 +01:00
Nikos Tsipinakis
27c6a1682d
Merge pull request #552 from Gravemind/x-canonical-private-synchronous
Implement x-canonical-private-synchronous hint
2018-11-11 19:55:05 +02:00
Benedikt Heine
2d2a9c893c Add doxygen docs for markup and utils files 2018-11-11 17:27:11 +01:00
Benedikt Heine
413c0d68af Use assertions and NULL checks in markup and utils 2018-11-11 17:26:14 +01:00
Benedikt Heine
ae1b20881e Use isspace to test for whitespace 2018-11-11 15:18:56 +01:00
Benedikt Heine
d8d457f500 Remove string_replace()
string_replace_at does almost the same and string_replace is only used
once, where additionally string_replace_at would be the better choice.
2018-11-11 15:18:56 +01:00
Jordan Galby
d879d70da0 Implement stack_tag, implementing x-canonical-private-synchronous
Implements "x-dunst-stack-tag", "x-canonical-private-synchronous",
"private-synchronous", and "synchronous" hints via the "stack_tag" feature.
2018-11-10 14:59:32 +01:00
Nikos Tsipinakis
b805273fb9
Merge pull request #558 from tsipinakis/feature/markup-escape
Implement smarter markup escaping
2018-11-06 21:04:35 +02:00
Nikos Tsipinakis
2c6cb8ebf3 Implement smarter markup escaping
Automatically detect and escape invalid and unsupported & entities.

Fixes #546
2018-11-06 20:49:47 +02:00
Benedikt Heine
851f8a7339 Rename dbus methods consistently 2018-10-31 15:19:24 +01:00
Benedikt Heine
9cd600f0bf Remove unused function get_filename_ext
This function had been copied 100% out of the stackoverflow answer
https://stackoverflow.com/a/24976006
2018-10-31 15:19:24 +01:00
Benedikt Heine
a24a464fbc Remove superfluous pause_signal_handler func 2018-10-31 15:19:24 +01:00
Benedikt Heine
08019dc268 Move context_menu into right header 2018-10-31 15:19:24 +01:00
Andrew Benson
f48a939dbf Add error message for failed regex initialization 2018-10-29 07:32:19 -07:00
Nikos Tsipinakis
f12f1094ed
Merge pull request #550 from bebehei/misc
Misc patches
2018-10-10 17:59:30 +03:00
Benedikt Heine
c0e2a2a7e3 Move all strcmp operations to STR*EQ macros 2018-10-09 10:08:17 +02:00