From 0e1cba7e962b4a3f27a51a253368810bc0b12d7b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 12 Feb 2007 22:44:42 -0500 Subject: [PATCH] Set the focus properly when removing a client from the selected area --- Makefile | 4 ++-- area.c | 16 +++++++++++----- client.c | 9 ++++----- event.c | 1 - frame.c | 2 +- printevent.c | 4 ++++ 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index e9bc2742..d5c58b3e 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,8 @@ include config.mk -SRC = area.c bar.c client.c column.c draw.c event.c \ - frame.c fs.c geom.c key.c main.c mouse.c rule.c util.c view.c +SRC = area.c bar.c client.c column.c draw.c event.c frame.c fs.c \ + geom.c key.c main.c mouse.c rule.c util.c view.c OBJ = ${SRC:.c=.o} all: options wmiiwm diff --git a/area.c b/area.c index c9a81250..8531d868 100644 --- a/area.c +++ b/area.c @@ -171,10 +171,16 @@ detach_from_area(Area *a, Frame *f) { for(pr = a->frame; pr; pr = pr->anext) if(pr->anext == f) break; remove_frame(f); - if(a->sel == f) - a->sel = pr; - if(a->sel == nil) - a->sel = a->frame; + + if(a->sel == f) { + if(!pr) + pr = a->frame; + if((a->view == screen->sel) && + (a->view->sel == a) && (pr)) + focus_frame(pr, False); + else + a->sel = pr; + } if(!a->floating) { if(a->frame) @@ -334,7 +340,7 @@ focus_area(Area *a) { if(f) { draw_frame(f); - XSetInputFocus(blz.dpy, f->client->win, RevertToPointerRoot, CurrentTime); + XSetInputFocus(blz.dpy, f->client->win, RevertToParent, CurrentTime); }else XSetInputFocus(blz.dpy, screen->barwin, RevertToPointerRoot, CurrentTime); diff --git a/client.c b/client.c index e5046bf7..d1c48418 100644 --- a/client.c +++ b/client.c @@ -307,9 +307,9 @@ set_urgent(Client *c, Bool urgent, Bool write) { XWMHints *wmh; char *cwrite; - cwrite = "Manager"; + cwrite = "Client"; if(write) - cwrite = "Client"; + cwrite = "Manager"; if(urgent != c->urgent) { if(urgent) @@ -361,7 +361,7 @@ prop_client(Client *c, XPropertyEvent *e) { break; case XA_WM_HINTS: wmh = XGetWMHints(blz.dpy, c->win); - set_urgent(c, (wmh->flags & XUrgencyHint), False); + set_urgent(c, (wmh->flags & XUrgencyHint) != 0, False); XFree(wmh); break; } @@ -454,7 +454,6 @@ destroy_client(Client *c) { } update_client_views(c, &dummy); - update_views(); unmap_client(c, WithdrawnState); reparent_client(c, blz.root, c->rect.x, c->rect.y); @@ -591,8 +590,8 @@ resize_client(Client *c, XRectangle *r) { c->rect.width, c->rect.height); map_client(c); map_frame(c); + configure_client(c); } - configure_client(c); } void diff --git a/event.c b/event.c index 3a11c930..4926e612 100644 --- a/event.c +++ b/event.c @@ -6,7 +6,6 @@ #include #include #include -#include "printevent.h" uint flush_masked_events(long even_mask) { diff --git a/frame.c b/frame.c index a7f16693..e6202dec 100644 --- a/frame.c +++ b/frame.c @@ -181,7 +181,7 @@ focus_frame(Frame *f, Bool restack) { return; if(a == old_a) { - XSetInputFocus(blz.dpy, f->client->win, RevertToPointerRoot, CurrentTime); + XSetInputFocus(blz.dpy, f->client->win, RevertToParent, CurrentTime); draw_frame(f); } else if(old_in_a) diff --git a/printevent.c b/printevent.c index 70b29cc5..69ece087 100644 --- a/printevent.c +++ b/printevent.c @@ -43,6 +43,7 @@ can get it touch with me at the following location: ken@richsun.UUCP */ +#include "wmii.h" #include #include #include @@ -852,7 +853,10 @@ char *eventtype(XEvent *ev) void printevent(XEvent *e) { XAnyEvent *ev = (void*)e; + Client *c; + if(ev->window && (c = client_of_win(ev->window))) + printf("title=%s\n", c->name); printf("%3ld %-20s ", ev->serial, eventtype(e)); if(ev->send_event) printf("(sendevent) ");