summaryrefslogtreecommitdiffstats
path: root/lib/Phi/X11.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Phi/X11.hs')
-rw-r--r--lib/Phi/X11.hs21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/Phi/X11.hs b/lib/Phi/X11.hs
index 9b93328..af4cb0b 100644
--- a/lib/Phi/X11.hs
+++ b/lib/Phi/X11.hs
@@ -9,8 +9,7 @@ module Phi.X11 ( X11(..)
) where
import Graphics.XHB hiding (Window)
-import Graphics.XHB.Connection
-import qualified Graphics.XHB.Connection.Open as CO
+import Graphics.XHB.Connection.XCB
import Graphics.XHB.Gen.Xinerama
import Graphics.XHB.Gen.Xproto hiding (Window)
@@ -35,7 +34,7 @@ import System.Exit
import System.Posix.Signals
import System.Posix.Types
-import qualified Phi.Bindings.XCB as XCB
+import Phi.Bindings.Cairo
import Phi.Phi
import Phi.X11.Util
@@ -82,7 +81,6 @@ data PhiConfig w s c = PhiConfig { phiPhi :: !Phi
, phiPanelConfig :: !Panel.PanelConfig
, phiXConfig :: !XConfig
, phiX11 :: !X11
- , phiXCB :: !XCB.Connection
, phiWidget :: !w
}
@@ -125,10 +123,8 @@ runPhi xconfig config widget = do
installHandler sigQUIT (termHandler phi) Nothing
conn <- liftM fromJust connect
- xcb <- XCB.connect
- let dispname = displayInfo conn
- screen = (roots_Setup . connectionSetup $ conn) !! CO.screen dispname
+ let screen = (roots_Setup . connectionSetup $ conn) !! connectionScreen conn
atoms <- initAtoms conn
changeWindowAttributes conn (root_SCREEN screen) $ toValueParam [(CWEventMask, toMask [EventMaskPropertyChange, EventMaskStructureNotify])]
@@ -150,7 +146,6 @@ runPhi xconfig config widget = do
, phiXConfig = xconfig
, phiPanelConfig = config
, phiX11 = x11
- , phiXCB = xcb
, phiWidget = widget'
}
PhiState { phiRootImage = bg
@@ -319,7 +314,6 @@ receiveEvents phi conn =
updatePanels :: (Widget w s c X11) => PhiX w s c ()
updatePanels = do
X11 conn _ screen <- asks phiX11
- xcb <- asks phiXCB
w <- asks phiWidget
s <- gets phiWidgetState
rootImage <- gets phiRootImage
@@ -334,7 +328,7 @@ updatePanels = do
let visualtype = fromJust $ findVisualtype screen (root_visual_SCREEN screen)
- xbuffer <- liftIO $ withDimension area $ XCB.createXCBSurface xcb (fromXid . toXid $ pixmap) visualtype
+ xbuffer <- liftIO $ withDimension area $ createXCBSurface conn (fromXid . toXid $ pixmap) visualtype
liftIO $ (withDimension area $ withSimilarSurface xbuffer ContentColor) $ \buffer -> do
renderWith buffer $ do
@@ -360,7 +354,9 @@ updatePanels = do
surfaceFinish xbuffer
-- update window
- liftIO $ withDimension area $ XCB.clearArea xcb True (panelWindow panel) 0 0
+ liftIO $ do
+ clearArea conn $ withDimension area $ MkClearArea True (panelWindow panel) 0 0
+ flush conn
return $ panel { panelWidgetCache = cache' }
@@ -370,7 +366,6 @@ updatePanels = do
updateRootImage :: PhiX w s c ()
updateRootImage = do
X11 conn atoms screen <- asks phiX11
- xcb <- asks phiXCB
let visualtype = fromJust $ findVisualtype screen (root_visual_SCREEN screen)
rootwin = root_SCREEN screen
@@ -399,7 +394,7 @@ updateRootImage = do
setSourceRGB 0 0 0
paint
_ -> do
- rootSurface <- liftIO $ XCB.createXCBSurface xcb (fromXid . toXid $ pixmap) visualtype (fromIntegral pixmapWidth) (fromIntegral pixmapHeight)
+ rootSurface <- liftIO $ createXCBSurface conn (fromXid . toXid $ pixmap) visualtype (fromIntegral pixmapWidth) (fromIntegral pixmapHeight)
renderWith bg $ withPatternForSurface rootSurface $ \pattern -> do
setSource pattern