From f0fe2e03c6436784bb29f95e77b51b405b96d167 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 26 Aug 2008 10:47:01 +0200 Subject: [PATCH] awful: implement under_mouse placement Signed-off-by: Julien Danjou --- lib/awful.lua.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/awful.lua.in b/lib/awful.lua.in index fb047417..e77e0076 100644 --- a/lib/awful.lua.in +++ b/lib/awful.lua.in @@ -71,6 +71,7 @@ widget.tasklist.label = {} client.urgent = {} client.urgent.stack = {} client.urgent.stack.data = {} +placement = {} --- Strip alpha part of color. -- @param color The color. @@ -1605,6 +1606,15 @@ function widget.button(args) return w end +--- Place the client under the mouse. +-- @param c The client. +function placement.under_mouse(c) + local c_coords = c:coords() + local m_coords = capi.mouse.coords() + c:coords({ x = m_coords.x - c_coords.width / 2, + y = m_coords.y - c_coords.height / 2 }) +end + -- Register standards hooks hooks.arrange.register(tag.history.update)