diff options
author | Andrea Rossato <andrea.rossato@unibz.it> | 2007-12-24 18:10:20 +0100 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@unibz.it> | 2007-12-24 18:10:20 +0100 |
commit | e8d74a86b7e6715242f10f78b35a1bf2c1305238 (patch) | |
tree | d7e966b5bd4f2561ce2df5492b134dc3bafd619e /XMonad/Util | |
parent | c6cb52a0bd9b59b1e5c1440d463bf319e0d8ee5d (diff) | |
download | XMonadContrib-e8d74a86b7e6715242f10f78b35a1bf2c1305238.tar.gz XMonadContrib-e8d74a86b7e6715242f10f78b35a1bf2c1305238.tar.xz XMonadContrib-e8d74a86b7e6715242f10f78b35a1bf2c1305238.zip |
Fix isssue 105
issue 105 was due to the fact that tab windows created when
bootstrapping the windowset after a restart where managed. Setting the
override_redirect attributes to True fixes the issue.
Added the possibility to set the override_redirect attribute with
XMonad.Util.XUtils.creationNewWindow
darcs-hash:20071224171020-32816-74cb79d8000d00c6eb9abdcf71474df5d0d9c735.gz
Diffstat (limited to '')
-rw-r--r-- | XMonad/Util/XUtils.hs | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/XMonad/Util/XUtils.hs b/XMonad/Util/XUtils.hs index 32d9294..7bd0ed7 100644 --- a/XMonad/Util/XUtils.hs +++ b/XMonad/Util/XUtils.hs @@ -3,7 +3,7 @@ -- Module : XMonad.Util.XUtils -- Copyright : (c) 2007 Andrea Rossato -- License : BSD-style (see xmonad/LICENSE) --- +-- -- Maintainer : andrea.rossato@unibz.it -- Stability : unstable -- Portability : unportable @@ -12,7 +12,7 @@ -- ----------------------------------------------------------------------------- -module XMonad.Util.XUtils ( +module XMonad.Util.XUtils ( -- * Usage: -- $usage averagePixels @@ -44,15 +44,16 @@ averagePixels p1 p2 f = let mn x1 x2 = round (fromIntegral x1 * f + fromIntegral x2 * (1-f)) Color p _ _ _ _ <- io $ allocColor d cm (Color 0 (mn r1 r2) (mn g1 g2) (mn b1 b2) 0) return p + -- | Create a simple window given a rectangle. If Nothing is given -- only the exposureMask will be set, otherwise the Just value. -- Use 'showWindow' to map and hideWindow to unmap. -createNewWindow :: Rectangle -> Maybe EventMask -> String -> X Window -createNewWindow (Rectangle x y w h) m col = do +createNewWindow :: Rectangle -> Maybe EventMask -> String -> Bool -> X Window +createNewWindow (Rectangle x y w h) m col o = do d <- asks display rw <- asks theRoot - c <- stringToPixel d col - win <- io $ createSimpleWindow d rw x y w h 0 c c + c <- stringToPixel d col + win <- io $ mkWindow d (defaultScreenOfDisplay d) rw x y w h c o case m of Just em -> io $ selectInput d win em Nothing -> io $ selectInput d win exposureMask @@ -77,9 +78,9 @@ deleteWindow w = do io $ destroyWindow d w -- | Fill a window with a rectangle and a border -paintWindow :: Window -- ^ The window where to draw +paintWindow :: Window -- ^ The window where to draw -> Dimension -- ^ Window width - -> Dimension -- ^ Window height + -> Dimension -- ^ Window height -> Dimension -- ^ Border width -> String -- ^ Window background color -> String -- ^ Border color @@ -88,10 +89,10 @@ paintWindow w wh ht bw c bc = paintWindow' w (Rectangle 0 0 wh ht) bw c bc Nothing -- | Fill a window with a rectangle and a border, and write a string at given position -paintAndWrite :: Window -- ^ The window where to draw +paintAndWrite :: Window -- ^ The window where to draw -> XMonadFont -- ^ XMonad Font for drawing -> Dimension -- ^ Window width - -> Dimension -- ^ Window height + -> Dimension -- ^ Window height -> Dimension -- ^ Border width -> String -- ^ Window background color -> String -- ^ Border color @@ -130,6 +131,21 @@ paintWindow' win (Rectangle x y wh ht) bw color b_color str = do io $ freePixmap d p io $ freeGC d gc +-- | Creates a window with the possibility of setting some attributes. +-- Not exported. +mkWindow :: Display -> Screen -> Window -> Position + -> Position -> Dimension -> Dimension -> Pixel -> Bool -> IO Window +mkWindow d s rw x y w h p o = do + let visual = defaultVisualOfScreen s + attrmask = cWOverrideRedirect .|. cWBackPixel .|. cWBorderPixel + allocaSetWindowAttributes $ + \attributes -> do + set_override_redirect attributes o + set_border_pixel attributes p + set_background_pixel attributes p + createWindow d rw x y w h 0 (defaultDepthOfScreen s) + inputOutput visual attrmask attributes + -- | Short-hand for 'fromIntegral' fi :: (Integral a, Num b) => a -> b fi = fromIntegral |