mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-04 05:54:14 +00:00 
			
		
		
		
	Revert "Revert "fix flickering when resizing/spawning windows""
This reverts commit 4a32293548667e68cd9a103e22368b8db1754deb.
This commit is contained in:
		
							parent
							
								
									c60f651951
								
							
						
					
					
						commit
						c8cd9fd3c6
					
				
							
								
								
									
										15
									
								
								client.h
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								client.h
									
									
									
									
									
								
							@ -240,6 +240,21 @@ client_is_mapped(Client *c)
 | 
				
			|||||||
	return c->surface.xdg->mapped;
 | 
						return c->surface.xdg->mapped;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline int
 | 
				
			||||||
 | 
					client_is_rendered_on_mon(Client *c, Monitor *m)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						/* This is needed for when you don't want to check formal assignment,
 | 
				
			||||||
 | 
						 * but rather actual displaying of the pixels.
 | 
				
			||||||
 | 
						 * Usually VISIBLEON suffices and is also faster. */
 | 
				
			||||||
 | 
						struct wlr_surface_output *s;
 | 
				
			||||||
 | 
						if (!c->scene->node.enabled)
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						wl_list_for_each(s, &client_surface(c)->current_outputs, link)
 | 
				
			||||||
 | 
							if (s->output == m->wlr_output)
 | 
				
			||||||
 | 
								return 1;
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
client_is_unmanaged(Client *c)
 | 
					client_is_unmanaged(Client *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										29
									
								
								dwl.c
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								dwl.c
									
									
									
									
									
								
							@ -185,7 +185,6 @@ 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 {
 | 
				
			||||||
@ -1522,8 +1521,6 @@ mapnotify(struct wl_listener *listener, void *data)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	printstatus();
 | 
						printstatus();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c->mon->un_map = 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
unset_fullscreen:
 | 
					unset_fullscreen:
 | 
				
			||||||
	m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
 | 
						m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
 | 
				
			||||||
	wl_list_for_each(w, &clients, link)
 | 
						wl_list_for_each(w, &clients, link)
 | 
				
			||||||
@ -1825,30 +1822,19 @@ rendermon(struct wl_listener *listener, void *data)
 | 
				
			|||||||
	 * generally at the output's refresh rate (e.g. 60Hz). */
 | 
						 * generally at the output's refresh rate (e.g. 60Hz). */
 | 
				
			||||||
	Monitor *m = wl_container_of(listener, m, frame);
 | 
						Monitor *m = wl_container_of(listener, m, frame);
 | 
				
			||||||
	Client *c;
 | 
						Client *c;
 | 
				
			||||||
	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) {
 | 
							if (client_is_rendered_on_mon(c, m) && (!c->isfloating && c->resize))
 | 
				
			||||||
		if ((c->resize && m->un_map) || (c->type == XDGShell
 | 
								goto skip;
 | 
				
			||||||
				&& (c->surface.xdg->pending.geometry.width !=
 | 
						if (!wlr_scene_output_commit(m->scene_output))
 | 
				
			||||||
				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))
 | 
					 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					skip:
 | 
				
			||||||
	/* 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
 | 
				
			||||||
@ -2424,9 +2410,6 @@ 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)) {
 | 
				
			||||||
		if (c == exclusive_focus)
 | 
							if (c == exclusive_focus)
 | 
				
			||||||
			exclusive_focus = NULL;
 | 
								exclusive_focus = NULL;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user