ewmh.lua: Fix the screen_change function

Fix this function so that it respects the recent changes in the ewmh.lua
code. It also incorporates some additional logic to respect the
border-width.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Ignas Anikevicius (gns_ank) 2012-03-02 13:39:28 +00:00 committed by Uli Schlachter
parent 524a0c1b35
commit 5f8f245ab6
1 changed files with 9 additions and 1 deletions

View File

@ -74,15 +74,23 @@ end
local function screen_change(window) local function screen_change(window)
if data[window] then if data[window] then
for _, reqtype in ipairs({ "maximized", "fullscreen" }) do for _, reqtype in ipairs({ "maximized_vertical", "maximized_horizontal", "fullscreen" }) do
if data[window][reqtype] then if data[window][reqtype] then
if data[window][reqtype].width then if data[window][reqtype].width then
data[window][reqtype].width = math.min(data[window][reqtype].width, data[window][reqtype].width = math.min(data[window][reqtype].width,
screen[window.screen].workarea.width) screen[window.screen].workarea.width)
if reqtype == "maximized_horizontal" then
local bw = window.border_width or 0
data[window][reqtype].width = data[window][reqtype].width - 2*bw
end
end end
if data[window][reqtype].height then if data[window][reqtype].height then
data[window][reqtype].height = math.min(data[window][reqtype].height, data[window][reqtype].height = math.min(data[window][reqtype].height,
screen[window.screen].workarea.height) screen[window.screen].workarea.height)
if reqtype == "maximized_vertical" then
local bw = window.border_width or 0
data[window][reqtype].height = data[window][reqtype].height - 2*bw
end
end end
if data[window][reqtype].screen then if data[window][reqtype].screen then
local from = screen[data[window][reqtype].screen].workarea local from = screen[data[window][reqtype].screen].workarea