Merge pull request #449 from bebehei/fix-notification-timeouts
Fix notification timeouts
This commit is contained in:
commit
75fddab7bd
20
src/dunst.c
20
src/dunst.c
@ -53,14 +53,9 @@ gboolean run(void *data)
|
||||
queues_check_timeouts(x_is_idle());
|
||||
queues_update();
|
||||
|
||||
static int timeout_cnt = 0;
|
||||
static gint64 next_timeout = 0;
|
||||
|
||||
if (data && timeout_cnt > 0) {
|
||||
timeout_cnt--;
|
||||
}
|
||||
|
||||
if (queues_length_displayed() > 0 && !xctx.visible) {
|
||||
if (!xctx.visible && queues_length_displayed() > 0) {
|
||||
x_win_show();
|
||||
}
|
||||
|
||||
@ -78,16 +73,19 @@ gboolean run(void *data)
|
||||
gint64 timeout_at = now + sleep;
|
||||
|
||||
if (sleep >= 0) {
|
||||
if (timeout_cnt == 0 || timeout_at < next_timeout) {
|
||||
g_timeout_add(sleep/1000, run, mainloop);
|
||||
if (next_timeout < now || timeout_at < next_timeout) {
|
||||
g_timeout_add(sleep/1000, run, NULL);
|
||||
next_timeout = timeout_at;
|
||||
timeout_cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* always return false to delete timers */
|
||||
return false;
|
||||
/* If the execution got triggered by g_timeout_add,
|
||||
* we have to remove the timeout (which is actually a
|
||||
* recurring interval), as we have set a new one
|
||||
* by ourselves.
|
||||
*/
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
gboolean pause_signal(gpointer data)
|
||||
|
@ -19,18 +19,15 @@
|
||||
extern GSList *rules;
|
||||
extern const char *color_strings[3][3];
|
||||
|
||||
/* return id of notification */
|
||||
gboolean run(void *data);
|
||||
void wake_up(void);
|
||||
|
||||
int dunst_main(int argc, char *argv[]);
|
||||
|
||||
void check_timeouts(void);
|
||||
void usage(int exit_status);
|
||||
void print_version(void);
|
||||
char *extract_urls(const char *str);
|
||||
void context_menu(void);
|
||||
void wake_up(void);
|
||||
void pause_signal_handler(int sig);
|
||||
|
||||
#endif
|
||||
|
@ -701,6 +701,8 @@ void x_win_draw(void)
|
||||
cairo_paint(cairo_ctx.context);
|
||||
cairo_show_page(cairo_ctx.context);
|
||||
|
||||
XFlush(xctx.dpy);
|
||||
|
||||
cairo_destroy(c);
|
||||
cairo_surface_destroy(image_surface);
|
||||
r_free_layouts(layouts);
|
||||
|
Loading…
x
Reference in New Issue
Block a user