From 3edf8fec9066d2bc0e8791f04650e0b000a6643a Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Thu, 6 Nov 2008 23:40:31 +0100 Subject: 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 --- XMonad/Main.hsc | 8 +++++--- 1 file 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 -- cgit v1.2.3