views:

117

answers:

1

This is just for curiosity.

Exposé has two functions, among others, that rearrange windows on the desktop, one shows all the open windows so the user can see windows that are hidden below others, and other function in which moves all the windows to the sides letting the user interact with the desktop.

I just wonder if someone knows the logic by which the OS decides which window to position where and which border to move windows to when showing the desktop.

+3  A: 

The generalized idea of what you're looking for is called Graph Drawing:

[The] drawing of a graph is basically a pictorial representation of an embedding of the graph in the plane, usually aimed at a convenient visualization of certain properties of the graph in question or of the object modeled by the graph.

Exposé would use an algorithm out of this, or a similar family to derive it's window layout functions. You can also have a look at the source code for the Graphviz project. It has algorithms for laying out graph nodes much the same way Exposé would.

As to shuffling windows off to the side. It's likely a "dumb" algorithm that takes the windows position and moves it to the closest side.

Gavin Miller
Yes, Omnigraffe uses the layout algorithms.
Hassan Syed