mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-04 05:54:14 +00:00 
			
		
		
		
	Revert "move sigchld() into XWayland section"
This reverts commit 0ddde0c85a46370759e85f3437e3475b569d5c41. and fix build with XWayland disabled
This commit is contained in:
		
							parent
							
								
									2d1a40caf2
								
							
						
					
					
						commit
						159670c3a2
					
				
							
								
								
									
										42
									
								
								dwl.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								dwl.c
									
									
									
									
									
								
							@ -302,6 +302,7 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
 | 
				
			|||||||
static void setpsel(struct wl_listener *listener, void *data);
 | 
					static void setpsel(struct wl_listener *listener, void *data);
 | 
				
			||||||
static void setsel(struct wl_listener *listener, void *data);
 | 
					static void setsel(struct wl_listener *listener, void *data);
 | 
				
			||||||
static void setup(void);
 | 
					static void setup(void);
 | 
				
			||||||
 | 
					static void sigchld(int unused);
 | 
				
			||||||
static void spawn(const Arg *arg);
 | 
					static void spawn(const Arg *arg);
 | 
				
			||||||
static void startdrag(struct wl_listener *listener, void *data);
 | 
					static void startdrag(struct wl_listener *listener, void *data);
 | 
				
			||||||
static void tag(const Arg *arg);
 | 
					static void tag(const Arg *arg);
 | 
				
			||||||
@ -403,7 +404,6 @@ static void configurex11(struct wl_listener *listener, void *data);
 | 
				
			|||||||
static void createnotifyx11(struct wl_listener *listener, void *data);
 | 
					static void createnotifyx11(struct wl_listener *listener, void *data);
 | 
				
			||||||
static Atom getatom(xcb_connection_t *xc, const char *name);
 | 
					static Atom getatom(xcb_connection_t *xc, const char *name);
 | 
				
			||||||
static void sethints(struct wl_listener *listener, void *data);
 | 
					static void sethints(struct wl_listener *listener, void *data);
 | 
				
			||||||
static void sigchld(int unused);
 | 
					 | 
				
			||||||
static void xwaylandready(struct wl_listener *listener, void *data);
 | 
					static void xwaylandready(struct wl_listener *listener, void *data);
 | 
				
			||||||
static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
 | 
					static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
 | 
				
			||||||
static struct wl_listener xwayland_ready = {.notify = xwaylandready};
 | 
					static struct wl_listener xwayland_ready = {.notify = xwaylandready};
 | 
				
			||||||
@ -2339,6 +2339,28 @@ setup(void)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					sigchld(int unused)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						siginfo_t in;
 | 
				
			||||||
 | 
						/* We should be able to remove this function in favor of a simple
 | 
				
			||||||
 | 
						 *     signal(SIGCHLD, SIG_IGN);
 | 
				
			||||||
 | 
						 * but the Xwayland implementation in wlroots currently prevents us from
 | 
				
			||||||
 | 
						 * setting our own disposition for SIGCHLD.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						if (signal(SIGCHLD, sigchld) == SIG_ERR)
 | 
				
			||||||
 | 
							die("can't install SIGCHLD handler:");
 | 
				
			||||||
 | 
						/* WNOWAIT leaves the child in a waitable state, in case this is the
 | 
				
			||||||
 | 
						 * XWayland process
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
 | 
				
			||||||
 | 
					#ifdef XWAYLAND
 | 
				
			||||||
 | 
								&& (!xwayland || in.si_pid != xwayland->server->pid)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
								)
 | 
				
			||||||
 | 
							waitpid(in.si_pid, NULL, 0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
spawn(const Arg *arg)
 | 
					spawn(const Arg *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -2782,24 +2804,6 @@ sethints(struct wl_listener *listener, void *data)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
sigchld(int unused)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	siginfo_t in;
 | 
					 | 
				
			||||||
	/* We should be able to remove this function in favor of a simple
 | 
					 | 
				
			||||||
	 *	struct sigaction sa = {.sa_handler = SIG_IGN};
 | 
					 | 
				
			||||||
	 * 	sigaction(SIGCHLD, &sa, NULL);
 | 
					 | 
				
			||||||
	 * but the Xwayland implementation in wlroots currently prevents us from
 | 
					 | 
				
			||||||
	 * setting our own disposition for SIGCHLD.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	/* WNOWAIT leaves the child in a waitable state, in case this is the
 | 
					 | 
				
			||||||
	 * XWayland process
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
 | 
					 | 
				
			||||||
			&& (!xwayland || in.si_pid != xwayland->server->pid))
 | 
					 | 
				
			||||||
		waitpid(in.si_pid, NULL, 0);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
xwaylandready(struct wl_listener *listener, void *data)
 | 
					xwaylandready(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user