fixed tab responding under marukuru

This commit is contained in:
WanderingPenwing 2024-08-14 18:23:35 +02:00
parent 276fe8e8ed
commit 98beb2bfa1

11
surf.c
View file

@ -154,6 +154,7 @@ typedef struct Client {
GtkWidget *tab_bar; GtkWidget *tab_bar;
int tab_click_index; int tab_click_index;
bool tab_drag; bool tab_drag;
pid_t subprocess_pid;
} Client; } Client;
typedef struct { typedef struct {
@ -651,6 +652,13 @@ void tab_bar_click(Client *c, bool close) {
return; return;
} }
int status;
pid_t result = waitpid(c->subprocess_pid, &status, WNOHANG);
if (result == 0 && c->subprocess_pid != 0) {
return;
}
if (close) { if (close) {
Arg close_arg = {.i = c->tab_click_index}; Arg close_arg = {.i = c->tab_click_index};
close_tab(c, &close_arg); close_tab(c, &close_arg);
@ -1556,7 +1564,8 @@ newwindow(Client *c, const Arg *a, int noembed)
void void
spawn(Client *c, const Arg *a) spawn(Client *c, const Arg *a)
{ {
if (fork() == 0) { c->subprocess_pid = fork();
if (c->subprocess_pid == 0) {
if (dpy) if (dpy)
close(ConnectionNumber(dpy)); close(ConnectionNumber(dpy));
close(spair[0]); close(spair[0]);