summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-03-08 14:05:17 +0100
committerDon Stewart <dons@cse.unsw.edu.au>2007-03-08 14:05:17 +0100
commit59ac26db7d151a7c69787ba8a08777649b8f3d71 (patch)
treec9591f93e8c61502bb1a3c36fb9b852eaf02b43d
parentfc7791f96abe49af78c3d6ae1be86bd933dffa1d (diff)
downloadmetatile-59ac26db7d151a7c69787ba8a08777649b8f3d71.tar
metatile-59ac26db7d151a7c69787ba8a08777649b8f3d71.zip
stub for MappingNotifyEvent, based on dwm. But the X11-extras binding for this event needs doing (sjanssen?)
darcs-hash:20070308130517-9c5c1-83193a446a74e9a50467a4f52aeb71632e4d8a64
-rw-r--r--Main.hs43
1 files changed, 37 insertions, 6 deletions
diff --git a/Main.hs b/Main.hs
index 176631a..4be96b4 100644
--- a/Main.hs
+++ b/Main.hs
@@ -72,7 +72,7 @@ main = do
r <- io $ rootWindow dpy dflt
io $ do selectInput dpy r (substructureRedirectMask .|. substructureNotifyMask)
sync dpy False
- registerKeys dpy r
+ grabKeys dpy r
(_, _, ws) <- io $ queryTree dpy r
forM_ ws $ \w -> do
wa <- io $ getWindowAttributes dpy w
@@ -86,19 +86,42 @@ main = do
e <- io $ allocaXEvent $ \ev -> nextEvent dpy ev >> getEvent ev
handle e
- -- register keys
- registerKeys dpy r = forM_ (M.keys keys) $ \(m,s) -> io $ do
- kc <- keysymToKeycode dpy s
- grabKey dpy kc m r True grabModeAsync grabModeAsync
+-- | Grab the keys back
+grabKeys :: Display -> Window -> W ()
+grabKeys dpy r = forM_ (M.keys keys) $ \(m,s) -> io $ do
+ kc <- keysymToKeycode dpy s
+ grabKey dpy kc m r True grabModeAsync grabModeAsync
--
-- | handle. Handle X events
+-- dwm handles:
+--
+-- [ButtonPress] = buttonpress,
+-- [ConfigureRequest] = configurerequest,
+-- [DestroyNotify] = destroynotify,
+-- [EnterNotify] = enternotify,
+-- [LeaveNotify] = leavenotify,
+-- [Expose] = expose,
+-- [KeyPress] = keypress,
+-- [MappingNotify] = mappingnotify,
+-- [MapRequest] = maprequest,
+-- [PropertyNotify] = propertynotify,
+-- [UnmapNotify] = unmapnotify
--
handle :: Event -> W ()
handle (MapRequestEvent {window = w}) = 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
+ io $ refreshKeyboardMapping m
+ when (r == mappingKeyboard) $ withDisplay $ \d -> grabKeys d w
+-}
+
handle (KeyEvent {event_type = t, state = m, keycode = code})
| t == keyPress = withDisplay $ \dpy -> do
s <- io $ keycodeToKeysym dpy code 0
@@ -117,7 +140,15 @@ handle e@(ConfigureRequestEvent {}) = do
}
io $ sync dpy False
-handle e = trace (eventName e) -- return ()
+-- Typical events I see still unhandled:
+-- ConfigureNotify
+-- MapNotify
+-- CreateNotify
+-- KeyRelease
+--
+-- In particular, ConfigureNotify and MapNotify a lot on firefox
+--
+handle e = trace (eventName e)
-- ---------------------------------------------------------------------
-- Managing windows