parent
7a4bdca9c2
commit
9b96b4b448
|
@ -196,15 +196,30 @@ function mouse.client.resize(c, corner, args)
|
||||||
return
|
return
|
||||||
end
|
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
|
-- Move the mouse to the corner
|
||||||
if corner and aplace[corner] then
|
if corner and aplace[corner] then
|
||||||
aplace[corner](capi.mouse, {parent=c})
|
aplace[corner](capi.mouse, {parent=c})
|
||||||
else
|
else
|
||||||
local _
|
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
|
end
|
||||||
|
|
||||||
mouse.resize(c, "mouse.resize", args or {include_sides=true})
|
new_args.corner = corner
|
||||||
|
|
||||||
|
mouse.resize(c, "mouse.resize", new_args)
|
||||||
|
|
||||||
return corner
|
return corner
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,8 +21,16 @@ local req = "request::geometry"
|
||||||
local callbacks = {enter={}, move={}, leave={}}
|
local callbacks = {enter={}, move={}, leave={}}
|
||||||
|
|
||||||
local cursors = {
|
local cursors = {
|
||||||
|
["mouse.move" ] = "fleur",
|
||||||
["mouse.resize" ] = "cross",
|
["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.
|
--- The resize cursor name.
|
||||||
|
@ -138,8 +146,12 @@ local function handler(_, client, context, args) --luacheck: no unused_args
|
||||||
|
|
||||||
-- Select the cursor
|
-- Select the cursor
|
||||||
local tcontext = context:gsub('[.]', '_')
|
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
|
-- Execute the placement function and use request::geometry
|
||||||
capi.mousegrabber.run(function (_mouse)
|
capi.mousegrabber.run(function (_mouse)
|
||||||
|
|
Loading…
Reference in New Issue