Fix tag mapping at reload and possible segf with tabmaster client in tag_client

This commit is contained in:
Martin Duquesnoy 2011-12-09 12:32:55 +01:00
parent 1fb82ecccc
commit d8a33d9894
2 changed files with 22 additions and 14 deletions

View File

@ -113,7 +113,7 @@ tag_client(struct tag *t, struct client *c)
else if(!(c->flags & CLIENT_TABBED))
layout_split_integrate(c, t->sel);
if(c->flags & CLIENT_TABMASTER)
if(c->flags & CLIENT_TABMASTER && c->prevtag)
{
struct client *cc;

View File

@ -185,31 +185,26 @@ wmfs_scan(void)
{
struct geo g;
struct client *c, *cc, *fc;
int i, n, rf;
struct screen *s;
int i, n, rf, nscreen;
int tag = -1, screen = -1, flags = -1;
unsigned long ir, il;
long *ret;
long *ret, *tret;
bool pstag = false;
XWindowAttributes wa;
Window usl, usl2, *w = NULL, tm, focus;
Atom rt;
SLIST_INIT(&W->h.client);
/* Set back selected tag */
/* Get previous selected tag to apply it at the end */
if(XGetWindowProperty(W->dpy, W->root, W->net_atom[wmfs_current_tag], 0, 32,
False, XA_CARDINAL, &rt, &rf, &ir, &il,
(unsigned char**)&ret)
(unsigned char**)&tret)
== Success && ret)
{
struct screen *s;
for(i = 0; i < (int)ir; ++i)
{
s = screen_gb_id(i);
tag_screen(s, tag_gb_id(s, ret[i]));
}
XFree(ret);
pstag = true;
nscreen = (int)ir;
}
/* Previous focused client before reload */
@ -309,7 +304,20 @@ wmfs_scan(void)
if((fc = client_gb_win(focus)) && fc != W->client)
client_focus(fc);
/* Set back selected tag */
if(pstag)
{
for(i = 0; i < (int)nscreen; ++i)
{
s = screen_gb_id(i);
tag_screen(screen_gb_id(i), tag_gb_id(s, tret[i]));
}
XFree(tret);
}
XFree(w);
XSync(W->dpy, false);
}
static void