summaryrefslogtreecommitdiffstats
path: root/Operations.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-06-04 08:36:57 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-06-04 08:36:57 +0200
commit6e02ebc8c107593d224e4e6fdbfdbe951957fb32 (patch)
tree80030ce5a2799846da4349c6c1d6906ee78cc150 /Operations.hs
parent3988e0eaaed37cedfdb7b09119ca93667c837072 (diff)
downloadmetatile-6e02ebc8c107593d224e4e6fdbfdbe951957fb32.tar
metatile-6e02ebc8c107593d224e4e6fdbfdbe951957fb32.zip
Merge windows and refresh
darcs-hash:20070604063657-a5988-502d9499134fce6562a8327ce3257d63a16207f2
Diffstat (limited to 'Operations.hs')
-rw-r--r--Operations.hs77
1 files changed, 37 insertions, 40 deletions
diff --git a/Operations.hs b/Operations.hs
index 469f153..92585db 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -114,44 +114,9 @@ kill = withDisplay $ \d -> withFocused $ \w -> do
-- | windows. Modify the current window list with a pure function, and refresh
windows :: (WindowSet -> WindowSet) -> X ()
windows f = do
- old <- gets windowset
- let new = f old
- modify (\s -> s { windowset = new })
- refresh
-
- -- We now go to some effort to compute the minimal set of windows to hide.
- -- The minimal set being only those windows which weren't previously hidden,
- -- which is the intersection of previously visible windows with those now hidden
- mapM_ hide . concatMap (W.integrate . W.stack) $
- intersectBy (\w x -> W.tag w == W.tag x)
- (map W.workspace $ W.current old : W.visible old)
- (W.hidden new)
-
- clearEnterEvents
-
- -- TODO: move this into StackSet. This isn't exactly the usual integrate.
-
--- | setWMState. set the WM_STATE property
-setWMState :: Window -> Int -> X ()
-setWMState w v = withDisplay $ \dpy -> do
- a <- atom_WM_STATE
- io $ changeProperty32 dpy w a a propModeReplace [fromIntegral v, fromIntegral none]
-
--- | hide. Hide a window by unmapping it.
-hide :: Window -> X ()
-hide w = withDisplay $ \d -> do
- io $ unmapWindow d w
- setWMState w 3 --iconic
-
--- | refresh. Render the currently visible workspaces, as determined by
--- the StackSet. Also, set focus to the focused window.
---
--- This is our 'view' operation (MVC), in that it pretty prints our model
--- with X calls.
---
-refresh :: X ()
-refresh = do
- XState { windowset = ws, layouts = fls, xineScreens = xinesc, statusGaps = gaps } <- get
+ XState { windowset = old, layouts = fls, xineScreens = xinesc, statusGaps = gaps } <- get
+ let ws = f old
+ modify (\s -> s { windowset = ws })
d <- asks display
-- for each workspace, layout the currently visible workspaces
@@ -199,9 +164,41 @@ refresh = do
io $ restackWindows d (flt ++ tiled')
setTopFocus
- clearEnterEvents
-- withWindowSet (io . hPrint stderr) -- logging state changes!
--- io performGC -- really helps
+ -- io performGC -- really helps
+
+ -- We now go to some effort to compute the minimal set of windows to hide.
+ -- The minimal set being only those windows which weren't previously hidden,
+ -- which is the intersection of previously visible windows with those now hidden
+ mapM_ hide . concatMap (W.integrate . W.stack) $
+ intersectBy (\w x -> W.tag w == W.tag x)
+ (map W.workspace $ W.current old : W.visible old)
+ (W.hidden ws)
+
+ clearEnterEvents
+
+ -- TODO: move this into StackSet. This isn't exactly the usual integrate.
+
+-- | setWMState. set the WM_STATE property
+setWMState :: Window -> Int -> X ()
+setWMState w v = withDisplay $ \dpy -> do
+ a <- atom_WM_STATE
+ io $ changeProperty32 dpy w a a propModeReplace [fromIntegral v, fromIntegral none]
+
+-- | hide. Hide a window by unmapping it.
+hide :: Window -> X ()
+hide w = withDisplay $ \d -> do
+ io $ unmapWindow d w
+ setWMState w 3 --iconic
+
+-- | refresh. Render the currently visible workspaces, as determined by
+-- the StackSet. Also, set focus to the focused window.
+--
+-- This is our 'view' operation (MVC), in that it pretty prints our model
+-- with X calls.
+--
+refresh :: X ()
+refresh = windows id
-- | clearEnterEvents. Remove all window entry events from the event queue.
clearEnterEvents :: X ()