Hi people,

the attached patch basicall reimplements the changes introduced in commit id
f5c35765d21, but it fixes an issue I had with the patch which was that with 
more than two clients on the screen, windows would dissappear (seemingly, they 
didn't get their geometry reset after being unfocused for some reason). Also 
this patch only accepts the currently focused window as the window displayed in 
the middle of the screen when it is on the same screen. Previously, if you had 
for example tile on the left and magnifier on the right screen and moved your 
mouse from the right to the left screen, the magnifier layout would sometimes 
"steal" clients.

-- 
    Gregor Best
From e8800e7a0a73140d6ddb0986e56d3bbac828af53 Mon Sep 17 00:00:00 2001
From: Gregor Best <[email protected]>
Date: Wed, 21 Jan 2009 17:23:24 +0100
Subject: [PATCH] awful.layout.suit.magnifier: restore client order according to focus

Signed-off-by: Gregor Best <[email protected]>
---
 lib/awful/layout/suit/magnifier.lua.in |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/lib/awful/layout/suit/magnifier.lua.in b/lib/awful/layout/suit/magnifier.lua.in
index e6762aa..e9bd5dc 100644
--- a/lib/awful/layout/suit/magnifier.lua.in
+++ b/lib/awful/layout/suit/magnifier.lua.in
@@ -42,10 +42,18 @@ local function magnifier(_, screen)
     end
 
     -- If focused window is not tiled, take the first one which is tiled.
-    if client.floating.get(focus) then
+    if client.floating.get(focus) or capi.client.focus.screen ~= screen then
         focus = cls[1]
     end
 
+    local fidx
+    for k, v in ipairs(cls) do
+        if v == focus then
+            fidx = k
+            break
+        end
+    end
+
     local geometry = {}
     if #cls - 1 > 0 then
         geometry.width = area.width * math.sqrt(mwfact)
@@ -67,13 +75,16 @@ local function magnifier(_, screen)
         geometry.height = area.height / (#cls - 1)
         geometry.width = area.width
 
-        for k, c in ipairs(cls) do
-            if c ~= focus then
-                c:geometry(geometry)
-                geometry.y = geometry.y + geometry.height
-            end
+        for k = fidx + 1, #cls do
+            cls[k]:geometry(geometry)
+            geometry.y = geometry.y + geometry.height
         end
-    end
+
+        for k = 1, fidx - 1 do
+            cls[k]:geometry(geometry)
+            geometry.y = geometry.y + geometry.height
+        end
+   end
 end
 
 setmetatable(_M, { __call = magnifier })
-- 
1.6.1

Attachment: signature.asc
Description: PGP signature

Reply via email to