summaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-03-12 02:07:56 +0100
committerDon Stewart <dons@cse.unsw.edu.au>2007-03-12 02:07:56 +0100
commit9f869f9af1d82bb916cdd1deb5d4756fe07f88c0 (patch)
tree4183e109d7e743618c7c56910f4d77c9921491d2 /Main.hs
parente7e0dd3aa0bb68b924ea29819d2d91640eab6339 (diff)
downloadmetatile-9f869f9af1d82bb916cdd1deb5d4756fe07f88c0.tar
metatile-9f869f9af1d82bb916cdd1deb5d4756fe07f88c0.zip
wibbles
darcs-hash:20070312010756-9c5c1-a24636e0c593d17f800bddc442466b727e7f4bde
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs25
1 files changed, 12 insertions, 13 deletions
diff --git a/Main.hs b/Main.hs
index 98f360d..c023853 100644
--- a/Main.hs
+++ b/Main.hs
@@ -218,11 +218,11 @@ windows f = do
hide :: Window -> X ()
hide w = withDisplay $ \d -> do
(sw,sh) <- gets dimensions
- io $! moveWindow d w (2*fromIntegral sw) (2*fromIntegral sh)
+ io $ moveWindow d w (2*fromIntegral sw) (2*fromIntegral sh)
-- | reveal. Expose a list of windows, moving them on screen
reveal :: Window -> X ()
-reveal w = withDisplay $ \d -> io $! moveWindow d w 0 0
+reveal w = withDisplay $ \d -> io $ moveWindow d w 0 0
-- ---------------------------------------------------------------------
-- Window operations
@@ -247,10 +247,16 @@ unmanage w = do
ws <- gets workspace
when (W.member w ws) $ do
modify $ \s -> s { workspace = W.delete w (workspace s) }
- withDisplay $ \d ->
- withServerX d $ do
- setTopFocus
- io (sync d False)
+ withServerX $ do
+ setTopFocus
+ withDisplay $ \d -> io (sync d False) -- TODO, everything operates on the current display, so wrap it up.
+
+-- | Grab the X server (lock it) from the X monad
+withServerX :: X () -> X ()
+withServerX f = withDisplay $ \dpy -> do
+ io $ grabServer dpy
+ f
+ io $ ungrabServer dpy
-- | Explicitly set the keyboard focus to the given window
setFocus :: Window -> X ()
@@ -268,13 +274,6 @@ setTopFocus = do
isRoot :: Window -> X Bool
isRoot w = liftM (w==) (gets theRoot)
--- | Grab the X server (lock it) from the X monad
-withServerX :: Display -> X () -> X ()
-withServerX dpy f = do
- io $ grabServer dpy
- f
- io $ ungrabServer dpy
-
-- | raise. focus to window at offset 'n' in list.
-- The currently focused window is always the head of the list
raise :: Ordering -> X ()