diff options
Diffstat (limited to 'lib/Phi/Widgets/Systray.hs')
-rw-r--r-- | lib/Phi/Widgets/Systray.hs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/Phi/Widgets/Systray.hs b/lib/Phi/Widgets/Systray.hs index 385a740..e9311de 100644 --- a/lib/Phi/Widgets/Systray.hs +++ b/lib/Phi/Widgets/Systray.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies, DeriveDataTypeable #-} +{-# LANGUAGE MultiParamTypeClasses, DeriveDataTypeable #-} module Phi.Widgets.Systray ( systray ) where @@ -48,16 +48,16 @@ instance Show (IORef a) where data SystrayIconState = SystrayIconState !Window !Window deriving Show data SystrayState = SystrayState !Phi !Rectangle !Int !(IORef Int) ![SystrayIconState] deriving Show +instance Eq SystrayState where + _ == _ = False -data Systray = Systray deriving Show +data Systray = Systray deriving (Show, Eq) data SystrayMessage = AddIcon !Window !Window | RemoveIcon !Window | RenderIcon !Window !Window !Int !Int !Int !Int !Bool deriving (Show, Typeable) -instance WidgetClass Systray where - type WidgetData Systray = SystrayState - +instance WidgetClass Systray SystrayState where initWidget (Systray) phi dispvar = do phi' <- dupPhi phi forkIO $ systrayRunner phi' dispvar @@ -71,15 +71,13 @@ instance WidgetClass Systray where weight _ = 0 - render Systray (SystrayState phi systrayScreen reset lastResetRef icons) w h screen = case True of + render Systray (SystrayState phi systrayScreen reset lastResetRef icons) x y w h screen = case True of _ | screen == systrayScreen -> do lastReset <- liftIO $ readIORef lastResetRef liftIO $ writeIORef lastResetRef reset - Matrix _ _ _ _ dx dy <- getMatrix forM_ (zip [0..] icons) $ \(i, SystrayIconState midParent window) -> do - let x = round dx + i*(h+2) - y = round dy - sendMessage phi $ RenderIcon midParent window x y h h (lastReset /= reset) + let x' = x + i*(h+2) + sendMessage phi $ RenderIcon midParent window x' y h h (lastReset /= reset) | otherwise -> return () |