mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
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
This commit is contained in:
parent
7e0186ef4e
commit
0c835744c2
@ -131,6 +131,6 @@ doLay mirror (DragPane mw ty delta split) r s = do
|
|||||||
newDragWin :: Rectangle -> X Window
|
newDragWin :: Rectangle -> X Window
|
||||||
newDragWin r = do
|
newDragWin r = do
|
||||||
let mask = Just $ exposureMask .|. buttonPressMask
|
let mask = Just $ exposureMask .|. buttonPressMask
|
||||||
w <- createNewWindow r mask handleColor
|
w <- createNewWindow r mask handleColor False
|
||||||
showWindow w
|
showWindow w
|
||||||
return w
|
return w
|
||||||
|
@ -94,7 +94,7 @@ data TabState =
|
|||||||
TabState { tabsWindows :: [(Window,Window)]
|
TabState { tabsWindows :: [(Window,Window)]
|
||||||
, scr :: Rectangle
|
, scr :: Rectangle
|
||||||
, font :: XMonadFont
|
, font :: XMonadFont
|
||||||
}
|
}
|
||||||
|
|
||||||
data Tabbed s a =
|
data Tabbed s a =
|
||||||
Tabbed (Invisible Maybe TabState) s TConf
|
Tabbed (Invisible Maybe TabState) s TConf
|
||||||
@ -136,8 +136,8 @@ handleMess _ _ = return Nothing
|
|||||||
|
|
||||||
handleEvent :: Shrinker s => s -> TConf -> TabState -> Event -> X ()
|
handleEvent :: Shrinker s => s -> TConf -> TabState -> Event -> X ()
|
||||||
-- button press
|
-- button press
|
||||||
handleEvent ishr conf (TabState {tabsWindows = tws, scr = screen, font = fs})
|
handleEvent ishr conf (TabState {tabsWindows = tws, scr = screen, font = fs})
|
||||||
(ButtonEvent {ev_window = thisw, ev_subwindow = thisbw, ev_event_type = t})
|
(ButtonEvent {ev_window = thisw, ev_subwindow = thisbw, ev_event_type = t })
|
||||||
| t == buttonPress, tl <- map fst tws, thisw `elem` tl || thisbw `elem` tl = do
|
| t == buttonPress, tl <- map fst tws, thisw `elem` tl || thisbw `elem` tl = do
|
||||||
case lookup thisw tws of
|
case lookup thisw tws of
|
||||||
Just x -> do focus x
|
Just x -> do focus x
|
||||||
@ -182,7 +182,7 @@ createTabs c (Rectangle x y wh ht) owl@(ow:ows) = do
|
|||||||
height = fromIntegral $ tabSize c
|
height = fromIntegral $ tabSize c
|
||||||
mask = Just (exposureMask .|. buttonPressMask)
|
mask = Just (exposureMask .|. buttonPressMask)
|
||||||
d <- asks display
|
d <- asks display
|
||||||
w <- createNewWindow (Rectangle x y wid height) mask (inactiveColor c)
|
w <- createNewWindow (Rectangle x y wid height) mask (inactiveColor c) True
|
||||||
io $ restackWindows d $ w : [ow]
|
io $ restackWindows d $ w : [ow]
|
||||||
ws <- createTabs c (Rectangle (x + fromIntegral wid) y (wh - wid) ht) ows
|
ws <- createTabs c (Rectangle (x + fromIntegral wid) y (wh - wid) ht) ows
|
||||||
return (w:ws)
|
return (w:ws)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
-- Module : XMonad.Util.XUtils
|
-- Module : XMonad.Util.XUtils
|
||||||
-- Copyright : (c) 2007 Andrea Rossato
|
-- Copyright : (c) 2007 Andrea Rossato
|
||||||
-- License : BSD-style (see xmonad/LICENSE)
|
-- License : BSD-style (see xmonad/LICENSE)
|
||||||
--
|
--
|
||||||
-- Maintainer : andrea.rossato@unibz.it
|
-- Maintainer : andrea.rossato@unibz.it
|
||||||
-- Stability : unstable
|
-- Stability : unstable
|
||||||
-- Portability : unportable
|
-- Portability : unportable
|
||||||
@ -12,7 +12,7 @@
|
|||||||
--
|
--
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module XMonad.Util.XUtils (
|
module XMonad.Util.XUtils (
|
||||||
-- * Usage:
|
-- * Usage:
|
||||||
-- $usage
|
-- $usage
|
||||||
averagePixels
|
averagePixels
|
||||||
@ -44,15 +44,16 @@ averagePixels p1 p2 f =
|
|||||||
let mn x1 x2 = round (fromIntegral x1 * f + fromIntegral x2 * (1-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)
|
Color p _ _ _ _ <- io $ allocColor d cm (Color 0 (mn r1 r2) (mn g1 g2) (mn b1 b2) 0)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
-- | Create a simple window given a rectangle. If Nothing is given
|
-- | Create a simple window given a rectangle. If Nothing is given
|
||||||
-- only the exposureMask will be set, otherwise the Just value.
|
-- only the exposureMask will be set, otherwise the Just value.
|
||||||
-- Use 'showWindow' to map and hideWindow to unmap.
|
-- Use 'showWindow' to map and hideWindow to unmap.
|
||||||
createNewWindow :: Rectangle -> Maybe EventMask -> String -> X Window
|
createNewWindow :: Rectangle -> Maybe EventMask -> String -> Bool -> X Window
|
||||||
createNewWindow (Rectangle x y w h) m col = do
|
createNewWindow (Rectangle x y w h) m col o = do
|
||||||
d <- asks display
|
d <- asks display
|
||||||
rw <- asks theRoot
|
rw <- asks theRoot
|
||||||
c <- stringToPixel d col
|
c <- stringToPixel d col
|
||||||
win <- io $ createSimpleWindow d rw x y w h 0 c c
|
win <- io $ mkWindow d (defaultScreenOfDisplay d) rw x y w h c o
|
||||||
case m of
|
case m of
|
||||||
Just em -> io $ selectInput d win em
|
Just em -> io $ selectInput d win em
|
||||||
Nothing -> io $ selectInput d win exposureMask
|
Nothing -> io $ selectInput d win exposureMask
|
||||||
@ -77,9 +78,9 @@ deleteWindow w = do
|
|||||||
io $ destroyWindow d w
|
io $ destroyWindow d w
|
||||||
|
|
||||||
-- | Fill a window with a rectangle and a border
|
-- | 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 width
|
||||||
-> Dimension -- ^ Window height
|
-> Dimension -- ^ Window height
|
||||||
-> Dimension -- ^ Border width
|
-> Dimension -- ^ Border width
|
||||||
-> String -- ^ Window background color
|
-> String -- ^ Window background color
|
||||||
-> String -- ^ Border 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
|
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
|
-- | 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
|
-> XMonadFont -- ^ XMonad Font for drawing
|
||||||
-> Dimension -- ^ Window width
|
-> Dimension -- ^ Window width
|
||||||
-> Dimension -- ^ Window height
|
-> Dimension -- ^ Window height
|
||||||
-> Dimension -- ^ Border width
|
-> Dimension -- ^ Border width
|
||||||
-> String -- ^ Window background color
|
-> String -- ^ Window background color
|
||||||
-> String -- ^ Border 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 $ freePixmap d p
|
||||||
io $ freeGC d gc
|
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'
|
-- | Short-hand for 'fromIntegral'
|
||||||
fi :: (Integral a, Num b) => a -> b
|
fi :: (Integral a, Num b) => a -> b
|
||||||
fi = fromIntegral
|
fi = fromIntegral
|
||||||
|
Loading…
x
Reference in New Issue
Block a user