From bd637ba0b6e533f2171a7a71c93043d146d78ca7 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Thu, 10 Feb 2022 17:16:32 +0000 Subject: [PATCH] X.Prelude: Adapt cleanKeyMask to stripModMask addition to core (Unfortunately MIN_VERSION_xmonad has only 3 parameters and adding a cabal flag seems too heavyweight.) Relates: https://github.com/xmonad/xmonad/pull/374 Relates: https://github.com/xmonad/xmonad/issues/172 Relates: https://github.com/xmonad/xmonad-contrib/issues/290 --- XMonad/Prelude.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/XMonad/Prelude.hs b/XMonad/Prelude.hs index 227211d1a4..1b8caa51fa 100644 --- a/XMonad/Prelude.hs +++ b/XMonad/Prelude.hs @@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} -------------------------------------------------------------------- -- | @@ -127,8 +128,12 @@ keyToString = uncurry (++) . bimap (keymaskToString 0) keysymToString -- the X server already for compatibility reasons. For more info, see: -- cleanKeyMask :: X (KeyMask -> KeyMask) -cleanKeyMask = cleanKeyMask' <$> gets numberlockMask +#if MIN_VERSION_xmonad(0, 17, 1) +cleanKeyMask = cleanKeyMask' <$> join (asks (stripModMask . config)) +#else +cleanKeyMask = cleanKeyMask' . (lockMask .|.) <$> gets numberlockMask +#endif cleanKeyMask' :: KeyMask -> KeyMask -> KeyMask -cleanKeyMask' numLockMask mask = - mask .&. complement (numLockMask .|. lockMask) .&. (button1Mask - 1) +cleanKeyMask' stripMask mask = + mask .&. complement stripMask .&. (button1Mask - 1)