From c4efffc9d1d55a6b2440bda809babf415f547120 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Tue, 27 Oct 2009 21:12:55 +0100 Subject: [PATCH] fix mouse warping Signed-off-by: Pierre Habouzit --- config/awesome/rc.lua | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index 0d88625..bf69929 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -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 -- }}} -- 2.20.1