commit
						a7dfd7f973
					
				
							
								
								
									
										22
									
								
								dunst.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								dunst.c
									
									
									
									
									
								
							| @ -168,9 +168,7 @@ void history_pop(void) | ||||
|         n->timeout = settings.sticky_history ? 0 : n->timeout; | ||||
|         g_queue_push_head(queue, n); | ||||
| 
 | ||||
|         if (!xctx.visible) { | ||||
|                 wake_up(); | ||||
|         } | ||||
|         wake_up(); | ||||
| } | ||||
| 
 | ||||
| void wake_up(void) | ||||
| @ -183,7 +181,7 @@ static int get_sleep_time(void) | ||||
| 
 | ||||
|         if (settings.show_age_threshold == 0) { | ||||
|                 /* we need to update every second */ | ||||
|                 return 1000; | ||||
|                 return 1; | ||||
|         } | ||||
| 
 | ||||
|         bool have_ttl = false; | ||||
| @ -195,7 +193,7 @@ static int get_sleep_time(void) | ||||
| 
 | ||||
|                 max_age = MAX(max_age, notification_get_age(n)); | ||||
|                 int ttl = notification_get_ttl(n); | ||||
|                 if (ttl > 0) { | ||||
|                 if (ttl >= 0) { | ||||
|                         if (have_ttl) { | ||||
|                                 min_ttl = MIN(min_ttl, ttl); | ||||
|                         } else { | ||||
| @ -209,7 +207,7 @@ static int get_sleep_time(void) | ||||
|         int show_age_timeout = settings.show_age_threshold - max_age; | ||||
| 
 | ||||
|         if (show_age_timeout < 1) { | ||||
|                 return 1000; | ||||
|                 return 1; | ||||
|         } | ||||
| 
 | ||||
|         if (!have_ttl) { | ||||
| @ -220,13 +218,9 @@ static int get_sleep_time(void) | ||||
| 
 | ||||
|         /* show_age_timeout might be negative */ | ||||
|         if (min_timeout < 1) { | ||||
|                 return 1000; | ||||
|                 return 1; | ||||
|         } else { | ||||
|                 /* add 501 milliseconds to make sure we wake are in the second
 | ||||
|                  * after the next notification times out. Otherwise we'll wake | ||||
|                  * up, but the notification won't get closed until we get woken | ||||
|                  * up again (which might be multiple seconds later */ | ||||
|                 return min_timeout * 1000 + 501; | ||||
|                 return min_timeout; | ||||
|         } | ||||
| } | ||||
| 
 | ||||
| @ -253,13 +247,13 @@ gboolean run(void *data) | ||||
|         } | ||||
| 
 | ||||
|         if (xctx.visible) { | ||||
|                 int now = time(NULL) * 1000; | ||||
|                 int now = time(NULL); | ||||
|                 int sleep = get_sleep_time(); | ||||
| 
 | ||||
|                 if (sleep > 0) { | ||||
|                         int timeout_at = now + sleep; | ||||
|                         if (timeout_cnt == 0 || timeout_at < next_timeout) { | ||||
|                                 g_timeout_add(sleep, run, mainloop); | ||||
|                                 g_timeout_add_seconds(sleep, run, mainloop); | ||||
|                                 next_timeout = timeout_at; | ||||
|                                 timeout_cnt++; | ||||
|                         } | ||||
|  | ||||
| @ -520,7 +520,7 @@ void notification_update_text_to_render(notification *n) | ||||
| 
 | ||||
| int notification_get_ttl(notification *n) { | ||||
|         if (n->timeout == 0) { | ||||
|                 return 0; | ||||
|                 return -1; | ||||
|         } else { | ||||
|                 return n->timeout - (time(NULL) - n->start); | ||||
|         } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Sascha Kruse
						Sascha Kruse