-
Notifications
You must be signed in to change notification settings - Fork 0
/
randr_req_auto.go
273 lines (252 loc) · 6.96 KB
/
randr_req_auto.go
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
package randr
import x "github.com/linuxdeepin/go-x11-client"
func QueryVersion(conn *x.Conn, clientMajorVersion, clientMinorVersion uint32) QueryVersionCookie {
body := encodeQueryVersion(clientMajorVersion, clientMinorVersion)
req := &x.ProtocolRequest{
Ext: _ext,
Header: x.RequestHeader{
Data: QueryVersionOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return QueryVersionCookie(seq)
}
func (cookie QueryVersionCookie) Reply(conn *x.Conn) (*QueryVersionReply, error) {
replyBuf, err := conn.WaitForReply(x.SeqNum(cookie))
if err != nil {
return nil, err
}
r := x.NewReaderFromData(replyBuf)
var reply QueryVersionReply
err = readQueryVersionReply(r, &reply)
if err != nil {
return nil, err
}
return &reply, nil
}
func GetCrtcInfo(conn *x.Conn, crtc Crtc, configTimestamp x.Timestamp) GetCrtcInfoCookie {
body := encodeGetCrtcInfo(crtc, configTimestamp)
req := &x.ProtocolRequest{
Ext: _ext,
Header: x.RequestHeader{
Data: GetCrtcInfoOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return GetCrtcInfoCookie(seq)
}
func (cookie GetCrtcInfoCookie) Reply(conn *x.Conn) (*GetCrtcInfoReply, error) {
replyBuf, err := conn.WaitForReply(x.SeqNum(cookie))
if err != nil {
return nil, err
}
r := x.NewReaderFromData(replyBuf)
var reply GetCrtcInfoReply
err = readGetCrtcInfoReply(r, &reply)
if err != nil {
return nil, err
}
return &reply, nil
}
func GetOutputInfo(conn *x.Conn, output Output, configTimestamp x.Timestamp) GetOutputInfoCookie {
body := encodeGetOutputInfo(output, configTimestamp)
req := &x.ProtocolRequest{
Ext: _ext,
Header: x.RequestHeader{
Data: GetOutputInfoOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return GetOutputInfoCookie(seq)
}
func (cookie GetOutputInfoCookie) Reply(conn *x.Conn) (*GetOutputInfoReply, error) {
replyBuf, err := conn.WaitForReply(x.SeqNum(cookie))
if err != nil {
return nil, err
}
r := x.NewReaderFromData(replyBuf)
var reply GetOutputInfoReply
err = readGetOutputInfoReply(r, &reply)
if err != nil {
return nil, err
}
return &reply, nil
}
func GetScreenResources(conn *x.Conn, window x.Window) GetScreenResourcesCookie {
body := encodeGetScreenResources(window)
req := &x.ProtocolRequest{
Ext: _ext,
Header: x.RequestHeader{
Data: GetScreenResourcesOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return GetScreenResourcesCookie(seq)
}
func (cookie GetScreenResourcesCookie) Reply(conn *x.Conn) (*GetScreenResourcesReply, error) {
replyBuf, err := conn.WaitForReply(x.SeqNum(cookie))
if err != nil {
return nil, err
}
r := x.NewReaderFromData(replyBuf)
var reply GetScreenResourcesReply
err = readGetScreenResourcesReply(r, &reply)
if err != nil {
return nil, err
}
return &reply, nil
}
func GetOutputPrimary(conn *x.Conn, window x.Window) GetOutputPrimaryCookie {
body := encodeGetOutputPrimary(window)
req := &x.ProtocolRequest{
Ext: _ext,
Header: x.RequestHeader{
Data: GetOutputPrimaryOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return GetOutputPrimaryCookie(seq)
}
func (cookie GetOutputPrimaryCookie) Reply(conn *x.Conn) (*GetOutputPrimaryReply, error) {
replyBuf, err := conn.WaitForReply(x.SeqNum(cookie))
if err != nil {
return nil, err
}
r := x.NewReaderFromData(replyBuf)
var reply GetOutputPrimaryReply
err = readGetOutputPrimaryReply(r, &reply)
if err != nil {
return nil, err
}
return &reply, nil
}
func GetOutputProperty(conn *x.Conn, output Output, property, Type x.Atom, longOffset, longLength uint32, delete, pending bool) GetOutputPropertyCookie {
body := encodeGetOutputProperty(output, property, Type, longOffset, longLength, delete, pending)
req := &x.ProtocolRequest{
Ext: _ext,
Header: x.RequestHeader{
Data: GetOutputPropertyOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return GetOutputPropertyCookie(seq)
}
func (cookie GetOutputPropertyCookie) Reply(conn *x.Conn) (*GetOutputPropertyReply, error) {
replyBuf, err := conn.WaitForReply(x.SeqNum(cookie))
if err != nil {
return nil, err
}
r := x.NewReaderFromData(replyBuf)
var reply GetOutputPropertyReply
err = readGetOutputPropertyReply(r, &reply)
if err != nil {
return nil, err
}
return &reply, nil
}
func SetCrtcConfig(conn *x.Conn, crtc Crtc, timestamp, configTimestamp x.Timestamp, X, y int16, mode Mode, rotation uint16, outputs []Output) SetCrtcConfigCookie {
body := encodeSetCrtcConfig(crtc, timestamp, configTimestamp, X, y, mode, rotation, outputs)
req := &x.ProtocolRequest{
Ext: _ext,
Header: x.RequestHeader{
Data: SetCrtcConfigOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return SetCrtcConfigCookie(seq)
}
func (cookie SetCrtcConfigCookie) Reply(conn *x.Conn) (*SetCrtcConfigReply, error) {
replyBuf, err := conn.WaitForReply(x.SeqNum(cookie))
if err != nil {
return nil, err
}
r := x.NewReaderFromData(replyBuf)
var reply SetCrtcConfigReply
err = readSetCrtcConfigReply(r, &reply)
if err != nil {
return nil, err
}
return &reply, nil
}
func SelectInput(conn *x.Conn, window x.Window, enable uint16) {
body := encodeSelectInput(window, enable)
req := &x.ProtocolRequest{
Ext: _ext,
NoReply: true,
Header: x.RequestHeader{
Data: SelectInputOpcode,
},
Body: body,
}
conn.SendRequest(0, req)
}
func SelectInputChecked(conn *x.Conn, window x.Window, enable uint16) x.VoidCookie {
body := encodeSelectInput(window, enable)
req := &x.ProtocolRequest{
Ext: _ext,
NoReply: true,
Header: x.RequestHeader{
Data: SelectInputOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return x.VoidCookie(seq)
}
func GetCrtcGammaSize(conn *x.Conn, crtc Crtc) GetCrtcGammaSizeCookie {
body := encodeGetCrtcGammaSize(crtc)
req := &x.ProtocolRequest{
Ext: _ext,
Header: x.RequestHeader{
Data: GetCrtcGammaSizeOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return GetCrtcGammaSizeCookie(seq)
}
func (cookie GetCrtcGammaSizeCookie) Reply(conn *x.Conn) (*GetCrtcGammaSizeReply, error) {
replyBuf, err := conn.WaitForReply(x.SeqNum(cookie))
if err != nil {
return nil, err
}
r := x.NewReaderFromData(replyBuf)
var reply GetCrtcGammaSizeReply
err = readGetCrtcGammaSizeReply(r, &reply)
if err != nil {
return nil, err
}
return &reply, nil
}
func SetCrtcGamma(conn *x.Conn, crtc Crtc, red, green, blue []uint16) {
body := encodeSetCrtcGamma(crtc, red, green, blue)
req := &x.ProtocolRequest{
Ext: _ext,
NoReply: true,
Header: x.RequestHeader{
Data: SetCrtcGammaOpcode,
},
Body: body,
}
conn.SendRequest(0, req)
}
func SetCrtcGammaChecked(conn *x.Conn, crtc Crtc, red, green, blue []uint16) x.VoidCookie {
body := encodeSetCrtcGamma(crtc, red, green, blue)
req := &x.ProtocolRequest{
Ext: _ext,
NoReply: true,
Header: x.RequestHeader{
Data: SetCrtcGammaOpcode,
},
Body: body,
}
seq := conn.SendRequest(x.RequestChecked, req)
return x.VoidCookie(seq)
}