aboutsummaryrefslogtreecommitdiff
path: root/montis/src/Montis/Core/Events.hs
blob: 91b8618c3e726668151b2820e406ca5234dc02c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module Montis.Core.Events where

import Data.Word (Word32)
import Montis.Base.Foreign.WlRoots.Types

data KeyState = KeyPressed | KeyReleased deriving (Show, Read, Eq, Enum, Ord)

data KeyEvent = KeyEvent
  { keyEvent_timeMs :: Word32,
    keyEvent_keycode :: Word32,
    keyEvent_state :: KeyState,
    keyEvent_modifiers :: Word32,
    keyEvent_keysym :: Word32,
    keyEvent_codepoint :: Char,
    keyEvent_device :: WlrInputDevice
  }
  deriving (Show, Ord, Eq)

data ButtonState = ButtonReleased | ButtonPressed deriving (Show, Read, Eq, Enum, Ord)

data ButtonEvent = ButtonEvent
  { buttonEvent_pointer :: WlrPointer,
    buttonEvent_timeMs :: Word32,
    buttonEvent_button :: Word32,
    buttonEvent_modifiers :: Word32,
    buttonEvent_state :: ButtonState
  }
  deriving (Eq, Show, Ord)

data MotionEvent = MotionEvent
  { motionEvent_pointer :: WlrPointer,
    motionEvent_timeMs :: Word32,
    motionEvent_modifiers :: Word32,
    motionEvent_absolute :: (Double, Double),
    motionEvent_raw :: (Double, Double)
  }
  deriving (Eq, Show, Ord)

data SurfaceState = Map | Unmap | Destroy
  deriving (Eq, Ord, Show, Read, Enum)

data SurfaceEvent = SurfaceEvent
  { surfaceEvent_state :: SurfaceState,
    surfaceEvent_surface :: Surface
  }
  deriving (Eq, Ord, Show)