summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--XMonad/Core.hs1
-rw-r--r--XMonad/Main.hsc3
-rw-r--r--XMonad/Operations.hs7
3 files changed, 8 insertions, 3 deletions
diff --git a/XMonad/Core.hs b/XMonad/Core.hs
index 26f2617..4b52439 100644
--- a/XMonad/Core.hs
+++ b/XMonad/Core.hs
@@ -69,6 +69,7 @@ data XConf = XConf
-- ^ a mapping of key presses to actions
, buttonActions :: !(M.Map (KeyMask, Button) (Window -> X ()))
-- ^ a mapping of button presses to actions
+ , mouseFocused :: !Bool -- ^ was refocus caused by mouse action?
}
-- todo, better name
diff --git a/XMonad/Main.hsc b/XMonad/Main.hsc
index a0100a6..cecbcec 100644
--- a/XMonad/Main.hsc
+++ b/XMonad/Main.hsc
@@ -98,7 +98,8 @@ xmonad initxmc = do
, normalBorder = nbc
, focusedBorder = fbc
, keyActions = keys xmc xmc
- , buttonActions = mouseBindings xmc xmc }
+ , buttonActions = mouseBindings xmc xmc
+ , mouseFocused = False }
st = XState
{ windowset = initialWinset
, mapped = S.empty
diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs
index 1e6e322..4c2623b 100644
--- a/XMonad/Operations.hs
+++ b/XMonad/Operations.hs
@@ -165,7 +165,8 @@ windows f = do
-- will overwrite withdrawnState with iconicState
mapM_ (flip setWMState withdrawnState) (W.allWindows old \\ W.allWindows ws)
- clearEvents enterWindowMask
+ isMouseFocused <- asks mouseFocused
+ unless isMouseFocused $ clearEvents enterWindowMask
-- | setWMState. set the WM_STATE property
setWMState :: Window -> Int -> X ()
@@ -294,7 +295,9 @@ setTopFocus = withWindowSet $ maybe (setFocusX =<< asks theRoot) setFocusX . W.p
-- the mouse to a new screen).
focus :: Window -> X ()
focus w = withWindowSet $ \s -> do
- if W.member w s then when (W.peek s /= Just w) $ windows (W.focusWindow w)
+ if W.member w s then when (W.peek s /= Just w) $ do
+ local (\c -> c { mouseFocused = True }) $ do
+ windows (W.focusWindow w)
else whenX (isRoot w) $ setFocusX w
-- | Call X to set the keyboard focus details.