[hackers] [wmii] Fix flicker and delay when changing focus via the keyboard.

From: Kris Maglione <jg_AT_suckless.org>
Date: Sat Mar 03 22:04:11 2007

changeset: 1992:b477dc47352b
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Mar 03 16:01:38 2007 -0500
summary: Fix flicker and delay when changing focus via the keyboard.

diff -r 9c58487f3e3a -r b477dc47352b area.c
--- a/area.c Sat Mar 03 14:46:12 2007 -0500
+++ b/area.c Sat Mar 03 16:01:38 2007 -0500
@@ -426,10 +426,9 @@ select_area(Area *a, char *arg) {
         return nil;
 
 focus_frame:
+ focus_frame(p, False);
         frame_to_top(p);
- focus_frame(p, False);
         if(v == screen->sel)
                 restack_view(v);
- flush_masked_events(EnterWindowMask);
         return nil;
 }
diff -r 9c58487f3e3a -r b477dc47352b client.c
--- a/client.c Sat Mar 03 14:46:12 2007 -0500
+++ b/client.c Sat Mar 03 16:01:38 2007 -0500
@@ -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 -r 9c58487f3e3a -r b477dc47352b event.c
--- a/event.c Sat Mar 03 14:46:12 2007 -0500
+++ b/event.c Sat Mar 03 16:01:38 2007 -0500
@@ -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 @@ static void
 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 -r 9c58487f3e3a -r b477dc47352b frame.c
--- a/frame.c Sat Mar 03 14:46:12 2007 -0500
+++ b/frame.c Sat Mar 03 16:01:38 2007 -0500
@@ -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)
Received on Sat Mar 03 2007 - 22:04:11 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:08 UTC