Commit Graph

53 Commits

Author SHA1 Message Date
Don Stewart
d3d058345d comment only 2007-05-20 09:08:46 +00:00
Don Stewart
77e46027ed HEADS UP: Rewrite StackSet as a Zipper
In order to give a better account of how focus and master interact, and
how each operation affects focus, we reimplement the StackSet type as a
two level nested 'Zipper'. To quote Oleg:

    A Zipper is essentially an `updateable' and yet pure functional
    cursor into a data structure. Zipper is also a delimited
    continuation reified as a data structure.

That is, we use the Zipper as a cursor which encodes the window which is
in focus. Thus our data structure tracks focus correctly by
construction! We then get simple, obvious semantics for e.g. insert, in
terms of how it affects focus/master. Our transient-messes-with-focus
bug evaporates. 'swap' becomes trivial.

By moving focus directly into the stackset, we can toss some QC
properties about focus handling: it is simply impossible now for focus
to go wrong. As a benefit, we get a dozen new QC properties for free,
governing how master and focus operate.

The encoding of focus in the data type also simplifies the focus
handling in Operations: several operations affecting focus are now
simply wrappers over StackSet.

For the full story, please read the StackSet module, and the QC
properties.

Finally, we save ~40 lines with the simplified logic in Operations.hs

For more info, see the blog post on the implementation,

    http://cgi.cse.unsw.edu.au/~dons/blog/2007/05/17#xmonad_part1b_zipper
2007-05-20 07:00:53 +00:00
Spencer Janssen
f9af744b1e Read is not needed for StackSet 2007-05-16 05:42:33 +00:00
David Roundy
54ee507cca keep focus stack. 2007-05-10 13:16:37 +00:00
Spencer Janssen
c5c958dc2c Remove unsafe fromJust 2007-05-08 16:38:22 +00:00
Neil Mitchell
97141b9a07 Work around the fact that Yhc gets defaulting a bit wrong 2007-05-08 12:49:49 +00:00
Spencer Janssen
a846eb18ff Remove unsafe use of head 2007-05-08 15:21:16 +00:00
Spencer Janssen
f03ca10714 Make 'index' return Nothing, rather than error 2007-05-08 15:12:00 +00:00
Spencer Janssen
ba9e15e772 Use 'drop 1' rather than tail, skip equality check. 2007-05-08 15:09:43 +00:00
Spencer Janssen
1276edc861 StackSet.view: ignore invalid indices 2007-05-08 14:39:51 +00:00
Neil Mitchell
27f1f50071 Change the swap function so its Haskell 98, by using list-comps instead of pattern-guards. 2007-05-08 12:31:58 +00:00
David Roundy
ab27c7d48d make quickcheck tests friendlier to read. 2007-05-05 17:54:15 +00:00
Spencer Janssen
bedc069143 Add -fglasgow-exts for pattern guards. Properties.hs doesn't complain anymore 2007-05-03 21:42:21 +00:00
Spencer Janssen
1dff21001c First steps to adding floating layer 2007-05-02 19:59:17 +00:00
Don Stewart
df7d1d95fa remove redundant call to 'delete' in 'shift' 2007-04-30 03:11:51 +00:00
Don Stewart
8265cae8a8 clean 'delete' a little 2007-04-30 02:53:19 +00:00
Don Stewart
a07f0778ad shrink 'swap' 2007-04-30 02:48:13 +00:00
Don Stewart
9fafa995c7 shrink 'rotate' a little 2007-04-30 02:45:25 +00:00
Don Stewart
966da43176 move size into Properties.hs 2007-04-30 02:17:58 +00:00
Don Stewart
a839238483 don't need 'size' operation on StackSet 2007-04-30 01:59:27 +00:00
Don Stewart
9b80a36cf8 move fromList into Properties.hs, -17 loc 2007-04-29 03:58:04 +00:00
Spencer Janssen
ea94892e1c Remove toList 2007-04-26 00:57:13 +00:00
Don Stewart
bf0f487ca4 add 8 new QC tests, including tests of the layout algorithm 2007-04-19 04:08:33 +00:00
Spencer Janssen
c858e0be4e Remove useless pragma 2007-04-19 01:52:39 +00:00
Don Stewart
b765cc9706 Parameterise StackSet by two index types, rather than breaking abstraction 2007-04-19 01:27:05 +00:00
Don Stewart
cf2c9f7328 tweak loc count to match count_lines script 2007-04-18 22:47:25 +00:00
Don Stewart
f3f83af393 Promote now swaps focused window with master window
This means other windows are unaffected.
The change from the previous cycling behaviour was felt necessary, since
cycling isn't a terribly useful operation.

Some properties that hold:
    focus is unchanged by promotion
    promote is idempotent (promoting twice does nothing)
    the focused and master window will swap their positions in the stack
2007-04-18 22:42:36 +00:00
Don Stewart
4b626ff729 and the tests still run 2007-04-11 08:15:00 +00:00
Don Stewart
e9597b4899 Change semantics of 'promote'.
Previously 'promote' would move the currently focused window into the
master position in tiled mode. This was *almost* a cycle of the windows,
but not quite (depending on where the focus was, it was in fact a
cycle).

Now we do the obvious generalisation, and just cycle the current window
stack. Simpler to understand, simpler to reason about.
2007-04-11 07:34:56 +00:00
Don Stewart
10a9f73be8 merge with toList/fromList patch 2007-04-11 06:09:47 +00:00
Don Stewart
c490333d12 Statically distinguish Workspace and Screen indices 2007-04-11 06:04:56 +00:00
Jason Creighton
c6dcc9d869 fromList/toList have # of screens + another QC property 2007-04-11 04:42:15 +00:00
Jason Creighton
ac913104a5 Xinerama screen switching bugfix 2007-04-11 04:16:15 +00:00
Jason Creighton
0c95f0c143 moved screen <-> workspace mapping from XMonad to StackSet 2007-04-10 06:27:31 +00:00
Alec Berryman
df4bda60ff Remove trailing spaces, no content changed 2007-04-01 14:45:39 +00:00
Don Stewart
b3dbe98e64 formatting only 2007-04-01 00:47:26 +00:00
daniel
5e6407df7f allow mouse to change current workspace 2007-03-28 10:34:35 +00:00
Spencer Janssen
a05115bb72 Add promote 2007-03-22 22:15:47 +00:00
Spencer Janssen
8a1a3333a8 Add raiseFocus. 2007-03-20 16:01:35 +00:00
Spencer Janssen
f1a0796da3 Decouple the concepts of focus and window order. First step to tiling! 2007-03-20 05:11:24 +00:00
Jason Creighton
bb43b2ad6f basic xinerama support (depends on Graphics.X11.Xinerama in X11-extras) 2007-03-17 23:49:04 +00:00
Don Stewart
8941aaaaf2 unnec. export list 2007-03-09 09:13:28 +00:00
Don Stewart
faab935ced unnec. `nub' 2007-03-09 09:10:45 +00:00
Don Stewart
6386569f9b just use Map, not int map. strict updates don't seem to help btw. 2007-03-09 08:37:06 +00:00
Don Stewart
4d7af3b953 comments on whether we lose space due to lazy updates of the stack set 2007-03-09 08:16:21 +00:00
Don Stewart
914192cc70 explicit interface on StackSet. maybe it should be a seperate package ... ? 2007-03-09 06:12:55 +00:00
Don Stewart
0ea4260a4c simpler type (no need to cache size, we *could* grow new stacks on demand now) 2007-03-09 04:36:38 +00:00
Don Stewart
d93cd66d11 replace Seq [a] with IntMap [a], hopefully gets 6.4 support 2007-03-09 04:30:35 +00:00
Don Stewart
7e2caa4707 simplify StackSet api even further (-15 loc) 2007-03-09 04:17:07 +00:00
Don Stewart
436fbd7865 shrink StackSet api 2007-03-09 03:56:03 +00:00