aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
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
commit3edf8fec9066d2bc0e8791f04650e0b000a6643a (patch)
tree1bd707ce2f5f6675f42cc82e56bdcee3ef0a91cb /XMonad
parent92d7fd5a58ef27216b416617001b73e7f5ce969e (diff)
downloadxmonad-3edf8fec9066d2bc0e8791f04650e0b000a6643a.tar.gz
xmonad-3edf8fec9066d2bc0e8791f04650e0b000a6643a.tar.xz
xmonad-3edf8fec9066d2bc0e8791f04650e0b000a6643a.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.gz
Diffstat (limited to 'XMonad')
-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