darcs patch: XMonad.Core: new layoutMirrored flag

Fri May 9 22:57:43 CEST 2008 Lukas Mai

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 This patch adds a new flag to 'XConf': 'layoutMirrored'. It indicates whether we're inside a layout that swaps the X and Y axes. It defaults to 'False', and 'Mirror' toggles it. 'XMonad.Operations.mkAdjust' reads it in order to apply size hints correctly. This change should make the Tall/Wide distinction in HintedTile redundant, because Mirror (HintedTile ...) works now, using mirrored size hints where appropriate.
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? 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
But then, I might just not have enough clue about all this and everything is fine already :-) Greetings, Joachim -- Joachim "nomeata" Breitner mail: mail@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C JID: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/ Debian Developer: nomeata@debian.org

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

Hi, Am Samstag, den 10.05.2008, 02:15 +0200 schrieb Lukas Mai:
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.
That’s a very good point and I have to admit I have not a full overview of the layout system. I guess you can ignore my comments. Greetings, Joachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de ICQ#: 74513189 Jabber-ID: nomeata@joachim-breitner.de

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... <snip> I don't understand this. Perhaps another way of looking at it is it hardcodes knowledge of one
On Sat, May 10, 2008 at 02:15:36AM +0200, Lukas Mai wrote: particular coordinate system transformer. What if somebody decided to write XMonad.Layout.Logarithmic (say, to give size preference to one corner of the screen)? What if I did that just to spite you? :D There is no perfect answer, of course, because we allow contribs to talk to X directly, so we can't wrap every call. Ambivalent as usual, <my name here>

l.mai:
Fri May 9 22:57:43 CEST 2008 Lukas Mai
* XMonad.Core: new layoutMirrored flag This patch adds a new flag to 'XConf': 'layoutMirrored'. It indicates whether we're inside a layout that swaps the X and Y axes. It defaults to 'False', and 'Mirror' toggles it. 'XMonad.Operations.mkAdjust' reads it in order to apply size hints correctly. This change should make the Tall/Wide distinction in HintedTile redundant, because Mirror (HintedTile ...) works now, using mirrored size hints where appropriate.
Thanks for looking into this! I would very much like to avoid a special case global for this though -- is there some other way? -- Don
participants (4)
-
Devin Mullins
-
Don Stewart
-
Joachim Breitner
-
Lukas Mai