summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <spencerjanssen@gmail.com>2008-11-06 23:40:31 +0100
committerSpencer Janssen <spencerjanssen@gmail.com>2008-11-06 23:40:31 +0100
commit6a033ebd9a2fa56edb676323cc947337678feca2 (patch)
tree1bd707ce2f5f6675f42cc82e56bdcee3ef0a91cb
parentc9a3ea8f5bf3c3aac20999809c8cf2b8fd236d0b (diff)
downloadmetatile-6a033ebd9a2fa56edb676323cc947337678feca2.tar
metatile-6a033ebd9a2fa56edb676323cc947337678feca2.zip
Change screen focus by clicking on the root window.
This is a modification of a patch from Joachim Breitner. darcs-hash:20081106224031-25a6b-975b5af81ed6b1c3baa73015f3ff3dd009a31a9f
-rw-r--r--XMonad/Main.hsc8
1 files changed, 5 insertions, 3 deletions
diff --git a/XMonad/Main.hsc b/XMonad/Main.hsc
index 454a3e6..acb3bfd 100644
--- a/XMonad/Main.hsc
+++ b/XMonad/Main.hsc
@@ -71,6 +71,7 @@ xmonad initxmc = do
-- an error.
selectInput dpy rootw $ substructureRedirectMask .|. substructureNotifyMask
.|. enterWindowMask .|. leaveWindowMask .|. structureNotifyMask
+ .|. buttonPressMask
sync dpy False -- sync to ensure all outstanding errors are delivered
-- turn off the default handler in favor of one that ignores all errors
@@ -229,9 +230,10 @@ handle e@(ButtonEvent {ev_window = w,ev_event_type = t,ev_button = b })
-- grabbed in grabButtons. Otherwise, it's click-to-focus.
isr <- isRoot w
m <- cleanMask $ ev_state e
- ba <- asks buttonActions
- if isr then userCode $ whenJust (M.lookup (m, b) ba) ($ ev_subwindow e)
- else focus w
+ mact <- asks (M.lookup (m, b) . buttonActions)
+ case mact of
+ (Just act) | isr -> act $ ev_subwindow e
+ _ -> focus w
broadcastMessage e -- Always send button events.
-- entered a normal window: focus it if focusFollowsMouse is set to