1160 Commits

Author SHA1 Message Date
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
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
5895593d0b Remove leftover cairo variables in x.c
Clean-up x.c from cairo items that were left over after the move to
draw.c.
2018-05-06 13:47:24 +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
Nikos Tsipinakis
52055f12c7 Move icon related methods to icon.c
The first step to cleaning out x.c.
2018-05-06 13:47:20 +03:00
Nikos Tsipinakis
7a9187728c Merge branch 'maint' 2018-05-06 13:36:07 +03:00
Nikos Tsipinakis
f9732bd2fa Dunst v1.3.2 v1.3.2 2018-05-06 13:30:01 +03:00
Nikos Tsipinakis
6ebe7ca413 Fix crash when loading an invalid or corrupted icon
GError values should be freed with g_error_free rather than g_free it
otherwise causes a crash.

Credit to @bebehei for discovering this.
2018-05-06 13:21:47 +03:00
Nikos Tsipinakis
7dd22d79e3 Merge branch 'maint'
Closes #511
2018-05-02 18:58:07 +03:00
Nikos Tsipinakis
f8538c9a45 Remove hardcoded rule to ignore transient notifications from history
This rule was added in #343 when trying to decide what to do with
transient notifications. This seemed like a good idea at the time but it
ended up creating more confusion that necessary.

Relevant issues: #310, #508
2018-04-02 14:43:10 +03:00
Nikos Tsipinakis
d6ef1c24c5 Fix outdated documentation
The return value of queues_notification_close_id was removed in 3b6c529
but the documentation wasn't updated accordingly.
2018-04-01 00:45:29 +03:00
Nikos Tsipinakis
8547be20d7
Merge pull request #503 from bebehei/escape-summary
Escape the summary
2018-03-20 15:32:18 +02:00
Nikos Tsipinakis
7d5ea54d02
Merge pull request #504 from bebehei/monotonic-time-sleep
Count monotonic time with Linux specific clocks
2018-03-20 15:28:52 +02:00
Benedikt Heine
ac4a0becd2 Count monotonic time with Linux specific clocks
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.
2018-03-20 14:17:03 +01:00
Benedikt Heine
80d8c40791 Escape the summary
According to the notification spec, only the body shall contain markup.
Therefore HTML symbols should get escaped in the summary, too.
2018-03-20 01:51:18 +01:00
Benedikt Heine
b5c2cdafb2
Merge pull request #501 from tsipinakis/bugfix/500
Do not expand config.mk variables on assignment
2018-03-15 04:43:17 +01:00
Nikos Tsipinakis
943b8c6785 Do not expand config.mk variables on assignment
Fix a bug introduced in 678ea70 where since the CFLAGS variable was
simply expanded it ignored the VERSION variable which was initialized
later.

Unfortunately there is no way to prepend a value to a recursively
expanded variable so instead we have to split the hardcoded compiler
flags into separate variables and combine them all later in the
makefile.

Fixes #500
2018-03-11 17:05:10 +02:00
Nikos Tsipinakis
4c5c124e1e
Merge pull request #499 from dunst-project/coveralls
Coveralls & travis build fixes
2018-03-10 10:41:26 +02:00
Nikos Tsipinakis
678ea70c88 Put user CFLAGS after the predefined flags
This allows the usage of the CFLAGS variable to override existing
parameters (e.g. optimizations) without editing config.mk.
2018-03-09 19:54:46 +02:00
Nikos Tsipinakis
063e29fd1b Remove parsing of the X11LIB variable
X11LIB was introduced along with other similar variables such as X11INC
in 1faee75, before dunst used pkg-config to manage libraries. These
variables were removed after the introduction of pkg-config in 0de2e17
so theoretically it is safe to remove it.

I really hope this doesn't break something...
2018-03-09 19:54:46 +02:00
Nikos Tsipinakis
8714a66a5b Exclude test directory from code coverage
Tests always run almost 100%, and there is no need to test our test
suite.
2018-03-09 19:54:46 +02:00
Nikos Tsipinakis
764761132f Drop travis IRC notifications
They aren't of much use and I don't think the users on IRC appreciate
the occasional notification spam when something breaks.
2018-03-09 18:19:35 +02:00
Nikos Tsipinakis
1831e9d015 Run code coverage tests without optimizations
This way the code coverage results also include code paths that are
optimized out by the compiler at higher optimization levels.
2018-03-09 18:18:05 +02:00
Nikos Tsipinakis
533f47f4c6 Fix coveralls crashing when building with clang
Coveralls defaulted to using gcov for all builds even when using clang
in which case it should have used llvm-cov. Fix this by specifying
different coveralls commands for each compiler.

Additionally, move the coverage to commands to the after_success section
to avoid sending coverage data when the build failed.
2018-03-09 18:15:26 +02:00
Nikos Tsipinakis
d536ae723c
Merge pull request #498 from shizeeg/master
per section 'frame_color' parameter
2018-03-08 20:42:46 +02:00
sh!zeeg
aa5ccd7dd7 per section 'frame_color' parameter 2018-03-08 21:33:28 +03:00
Benedikt Heine
f80e6fc579
Merge pull request #472 from bebehei/fullscreen
Implement hiding on fullscreen
2018-02-25 20:50:54 +01:00
Benedikt Heine
0cf4753a68 Wake up for fullscreen change events
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.
2018-02-25 20:44:31 +01:00
Benedikt Heine
a7bc16874d log wakeup 2018-02-25 20:44:31 +01:00
Benedikt Heine
c12873184c Debug processed XEvents 2018-02-25 20:44:23 +01:00