[hackers] [wmii] Fixed some bugs in the new focus system.

From: Kris Maglione <jg_AT_suckless.org>
Date: Mon Feb 19 00:36:57 2007

changeset: 1902:b1d6b246e661
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sun Feb 18 18:31:58 2007 -0500
summary: Fixed some bugs in the new focus system.

diff -r a281f7f21692 -r b1d6b246e661 event.c
--- a/event.c Sun Feb 18 17:54:56 2007 -0500
+++ b/event.c Sun Feb 18 18:31:58 2007 -0500
@@ -291,6 +291,8 @@ focusin(XEvent *e) {
                         fprintf(stderr, "\t%s => %s\n", (screen->focus ? screen->focus->name : nil),
                                         c->name);
                 }
+ if(ev->mode == NotifyGrab)
+ screen->hasgrab = c;
                 screen->focus = c;
                 update_client_grab(c);
                 if(c->sel)
@@ -302,6 +304,13 @@ focusin(XEvent *e) {
                                         "<nil>");
                 }
                 screen->focus = nil;
+ }else if(ev->mode == NotifyGrab) {
+ c = screen->focus;
+ if(c) {
+ screen->focus = nil;
+ if(c->sel)
+ draw_frame(c->sel);
+ }
         }
 }
 
@@ -313,11 +322,17 @@ focusout(XEvent *e) {
         if(!((ev->detail == NotifyNonlinear)
            ||(ev->detail == NotifyNonlinearVirtual)))
                 return;
- if(ev->mode == NotifyWhileGrabbed)
- return;
+ if(ev->mode == NotifyUngrab)
+ screen->hasgrab = nil;
 
         c = client_of_win(ev->window);
         if(c) {
+ if(ev->mode == NotifyWhileGrabbed) {
+ if(screen->focus && screen->hasgrab != screen->focus)
+ screen->hasgrab = screen->focus;
+ if(screen->hasgrab == c)
+ return;
+ }
                 if(screen->focus == c)
                         screen->focus = nil;
                 update_client_grab(c);
diff -r a281f7f21692 -r b1d6b246e661 wmii.h
--- a/wmii.h Sun Feb 18 17:54:56 2007 -0500
+++ b/wmii.h Sun Feb 18 18:31:58 2007 -0500
@@ -223,6 +223,7 @@ struct WMScreen {
         Bar *rbar;
         View *sel;
         Client *focus;
+ Client *hasgrab;
         Window barwin;
 
         XRectangle rect;
Received on Mon Feb 19 2007 - 00:36:57 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:25 UTC