summaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-03-09 06:54:17 +0100
committerDon Stewart <dons@cse.unsw.edu.au>2007-03-09 06:54:17 +0100
commit539ce237c209cf4f161b3ef29110737372047769 (patch)
treea2c93e6591341d5eebeae9ebf557608fd0cd3686 /Main.hs
parent4261b9a398a5bc27e01ca15ee385f91e9a0304dc (diff)
downloadmetatile-539ce237c209cf4f161b3ef29110737372047769.tar
metatile-539ce237c209cf4f161b3ef29110737372047769.zip
refactor, -10 or so loc
darcs-hash:20070309055417-9c5c1-6d4119932cae7f8f885b0d1ce674efc25f7488e8
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/Main.hs b/Main.hs
index 4a7a914..76fd0d7 100644
--- a/Main.hs
+++ b/Main.hs
@@ -147,14 +147,18 @@ refresh :: W ()
refresh = do
ws <- gets workspace
whenJust (W.peek ws) $ \w ->
- withScreen $ \(d,sw,sh) -> io $ do
- moveResizeWindow d w 0 0 (fromIntegral sw) (fromIntegral sh) -- fullscreen
- raiseWindow d w
+ withDisplay $ \d -> do
+ sw <- gets screenWidth
+ sh <- gets screenHeight
+ io $ do moveResizeWindow d w 0 0 (fromIntegral sw) (fromIntegral sh) -- fullscreen
+ raiseWindow d w
-- | hide. Hide a list of windows by moving them offscreen.
hide :: Window -> W ()
-hide w = withScreen $ \(dpy,sw,sh) -> io $
- moveWindow dpy w (2*fromIntegral sw) (2*fromIntegral sh)
+hide w = withDisplay $ \d -> do
+ sw <- gets screenWidth
+ sh <- gets screenHeight
+ io $ moveWindow d w (2*fromIntegral sw) (2*fromIntegral sh)
-- | reveal. Expose a list of windows, moving them on screen
reveal :: Window -> W ()
@@ -162,7 +166,11 @@ reveal w = withDisplay $ \d -> io $ moveWindow d w 0 0
-- | windows. Modify the current window list with a pure function, and refresh
windows :: (WorkSpace -> WorkSpace) -> W ()
-windows f = modifyWorkspace f >> refresh
+windows f = do
+ modify $ \s -> s { workspace = f (workspace s) }
+ ws <- gets workspace
+ refresh
+ trace (show ws) -- log state changes to stderr
-- ---------------------------------------------------------------------
-- Window operations