diff options
author | Jason Creighton <jcreigh@gmail.com> | 2007-06-01 03:51:37 +0200 |
---|---|---|
committer | Jason Creighton <jcreigh@gmail.com> | 2007-06-01 03:51:37 +0200 |
commit | dba1257bd521925f5e6524f1b49468beae5ea87a (patch) | |
tree | b3fdcc5997eab31b4c73299027a5b609666569bc | |
parent | 473dafebcd0c24b10a94c977b18e424ffca36543 (diff) | |
download | metatile-dba1257bd521925f5e6524f1b49468beae5ea87a.tar metatile-dba1257bd521925f5e6524f1b49468beae5ea87a.zip |
ignore numlock/capslock on mouse bindings
darcs-hash:20070601015137-b9aa7-51c6b9ec428c2d16d65b196384fa2ce953dda245
-rw-r--r-- | Config.hs-boot | 1 | ||||
-rw-r--r-- | Main.hs | 3 | ||||
-rw-r--r-- | Operations.hs | 16 |
3 files changed, 12 insertions, 8 deletions
diff --git a/Config.hs-boot b/Config.hs-boot index 681160a..ca01d46 100644 --- a/Config.hs-boot +++ b/Config.hs-boot @@ -3,3 +3,4 @@ import Graphics.X11.Xlib.Types (Dimension) import Graphics.X11.Xlib (KeyMask) borderWidth :: Dimension modMask :: KeyMask +numlockMask :: KeyMask @@ -106,8 +106,7 @@ grabKeys dpy rootw = do kc <- keysymToKeycode dpy sym -- "If the specified KeySym is not defined for any KeyCode, -- XKeysymToKeycode() returns zero." - when (kc /= '\0') $ mapM_ (grab kc . (mask .|.)) $ - [0, numlockMask, lockMask, numlockMask .|. lockMask] + when (kc /= '\0') $ mapM_ (grab kc . (mask .|.)) extraModifiers where grab kc m = grabKey dpy kc m rootw True grabModeAsync grabModeAsync diff --git a/Operations.hs b/Operations.hs index f1f5b21..1a25e99 100644 --- a/Operations.hs +++ b/Operations.hs @@ -15,7 +15,7 @@ module Operations where import XMonad import qualified StackSet as W -import {-# SOURCE #-} Config (borderWidth, modMask) +import {-# SOURCE #-} Config (borderWidth, modMask, numlockMask) import Data.Maybe import Data.List (genericIndex, intersectBy, partition, delete) @@ -239,13 +239,17 @@ rescreen = do -- --------------------------------------------------------------------- +extraModifiers :: [KeyMask] +extraModifiers = [0, numlockMask, lockMask, numlockMask .|. lockMask ] + -- | setButtonGrab. Tell whether or not to intercept clicks on a given window setButtonGrab :: Bool -> Window -> X () -setButtonGrab grab w = withDisplay $ \d -> io $ do - when (not grab) $ ungrabButton d anyButton anyModifier w - grabButton d anyButton mask w False (buttonPressMask .|. buttonReleaseMask) - grabModeAsync grabModeSync none none - where mask = if grab then anyModifier else modMask +setButtonGrab grabAll w = withDisplay $ \d -> io $ do + when (not grabAll) $ ungrabButton d anyButton anyModifier w + mapM_ (grab d) masks + where masks = if grabAll then [anyModifier] else map (modMask .|.) extraModifiers + grab d m = grabButton d anyButton m w False (buttonPressMask .|. buttonReleaseMask) + grabModeAsync grabModeSync none none -- --------------------------------------------------------------------- -- Setting keyboard focus |