wmii

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

commit 4d456126186a66cf239ea4cb2099c59bc9615f7c
parent 5fbf900d959cdf03bede133f8d461f1d172e2bc4
Author: Kris Maglione <jg@suckless.org>
Date:   Tue, 13 Feb 2007 13:19:01 -0500

Fixed Denis' focus bug


Diffstat:
area.c | 11+++--------
client.c | 11+++++++++++
frame.c | 2+-
wmii.h | 2++
4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/area.c b/area.c @@ -175,8 +175,7 @@ detach_from_area(Area *a, Frame *f) { if(a->sel == f) { if(!pr) pr = a->frame; - if((a->view == screen->sel) && - (a->view->sel == a) && (pr)) + if((a->view->sel == a) && (pr)) focus_frame(pr, False); else a->sel = pr; @@ -320,10 +319,6 @@ focus_area(Area *a) { f = a->sel; old_a = v->sel; - /* XXX: Replace this with an assert later */ - if(a == old_a) - return; - v->sel = a; if(f) @@ -340,9 +335,9 @@ focus_area(Area *a) { if(f) { draw_frame(f); - XSetInputFocus(blz.dpy, f->client->win, RevertToParent, CurrentTime); + focus_client(f->client); }else - XSetInputFocus(blz.dpy, screen->barwin, RevertToPointerRoot, CurrentTime); + focus_client(nil); if(old_a && old_a->sel) draw_frame(old_a->sel); diff --git a/client.c b/client.c @@ -545,6 +545,17 @@ match_sizehints(Client *c, XRectangle *r, Bool floating, BlitzAlign sticky) { } void +focus_client(Client *c) { + if(screen->focus != c) { + if(c) + XSetInputFocus(blz.dpy, c->win, RevertToParent, CurrentTime); + else + XSetInputFocus(blz.dpy, screen->barwin, RevertToParent, CurrentTime); + screen->focus = c; + } +} + +void resize_client(Client *c, XRectangle *r) { Frame *f; Bool floating; 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, RevertToParent, CurrentTime); + focus_client(f->client); draw_frame(f); } else if(old_in_a) diff --git a/wmii.h b/wmii.h @@ -222,6 +222,7 @@ struct WMScreen { Bar *lbar; Bar *rbar; View *sel; + Client *focus; Window barwin; XRectangle rect; @@ -296,6 +297,7 @@ extern void focus_frame(Frame *f, Bool restack); extern void reparent_client(Client *c, Window w, int x, int y); extern void manage_client(Client *c); extern void focus(Client *c, Bool restack); +extern void focus_client(Client *c); extern void resize_client(Client *c, XRectangle *r); extern void match_sizehints(Client *c, XRectangle *r, Bool floating, BlitzAlign sticky); extern char *send_client(Frame *f, char *arg, Bool swap);