summaryrefslogtreecommitdiff
path: root/protocols/Wayland/Protocols/Core/WLOutput.hs
blob: 2989fe54370c4297ba0f687f82452d9a6742cc0f (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TypeFamilies #-}

module Wayland.Protocols.Core.WLOutput
  ( Subpixel(..)
  , Transform(..)
  , Mode(..)
  , Geometry(..)
  , Request(..)
  , Event(..)
  , Handle(..)
  ) where

import Data.Data (Typeable)
import Wayland.Server (ResourceClass(..), RequestClass(..), ObjectID)

newtype Handle = Handle ObjectID
  deriving (Show, Eq, Ord)

instance ResourceClass Handle where
  type ResourceEvent   Handle = Event
  type ResourceRequest Handle = Request
  objectID (Handle h) = h
  interface _ = undefined

data Subpixel
  = SubpixelUnknown
  | SubpixelNone
  | SubpixelHorizontalRgb
  | SubpixelHorizontalBgr
  | SubpixelVerticalRgb
  | SubpixelVerticalBgr

data Transform
  = TransformNormal
  | TransformNormal90
  | TransformNormal180
  | TransformNormal270
  | TransformFlipped
  | TransformFlipped90
  | TransformFlipped180
  | TransformFlipped270

data Mode
  = Mode { current   :: Bool
         , preferred :: Bool }

data Geometry
  = Geometry { x              :: Int
             , y              :: Int
             , physicalWidth  :: Int
             , physicalHeight :: Int
             , subpixel       :: Subpixel
             , make           :: String
             , model          :: String
             , transform      :: Transform }

data Request
  = ReqRelease Handle
  deriving (Typeable, Show)

instance RequestClass Request

data Event
  = EvGeometry    Geometry
  | EvMode        Mode
  | EvScale       Int
  | EvName        String
  | EvDescription String
  | EvDone