Hi people, recently, I have become a bit annoyed with some of the snapping done by awful.mouse when moving floating clients around. The problem was that while snapping against the border between two screens the client would be moved a bit too much to the right, resulting in it being partially on both screens (with the right screen only containing a very small strip of the client). The same problem arose when snapping against the border of another client.
The result looked a bit like the following (with the box containing
"Hi!" being a floating client and two screens):
+---------------------------+-------------------------------+
| +--------+ |
| | Hi! | |
| | | |
| +--------+ |
| | |
| | |
| | |
| | |
| | |
+---------------------------+-------------------------------+
Anyway, through careful analysis (LOL) of the present code in
awful.mouse, I found the problem was that the client geometry doesn't
take the border size into account. A patch is attached.
--
$l="\n";$p=q-sub r{rand}sub c{((shift)**2+(shift)**2)<1}while(
$i++<=$s){$t++if c r,r}die("Gregor Best, 0xDB9F9A7C, ".($t/$s*
4).$l)-;$s+=ord$$|$_ for split //,$p;srand($s|$$);eval$p;die$@
From d9c97347ef2dcd0c516559889723f389fcbf6b30 Mon Sep 17 00:00:00 2001 From: Gregor Best <[email protected]> Date: Sun, 20 Mar 2011 22:51:00 +0100 Subject: [PATCH] awful.mouse: fix client snapping Signed-off-by: Gregor Best <[email protected]> --- lib/awful/mouse/init.lua.in | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lib/awful/mouse/init.lua.in b/lib/awful/mouse/init.lua.in index af6c7b6..37fcc41 100644 --- a/lib/awful/mouse/init.lua.in +++ b/lib/awful/mouse/init.lua.in @@ -110,6 +110,8 @@ function client.snap(c, snap, x, y, fixed_x, fixed_y) local c = c or client.focus local cur_geom = c:geometry() local geom = c:geometry() + geom.width = geom.width + (2 * c.border_width) + geom.height = geom.height + (2 * c.border_width) local edge = "none" local edge2 = "none" geom.x = x or geom.x -- 1.7.3.4
pgps51e7J5mtr.pgp
Description: PGP signature
