layout: Handle tiled client request::geometry 'mouse.move'

This commit is contained in:
Emmanuel Lepage Vallee 2016-04-28 16:47:29 -04:00
parent 688021d087
commit b5a1a8d6e5
1 changed files with 22 additions and 0 deletions

View File

@ -241,6 +241,28 @@ capi.client.connect_signal("list", function()
end
end)
--- Default handler for tiled clients request::geometry with the `mouse.move`
-- context.
-- @tparam client c The client
-- @tparam string context The context
-- @tparam table hints Additional hints
function layout.move_handler(c, context, hints) --luacheck: no unused args
-- Quit if it isn't a mouse.move on a tiled layout, that's handled elsewhere
if c.floating then return end
if context ~= "mouse.move" then return end
local l = c.screen.selected_tag and c.screen.selected_tag.layout or nil
if l == layout.suit.floating then return end
local c_u_m = capi.mouse.current_client
if c_u_m and not c_u_m.floating then
if c_u_m ~= c then
c:swap(c_u_m)
end
end
end
capi.client.connect_signal("request::geometry", layout.move_handler)
return layout
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80