summaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-03-07 08:49:10 +0100
committerDon Stewart <dons@cse.unsw.edu.au>2007-03-07 08:49:10 +0100
commit4c7e9568ee8d5db7dd60ba174b6814de5d5b909e (patch)
tree837f730c0891bce82ea98927d1a0b5168f100f79 /Main.hs
parent04c83e1bfa8192d4fa6a157490cb1f01a1ed55cc (diff)
downloadmetatile-4c7e9568ee8d5db7dd60ba174b6814de5d5b909e.tar
metatile-4c7e9568ee8d5db7dd60ba174b6814de5d5b909e.zip
-Wall police. and strip the binary
darcs-hash:20070307074910-9c5c1-c82071afe812d1e1e6f4577c07c1d7b0b141c6c9
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs22
1 files changed, 12 insertions, 10 deletions
diff --git a/Main.hs b/Main.hs
index 70e2574..7f761f0 100644
--- a/Main.hs
+++ b/Main.hs
@@ -40,7 +40,7 @@ keys = M.fromList
, ((mod1Mask, xK_Tab ), focus 1)
, ((mod1Mask, xK_j ), focus 1)
, ((mod1Mask, xK_k ), focus (-1))
- , (mod1Mask .|. shiftMask, xK_c ), kill)
+ , ((mod1Mask .|. shiftMask, xK_c ), kill)
, ((mod1Mask .|. shiftMask, xK_q ), io $ exitWith ExitSuccess)
]
@@ -58,10 +58,10 @@ main = do
, windows = [] }
runW initState $ do
- root <- io $ rootWindow dpy dflt
- io $ do selectInput dpy root (substructureRedirectMask .|. substructureNotifyMask)
+ r <- io $ rootWindow dpy dflt
+ io $ do selectInput dpy r (substructureRedirectMask .|. substructureNotifyMask)
sync dpy False
- registerKeys dpy root
+ registerKeys dpy r
go dpy
return ()
@@ -72,9 +72,9 @@ main = do
handle e
-- register keys
- registerKeys dpy root = forM_ (M.keys keys) $ \(mod,sym) -> io $ do
- kc <- keysymToKeycode dpy sym
- grabKey dpy kc mod root True grabModeAsync grabModeAsync
+ registerKeys dpy r = forM_ (M.keys keys) $ \(m,s) -> io $ do
+ kc <- keysymToKeycode dpy s
+ grabKey dpy kc m r True grabModeAsync grabModeAsync
--
-- The event handler
@@ -84,11 +84,13 @@ handle (MapRequestEvent {window = w}) = manage w
handle (DestroyWindowEvent {window = w}) = unmanage w
handle (UnmapEvent {window = w}) = unmanage w
-handle (KeyEvent {event_type = t, state = mod, keycode = code})
+handle (KeyEvent {event_type = t, state = m, keycode = code})
| t == keyPress = do
dpy <- gets display
- sym <- io $ keycodeToKeysym dpy code 0
- M.lookup (mod,sym) keys
+ s <- io $ keycodeToKeysym dpy code 0
+ case M.lookup (m,s) keys of
+ Nothing -> return ()
+ Just a -> a
handle e@(ConfigureRequestEvent {}) = do
dpy <- gets display