fix mouse warping
authorPierre Habouzit <madcoder@debian.org>
Tue, 27 Oct 2009 20:12:55 +0000 (21:12 +0100)
committerPierre Habouzit <madcoder@debian.org>
Tue, 27 Oct 2009 20:12:55 +0000 (21:12 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
config/awesome/rc.lua

index 0d88625..bf69929 100644 (file)
@@ -500,10 +500,19 @@ awful.rules.rules = {
 -- }}}
 -- {{{ Signals
 
+function warp_mouse(c)
+    local o = awful.mouse.client_under_pointer()
+    if not o or o ~= c then
+        local g = c:geometry()
+        mouse.coords({ x = g.x + 5, y = g.y + 5 }, true)
+    end
+end
+
 client.add_signal("focus", function (c)
     if not awful.client.ismarked(c) then
         c.border_color = beautiful.border_focus
     end
+    warp_mouse(c)
 end)
 
 client.add_signal("unfocus", function (c)
@@ -513,29 +522,15 @@ client.add_signal("unfocus", function (c)
 end)
 
 client.add_signal("manage", function (c, startup)
-    -- Enable sloppy focus
-    c:add_signal("mouse::enter", function(c)
-        client.focus = c
-    end)
-
-    -- Focus new clients
-    client.focus = c
+    c:add_signal("mouse::enter", function(c) client.focus = c end)
 end)
 
-function warp_mouse(screen)
-    local c = client.focus
-
-    if c then
-        local o = awful.mouse.client_under_pointer()
-        if not o or o ~= c then
-            local g = c:geometry()
-            mouse.coords { x = g.x + 5, y = g.y + 5 }
-        end
-    end
-end
-
 for s = 1, screen.count() do
-    -- screen[s]:add_signal("arrange", warp_mouse)
+    screen[s]:add_signal("arrange", function ()
+        if client.focus and client.focus.screen == s then
+            warp_mouse(client.focus)
+        end
+    end)
 end
 
 -- }}}