delete oldest msg on click
This commit is contained in:
		
							parent
							
								
									47c7a7fd92
								
							
						
					
					
						commit
						732b52480f
					
				
							
								
								
									
										11
									
								
								dunst.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								dunst.c
									
									
									
									
									
								
							| @ -180,13 +180,20 @@ check_timeouts(void) { | |||||||
| void | void | ||||||
| delete_msg(msg_queue_t *elem) { | delete_msg(msg_queue_t *elem) { | ||||||
|     msg_queue_t *cur; |     msg_queue_t *cur; | ||||||
|  |     msg_queue_t *tmp; | ||||||
|     int visible_count = 0; |     int visible_count = 0; | ||||||
|     if(msgqueue == NULL) { |     if(msgqueue == NULL) { | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     if(elem == NULL) { |     if(elem == NULL) { | ||||||
|         /* delete the last element */ |         /* delete the oldest element */ | ||||||
|         for(elem = msgqueue; elem->next != NULL; elem = elem->next); |         tmp = msgqueue; | ||||||
|  |         for(elem = msgqueue; elem->next != NULL; elem = elem->next) { | ||||||
|  |             if(tmp->start > 0 && tmp->start < elem->start) { | ||||||
|  |                 tmp = elem; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         elem = tmp; | ||||||
|     } |     } | ||||||
|     msgqueue = delete(elem); |     msgqueue = delete(elem); | ||||||
|     for(cur = msgqueue; cur != NULL; cur = cur->next) { |     for(cur = msgqueue; cur != NULL; cur = cur->next) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Sascha Kruse
						Sascha Kruse