From 61cdc405959ed738648a26459a5d0297c37b3432 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Wed, 12 Sep 2018 10:30:17 +0300 Subject: [PATCH] awful.placement: Fix no_offscreen when composed with other functions The awful.placement.no_offscreen function did not work properly when composed with other placement functions; in particular, the default configuration (awful.placement.no_overlap+awful.placement.no_offscreen) was broken. The compose function sets args.pretend=true and puts the result of the previous placement function into args.override_geometry before calling the next placement function, but no_offscreen did not use args.override_geometry, therefore the result of the previous placement function was discarded. All other placement functions use `geometry_common(c, args)` to get the current client geometry; `area_common(c)` should be used only when getting geometry of other clients. This change also fixes the problem with margin handling (adding margins should not affect the window size, only the window position should change); the test output which was adjusted in commit 0275d3537d05b66b9f is adjusted again to account for this change. Signed-off-by: Sergey Vlasov --- lib/awful/placement.lua | 2 +- tests/examples/awful/placement/no_offscreen.output.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/awful/placement.lua b/lib/awful/placement.lua index d516195d..3cc2ceb0 100644 --- a/lib/awful/placement.lua +++ b/lib/awful/placement.lua @@ -851,7 +851,7 @@ function placement.no_offscreen(c, args) c = c or capi.client.focus args = add_context(args, "no_offscreen") - local geometry = area_common(c) + local geometry = geometry_common(c, args) local screen = get_screen(args.screen or c.screen or a_screen.getbycoord(geometry.x, geometry.y)) local screen_geometry = screen.workarea diff --git a/tests/examples/awful/placement/no_offscreen.output.txt b/tests/examples/awful/placement/no_offscreen.output.txt index 2bd013d5..3c3ea651 100644 --- a/tests/examples/awful/placement/no_offscreen.output.txt +++ b/tests/examples/awful/placement/no_offscreen.output.txt @@ -1,2 +1,2 @@ Before: x=-30, y=-30, width=100, height=100 -After: x=50, y=50, width=20, height=20 +After: x=50, y=50, width=100, height=100