summaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-03-09 04:06:44 +0100
committerDon Stewart <dons@cse.unsw.edu.au>2007-03-09 04:06:44 +0100
commit31a0863d89d6934479f64060522b773b09dbb36c (patch)
tree575df9944b1773d7a7ff88b4abf63af5dbbb69ab /Main.hs
parent6515e1bdb7ca00cdad80cc66d09cfcc18ae7e64b (diff)
downloadmetatile-31a0863d89d6934479f64060522b773b09dbb36c.tar
metatile-31a0863d89d6934479f64060522b773b09dbb36c.zip
handle MappingNotifyEvent properly, and missing test in MapRequestEvent. firefox still won't take the keyboard though
darcs-hash:20070309030644-9c5c1-1730b17391d547fc94d76bb0bab601578074659c
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/Main.hs b/Main.hs
index 4be96b4..42fcfdf 100644
--- a/Main.hs
+++ b/Main.hs
@@ -109,18 +109,17 @@ grabKeys dpy r = forM_ (M.keys keys) $ \(m,s) -> io $ do
-- [UnmapNotify] = unmapnotify
--
handle :: Event -> W ()
-handle (MapRequestEvent {window = w}) = manage w
+handle (MapRequestEvent {window = w}) = withDisplay $ \dpy -> do
+ wa <- io $ getWindowAttributes dpy w
+ when (not (waOverrideRedirect wa)) $ manage w
+
handle (DestroyWindowEvent {window = w}) = unmanage w
handle (UnmapEvent {window = w}) = unmanage w
-handle (MappingNotifyEvent {window = w}) = do
- trace $ "Got mapping notify event for window: " ++ show w
-
-{-
-, mapping= m@(r,_,_)}) = do
+handle e@(MappingNotifyEvent {window = w}) = do
+ let m = (request e, first_keycode e, count e)
io $ refreshKeyboardMapping m
- when (r == mappingKeyboard) $ withDisplay $ \d -> grabKeys d w
--}
+ when (request e == mappingKeyboard) $ withDisplay $ flip grabKeys w
handle (KeyEvent {event_type = t, state = m, keycode = code})
| t == keyPress = withDisplay $ \dpy -> do