On Tue, 22 Oct 1996, Dan Astoorian wrote:
> On Tue, 22 Oct 1996 02:06:26 PDT, Trent Piepho writes:
> >How about this for a new window placement policy, CleverPlacement? Currently
> >we have SmartPlacement, which avoids all overlap and gives up if it can't,
> >and DumbPlacement (er, RandomPlacement), which sticks the windows semi-randoml
> >y
> >on the screen. CleverPlacement should be like SmartPlacement, it tries to
> >avoid overlap. If it can't avoid it entirely, it tries to minimize it.
I considered doing this myself when I was fixing up the SmartPlacement
code so that it didn't leave a 1 pixel gap around the windows.
> I was planning to do some work on this, but have just been too busy;
> I'll share my thoughts and perhaps someone else will get around to
> putting together some code before I do.
I'll do it (tonight?)
> Currently, SmartPlacement is implemented something like this:
...
> Note that since y is only incremented by 1, it can take thousands of
> iterations to conclude that there's no room on the desktop.
>
> A possible optimization: keep a sorted list of the y coordinate of the
> bottom edge of each existing window; then instead of adding 1, set y to
> the next-higher element of the list. (Why this algorithm works is left
> as an exercise.)
Done. I did this when I was fixing the placement code so that it didn't
leave a gap. But my code, although cleaner than the existing code, was
also larger, and I thought less likely to be accepted. The existing
SmartPlacement, although crude, is surprisingly compact.
> Once this improvement is made, the following enhancement becomes
> feasible: each time an (x,y) placement fails, calculate the area of
> overlap between that placement and all windows on the screen. Reject
> the placement if this overlap exceeds the smallest found so far. (In
> fact, when traversing the list of windows to calculate the total
> overlap, you can stop early once you've found enough overlapping area to
> eliminate the placement as a candidate.)
>
> If an overlap of 0 is found during this process, that position is
> returned and CleverPlacement works like SmartPlacement. If it hits the
> bottom of the screen before finding such a 'perfect' placement, it uses
> the best guess it found.
This is basically what I had in mind. I will take a look at it (implement
it?) tonight.
Tony.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Tue Oct 22 1996 - 13:06:14 BST