On 12/06/2008 01:15 AM, Maarten Maathuis wrote:
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.
Two more patches, one to avoid taskbars keeping their original size when
struts change, the other to resize the taskbar when clients with struts
are (un)banned.
Maarten.
>From 66cba487b5e1e0760d591ee390dc2c9605e95155 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[EMAIL PROTECTED]>
Date: Sat, 6 Dec 2008 23:24:12 +0100
Subject: [PATCH] wibox: Always resize, otherwise your wiboxes are too large or
small when the workarea changes.
Signed-off-by: Maarten Maathuis <[EMAIL PROTECTED]>
---
wibox.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/wibox.c b/wibox.c
index bd3b8c6..ebe06dc 100644
--- a/wibox.c
+++ b/wibox.c
@@ -359,12 +359,14 @@ wibox_position_update(wibox_t *wibox)
}
}
+ /* Width and height are always chosen as optimal size given size
constraints.
+ * Anything else produces either wiboxes that are too small or too large.
+ */
switch(wibox->position)
{
case Right:
- wingeom.height = wibox->sw.geometry.height > 0 ?
- wibox->sw.geometry.height : area.height - 2 *
wibox->sw.border.width;
- wingeom.width = wibox->sw.geometry.width > 0 ?
wibox->sw.geometry.width : 1.5 * globalconf.font->height;
+ wingeom.height = area.height - 2 * wibox->sw.border.width;
+ wingeom.width = 1.5 * globalconf.font->height;
wingeom.x = area.x + area.width - wingeom.width - 2 *
wibox->sw.border.width;
switch(wibox->align)
{
@@ -380,9 +382,8 @@ wibox_position_update(wibox_t *wibox)
}
break;
case Left:
- wingeom.height = wibox->sw.geometry.height > 0 ?
- wibox->sw.geometry.height : area.height - 2 *
wibox->sw.border.width;
- wingeom.width = wibox->sw.geometry.width > 0 ?
wibox->sw.geometry.width : 1.5 * globalconf.font->height;
+ wingeom.height = area.height - 2 * wibox->sw.border.width;
+ wingeom.width = 1.5 * globalconf.font->height;
wingeom.x = area.x;
switch(wibox->align)
{
@@ -397,9 +398,8 @@ wibox_position_update(wibox_t *wibox)
}
break;
case Bottom:
- wingeom.height = wibox->sw.geometry.height > 0 ?
wibox->sw.geometry.height : 1.5 * globalconf.font->height;
- wingeom.width = wibox->sw.geometry.width > 0 ?
- wibox->sw.geometry.width : area.width - 2 * wibox->sw.border.width;
+ wingeom.height = 1.5 * globalconf.font->height;
+ wingeom.width = area.width - 2 * wibox->sw.border.width;
wingeom.y = (area.y + area.height) - wingeom.height - 2 *
wibox->sw.border.width;
wingeom.x = area.x;
switch(wibox->align)
@@ -415,9 +415,8 @@ wibox_position_update(wibox_t *wibox)
}
break;
case Top:
- wingeom.height = wibox->sw.geometry.height > 0 ?
wibox->sw.geometry.height : 1.5 * globalconf.font->height;
- wingeom.width = wibox->sw.geometry.width > 0 ?
- wibox->sw.geometry.width : area.width - 2 * wibox->sw.border.width;
+ wingeom.height = 1.5 * globalconf.font->height;
+ wingeom.width = area.width - 2 * wibox->sw.border.width;
wingeom.x = area.x;
wingeom.y = area.y;
switch(wibox->align)
--
1.6.0.4
>From 36af5fc73e3a0b3f54c491029414641c98606d9a Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[EMAIL PROTECTED]>
Date: Sat, 6 Dec 2008 23:41:33 +0100
Subject: [PATCH] client: Also check for struts on client_{ban,unban}
Signed-off-by: Maarten Maathuis <[EMAIL PROTECTED]>
---
client.c | 17 ++++++++++-------
event.c | 9 ++-------
ewmh.c | 9 ++-------
wibox.c | 13 +++++++++++++
wibox.h | 1 +
5 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/client.c b/client.c
index f55371e..50064d0 100644
--- a/client.c
+++ b/client.c
@@ -181,6 +181,10 @@ client_ban(client_t *c)
request);
c->isbanned = true;
+
+ /* All the wiboxes (may) need to be repositioned. */
+ if(client_hasstrut(c))
+ wibox_update_positions();
}
/* Wait until the last moment to take away the focus from the window. */
@@ -935,6 +939,10 @@ client_unban(client_t *c)
window_configure(c->win, c->geometry, c->border);
c->isbanned = false;
+
+ /* All the wiboxes (may) need to be repositioned. */
+ if(client_hasstrut(c))
+ wibox_update_positions();
}
}
@@ -986,14 +994,9 @@ client_unmanage(client_t *c)
xcb_delete_property(globalconf.connection, c->win, _AWESOME_TAGS);
xcb_delete_property(globalconf.connection, c->win, _AWESOME_FLOATING);
+ /* All the wiboxes (may) need to be repositioned. */
if(client_hasstrut(c))
- /* All the wiboxes (may) need to be repositioned */
- for(int screen = 0; screen < globalconf.nscreen; screen++)
- for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++)
- {
- wibox_t *s = globalconf.screens[screen].wiboxes.tab[i];
- wibox_position_update(s);
- }
+ wibox_update_positions();
/* set client as invalid */
c->invalid = true;
diff --git a/event.c b/event.c
index bf30476..93dc822 100644
--- a/event.c
+++ b/event.c
@@ -222,14 +222,9 @@ event_handle_configurerequest(void *data __attribute__
((unused)),
|| geometry.width != c->geometry.width || geometry.height !=
c->geometry.height)
{
client_resize(c, geometry, false);
+ /* All the wiboxes (may) need to be repositioned. */
if(client_hasstrut(c))
- /* All the wiboxes (may) need to be repositioned */
- for(int screen = 0; screen < globalconf.nscreen; screen++)
- for(int i = 0; i < globalconf.screens[screen].wiboxes.len;
i++)
- {
- wibox_t *s = globalconf.screens[screen].wiboxes.tab[i];
- wibox_position_update(s);
- }
+ wibox_update_positions();
client_need_arrange(c);
}
else
diff --git a/ewmh.c b/ewmh.c
index aec69ab..2eabdae 100644
--- a/ewmh.c
+++ b/ewmh.c
@@ -561,13 +561,8 @@ ewmh_client_strut_update(client_t *c,
xcb_get_property_reply_t *strut_r)
c->strut.bottom_end_x = strut[11];
client_need_arrange(c);
- /* All the wiboxes (may) need to be repositioned */
- for(int screen = 0; screen < globalconf.nscreen; screen++)
- for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++)
- {
- wibox_t *s = globalconf.screens[screen].wiboxes.tab[i];
- wibox_position_update(s);
- }
+ /* All the wiboxes (may) need to be repositioned. */
+ wibox_update_positions();
}
}
diff --git a/wibox.c b/wibox.c
index ebe06dc..11b1553 100644
--- a/wibox.c
+++ b/wibox.c
@@ -512,6 +512,19 @@ wibox_refresh(void)
}
}
+/** Reposition all wiboxes.
+ */
+void
+wibox_update_positions(void)
+{
+ for(int screen = 0; screen < globalconf.nscreen; screen++)
+ for(int i = 0; i < globalconf.screens[screen].wiboxes.len; i++)
+ {
+ wibox_t *s = globalconf.screens[screen].wiboxes.tab[i];
+ wibox_position_update(s);
+ }
+}
+
/** Set a wibox visible or not.
* \param wibox The wibox.
* \param v The visible value.
diff --git a/wibox.h b/wibox.h
index 5304322..398ac4c 100644
--- a/wibox.h
+++ b/wibox.h
@@ -26,6 +26,7 @@
#include "swindow.h"
void wibox_refresh(void);
+void wibox_update_positions(void);
int luaA_wibox_new(lua_State *);
int luaA_wibox_userdata_new(lua_State *, wibox_t *);
--
1.6.0.4