
Am Freitag, 9. Mai 2008 schrieb Joachim Breitner:
Hi,
Am Freitag, den 09.05.2008, 23:06 +0200 schrieb Lukas Mai:
Fri May 9 22:57:43 CEST 2008 Lukas Mai
* XMonad.Core: new layoutMirrored flag Maybe I’m not fully aware of how layouts work, but to me it seems that XConf is the wrong place to add this: Aren’t there layouts that combine other layouts? So what if I combine Mirror Tall and Tall on one screen, what should layoutMirrored say? Also, is it xinerama safe?
It's not really global. Mirror just flips the bit for the wrapped layout's runLayout method, using local (because X is a MonadReader for XConf). So the effects are limited to the layout(s) called from Mirror.
A cleaner way would probably be a new method for the LayoutClass class that allows this query to run, and be modified by mirroring layout transformers. Seems at least more functional to me than some global flag... If you give a default implementation of the method, you would not even have to change the instances. Maybe something a long the lines of
coordinateMirrored :: Window -> Bool
I don't understand this. What I want is a way to teleport information from Mirror (and similar layouts) to mkAdjust, which queries a window to build a suitable hinter function. To do this right, mkAdjust needs to know whether the coordinates it gets are flipped or normal. mkAdjust :: Window -> X (D -> D) There is no way to pass this information directly. You could use another function for this task, but how do you use coordinateMirrored in a layout to access the mirror bit? Also, coordinateMirror's type doesn't mention a particular layout, so it can't be a method of LayoutClass. And if it was, which layout would you pass to it? The control flow goes something like: runLayout[Mirror] -> runLayout[Foo] -> mkAdjust for some layout Mirror Foo. I want to change mkAdjust's behavior from runLayout[Mirror] without runLayout[Foo] having to do anything or even knowing about it. This calls for hidden parameter passing, which is what Reader is all about. Unfortunately layouts don't have their own monad (hmm, maybe there should be a MonadX class and runLayout should be runLayout :: (MonadX x) => Workspace WorkspaceId (layout a) a -> Rectangle -> x ([(a, Rectangle)], Maybe (layout a)) No idea if that would work ...) But X already passes an XConf to each layout, so that's what I used. I think it's functional enough if you keep in mind that's not a global flag but an implicit parameter of each layout. I hope what I wrote above makes sense; I'm going to continue thinking about this tomorrow. If anyone has a better (less intrusive) idea, I'd be glad to hear it. HTH, Lukas