-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Uli Schlachter wrote:
> The first patch makes awful.wibox() work with non-north orientation and
> user-specified geometries.

I'm just a human.... Attached is a New and Improved (tm) version of this first
patch.

Cheers,
Uli
- --
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQEcBAEBCAAGBQJKKmTmAAoJECLkKOvLj8sGlPUIAM1qjONuZIvt7XpKU9uCKpPJ
Md7vti15oyjjMUiaqND95pbLuEYjuFIjuUznNaYi0AfWrnCpCyvRP0VtpJHqBAYv
kGfNkz31rxnd5gd2TPw9dmwtQCwxuHFxwxwlCAAjulDq7rJ9h59q/WCPP7TmvMNa
7TyWtFG830p8Brz8WG/MAKUMUnC1TpyoinFBbIGSWwEDwfP9ks7EziD5WBR5Wk/x
NFqdRHA4YhQu/kzuGBS/a1Xzwf/rRi4wUmtWOBQpiLs1XloJBLSnQCtH3gFk7BJ0
diZm2ObFkvgarjUW7k1gJ97fj/4iQWkjA4zZj1KTBiVOB8mJ3MP1zt0KN78MP6Q=
=1Rkp
-----END PGP SIGNATURE-----
>From cbbec52a98f35f25fb6d9d99510c065e19662b60 Mon Sep 17 00:00:00 2001
From: Uli Schlachter <psyc...@znc.in>
Date: Fri, 5 Jun 2009 23:28:54 +0200
Subject: [PATCH] awful.wibox(): Honour user specified geometries

If a wibox with non-north geometry was created and a wibox size was specified,
this function happily ignored it when it made the wibox fit.

The hunk in wibox.c partly reverts 7cc0b13eae2638aaab40bfd1632036a6bea4d8d4.
No idea if this is a good idea or why that one was done...

Thanks to Garoth who found this bug.

Signed-off-by: Uli Schlachter <psyc...@znc.in>
---
 lib/awful/wibox.lua.in |   11 +++++++++--
 wibox.c                |    4 ++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/awful/wibox.lua.in b/lib/awful/wibox.lua.in
index 190caea..939f52e 100644
--- a/lib/awful/wibox.lua.in
+++ b/lib/awful/wibox.lua.in
@@ -237,14 +237,21 @@ function new(arg)
     -- Empty position and align in arg so we are passing deprecation warning
     arg.position = nil
 
+    -- Set default size
+    if position == "left" or position == "right" then
+        arg.width = arg.width or capi.awesome.font_height * 1.5
+        arg.height = arg.height or 100
+    else
+        arg.width = arg.width or 100
+        arg.height = arg.height or capi.awesome.font_height * 1.5
+    end
+
     local w = capi.wibox(arg)
 
     if position == "left" then
         w.orientation = "north"
-        w:geometry({ width = capi.awesome.font_height * 1.5 })
     elseif position == "right" then
         w.orientation = "south"
-        w:geometry({ width = capi.awesome.font_height * 1.5 })
     end
 
     w.screen = arg.screen or 1
diff --git a/wibox.c b/wibox.c
index 69009c9..a54634c 100644
--- a/wibox.c
+++ b/wibox.c
@@ -488,8 +488,8 @@ luaA_wibox_new(lua_State *L)
     w->sw.border.width = luaA_getopt_number(L, 2, "border_width", 0);
     w->sw.geometry.x = luaA_getopt_number(L, 2, "x", 0);
     w->sw.geometry.y = luaA_getopt_number(L, 2, "y", 0);
-    w->sw.geometry.width = luaA_getopt_number(L, 2, "width", 100);
-    w->sw.geometry.height = luaA_getopt_number(L, 2, "height", globalconf.font->height * 1.5);
+    w->sw.geometry.width = luaA_getopt_number(L, 2, "width", 0);
+    w->sw.geometry.height = luaA_getopt_number(L, 2, "height", 0);
 
     w->isvisible = true;
     w->cursor = a_strdup("left_ptr");
-- 
1.6.3.1

Reply via email to