From 1d4e51ff5a48dd282b94441583faec7f66e99a10 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 22 Nov 2022 16:55:07 -0700 Subject: More consistent handling with button mapping. Button mapping is now similar in architecture to KeyMapping. As a consequence it works with the pending buffer. --- src/Rahm/Desktop/Keys/Dsl.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Rahm/Desktop/Keys') diff --git a/src/Rahm/Desktop/Keys/Dsl.hs b/src/Rahm/Desktop/Keys/Dsl.hs index adb2668..7f06a74 100644 --- a/src/Rahm/Desktop/Keys/Dsl.hs +++ b/src/Rahm/Desktop/Keys/Dsl.hs @@ -21,7 +21,12 @@ data KeyBinding type KeyBindings = Map (KeyMask, KeySym) (Documented KeyBinding) -type ButtonBinding = Window -> X () +data ButtonBinding + = ButtonAction (Window -> X ()) + | ButtonSubmap ButtonBindings + | ButtonContinuous ButtonBindings + +-- Window -> X () type ButtonBindings = Map (KeyMask, Button) ButtonBinding @@ -52,6 +57,9 @@ class Binding k b where rawMask :: KeyMask -> k -> BindingBuilder b () rawMask m x = BindingBuilder $ modify' (second ((m, toB x) :)) +instance Binding (Window -> X ()) ButtonBinding where + toB = ButtonAction + instance Binding (X ()) (Documented KeyBinding) where toB = Documented "" . Action -- cgit