| 1 |
|
| 2 |
package xselinux |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
import ( |
| 7 |
"github.com/BurntSushi/xgb" |
| 8 |
|
| 9 |
"github.com/BurntSushi/xgb/xproto" |
| 10 |
) |
| 11 |
|
| 12 |
|
| 13 |
func Init(c *xgb.Conn) error { |
| 14 |
reply, err := xproto.QueryExtension(c, 7, "SELinux").Reply() |
| 15 |
switch { |
| 16 |
case err != nil: |
| 17 |
return err |
| 18 |
case !reply.Present: |
| 19 |
return xgb.Errorf("No extension named SELinux could be found on on the server.") |
| 20 |
} |
| 21 |
|
| 22 |
c.ExtLock.Lock() |
| 23 |
c.Extensions["SELinux"] = reply.MajorOpcode |
| 24 |
c.ExtLock.Unlock() |
| 25 |
for evNum, fun := range xgb.NewExtEventFuncs["SELinux"] { |
| 26 |
xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun |
| 27 |
} |
| 28 |
for errNum, fun := range xgb.NewExtErrorFuncs["SELinux"] { |
| 29 |
xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun |
| 30 |
} |
| 31 |
return nil |
| 32 |
} |
| 33 |
|
| 34 |
func init() { |
| 35 |
xgb.NewExtEventFuncs["SELinux"] = make(map[int]xgb.NewEventFun) |
| 36 |
xgb.NewExtErrorFuncs["SELinux"] = make(map[int]xgb.NewErrorFun) |
| 37 |
} |
| 38 |
|
| 39 |
type ListItem struct { |
| 40 |
Name xproto.Atom |
| 41 |
ObjectContextLen uint32 |
| 42 |
DataContextLen uint32 |
| 43 |
ObjectContext string |
| 44 |
DataContext string |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
func ListItemRead(buf []byte, v *ListItem) int { |
| 49 |
b := 0 |
| 50 |
|
| 51 |
v.Name = xproto.Atom(xgb.Get32(buf[b:])) |
| 52 |
b += 4 |
| 53 |
|
| 54 |
v.ObjectContextLen = xgb.Get32(buf[b:]) |
| 55 |
b += 4 |
| 56 |
|
| 57 |
v.DataContextLen = xgb.Get32(buf[b:]) |
| 58 |
b += 4 |
| 59 |
|
| 60 |
{ |
| 61 |
byteString := make([]byte, v.ObjectContextLen) |
| 62 |
copy(byteString[:v.ObjectContextLen], buf[b:]) |
| 63 |
v.ObjectContext = string(byteString) |
| 64 |
b += int(v.ObjectContextLen) |
| 65 |
} |
| 66 |
|
| 67 |
{ |
| 68 |
byteString := make([]byte, v.DataContextLen) |
| 69 |
copy(byteString[:v.DataContextLen], buf[b:]) |
| 70 |
v.DataContext = string(byteString) |
| 71 |
b += int(v.DataContextLen) |
| 72 |
} |
| 73 |
|
| 74 |
return b |
| 75 |
} |
| 76 |
|
| 77 |
|
| 78 |
func ListItemReadList(buf []byte, dest []ListItem) int { |
| 79 |
b := 0 |
| 80 |
for i := 0; i < len(dest); i++ { |
| 81 |
dest[i] = ListItem{} |
| 82 |
b += ListItemRead(buf[b:], &dest[i]) |
| 83 |
} |
| 84 |
return xgb.Pad(b) |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
func (v ListItem) Bytes() []byte { |
| 89 |
buf := make([]byte, ((12 + xgb.Pad((int(v.ObjectContextLen) * 1))) + xgb.Pad((int(v.DataContextLen) * 1)))) |
| 90 |
b := 0 |
| 91 |
|
| 92 |
xgb.Put32(buf[b:], uint32(v.Name)) |
| 93 |
b += 4 |
| 94 |
|
| 95 |
xgb.Put32(buf[b:], v.ObjectContextLen) |
| 96 |
b += 4 |
| 97 |
|
| 98 |
xgb.Put32(buf[b:], v.DataContextLen) |
| 99 |
b += 4 |
| 100 |
|
| 101 |
copy(buf[b:], v.ObjectContext[:v.ObjectContextLen]) |
| 102 |
b += int(v.ObjectContextLen) |
| 103 |
|
| 104 |
copy(buf[b:], v.DataContext[:v.DataContextLen]) |
| 105 |
b += int(v.DataContextLen) |
| 106 |
|
| 107 |
return buf[:b] |
| 108 |
} |
| 109 |
|
| 110 |
|
| 111 |
func ListItemListBytes(buf []byte, list []ListItem) int { |
| 112 |
b := 0 |
| 113 |
var structBytes []byte |
| 114 |
for _, item := range list { |
| 115 |
structBytes = item.Bytes() |
| 116 |
copy(buf[b:], structBytes) |
| 117 |
b += len(structBytes) |
| 118 |
} |
| 119 |
return xgb.Pad(b) |
| 120 |
} |
| 121 |
|
| 122 |
|
| 123 |
func ListItemListSize(list []ListItem) int { |
| 124 |
size := 0 |
| 125 |
for _, item := range list { |
| 126 |
size += ((12 + xgb.Pad((int(item.ObjectContextLen) * 1))) + xgb.Pad((int(item.DataContextLen) * 1))) |
| 127 |
} |
| 128 |
return size |
| 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 |
type GetClientContextCookie struct { |
| 157 |
*xgb.Cookie |
| 158 |
} |
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
func GetClientContext(c *xgb.Conn, Resource uint32) GetClientContextCookie { |
| 163 |
c.ExtLock.RLock() |
| 164 |
defer c.ExtLock.RUnlock() |
| 165 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 166 |
panic("Cannot issue request 'GetClientContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 167 |
} |
| 168 |
cookie := c.NewCookie(true, true) |
| 169 |
c.NewRequest(getClientContextRequest(c, Resource), cookie) |
| 170 |
return GetClientContextCookie{cookie} |
| 171 |
} |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
func GetClientContextUnchecked(c *xgb.Conn, Resource uint32) GetClientContextCookie { |
| 176 |
c.ExtLock.RLock() |
| 177 |
defer c.ExtLock.RUnlock() |
| 178 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 179 |
panic("Cannot issue request 'GetClientContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 180 |
} |
| 181 |
cookie := c.NewCookie(false, true) |
| 182 |
c.NewRequest(getClientContextRequest(c, Resource), cookie) |
| 183 |
return GetClientContextCookie{cookie} |
| 184 |
} |
| 185 |
|
| 186 |
|
| 187 |
type GetClientContextReply struct { |
| 188 |
Sequence uint16 |
| 189 |
Length uint32 |
| 190 |
|
| 191 |
ContextLen uint32 |
| 192 |
|
| 193 |
Context string |
| 194 |
} |
| 195 |
|
| 196 |
|
| 197 |
func (cook GetClientContextCookie) Reply() (*GetClientContextReply, error) { |
| 198 |
buf, err := cook.Cookie.Reply() |
| 199 |
if err != nil { |
| 200 |
return nil, err |
| 201 |
} |
| 202 |
if buf == nil { |
| 203 |
return nil, nil |
| 204 |
} |
| 205 |
return getClientContextReply(buf), nil |
| 206 |
} |
| 207 |
|
| 208 |
|
| 209 |
func getClientContextReply(buf []byte) *GetClientContextReply { |
| 210 |
v := new(GetClientContextReply) |
| 211 |
b := 1 |
| 212 |
|
| 213 |
b += 1 |
| 214 |
|
| 215 |
v.Sequence = xgb.Get16(buf[b:]) |
| 216 |
b += 2 |
| 217 |
|
| 218 |
v.Length = xgb.Get32(buf[b:]) |
| 219 |
b += 4 |
| 220 |
|
| 221 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 222 |
b += 4 |
| 223 |
|
| 224 |
b += 20 |
| 225 |
|
| 226 |
{ |
| 227 |
byteString := make([]byte, v.ContextLen) |
| 228 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 229 |
v.Context = string(byteString) |
| 230 |
b += int(v.ContextLen) |
| 231 |
} |
| 232 |
|
| 233 |
return v |
| 234 |
} |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
func getClientContextRequest(c *xgb.Conn, Resource uint32) []byte { |
| 239 |
size := 8 |
| 240 |
b := 0 |
| 241 |
buf := make([]byte, size) |
| 242 |
|
| 243 |
c.ExtLock.RLock() |
| 244 |
buf[b] = c.Extensions["SELinux"] |
| 245 |
c.ExtLock.RUnlock() |
| 246 |
b += 1 |
| 247 |
|
| 248 |
buf[b] = 22 |
| 249 |
b += 1 |
| 250 |
|
| 251 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 252 |
b += 2 |
| 253 |
|
| 254 |
xgb.Put32(buf[b:], Resource) |
| 255 |
b += 4 |
| 256 |
|
| 257 |
return buf |
| 258 |
} |
| 259 |
|
| 260 |
|
| 261 |
type GetDeviceContextCookie struct { |
| 262 |
*xgb.Cookie |
| 263 |
} |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
func GetDeviceContext(c *xgb.Conn, Device uint32) GetDeviceContextCookie { |
| 268 |
c.ExtLock.RLock() |
| 269 |
defer c.ExtLock.RUnlock() |
| 270 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 271 |
panic("Cannot issue request 'GetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 272 |
} |
| 273 |
cookie := c.NewCookie(true, true) |
| 274 |
c.NewRequest(getDeviceContextRequest(c, Device), cookie) |
| 275 |
return GetDeviceContextCookie{cookie} |
| 276 |
} |
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
func GetDeviceContextUnchecked(c *xgb.Conn, Device uint32) GetDeviceContextCookie { |
| 281 |
c.ExtLock.RLock() |
| 282 |
defer c.ExtLock.RUnlock() |
| 283 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 284 |
panic("Cannot issue request 'GetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 285 |
} |
| 286 |
cookie := c.NewCookie(false, true) |
| 287 |
c.NewRequest(getDeviceContextRequest(c, Device), cookie) |
| 288 |
return GetDeviceContextCookie{cookie} |
| 289 |
} |
| 290 |
|
| 291 |
|
| 292 |
type GetDeviceContextReply struct { |
| 293 |
Sequence uint16 |
| 294 |
Length uint32 |
| 295 |
|
| 296 |
ContextLen uint32 |
| 297 |
|
| 298 |
Context string |
| 299 |
} |
| 300 |
|
| 301 |
|
| 302 |
func (cook GetDeviceContextCookie) Reply() (*GetDeviceContextReply, error) { |
| 303 |
buf, err := cook.Cookie.Reply() |
| 304 |
if err != nil { |
| 305 |
return nil, err |
| 306 |
} |
| 307 |
if buf == nil { |
| 308 |
return nil, nil |
| 309 |
} |
| 310 |
return getDeviceContextReply(buf), nil |
| 311 |
} |
| 312 |
|
| 313 |
|
| 314 |
func getDeviceContextReply(buf []byte) *GetDeviceContextReply { |
| 315 |
v := new(GetDeviceContextReply) |
| 316 |
b := 1 |
| 317 |
|
| 318 |
b += 1 |
| 319 |
|
| 320 |
v.Sequence = xgb.Get16(buf[b:]) |
| 321 |
b += 2 |
| 322 |
|
| 323 |
v.Length = xgb.Get32(buf[b:]) |
| 324 |
b += 4 |
| 325 |
|
| 326 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 327 |
b += 4 |
| 328 |
|
| 329 |
b += 20 |
| 330 |
|
| 331 |
{ |
| 332 |
byteString := make([]byte, v.ContextLen) |
| 333 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 334 |
v.Context = string(byteString) |
| 335 |
b += int(v.ContextLen) |
| 336 |
} |
| 337 |
|
| 338 |
return v |
| 339 |
} |
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
func getDeviceContextRequest(c *xgb.Conn, Device uint32) []byte { |
| 344 |
size := 8 |
| 345 |
b := 0 |
| 346 |
buf := make([]byte, size) |
| 347 |
|
| 348 |
c.ExtLock.RLock() |
| 349 |
buf[b] = c.Extensions["SELinux"] |
| 350 |
c.ExtLock.RUnlock() |
| 351 |
b += 1 |
| 352 |
|
| 353 |
buf[b] = 4 |
| 354 |
b += 1 |
| 355 |
|
| 356 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 357 |
b += 2 |
| 358 |
|
| 359 |
xgb.Put32(buf[b:], Device) |
| 360 |
b += 4 |
| 361 |
|
| 362 |
return buf |
| 363 |
} |
| 364 |
|
| 365 |
|
| 366 |
type GetDeviceCreateContextCookie struct { |
| 367 |
*xgb.Cookie |
| 368 |
} |
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
func GetDeviceCreateContext(c *xgb.Conn) GetDeviceCreateContextCookie { |
| 373 |
c.ExtLock.RLock() |
| 374 |
defer c.ExtLock.RUnlock() |
| 375 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 376 |
panic("Cannot issue request 'GetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 377 |
} |
| 378 |
cookie := c.NewCookie(true, true) |
| 379 |
c.NewRequest(getDeviceCreateContextRequest(c), cookie) |
| 380 |
return GetDeviceCreateContextCookie{cookie} |
| 381 |
} |
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
func GetDeviceCreateContextUnchecked(c *xgb.Conn) GetDeviceCreateContextCookie { |
| 386 |
c.ExtLock.RLock() |
| 387 |
defer c.ExtLock.RUnlock() |
| 388 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 389 |
panic("Cannot issue request 'GetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 390 |
} |
| 391 |
cookie := c.NewCookie(false, true) |
| 392 |
c.NewRequest(getDeviceCreateContextRequest(c), cookie) |
| 393 |
return GetDeviceCreateContextCookie{cookie} |
| 394 |
} |
| 395 |
|
| 396 |
|
| 397 |
type GetDeviceCreateContextReply struct { |
| 398 |
Sequence uint16 |
| 399 |
Length uint32 |
| 400 |
|
| 401 |
ContextLen uint32 |
| 402 |
|
| 403 |
Context string |
| 404 |
} |
| 405 |
|
| 406 |
|
| 407 |
func (cook GetDeviceCreateContextCookie) Reply() (*GetDeviceCreateContextReply, error) { |
| 408 |
buf, err := cook.Cookie.Reply() |
| 409 |
if err != nil { |
| 410 |
return nil, err |
| 411 |
} |
| 412 |
if buf == nil { |
| 413 |
return nil, nil |
| 414 |
} |
| 415 |
return getDeviceCreateContextReply(buf), nil |
| 416 |
} |
| 417 |
|
| 418 |
|
| 419 |
func getDeviceCreateContextReply(buf []byte) *GetDeviceCreateContextReply { |
| 420 |
v := new(GetDeviceCreateContextReply) |
| 421 |
b := 1 |
| 422 |
|
| 423 |
b += 1 |
| 424 |
|
| 425 |
v.Sequence = xgb.Get16(buf[b:]) |
| 426 |
b += 2 |
| 427 |
|
| 428 |
v.Length = xgb.Get32(buf[b:]) |
| 429 |
b += 4 |
| 430 |
|
| 431 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 432 |
b += 4 |
| 433 |
|
| 434 |
b += 20 |
| 435 |
|
| 436 |
{ |
| 437 |
byteString := make([]byte, v.ContextLen) |
| 438 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 439 |
v.Context = string(byteString) |
| 440 |
b += int(v.ContextLen) |
| 441 |
} |
| 442 |
|
| 443 |
return v |
| 444 |
} |
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
func getDeviceCreateContextRequest(c *xgb.Conn) []byte { |
| 449 |
size := 4 |
| 450 |
b := 0 |
| 451 |
buf := make([]byte, size) |
| 452 |
|
| 453 |
c.ExtLock.RLock() |
| 454 |
buf[b] = c.Extensions["SELinux"] |
| 455 |
c.ExtLock.RUnlock() |
| 456 |
b += 1 |
| 457 |
|
| 458 |
buf[b] = 2 |
| 459 |
b += 1 |
| 460 |
|
| 461 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 462 |
b += 2 |
| 463 |
|
| 464 |
return buf |
| 465 |
} |
| 466 |
|
| 467 |
|
| 468 |
type GetPropertyContextCookie struct { |
| 469 |
*xgb.Cookie |
| 470 |
} |
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
func GetPropertyContext(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyContextCookie { |
| 475 |
c.ExtLock.RLock() |
| 476 |
defer c.ExtLock.RUnlock() |
| 477 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 478 |
panic("Cannot issue request 'GetPropertyContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 479 |
} |
| 480 |
cookie := c.NewCookie(true, true) |
| 481 |
c.NewRequest(getPropertyContextRequest(c, Window, Property), cookie) |
| 482 |
return GetPropertyContextCookie{cookie} |
| 483 |
} |
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
func GetPropertyContextUnchecked(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyContextCookie { |
| 488 |
c.ExtLock.RLock() |
| 489 |
defer c.ExtLock.RUnlock() |
| 490 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 491 |
panic("Cannot issue request 'GetPropertyContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 492 |
} |
| 493 |
cookie := c.NewCookie(false, true) |
| 494 |
c.NewRequest(getPropertyContextRequest(c, Window, Property), cookie) |
| 495 |
return GetPropertyContextCookie{cookie} |
| 496 |
} |
| 497 |
|
| 498 |
|
| 499 |
type GetPropertyContextReply struct { |
| 500 |
Sequence uint16 |
| 501 |
Length uint32 |
| 502 |
|
| 503 |
ContextLen uint32 |
| 504 |
|
| 505 |
Context string |
| 506 |
} |
| 507 |
|
| 508 |
|
| 509 |
func (cook GetPropertyContextCookie) Reply() (*GetPropertyContextReply, error) { |
| 510 |
buf, err := cook.Cookie.Reply() |
| 511 |
if err != nil { |
| 512 |
return nil, err |
| 513 |
} |
| 514 |
if buf == nil { |
| 515 |
return nil, nil |
| 516 |
} |
| 517 |
return getPropertyContextReply(buf), nil |
| 518 |
} |
| 519 |
|
| 520 |
|
| 521 |
func getPropertyContextReply(buf []byte) *GetPropertyContextReply { |
| 522 |
v := new(GetPropertyContextReply) |
| 523 |
b := 1 |
| 524 |
|
| 525 |
b += 1 |
| 526 |
|
| 527 |
v.Sequence = xgb.Get16(buf[b:]) |
| 528 |
b += 2 |
| 529 |
|
| 530 |
v.Length = xgb.Get32(buf[b:]) |
| 531 |
b += 4 |
| 532 |
|
| 533 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 534 |
b += 4 |
| 535 |
|
| 536 |
b += 20 |
| 537 |
|
| 538 |
{ |
| 539 |
byteString := make([]byte, v.ContextLen) |
| 540 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 541 |
v.Context = string(byteString) |
| 542 |
b += int(v.ContextLen) |
| 543 |
} |
| 544 |
|
| 545 |
return v |
| 546 |
} |
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
func getPropertyContextRequest(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) []byte { |
| 551 |
size := 12 |
| 552 |
b := 0 |
| 553 |
buf := make([]byte, size) |
| 554 |
|
| 555 |
c.ExtLock.RLock() |
| 556 |
buf[b] = c.Extensions["SELinux"] |
| 557 |
c.ExtLock.RUnlock() |
| 558 |
b += 1 |
| 559 |
|
| 560 |
buf[b] = 12 |
| 561 |
b += 1 |
| 562 |
|
| 563 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 564 |
b += 2 |
| 565 |
|
| 566 |
xgb.Put32(buf[b:], uint32(Window)) |
| 567 |
b += 4 |
| 568 |
|
| 569 |
xgb.Put32(buf[b:], uint32(Property)) |
| 570 |
b += 4 |
| 571 |
|
| 572 |
return buf |
| 573 |
} |
| 574 |
|
| 575 |
|
| 576 |
type GetPropertyCreateContextCookie struct { |
| 577 |
*xgb.Cookie |
| 578 |
} |
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
func GetPropertyCreateContext(c *xgb.Conn) GetPropertyCreateContextCookie { |
| 583 |
c.ExtLock.RLock() |
| 584 |
defer c.ExtLock.RUnlock() |
| 585 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 586 |
panic("Cannot issue request 'GetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 587 |
} |
| 588 |
cookie := c.NewCookie(true, true) |
| 589 |
c.NewRequest(getPropertyCreateContextRequest(c), cookie) |
| 590 |
return GetPropertyCreateContextCookie{cookie} |
| 591 |
} |
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
func GetPropertyCreateContextUnchecked(c *xgb.Conn) GetPropertyCreateContextCookie { |
| 596 |
c.ExtLock.RLock() |
| 597 |
defer c.ExtLock.RUnlock() |
| 598 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 599 |
panic("Cannot issue request 'GetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 600 |
} |
| 601 |
cookie := c.NewCookie(false, true) |
| 602 |
c.NewRequest(getPropertyCreateContextRequest(c), cookie) |
| 603 |
return GetPropertyCreateContextCookie{cookie} |
| 604 |
} |
| 605 |
|
| 606 |
|
| 607 |
type GetPropertyCreateContextReply struct { |
| 608 |
Sequence uint16 |
| 609 |
Length uint32 |
| 610 |
|
| 611 |
ContextLen uint32 |
| 612 |
|
| 613 |
Context string |
| 614 |
} |
| 615 |
|
| 616 |
|
| 617 |
func (cook GetPropertyCreateContextCookie) Reply() (*GetPropertyCreateContextReply, error) { |
| 618 |
buf, err := cook.Cookie.Reply() |
| 619 |
if err != nil { |
| 620 |
return nil, err |
| 621 |
} |
| 622 |
if buf == nil { |
| 623 |
return nil, nil |
| 624 |
} |
| 625 |
return getPropertyCreateContextReply(buf), nil |
| 626 |
} |
| 627 |
|
| 628 |
|
| 629 |
func getPropertyCreateContextReply(buf []byte) *GetPropertyCreateContextReply { |
| 630 |
v := new(GetPropertyCreateContextReply) |
| 631 |
b := 1 |
| 632 |
|
| 633 |
b += 1 |
| 634 |
|
| 635 |
v.Sequence = xgb.Get16(buf[b:]) |
| 636 |
b += 2 |
| 637 |
|
| 638 |
v.Length = xgb.Get32(buf[b:]) |
| 639 |
b += 4 |
| 640 |
|
| 641 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 642 |
b += 4 |
| 643 |
|
| 644 |
b += 20 |
| 645 |
|
| 646 |
{ |
| 647 |
byteString := make([]byte, v.ContextLen) |
| 648 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 649 |
v.Context = string(byteString) |
| 650 |
b += int(v.ContextLen) |
| 651 |
} |
| 652 |
|
| 653 |
return v |
| 654 |
} |
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
func getPropertyCreateContextRequest(c *xgb.Conn) []byte { |
| 659 |
size := 4 |
| 660 |
b := 0 |
| 661 |
buf := make([]byte, size) |
| 662 |
|
| 663 |
c.ExtLock.RLock() |
| 664 |
buf[b] = c.Extensions["SELinux"] |
| 665 |
c.ExtLock.RUnlock() |
| 666 |
b += 1 |
| 667 |
|
| 668 |
buf[b] = 9 |
| 669 |
b += 1 |
| 670 |
|
| 671 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 672 |
b += 2 |
| 673 |
|
| 674 |
return buf |
| 675 |
} |
| 676 |
|
| 677 |
|
| 678 |
type GetPropertyDataContextCookie struct { |
| 679 |
*xgb.Cookie |
| 680 |
} |
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
func GetPropertyDataContext(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyDataContextCookie { |
| 685 |
c.ExtLock.RLock() |
| 686 |
defer c.ExtLock.RUnlock() |
| 687 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 688 |
panic("Cannot issue request 'GetPropertyDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 689 |
} |
| 690 |
cookie := c.NewCookie(true, true) |
| 691 |
c.NewRequest(getPropertyDataContextRequest(c, Window, Property), cookie) |
| 692 |
return GetPropertyDataContextCookie{cookie} |
| 693 |
} |
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
func GetPropertyDataContextUnchecked(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyDataContextCookie { |
| 698 |
c.ExtLock.RLock() |
| 699 |
defer c.ExtLock.RUnlock() |
| 700 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 701 |
panic("Cannot issue request 'GetPropertyDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 702 |
} |
| 703 |
cookie := c.NewCookie(false, true) |
| 704 |
c.NewRequest(getPropertyDataContextRequest(c, Window, Property), cookie) |
| 705 |
return GetPropertyDataContextCookie{cookie} |
| 706 |
} |
| 707 |
|
| 708 |
|
| 709 |
type GetPropertyDataContextReply struct { |
| 710 |
Sequence uint16 |
| 711 |
Length uint32 |
| 712 |
|
| 713 |
ContextLen uint32 |
| 714 |
|
| 715 |
Context string |
| 716 |
} |
| 717 |
|
| 718 |
|
| 719 |
func (cook GetPropertyDataContextCookie) Reply() (*GetPropertyDataContextReply, error) { |
| 720 |
buf, err := cook.Cookie.Reply() |
| 721 |
if err != nil { |
| 722 |
return nil, err |
| 723 |
} |
| 724 |
if buf == nil { |
| 725 |
return nil, nil |
| 726 |
} |
| 727 |
return getPropertyDataContextReply(buf), nil |
| 728 |
} |
| 729 |
|
| 730 |
|
| 731 |
func getPropertyDataContextReply(buf []byte) *GetPropertyDataContextReply { |
| 732 |
v := new(GetPropertyDataContextReply) |
| 733 |
b := 1 |
| 734 |
|
| 735 |
b += 1 |
| 736 |
|
| 737 |
v.Sequence = xgb.Get16(buf[b:]) |
| 738 |
b += 2 |
| 739 |
|
| 740 |
v.Length = xgb.Get32(buf[b:]) |
| 741 |
b += 4 |
| 742 |
|
| 743 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 744 |
b += 4 |
| 745 |
|
| 746 |
b += 20 |
| 747 |
|
| 748 |
{ |
| 749 |
byteString := make([]byte, v.ContextLen) |
| 750 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 751 |
v.Context = string(byteString) |
| 752 |
b += int(v.ContextLen) |
| 753 |
} |
| 754 |
|
| 755 |
return v |
| 756 |
} |
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
func getPropertyDataContextRequest(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) []byte { |
| 761 |
size := 12 |
| 762 |
b := 0 |
| 763 |
buf := make([]byte, size) |
| 764 |
|
| 765 |
c.ExtLock.RLock() |
| 766 |
buf[b] = c.Extensions["SELinux"] |
| 767 |
c.ExtLock.RUnlock() |
| 768 |
b += 1 |
| 769 |
|
| 770 |
buf[b] = 13 |
| 771 |
b += 1 |
| 772 |
|
| 773 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 774 |
b += 2 |
| 775 |
|
| 776 |
xgb.Put32(buf[b:], uint32(Window)) |
| 777 |
b += 4 |
| 778 |
|
| 779 |
xgb.Put32(buf[b:], uint32(Property)) |
| 780 |
b += 4 |
| 781 |
|
| 782 |
return buf |
| 783 |
} |
| 784 |
|
| 785 |
|
| 786 |
type GetPropertyUseContextCookie struct { |
| 787 |
*xgb.Cookie |
| 788 |
} |
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
func GetPropertyUseContext(c *xgb.Conn) GetPropertyUseContextCookie { |
| 793 |
c.ExtLock.RLock() |
| 794 |
defer c.ExtLock.RUnlock() |
| 795 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 796 |
panic("Cannot issue request 'GetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 797 |
} |
| 798 |
cookie := c.NewCookie(true, true) |
| 799 |
c.NewRequest(getPropertyUseContextRequest(c), cookie) |
| 800 |
return GetPropertyUseContextCookie{cookie} |
| 801 |
} |
| 802 |
|
| 803 |
|
| 804 |
|
| 805 |
func GetPropertyUseContextUnchecked(c *xgb.Conn) GetPropertyUseContextCookie { |
| 806 |
c.ExtLock.RLock() |
| 807 |
defer c.ExtLock.RUnlock() |
| 808 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 809 |
panic("Cannot issue request 'GetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 810 |
} |
| 811 |
cookie := c.NewCookie(false, true) |
| 812 |
c.NewRequest(getPropertyUseContextRequest(c), cookie) |
| 813 |
return GetPropertyUseContextCookie{cookie} |
| 814 |
} |
| 815 |
|
| 816 |
|
| 817 |
type GetPropertyUseContextReply struct { |
| 818 |
Sequence uint16 |
| 819 |
Length uint32 |
| 820 |
|
| 821 |
ContextLen uint32 |
| 822 |
|
| 823 |
Context string |
| 824 |
} |
| 825 |
|
| 826 |
|
| 827 |
func (cook GetPropertyUseContextCookie) Reply() (*GetPropertyUseContextReply, error) { |
| 828 |
buf, err := cook.Cookie.Reply() |
| 829 |
if err != nil { |
| 830 |
return nil, err |
| 831 |
} |
| 832 |
if buf == nil { |
| 833 |
return nil, nil |
| 834 |
} |
| 835 |
return getPropertyUseContextReply(buf), nil |
| 836 |
} |
| 837 |
|
| 838 |
|
| 839 |
func getPropertyUseContextReply(buf []byte) *GetPropertyUseContextReply { |
| 840 |
v := new(GetPropertyUseContextReply) |
| 841 |
b := 1 |
| 842 |
|
| 843 |
b += 1 |
| 844 |
|
| 845 |
v.Sequence = xgb.Get16(buf[b:]) |
| 846 |
b += 2 |
| 847 |
|
| 848 |
v.Length = xgb.Get32(buf[b:]) |
| 849 |
b += 4 |
| 850 |
|
| 851 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 852 |
b += 4 |
| 853 |
|
| 854 |
b += 20 |
| 855 |
|
| 856 |
{ |
| 857 |
byteString := make([]byte, v.ContextLen) |
| 858 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 859 |
v.Context = string(byteString) |
| 860 |
b += int(v.ContextLen) |
| 861 |
} |
| 862 |
|
| 863 |
return v |
| 864 |
} |
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
func getPropertyUseContextRequest(c *xgb.Conn) []byte { |
| 869 |
size := 4 |
| 870 |
b := 0 |
| 871 |
buf := make([]byte, size) |
| 872 |
|
| 873 |
c.ExtLock.RLock() |
| 874 |
buf[b] = c.Extensions["SELinux"] |
| 875 |
c.ExtLock.RUnlock() |
| 876 |
b += 1 |
| 877 |
|
| 878 |
buf[b] = 11 |
| 879 |
b += 1 |
| 880 |
|
| 881 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 882 |
b += 2 |
| 883 |
|
| 884 |
return buf |
| 885 |
} |
| 886 |
|
| 887 |
|
| 888 |
type GetSelectionContextCookie struct { |
| 889 |
*xgb.Cookie |
| 890 |
} |
| 891 |
|
| 892 |
|
| 893 |
|
| 894 |
func GetSelectionContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionContextCookie { |
| 895 |
c.ExtLock.RLock() |
| 896 |
defer c.ExtLock.RUnlock() |
| 897 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 898 |
panic("Cannot issue request 'GetSelectionContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 899 |
} |
| 900 |
cookie := c.NewCookie(true, true) |
| 901 |
c.NewRequest(getSelectionContextRequest(c, Selection), cookie) |
| 902 |
return GetSelectionContextCookie{cookie} |
| 903 |
} |
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
func GetSelectionContextUnchecked(c *xgb.Conn, Selection xproto.Atom) GetSelectionContextCookie { |
| 908 |
c.ExtLock.RLock() |
| 909 |
defer c.ExtLock.RUnlock() |
| 910 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 911 |
panic("Cannot issue request 'GetSelectionContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 912 |
} |
| 913 |
cookie := c.NewCookie(false, true) |
| 914 |
c.NewRequest(getSelectionContextRequest(c, Selection), cookie) |
| 915 |
return GetSelectionContextCookie{cookie} |
| 916 |
} |
| 917 |
|
| 918 |
|
| 919 |
type GetSelectionContextReply struct { |
| 920 |
Sequence uint16 |
| 921 |
Length uint32 |
| 922 |
|
| 923 |
ContextLen uint32 |
| 924 |
|
| 925 |
Context string |
| 926 |
} |
| 927 |
|
| 928 |
|
| 929 |
func (cook GetSelectionContextCookie) Reply() (*GetSelectionContextReply, error) { |
| 930 |
buf, err := cook.Cookie.Reply() |
| 931 |
if err != nil { |
| 932 |
return nil, err |
| 933 |
} |
| 934 |
if buf == nil { |
| 935 |
return nil, nil |
| 936 |
} |
| 937 |
return getSelectionContextReply(buf), nil |
| 938 |
} |
| 939 |
|
| 940 |
|
| 941 |
func getSelectionContextReply(buf []byte) *GetSelectionContextReply { |
| 942 |
v := new(GetSelectionContextReply) |
| 943 |
b := 1 |
| 944 |
|
| 945 |
b += 1 |
| 946 |
|
| 947 |
v.Sequence = xgb.Get16(buf[b:]) |
| 948 |
b += 2 |
| 949 |
|
| 950 |
v.Length = xgb.Get32(buf[b:]) |
| 951 |
b += 4 |
| 952 |
|
| 953 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 954 |
b += 4 |
| 955 |
|
| 956 |
b += 20 |
| 957 |
|
| 958 |
{ |
| 959 |
byteString := make([]byte, v.ContextLen) |
| 960 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 961 |
v.Context = string(byteString) |
| 962 |
b += int(v.ContextLen) |
| 963 |
} |
| 964 |
|
| 965 |
return v |
| 966 |
} |
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
func getSelectionContextRequest(c *xgb.Conn, Selection xproto.Atom) []byte { |
| 971 |
size := 8 |
| 972 |
b := 0 |
| 973 |
buf := make([]byte, size) |
| 974 |
|
| 975 |
c.ExtLock.RLock() |
| 976 |
buf[b] = c.Extensions["SELinux"] |
| 977 |
c.ExtLock.RUnlock() |
| 978 |
b += 1 |
| 979 |
|
| 980 |
buf[b] = 19 |
| 981 |
b += 1 |
| 982 |
|
| 983 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 984 |
b += 2 |
| 985 |
|
| 986 |
xgb.Put32(buf[b:], uint32(Selection)) |
| 987 |
b += 4 |
| 988 |
|
| 989 |
return buf |
| 990 |
} |
| 991 |
|
| 992 |
|
| 993 |
type GetSelectionCreateContextCookie struct { |
| 994 |
*xgb.Cookie |
| 995 |
} |
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
func GetSelectionCreateContext(c *xgb.Conn) GetSelectionCreateContextCookie { |
| 1000 |
c.ExtLock.RLock() |
| 1001 |
defer c.ExtLock.RUnlock() |
| 1002 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1003 |
panic("Cannot issue request 'GetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1004 |
} |
| 1005 |
cookie := c.NewCookie(true, true) |
| 1006 |
c.NewRequest(getSelectionCreateContextRequest(c), cookie) |
| 1007 |
return GetSelectionCreateContextCookie{cookie} |
| 1008 |
} |
| 1009 |
|
| 1010 |
|
| 1011 |
|
| 1012 |
func GetSelectionCreateContextUnchecked(c *xgb.Conn) GetSelectionCreateContextCookie { |
| 1013 |
c.ExtLock.RLock() |
| 1014 |
defer c.ExtLock.RUnlock() |
| 1015 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1016 |
panic("Cannot issue request 'GetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1017 |
} |
| 1018 |
cookie := c.NewCookie(false, true) |
| 1019 |
c.NewRequest(getSelectionCreateContextRequest(c), cookie) |
| 1020 |
return GetSelectionCreateContextCookie{cookie} |
| 1021 |
} |
| 1022 |
|
| 1023 |
|
| 1024 |
type GetSelectionCreateContextReply struct { |
| 1025 |
Sequence uint16 |
| 1026 |
Length uint32 |
| 1027 |
|
| 1028 |
ContextLen uint32 |
| 1029 |
|
| 1030 |
Context string |
| 1031 |
} |
| 1032 |
|
| 1033 |
|
| 1034 |
func (cook GetSelectionCreateContextCookie) Reply() (*GetSelectionCreateContextReply, error) { |
| 1035 |
buf, err := cook.Cookie.Reply() |
| 1036 |
if err != nil { |
| 1037 |
return nil, err |
| 1038 |
} |
| 1039 |
if buf == nil { |
| 1040 |
return nil, nil |
| 1041 |
} |
| 1042 |
return getSelectionCreateContextReply(buf), nil |
| 1043 |
} |
| 1044 |
|
| 1045 |
|
| 1046 |
func getSelectionCreateContextReply(buf []byte) *GetSelectionCreateContextReply { |
| 1047 |
v := new(GetSelectionCreateContextReply) |
| 1048 |
b := 1 |
| 1049 |
|
| 1050 |
b += 1 |
| 1051 |
|
| 1052 |
v.Sequence = xgb.Get16(buf[b:]) |
| 1053 |
b += 2 |
| 1054 |
|
| 1055 |
v.Length = xgb.Get32(buf[b:]) |
| 1056 |
b += 4 |
| 1057 |
|
| 1058 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 1059 |
b += 4 |
| 1060 |
|
| 1061 |
b += 20 |
| 1062 |
|
| 1063 |
{ |
| 1064 |
byteString := make([]byte, v.ContextLen) |
| 1065 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 1066 |
v.Context = string(byteString) |
| 1067 |
b += int(v.ContextLen) |
| 1068 |
} |
| 1069 |
|
| 1070 |
return v |
| 1071 |
} |
| 1072 |
|
| 1073 |
|
| 1074 |
|
| 1075 |
func getSelectionCreateContextRequest(c *xgb.Conn) []byte { |
| 1076 |
size := 4 |
| 1077 |
b := 0 |
| 1078 |
buf := make([]byte, size) |
| 1079 |
|
| 1080 |
c.ExtLock.RLock() |
| 1081 |
buf[b] = c.Extensions["SELinux"] |
| 1082 |
c.ExtLock.RUnlock() |
| 1083 |
b += 1 |
| 1084 |
|
| 1085 |
buf[b] = 16 |
| 1086 |
b += 1 |
| 1087 |
|
| 1088 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1089 |
b += 2 |
| 1090 |
|
| 1091 |
return buf |
| 1092 |
} |
| 1093 |
|
| 1094 |
|
| 1095 |
type GetSelectionDataContextCookie struct { |
| 1096 |
*xgb.Cookie |
| 1097 |
} |
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
func GetSelectionDataContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionDataContextCookie { |
| 1102 |
c.ExtLock.RLock() |
| 1103 |
defer c.ExtLock.RUnlock() |
| 1104 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1105 |
panic("Cannot issue request 'GetSelectionDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1106 |
} |
| 1107 |
cookie := c.NewCookie(true, true) |
| 1108 |
c.NewRequest(getSelectionDataContextRequest(c, Selection), cookie) |
| 1109 |
return GetSelectionDataContextCookie{cookie} |
| 1110 |
} |
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
func GetSelectionDataContextUnchecked(c *xgb.Conn, Selection xproto.Atom) GetSelectionDataContextCookie { |
| 1115 |
c.ExtLock.RLock() |
| 1116 |
defer c.ExtLock.RUnlock() |
| 1117 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1118 |
panic("Cannot issue request 'GetSelectionDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1119 |
} |
| 1120 |
cookie := c.NewCookie(false, true) |
| 1121 |
c.NewRequest(getSelectionDataContextRequest(c, Selection), cookie) |
| 1122 |
return GetSelectionDataContextCookie{cookie} |
| 1123 |
} |
| 1124 |
|
| 1125 |
|
| 1126 |
type GetSelectionDataContextReply struct { |
| 1127 |
Sequence uint16 |
| 1128 |
Length uint32 |
| 1129 |
|
| 1130 |
ContextLen uint32 |
| 1131 |
|
| 1132 |
Context string |
| 1133 |
} |
| 1134 |
|
| 1135 |
|
| 1136 |
func (cook GetSelectionDataContextCookie) Reply() (*GetSelectionDataContextReply, error) { |
| 1137 |
buf, err := cook.Cookie.Reply() |
| 1138 |
if err != nil { |
| 1139 |
return nil, err |
| 1140 |
} |
| 1141 |
if buf == nil { |
| 1142 |
return nil, nil |
| 1143 |
} |
| 1144 |
return getSelectionDataContextReply(buf), nil |
| 1145 |
} |
| 1146 |
|
| 1147 |
|
| 1148 |
func getSelectionDataContextReply(buf []byte) *GetSelectionDataContextReply { |
| 1149 |
v := new(GetSelectionDataContextReply) |
| 1150 |
b := 1 |
| 1151 |
|
| 1152 |
b += 1 |
| 1153 |
|
| 1154 |
v.Sequence = xgb.Get16(buf[b:]) |
| 1155 |
b += 2 |
| 1156 |
|
| 1157 |
v.Length = xgb.Get32(buf[b:]) |
| 1158 |
b += 4 |
| 1159 |
|
| 1160 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 1161 |
b += 4 |
| 1162 |
|
| 1163 |
b += 20 |
| 1164 |
|
| 1165 |
{ |
| 1166 |
byteString := make([]byte, v.ContextLen) |
| 1167 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 1168 |
v.Context = string(byteString) |
| 1169 |
b += int(v.ContextLen) |
| 1170 |
} |
| 1171 |
|
| 1172 |
return v |
| 1173 |
} |
| 1174 |
|
| 1175 |
|
| 1176 |
|
| 1177 |
func getSelectionDataContextRequest(c *xgb.Conn, Selection xproto.Atom) []byte { |
| 1178 |
size := 8 |
| 1179 |
b := 0 |
| 1180 |
buf := make([]byte, size) |
| 1181 |
|
| 1182 |
c.ExtLock.RLock() |
| 1183 |
buf[b] = c.Extensions["SELinux"] |
| 1184 |
c.ExtLock.RUnlock() |
| 1185 |
b += 1 |
| 1186 |
|
| 1187 |
buf[b] = 20 |
| 1188 |
b += 1 |
| 1189 |
|
| 1190 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1191 |
b += 2 |
| 1192 |
|
| 1193 |
xgb.Put32(buf[b:], uint32(Selection)) |
| 1194 |
b += 4 |
| 1195 |
|
| 1196 |
return buf |
| 1197 |
} |
| 1198 |
|
| 1199 |
|
| 1200 |
type GetSelectionUseContextCookie struct { |
| 1201 |
*xgb.Cookie |
| 1202 |
} |
| 1203 |
|
| 1204 |
|
| 1205 |
|
| 1206 |
func GetSelectionUseContext(c *xgb.Conn) GetSelectionUseContextCookie { |
| 1207 |
c.ExtLock.RLock() |
| 1208 |
defer c.ExtLock.RUnlock() |
| 1209 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1210 |
panic("Cannot issue request 'GetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1211 |
} |
| 1212 |
cookie := c.NewCookie(true, true) |
| 1213 |
c.NewRequest(getSelectionUseContextRequest(c), cookie) |
| 1214 |
return GetSelectionUseContextCookie{cookie} |
| 1215 |
} |
| 1216 |
|
| 1217 |
|
| 1218 |
|
| 1219 |
func GetSelectionUseContextUnchecked(c *xgb.Conn) GetSelectionUseContextCookie { |
| 1220 |
c.ExtLock.RLock() |
| 1221 |
defer c.ExtLock.RUnlock() |
| 1222 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1223 |
panic("Cannot issue request 'GetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1224 |
} |
| 1225 |
cookie := c.NewCookie(false, true) |
| 1226 |
c.NewRequest(getSelectionUseContextRequest(c), cookie) |
| 1227 |
return GetSelectionUseContextCookie{cookie} |
| 1228 |
} |
| 1229 |
|
| 1230 |
|
| 1231 |
type GetSelectionUseContextReply struct { |
| 1232 |
Sequence uint16 |
| 1233 |
Length uint32 |
| 1234 |
|
| 1235 |
ContextLen uint32 |
| 1236 |
|
| 1237 |
Context string |
| 1238 |
} |
| 1239 |
|
| 1240 |
|
| 1241 |
func (cook GetSelectionUseContextCookie) Reply() (*GetSelectionUseContextReply, error) { |
| 1242 |
buf, err := cook.Cookie.Reply() |
| 1243 |
if err != nil { |
| 1244 |
return nil, err |
| 1245 |
} |
| 1246 |
if buf == nil { |
| 1247 |
return nil, nil |
| 1248 |
} |
| 1249 |
return getSelectionUseContextReply(buf), nil |
| 1250 |
} |
| 1251 |
|
| 1252 |
|
| 1253 |
func getSelectionUseContextReply(buf []byte) *GetSelectionUseContextReply { |
| 1254 |
v := new(GetSelectionUseContextReply) |
| 1255 |
b := 1 |
| 1256 |
|
| 1257 |
b += 1 |
| 1258 |
|
| 1259 |
v.Sequence = xgb.Get16(buf[b:]) |
| 1260 |
b += 2 |
| 1261 |
|
| 1262 |
v.Length = xgb.Get32(buf[b:]) |
| 1263 |
b += 4 |
| 1264 |
|
| 1265 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 1266 |
b += 4 |
| 1267 |
|
| 1268 |
b += 20 |
| 1269 |
|
| 1270 |
{ |
| 1271 |
byteString := make([]byte, v.ContextLen) |
| 1272 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 1273 |
v.Context = string(byteString) |
| 1274 |
b += int(v.ContextLen) |
| 1275 |
} |
| 1276 |
|
| 1277 |
return v |
| 1278 |
} |
| 1279 |
|
| 1280 |
|
| 1281 |
|
| 1282 |
func getSelectionUseContextRequest(c *xgb.Conn) []byte { |
| 1283 |
size := 4 |
| 1284 |
b := 0 |
| 1285 |
buf := make([]byte, size) |
| 1286 |
|
| 1287 |
c.ExtLock.RLock() |
| 1288 |
buf[b] = c.Extensions["SELinux"] |
| 1289 |
c.ExtLock.RUnlock() |
| 1290 |
b += 1 |
| 1291 |
|
| 1292 |
buf[b] = 18 |
| 1293 |
b += 1 |
| 1294 |
|
| 1295 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1296 |
b += 2 |
| 1297 |
|
| 1298 |
return buf |
| 1299 |
} |
| 1300 |
|
| 1301 |
|
| 1302 |
type GetWindowContextCookie struct { |
| 1303 |
*xgb.Cookie |
| 1304 |
} |
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
func GetWindowContext(c *xgb.Conn, Window xproto.Window) GetWindowContextCookie { |
| 1309 |
c.ExtLock.RLock() |
| 1310 |
defer c.ExtLock.RUnlock() |
| 1311 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1312 |
panic("Cannot issue request 'GetWindowContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1313 |
} |
| 1314 |
cookie := c.NewCookie(true, true) |
| 1315 |
c.NewRequest(getWindowContextRequest(c, Window), cookie) |
| 1316 |
return GetWindowContextCookie{cookie} |
| 1317 |
} |
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
func GetWindowContextUnchecked(c *xgb.Conn, Window xproto.Window) GetWindowContextCookie { |
| 1322 |
c.ExtLock.RLock() |
| 1323 |
defer c.ExtLock.RUnlock() |
| 1324 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1325 |
panic("Cannot issue request 'GetWindowContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1326 |
} |
| 1327 |
cookie := c.NewCookie(false, true) |
| 1328 |
c.NewRequest(getWindowContextRequest(c, Window), cookie) |
| 1329 |
return GetWindowContextCookie{cookie} |
| 1330 |
} |
| 1331 |
|
| 1332 |
|
| 1333 |
type GetWindowContextReply struct { |
| 1334 |
Sequence uint16 |
| 1335 |
Length uint32 |
| 1336 |
|
| 1337 |
ContextLen uint32 |
| 1338 |
|
| 1339 |
Context string |
| 1340 |
} |
| 1341 |
|
| 1342 |
|
| 1343 |
func (cook GetWindowContextCookie) Reply() (*GetWindowContextReply, error) { |
| 1344 |
buf, err := cook.Cookie.Reply() |
| 1345 |
if err != nil { |
| 1346 |
return nil, err |
| 1347 |
} |
| 1348 |
if buf == nil { |
| 1349 |
return nil, nil |
| 1350 |
} |
| 1351 |
return getWindowContextReply(buf), nil |
| 1352 |
} |
| 1353 |
|
| 1354 |
|
| 1355 |
func getWindowContextReply(buf []byte) *GetWindowContextReply { |
| 1356 |
v := new(GetWindowContextReply) |
| 1357 |
b := 1 |
| 1358 |
|
| 1359 |
b += 1 |
| 1360 |
|
| 1361 |
v.Sequence = xgb.Get16(buf[b:]) |
| 1362 |
b += 2 |
| 1363 |
|
| 1364 |
v.Length = xgb.Get32(buf[b:]) |
| 1365 |
b += 4 |
| 1366 |
|
| 1367 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 1368 |
b += 4 |
| 1369 |
|
| 1370 |
b += 20 |
| 1371 |
|
| 1372 |
{ |
| 1373 |
byteString := make([]byte, v.ContextLen) |
| 1374 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 1375 |
v.Context = string(byteString) |
| 1376 |
b += int(v.ContextLen) |
| 1377 |
} |
| 1378 |
|
| 1379 |
return v |
| 1380 |
} |
| 1381 |
|
| 1382 |
|
| 1383 |
|
| 1384 |
func getWindowContextRequest(c *xgb.Conn, Window xproto.Window) []byte { |
| 1385 |
size := 8 |
| 1386 |
b := 0 |
| 1387 |
buf := make([]byte, size) |
| 1388 |
|
| 1389 |
c.ExtLock.RLock() |
| 1390 |
buf[b] = c.Extensions["SELinux"] |
| 1391 |
c.ExtLock.RUnlock() |
| 1392 |
b += 1 |
| 1393 |
|
| 1394 |
buf[b] = 7 |
| 1395 |
b += 1 |
| 1396 |
|
| 1397 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1398 |
b += 2 |
| 1399 |
|
| 1400 |
xgb.Put32(buf[b:], uint32(Window)) |
| 1401 |
b += 4 |
| 1402 |
|
| 1403 |
return buf |
| 1404 |
} |
| 1405 |
|
| 1406 |
|
| 1407 |
type GetWindowCreateContextCookie struct { |
| 1408 |
*xgb.Cookie |
| 1409 |
} |
| 1410 |
|
| 1411 |
|
| 1412 |
|
| 1413 |
func GetWindowCreateContext(c *xgb.Conn) GetWindowCreateContextCookie { |
| 1414 |
c.ExtLock.RLock() |
| 1415 |
defer c.ExtLock.RUnlock() |
| 1416 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1417 |
panic("Cannot issue request 'GetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1418 |
} |
| 1419 |
cookie := c.NewCookie(true, true) |
| 1420 |
c.NewRequest(getWindowCreateContextRequest(c), cookie) |
| 1421 |
return GetWindowCreateContextCookie{cookie} |
| 1422 |
} |
| 1423 |
|
| 1424 |
|
| 1425 |
|
| 1426 |
func GetWindowCreateContextUnchecked(c *xgb.Conn) GetWindowCreateContextCookie { |
| 1427 |
c.ExtLock.RLock() |
| 1428 |
defer c.ExtLock.RUnlock() |
| 1429 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1430 |
panic("Cannot issue request 'GetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1431 |
} |
| 1432 |
cookie := c.NewCookie(false, true) |
| 1433 |
c.NewRequest(getWindowCreateContextRequest(c), cookie) |
| 1434 |
return GetWindowCreateContextCookie{cookie} |
| 1435 |
} |
| 1436 |
|
| 1437 |
|
| 1438 |
type GetWindowCreateContextReply struct { |
| 1439 |
Sequence uint16 |
| 1440 |
Length uint32 |
| 1441 |
|
| 1442 |
ContextLen uint32 |
| 1443 |
|
| 1444 |
Context string |
| 1445 |
} |
| 1446 |
|
| 1447 |
|
| 1448 |
func (cook GetWindowCreateContextCookie) Reply() (*GetWindowCreateContextReply, error) { |
| 1449 |
buf, err := cook.Cookie.Reply() |
| 1450 |
if err != nil { |
| 1451 |
return nil, err |
| 1452 |
} |
| 1453 |
if buf == nil { |
| 1454 |
return nil, nil |
| 1455 |
} |
| 1456 |
return getWindowCreateContextReply(buf), nil |
| 1457 |
} |
| 1458 |
|
| 1459 |
|
| 1460 |
func getWindowCreateContextReply(buf []byte) *GetWindowCreateContextReply { |
| 1461 |
v := new(GetWindowCreateContextReply) |
| 1462 |
b := 1 |
| 1463 |
|
| 1464 |
b += 1 |
| 1465 |
|
| 1466 |
v.Sequence = xgb.Get16(buf[b:]) |
| 1467 |
b += 2 |
| 1468 |
|
| 1469 |
v.Length = xgb.Get32(buf[b:]) |
| 1470 |
b += 4 |
| 1471 |
|
| 1472 |
v.ContextLen = xgb.Get32(buf[b:]) |
| 1473 |
b += 4 |
| 1474 |
|
| 1475 |
b += 20 |
| 1476 |
|
| 1477 |
{ |
| 1478 |
byteString := make([]byte, v.ContextLen) |
| 1479 |
copy(byteString[:v.ContextLen], buf[b:]) |
| 1480 |
v.Context = string(byteString) |
| 1481 |
b += int(v.ContextLen) |
| 1482 |
} |
| 1483 |
|
| 1484 |
return v |
| 1485 |
} |
| 1486 |
|
| 1487 |
|
| 1488 |
|
| 1489 |
func getWindowCreateContextRequest(c *xgb.Conn) []byte { |
| 1490 |
size := 4 |
| 1491 |
b := 0 |
| 1492 |
buf := make([]byte, size) |
| 1493 |
|
| 1494 |
c.ExtLock.RLock() |
| 1495 |
buf[b] = c.Extensions["SELinux"] |
| 1496 |
c.ExtLock.RUnlock() |
| 1497 |
b += 1 |
| 1498 |
|
| 1499 |
buf[b] = 6 |
| 1500 |
b += 1 |
| 1501 |
|
| 1502 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1503 |
b += 2 |
| 1504 |
|
| 1505 |
return buf |
| 1506 |
} |
| 1507 |
|
| 1508 |
|
| 1509 |
type ListPropertiesCookie struct { |
| 1510 |
*xgb.Cookie |
| 1511 |
} |
| 1512 |
|
| 1513 |
|
| 1514 |
|
| 1515 |
func ListProperties(c *xgb.Conn, Window xproto.Window) ListPropertiesCookie { |
| 1516 |
c.ExtLock.RLock() |
| 1517 |
defer c.ExtLock.RUnlock() |
| 1518 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1519 |
panic("Cannot issue request 'ListProperties' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1520 |
} |
| 1521 |
cookie := c.NewCookie(true, true) |
| 1522 |
c.NewRequest(listPropertiesRequest(c, Window), cookie) |
| 1523 |
return ListPropertiesCookie{cookie} |
| 1524 |
} |
| 1525 |
|
| 1526 |
|
| 1527 |
|
| 1528 |
func ListPropertiesUnchecked(c *xgb.Conn, Window xproto.Window) ListPropertiesCookie { |
| 1529 |
c.ExtLock.RLock() |
| 1530 |
defer c.ExtLock.RUnlock() |
| 1531 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1532 |
panic("Cannot issue request 'ListProperties' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1533 |
} |
| 1534 |
cookie := c.NewCookie(false, true) |
| 1535 |
c.NewRequest(listPropertiesRequest(c, Window), cookie) |
| 1536 |
return ListPropertiesCookie{cookie} |
| 1537 |
} |
| 1538 |
|
| 1539 |
|
| 1540 |
type ListPropertiesReply struct { |
| 1541 |
Sequence uint16 |
| 1542 |
Length uint32 |
| 1543 |
|
| 1544 |
PropertiesLen uint32 |
| 1545 |
|
| 1546 |
Properties []ListItem |
| 1547 |
} |
| 1548 |
|
| 1549 |
|
| 1550 |
func (cook ListPropertiesCookie) Reply() (*ListPropertiesReply, error) { |
| 1551 |
buf, err := cook.Cookie.Reply() |
| 1552 |
if err != nil { |
| 1553 |
return nil, err |
| 1554 |
} |
| 1555 |
if buf == nil { |
| 1556 |
return nil, nil |
| 1557 |
} |
| 1558 |
return listPropertiesReply(buf), nil |
| 1559 |
} |
| 1560 |
|
| 1561 |
|
| 1562 |
func listPropertiesReply(buf []byte) *ListPropertiesReply { |
| 1563 |
v := new(ListPropertiesReply) |
| 1564 |
b := 1 |
| 1565 |
|
| 1566 |
b += 1 |
| 1567 |
|
| 1568 |
v.Sequence = xgb.Get16(buf[b:]) |
| 1569 |
b += 2 |
| 1570 |
|
| 1571 |
v.Length = xgb.Get32(buf[b:]) |
| 1572 |
b += 4 |
| 1573 |
|
| 1574 |
v.PropertiesLen = xgb.Get32(buf[b:]) |
| 1575 |
b += 4 |
| 1576 |
|
| 1577 |
b += 20 |
| 1578 |
|
| 1579 |
v.Properties = make([]ListItem, v.PropertiesLen) |
| 1580 |
b += ListItemReadList(buf[b:], v.Properties) |
| 1581 |
|
| 1582 |
return v |
| 1583 |
} |
| 1584 |
|
| 1585 |
|
| 1586 |
|
| 1587 |
func listPropertiesRequest(c *xgb.Conn, Window xproto.Window) []byte { |
| 1588 |
size := 8 |
| 1589 |
b := 0 |
| 1590 |
buf := make([]byte, size) |
| 1591 |
|
| 1592 |
c.ExtLock.RLock() |
| 1593 |
buf[b] = c.Extensions["SELinux"] |
| 1594 |
c.ExtLock.RUnlock() |
| 1595 |
b += 1 |
| 1596 |
|
| 1597 |
buf[b] = 14 |
| 1598 |
b += 1 |
| 1599 |
|
| 1600 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1601 |
b += 2 |
| 1602 |
|
| 1603 |
xgb.Put32(buf[b:], uint32(Window)) |
| 1604 |
b += 4 |
| 1605 |
|
| 1606 |
return buf |
| 1607 |
} |
| 1608 |
|
| 1609 |
|
| 1610 |
type ListSelectionsCookie struct { |
| 1611 |
*xgb.Cookie |
| 1612 |
} |
| 1613 |
|
| 1614 |
|
| 1615 |
|
| 1616 |
func ListSelections(c *xgb.Conn) ListSelectionsCookie { |
| 1617 |
c.ExtLock.RLock() |
| 1618 |
defer c.ExtLock.RUnlock() |
| 1619 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1620 |
panic("Cannot issue request 'ListSelections' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1621 |
} |
| 1622 |
cookie := c.NewCookie(true, true) |
| 1623 |
c.NewRequest(listSelectionsRequest(c), cookie) |
| 1624 |
return ListSelectionsCookie{cookie} |
| 1625 |
} |
| 1626 |
|
| 1627 |
|
| 1628 |
|
| 1629 |
func ListSelectionsUnchecked(c *xgb.Conn) ListSelectionsCookie { |
| 1630 |
c.ExtLock.RLock() |
| 1631 |
defer c.ExtLock.RUnlock() |
| 1632 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1633 |
panic("Cannot issue request 'ListSelections' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1634 |
} |
| 1635 |
cookie := c.NewCookie(false, true) |
| 1636 |
c.NewRequest(listSelectionsRequest(c), cookie) |
| 1637 |
return ListSelectionsCookie{cookie} |
| 1638 |
} |
| 1639 |
|
| 1640 |
|
| 1641 |
type ListSelectionsReply struct { |
| 1642 |
Sequence uint16 |
| 1643 |
Length uint32 |
| 1644 |
|
| 1645 |
SelectionsLen uint32 |
| 1646 |
|
| 1647 |
Selections []ListItem |
| 1648 |
} |
| 1649 |
|
| 1650 |
|
| 1651 |
func (cook ListSelectionsCookie) Reply() (*ListSelectionsReply, error) { |
| 1652 |
buf, err := cook.Cookie.Reply() |
| 1653 |
if err != nil { |
| 1654 |
return nil, err |
| 1655 |
} |
| 1656 |
if buf == nil { |
| 1657 |
return nil, nil |
| 1658 |
} |
| 1659 |
return listSelectionsReply(buf), nil |
| 1660 |
} |
| 1661 |
|
| 1662 |
|
| 1663 |
func listSelectionsReply(buf []byte) *ListSelectionsReply { |
| 1664 |
v := new(ListSelectionsReply) |
| 1665 |
b := 1 |
| 1666 |
|
| 1667 |
b += 1 |
| 1668 |
|
| 1669 |
v.Sequence = xgb.Get16(buf[b:]) |
| 1670 |
b += 2 |
| 1671 |
|
| 1672 |
v.Length = xgb.Get32(buf[b:]) |
| 1673 |
b += 4 |
| 1674 |
|
| 1675 |
v.SelectionsLen = xgb.Get32(buf[b:]) |
| 1676 |
b += 4 |
| 1677 |
|
| 1678 |
b += 20 |
| 1679 |
|
| 1680 |
v.Selections = make([]ListItem, v.SelectionsLen) |
| 1681 |
b += ListItemReadList(buf[b:], v.Selections) |
| 1682 |
|
| 1683 |
return v |
| 1684 |
} |
| 1685 |
|
| 1686 |
|
| 1687 |
|
| 1688 |
func listSelectionsRequest(c *xgb.Conn) []byte { |
| 1689 |
size := 4 |
| 1690 |
b := 0 |
| 1691 |
buf := make([]byte, size) |
| 1692 |
|
| 1693 |
c.ExtLock.RLock() |
| 1694 |
buf[b] = c.Extensions["SELinux"] |
| 1695 |
c.ExtLock.RUnlock() |
| 1696 |
b += 1 |
| 1697 |
|
| 1698 |
buf[b] = 21 |
| 1699 |
b += 1 |
| 1700 |
|
| 1701 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1702 |
b += 2 |
| 1703 |
|
| 1704 |
return buf |
| 1705 |
} |
| 1706 |
|
| 1707 |
|
| 1708 |
type QueryVersionCookie struct { |
| 1709 |
*xgb.Cookie |
| 1710 |
} |
| 1711 |
|
| 1712 |
|
| 1713 |
|
| 1714 |
func QueryVersion(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie { |
| 1715 |
c.ExtLock.RLock() |
| 1716 |
defer c.ExtLock.RUnlock() |
| 1717 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1718 |
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1719 |
} |
| 1720 |
cookie := c.NewCookie(true, true) |
| 1721 |
c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie) |
| 1722 |
return QueryVersionCookie{cookie} |
| 1723 |
} |
| 1724 |
|
| 1725 |
|
| 1726 |
|
| 1727 |
func QueryVersionUnchecked(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie { |
| 1728 |
c.ExtLock.RLock() |
| 1729 |
defer c.ExtLock.RUnlock() |
| 1730 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1731 |
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1732 |
} |
| 1733 |
cookie := c.NewCookie(false, true) |
| 1734 |
c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie) |
| 1735 |
return QueryVersionCookie{cookie} |
| 1736 |
} |
| 1737 |
|
| 1738 |
|
| 1739 |
type QueryVersionReply struct { |
| 1740 |
Sequence uint16 |
| 1741 |
Length uint32 |
| 1742 |
|
| 1743 |
ServerMajor uint16 |
| 1744 |
ServerMinor uint16 |
| 1745 |
} |
| 1746 |
|
| 1747 |
|
| 1748 |
func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { |
| 1749 |
buf, err := cook.Cookie.Reply() |
| 1750 |
if err != nil { |
| 1751 |
return nil, err |
| 1752 |
} |
| 1753 |
if buf == nil { |
| 1754 |
return nil, nil |
| 1755 |
} |
| 1756 |
return queryVersionReply(buf), nil |
| 1757 |
} |
| 1758 |
|
| 1759 |
|
| 1760 |
func queryVersionReply(buf []byte) *QueryVersionReply { |
| 1761 |
v := new(QueryVersionReply) |
| 1762 |
b := 1 |
| 1763 |
|
| 1764 |
b += 1 |
| 1765 |
|
| 1766 |
v.Sequence = xgb.Get16(buf[b:]) |
| 1767 |
b += 2 |
| 1768 |
|
| 1769 |
v.Length = xgb.Get32(buf[b:]) |
| 1770 |
b += 4 |
| 1771 |
|
| 1772 |
v.ServerMajor = xgb.Get16(buf[b:]) |
| 1773 |
b += 2 |
| 1774 |
|
| 1775 |
v.ServerMinor = xgb.Get16(buf[b:]) |
| 1776 |
b += 2 |
| 1777 |
|
| 1778 |
return v |
| 1779 |
} |
| 1780 |
|
| 1781 |
|
| 1782 |
|
| 1783 |
func queryVersionRequest(c *xgb.Conn, ClientMajor byte, ClientMinor byte) []byte { |
| 1784 |
size := 8 |
| 1785 |
b := 0 |
| 1786 |
buf := make([]byte, size) |
| 1787 |
|
| 1788 |
c.ExtLock.RLock() |
| 1789 |
buf[b] = c.Extensions["SELinux"] |
| 1790 |
c.ExtLock.RUnlock() |
| 1791 |
b += 1 |
| 1792 |
|
| 1793 |
buf[b] = 0 |
| 1794 |
b += 1 |
| 1795 |
|
| 1796 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1797 |
b += 2 |
| 1798 |
|
| 1799 |
buf[b] = ClientMajor |
| 1800 |
b += 1 |
| 1801 |
|
| 1802 |
buf[b] = ClientMinor |
| 1803 |
b += 1 |
| 1804 |
|
| 1805 |
return buf |
| 1806 |
} |
| 1807 |
|
| 1808 |
|
| 1809 |
type SetDeviceContextCookie struct { |
| 1810 |
*xgb.Cookie |
| 1811 |
} |
| 1812 |
|
| 1813 |
|
| 1814 |
|
| 1815 |
func SetDeviceContext(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) SetDeviceContextCookie { |
| 1816 |
c.ExtLock.RLock() |
| 1817 |
defer c.ExtLock.RUnlock() |
| 1818 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1819 |
panic("Cannot issue request 'SetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1820 |
} |
| 1821 |
cookie := c.NewCookie(false, false) |
| 1822 |
c.NewRequest(setDeviceContextRequest(c, Device, ContextLen, Context), cookie) |
| 1823 |
return SetDeviceContextCookie{cookie} |
| 1824 |
} |
| 1825 |
|
| 1826 |
|
| 1827 |
|
| 1828 |
func SetDeviceContextChecked(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) SetDeviceContextCookie { |
| 1829 |
c.ExtLock.RLock() |
| 1830 |
defer c.ExtLock.RUnlock() |
| 1831 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1832 |
panic("Cannot issue request 'SetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1833 |
} |
| 1834 |
cookie := c.NewCookie(true, false) |
| 1835 |
c.NewRequest(setDeviceContextRequest(c, Device, ContextLen, Context), cookie) |
| 1836 |
return SetDeviceContextCookie{cookie} |
| 1837 |
} |
| 1838 |
|
| 1839 |
|
| 1840 |
|
| 1841 |
func (cook SetDeviceContextCookie) Check() error { |
| 1842 |
return cook.Cookie.Check() |
| 1843 |
} |
| 1844 |
|
| 1845 |
|
| 1846 |
|
| 1847 |
func setDeviceContextRequest(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) []byte { |
| 1848 |
size := xgb.Pad((12 + xgb.Pad((int(ContextLen) * 1)))) |
| 1849 |
b := 0 |
| 1850 |
buf := make([]byte, size) |
| 1851 |
|
| 1852 |
c.ExtLock.RLock() |
| 1853 |
buf[b] = c.Extensions["SELinux"] |
| 1854 |
c.ExtLock.RUnlock() |
| 1855 |
b += 1 |
| 1856 |
|
| 1857 |
buf[b] = 3 |
| 1858 |
b += 1 |
| 1859 |
|
| 1860 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1861 |
b += 2 |
| 1862 |
|
| 1863 |
xgb.Put32(buf[b:], Device) |
| 1864 |
b += 4 |
| 1865 |
|
| 1866 |
xgb.Put32(buf[b:], ContextLen) |
| 1867 |
b += 4 |
| 1868 |
|
| 1869 |
copy(buf[b:], Context[:ContextLen]) |
| 1870 |
b += int(ContextLen) |
| 1871 |
|
| 1872 |
return buf |
| 1873 |
} |
| 1874 |
|
| 1875 |
|
| 1876 |
type SetDeviceCreateContextCookie struct { |
| 1877 |
*xgb.Cookie |
| 1878 |
} |
| 1879 |
|
| 1880 |
|
| 1881 |
|
| 1882 |
func SetDeviceCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetDeviceCreateContextCookie { |
| 1883 |
c.ExtLock.RLock() |
| 1884 |
defer c.ExtLock.RUnlock() |
| 1885 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1886 |
panic("Cannot issue request 'SetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1887 |
} |
| 1888 |
cookie := c.NewCookie(false, false) |
| 1889 |
c.NewRequest(setDeviceCreateContextRequest(c, ContextLen, Context), cookie) |
| 1890 |
return SetDeviceCreateContextCookie{cookie} |
| 1891 |
} |
| 1892 |
|
| 1893 |
|
| 1894 |
|
| 1895 |
func SetDeviceCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetDeviceCreateContextCookie { |
| 1896 |
c.ExtLock.RLock() |
| 1897 |
defer c.ExtLock.RUnlock() |
| 1898 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1899 |
panic("Cannot issue request 'SetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1900 |
} |
| 1901 |
cookie := c.NewCookie(true, false) |
| 1902 |
c.NewRequest(setDeviceCreateContextRequest(c, ContextLen, Context), cookie) |
| 1903 |
return SetDeviceCreateContextCookie{cookie} |
| 1904 |
} |
| 1905 |
|
| 1906 |
|
| 1907 |
|
| 1908 |
func (cook SetDeviceCreateContextCookie) Check() error { |
| 1909 |
return cook.Cookie.Check() |
| 1910 |
} |
| 1911 |
|
| 1912 |
|
| 1913 |
|
| 1914 |
func setDeviceCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte { |
| 1915 |
size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1)))) |
| 1916 |
b := 0 |
| 1917 |
buf := make([]byte, size) |
| 1918 |
|
| 1919 |
c.ExtLock.RLock() |
| 1920 |
buf[b] = c.Extensions["SELinux"] |
| 1921 |
c.ExtLock.RUnlock() |
| 1922 |
b += 1 |
| 1923 |
|
| 1924 |
buf[b] = 1 |
| 1925 |
b += 1 |
| 1926 |
|
| 1927 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1928 |
b += 2 |
| 1929 |
|
| 1930 |
xgb.Put32(buf[b:], ContextLen) |
| 1931 |
b += 4 |
| 1932 |
|
| 1933 |
copy(buf[b:], Context[:ContextLen]) |
| 1934 |
b += int(ContextLen) |
| 1935 |
|
| 1936 |
return buf |
| 1937 |
} |
| 1938 |
|
| 1939 |
|
| 1940 |
type SetPropertyCreateContextCookie struct { |
| 1941 |
*xgb.Cookie |
| 1942 |
} |
| 1943 |
|
| 1944 |
|
| 1945 |
|
| 1946 |
func SetPropertyCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyCreateContextCookie { |
| 1947 |
c.ExtLock.RLock() |
| 1948 |
defer c.ExtLock.RUnlock() |
| 1949 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1950 |
panic("Cannot issue request 'SetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1951 |
} |
| 1952 |
cookie := c.NewCookie(false, false) |
| 1953 |
c.NewRequest(setPropertyCreateContextRequest(c, ContextLen, Context), cookie) |
| 1954 |
return SetPropertyCreateContextCookie{cookie} |
| 1955 |
} |
| 1956 |
|
| 1957 |
|
| 1958 |
|
| 1959 |
func SetPropertyCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyCreateContextCookie { |
| 1960 |
c.ExtLock.RLock() |
| 1961 |
defer c.ExtLock.RUnlock() |
| 1962 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 1963 |
panic("Cannot issue request 'SetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 1964 |
} |
| 1965 |
cookie := c.NewCookie(true, false) |
| 1966 |
c.NewRequest(setPropertyCreateContextRequest(c, ContextLen, Context), cookie) |
| 1967 |
return SetPropertyCreateContextCookie{cookie} |
| 1968 |
} |
| 1969 |
|
| 1970 |
|
| 1971 |
|
| 1972 |
func (cook SetPropertyCreateContextCookie) Check() error { |
| 1973 |
return cook.Cookie.Check() |
| 1974 |
} |
| 1975 |
|
| 1976 |
|
| 1977 |
|
| 1978 |
func setPropertyCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte { |
| 1979 |
size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1)))) |
| 1980 |
b := 0 |
| 1981 |
buf := make([]byte, size) |
| 1982 |
|
| 1983 |
c.ExtLock.RLock() |
| 1984 |
buf[b] = c.Extensions["SELinux"] |
| 1985 |
c.ExtLock.RUnlock() |
| 1986 |
b += 1 |
| 1987 |
|
| 1988 |
buf[b] = 8 |
| 1989 |
b += 1 |
| 1990 |
|
| 1991 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 1992 |
b += 2 |
| 1993 |
|
| 1994 |
xgb.Put32(buf[b:], ContextLen) |
| 1995 |
b += 4 |
| 1996 |
|
| 1997 |
copy(buf[b:], Context[:ContextLen]) |
| 1998 |
b += int(ContextLen) |
| 1999 |
|
| 2000 |
return buf |
| 2001 |
} |
| 2002 |
|
| 2003 |
|
| 2004 |
type SetPropertyUseContextCookie struct { |
| 2005 |
*xgb.Cookie |
| 2006 |
} |
| 2007 |
|
| 2008 |
|
| 2009 |
|
| 2010 |
func SetPropertyUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyUseContextCookie { |
| 2011 |
c.ExtLock.RLock() |
| 2012 |
defer c.ExtLock.RUnlock() |
| 2013 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 2014 |
panic("Cannot issue request 'SetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 2015 |
} |
| 2016 |
cookie := c.NewCookie(false, false) |
| 2017 |
c.NewRequest(setPropertyUseContextRequest(c, ContextLen, Context), cookie) |
| 2018 |
return SetPropertyUseContextCookie{cookie} |
| 2019 |
} |
| 2020 |
|
| 2021 |
|
| 2022 |
|
| 2023 |
func SetPropertyUseContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyUseContextCookie { |
| 2024 |
c.ExtLock.RLock() |
| 2025 |
defer c.ExtLock.RUnlock() |
| 2026 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 2027 |
panic("Cannot issue request 'SetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 2028 |
} |
| 2029 |
cookie := c.NewCookie(true, false) |
| 2030 |
c.NewRequest(setPropertyUseContextRequest(c, ContextLen, Context), cookie) |
| 2031 |
return SetPropertyUseContextCookie{cookie} |
| 2032 |
} |
| 2033 |
|
| 2034 |
|
| 2035 |
|
| 2036 |
func (cook SetPropertyUseContextCookie) Check() error { |
| 2037 |
return cook.Cookie.Check() |
| 2038 |
} |
| 2039 |
|
| 2040 |
|
| 2041 |
|
| 2042 |
func setPropertyUseContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte { |
| 2043 |
size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1)))) |
| 2044 |
b := 0 |
| 2045 |
buf := make([]byte, size) |
| 2046 |
|
| 2047 |
c.ExtLock.RLock() |
| 2048 |
buf[b] = c.Extensions["SELinux"] |
| 2049 |
c.ExtLock.RUnlock() |
| 2050 |
b += 1 |
| 2051 |
|
| 2052 |
buf[b] = 10 |
| 2053 |
b += 1 |
| 2054 |
|
| 2055 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 2056 |
b += 2 |
| 2057 |
|
| 2058 |
xgb.Put32(buf[b:], ContextLen) |
| 2059 |
b += 4 |
| 2060 |
|
| 2061 |
copy(buf[b:], Context[:ContextLen]) |
| 2062 |
b += int(ContextLen) |
| 2063 |
|
| 2064 |
return buf |
| 2065 |
} |
| 2066 |
|
| 2067 |
|
| 2068 |
type SetSelectionCreateContextCookie struct { |
| 2069 |
*xgb.Cookie |
| 2070 |
} |
| 2071 |
|
| 2072 |
|
| 2073 |
|
| 2074 |
func SetSelectionCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionCreateContextCookie { |
| 2075 |
c.ExtLock.RLock() |
| 2076 |
defer c.ExtLock.RUnlock() |
| 2077 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 2078 |
panic("Cannot issue request 'SetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 2079 |
} |
| 2080 |
cookie := c.NewCookie(false, false) |
| 2081 |
c.NewRequest(setSelectionCreateContextRequest(c, ContextLen, Context), cookie) |
| 2082 |
return SetSelectionCreateContextCookie{cookie} |
| 2083 |
} |
| 2084 |
|
| 2085 |
|
| 2086 |
|
| 2087 |
func SetSelectionCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionCreateContextCookie { |
| 2088 |
c.ExtLock.RLock() |
| 2089 |
defer c.ExtLock.RUnlock() |
| 2090 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 2091 |
panic("Cannot issue request 'SetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 2092 |
} |
| 2093 |
cookie := c.NewCookie(true, false) |
| 2094 |
c.NewRequest(setSelectionCreateContextRequest(c, ContextLen, Context), cookie) |
| 2095 |
return SetSelectionCreateContextCookie{cookie} |
| 2096 |
} |
| 2097 |
|
| 2098 |
|
| 2099 |
|
| 2100 |
func (cook SetSelectionCreateContextCookie) Check() error { |
| 2101 |
return cook.Cookie.Check() |
| 2102 |
} |
| 2103 |
|
| 2104 |
|
| 2105 |
|
| 2106 |
func setSelectionCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte { |
| 2107 |
size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1)))) |
| 2108 |
b := 0 |
| 2109 |
buf := make([]byte, size) |
| 2110 |
|
| 2111 |
c.ExtLock.RLock() |
| 2112 |
buf[b] = c.Extensions["SELinux"] |
| 2113 |
c.ExtLock.RUnlock() |
| 2114 |
b += 1 |
| 2115 |
|
| 2116 |
buf[b] = 15 |
| 2117 |
b += 1 |
| 2118 |
|
| 2119 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 2120 |
b += 2 |
| 2121 |
|
| 2122 |
xgb.Put32(buf[b:], ContextLen) |
| 2123 |
b += 4 |
| 2124 |
|
| 2125 |
copy(buf[b:], Context[:ContextLen]) |
| 2126 |
b += int(ContextLen) |
| 2127 |
|
| 2128 |
return buf |
| 2129 |
} |
| 2130 |
|
| 2131 |
|
| 2132 |
type SetSelectionUseContextCookie struct { |
| 2133 |
*xgb.Cookie |
| 2134 |
} |
| 2135 |
|
| 2136 |
|
| 2137 |
|
| 2138 |
func SetSelectionUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionUseContextCookie { |
| 2139 |
c.ExtLock.RLock() |
| 2140 |
defer c.ExtLock.RUnlock() |
| 2141 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 2142 |
panic("Cannot issue request 'SetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 2143 |
} |
| 2144 |
cookie := c.NewCookie(false, false) |
| 2145 |
c.NewRequest(setSelectionUseContextRequest(c, ContextLen, Context), cookie) |
| 2146 |
return SetSelectionUseContextCookie{cookie} |
| 2147 |
} |
| 2148 |
|
| 2149 |
|
| 2150 |
|
| 2151 |
func SetSelectionUseContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionUseContextCookie { |
| 2152 |
c.ExtLock.RLock() |
| 2153 |
defer c.ExtLock.RUnlock() |
| 2154 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 2155 |
panic("Cannot issue request 'SetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 2156 |
} |
| 2157 |
cookie := c.NewCookie(true, false) |
| 2158 |
c.NewRequest(setSelectionUseContextRequest(c, ContextLen, Context), cookie) |
| 2159 |
return SetSelectionUseContextCookie{cookie} |
| 2160 |
} |
| 2161 |
|
| 2162 |
|
| 2163 |
|
| 2164 |
func (cook SetSelectionUseContextCookie) Check() error { |
| 2165 |
return cook.Cookie.Check() |
| 2166 |
} |
| 2167 |
|
| 2168 |
|
| 2169 |
|
| 2170 |
func setSelectionUseContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte { |
| 2171 |
size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1)))) |
| 2172 |
b := 0 |
| 2173 |
buf := make([]byte, size) |
| 2174 |
|
| 2175 |
c.ExtLock.RLock() |
| 2176 |
buf[b] = c.Extensions["SELinux"] |
| 2177 |
c.ExtLock.RUnlock() |
| 2178 |
b += 1 |
| 2179 |
|
| 2180 |
buf[b] = 17 |
| 2181 |
b += 1 |
| 2182 |
|
| 2183 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 2184 |
b += 2 |
| 2185 |
|
| 2186 |
xgb.Put32(buf[b:], ContextLen) |
| 2187 |
b += 4 |
| 2188 |
|
| 2189 |
copy(buf[b:], Context[:ContextLen]) |
| 2190 |
b += int(ContextLen) |
| 2191 |
|
| 2192 |
return buf |
| 2193 |
} |
| 2194 |
|
| 2195 |
|
| 2196 |
type SetWindowCreateContextCookie struct { |
| 2197 |
*xgb.Cookie |
| 2198 |
} |
| 2199 |
|
| 2200 |
|
| 2201 |
|
| 2202 |
func SetWindowCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetWindowCreateContextCookie { |
| 2203 |
c.ExtLock.RLock() |
| 2204 |
defer c.ExtLock.RUnlock() |
| 2205 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 2206 |
panic("Cannot issue request 'SetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 2207 |
} |
| 2208 |
cookie := c.NewCookie(false, false) |
| 2209 |
c.NewRequest(setWindowCreateContextRequest(c, ContextLen, Context), cookie) |
| 2210 |
return SetWindowCreateContextCookie{cookie} |
| 2211 |
} |
| 2212 |
|
| 2213 |
|
| 2214 |
|
| 2215 |
func SetWindowCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetWindowCreateContextCookie { |
| 2216 |
c.ExtLock.RLock() |
| 2217 |
defer c.ExtLock.RUnlock() |
| 2218 |
if _, ok := c.Extensions["SELinux"]; !ok { |
| 2219 |
panic("Cannot issue request 'SetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") |
| 2220 |
} |
| 2221 |
cookie := c.NewCookie(true, false) |
| 2222 |
c.NewRequest(setWindowCreateContextRequest(c, ContextLen, Context), cookie) |
| 2223 |
return SetWindowCreateContextCookie{cookie} |
| 2224 |
} |
| 2225 |
|
| 2226 |
|
| 2227 |
|
| 2228 |
func (cook SetWindowCreateContextCookie) Check() error { |
| 2229 |
return cook.Cookie.Check() |
| 2230 |
} |
| 2231 |
|
| 2232 |
|
| 2233 |
|
| 2234 |
func setWindowCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context string) []byte { |
| 2235 |
size := xgb.Pad((8 + xgb.Pad((int(ContextLen) * 1)))) |
| 2236 |
b := 0 |
| 2237 |
buf := make([]byte, size) |
| 2238 |
|
| 2239 |
c.ExtLock.RLock() |
| 2240 |
buf[b] = c.Extensions["SELinux"] |
| 2241 |
c.ExtLock.RUnlock() |
| 2242 |
b += 1 |
| 2243 |
|
| 2244 |
buf[b] = 5 |
| 2245 |
b += 1 |
| 2246 |
|
| 2247 |
xgb.Put16(buf[b:], uint16(size/4)) |
| 2248 |
b += 2 |
| 2249 |
|
| 2250 |
xgb.Put32(buf[b:], ContextLen) |
| 2251 |
b += 4 |
| 2252 |
|
| 2253 |
copy(buf[b:], Context[:ContextLen]) |
| 2254 |
b += int(ContextLen) |
| 2255 |
|
| 2256 |
return buf |
| 2257 |
} |