[xmonad] darcs patch: Split out the X event get function from xmonad.

Lally Singh lally.singh at gmail.com
Thu Feb 26 15:29:15 UTC 2015


Hello!

 Please tell me what you think, of both the patch and the process I'm
sending this in-by.  First time for both.

Thanks!

1 patch for repository http://code.haskell.org/xmonad:

Thu Feb 26 10:22:06 EST 2015  lally.singh at gmail.com
  * Split out the X event get function from xmonad.

  This lets xmonad users specify their own functions that get the next X
event,
  and consequently have access to the Display and run in xmonad's thread.
Useful
  for providing such access to other threads.



New patches:

[Split out the X event get function from xmonad.
lally.singh at gmail.com**20150226152206
 Ignore-this: de10517364b9c642552ff62ebb614d28

 This lets xmonad users specify their own functions that get the next X
event,
 and consequently have access to the Display and run in xmonad's thread.
Useful
 for providing such access to other threads.

] {
hunk ./src/XMonad/Main.hs 49
 -- The main entry point
 --
 xmonad :: (LayoutClass l Window, Read (l Window)) => XConfig l -> IO ()
-xmonad initxmc = do
+xmonad initxmc = xmonad' defaultEventGetter initxmc
+
+-- | Default X event getter.
+defaultEventGetter :: Display -> XEventPtr -> X Event
+defaultEventGetter _ = io . getEvent
+
+-- | Actual entry point, with a parameter for the X event getter.  The
getter
+-- has access to the X event loop.
+xmonad' :: (LayoutClass l Window, Read (l Window)) => (Display ->
XEventPtr -> X Event) -> XConfig l -> IO ()
+xmonad' eventGetter initxmc = do
     -- setup locale information from environment
     setLocale LC_ALL Nothing
     -- ignore SIGPIPE and SIGCHLD
hunk ./src/XMonad/Main.hs 158
             userCode $ startupHook initxmc

             -- main loop, for all you HOF/recursion fans out there.
-            forever $ prehandle =<< io (nextEvent dpy e >> getEvent e)
+            forever $ prehandle =<< eventGetter dpy e

     return ()
       where
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20150226/f52116e5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: split-out-the-x-event-get-function-from-xmonad_.dpatch
Type: application/octet-stream
Size: 8557 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20150226/f52116e5/attachment.obj>


More information about the xmonad mailing list