mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-10-30 19:44:17 +00:00 
			
		
		
		
	Back to closemon() with one parameter
With the recent changes in output-management, the extra argument in closemon() would be needed only when unplugging the monitor, so it isn't worth it anymore. Also now is more efficient.
This commit is contained in:
		
							parent
							
								
									5622dbdaf3
								
							
						
					
					
						commit
						9f0b16868a
					
				
							
								
								
									
										18
									
								
								dwl.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								dwl.c
									
									
									
									
									
								
							| @ -204,7 +204,7 @@ static void chvt(const Arg *arg); | |||||||
| static void cleanup(void); | static void cleanup(void); | ||||||
| static void cleanupkeyboard(struct wl_listener *listener, void *data); | static void cleanupkeyboard(struct wl_listener *listener, void *data); | ||||||
| static void cleanupmon(struct wl_listener *listener, void *data); | static void cleanupmon(struct wl_listener *listener, void *data); | ||||||
| static void closemon(Monitor *m, Monitor *newmon); | static void closemon(Monitor *m); | ||||||
| static void commitlayersurfacenotify(struct wl_listener *listener, void *data); | static void commitlayersurfacenotify(struct wl_listener *listener, void *data); | ||||||
| static void commitnotify(struct wl_listener *listener, void *data); | static void commitnotify(struct wl_listener *listener, void *data); | ||||||
| static void createkeyboard(struct wlr_input_device *device); | static void createkeyboard(struct wlr_input_device *device); | ||||||
| @ -688,7 +688,7 @@ void | |||||||
| cleanupmon(struct wl_listener *listener, void *data) | cleanupmon(struct wl_listener *listener, void *data) | ||||||
| { | { | ||||||
| 	struct wlr_output *wlr_output = data; | 	struct wlr_output *wlr_output = data; | ||||||
| 	Monitor *m = wlr_output->data, *newmon; | 	Monitor *m = wlr_output->data; | ||||||
| 
 | 
 | ||||||
| 	wl_list_remove(&m->destroy.link); | 	wl_list_remove(&m->destroy.link); | ||||||
| 	wl_list_remove(&m->frame.link); | 	wl_list_remove(&m->frame.link); | ||||||
| @ -696,24 +696,26 @@ cleanupmon(struct wl_listener *listener, void *data) | |||||||
| 	wlr_output_layout_remove(output_layout, m->wlr_output); | 	wlr_output_layout_remove(output_layout, m->wlr_output); | ||||||
| 
 | 
 | ||||||
| 	updatemons(); | 	updatemons(); | ||||||
| 	closemon(m, wl_container_of(mons.next, newmon, link)); | 
 | ||||||
|  | 	selmon = wl_container_of(mons.next, selmon, link); | ||||||
|  | 	focusclient(selclient(), focustop(selmon), 1); | ||||||
|  | 	closemon(m); | ||||||
|  | 
 | ||||||
| 	free(m); | 	free(m); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| closemon(Monitor *m, Monitor *newmon) | closemon(Monitor *m) | ||||||
| { | { | ||||||
| 	// move all the clients on a closed monitor to another one
 | 	// move closed monitor's clients to the focused one
 | ||||||
| 	Client *c; | 	Client *c; | ||||||
| 
 | 
 | ||||||
| 	selmon = newmon; |  | ||||||
| 	focusclient(selclient(), focustop(newmon), 1); |  | ||||||
| 	wl_list_for_each(c, &clients, link) { | 	wl_list_for_each(c, &clients, link) { | ||||||
| 		if (c->isfloating && c->geom.x > m->m.width) | 		if (c->isfloating && c->geom.x > m->m.width) | ||||||
| 			resize(c, c->geom.x - m->w.width, c->geom.y, | 			resize(c, c->geom.x - m->w.width, c->geom.y, | ||||||
| 				c->geom.width, c->geom.height, 0); | 				c->geom.width, c->geom.height, 0); | ||||||
| 		if (c->mon == m) | 		if (c->mon == m) | ||||||
| 			setmon(c, newmon, c->tags); | 			setmon(c, selmon, c->tags); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Stivvo
						Stivvo