Number 3 is the least intrusive way to handle maximized windows in a
decent way. Works pretty well, except for ooimpress (which was my test
case/annoyance) which insists in some cases on moving the window one
pixel down after requesting maximize (i've found no indication awesome
is doing this, nor does forcing all the apps to maximize on manage
reveal any other cases), which messes with sloppy focus (one pixel of
tiled window is exposed then). But with openoffice's track record that
is not surprising i suppose.
Maarten.
>From df2e3e383068287eb1683118400c110cbd73c396 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[EMAIL PROTECTED]>
Date: Fri, 5 Dec 2008 18:41:19 +0100
Subject: [PATCH] client: Sometimes you need to arrange before a client gets
unbanned.
Signed-off-by: Maarten Maathuis <[EMAIL PROTECTED]>
---
client.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/client.h b/client.h
index f9bc68a..e097d5a 100644
--- a/client.h
+++ b/client.h
@@ -41,7 +41,7 @@ DO_RCNT(client_t, client, client_delete)
#define client_need_arrange(c) \
do { \
if(!globalconf.screens[(c)->screen].need_arrange \
- && client_isvisible(c, (c)->screen)) \
+ && client_isvisible_exclude_banned(c, (c)->screen)) \
globalconf.screens[(c)->screen].need_arrange = true; \
} while(0)
--
1.6.0.4
>From 7604515e2c758a78518556b66d2ae832c3e83c92 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[EMAIL PROTECTED]>
Date: Fri, 5 Dec 2008 18:43:51 +0100
Subject: [PATCH] client: Don't show transient windows for invisible parents.
Signed-off-by: Maarten Maathuis <[EMAIL PROTECTED]>
---
client.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/client.h b/client.h
index e097d5a..67e94ea 100644
--- a/client.h
+++ b/client.h
@@ -135,6 +135,10 @@ client_isfixed(client_t *c)
static inline bool
client_isvisible_exclude_banned(client_t *c, int screen)
{
+ /* If the parent is invisible, then so should the child. */
+ if(c->transient_for)
+ if(!client_isvisible_exclude_banned(c->transient_for, screen))
+ return false;
return (!c->ishidden && !c->isminimized && client_maybevisible(c, screen));
}
--
1.6.0.4
>From b8d96e054d9436ed77d483b745eb86e8d0800206 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[EMAIL PROTECTED]>
Date: Sat, 6 Dec 2008 01:02:26 +0100
Subject: [PATCH] client: Fix handling of maximized windows.
Signed-off-by: Maarten Maathuis <[EMAIL PROTECTED]>
---
client.c | 6 +++++-
lib/awful/client.lua.in | 21 +++++++++++++++++++++
lib/awful/mouse.lua.in | 28 +++++++++++++++++++++-------
3 files changed, 47 insertions(+), 8 deletions(-)
diff --git a/client.c b/client.c
index f1c2426..f55371e 100644
--- a/client.c
+++ b/client.c
@@ -1284,7 +1284,11 @@ luaA_client_geometry(lua_State *L)
geometry.height = luaA_getopt_number(L, 2, "height",
(*c)->geometry.height);
}
- (*c)->ismaxhoriz = (*c)->ismaxvert = false;
+ if ((*c)->geometry.width != geometry.width || (*c)->geometry.x !=
geometry.x)
+ (*c)->ismaxhoriz = false;
+
+ if ((*c)->geometry.height != geometry.height || (*c)->geometry.y !=
geometry.y)
+ (*c)->ismaxvert = false;
client_resize(*c, geometry, (*c)->honorsizehints);
}
diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in
index 5ad971f..b2c7a98 100644
--- a/lib/awful/client.lua.in
+++ b/lib/awful/client.lua.in
@@ -572,4 +572,25 @@ hooks.unmanage.register(urgent.delete)
hooks.unmanage.register(floating.delete)
+-- Pseudo tiled beheaviour for fully maximized clients.
+-- The lowering is needed to see all tiled windows again.
+-- The raising is needed to see the maximized window again.
+-- Lowering upon unfocus would mess with floating/transient windows.
+hooks.focus.register(function(c)
+ if c.maximized_horizontal and c.maximized_vertical then
+ c:raise()
+ elseif not floating.get(c) then
+ -- Find all maximized windows and lower them
+ local tls = tag.selectedlist(c.screen)
+ for i, t in pairs(tls) do
+ local cls = t:clients()
+ for j, cot in pairs(cls) do
+ if cot.maximized_horizontal and cot.maximized_vertical then
+ cot:lower()
+ end
+ end
+ end
+ end
+end)
+
-- vim:
filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
diff --git a/lib/awful/mouse.lua.in b/lib/awful/mouse.lua.in
index a9443f2..444fe8b 100644
--- a/lib/awful/mouse.lua.in
+++ b/lib/awful/mouse.lua.in
@@ -79,9 +79,12 @@ end
-- @param snap The pixel to snap clients.
-- @param x The client x coordinate.
-- @param y The client y coordinate.
-function client.snap(c, snap, x, y)
+-- @param fixed_x True if the client isn't allowed to move in the x direction.
+-- @param fixed_y True if the client isn't allowed to move in the y direction.
+function client.snap(c, snap, x, y, fixed_x, fixed_y)
local snap = snap or 8
local c = c or client.focus
+ local cur_geom = c:geometry()
local geom = c:geometry()
geom.x = x or geom.x
geom.y = y or geom.y
@@ -94,6 +97,11 @@ function client.snap(c, snap, x, y)
geom = snap_outside(geom, snapper:geometry(), snap)
end
end
+
+ -- It's easiest to undo changes afterwards if they're not allowed
+ if fixed_x then geom.x = cur_geom.x end
+ if fixed_y then geom.y = cur_geom.y end
+
return geom
end
@@ -118,6 +126,9 @@ function client.move(c, snap)
local m_c = capi.mouse.coords()
local dist_x = m_c.x - orig.x
local dist_y = m_c.y - orig.y
+ -- Only allow moving in the non-maximized directions
+ local fixed_x = c.maximized_horizontal
+ local fixed_y = c.maximized_vertical
local function ug(c, prop)
if prop == "geometry" then
@@ -134,7 +145,7 @@ function client.move(c, snap)
if lay == layout.suit.floating or
aclient.floating.get(c) then
local x = mouse.x - dist_x
local y = mouse.y - dist_y
- c:geometry(client.snap(c, snap, x,
y))
+ c:geometry(client.snap(c, snap, x,
y, fixed_x, fixed_y))
if layout.get(c.screen) ~=
layout.suit.floating and not aclient.floating.get(c) then
hooks.property.register(ug)
end
@@ -273,16 +284,13 @@ local function client_resize_tiled(c, lay)
end, cursor)
end
-local function client_resize_floating(c, corner)
+local function client_resize_floating(c, corner, fixed_x, fixed_y)
local corner, x, y = client.corner(c, corner)
- local fixed_x, fixed_y
local g = c:geometry()
-- Warp mouse pointer
capi.mouse.coords({ x = x, y = y })
- local fixed_x, fixed_y
-
capi.mousegrabber.run(function (mouse)
for k, v in ipairs(mouse.buttons) do
if v then
@@ -312,6 +320,8 @@ local function client_resize_floating(c, corner)
end
if ng.width <= 0 then ng.width = nil end
if ng.height <= 0 then ng.height = nil
end
+ if fixed_x then ng.width = width end
+ if fixed_y then ng.height = height end
c:geometry({ width = ng.width, height =
ng.height })
-- Get real geometry that has been
applied
-- in case we honor size hints
@@ -352,10 +362,14 @@ function client.resize(c, corner)
return
end
+ -- Do not allow maximized clients to be resized by mouse
+ local fixed_x = c.maximized_horizontal
+ local fixed_y = c.maximized_vertical
+
local lay = layout.get(c.screen)
if lay == layout.suit.floating or aclient.floating.get(c) then
- return client_resize_floating(c, corner)
+ return client_resize_floating(c, corner, fixed_x, fixed_y)
elseif lay == layout.suit.tile
or lay == layout.suit.tile.left
or lay == layout.suit.tile.top
--
1.6.0.4