resize: Use the right mouse cursor

Fix #1018
This commit is contained in:
Emmanuel Lepage Vallee 2016-09-10 23:56:10 -04:00
parent 7a4bdca9c2
commit 9b96b4b448
2 changed files with 32 additions and 5 deletions

View File

@ -196,15 +196,30 @@ function mouse.client.resize(c, corner, args)
return
end
-- Set some default arguments
local new_args = setmetatable(
{
include_sides = (not args) or args.include_sides ~= false
},
{
__index = args or {}
}
)
-- Move the mouse to the corner
if corner and aplace[corner] then
aplace[corner](capi.mouse, {parent=c})
else
local _
_, corner = aplace.closest_corner(capi.mouse, {parent=c})
_, corner = aplace.closest_corner(capi.mouse, {
parent = c,
include_sides = new_args.include_sides ~= false,
})
end
mouse.resize(c, "mouse.resize", args or {include_sides=true})
new_args.corner = corner
mouse.resize(c, "mouse.resize", new_args)
return corner
end

View File

@ -21,8 +21,16 @@ local req = "request::geometry"
local callbacks = {enter={}, move={}, leave={}}
local cursors = {
["mouse.move" ] = "fleur",
["mouse.resize" ] = "cross",
["mouse.move" ] = "fleur"
["mouse.resize_left" ] = "sb_h_double_arrow",
["mouse.resize_right" ] = "sb_h_double_arrow",
["mouse.resize_top" ] = "sb_v_double_arrow",
["mouse.resize_bottom" ] = "sb_v_double_arrow",
["mouse.resize_top_left" ] = "top_left_corner",
["mouse.resize_top_right" ] = "top_right_corner",
["mouse.resize_bottom_left" ] = "bottom_left_corner",
["mouse.resize_bottom_right"] = "bottom_right_corner",
}
--- The resize cursor name.
@ -138,8 +146,12 @@ local function handler(_, client, context, args) --luacheck: no unused_args
-- Select the cursor
local tcontext = context:gsub('[.]', '_')
local corner = args.corner and ("_".. args.corner) or ""
local cursor = beautiful["cursor_"..tcontext] or cursors[context] or "fleur"
local cursor = beautiful["cursor_"..tcontext]
or cursors[context..corner]
or cursors[context]
or "fleur"
-- Execute the placement function and use request::geometry
capi.mousegrabber.run(function (_mouse)