At 1256606721 time_t, Pierre Habouzit wrote:
> This was perfect and forced the mouse inside the window of newly created
> clients, or when changing the focus to a new client *AFTER* all the
> resizes had been done.
> 
> There is absolutely no sane way to do that right now unless I'm
> mistaken. I tried to do it in the "focus" hook, but it can trigger 100%
> CPUs when creating a new client, probably because moving the mouse can
> stupidly trigger a race with the resizing of windows.

There's no way to do that actually, because arrange() does not emit a
signal itself.
I propose the following patch to fix that, The awful part can be merged
in 3.4 branch if it seems enough to you.

diff --git a/awesomerc.lua.in b/awesomerc.lua.in
index 4b582d5..9aee01d 100644
--- a/awesomerc.lua.in
+++ b/awesomerc.lua.in
@@ -332,3 +332,17 @@ end)
 client.add_signal("focus", function(c) c.border_color = beautiful.border_focus 
end)
 client.add_signal("unfocus", function(c) c.border_color = 
beautiful.border_normal end)
 -- }}}
+
+local function warp_mouse(screen)
+    c = client.focus
+    if c then
+        local g = c:geometry()
+        mouse.coords { x = g.x + 5, y = g.y + 5 }
+    end
+end
+
+for s = 1, screen.count() do
+    screen[s]:add_signal("arrange", function (screen)
+        warp_mouse(screen)
+    end)
+end
diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in
index 963582e..5468269 100644
--- a/lib/awful/layout/init.lua.in
+++ b/lib/awful/layout/init.lua.in
@@ -82,6 +82,7 @@ function arrange(screen)
     p.clients = client.tiled(screen)
     p.screen = screen
     get(screen).arrange(p)
+    capi.screen[screen]:emit_signal("arrange")
     arrange_lock = false
 end
 
-- 
Julien Danjou
// ᐰ <[email protected]>   http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
// This is the end of my signature.

Attachment: signature.asc
Description: Digital signature

Reply via email to