On Thu, Feb 27, 2003 at 10:35:23AM +0200, Tuomo Valkonen wrote:
> It seems I need to rethink all the focusing code *sigh*. 

Here's another patch. It seems working to me, but I'm sure I've
missed some case...

-- 
Tuomo
Only in .: acsystem.mk.in
Only in .: config.cache
Only in .: config.log
Only in .: config.status
Only in .: configure
Only in .: configure.in
Only in ./man: ion.1x
Only in .: pwm
Only in ./src: ion
diff -u -r -x CVS -x '*.o' -x '*.a' ../../r/ion/src/splitframe.c ./src/splitframe.c
--- ../../r/ion/src/splitframe.c        2003-02-23 20:55:00.000000000 +0200
+++ ./src/splitframe.c  2003-02-27 21:44:16.000000000 +0200
@@ -206,7 +206,7 @@
                if(frame->managed_count==0)
                        warn("Could not move all managed objects.");
        }
-       
+
        if(other!=NULL && was_active)
                set_focus(other);
                                 
diff -u -r -x CVS -x '*.o' -x '*.a' ../../r/ion/src/workspace.c ./src/workspace.c
--- ../../r/ion/src/workspace.c 2003-02-23 02:38:16.000000000 +0200
+++ ./src/workspace.c   2003-02-27 08:09:12.000000000 +0200
@@ -35,6 +35,11 @@
 static void focus_workspace(WWorkspace *ws, bool warp);
 static bool workspace_save_to_file(WWorkspace *ws, FILE *file, int lvl);
 
+bool workspace_display_managed(WWorkspace *ws, WRegion *reg)
+{
+       return TRUE;
+}
+
 
 static DynFunTab workspace_dynfuntab[]={
        {fit_region, fit_workspace},
@@ -49,7 +54,8 @@
        {region_request_managed_geom, workspace_request_managed_geom},
        {region_managed_activated, workspace_managed_activated},
        {region_remove_managed, workspace_remove_managed},
-
+       {(DynFun*)region_display_managed, (DynFun*)workspace_display_managed},
+       
        {(DynFun*)region_do_find_new_manager, (DynFun*)workspace_do_find_new_manager},
        
        {(DynFun*)region_save_to_file, (DynFun*)workspace_save_to_file},
diff -u -r -x CVS -x '*.o' -x '*.a' ../../r/ion/wmcore/clientwin.c ./wmcore/clientwin.c
--- ../../r/ion/wmcore/clientwin.c      2003-02-23 15:45:43.000000000 +0200
+++ ./wmcore/clientwin.c        2003-02-27 01:39:45.000000000 +0200
@@ -701,9 +701,6 @@
        
        convert_geom(cwin, geom, &wingeom, rq);
        
-       cwin->win_geom=wingeom;
-       REGION_GEOM(cwin)=geom;
-       
        /* XMoveResizeWindow won't send a ConfigureNotify event if the
         * geometry has not changed and some programs expect that.
         */
@@ -718,6 +715,9 @@
                        return;
                }
        }
+
+       cwin->win_geom=wingeom;
+       REGION_GEOM(cwin)=geom;
        
        if(np!=NULL){
                do_reparent_clientwin(cwin, np->win,
diff -u -r -x CVS -x '*.o' -x '*.a' ../../r/ion/wmcore/common.h ./wmcore/common.h
--- ../../r/ion/wmcore/common.h 2003-01-31 20:16:34.000000000 +0200
+++ ./wmcore/common.h   2003-02-27 21:33:02.000000000 +0200
@@ -43,4 +43,10 @@
 
 extern void pgeom(const char *n, WRectangle g);
 
+#if 0
+#define D(X) X
+#else
+#define D(X)
+#endif
+
 #endif /* WMCORE_COMMON_H */
diff -u -r -x CVS -x '*.o' -x '*.a' ../../r/ion/wmcore/eventh.c ./wmcore/eventh.c
--- ../../r/ion/wmcore/eventh.c 2003-02-25 21:29:55.000000000 +0200
+++ ./wmcore/eventh.c   2003-02-27 21:32:34.000000000 +0200
@@ -76,10 +76,12 @@
                                                  EnterWindowMask|FocusChangeMask, 
&ev)){
                if(ev.type==FocusOut)
                        handle_focus_out(&(ev.xfocus));
+               else if(ev.type==FocusIn)
+                       handle_focus_in(&(ev.xfocus));
                
                /*if(ev.type!=FocusIn)
                        continue;*/
-               
+               #if 0
                r=FIND_WINDOW_T(ev.xany.window, WRegion);
                
                while(r!=NULL){
@@ -92,6 +94,7 @@
                        }
                        r=FIND_PARENT1(r, WRegion);
                }
+               #endif
        }
 }
 
@@ -182,16 +185,19 @@
                execute_deferred();
                
                XSync(wglobal.dpy, False);
-               
-               if(wglobal.focus_next!=NULL){
+               if(wglobal.focus_next!=NULL && wglobal.input_mode==INPUT_NORMAL){
                        skip_focusenter_but(wglobal.focus_next);
                        do_set_focus(wglobal.focus_next, wglobal.warp_next);
                        wglobal.focus_next=NULL;
                        wglobal.warp_next=FALSE;
-               }else if(wglobal.grab_released){
-                       wglobal.grab_released=FALSE;
+               }
+               #if 0
+               else 
+                       if(wglobal.grab_released /*|| wglobal.focus_next!=NULL*/){
                        skip_focusenter_but(NULL);
                }
+               #endif
+               wglobal.grab_released=FALSE;
        }
 }
 
@@ -401,19 +407,18 @@
 {
        XEnterWindowEvent *eev=&(ev->xcrossing);
        WRegion *reg=NULL, *mgr;
-
+#if 0
        while(XCheckMaskEvent(wglobal.dpy, EnterWindowMask, ev)){
                /* We're only interested in the latest enter event */
        }
-
-       /*
-       if((eev->mode!=NotifyNormal && eev->mode!=NotifyUngrab) &&
-          !wglobal.warp_enabled)
+#endif
+       if(wglobal.input_mode!=INPUT_NORMAL)
                return;
-       */
-       
-       /*
-       if(eev->window==eev->root){
+/*
+       if(eev->mode!=NotifyNormal && !wglobal.warp_enabled)
+               return;
+*/
+/*     if(eev->window==eev->root){
                return;
        }*/
        
@@ -451,12 +456,23 @@
        if(reg==NULL)
                return;
 
-       /*fprintf(stderr, "FI: %s %p %d %d\n", WOBJ_TYPESTR(reg), reg, ev->mode, 
ev->detail);*/
+       D(fprintf(stderr, "FI: %s %p %d %d\n", WOBJ_TYPESTR(reg), reg, ev->mode, 
ev->detail);)
 
     if(ev->mode==NotifyGrab)/* || ev->mode==NotifyWhileGrabbed)*/
        /*if(ev->mode!=NotifyNormal && ev->mode!=NotifyWhileGrabbed)*/
                return;
        
+       if(wglobal.focus_next!=NULL){
+               WRegion *r2=reg;
+               while(r2!=NULL){
+                       if(r2==wglobal.focus_next)
+                               break;
+                       r2=FIND_PARENT1(r2, WRegion);
+               }
+               if(r2==NULL)
+                       return;
+       }
+       
        if(WTHING_IS(reg, WScreen)){
                if(ev->detail!=NotifyInferior){
                        /* Restore focus */
@@ -496,7 +512,7 @@
        if(reg==NULL)
                return;
 
-       /*fprintf(stderr, "FO: %s %p %d %d\n", WOBJ_TYPESTR(reg), reg, ev->mode, 
ev->detail);*/
+       D(fprintf(stderr, "FO: %s %p %d %d\n", WOBJ_TYPESTR(reg), reg, ev->mode, 
ev->detail);)
 
        if(ev->mode==NotifyGrab)/* || ev->mode==NotifyWhileGrabbed)*/
        /*if(ev->mode!=NotifyNormal && ev->mode!=NotifyWhileGrabbed)*/
diff -u -r -x CVS -x '*.o' -x '*.a' ../../r/ion/wmcore/region.c ./wmcore/region.c
--- ../../r/ion/wmcore/region.c 2003-02-23 02:38:17.000000000 +0200
+++ ./wmcore/region.c   2003-02-27 21:33:04.000000000 +0200
@@ -17,12 +17,6 @@
 #include "names.h"
 
 
-#if 0
-#define D(X) X
-#else
-#define D(X)
-#endif
-
 #define FOR_ALL_SUBREGIONS(REG, SUB) \
        FOR_ALL_TYPED(REG, SUB, WRegion)
 

Reply via email to