diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-07-17 19:20:19 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-07-17 19:20:19 +0200 |
commit | 0fefcaa35f217ca2e1f15e2dd77742adfd231571 (patch) | |
tree | 046600165a46fbb5a75508a5fe5b9e738124ab7e /lib/Phi/X11/Atoms.hs | |
parent | b66d6690d8a062053268b3246a2a55cbff46410d (diff) | |
download | phi-0fefcaa35f217ca2e1f15e2dd77742adfd231571.tar phi-0fefcaa35f217ca2e1f15e2dd77742adfd231571.zip |
Some initial systray code
Diffstat (limited to 'lib/Phi/X11/Atoms.hs')
-rw-r--r-- | lib/Phi/X11/Atoms.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Phi/X11/Atoms.hs b/lib/Phi/X11/Atoms.hs index 38f8f3c..acbae64 100644 --- a/lib/Phi/X11/Atoms.hs +++ b/lib/Phi/X11/Atoms.hs @@ -12,7 +12,7 @@ import Phi.X11.AtomList $(let atomsName = mkName "Atoms" - atomNames = map (\atom -> (atom, mkName ("atom" ++ atom))) atoms + atomNames = map (\atom -> (atom, mkName ("atom" ++ atom))) $ atoms ++ (map fst specialAtoms) fields = map (\(_, name) -> (name, IsStrict, ConT ''Atom)) atomNames in return [DataD [] atomsName [] [RecC atomsName fields] []] ) @@ -20,12 +20,17 @@ $(let atomsName = mkName "Atoms" initAtoms :: Display -> IO Atoms initAtoms display = $(do - atomNames <- mapM (\atom -> do + normalAtomNames <- mapM (\atom -> do varName <- newName ('_':atom) - return (atom, mkName ("atom" ++ atom), varName) + return ([|const atom|], mkName ("atom" ++ atom), varName) ) atoms + specialAtomNames <- mapM (\(name, atomgen) -> do + varName <- newName ('_':name) + return (atomgen, mkName ("atom" ++ name), varName) + ) specialAtoms + let atomNames = normalAtomNames ++ specialAtomNames atomInitializers <- forM atomNames $ - \(atom, _, varName) -> liftM (BindS (VarP varName)) [| internAtom display atom False |] + \(atomgen, _, varName) -> liftM (BindS (VarP varName)) [| internAtom display ($atomgen display) False |] let atomFieldExps = map (\(_, atomName, varName) -> (atomName, VarE varName)) atomNames atomsName = mkName "Atoms" |