From aacba82c15c390c980a62a4bebf7b1d0244ecd9a Mon Sep 17 00:00:00 2001 From: Jason Creighton Date: Mon, 11 Jun 2007 03:54:37 +0200 Subject: use safe peek instead of unsafe focus Fixes crashing bug with Xinerama where you have a tabbed layout on one screen and attempt to switch to an empty workspace on the other. darcs-hash:20070611015437-b9aa7-19e093acecdf9c248a965625b226b82b1422ffd0.gz --- Tabbed.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Tabbed.hs') diff --git a/Tabbed.hs b/Tabbed.hs index 6eaa754..d88077a 100644 --- a/Tabbed.hs +++ b/Tabbed.hs @@ -10,7 +10,7 @@ module XMonadContrib.Tabbed ( tabbed ) where -- defaultLayouts = [ tabbed -- , ... ] -import Control.Monad ( forM ) +import Control.Monad ( forM, liftM ) import Control.Monad.State ( gets ) import Graphics.X11.Xlib @@ -32,8 +32,7 @@ dolay sc@(Rectangle x y wid _) ws = maketab (t,w) = newDecoration t 1 0x000000 0x777777 (drawtab t w) (focus w) drawtab r@(Rectangle _ _ wt ht) w d w' gc = do nw <- getName w - focusw <- gets (W.focus . W.stack . W.workspace . W.current . windowset) - let tabcolor = if focusw == w then 0xBBBBBB else 0x888888 + tabcolor <- (maybe 0x888888 (\focusw -> if focusw == w then 0xBBBBBB else 0x888888) . W.peek) `liftM` gets windowset io $ setForeground d gc tabcolor io $ fillRectangles d w' gc [Rectangle 0 0 wt ht] io $ setForeground d gc 0x000000 -- cgit v1.2.3