Cleanup
This commit is contained in:
+10
-17
@@ -23,13 +23,8 @@ handleKeyboardEvent :: KeyboardEventData -> Input -> Input
|
||||
handleKeyboardEvent kev = case keyboardEventKeyMotion kev of
|
||||
Released -> pressedKeys . at scode .~ Nothing
|
||||
Pressed | keyboardEventRepeat kev -> addTermSignal scode
|
||||
Pressed | not (keyboardEventRepeat kev) ->
|
||||
(pressedKeys . at scode ?~ 0)
|
||||
. addTermSignal scode
|
||||
Pressed -> (pressedKeys . at scode ?~ 0) . addTermSignal scode
|
||||
where
|
||||
-- val
|
||||
-- | keyboardEventRepeat kev = LongPress 0
|
||||
-- | otherwise = InitialPress 0
|
||||
scode = (keysymScancode . keyboardEventKeysym) kev
|
||||
|
||||
addTermSignal :: Scancode -> Input -> Input
|
||||
@@ -46,9 +41,7 @@ addTermSignal sc = case sc of
|
||||
_ -> id
|
||||
|
||||
handleMouseMotionEvent :: MouseMotionEventData -> Configuration -> Input -> Input
|
||||
handleMouseMotionEvent mmev cfig =
|
||||
set mousePos themousepos
|
||||
. set mouseMoving True
|
||||
handleMouseMotionEvent mmev cfig = set mousePos themousepos . set mouseMoving True
|
||||
where
|
||||
P (V2 x y) = mouseMotionEventPos mmev
|
||||
themousepos =
|
||||
@@ -62,13 +55,13 @@ handleMouseWheelEvent mwev = scrollAmount +~ fromIntegral y
|
||||
V2 _ y = mouseWheelEventPos mwev
|
||||
|
||||
handleMouseButtonEvent :: MouseButtonEventData -> Input -> Input
|
||||
handleMouseButtonEvent mbev theinput = case mouseButtonEventMotion mbev of
|
||||
Released -> theinput & mouseButtons . at thebutton .~ Nothing
|
||||
& mouseButtonsReleased . at thebutton ?~ 0
|
||||
Pressed -> theinput
|
||||
& mouseButtons . at thebutton ?~ 0
|
||||
& mouseButtonsReleased . at thebutton .~ Nothing
|
||||
& clickPos . at thebutton ?~ (theinput ^. mousePos)
|
||||
handleMouseButtonEvent mbev inp = case mouseButtonEventMotion mbev of
|
||||
Released -> inp & mouseButtons . at but .~ Nothing
|
||||
& mouseButtonsReleased . at but ?~ 0
|
||||
Pressed -> inp
|
||||
& mouseButtons . at but ?~ 0
|
||||
& mouseButtonsReleased . at but .~ Nothing
|
||||
& clickPos . at but ?~ (inp ^. mousePos)
|
||||
-- note that mouse button down events are NOT repeating
|
||||
where
|
||||
thebutton = mouseButtonEventButton mbev
|
||||
but = mouseButtonEventButton mbev
|
||||
|
||||
Reference in New Issue
Block a user