Fix some free client issues, add double fork in spawn

This commit is contained in:
Martin Duquesnoy 2012-01-28 17:10:59 +01:00
parent 4deb60dfa6
commit 2ac4d8ffd0
3 changed files with 31 additions and 20 deletions

View File

@ -493,7 +493,7 @@ _client_tab(struct client *c, struct client *cm)
{
long m[2] = { CLIENT_TILED, CLIENT_FREE };
/* Do not tab already tabed client */
/* Do not tab already tabbed client */
if(c->flags & (CLIENT_TABBED | CLIENT_TABMASTER)
|| c->tag != cm->tag || c == cm)
return;
@ -841,18 +841,25 @@ client_apply_rule(struct client *c)
if(flags & (RINSTANCE | RCLASS | RNAME) && flags & RROLE)
{
c->screen = screen_gb_id(r->screen);
c->tag = tag_gb_id(c->screen, r->tag);
if(r->screen > 0)
c->screen = screen_gb_id(r->screen);
c->tag = c->screen->seltag;
if(r->tag > 0)
c->tag = tag_gb_id(c->screen, r->tag);
c->theme = r->theme;
if(r->flags & RULE_FREE)
c->flags |= CLIENT_FREE;
FLAGAPPLY(c->flags, (r->flags & RULE_FREE), CLIENT_FREE);
if(r->flags & RULE_MAX)
{ /* TODO */ }
if(r->flags & RULE_IGNORE_TAG)
{ /* TODO */ }
/* TODO
if(r->flags & RULE_MAX)
{}
if(r->flags & RULE_IGNORE_TAG)
{}
*/
c->flags |= CLIENT_RULED;
}
@ -1055,8 +1062,6 @@ client_moveresize(struct client *c, struct geo *g)
c->wgeo.y = c->tbarw;
c->geo.w = c->rgeo.w = c->wgeo.w + c->border + c->border;
c->geo.h = c->rgeo.h = c->wgeo.h + c->tbarw + c->border;
c->fgeo = c->geo;
}
/* Adjust window regarding required size for frame (tiling) */
else
@ -1067,6 +1072,8 @@ client_moveresize(struct client *c, struct geo *g)
client_winsize(c, g);
}
c->fgeo = c->geo;
/* Real geo regarding full root size */
c->rgeo.x += c->screen->ugeo.x;
c->rgeo.y += c->screen->ugeo.y;
@ -1361,15 +1368,15 @@ uicb_client_toggle_free(Uicb cmd)
W->client->flags ^= CLIENT_FREE;
layout_client(W->client);
/* Set tabbed client of toggled client as free */
if(W->client->flags & CLIENT_TABMASTER)
{
SLIST_FOREACH(c, &W->client->tag->clients, tnext)
if(c->tabmaster == W->client)
if(c->tabmaster == W->client && c != W->client)
c->flags ^= CLIENT_FREE;
}
layout_client(W->client);
}
void

View File

@ -375,7 +375,7 @@ layout_split_integrate(struct client *c, struct client *sc)
*/
FOREACH_NFCLIENT(sc, &c->tag->clients, tnext)
{
if(!(sc->flags & CLIENT_TILED) || sc == c)
if(sc == c || sc->flags & CLIENT_TABBED)
continue;
break;
}
@ -567,8 +567,8 @@ layout_client(struct client *c)
if(c->flags & CLIENT_FREE)
{
c->flags &= ~CLIENT_TILED;
layout_split_arrange_closed(c);
c->flags ^= CLIENT_TILED;
client_moveresize(c, &c->fgeo);
XRaiseWindow(W->dpy, c->frame);
}

View File

@ -110,10 +110,14 @@ spawn(const char *format, ...)
if((pid = fork()) == 0)
{
setsid();
if (execl(sh, sh, "-c", cmd, (char*)NULL) == -1)
warnl("execl(sh -c %s)", cmd);
exit(EXIT_FAILURE);
if((pid = fork()) == 0)
{
setsid();
if (execl(sh, sh, "-c", cmd, (char*)NULL) == -1)
warnl("execl(sh -c %s)", cmd);
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
else if (pid == -1)
warnl("fork");