tabbed and the way the new decoration framework works

Hi, Spencer just pushed a big patch to clean up my code a bit. He also broke Tabbed, since, probably, I was not quite clear on how the new decoration framework works. A decoration is a modification to a layout, now. And it is attached to a window. If there is no window, there is no decoration. This way we can decorate any window by just applying a modifier to a layout. This is done safely, since the modifier implementation as a layout (ModifiedLayout) is abstract, and we can guarantee that the ModfiedLayout behaves exactly like a Layout. By the fact that layouts may be modified only by layout modifier, we can be sure every modified layout will have a predictable behavior. There is a price to pay. If we want the decoration framework to be independent from the layout framework, we can decorate only windows returned by a layout. This means that a tabbed decoration will create tabs only for windows that have been returned by the underlying layout. Otherwise we must create a layout. So you choose: a layout or a layout modifier. They have different semantics. The LayoutModifier class together with the ModifiedLayout instance of the LayoutClass will perfectly map a modifier to the layout behavior, but they are different things. As you may understand this is the very very reason why I'm asking to change decoration :: l a -> String to decoration :: l a -> X String. If we have the second type I can write a LayoutCombinator class with a CombinedLayout that will perfectly map the semantics of a Layout. Pure and impure combinators will thus behave as layouts. If you do not give me that type, I'll be able to write a class the can map perfectly only pure combinators, and quite well impure combinators. This is a choice we can make: we like l a -> String? Ok, I'm going to write a pure combinator class only. As a side effect I'll stop maintaining (bugged) layout combinators that break at every API change.;) As I said, this is a change that has some quite deep implication. I tried to write extensively on that, *without* feedback from the other developers (well I had a go from David, who started all that). If you don't like this design we can quickly revert it. I don't really mind. It has been a pleasure this ride into type classes, because it gave me a completely new perspective on how extensible code must be written. I would like to thank David for that, since he pushed me in this direction. But I can understand that maybe the other developer may just think David's the one to blame... Wait! No, I take full responsibility! Cheers, andrea

On Wed, Jan 30, 2008 at 11:50:30AM +0100, Andrea Rossato wrote:
There is a price to pay. If we want the decoration framework to be independent from the layout framework, we can decorate only windows returned by a layout.
just to show you (I already did btw) what I are getting by paying that price: this is a vertically reflected floating layout: http://gorgias.mine.nu/xmonadShots/floatingReflected.png if you want to see a reflected tabbed (before Spencer patch), just let me know.... layout/modifier/combinator composbility is a neat feature, but it is costly - tons of code to remove. andrea

On Wed, Jan 30, 2008 at 11:50:30AM +0100, Andrea Rossato wrote:
A decoration is a modification to a layout, now. And it is attached to a window. If there is no window, there is no decoration.
just to clarify a bit more: decorations are produced by the Decoration layout modifier according to the decoration style - whose class you came to know. The decoration window is then inserted in the list of windows to be returned by runLayout in Operations.windows. So, now it is xmonad that calls "restackWindows d vs" - and vs has inside, properly placed, all our decoration windows. This way (this is THE only way I'm aware of), decorations, even if they have override_redirect set to True, will not float above windows placed above the window they are decorating... for instance, you can place a window above the tabs (the WindowArrager PURE modifier is quite an interesting stuff to explore... I didn't have the time, yet). As a side effect, all this placing of windows and decorations can be done with pure code on lists (some monadic bits are there just to provide methods with the right and more expressive types - I didn't choose them because I like them...;), Hope it's quite clear now, why we can decorate only windows returned to a layout. But you are free to hack Decoration and find better ways. I'm really really eager to discuss and to be questioned, and to see better stuff. I'm doing all that not because I want a better WM (it's been quite some time I have all I need), but just because I want a better understanding in structuring extensible code. Sorry for the noise. Andrea PS: This is just the design. We need to clean it up quite a lot. If you want to accept it. Otherwise, unrecord/revert, whatever...;)

a last note: the fact that the decoration windows (with override_redirect attribute set to True) are in the list returned by the Decoration modifier, has an interesting side effect: a modifier placed over Decoration is able to find decorations and knows that the head of the remainder of the list is the window that decoration has been created for... actually I have no idea why someone would place a modifier on top of Decoration in order to manipulate the returned list, but there are quite weird guys around... ;) andrea
participants (1)
-
Andrea Rossato