mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
Partial revert of "awful.client: use signal and geometry attributes"
Partial revert of 1da49640b5
.
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
e25a8ba6f4
commit
b3214e589e
1 changed files with 16 additions and 22 deletions
|
@ -77,8 +77,9 @@ end
|
|||
|
||||
--- Adds client to urgent stack.
|
||||
-- @param c The client object.
|
||||
function urgent.add(c)
|
||||
if c.urgent then
|
||||
-- @param prop The property which is updated.
|
||||
function urgent.add(c, prop)
|
||||
if type(c) == "client" and prop == "urgent" and c.urgent then
|
||||
table.insert(data.urgent, c)
|
||||
end
|
||||
end
|
||||
|
@ -288,7 +289,7 @@ end
|
|||
local function get_client_in_direction(dir, c)
|
||||
local sel = c or capi.client.focus
|
||||
if sel then
|
||||
local geometry = { x = c.x, y = c.y, width = c.width, height = c.height }
|
||||
local geometry = sel:geometry()
|
||||
local dist, dist_min
|
||||
local target = nil
|
||||
local cls = visible(sel.screen)
|
||||
|
@ -296,11 +297,10 @@ local function get_client_in_direction(dir, c)
|
|||
-- We check each client.
|
||||
for i, c in ipairs(cls) do
|
||||
-- Check geometry to see if client is located in the right direction.
|
||||
local g = { x = c.x, y = c.y, width = c.width, height = c.height }
|
||||
if is_in_direction(dir, geometry, g) then
|
||||
if is_in_direction(dir, geometry, c:geometry()) then
|
||||
|
||||
-- Calculate distance between focused client and checked client.
|
||||
dist = calculate_distance(dir, geometry, g)
|
||||
dist = calculate_distance(dir, geometry, c:geometry())
|
||||
|
||||
-- If distance is shorter then keep the client.
|
||||
if not target or dist < dist_min then
|
||||
|
@ -410,11 +410,13 @@ end
|
|||
-- @param h The relative height.
|
||||
-- @param c The optional client, otherwise focused one is used.
|
||||
function moveresize(x, y, w, h, c)
|
||||
local c = c or capi.client.focus
|
||||
c.x = c.x + x
|
||||
c.y = c.y + y
|
||||
c.width = c.width + width
|
||||
c.height = c.height + height
|
||||
local sel = c or capi.client.focus
|
||||
local geometry = sel:geometry()
|
||||
geometry['x'] = geometry['x'] + x
|
||||
geometry['y'] = geometry['y'] + y
|
||||
geometry['width'] = geometry['width'] + w
|
||||
geometry['height'] = geometry['height'] + h
|
||||
sel:geometry(geometry)
|
||||
end
|
||||
|
||||
--- Move a client to a tag.
|
||||
|
@ -555,28 +557,20 @@ function floating.set(c, s)
|
|||
property.set(c, "floating", s)
|
||||
local screen = c.screen
|
||||
if s == true then
|
||||
local g = property.get(c, "floating_geometry")
|
||||
c.x = g.x
|
||||
c.y = g.y
|
||||
c.width = g.width
|
||||
c.height = g.height
|
||||
c:geometry(property.get(c, "floating_geometry"))
|
||||
end
|
||||
c.screen = screen
|
||||
end
|
||||
end
|
||||
|
||||
capi.client.add_signal("manage", function (c)
|
||||
property.set(c, "floating_geometry", { x = c.x, y = c.y, width = c.width, height = c.height })
|
||||
end)
|
||||
|
||||
local function store_floating_geometry(c)
|
||||
if floating.get(c) then
|
||||
property.set(c, "floating_geometry",
|
||||
{ x = c.x, y = c.y, width = c.width, height = c.height })
|
||||
property.set(c, "floating_geometry", c:geometry())
|
||||
end
|
||||
end
|
||||
|
||||
capi.client.add_signal("manage", function(c)
|
||||
property.set(c, "floating_geometry", c:geometry())
|
||||
c:add_signal("property::x", store_floating_geometry)
|
||||
c:add_signal("property::y", store_floating_geometry)
|
||||
c:add_signal("property::width", store_floating_geometry)
|
||||
|
|
Loading…
Reference in a new issue