On 2009-02-08 21:52 +0100, Daniel Clemente wrote:
> 
> Hi; thanks for the helpful explanations.
> 
>   I tried doing that change and it stayed the same. I also tried doing a 
> sleep(2) before sending the WM_TAKE_FOCUS (with the +2s timestamp), but 
> without success.
> 
>   What did work is this:

Try the attached patch. (Disclaimer: I haven't particularly tried it; 
just quickly threw it together.)

-- 
Stop Gnomes and other pests! Purchase Windows today!

diff -rN -u old-ion-3/ioncore/clientwin.c new-ion-3/ioncore/clientwin.c
--- old-ion-3/ioncore/clientwin.c       2009-02-09 00:35:07.380883290 +0200
+++ new-ion-3/ioncore/clientwin.c       2009-02-09 00:35:07.488878930 +0200
@@ -1015,10 +1015,11 @@
 {
     if(cwin->flags&CLIENTWIN_P_WM_TAKE_FOCUS){
         Time stmp=ioncore_get_timestamp();
+        region_finalise_focusing((WRegion*)cwin, cwin->win, warp, stmp);
         send_clientmsg(cwin->win, ioncore_g.atom_wm_take_focus, stmp);
+    }else{
+        region_finalise_focusing((WRegion*)cwin, cwin->win, warp, CurrentTime);
     }
-
-    region_finalise_focusing((WRegion*)cwin, cwin->win, warp);
     
     XSync(ioncore_g.dpy, 0);
 }
diff -rN -u old-ion-3/ioncore/focus.c new-ion-3/ioncore/focus.c
--- old-ion-3/ioncore/focus.c   2009-02-09 00:35:07.368883774 +0200
+++ new-ion-3/ioncore/focus.c   2009-02-09 00:35:07.484879092 +0200
@@ -347,7 +347,7 @@
 /*Time ioncore_focus_time=CurrentTime;*/
 
 
-void region_finalise_focusing(WRegion* reg, Window win, bool warp)
+void region_finalise_focusing(WRegion* reg, Window win, bool warp, Time time)
 {
     if(warp)
         region_do_warp(reg);
@@ -356,10 +356,7 @@
         return;
     
     region_set_await_focus(reg);
-    /*xwindow_do_set_focus(win);*/
-    XSetInputFocus(ioncore_g.dpy, win, RevertToParent, 
-                   CurrentTime/*ioncore_focus_time*/);
-    /*ioncore_focus_time=CurrentTime;*/
+    XSetInputFocus(ioncore_g.dpy, win, RevertToParent, time);
 }
 
 
diff -rN -u old-ion-3/ioncore/focus.h new-ion-3/ioncore/focus.h
--- old-ion-3/ioncore/focus.h   2009-02-09 00:35:07.368883774 +0200
+++ new-ion-3/ioncore/focus.h   2009-02-09 00:35:07.484879092 +0200
@@ -23,7 +23,7 @@
 extern void region_warp(WRegion *reg); /* maybewarp TRUE */
 extern void region_set_focus(WRegion *reg); /* maybewarp FALSE */
 
-extern void region_finalise_focusing(WRegion* reg, Window win, bool warp);
+extern void region_finalise_focusing(WRegion* reg, Window win, bool warp, Time 
time);
 
 DYNFUN void region_do_set_focus(WRegion *reg, bool warp);
 extern void region_do_warp(WRegion *reg);
diff -rN -u old-ion-3/ioncore/group.c new-ion-3/ioncore/group.c
--- old-ion-3/ioncore/group.c   2009-02-09 00:35:07.272887653 +0200
+++ new-ion-3/ioncore/group.c   2009-02-09 00:35:07.460880061 +0200
@@ -241,7 +241,7 @@
     if(st!=NULL && st->reg!=NULL)
         region_do_set_focus(st->reg, warp);
     else
-        region_finalise_focusing((WRegion*)ws, ws->dummywin, warp);
+        region_finalise_focusing((WRegion*)ws, ws->dummywin, warp, 
CurrentTime);
 }
 
 
diff -rN -u old-ion-3/ioncore/window.c new-ion-3/ioncore/window.c
--- old-ion-3/ioncore/window.c  2009-02-09 00:35:07.332885230 +0200
+++ new-ion-3/ioncore/window.c  2009-02-09 00:35:07.480879252 +0200
@@ -182,7 +182,7 @@
 
 void window_do_set_focus(WWindow *wwin, bool warp)
 {
-    region_finalise_focusing((WRegion*)wwin, wwin->win, warp);
+    region_finalise_focusing((WRegion*)wwin, wwin->win, warp, CurrentTime);
 }
 
 
diff -rN -u old-ion-3/mod_tiling/tiling.c new-ion-3/mod_tiling/tiling.c
--- old-ion-3/mod_tiling/tiling.c       2009-02-09 00:35:07.124893627 +0200
+++ new-ion-3/mod_tiling/tiling.c       2009-02-09 00:35:07.416881837 +0200
@@ -158,7 +158,7 @@
 
 void tiling_fallback_focus(WTiling *ws, bool warp)
 {
-    region_finalise_focusing((WRegion*)ws, ws->dummywin, warp);
+    region_finalise_focusing((WRegion*)ws, ws->dummywin, warp, CurrentTime);
 }
 
 

Reply via email to