I’m packing child windows into a larger window (MDI fashion).
Imagine a bulletin board covered by a bunch of overlapping items.
I want to find a “reasonable” way to position the smaller windows.
Ideally part of each one would be exposed. For real-world values,
that would be impossible, since the total area of the small windows
would far exceed the total area of the large one.
I’ll probably display them in reverse order, so that the ones at the
beginning of the list go on top, and the others are buried.
A truly smart algorithm, of course, would ignore the bottom of the
list and display only the top N items for efficiency. But then I
have to worry about finding N.
I’m packing child windows into a larger window (MDI fashion).
Imagine a bulletin board covered by a bunch of overlapping items.
I want to find a “reasonable” way to position the smaller windows.
Ideally part of each one would be exposed. For real-world values,
that would be impossible, since the total area of the small windows
would far exceed the total area of the large one.
Are you familiar with sawfish? It has a ‘best-fit’ window placement mode
similar to what you describe. It is written in rep, a lisp dialect, but
hopefully it will be easy enough for you to follow. I put the applicable
file at http://kapheine.hypa.net/tmp/smart.jl. If you snag the sawfish
distribution (http://sawfish.sourceforge.net) there are a couple other
placement modes in lisp/sawfish/wm/placement/: off-center, stagger, and
top-left. But I think smart is what you want.
Is the algorithm used in ‘Expose’ available somewhere? That could be a
good starting point.
Guillaume.
···
On Thu, 2004-03-18 at 03:11, Zachary P. Landau wrote:
I’m packing child windows into a larger window (MDI fashion).
Imagine a bulletin board covered by a bunch of overlapping items.
I want to find a “reasonable” way to position the smaller windows.
Ideally part of each one would be exposed. For real-world values,
that would be impossible, since the total area of the small windows
would far exceed the total area of the large one.
Are you familiar with sawfish? It has a ‘best-fit’ window placement mode
similar to what you describe. It is written in rep, a lisp dialect, but
hopefully it will be easy enough for you to follow. I put the applicable
file at http://kapheine.hypa.net/tmp/smart.jl. If you snag the sawfish
distribution (http://sawfish.sourceforge.net) there are a couple other
placement modes in lisp/sawfish/wm/placement/: off-center, stagger, and
top-left. But I think smart is what you want.