Fix notification not disappearing

This commit is contained in:
fwsmit 2020-12-26 16:42:46 +01:00
parent 4a9c7693f4
commit 72ceedd4db
5 changed files with 23 additions and 2 deletions

View File

@ -43,7 +43,6 @@ pkg_config_packs := gio-2.0 \
"xrandr >= 1.5" \
xscrnsaver \
wayland-client\
systemd
# dunstify also needs libnotify

View File

@ -74,10 +74,12 @@ static gboolean run(void *data)
bool active = queues_length_displayed() > 0;
if (active) {
LOG_D("Dunst: Window is active");
// Call draw before showing the window to avoid flickering
draw();
output->win_show(win);
} else {
LOG_D("Dunst: Window is NOT active");
output->win_hide(win);
}
@ -86,6 +88,8 @@ static gboolean run(void *data)
gint64 sleep = queues_get_next_datachange(now);
gint64 timeout_at = now + sleep;
LOG_D("Dunst: sleeping for %li ms", sleep/1000);
if (sleep >= 0) {
if (next_timeout < now || timeout_at < next_timeout) {
g_timeout_add(sleep/1000, run, NULL);

View File

@ -1,5 +1,6 @@
#include "output.h"
#include "log.h"
#include "x11/x.h"
#include "x11/screen.h"
#include "wayland/wl.h"

View File

@ -141,6 +141,7 @@ static bool queues_notification_is_finished(struct notification *n, struct dunst
if (n->timeout == 0) // sticky
return false;
/* LOG_I("Queues: Still checking if notification is finished"); */
bool is_idle = status.fullscreen ? false : status.idle;
/* don't timeout when user is idle */
@ -311,6 +312,21 @@ void queues_notification_close_id(int id, enum reason reason)
{
struct notification *target = NULL;
char* reason_string;
switch (reason)
{
case REASON_TIME:
reason_string="time";
break;
case REASON_USER:
reason_string="user";
break;
default:
reason_string="unknown";
}
LOG_D("Queues: Closing notification for reason: %s", reason_string);
GQueue *allqueues[] = { displayed, waiting };
for (int i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) {
for (GList *iter = g_queue_peek_head_link(allqueues[i]); iter;

View File

@ -777,6 +777,7 @@ void x_win_show(window winptr)
*/
void x_win_hide(window winptr)
{
LOG_I("X11: Hiding window");
struct window_x11 *win = (struct window_x11*)winptr;
ASSERT_OR_RET(win->visible,);