diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2026-01-01 20:47:17 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2026-01-01 20:47:17 -0700 |
| commit | 4c5a5cc0eb92319719773e382fb43d5cb4098b13 (patch) | |
| tree | 4ad36814f75397af0515449a0753395f0dee5eb0 /plug/src/Montis/Dsl/Bind.hs | |
| parent | cb657fa9fc8124bdab42eb148e9b4a8ac69fc05e (diff) | |
| download | montis-main.tar.gz montis-main.tar.bz2 montis-main.zip | |
Diffstat (limited to 'plug/src/Montis/Dsl/Bind.hs')
| -rw-r--r-- | plug/src/Montis/Dsl/Bind.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plug/src/Montis/Dsl/Bind.hs b/plug/src/Montis/Dsl/Bind.hs index c7dbc43..ddba481 100644 --- a/plug/src/Montis/Dsl/Bind.hs +++ b/plug/src/Montis/Dsl/Bind.hs @@ -1,9 +1,11 @@ +{-# OPTIONS_GHC -Wno-unused-top-binds #-} -- | eDSL for the 'bind' function. The 'bind' function provides an easy way to -- bind certain actions to other actions. module Montis.Dsl.Bind ( bind, (.+), MatchEvent (..), + MatchModifiers (..), Modifier (..), released, weak, @@ -14,7 +16,6 @@ module Montis.Dsl.Bind where import Control.Monad -import Control.Monad.Trans import Data.Bits import Data.Word import Montis.Core.ButtonEvent (ButtonEvent(..)) @@ -82,19 +83,18 @@ data MatchModifiers = MatchModifiers } instance MatchEvent MatchModifiers where - matches (MatchModifiers weak bits base) ev = do + matches (MatchModifiers weakMatch bits base) ev = do mods <- getMods ev b <- liftW $ base ev return $ b - && ( (not weak && mods == bits) - || (weak && (bits .&. mods == bits)) + && ( (not weakMatch && mods == bits) + || (weakMatch && (bits .&. mods == bits)) ) where getMods (InputButtonEvent (ButtonEvent {ButtonEvent.modifiers = mods})) = return mods getMods (InputKeyEvent (KeyEvent {KeyEvent.modifiers = mods})) = return mods - getMods _ = getModifierState class LiftMatchModifiers a where toModifiers :: a -> MatchModifiers |