-
Notifications
You must be signed in to change notification settings - Fork 9
/
patch
165 lines (158 loc) · 6.96 KB
/
patch
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
diff -u -r generated/1.5/Graphics/XHB/Gen/Damage.hs patched/Graphics/XHB/Gen/Damage.hs
--- generated/1.5/Graphics/XHB/Gen/Damage.hs 2009-06-28 12:31:55.000000000 -0500
+++ patched/Graphics/XHB/Gen/Damage.hs 2009-06-28 12:31:56.000000000 -0500
@@ -2,6 +2,7 @@
(extension, queryVersion, create, destroy, subtract, add,
module Graphics.XHB.Gen.Damage.Types)
where
+import Prelude hiding (subtract)
import Graphics.XHB.Gen.Damage.Types
import Graphics.XHB.Connection.Internal
import Graphics.XHB.Connection.Extension
diff -u -r generated/1.5/Graphics/XHB/Gen/RandR/Types.hs patched/Graphics/XHB/Gen/RandR/Types.hs
--- generated/1.5/Graphics/XHB/Gen/RandR/Types.hs 2009-06-28 12:31:54.000000000 -0500
+++ patched/Graphics/XHB/Gen/RandR/Types.hs 2009-06-28 12:31:56.000000000 -0500
@@ -23,7 +23,7 @@
SetOutputPrimary(..), GetOutputPrimary(..),
GetOutputPrimaryReply(..), ScreenChangeNotifyEvent(..), Notify(..),
CrtcChange(..), OutputChange(..), OutputProperty(..),
- NotifyEvent(..))
+ NotifyEvent(..), NotifyData(..))
where
import Data.Word
import Data.Int
@@ -1655,11 +1655,36 @@
status <- liftM fromValue (deserialize :: Get Word8)
skip 11
return (MkOutputProperty window output atom timestamp status)
+
+
+data NotifyData = NotifyDataCrtcChange CrtcChange
+ | NotifyDataOutputChange OutputChange
+ | NotifyDataOutputProperty OutputProperty
+ deriving (Show, Typeable, Eq, Ord)
+
+instance Serialize NotifyData where
+ serialize (NotifyDataCrtcChange x) = serialize x
+ serialize (NotifyDataOutputChange x) = serialize x
+ serialize (NotifyDataOutputProperty x) = serialize x
+ size (NotifyDataCrtcChange x) = size x
+ size (NotifyDataOutputChange x) = size x
+ size (NotifyDataOutputProperty x) = size x
+
+deserializeNotifyData :: Notify -> Get NotifyData
+deserializeNotifyData NotifyCrtcChange = NotifyDataCrtcChange `liftM` deserialize
+deserializeNotifyData NotifyOutputChange = NotifyDataOutputChange `liftM` deserialize
+deserializeNotifyData NotifyOutputProperty = NotifyDataOutputProperty `liftM` deserialize
+
+subCodeToNotifyEnum :: Word8 -> Notify
+subCodeToNotifyEnum 0 = NotifyCrtcChange
+subCodeToNotifyEnum 1 = NotifyOutputChange
+subCodeToNotifyEnum 2 = NotifyOutputProperty
+
data NotifyEvent = MkNotifyEvent{subCode_NotifyEvent :: Notify,
u_NotifyEvent :: NotifyData}
deriving (Show, Typeable, Eq, Ord)
-
+
instance Graphics.XHB.Shared.Event NotifyEvent
instance Deserialize NotifyEvent where
@@ -1667,5 +1692,5 @@
= do skip 1
subCode <- liftM fromValue (deserialize :: Get Word8)
skip 2
- u <- deserialize
+ u <- deserializeNotifyData subCode
return (MkNotifyEvent subCode u)
\ No newline at end of file
diff -u -r generated/1.5/Graphics/XHB/Gen/Xproto/Types.hs patched/Graphics/XHB/Gen/Xproto/Types.hs
--- generated/1.5/Graphics/XHB/Gen/Xproto/Types.hs 2009-06-28 12:31:55.000000000 -0500
+++ patched/Graphics/XHB/Gen/Xproto/Types.hs 2009-06-28 12:31:56.000000000 -0500
@@ -21,7 +21,7 @@
PropertyNotifyEvent(..), SelectionClearEvent(..), Time(..),
Atom(..), SelectionRequestEvent(..), SelectionNotifyEvent(..),
ColormapState(..), Colormap(..), ColormapNotifyEvent(..),
- ClientMessageEvent(..), Mapping(..), MappingNotifyEvent(..),
+ ClientMessageEvent(..), ClientMessageData(..), Mapping(..), MappingNotifyEvent(..),
RequestError(..), ValueError(..), WindowError(..), PixmapError(..),
AtomError(..), CursorError(..), FontError(..), MatchError(..),
DrawableError(..), AccessError(..), AllocError(..),
@@ -1516,6 +1516,51 @@
window_MapNotifyEvent :: WINDOW,
override_redirect_MapNotifyEvent :: Bool}
deriving (Show, Typeable, Eq, Ord)
+
+
+data ClientMessageData = ClientData8 [Word8] -- ^length 20
+ | ClientData16 [Word16] -- ^length 10
+ | ClientData32 [Word32] -- ^length 5
+ deriving (Show, Typeable, Eq, Ord)
+
+
+data ClientMessageDataType = CDType8
+ | CDType16
+ | CDType32
+
+clientMessageDataType :: ClientMessageData -> ClientMessageDataType
+clientMessageDataType ClientData8{} = CDType8
+clientMessageDataType ClientData16{} = CDType16
+clientMessageDataType ClientData32{} = CDType32
+
+instance Serialize ClientMessageData where
+ serialize (ClientData8 xs) = assert (length xs == 20) $
+ serializeList xs
+ serialize (ClientData16 xs) = assert (length xs == 10) $
+ serializeList xs
+ serialize (ClientData32 xs) = assert (length xs == 5) $
+ serializeList xs
+ size cd = assert
+ (case cd of
+ ClientData8 xs -> length xs == 20
+ ClientData16 xs -> length xs == 10
+ ClientData32 xs -> length xs == 5)
+ 20
+
+deserializeClientData :: ClientMessageDataType -> Get ClientMessageData
+deserializeClientData CDType8
+ = ClientData8 `liftM` deserializeList 20
+deserializeClientData CDType16
+ = ClientData16 `liftM` deserializeList 10
+deserializeClientData CDType32
+ = ClientData32 `liftM` deserializeList 5
+
+clientDataFormatToType :: Word8 -> ClientMessageDataType
+clientDataFormatToType 8 = CDType8
+clientDataFormatToType 16 = CDType16
+clientDataFormatToType 32 = CDType32
+clientDataFormatToType _ = CDType8 -- should we throw an error here?
+
instance Graphics.XHB.Shared.Event MapNotifyEvent
@@ -1896,7 +1941,7 @@
skip 2
window <- deserialize
type_ <- deserialize
- data_ <- deserialize
+ data_ <- deserializeClientData (clientDataFormatToType format)
return (MkClientMessageEvent format window type_ data_)
data Mapping = MappingModifier
@@ -3827,7 +3872,10 @@
odd_length_QueryTextExtents :: QueryTextExtents -> Bool
odd_length_QueryTextExtents x
- = (fromIntegral (string_len_QueryTextExtents x .&. 1))
+ = wordToBool (string_len_QueryTextExtents x .&. 1)
+
+string_len_QueryTextExtents :: QueryTextExtents -> Word8
+string_len_QueryTextExtents x = genericLength $ string_QueryTextExtents x
instance Serialize QueryTextExtents where
serialize x
diff -u -r generated/1.5/Graphics/XHB/Gen/Xv/Types.hs patched/Graphics/XHB/Gen/Xv/Types.hs
--- generated/1.5/Graphics/XHB/Gen/Xv/Types.hs 2009-06-28 12:31:55.000000000 -0500
+++ patched/Graphics/XHB/Gen/Xv/Types.hs 2009-06-28 12:31:56.000000000 -0500
@@ -17,6 +17,7 @@
ListImageFormatsReply(..), QueryImageAttributes(..),
QueryImageAttributesReply(..), PutImage(..), ShmPutImage(..))
where
+import Prelude hiding (Rational)
import Data.Word
import Data.Int
import Foreign.C.Types