437 Commits

Author SHA1 Message Date
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
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
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
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
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
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
sh!zeeg
aa5ccd7dd7 per section 'frame_color' parameter 2018-03-08 21:33:28 +03: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
Benedikt Heine
aa5cc977cc Add pushback mode 2018-02-25 20:18:40 +01:00
Benedikt Heine
0f46564e97 Print fullscreen value of notification 2018-02-25 20:18:40 +01:00
Benedikt Heine
dd28e62c11 Add Error Handler to fullscreen check 2018-02-25 20:18:40 +01:00
Benedikt Heine
aa7a851fdd Catch screen without window 2018-02-25 20:18:40 +01:00
Benedikt Heine
f89ce8e16f Delay incoming notifications when fullscreens set 2018-02-25 20:18:40 +01:00
Benedikt Heine
bda8c1dbb2 Add rule to show notification on fullscreen 2018-02-25 20:18:40 +01:00
Benedikt Heine
9e824a79ee Add functions to check fullscreen windows 2018-02-25 20:18:36 +01:00
Benedikt Heine
28db0416b4
Merge pull request #491 from bebehei/docs
Parsable markup documentation with doxygen
2018-02-22 21:34:42 +01:00
Benedikt Heine
422f353243 Add initial doxygen documentation 2018-02-22 20:08:00 +01:00
Benedikt Heine
c4eb26e3f5 Remove unnecessary return value 2018-02-20 17:05:55 +01:00
Benedikt Heine
3b6c5299be Use void as argument for parameterless functions 2018-02-20 16:24:00 +01:00
Nikos Tsipinakis
8735c9d3d0
Remove binary file in source directory
This file was added in the logging PR probably by accident or as a
result of `git add --all` (which is why its usage is discouraged).
    
This should have really been caught during code review but accidents
happen!
2018-02-15 12:37:38 +02:00
Benedikt Heine
c3e8bedfab
Merge pull request #474 from bebehei/logging
Logging with GLib
2018-02-12 13:13:37 +01:00
Benedikt Heine
6402218205 Remove negative NULL-check warning
According to the docs in the GSourceFuncs, the timeout_ parameter can be
NULL. But when it's NULL, it would be equivalent to an invocation to
return -1 as timeout_ and FALSE as return value. This is exactly the
same, what we're doing if timeout_ is not NULL.
2018-02-02 17:29:05 +01:00
Benedikt Heine
1e6a15de00 Fix memleak 2018-02-02 17:29:05 +01:00
Benedikt Heine
280ec456a4 Allow to set the log level via options 2018-02-02 17:29:04 +01:00
Benedikt Heine
38dced7591 Translate last unusual logging calls 2018-02-02 17:29:04 +01:00
Benedikt Heine
58dc09b415 Replace PERR macro with appropriate logging macro 2018-02-02 17:29:04 +01:00
Benedikt Heine
19b364d67c Translate fprintf statements into log messages 2018-02-02 17:29:04 +01:00
Benedikt Heine
020a90e521 Replace die method with appropriate critical log 2018-02-02 17:29:04 +01:00
Benedikt Heine
2c503c2984 Add option to suppress log output when testing 2018-02-02 17:29:04 +01:00
Benedikt Heine
cad2ac34f9 Add GLib logging capabilities 2018-02-02 17:29:04 +01:00