From c8b6388fb842eaeda84e9e48b2743c88f0a9a11b Mon Sep 17 00:00:00 2001
From: David Roundy <droundy@darcs.net>
Date: Sun, 10 Jun 2007 15:38:36 +0000
Subject: [PATCH] a few modifications to event-sending to make Tabbed layout
 work.

---
 Main.hs       | 3 +--
 Operations.hs | 5 ++++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Main.hs b/Main.hs
index c17e741..8a475cb 100644
--- a/Main.hs
+++ b/Main.hs
@@ -186,6 +186,7 @@ handle e@(ButtonEvent {ev_window = w,ev_event_type = t,ev_button = b })
            else focus w
     -- If it's the root window, then it's something we
     -- grabbed in grabButtons. Otherwise, it's click-to-focus.
+    sendMessage e -- Always send button events.
 
 -- entered a normal window, makes this focused.
 handle e@(CrossingEvent {ev_window = w, ev_event_type = t})
@@ -225,5 +226,3 @@ handle e@(ConfigureRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do
 handle (ConfigureEvent {ev_window = w}) = whenX (isRoot w) rescreen
 
 handle e = sendMessage e -- trace (eventName e) -- ignoring
-
-instance Message Event
diff --git a/Operations.hs b/Operations.hs
index 7405ce7..b4c33cf 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -123,7 +123,7 @@ kill = withDisplay $ \d -> withFocused $ \w -> do
 -- ---------------------------------------------------------------------
 -- Managing windows
 
-data ModifyWindows = ModifyWindows deriving Typeable
+data ModifyWindows = ModifyWindows deriving ( Typeable, Eq )
 instance Message ModifyWindows
 
 -- | windows. Modify the current window list with a pure function, and refresh
@@ -345,6 +345,8 @@ sendMessage a = do n <- (W.tag . W.workspace . W.current) `fmap` gets windowset
                    whenJust ml' $ \l' -> do modify $ \s -> s { layouts = M.insert n (l',ls) (layouts s) }
                                             refresh
 
+instance Message Event
+
 --
 -- Builtin layout algorithms:
 --
@@ -436,6 +438,7 @@ splitVerticallyBy f = (mirrorRect *** mirrorRect) . splitHorizontallyBy f . mirr
 -- function and refresh.
 layout :: ((Layout, [Layout]) -> (Layout, [Layout])) -> X ()
 layout f = do
+    sendMessage ModifyWindows
     modify $ \s ->
         let n          = W.tag . W.workspace . W.current . windowset $ s
             (Just fl)  = M.lookup n $ layouts s