mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-03 09:01:45 -05:00 
			
		
		
		
	Restore windows after fullscreen
Store position and size of windows before going fullscreen. This is more efficient than arrange() and also works with floating windows All the clients keep their original position because arrange() isn't used after quitting fullscreen
This commit is contained in:
		
							parent
							
								
									4b1ab7804b
								
							
						
					
					
						commit
						43bd806291
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		
							
								
								
									
										14
									
								
								dwl.c
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								dwl.c
									
										
									
									
									
								
							| 
						 | 
					@ -106,6 +106,10 @@ typedef struct {
 | 
				
			||||||
	unsigned int tags;
 | 
						unsigned int tags;
 | 
				
			||||||
	int isfloating;
 | 
						int isfloating;
 | 
				
			||||||
	uint32_t resize; /* configure serial of a pending resize */
 | 
						uint32_t resize; /* configure serial of a pending resize */
 | 
				
			||||||
 | 
						int prevx;
 | 
				
			||||||
 | 
						int prevy;
 | 
				
			||||||
 | 
						int prevwidth;
 | 
				
			||||||
 | 
						int prevheight;
 | 
				
			||||||
} Client;
 | 
					} Client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
| 
						 | 
					@ -675,6 +679,16 @@ fullscreenotify(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	wlr_xdg_toplevel_set_fullscreen(
 | 
						wlr_xdg_toplevel_set_fullscreen(
 | 
				
			||||||
			c->surface.xdg, !c->surface.xdg->toplevel->current.fullscreen);
 | 
								c->surface.xdg, !c->surface.xdg->toplevel->current.fullscreen);
 | 
				
			||||||
	c->bw = (int)c->surface.xdg->toplevel->current.fullscreen * borderpx;
 | 
						c->bw = (int)c->surface.xdg->toplevel->current.fullscreen * borderpx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (c->surface.xdg->toplevel->current.fullscreen) { /* fullscreen off */
 | 
				
			||||||
 | 
							resize(c, c->prevx, c->prevy, c->prevwidth, c->prevheight, 0);
 | 
				
			||||||
 | 
						} else { /* fullscreen on */
 | 
				
			||||||
 | 
							c->prevx = c->geom.x;
 | 
				
			||||||
 | 
							c->prevy = c->geom.y;
 | 
				
			||||||
 | 
							c->prevheight = c->geom.height;
 | 
				
			||||||
 | 
							c->prevwidth = c->geom.width;
 | 
				
			||||||
 | 
							resize(c, c->mon->w.x, c->mon->w.y, c->mon->w.width, c->mon->w.height, 0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Monitor *
 | 
					Monitor *
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue