From 4292cbce3e1f77bae0297cea20b2e3fe67f98121 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 18 Jul 2011 12:44:55 +0200 Subject: Don't change the ordering of the window list we get from _NET_CLIENT_LIST, as that is the order we tab through --- lib/Phi/Widgets/Taskbar.hs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'lib/Phi/Widgets') diff --git a/lib/Phi/Widgets/Taskbar.hs b/lib/Phi/Widgets/Taskbar.hs index 92c93e8..80a5cc7 100644 --- a/lib/Phi/Widgets/Taskbar.hs +++ b/lib/Phi/Widgets/Taskbar.hs @@ -317,7 +317,7 @@ taskbarRunner :: Phi -> Display -> IO () taskbarRunner phi dispvar = do let screens = getScreens dispvar (windows, states, icons, scaledIcons, windowScreens) <- liftIO $ withDisplay dispvar $ \disp -> do - (windows, states, icons, scaledIcons, windowScreens) <- getWindowStates disp screens (getAtoms dispvar) [] M.empty M.empty M.empty M.empty + (windows, states, icons, scaledIcons, windowScreens) <- getWindowStates disp screens (getAtoms dispvar) M.empty M.empty M.empty M.empty desktopCount <- getDesktopCount disp (getAtoms dispvar) current <- getCurrentDesktop disp (getAtoms dispvar) activeWindow <- getActiveWindow disp (getAtoms dispvar) @@ -367,7 +367,7 @@ handleEvent phi dispvar XExtras.PropertyEvent {XExtras.ev_atom = atom, XExtras.e sendMessage phi Repaint when (atom == atom_NET_CLIENT_LIST atoms) $ do (windows, windowStates, icons, scaledIcons, windowScreens) <- get - (windows', windowStates', icons', scaledIcons', windowScreens') <- liftIO $ getWindowStates disp screens atoms windows windowStates icons scaledIcons windowScreens + (windows', windowStates', icons', scaledIcons', windowScreens') <- liftIO $ getWindowStates disp screens atoms windowStates icons scaledIcons windowScreens when (windows /= windows') $ do sendMessage phi $ WindowListUpdate windows' windowStates' icons' scaledIcons' windowScreens' @@ -425,10 +425,10 @@ getActiveWindow :: Xlib.Display -> Atoms -> IO Window getActiveWindow disp atoms = liftM (fromIntegral . fromMaybe 0 . join . fmap listToMaybe) $ XExtras.getWindowProperty32 disp (atom_NET_ACTIVE_WINDOW atoms) $ Xlib.defaultRootWindow disp -getWindowStates :: Xlib.Display -> [Xlib.Rectangle] -> Atoms -> [Window] -> M.Map Window WindowState -> M.Map Window [(Int, Surface)] -> M.Map Window (IORef (Maybe (Int, Surface))) -> M.Map Window Xlib.Rectangle +getWindowStates :: Xlib.Display -> [Xlib.Rectangle] -> Atoms -> M.Map Window WindowState -> M.Map Window [(Int, Surface)] -> M.Map Window (IORef (Maybe (Int, Surface))) -> M.Map Window Xlib.Rectangle -> IO ([Window], M.Map Window WindowState, M.Map Window [(Int, Surface)], M.Map Window (IORef (Maybe (Int, Surface))), M.Map Window Xlib.Rectangle) -getWindowStates disp screens atoms oldWindows windowStates windowIcons windowScaledIcons windowScreens = do - windows <- getWindowList disp atoms oldWindows +getWindowStates disp screens atoms windowStates windowIcons windowScaledIcons windowScreens = do + windows <- getWindowList disp atoms let windowStates' = map (\w -> (w, M.lookup w windowStates)) windows windowIcons' = map (\w -> (w, M.lookup w windowIcons)) windows @@ -543,11 +543,8 @@ showWindow disp atoms window = do ] -getWindowList :: Xlib.Display -> Atoms -> [Window] -> IO [Window] -getWindowList disp atoms windows = do - newWindows <- liftM (map fromIntegral . join . maybeToList) $ XExtras.getWindowProperty32 disp (atom_NET_CLIENT_LIST atoms) $ Xlib.defaultRootWindow disp - return $ (filter (flip elem newWindows) windows) ++ (filter (not . flip elem windows) newWindows) - +getWindowList :: Xlib.Display -> Atoms -> IO [Window] +getWindowList disp atoms = liftM (map fromIntegral . join . maybeToList) $ XExtras.getWindowProperty32 disp (atom_NET_CLIENT_LIST atoms) $ Xlib.defaultRootWindow disp taskbar :: TaskbarConfig -> Widget taskbar config = do -- cgit v1.2.3