Fix flicker and delay when changing focus via the keyboard.

This commit is contained in:
Kris Maglione 2007-03-03 16:01:38 -05:00
parent c7813c07ca
commit 92f1feda99
4 changed files with 15 additions and 8 deletions

3
area.c
View File

@ -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;
}

View File

@ -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);
}

13
event.c
View File

@ -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;

View File

@ -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)