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

Damn, that went faster than I had expected....

Commit message should say it all, read it!

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)

iQEcBAEBCAAGBQJKcETGAAoJECLkKOvLj8sGWjUH/jyDAMC+JvcOzX+ZLfd8Ta0c
jfQgkF/AK4bFkf1Ngl2iR8pb2/+zVaW+1LioMBbahUxdmRq8e+rvCKvPNq2Qajb0
CDOlLH1g3zbT3lBfHhMu3CwI11JNX+2TnN7DvG53Z4HDBUcY+BFNaCog9x+z5xfz
snCyxk4ZLfY+bW5VbPwt044N+CyDwkQVMImyvjMO12ZbRE2dfJIyi5HUeprd3OAP
70eznzci5WwaWKPMoLJmBOKKHrlglU64CC07lcDNzSRMmjt/9WJKO31b9/MuRW6W
38eP5fDmXY5P7H6AJyAbnv/JHWUcMVhDghh9spbGLJyAOEzX8rRq0kh4FJxQfg8=
=tiDR
-----END PGP SIGNATURE-----
>From 649b434e8a6b042cc81b041e39488bd06884e51b Mon Sep 17 00:00:00 2001
From: Uli Schlachter <[email protected]>
Date: Wed, 29 Jul 2009 14:43:00 +0200
Subject: [PATCH] Naughty: Remove some code duplication

2b69d333f8d4e2770da added some code duplication here. I guess this was a
mis-rebase or something like that. Anyway, the width and height of the wibox is
already calculated right before this code snippet and the existing calculation
is even correct (now that the calculation for a wibox' geometry with
border_width was fixed up).

Tested via notify-send with and without icon.

Signed-off-by: Uli Schlachter <[email protected]>
---
 lib/naughty.lua.in |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index ad02149..b4feb06 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -379,24 +379,10 @@ function notify(args)
     notification.width = width + 2 * (border_width or 0)
 
     -- position the wibox
-    if iconbox and iconbox.image.height > textbox:extents()["height"] then
-        notification.height = iconbox.image.height + (2 * config.border_width)
-    else
-        notification.height = textbox:extents()["height"] + (2 * config.border_width)
-    end
-    notification.width = (iconbox and iconbox:extents()["width"] or 0) + textbox:extents()["width"] + (2 * config.border_width)
-
-    if capi.screen[screen].workarea.width < notification.width then
-        notification.width = capi.screen[screen].workarea.width - (2 * config.border_width) - (2 * config.padding)
-    end
-    if capi.screen[screen].workarea.height < notification.height then
-        notification.height = capi.screen[screen].workarea.height - (2 * config.border_width) - (2 * config.padding)
-    end
-
-    local offset = get_offset(screen, notification.position, notification.idx, notification.width, notification.height)
+    local offset = get_offset(screen, notification.position, nil, notification.width, notification.height)
     notification.box.ontop = ontop
-    notification.box:geometry({ width = notification.width,
-                                height = notification.height,
+    notification.box:geometry({ width = width,
+                                height = height,
                                 x = offset.x,
                                 y = offset.y })
     notification.box.opacity = opacity
-- 
1.6.3.3

Reply via email to