Merge pull request #93 from blueyed/enforce-client-geometry

awful.ewmh: Enforce client geometry (FS#764, FS#1216)
This commit is contained in:
Daniel Hahler 2015-02-10 09:33:33 +01:00
commit 3ab3bb900a
1 changed files with 11 additions and 5 deletions

View File

@ -114,8 +114,13 @@ local function screen_change(window)
end end
end end
-- Update a client's settings when its border width changes -- Update a client's settings when its geometry changes, skipping signals
local function border_change(window) -- resulting from calls within.
local geometry_change_lock = false
local function geometry_change(window)
if geometry_change_lock then return end
geometry_change_lock = true
-- Fix up the geometry in case this window needs to cover the whole screen. -- Fix up the geometry in case this window needs to cover the whole screen.
local bw = window.border_width or 0 local bw = window.border_width or 0
local g = screen[window.screen].workarea local g = screen[window.screen].workarea
@ -126,11 +131,11 @@ local function border_change(window)
window:geometry { width = g.width - 2*bw, x = g.x } window:geometry { width = g.width - 2*bw, x = g.x }
end end
if window.fullscreen then if window.fullscreen then
-- This *will* cause an endless loop if some other property::border_width
-- signal dares to change the border width, too, so don't do that!
window.border_width = 0 window.border_width = 0
window:geometry(screen[window.screen].geometry) window:geometry(screen[window.screen].geometry)
end end
geometry_change_lock = false
end end
-- Activate a window -- Activate a window
@ -159,7 +164,8 @@ client.connect_signal("request::maximized_horizontal", maximized_horizontal)
client.connect_signal("request::maximized_vertical", maximized_vertical) client.connect_signal("request::maximized_vertical", maximized_vertical)
client.connect_signal("request::fullscreen", fullscreen) client.connect_signal("request::fullscreen", fullscreen)
client.connect_signal("property::screen", screen_change) client.connect_signal("property::screen", screen_change)
client.connect_signal("property::border_width", border_change) client.connect_signal("property::border_width", geometry_change)
client.connect_signal("property::geometry", geometry_change)
return ewmh return ewmh