wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 0e1cba7e962b4a3f27a51a253368810bc0b12d7b
parent 98d10dccace71d10da618e3631f3c351834c132b
Author: Kris Maglione <jg@suckless.org>
Date:   Mon, 12 Feb 2007 22:44:42 -0500

Set the focus properly when removing a client from the selected area


Diffstat:
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 @@ -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 @@ -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 @@ -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 @@ -6,7 +6,6 @@ #include <stdlib.h> #include <string.h> #include <X11/keysym.h> -#include "printevent.h" uint flush_masked_events(long even_mask) { diff --git 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 @@ -43,6 +43,7 @@ can get it touch with me at the following location: ken@richsun.UUCP */ +#include "wmii.h" #include <stdio.h> #include <X11/Intrinsic.h> #include <X11/Xproto.h> @@ -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) ");