mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-10-31 12:04:16 +00:00 
			
		
		
		
	cleanup function to match dwm
This commit is contained in:
		
							parent
							
								
									8eb6fe8e9e
								
							
						
					
					
						commit
						620da43933
					
				
							
								
								
									
										37
									
								
								dwl.c
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								dwl.c
									
									
									
									
									
								
							| @ -179,6 +179,7 @@ static void arrange(Monitor *m); | |||||||
| static void axisnotify(struct wl_listener *listener, void *data); | static void axisnotify(struct wl_listener *listener, void *data); | ||||||
| static void buttonpress(struct wl_listener *listener, void *data); | static void buttonpress(struct wl_listener *listener, void *data); | ||||||
| static void chvt(const Arg *arg); | static void chvt(const Arg *arg); | ||||||
|  | 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 commitnotify(struct wl_listener *listener, void *data); | static void commitnotify(struct wl_listener *listener, void *data); | ||||||
| @ -434,6 +435,20 @@ chvt(const Arg *arg) | |||||||
| 	wlr_session_change_vt(wlr_backend_get_session(backend), arg->ui); | 	wlr_session_change_vt(wlr_backend_get_session(backend), arg->ui); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void | ||||||
|  | cleanup(void) | ||||||
|  | { | ||||||
|  | #ifdef XWAYLAND | ||||||
|  | 	wlr_xwayland_destroy(xwayland); | ||||||
|  | #endif | ||||||
|  | 	wl_display_destroy_clients(dpy); | ||||||
|  | 	wl_display_destroy(dpy); | ||||||
|  | 
 | ||||||
|  | 	wlr_xcursor_manager_destroy(cursor_mgr); | ||||||
|  | 	wlr_cursor_destroy(cursor); | ||||||
|  | 	wlr_output_layout_destroy(output_layout); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void | void | ||||||
| cleanupkeyboard(struct wl_listener *listener, void *data) | cleanupkeyboard(struct wl_listener *listener, void *data) | ||||||
| { | { | ||||||
| @ -1447,6 +1462,10 @@ setsel(struct wl_listener *listener, void *data) | |||||||
| void | void | ||||||
| setup(void) | setup(void) | ||||||
| { | { | ||||||
|  | 	/* The Wayland display is managed by libwayland. It handles accepting
 | ||||||
|  | 	 * clients from the Unix socket, manging Wayland globals, and so on. */ | ||||||
|  | 	dpy = wl_display_create(); | ||||||
|  | 
 | ||||||
| 	/* clean up child processes immediately */ | 	/* clean up child processes immediately */ | ||||||
| 	sigchld(0); | 	sigchld(0); | ||||||
| 
 | 
 | ||||||
| @ -1912,25 +1931,9 @@ main(int argc, char *argv[]) | |||||||
| 	// socket
 | 	// socket
 | ||||||
| 	if (!getenv("XDG_RUNTIME_DIR")) | 	if (!getenv("XDG_RUNTIME_DIR")) | ||||||
| 		BARF("XDG_RUNTIME_DIR must be set"); | 		BARF("XDG_RUNTIME_DIR must be set"); | ||||||
| 
 |  | ||||||
| 	/* The Wayland display is managed by libwayland. It handles accepting
 |  | ||||||
| 	 * clients from the Unix socket, manging Wayland globals, and so on. */ |  | ||||||
| 	dpy = wl_display_create(); |  | ||||||
| 
 |  | ||||||
| 	setup(); | 	setup(); | ||||||
| 	run(startup_cmd); | 	run(startup_cmd); | ||||||
| 
 | 	cleanup(); | ||||||
| 	/* Once wl_display_run returns, we shut down the server. */ |  | ||||||
| #ifdef XWAYLAND |  | ||||||
| 	wlr_xwayland_destroy(xwayland); |  | ||||||
| #endif |  | ||||||
| 	wl_display_destroy_clients(dpy); |  | ||||||
| 	wl_display_destroy(dpy); |  | ||||||
| 
 |  | ||||||
| 	wlr_xcursor_manager_destroy(cursor_mgr); |  | ||||||
| 	wlr_cursor_destroy(cursor); |  | ||||||
| 	wlr_output_layout_destroy(output_layout); |  | ||||||
| 
 |  | ||||||
| 	return EXIT_SUCCESS; | 	return EXIT_SUCCESS; | ||||||
| 
 | 
 | ||||||
| usage: | usage: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Devin J. Pohly
						Devin J. Pohly