Adjust to patched xhb version
This commit is contained in:
parent
579552b29b
commit
456f9fb6e6
7 changed files with 23 additions and 21 deletions
|
@ -6,7 +6,7 @@ module Phi.X11.AtomList ( atoms
|
|||
|
||||
import Language.Haskell.TH
|
||||
|
||||
import Graphics.XHB
|
||||
import Graphics.XHB.Connection
|
||||
import Graphics.XHB.Connection.Open
|
||||
|
||||
atoms :: [String]
|
||||
|
|
|
@ -10,6 +10,7 @@ import Data.List
|
|||
|
||||
import Language.Haskell.TH
|
||||
import Graphics.XHB
|
||||
import Graphics.XHB.Connection
|
||||
import Graphics.XHB.Gen.Xproto
|
||||
|
||||
import Phi.X11.AtomList
|
||||
|
|
|
@ -29,7 +29,7 @@ import Graphics.XHB.Gen.Xproto
|
|||
import System.IO.Unsafe
|
||||
|
||||
|
||||
getReply' :: String -> Receipt a -> IO a
|
||||
getReply' :: ConnectionClass c r => String -> r a -> IO a
|
||||
getReply' m = getReply >=> return . fromRight
|
||||
where
|
||||
fromRight (Left _) = error m
|
||||
|
@ -60,17 +60,17 @@ castToCChar input = unsafePerformIO $
|
|||
with input $ \ptr ->
|
||||
peekArray (sizeOf input) (castPtr ptr)
|
||||
|
||||
changeProperty8 :: Connection -> PropMode -> WINDOW -> ATOM -> ATOM -> [Word8] -> IO ()
|
||||
changeProperty8 :: ConnectionClass c r => c -> PropMode -> WINDOW -> ATOM -> ATOM -> [Word8] -> IO ()
|
||||
changeProperty8 conn mode win prop proptype propdata = changeProperty conn $ MkChangeProperty mode win prop proptype 8 (genericLength propdata) propdata
|
||||
|
||||
changeProperty16 :: Connection -> PropMode -> WINDOW -> ATOM -> ATOM -> [Word16] -> IO ()
|
||||
changeProperty16 :: ConnectionClass c r => c -> PropMode -> WINDOW -> ATOM -> ATOM -> [Word16] -> IO ()
|
||||
changeProperty16 conn mode win prop proptype propdata = changeProperty conn $ MkChangeProperty mode win prop proptype 16 (genericLength propdata) (castWord16to8 propdata)
|
||||
|
||||
changeProperty32 :: Connection -> PropMode -> WINDOW -> ATOM -> ATOM -> [Word32] -> IO ()
|
||||
changeProperty32 :: ConnectionClass c r => c -> PropMode -> WINDOW -> ATOM -> ATOM -> [Word32] -> IO ()
|
||||
changeProperty32 conn mode win prop proptype propdata = changeProperty conn $ MkChangeProperty mode win prop proptype 32 (genericLength propdata) (castWord32to8 propdata)
|
||||
|
||||
|
||||
getProperty' :: Word8 -> Connection -> WINDOW -> ATOM -> IO (Maybe [Word8])
|
||||
getProperty' :: ConnectionClass c r => Word8 -> c -> WINDOW -> ATOM -> IO (Maybe [Word8])
|
||||
getProperty' format conn win prop = do
|
||||
reply <- getProperty conn (MkGetProperty False win prop (fromXid xidNone) 0 4) >>= getReply
|
||||
case reply of
|
||||
|
@ -84,13 +84,13 @@ getProperty' format conn win prop = do
|
|||
Right (MkGetPropertyReply {format_GetPropertyReply = format'}) | format' /= format -> return Nothing
|
||||
Right (MkGetPropertyReply {value_GetPropertyReply = value}) -> return $ Just value
|
||||
|
||||
getProperty8 :: Connection -> WINDOW -> ATOM -> IO (Maybe [Word8])
|
||||
getProperty8 :: ConnectionClass c r => c -> WINDOW -> ATOM -> IO (Maybe [Word8])
|
||||
getProperty8 = getProperty' 8
|
||||
|
||||
getProperty16 :: Connection -> WINDOW -> ATOM -> IO (Maybe [Word16])
|
||||
getProperty16 :: ConnectionClass c r => c -> WINDOW -> ATOM -> IO (Maybe [Word16])
|
||||
getProperty16 conn win prop = getProperty' 16 conn win prop >>= return . fmap castWord8to16
|
||||
|
||||
getProperty32 :: Connection -> WINDOW -> ATOM -> IO (Maybe [Word32])
|
||||
getProperty32 :: ConnectionClass c r => c -> WINDOW -> ATOM -> IO (Maybe [Word32])
|
||||
getProperty32 conn win prop = getProperty' 32 conn win prop >>= return . fmap castWord8to32
|
||||
|
||||
|
||||
|
|
Reference in a new issue