Fix client_close & selected client management

This commit is contained in:
Martin Duquesnoy 2011-09-21 20:06:49 +02:00
parent 30fdd1a69d
commit 68aecac27c
4 changed files with 19 additions and 26 deletions

View File

@ -224,7 +224,10 @@ client_focus(struct client *c)
XSetInputFocus(W->dpy, c->win, RevertToPointerRoot, CurrentTime);
}
else
{
W->client = W->screen->seltag->sel = NULL;
XSetInputFocus(W->dpy, W->root, RevertToPointerRoot, CurrentTime);
}
}
/** Get a client name
@ -256,6 +259,7 @@ client_close(struct client *c)
{
bool canbedel;
int proto;
XEvent ev;
Atom *atom = NULL;
/* Event will call client_remove */
@ -271,18 +275,15 @@ client_close(struct client *c)
if(canbedel)
{
XEvent ev =
{
.type = ClientMessage,
.xclient.window = c->win,
.xclient.message_type = ATOM("WM_PROTOCOLS"),
.xclient.format = 32,
.xclient.data.l[0] = ATOM("WM_DELETE_WINDOW"),
.xclient.data.l[1] = CurrentTime
};
ev.type = ClientMessage;
ev.xclient.window = c->win;
ev.xclient.message_type = ATOM("WM_PROTOCOLS");
ev.xclient.format = 32;
ev.xclient.data.l[0] = ATOM("WM_DELETE_WINDOW");
ev.xclient.data.l[1] = CurrentTime;
XSendEvent(W->dpy, c->win, False, NoEventMask, &ev);
}
}
else
XKillClient(W->dpy, c->win);
}
@ -408,12 +409,6 @@ client_remove(struct client *c)
XSetErrorHandler(wmfs_error_handler_dummy);
XReparentWindow(W->dpy, c->win, W->root, c->geo.x, c->geo.y);
if(W->client == c)
{
W->client = NULL;
XSetInputFocus(W->dpy, W->root, RevertToPointerRoot, CurrentTime);
}
/* Remove from global client list */
SLIST_REMOVE(&W->h.client, c, client, next);
@ -426,6 +421,7 @@ client_remove(struct client *c)
XSetErrorHandler(wmfs_error_handler);
free(c);
c = NULL;
}
void

View File

@ -123,7 +123,7 @@ event_maprequest(XEvent *e)
return;
if(!client_gb_win(ev->window))
(struct client*)client_new(ev->window, &at);
client_new(ev->window, &at);
}
static void

View File

@ -73,7 +73,6 @@ layout_split_check_row_dir(struct client *c, struct client *g, Position p)
{
s += (LDIR(p) ? cc->geo.h : cc->geo.w);
if(s == cs)
return true;
if(s > cs)
@ -101,6 +100,7 @@ layout_split_arrange_closed(struct client *ghost)
bool b = false;
Position p;
/* Search for single parent for easy resize
* Example case:
* ___________ ___________

View File

@ -70,12 +70,12 @@ tag_screen(struct screen *s, struct tag *t)
WIN_STATE(t->frame, Map);
SLIST_FOREACH(c, &t->clients, tnext)
ewmh_set_wm_state(c->win, NormalState);
client_focus(t->sel);
}
s->seltag = t;
client_focus(t->sel);
infobar_elem_screen_update(s, ElemTag);
}
@ -91,13 +91,10 @@ tag_client(struct tag *t, struct client *c)
layout_split_arrange_closed(c);
SLIST_REMOVE(&c->tag->clients, c, client, tnext);
if(c->tag->sel == c)
{
c->tag->sel = NULL;
if(c->tag->sel == c || W->client == c)
client_focus(client_next(c));
}
SLIST_REMOVE(&c->tag->clients, c, client, tnext);
}
/*