From 957f46de4f33f99369ec296d7936653ccae1b835 Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Mon, 4 Jun 2007 08:36:57 +0200 Subject: Merge windows and refresh darcs-hash:20070604063657-a5988-502d9499134fce6562a8327ce3257d63a16207f2.gz --- Operations.hs | 77 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 40 deletions(-) (limited to 'Operations.hs') 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 () -- cgit v1.2.3