diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-08-21 08:47:32 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-08-21 08:47:32 +0200 |
commit | ddca7c3ec59a5b7c62a11afe225de40edbde85ff (patch) | |
tree | 0c04586460e7ff895b7d710b8bed43a3b0dd0329 /lib | |
parent | 022783f4a7fd5b85afa5eedffd8a2e6a07432e1d (diff) | |
download | phi-ddca7c3ec59a5b7c62a11afe225de40edbde85ff.tar phi-ddca7c3ec59a5b7c62a11afe225de40edbde85ff.zip |
Correctly handle widgets with zero weight
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Phi/X11.hs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/Phi/X11.hs b/lib/Phi/X11.hs index 2e3cb8a..b2b3c2c 100644 --- a/lib/Phi/X11.hs +++ b/lib/Phi/X11.hs @@ -30,7 +30,7 @@ import Phi.Phi import qualified Phi.Types as Phi import qualified Phi.Panel as Panel import qualified Phi.Widget as Widget -import Phi.Widget (Widget) +import Phi.Widget hiding (Display, handleMessage) import Phi.X11.Atoms import qualified Phi.Bindings.Util as Util @@ -39,19 +39,19 @@ data XConfig = XConfig { phiXScreenInfo :: !(Display -> IO [Rectangle]) } data PhiState w d = (Widget.Widget w d) => PhiState { phiRootImage :: !Surface - , phiPanels :: ![PanelState w d] - , phiRepaint :: !Bool - , phiShutdown :: !Bool - , phiShutdownHold :: !Int - } + , phiPanels :: ![PanelState w d] + , phiRepaint :: !Bool + , phiShutdown :: !Bool + , phiShutdownHold :: !Int + } data PanelState w d = (Widget.Widget w d) => PanelState { panelWindow :: !Window - , panelPixmap :: !Pixmap - , panelArea :: !Rectangle - , panelScreenArea :: !Rectangle - , panelWidget :: !w - , panelWidgetState :: !d - } + , panelPixmap :: !Pixmap + , panelArea :: !Rectangle + , panelScreenArea :: !Rectangle + , panelWidget :: !w + , panelWidgetState :: !d + } data PhiConfig = PhiConfig { phiPhi :: !Phi , phiPanelConfig :: !Panel.PanelConfig @@ -110,10 +110,11 @@ runPhi xconfig config widget = do dispmvar <- liftIO $ newMVar disp let screenPanels = zip screens panelWindows dispvar = Widget.Display dispmvar atoms screenPanels - widgetState <- liftIO $ Widget.initWidget widget phi dispvar + widget' = widget <~> separator 0 (if weight widget > 0 then 0 else 1) + widgetState <- liftIO $ Widget.initWidget widget' phi dispvar Widget.withDisplay dispvar $ \disp -> do - panels <- mapM (\(screen, window) -> createPanel disp window widget widgetState screen) screenPanels + panels <- mapM (\(screen, window) -> createPanel disp window widget' widgetState screen) screenPanels forM_ panels $ \panel -> do setPanelProperties disp panel |