ewmh: Use the request:: API in the border_width / wa callback
And stop listening to property::geometry, it's no longer needed. This also remove messing up the border without saving it somewhere. The concept is sound, but not the implementation.
This commit is contained in:
parent
d5b681502a
commit
631e75a757
|
@ -37,26 +37,24 @@ local ewmh = {
|
||||||
|
|
||||||
--- Update a client's settings when its geometry changes, skipping signals
|
--- Update a client's settings when its geometry changes, skipping signals
|
||||||
-- resulting from calls within.
|
-- resulting from calls within.
|
||||||
local geometry_change_lock = false
|
local repair_geometry_lock = false
|
||||||
local function geometry_change(window)
|
local function repair_geometry(window)
|
||||||
if geometry_change_lock then return end
|
if repair_geometry_lock then return end
|
||||||
geometry_change_lock = true
|
repair_geometry_lock = true
|
||||||
|
|
||||||
-- Fix up the geometry in case this window needs to cover the whole screen.
|
-- Re-apply the geometry locking properties to what they should be.
|
||||||
local bw = window.border_width or 0
|
for _, prop in ipairs {
|
||||||
local g = window.screen.workarea
|
"fullscreen", "maximized", "maximized_vertical", "maximized_horizontal"
|
||||||
if window.maximized_vertical or window.maximized then
|
} do
|
||||||
window:geometry { height = g.height - 2*bw, y = g.y }
|
if window[prop] then
|
||||||
end
|
window:emit_signal("request::geometry", prop, {
|
||||||
if window.maximized_horizontal or window.maximized then
|
store_geometry = false
|
||||||
window:geometry { width = g.width - 2*bw, x = g.x }
|
})
|
||||||
end
|
break
|
||||||
if window.fullscreen then
|
end
|
||||||
window.border_width = 0
|
|
||||||
window:geometry(window.screen.geometry)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
geometry_change_lock = false
|
repair_geometry_lock = false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Activate a window.
|
--- Activate a window.
|
||||||
|
@ -265,7 +263,10 @@ function ewmh.geometry(c, context, hints)
|
||||||
-- If the property is boolean and it correspond to the undo operation,
|
-- If the property is boolean and it correspond to the undo operation,
|
||||||
-- restore the stored geometry.
|
-- restore the stored geometry.
|
||||||
if state == false then
|
if state == false then
|
||||||
|
local original = repair_geometry_lock
|
||||||
|
repair_geometry_lock = true
|
||||||
aplace.restore(c,{context=context})
|
aplace.restore(c,{context=context})
|
||||||
|
repair_geometry_lock = original
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -283,11 +284,11 @@ client.connect_signal("request::activate", ewmh.activate)
|
||||||
client.connect_signal("request::tag", ewmh.tag)
|
client.connect_signal("request::tag", ewmh.tag)
|
||||||
client.connect_signal("request::urgent", ewmh.urgent)
|
client.connect_signal("request::urgent", ewmh.urgent)
|
||||||
client.connect_signal("request::geometry", ewmh.geometry)
|
client.connect_signal("request::geometry", ewmh.geometry)
|
||||||
client.connect_signal("property::border_width", geometry_change)
|
client.connect_signal("property::border_width", repair_geometry)
|
||||||
client.connect_signal("property::geometry", geometry_change)
|
client.connect_signal("property::screen", repair_geometry)
|
||||||
screen.connect_signal("property::workarea", function(s)
|
screen.connect_signal("property::workarea", function(s)
|
||||||
for _, c in pairs(client.get(s)) do
|
for _, c in pairs(client.get(s)) do
|
||||||
geometry_change(c)
|
repair_geometry(c)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -82,10 +82,11 @@ local steps = {
|
||||||
local bw = c.border_width
|
local bw = c.border_width
|
||||||
|
|
||||||
assert(c.fullscreen)
|
assert(c.fullscreen)
|
||||||
assert(new_geo.x-bw==sgeo.x)
|
|
||||||
assert(new_geo.y-bw==sgeo.y)
|
assert(new_geo.x==sgeo.x)
|
||||||
assert(new_geo.x+new_geo.width+bw==sgeo.x+sgeo.width)
|
assert(new_geo.y==sgeo.y)
|
||||||
assert(new_geo.y+new_geo.height+bw==sgeo.y+sgeo.height)
|
assert(new_geo.x+new_geo.width+2*bw==sgeo.x+sgeo.width)
|
||||||
|
assert(new_geo.y+new_geo.height+2*bw==sgeo.y+sgeo.height)
|
||||||
|
|
||||||
c.fullscreen = false
|
c.fullscreen = false
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue