mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-03 09:01:45 -05:00 
			
		
		
		
	Fix dwl freezing when resizing
This commit is contained in:
		
							parent
							
								
									b42abeac69
								
							
						
					
					
						commit
						a41d6cb00f
					
				
					 1 changed files with 22 additions and 6 deletions
				
			
		
							
								
								
									
										28
									
								
								dwl.c
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								dwl.c
									
										
									
									
									
								
							| 
						 | 
					@ -170,6 +170,7 @@ struct Monitor {
 | 
				
			||||||
	unsigned int tagset[2];
 | 
						unsigned int tagset[2];
 | 
				
			||||||
	double mfact;
 | 
						double mfact;
 | 
				
			||||||
	int nmaster;
 | 
						int nmaster;
 | 
				
			||||||
 | 
						int un_map; /* If a map/unmap happened on this monitor, then this should be true */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
| 
						 | 
					@ -1252,6 +1253,8 @@ mapnotify(struct wl_listener *listener, void *data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (c->isfullscreen)
 | 
						if (c->isfullscreen)
 | 
				
			||||||
		setfullscreen(c, 1);
 | 
							setfullscreen(c, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						c->mon->un_map = 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
| 
						 | 
					@ -1521,17 +1524,27 @@ rendermon(struct wl_listener *listener, void *data)
 | 
				
			||||||
	int skip = 0;
 | 
						int skip = 0;
 | 
				
			||||||
	struct timespec now;
 | 
						struct timespec now;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						clock_gettime(CLOCK_MONOTONIC, &now);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Render if no XDG clients have an outstanding resize and are visible on
 | 
						/* Render if no XDG clients have an outstanding resize and are visible on
 | 
				
			||||||
	 * this monitor.
 | 
						 * this monitor. */
 | 
				
			||||||
	 */
 | 
						/* Checking m->un_map for every client is not optimal but works */
 | 
				
			||||||
	wl_list_for_each(c, &clients, link)
 | 
						wl_list_for_each(c, &clients, link) {
 | 
				
			||||||
		skip = skip || (c->resize && VISIBLEON(c, m));
 | 
							if ((c->resize && m->un_map) || (c->type == XDGShell
 | 
				
			||||||
 | 
									&& (c->surface.xdg->pending.geometry.width !=
 | 
				
			||||||
 | 
									c->surface.xdg->current.geometry.width
 | 
				
			||||||
 | 
									|| c->surface.xdg->pending.geometry.height !=
 | 
				
			||||||
 | 
									c->surface.xdg->current.geometry.height))) {
 | 
				
			||||||
 | 
								/* Lie */
 | 
				
			||||||
 | 
								wlr_surface_send_frame_done(client_surface(c), &now);
 | 
				
			||||||
 | 
								skip = 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (!skip && !wlr_scene_output_commit(m->scene_output))
 | 
						if (!skip && !wlr_scene_output_commit(m->scene_output))
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Let clients know a frame has been rendered */
 | 
						/* Let clients know a frame has been rendered */
 | 
				
			||||||
	clock_gettime(CLOCK_MONOTONIC, &now);
 | 
					 | 
				
			||||||
	wlr_scene_output_send_frame_done(m->scene_output, &now);
 | 
						wlr_scene_output_send_frame_done(m->scene_output, &now);
 | 
				
			||||||
 | 
						m->un_map = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
| 
						 | 
					@ -2070,6 +2083,9 @@ unmapnotify(struct wl_listener *listener, void *data)
 | 
				
			||||||
		grabc = NULL;
 | 
							grabc = NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (c->mon)
 | 
				
			||||||
 | 
							c->mon->un_map = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (client_is_unmanaged(c)) {
 | 
						if (client_is_unmanaged(c)) {
 | 
				
			||||||
		wlr_scene_node_destroy(c->scene);
 | 
							wlr_scene_node_destroy(c->scene);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue