From b658401b3307992aef9ff284c8b836a329cfd8b5 Mon Sep 17 00:00:00 2001 From: Josh Timmer <0ohexxo0@gmail.com> Date: Tue, 8 Sep 2015 20:19:55 -0400 Subject: [PATCH] Fixes for the silly case where a client's borders are bigger than its allotted space --- layout/cascade.lua | 2 ++ layout/cascadetile.lua | 4 ++++ layout/centerfair.lua | 8 ++++++++ layout/centerwork.lua | 4 ++++ layout/termfair.lua | 2 ++ 5 files changed, 20 insertions(+) diff --git a/layout/cascade.lua b/layout/cascade.lua index a7c0032..3d7598b 100644 --- a/layout/cascade.lua +++ b/layout/cascade.lua @@ -69,6 +69,8 @@ function cascade.arrange(p) g.y = wa.y + (i - 1) * cascade.offset_y g.width = wa.width - current_offset_x - 2*c.border_width g.height = wa.height - current_offset_y - 2*c.border_width + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end c:geometry(g) end diff --git a/layout/cascadetile.lua b/layout/cascadetile.lua index b4fbc65..3baf3e9 100644 --- a/layout/cascadetile.lua +++ b/layout/cascadetile.lua @@ -141,6 +141,8 @@ function cascadetile.arrange(p) g.width = g.width - useless_gap end end + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end c:geometry(g) -- Remaining clients stacked in slave column, new ones on top. @@ -161,6 +163,8 @@ function cascadetile.arrange(p) g.x = g.x + useless_gap g.y = g.y + useless_gap end + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end c:geometry(g) end end diff --git a/layout/centerfair.lua b/layout/centerfair.lua index d84f4a6..5022726 100644 --- a/layout/centerfair.lua +++ b/layout/centerfair.lua @@ -77,6 +77,8 @@ function centerfair.arrange(p) local c = cls[i] g.width = width - 2*c.border_width g.height = wa.height - 2*useless_gap - 2*c.border_width + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end g.x = offset_x + (i - 1) * (width + useless_gap) c:geometry(g) end @@ -87,6 +89,8 @@ function centerfair.arrange(p) local g = {} g.width = wa.width - (num_x - 1)*width - (num_x + 1)*useless_gap - 2*c.border_width g.height = wa.height - 2*useless_gap - 2*c.border_width + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end g.x = wa.x + useless_gap g.y = wa.y + useless_gap @@ -139,6 +143,8 @@ function centerfair.arrange(p) local c = cls[nclient] g.height = height - 2*c.border_width g.width = width - 2*c.border_width + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end c:geometry(g) nclient = nclient + 1 g.y = g.y + height + useless_gap @@ -146,6 +152,8 @@ function centerfair.arrange(p) local c = cls[nclient] g.height = wa.height - (num_y[i] + 1)*useless_gap - (num_y[i] - 1)*height - 2*c.border_width g.width = width - 2*c.border_width + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end c:geometry(g) nclient = nclient + 1 g.x = g.x + width + useless_gap diff --git a/layout/centerwork.lua b/layout/centerwork.lua index 1a45e2f..98a3ac2 100644 --- a/layout/centerwork.lua +++ b/layout/centerwork.lua @@ -60,6 +60,8 @@ function centerwork.arrange(p) g.height = wa.height - 2*useless_gap - 2*c.border_width g.width = mainwid - 2*c.border_width + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end g.x = wa.x + slaveLwid g.y = wa.y + useless_gap @@ -112,6 +114,8 @@ function centerwork.arrange(p) g.height = slaveBhei - 2*useless_gap - 2*c.border_width end + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end c:geometry(g) at = at + 1 diff --git a/layout/termfair.lua b/layout/termfair.lua index 6bb3e40..6aca99d 100644 --- a/layout/termfair.lua +++ b/layout/termfair.lua @@ -113,6 +113,8 @@ function termfair.arrange(p) g.y = g.y + (this_y + 1)*useless_gap end + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end c:geometry(g) remaining_clients = remaining_clients - 1