wmii

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

commit 92f1feda99cbc3541d2a05fecffc210970572c3e
parent c7813c07ca56c4fe2467371be01e4bf5adb990cb
Author: Kris Maglione <jg@suckless.org>
Date:   Sat,  3 Mar 2007 16:01:38 -0500

Fix flicker and delay when changing focus via the keyboard.

Diffstat:
area.c | 3+--
client.c | 3++-
event.c | 13++++++++++---
frame.c | 4++--
4 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/area.c b/area.c @@ -426,10 +426,9 @@ select_area(Area *a, char *arg) { return nil; focus_frame: - frame_to_top(p); focus_frame(p, False); + frame_to_top(p); if(v == screen->sel) restack_view(v); - flush_masked_events(EnterWindowMask); return nil; } diff --git a/client.c b/client.c @@ -254,7 +254,8 @@ focus(Client *c, Bool restack) { v = f->area->view; arrange_column(f->area, False); - focus_view(screen, v); + if(v != screen->sel) + focus_view(screen, v); focus_frame(c->sel, restack); } diff --git a/event.c b/event.c @@ -10,10 +10,10 @@ #include "printevent.h" uint -flush_masked_events(long even_mask) { +flush_masked_events(long event_mask) { XEvent ev; uint n = 0; - while(XCheckMaskEvent(blz.dpy, even_mask, &ev)) n++; + while(XCheckMaskEvent(blz.dpy, event_mask, &ev)) n++; return n; } @@ -220,6 +220,7 @@ print_focus(Client *c, char *to) { static void focusin(XEvent *e) { Client *c, *old; + XEvent me; XFocusChangeEvent *ev = &e->xfocus; /* Yes, we're focusing in on nothing, here. */ @@ -255,6 +256,12 @@ focusin(XEvent *e) { print_focus(nil, "<nil>"); screen->focus = nil; }else if(ev->mode == NotifyGrab) { + if(ev->window == blz.root) { + if(XCheckMaskEvent(blz.dpy, KeyPressMask, &me)) { + handler[me.xany.type](&me); + return; + } + } if((c = screen->focus)) { /* Some unmanaged window has focus */ print_focus(&c_magic, "<magic>"); @@ -284,7 +291,7 @@ focusout(XEvent *e) { screen->hasgrab = screen->focus; if(screen->hasgrab == c) return; - }else if(ev->mode != NotifyGrab) { + }else if(ev->mode != NotifyGrab && ev->window != blz.root) { if(screen->focus == c) { print_focus(&c_magic, "<magic>"); screen->focus = &c_magic; diff --git a/frame.c b/frame.c @@ -216,8 +216,8 @@ focus_frame(Frame *f, Bool restack) { old_in_a = a->sel; a->sel = f; - if(!a->floating && ((a->mode == Colstack) - || (a->mode == Colmax))) + if(!a->floating + && ((a->mode == Colstack) || (a->mode == Colmax))) arrange_column(a, False); if(a != old_a)