Hi people,

the attached two patches fix some little quirks introduced by the recent
introduction of wibox management in awful.

The first patch fixes a little bug I encountered while playing around
with wiboxes and it makes "floating" the position if something went
wrong (i.e. the user tried to set "fnord" as the position)

The second patch adapts awful.mouse.wibox.move to the new syntax for
handling wibox positions.

-- 
GCS/IT/M d- s+:- a--- C++ UL+++ US UB++ P+++ L+++ E--- W+ N+ o--
K- w--- O M-- V PS+ PE- Y+ PGP+++ t+ 5 X+ R tv+ b++ DI+++ D+++ G+
e- h! r y+

    Gregor Best
From 68a1e0c74d4238b446e1ca85b7c7aa9237e43990 Mon Sep 17 00:00:00 2001
From: Gregor Best <farha...@googlemail.com>
Date: Fri, 5 Jun 2009 19:49:03 +0200
Subject: [PATCH 1/2] awful.wibox(): correctly handle position changes

This patch fixes a bug and changes the position handling for wiboxes:

The bug was that awful.wibox.set_position() didn't update the cached
wibox position, i.e. the wibox was moved, but the position value in the
wiboxes table stayed the same

The change in position handling was that unknown positions (i.e.
"fnord") default to "floating"

Signed-off-by: Gregor Best <farha...@googlemail.com>
---
 lib/awful/wibox.lua.in |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/lib/awful/wibox.lua.in b/lib/awful/wibox.lua.in
index 190caea..2a155c9 100644
--- a/lib/awful/wibox.lua.in
+++ b/lib/awful/wibox.lua.in
@@ -115,6 +115,13 @@ function set_position(wibox, position, screen)
         wingeom.y = area.y
     end
 
+    for _, wprop in ipairs(wiboxes) do
+        if wprop.wibox == wibox then
+            wprop.position = position
+            break
+        end
+    end
+
     wibox:geometry(wingeom)
 end
 
@@ -147,6 +154,10 @@ function attach(wibox, position)
         end
     end
 
+    if position ~= "top" and position ~= "bottom" and position ~= "right" and 
position ~= "left" then
+        position = "floating"
+    end
+
     if not wibox_prop_table then
         table.insert(wiboxes,
         setmetatable({ wibox = wibox, position = position }, { __mode = 'v' }))
-- 
1.6.3.1

From ab18dfbe92ef64bdb854bc227597ad90fb9eefb3 Mon Sep 17 00:00:00 2001
From: Gregor Best <farha...@googlemail.com>
Date: Fri, 5 Jun 2009 19:51:33 +0200
Subject: [PATCH 2/2] awful.mouse: fix wibox.move()

Signed-off-by: Gregor Best <farha...@googlemail.com>
---
 lib/awful/mouse.lua.in |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/awful/mouse.lua.in b/lib/awful/mouse.lua.in
index fc4cb90..b264576 100644
--- a/lib/awful/mouse.lua.in
+++ b/lib/awful/mouse.lua.in
@@ -284,7 +284,7 @@ function wibox.move(w)
 
     capi.mousegrabber.run(function (mouse)
         local button_down = false
-        if w.position == "floating" then
+        if awibox.get_position(w) == "floating" then
             w:geometry({
                 x = capi.mouse.coords()["x"] + offset["x"],
                 y = capi.mouse.coords()["y"] + offset["y"],
@@ -293,13 +293,13 @@ function wibox.move(w)
             local wa = awibox.get_workarea(capi.mouse.screen)
 
             if capi.mouse.coords()["y"] > wa.y + wa.height - 10 then
-                w.position = "bottom"
+                awibox.set_position(w, "bottom", w.screen)
             elseif capi.mouse.coords()["y"] < wa.y + 10 then
-                w.position = "top"
+                awibox.set_position(w, "top", w.screen)
             elseif capi.mouse.coords()["x"] > wa.x + wa.width - 10 then
-                w.position = "right"
+                awibox.set_position(w, "right", w.screen)
             elseif capi.mouse.coords()["x"] < wa.x + 10 then
-                w.position = "left"
+                awibox.set_position(w, "left", w.screen)
             end
             w.screen = capi.mouse.screen
         end
-- 
1.6.3.1

Attachment: pgpXFGBRAXkzy.pgp
Description: PGP signature

Reply via email to