At Fri, 13 Mar 2009 16:59:43 +0100
Gregor Best wrote:

> At Fri, 13 Mar 2009 11:49:25 -0400
> Alex Cornejo wrote:
> 
> > Great, thanks Gregor, it seems to work pretty well, I am not sure either
> > what are you doing with c.screen & s, but it works.
> > 
> > Cheers,
> > 
> > Alex
> > 
> 
> If you map a client, it is originall at position (0, 0), unless it requests to
> be placed at some other location. This is the location stored in the manage
> hook which gets executed before any arrange hook, so once you set the client
> to float, it will be moved to position (0, 0) and have its screen changed as a
> part of that procedure, as that was its last known position. To overcome this,
> the client is moved to its new screen after setting the old geometry.
> 

I attached a version without the flaw Julien pointed out.

-- 
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 ce2253422a13e8fe06a392b41b5ee8855f08925e Mon Sep 17 00:00:00 2001
From: Gregor Best <[email protected]>
Date: Thu, 12 Mar 2009 20:11:52 +0100
Subject: [PATCH] lib/awful/client: store floating geometry of clients in awful

Signed-off-by: Gregor Best <[email protected]>
---
 lib/awful/client.lua.in |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in
index 36d992d..3f911f2 100644
--- a/lib/awful/client.lua.in
+++ b/lib/awful/client.lua.in
@@ -551,11 +551,26 @@ function floating.set(c, s)
     local c = c or capi.client.focus
     if c and property.get(c, "floating") ~= s then
         property.set(c, "floating", s)
+        local screen = c.screen
+        if s == true then
+            c:geometry(property.get(c, "floating_geometry"))
+        end
+        c.screen = screen
         capi.hooks.arrange()(c.screen)
         capi.hooks.property()(c, "floating")
     end
 end
 
+hooks.manage.register(function (c)
+    property.set(c, "floating_geometry", c:geometry())
+end)
+
+hooks.property.register(function (c, prop)
+    if prop == "geometry" and floating.get(c) then
+        property.set(c, "floating_geometry", c:geometry())
+    end
+end)
+
 --- Return if a client has a fixe size or not.
 -- @param c The client.
 function isfixed(c)
-- 
1.6.2

Attachment: signature.asc
Description: PGP signature

Reply via email to