From da9d918dc3ccf11f10c5fedb30f5fdc5c7be5022 Mon Sep 17 00:00:00 2001
From: Geoff Reedy <geoff@programmer-monk.net>
Date: Mon, 22 Jun 2009 05:56:49 +0200
Subject: track currently processing event

Ignore-this: da2e82037548ab176a4333056c94a07a

darcs-hash:20090622035649-8d81a-de848ab7c732ae633b5c21333370d5aca43bf939.gz
---
 XMonad/Core.hs  | 2 ++
 XMonad/Main.hsc | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

(limited to 'XMonad')

diff --git a/XMonad/Core.hs b/XMonad/Core.hs
index cc3bf3e..b8ba1b1 100644
--- a/XMonad/Core.hs
+++ b/XMonad/Core.hs
@@ -86,6 +86,8 @@ data XConf = XConf
     , mousePosition :: !(Maybe (Position, Position))
                                       -- ^ position of the mouse according to
                                       -- the event currently being processed
+    , currentEvent :: !(Maybe Event)
+                                      -- ^ event currently being processed
     }
 
 -- todo, better name
diff --git a/XMonad/Main.hsc b/XMonad/Main.hsc
index ed3fc59..33838c8 100644
--- a/XMonad/Main.hsc
+++ b/XMonad/Main.hsc
@@ -122,6 +122,11 @@ xmonad initxmc = do
             , buttonActions = mouseBindings xmc xmc
             , mouseFocused  = False
             , mousePosition = Nothing }
+        st = XState
+            { windowset     = initialWinset
+            , mapped        = S.empty
+            , waitingUnmap  = M.empty
+            , dragging      = Nothing }
 
         st = XState
             { windowset       = initialWinset
@@ -163,7 +168,7 @@ xmonad initxmc = do
         prehandle e = let mouse = do guard (ev_event_type e `elem` evs)
                                      return (fromIntegral (ev_x_root e)
                                             ,fromIntegral (ev_y_root e))
-                      in local (\c -> c { mousePosition = mouse }) (handleWithHook e)
+                      in local (\c -> c { mousePosition = mouse, currentEvent = Just e }) (handleWithHook e)
         evs = [ keyPress, keyRelease, enterNotify, leaveNotify
               , buttonPress, buttonRelease]
 
-- 
cgit v1.2.3