Tabbed: check if we really have a window to focus

This commit is contained in:
Andrea Rossato
2007-10-05 11:17:33 +00:00
parent b9abecd4f2
commit 7e00195c4b

View File

@@ -138,8 +138,10 @@ handleEvent :: Invisible Maybe Shrinker -> TConf -> TabState -> Event -> X ()
handleEvent ishr conf (TabState {tabsWindows = tws, scr = screen, fontS = fs }) handleEvent ishr conf (TabState {tabsWindows = tws, scr = screen, fontS = 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
focus (fromJust $ lookup thisw tws) case lookup thisw tws of
updateTab ishr conf fs width (thisw, fromJust $ lookup thisw tws) Just x -> do focus x
updateTab ishr conf fs width (thisw, x)
Nothing -> return ()
where where
width = rect_width screen`div` fromIntegral (length tws) width = rect_width screen`div` fromIntegral (length tws)