From 8fd801a6f4256ef4cb4cb1f69ff0fab87deef93c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 6 Mar 2016 11:34:44 +0100 Subject: [PATCH 1/3] awful.util.get_rectangle_in_direction(): Use pairs This code works just fine with non-integer table keys. Also, this is used by awful.screen.focus_bydirection() and thus will be used with screen objects instead of screen indicies when we get rid of screen indicies. Signed-off-by: Uli Schlachter --- lib/awful/util.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/awful/util.lua b/lib/awful/util.lua index cd61fea5c..f1c3feff6 100644 --- a/lib/awful/util.lua +++ b/lib/awful/util.lua @@ -362,7 +362,7 @@ function util.get_rectangle_in_direction(dir, recttbl, cur) local target = nil -- We check each object - for i, rect in ipairs(recttbl) do + for i, rect in pairs(recttbl) do -- Check geometry to see if object is located in the right direction. if is_in_direction(dir, cur, rect) then -- Calculate distance between current and checked object. From 8b65bad3fcfa5a2042edb007fdf05e6ee85fdd4d Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 6 Mar 2016 11:37:38 +0100 Subject: [PATCH 2/3] Remove useless iteration over screens Signals on instances are also emitted on the class and thus we can just connect to the signal on the class here. Signed-off-by: Uli Schlachter --- lib/awful/tag.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index b24860b48..9d04ba4d8 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -848,9 +848,7 @@ capi.tag.add_signal("property::urgent") capi.tag.add_signal("property::urgent_count") capi.screen.add_signal("tag::history::update") -for s = 1, capi.screen.count() do - capi.screen[s]:connect_signal("tag::history::update", tag.history.update) -end +capi.screen.connect_signal("tag::history::update", tag.history.update) function tag.mt:__call(...) return tag.new(...) From dd78f8e6f260f45dea9816c4fdb0add0c6752841 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 6 Mar 2016 11:38:52 +0100 Subject: [PATCH 3/3] Remove another useless iteration over screens Any signal on a screen instance is also emitted on the screen class, so the here can just connect to the screen class. Signed-off-by: Uli Schlachter --- lib/awful/layout/init.lua | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index dd81cba08..3c7546e37 100644 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -238,14 +238,8 @@ capi.tag.connect_signal("property::useless_gap", arrange_tag) capi.tag.connect_signal("property::master_fill_policy", arrange_tag) capi.tag.connect_signal("tagged", arrange_tag) -for s = 1, capi.screen.count() do - capi.screen[s]:connect_signal("property::workarea", function(screen) - layout.arrange(screen) - end) - capi.screen[s]:connect_signal("padding", function (screen) - layout.arrange(screen) - end) -end +capi.screen.connect_signal("property::workarea", layout.arrange) +capi.screen.connect_signal("padding", layout.arrange) capi.client.connect_signal("raised", function(c) layout.arrange(c.screen) end) capi.client.connect_signal("lowered", function(c) layout.arrange(c.screen) end)