getAtomName is now defined in the X11 library

This commit is contained in:
Daniel Wagner
2013-02-25 18:03:23 +00:00
parent 8bfe148416
commit 5c04a573db

View File

@@ -42,27 +42,12 @@ import Codec.Binary.UTF8.String
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe)
import Data.Monoid import Data.Monoid
import Foreign import Foreign
import Foreign.C.String
import Foreign.C.Types import Foreign.C.Types
import Numeric (showHex) import Numeric (showHex)
import System.Exit import System.Exit
import System.IO import System.IO
import System.Process import System.Process
-- this should move into X11
foreign import ccall unsafe "XGetAtomName"
xGetAtomName :: Display -> Atom -> IO CString
getAtomName :: Display -> Atom -> IO (Maybe String)
getAtomName d a = do
n <- xGetAtomName d a
if n == nullPtr
then return Nothing
else do
n' <- peekCString n
xFree n
return $ Just n'
-- | Event hook to dump all received events. You should probably not use this -- | Event hook to dump all received events. You should probably not use this
-- unconditionally; it will produce massive amounts of output. -- unconditionally; it will produce massive amounts of output.
debugEventsHook :: Event -> X All debugEventsHook :: Event -> X All