From 0ecf5875b13d5eab2e223df6665da87e05308240 Mon Sep 17 00:00:00 2001 From: tadam Date: Wed, 30 Dec 2009 22:42:23 +0000 Subject: [PATCH] Fix y-position of windows using MinOverlapPlacement. Due to how the offsets for the best window positioning is calculated, the y position was not ever taking into account the placement of the window with respect to the size of the borders; effectively pushing it off-screen. Fix it by resetting the y position to take into account the total size of the border height. --- ChangeLog | 6 ++++++ NEWS | 1 + fvwm/placement.c | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/ChangeLog b/ChangeLog index db9ff5f01..33bc9c50a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-39 Thomas Adam + * fvwm/placement.c (__pl_minoverlap_get_pos_penalty): + Fix y-axis offset calculations when using MinOverlapPlacement, by + forcing the window on-screen when over-zealous penality calculations + don't take into account the size of the window borders. + 2009-12-26 Thomas Adam * bin/fvwm-convert-2.6.1.in: Add in BUGS section a note that converting over FvwmTheme lines is diff --git a/NEWS b/NEWS index 94ee6e982..3ed47578d 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ Changes in beta release 2.5.29 (not released yet) - Fixed the InitialMapCommand style from running when FVWM is restarting. - Fix rendering of FvwmForm windows when initially mapped. + - Fix placement of windows when using MinoverlapPlacement and friends. Changes in beta release 2.5.28 (20-Sep-2009) diff --git a/fvwm/placement.c b/fvwm/placement.c index d6ac0bade..59e861f63 100644 --- a/fvwm/placement.c +++ b/fvwm/placement.c @@ -990,6 +990,7 @@ static pl_penalty_t __pl_minoverlap_get_pos_penalty( { FvwmWindow *other_fw; pl_penalty_t penalty; + size_borders b; penalty = 0; for ( @@ -998,6 +999,7 @@ static pl_penalty_t __pl_minoverlap_get_pos_penalty( { rectangle other_g; Bool rc; + get_window_borders(other_fw, &b); if ( arg->place_fw == other_fw || @@ -1033,6 +1035,24 @@ static pl_penalty_t __pl_minoverlap_get_pos_penalty( penalty > ret->best_penalty && ret->best_penalty != -1) { + /* TA: 20091230: Fix over-zealous penalties + * by explicitly forcing the window on-screen + * here. The y-axis is only affected here, + * due to how the xoffset calculations happen + * prior to setting the x-axis. When we get + * penalties which are "over-zealous" -- and + * by not taking into account the size of the + * window borders, the window was being placed + * off screen. + */ + if (ret->best_p.y + arg->place_g.height >= arg->page_p2.y) + { + ret->best_p.y = + (arg->page_p2.y - + arg->place_g.height - + b.total_size.height); + } + /* stop looking; the penalty is too high */ return penalty; } -- 2.11.4.GIT