aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2010-02-22 15:45:12 +0100
committerAdam Vogt <vogt.adam@gmail.com>2010-02-22 15:45:12 +0100
commit85ce17a356afa5371be37f4bc2a46c54987343ce (patch)
tree1fd5ed844cab3b3dfddb9d398ece4524e9308810 /XMonad
parentd11fc9b2358ace8b4727c9b9d905be94879b44f7 (diff)
downloadxmonad-85ce17a356afa5371be37f4bc2a46c54987343ce.tar.gz
xmonad-85ce17a356afa5371be37f4bc2a46c54987343ce.tar.xz
xmonad-85ce17a356afa5371be37f4bc2a46c54987343ce.zip
Resolve conflicts Geoff Reedy's window focus hack.
Ignore-this: a71f3cb0507642e828f4bdfdc7ccd289 darcs-hash:20100222144512-1499c-f733b3d845d3d45da0713653796caae461b09b15.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Main.hsc8
-rw-r--r--XMonad/Operations.hs23
2 files changed, 23 insertions, 8 deletions
diff --git a/XMonad/Main.hsc b/XMonad/Main.hsc
index 33838c8..0d279f9 100644
--- a/XMonad/Main.hsc
+++ b/XMonad/Main.hsc
@@ -121,12 +121,8 @@ xmonad initxmc = do
, keyActions = keys xmc xmc
, buttonActions = mouseBindings xmc xmc
, mouseFocused = False
- , mousePosition = Nothing }
- st = XState
- { windowset = initialWinset
- , mapped = S.empty
- , waitingUnmap = M.empty
- , dragging = Nothing }
+ , mousePosition = Nothing
+ , currentEvent = Nothing }
st = XState
{ windowset = initialWinset
diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs
index 048434d..401a812 100644
--- a/XMonad/Operations.hs
+++ b/XMonad/Operations.hs
@@ -325,8 +325,27 @@ setFocusX w = withWindowSet $ \ws -> do
-- If we ungrab buttons on the root window, we lose our mouse bindings.
whenX (not <$> isRoot w) $ setButtonGrab False w
- io $ do setInputFocus dpy w revertToPointerRoot 0
- -- raiseWindow dpy w
+
+ hints <- io $ getWMHints dpy w
+ protocols <- io $ getWMProtocols dpy w
+ wmprot <- atom_WM_PROTOCOLS
+ wmtf <- atom_WM_TAKE_FOCUS
+ currevt <- asks currentEvent
+ let inputHintSet = wmh_flags hints `testBit` inputHintBit
+
+ when ((inputHintSet && wmh_input hints) || (not inputHintSet)) $
+ io $ do setInputFocus dpy w revertToPointerRoot 0
+ when (wmtf `elem` protocols) $
+ io $ allocaXEvent $ \ev -> do
+ setEventType ev clientMessage
+ setClientMessageEvent ev w wmprot 32 wmtf $ maybe currentTime event_time currevt
+ sendEvent dpy w False noEventMask ev
+ where event_time ev =
+ if (ev_event_type ev) `elem` timedEvents then
+ ev_time ev
+ else
+ currentTime
+ timedEvents = [ keyPress, keyRelease, buttonPress, buttonRelease, enterNotify, leaveNotify, selectionRequest ]
------------------------------------------------------------------------
-- Message handling