From e1b78a1f8435d4248878091ad9e9fb84944c14a7 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 21 Apr 2002 03:36:09 +0000 Subject: [PATCH] even better bestfit placement. way to go colophon! --- src/Workspace.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Workspace.cc b/src/Workspace.cc index 70b043c0..4b6c23b4 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -391,11 +391,14 @@ Point *Workspace::bestFitPlacement(const Size &win_size, const Rect &space) //Find first space that fits the window best = NULL; for (siter=spaces.begin(); siter!=spaces.end(); ++siter) { - if ((siter->w() >= win_size.w()) && - (siter->h() >= win_size.h())) - best = siter; + if ((siter->w() >= win_size.w()) && (siter->h() >= win_size.h())) { + if (best == NULL) + best = siter; + else if (win_size.w() * win_size.h() - siter->w() * siter->h() < + best->w() + best->h()) + best = siter; + } } - if (best != NULL) { Point *pt = new Point(best->origin()); if (screen.colPlacementDirection() != BScreen::TopBottom) -- 2.45.2