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_check_timeouts(x_is_idle());
 | 
				
			||||||
        queues_update();
 | 
					        queues_update();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        static int timeout_cnt = 0;
 | 
					 | 
				
			||||||
        static gint64 next_timeout = 0;
 | 
					        static gint64 next_timeout = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (data && timeout_cnt > 0) {
 | 
					        if (!xctx.visible && queues_length_displayed() > 0) {
 | 
				
			||||||
                timeout_cnt--;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (queues_length_displayed() > 0 && !xctx.visible) {
 | 
					 | 
				
			||||||
                x_win_show();
 | 
					                x_win_show();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -78,16 +73,19 @@ gboolean run(void *data)
 | 
				
			|||||||
                gint64 timeout_at = now + sleep;
 | 
					                gint64 timeout_at = now + sleep;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (sleep >= 0) {
 | 
					                if (sleep >= 0) {
 | 
				
			||||||
                        if (timeout_cnt == 0 || timeout_at < next_timeout) {
 | 
					                        if (next_timeout < now || timeout_at < next_timeout) {
 | 
				
			||||||
                                g_timeout_add(sleep/1000, run, mainloop);
 | 
					                                g_timeout_add(sleep/1000, run, NULL);
 | 
				
			||||||
                                next_timeout = timeout_at;
 | 
					                                next_timeout = timeout_at;
 | 
				
			||||||
                                timeout_cnt++;
 | 
					 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* always return false to delete timers */
 | 
					        /* If the execution got triggered by g_timeout_add,
 | 
				
			||||||
        return false;
 | 
					         * 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)
 | 
					gboolean pause_signal(gpointer data)
 | 
				
			||||||
 | 
				
			|||||||
@ -19,18 +19,15 @@
 | 
				
			|||||||
extern GSList *rules;
 | 
					extern GSList *rules;
 | 
				
			||||||
extern const char *color_strings[3][3];
 | 
					extern const char *color_strings[3][3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* return id of notification */
 | 
					 | 
				
			||||||
gboolean run(void *data);
 | 
					gboolean run(void *data);
 | 
				
			||||||
void wake_up(void);
 | 
					void wake_up(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int dunst_main(int argc, char *argv[]);
 | 
					int dunst_main(int argc, char *argv[]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void check_timeouts(void);
 | 
					 | 
				
			||||||
void usage(int exit_status);
 | 
					void usage(int exit_status);
 | 
				
			||||||
void print_version(void);
 | 
					void print_version(void);
 | 
				
			||||||
char *extract_urls(const char *str);
 | 
					char *extract_urls(const char *str);
 | 
				
			||||||
void context_menu(void);
 | 
					void context_menu(void);
 | 
				
			||||||
void wake_up(void);
 | 
					 | 
				
			||||||
void pause_signal_handler(int sig);
 | 
					void pause_signal_handler(int sig);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -701,6 +701,8 @@ void x_win_draw(void)
 | 
				
			|||||||
        cairo_paint(cairo_ctx.context);
 | 
					        cairo_paint(cairo_ctx.context);
 | 
				
			||||||
        cairo_show_page(cairo_ctx.context);
 | 
					        cairo_show_page(cairo_ctx.context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        XFlush(xctx.dpy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cairo_destroy(c);
 | 
					        cairo_destroy(c);
 | 
				
			||||||
        cairo_surface_destroy(image_surface);
 | 
					        cairo_surface_destroy(image_surface);
 | 
				
			||||||
        r_free_layouts(layouts);
 | 
					        r_free_layouts(layouts);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user