From 7e00195c4b959d536c1e2e9efe2b9621863c636d Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Fri, 5 Oct 2007 11:17:33 +0000 Subject: [PATCH] Tabbed: check if we really have a window to focus --- Tabbed.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tabbed.hs b/Tabbed.hs index 689e4a64..a93f7b45 100644 --- a/Tabbed.hs +++ b/Tabbed.hs @@ -138,8 +138,10 @@ handleEvent :: Invisible Maybe Shrinker -> TConf -> TabState -> Event -> X () handleEvent ishr conf (TabState {tabsWindows = tws, scr = screen, fontS = fs }) (ButtonEvent {ev_window = thisw, ev_subwindow = thisbw, ev_event_type = t }) | t == buttonPress, tl <- map fst tws, thisw `elem` tl || thisbw `elem` tl = do - focus (fromJust $ lookup thisw tws) - updateTab ishr conf fs width (thisw, fromJust $ lookup thisw tws) + case lookup thisw tws of + Just x -> do focus x + updateTab ishr conf fs width (thisw, x) + Nothing -> return () where width = rect_width screen`div` fromIntegral (length tws)