github.com/robotn/xgb@v0.0.0-20190912153532-2cb92d044934/glx/glx.go (about) 1 // Package glx is the X client API for the GLX extension. 2 package glx 3 4 // This file is automatically generated from glx.xml. Edit at your peril! 5 6 import ( 7 "github.com/robotn/xgb" 8 9 "github.com/robotn/xgb/xproto" 10 ) 11 12 // Init must be called before using the GLX extension. 13 func Init(c *xgb.Conn) error { 14 reply, err := xproto.QueryExtension(c, 3, "GLX").Reply() 15 switch { 16 case err != nil: 17 return err 18 case !reply.Present: 19 return xgb.Errorf("No extension named GLX could be found on on the server.") 20 } 21 22 c.ExtLock.Lock() 23 c.Extensions["GLX"] = reply.MajorOpcode 24 c.ExtLock.Unlock() 25 for evNum, fun := range xgb.NewExtEventFuncs["GLX"] { 26 xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun 27 } 28 for errNum, fun := range xgb.NewExtErrorFuncs["GLX"] { 29 xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun 30 } 31 return nil 32 } 33 34 func init() { 35 xgb.NewExtEventFuncs["GLX"] = make(map[int]xgb.NewEventFun) 36 xgb.NewExtErrorFuncs["GLX"] = make(map[int]xgb.NewErrorFun) 37 } 38 39 // BadBadContext is the error number for a BadBadContext. 40 const BadBadContext = 0 41 42 type BadContextError GenericError 43 44 // BadContextErrorNew constructs a BadContextError value that implements xgb.Error from a byte slice. 45 func BadContextErrorNew(buf []byte) xgb.Error { 46 v := BadContextError(GenericErrorNew(buf).(GenericError)) 47 v.NiceName = "BadContext" 48 return v 49 } 50 51 // SequenceId returns the sequence id attached to the BadBadContext error. 52 // This is mostly used internally. 53 func (err BadContextError) SequenceId() uint16 { 54 return err.Sequence 55 } 56 57 // BadId returns the 'BadValue' number if one exists for the BadBadContext error. If no bad value exists, 0 is returned. 58 func (err BadContextError) BadId() uint32 { 59 return 0 60 } 61 62 // Error returns a rudimentary string representation of the BadBadContext error. 63 func (err BadContextError) Error() string { 64 fieldVals := make([]string, 0, 4) 65 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 66 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 67 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 68 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 69 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 70 return "BadBadContext {" + xgb.StringsJoin(fieldVals, ", ") + "}" 71 } 72 73 func init() { 74 xgb.NewExtErrorFuncs["GLX"][0] = BadContextErrorNew 75 } 76 77 // BadBadContextState is the error number for a BadBadContextState. 78 const BadBadContextState = 1 79 80 type BadContextStateError GenericError 81 82 // BadContextStateErrorNew constructs a BadContextStateError value that implements xgb.Error from a byte slice. 83 func BadContextStateErrorNew(buf []byte) xgb.Error { 84 v := BadContextStateError(GenericErrorNew(buf).(GenericError)) 85 v.NiceName = "BadContextState" 86 return v 87 } 88 89 // SequenceId returns the sequence id attached to the BadBadContextState error. 90 // This is mostly used internally. 91 func (err BadContextStateError) SequenceId() uint16 { 92 return err.Sequence 93 } 94 95 // BadId returns the 'BadValue' number if one exists for the BadBadContextState error. If no bad value exists, 0 is returned. 96 func (err BadContextStateError) BadId() uint32 { 97 return 0 98 } 99 100 // Error returns a rudimentary string representation of the BadBadContextState error. 101 func (err BadContextStateError) Error() string { 102 fieldVals := make([]string, 0, 4) 103 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 104 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 105 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 106 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 107 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 108 return "BadBadContextState {" + xgb.StringsJoin(fieldVals, ", ") + "}" 109 } 110 111 func init() { 112 xgb.NewExtErrorFuncs["GLX"][1] = BadContextStateErrorNew 113 } 114 115 // BadBadContextTag is the error number for a BadBadContextTag. 116 const BadBadContextTag = 4 117 118 type BadContextTagError GenericError 119 120 // BadContextTagErrorNew constructs a BadContextTagError value that implements xgb.Error from a byte slice. 121 func BadContextTagErrorNew(buf []byte) xgb.Error { 122 v := BadContextTagError(GenericErrorNew(buf).(GenericError)) 123 v.NiceName = "BadContextTag" 124 return v 125 } 126 127 // SequenceId returns the sequence id attached to the BadBadContextTag error. 128 // This is mostly used internally. 129 func (err BadContextTagError) SequenceId() uint16 { 130 return err.Sequence 131 } 132 133 // BadId returns the 'BadValue' number if one exists for the BadBadContextTag error. If no bad value exists, 0 is returned. 134 func (err BadContextTagError) BadId() uint32 { 135 return 0 136 } 137 138 // Error returns a rudimentary string representation of the BadBadContextTag error. 139 func (err BadContextTagError) Error() string { 140 fieldVals := make([]string, 0, 4) 141 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 142 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 143 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 144 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 145 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 146 return "BadBadContextTag {" + xgb.StringsJoin(fieldVals, ", ") + "}" 147 } 148 149 func init() { 150 xgb.NewExtErrorFuncs["GLX"][4] = BadContextTagErrorNew 151 } 152 153 // BadBadCurrentDrawable is the error number for a BadBadCurrentDrawable. 154 const BadBadCurrentDrawable = 11 155 156 type BadCurrentDrawableError GenericError 157 158 // BadCurrentDrawableErrorNew constructs a BadCurrentDrawableError value that implements xgb.Error from a byte slice. 159 func BadCurrentDrawableErrorNew(buf []byte) xgb.Error { 160 v := BadCurrentDrawableError(GenericErrorNew(buf).(GenericError)) 161 v.NiceName = "BadCurrentDrawable" 162 return v 163 } 164 165 // SequenceId returns the sequence id attached to the BadBadCurrentDrawable error. 166 // This is mostly used internally. 167 func (err BadCurrentDrawableError) SequenceId() uint16 { 168 return err.Sequence 169 } 170 171 // BadId returns the 'BadValue' number if one exists for the BadBadCurrentDrawable error. If no bad value exists, 0 is returned. 172 func (err BadCurrentDrawableError) BadId() uint32 { 173 return 0 174 } 175 176 // Error returns a rudimentary string representation of the BadBadCurrentDrawable error. 177 func (err BadCurrentDrawableError) Error() string { 178 fieldVals := make([]string, 0, 4) 179 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 180 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 181 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 182 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 183 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 184 return "BadBadCurrentDrawable {" + xgb.StringsJoin(fieldVals, ", ") + "}" 185 } 186 187 func init() { 188 xgb.NewExtErrorFuncs["GLX"][11] = BadCurrentDrawableErrorNew 189 } 190 191 // BadBadCurrentWindow is the error number for a BadBadCurrentWindow. 192 const BadBadCurrentWindow = 5 193 194 type BadCurrentWindowError GenericError 195 196 // BadCurrentWindowErrorNew constructs a BadCurrentWindowError value that implements xgb.Error from a byte slice. 197 func BadCurrentWindowErrorNew(buf []byte) xgb.Error { 198 v := BadCurrentWindowError(GenericErrorNew(buf).(GenericError)) 199 v.NiceName = "BadCurrentWindow" 200 return v 201 } 202 203 // SequenceId returns the sequence id attached to the BadBadCurrentWindow error. 204 // This is mostly used internally. 205 func (err BadCurrentWindowError) SequenceId() uint16 { 206 return err.Sequence 207 } 208 209 // BadId returns the 'BadValue' number if one exists for the BadBadCurrentWindow error. If no bad value exists, 0 is returned. 210 func (err BadCurrentWindowError) BadId() uint32 { 211 return 0 212 } 213 214 // Error returns a rudimentary string representation of the BadBadCurrentWindow error. 215 func (err BadCurrentWindowError) Error() string { 216 fieldVals := make([]string, 0, 4) 217 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 218 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 219 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 220 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 221 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 222 return "BadBadCurrentWindow {" + xgb.StringsJoin(fieldVals, ", ") + "}" 223 } 224 225 func init() { 226 xgb.NewExtErrorFuncs["GLX"][5] = BadCurrentWindowErrorNew 227 } 228 229 // BadBadDrawable is the error number for a BadBadDrawable. 230 const BadBadDrawable = 2 231 232 type BadDrawableError GenericError 233 234 // BadDrawableErrorNew constructs a BadDrawableError value that implements xgb.Error from a byte slice. 235 func BadDrawableErrorNew(buf []byte) xgb.Error { 236 v := BadDrawableError(GenericErrorNew(buf).(GenericError)) 237 v.NiceName = "BadDrawable" 238 return v 239 } 240 241 // SequenceId returns the sequence id attached to the BadBadDrawable error. 242 // This is mostly used internally. 243 func (err BadDrawableError) SequenceId() uint16 { 244 return err.Sequence 245 } 246 247 // BadId returns the 'BadValue' number if one exists for the BadBadDrawable error. If no bad value exists, 0 is returned. 248 func (err BadDrawableError) BadId() uint32 { 249 return 0 250 } 251 252 // Error returns a rudimentary string representation of the BadBadDrawable error. 253 func (err BadDrawableError) Error() string { 254 fieldVals := make([]string, 0, 4) 255 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 256 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 257 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 258 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 259 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 260 return "BadBadDrawable {" + xgb.StringsJoin(fieldVals, ", ") + "}" 261 } 262 263 func init() { 264 xgb.NewExtErrorFuncs["GLX"][2] = BadDrawableErrorNew 265 } 266 267 // BadBadFBConfig is the error number for a BadBadFBConfig. 268 const BadBadFBConfig = 9 269 270 type BadFBConfigError GenericError 271 272 // BadFBConfigErrorNew constructs a BadFBConfigError value that implements xgb.Error from a byte slice. 273 func BadFBConfigErrorNew(buf []byte) xgb.Error { 274 v := BadFBConfigError(GenericErrorNew(buf).(GenericError)) 275 v.NiceName = "BadFBConfig" 276 return v 277 } 278 279 // SequenceId returns the sequence id attached to the BadBadFBConfig error. 280 // This is mostly used internally. 281 func (err BadFBConfigError) SequenceId() uint16 { 282 return err.Sequence 283 } 284 285 // BadId returns the 'BadValue' number if one exists for the BadBadFBConfig error. If no bad value exists, 0 is returned. 286 func (err BadFBConfigError) BadId() uint32 { 287 return 0 288 } 289 290 // Error returns a rudimentary string representation of the BadBadFBConfig error. 291 func (err BadFBConfigError) Error() string { 292 fieldVals := make([]string, 0, 4) 293 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 294 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 295 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 296 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 297 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 298 return "BadBadFBConfig {" + xgb.StringsJoin(fieldVals, ", ") + "}" 299 } 300 301 func init() { 302 xgb.NewExtErrorFuncs["GLX"][9] = BadFBConfigErrorNew 303 } 304 305 // BadBadLargeRequest is the error number for a BadBadLargeRequest. 306 const BadBadLargeRequest = 7 307 308 type BadLargeRequestError GenericError 309 310 // BadLargeRequestErrorNew constructs a BadLargeRequestError value that implements xgb.Error from a byte slice. 311 func BadLargeRequestErrorNew(buf []byte) xgb.Error { 312 v := BadLargeRequestError(GenericErrorNew(buf).(GenericError)) 313 v.NiceName = "BadLargeRequest" 314 return v 315 } 316 317 // SequenceId returns the sequence id attached to the BadBadLargeRequest error. 318 // This is mostly used internally. 319 func (err BadLargeRequestError) SequenceId() uint16 { 320 return err.Sequence 321 } 322 323 // BadId returns the 'BadValue' number if one exists for the BadBadLargeRequest error. If no bad value exists, 0 is returned. 324 func (err BadLargeRequestError) BadId() uint32 { 325 return 0 326 } 327 328 // Error returns a rudimentary string representation of the BadBadLargeRequest error. 329 func (err BadLargeRequestError) Error() string { 330 fieldVals := make([]string, 0, 4) 331 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 332 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 333 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 334 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 335 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 336 return "BadBadLargeRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}" 337 } 338 339 func init() { 340 xgb.NewExtErrorFuncs["GLX"][7] = BadLargeRequestErrorNew 341 } 342 343 // BadBadPbuffer is the error number for a BadBadPbuffer. 344 const BadBadPbuffer = 10 345 346 type BadPbufferError GenericError 347 348 // BadPbufferErrorNew constructs a BadPbufferError value that implements xgb.Error from a byte slice. 349 func BadPbufferErrorNew(buf []byte) xgb.Error { 350 v := BadPbufferError(GenericErrorNew(buf).(GenericError)) 351 v.NiceName = "BadPbuffer" 352 return v 353 } 354 355 // SequenceId returns the sequence id attached to the BadBadPbuffer error. 356 // This is mostly used internally. 357 func (err BadPbufferError) SequenceId() uint16 { 358 return err.Sequence 359 } 360 361 // BadId returns the 'BadValue' number if one exists for the BadBadPbuffer error. If no bad value exists, 0 is returned. 362 func (err BadPbufferError) BadId() uint32 { 363 return 0 364 } 365 366 // Error returns a rudimentary string representation of the BadBadPbuffer error. 367 func (err BadPbufferError) Error() string { 368 fieldVals := make([]string, 0, 4) 369 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 370 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 371 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 372 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 373 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 374 return "BadBadPbuffer {" + xgb.StringsJoin(fieldVals, ", ") + "}" 375 } 376 377 func init() { 378 xgb.NewExtErrorFuncs["GLX"][10] = BadPbufferErrorNew 379 } 380 381 // BadBadPixmap is the error number for a BadBadPixmap. 382 const BadBadPixmap = 3 383 384 type BadPixmapError GenericError 385 386 // BadPixmapErrorNew constructs a BadPixmapError value that implements xgb.Error from a byte slice. 387 func BadPixmapErrorNew(buf []byte) xgb.Error { 388 v := BadPixmapError(GenericErrorNew(buf).(GenericError)) 389 v.NiceName = "BadPixmap" 390 return v 391 } 392 393 // SequenceId returns the sequence id attached to the BadBadPixmap error. 394 // This is mostly used internally. 395 func (err BadPixmapError) SequenceId() uint16 { 396 return err.Sequence 397 } 398 399 // BadId returns the 'BadValue' number if one exists for the BadBadPixmap error. If no bad value exists, 0 is returned. 400 func (err BadPixmapError) BadId() uint32 { 401 return 0 402 } 403 404 // Error returns a rudimentary string representation of the BadBadPixmap error. 405 func (err BadPixmapError) Error() string { 406 fieldVals := make([]string, 0, 4) 407 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 408 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 409 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 410 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 411 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 412 return "BadBadPixmap {" + xgb.StringsJoin(fieldVals, ", ") + "}" 413 } 414 415 func init() { 416 xgb.NewExtErrorFuncs["GLX"][3] = BadPixmapErrorNew 417 } 418 419 // BadBadRenderRequest is the error number for a BadBadRenderRequest. 420 const BadBadRenderRequest = 6 421 422 type BadRenderRequestError GenericError 423 424 // BadRenderRequestErrorNew constructs a BadRenderRequestError value that implements xgb.Error from a byte slice. 425 func BadRenderRequestErrorNew(buf []byte) xgb.Error { 426 v := BadRenderRequestError(GenericErrorNew(buf).(GenericError)) 427 v.NiceName = "BadRenderRequest" 428 return v 429 } 430 431 // SequenceId returns the sequence id attached to the BadBadRenderRequest error. 432 // This is mostly used internally. 433 func (err BadRenderRequestError) SequenceId() uint16 { 434 return err.Sequence 435 } 436 437 // BadId returns the 'BadValue' number if one exists for the BadBadRenderRequest error. If no bad value exists, 0 is returned. 438 func (err BadRenderRequestError) BadId() uint32 { 439 return 0 440 } 441 442 // Error returns a rudimentary string representation of the BadBadRenderRequest error. 443 func (err BadRenderRequestError) Error() string { 444 fieldVals := make([]string, 0, 4) 445 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 446 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 447 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 448 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 449 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 450 return "BadBadRenderRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}" 451 } 452 453 func init() { 454 xgb.NewExtErrorFuncs["GLX"][6] = BadRenderRequestErrorNew 455 } 456 457 // BadBadWindow is the error number for a BadBadWindow. 458 const BadBadWindow = 12 459 460 type BadWindowError GenericError 461 462 // BadWindowErrorNew constructs a BadWindowError value that implements xgb.Error from a byte slice. 463 func BadWindowErrorNew(buf []byte) xgb.Error { 464 v := BadWindowError(GenericErrorNew(buf).(GenericError)) 465 v.NiceName = "BadWindow" 466 return v 467 } 468 469 // SequenceId returns the sequence id attached to the BadBadWindow error. 470 // This is mostly used internally. 471 func (err BadWindowError) SequenceId() uint16 { 472 return err.Sequence 473 } 474 475 // BadId returns the 'BadValue' number if one exists for the BadBadWindow error. If no bad value exists, 0 is returned. 476 func (err BadWindowError) BadId() uint32 { 477 return 0 478 } 479 480 // Error returns a rudimentary string representation of the BadBadWindow error. 481 func (err BadWindowError) Error() string { 482 fieldVals := make([]string, 0, 4) 483 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 484 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 485 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 486 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 487 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 488 return "BadBadWindow {" + xgb.StringsJoin(fieldVals, ", ") + "}" 489 } 490 491 func init() { 492 xgb.NewExtErrorFuncs["GLX"][12] = BadWindowErrorNew 493 } 494 495 type Bool32 uint32 496 497 // BufferSwapComplete is the event number for a BufferSwapCompleteEvent. 498 const BufferSwapComplete = 1 499 500 type BufferSwapCompleteEvent struct { 501 Sequence uint16 502 // padding: 1 bytes 503 EventType uint16 504 // padding: 2 bytes 505 Drawable Drawable 506 UstHi uint32 507 UstLo uint32 508 MscHi uint32 509 MscLo uint32 510 Sbc uint32 511 } 512 513 // BufferSwapCompleteEventNew constructs a BufferSwapCompleteEvent value that implements xgb.Event from a byte slice. 514 func BufferSwapCompleteEventNew(buf []byte) xgb.Event { 515 v := BufferSwapCompleteEvent{} 516 b := 1 // don't read event number 517 518 b += 1 // padding 519 520 v.Sequence = xgb.Get16(buf[b:]) 521 b += 2 522 523 v.EventType = xgb.Get16(buf[b:]) 524 b += 2 525 526 b += 2 // padding 527 528 v.Drawable = Drawable(xgb.Get32(buf[b:])) 529 b += 4 530 531 v.UstHi = xgb.Get32(buf[b:]) 532 b += 4 533 534 v.UstLo = xgb.Get32(buf[b:]) 535 b += 4 536 537 v.MscHi = xgb.Get32(buf[b:]) 538 b += 4 539 540 v.MscLo = xgb.Get32(buf[b:]) 541 b += 4 542 543 v.Sbc = xgb.Get32(buf[b:]) 544 b += 4 545 546 return v 547 } 548 549 // Bytes writes a BufferSwapCompleteEvent value to a byte slice. 550 func (v BufferSwapCompleteEvent) Bytes() []byte { 551 buf := make([]byte, 32) 552 b := 0 553 554 // write event number 555 buf[b] = 1 556 b += 1 557 558 b += 1 // padding 559 560 b += 2 // skip sequence number 561 562 xgb.Put16(buf[b:], v.EventType) 563 b += 2 564 565 b += 2 // padding 566 567 xgb.Put32(buf[b:], uint32(v.Drawable)) 568 b += 4 569 570 xgb.Put32(buf[b:], v.UstHi) 571 b += 4 572 573 xgb.Put32(buf[b:], v.UstLo) 574 b += 4 575 576 xgb.Put32(buf[b:], v.MscHi) 577 b += 4 578 579 xgb.Put32(buf[b:], v.MscLo) 580 b += 4 581 582 xgb.Put32(buf[b:], v.Sbc) 583 b += 4 584 585 return buf 586 } 587 588 // SequenceId returns the sequence id attached to the BufferSwapComplete event. 589 // Events without a sequence number (KeymapNotify) return 0. 590 // This is mostly used internally. 591 func (v BufferSwapCompleteEvent) SequenceId() uint16 { 592 return v.Sequence 593 } 594 595 // String is a rudimentary string representation of BufferSwapCompleteEvent. 596 func (v BufferSwapCompleteEvent) String() string { 597 fieldVals := make([]string, 0, 9) 598 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) 599 fieldVals = append(fieldVals, xgb.Sprintf("EventType: %d", v.EventType)) 600 fieldVals = append(fieldVals, xgb.Sprintf("Drawable: %d", v.Drawable)) 601 fieldVals = append(fieldVals, xgb.Sprintf("UstHi: %d", v.UstHi)) 602 fieldVals = append(fieldVals, xgb.Sprintf("UstLo: %d", v.UstLo)) 603 fieldVals = append(fieldVals, xgb.Sprintf("MscHi: %d", v.MscHi)) 604 fieldVals = append(fieldVals, xgb.Sprintf("MscLo: %d", v.MscLo)) 605 fieldVals = append(fieldVals, xgb.Sprintf("Sbc: %d", v.Sbc)) 606 return "BufferSwapComplete {" + xgb.StringsJoin(fieldVals, ", ") + "}" 607 } 608 609 func init() { 610 xgb.NewExtEventFuncs["GLX"][1] = BufferSwapCompleteEventNew 611 } 612 613 type Context uint32 614 615 func NewContextId(c *xgb.Conn) (Context, error) { 616 id, err := c.NewId() 617 if err != nil { 618 return 0, err 619 } 620 return Context(id), nil 621 } 622 623 type ContextTag uint32 624 625 type Drawable uint32 626 627 func NewDrawableId(c *xgb.Conn) (Drawable, error) { 628 id, err := c.NewId() 629 if err != nil { 630 return 0, err 631 } 632 return Drawable(id), nil 633 } 634 635 type Fbconfig uint32 636 637 func NewFbconfigId(c *xgb.Conn) (Fbconfig, error) { 638 id, err := c.NewId() 639 if err != nil { 640 return 0, err 641 } 642 return Fbconfig(id), nil 643 } 644 645 type Float32 float64 646 647 type Float64 float64 648 649 // BadGLXBadProfileARB is the error number for a BadGLXBadProfileARB. 650 const BadGLXBadProfileARB = 13 651 652 type GLXBadProfileARBError GenericError 653 654 // GLXBadProfileARBErrorNew constructs a GLXBadProfileARBError value that implements xgb.Error from a byte slice. 655 func GLXBadProfileARBErrorNew(buf []byte) xgb.Error { 656 v := GLXBadProfileARBError(GenericErrorNew(buf).(GenericError)) 657 v.NiceName = "GLXBadProfileARB" 658 return v 659 } 660 661 // SequenceId returns the sequence id attached to the BadGLXBadProfileARB error. 662 // This is mostly used internally. 663 func (err GLXBadProfileARBError) SequenceId() uint16 { 664 return err.Sequence 665 } 666 667 // BadId returns the 'BadValue' number if one exists for the BadGLXBadProfileARB error. If no bad value exists, 0 is returned. 668 func (err GLXBadProfileARBError) BadId() uint32 { 669 return 0 670 } 671 672 // Error returns a rudimentary string representation of the BadGLXBadProfileARB error. 673 func (err GLXBadProfileARBError) Error() string { 674 fieldVals := make([]string, 0, 4) 675 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 676 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 677 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 678 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 679 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 680 return "BadGLXBadProfileARB {" + xgb.StringsJoin(fieldVals, ", ") + "}" 681 } 682 683 func init() { 684 xgb.NewExtErrorFuncs["GLX"][13] = GLXBadProfileARBErrorNew 685 } 686 687 const ( 688 GcGlCurrentBit = 1 689 GcGlPointBit = 2 690 GcGlLineBit = 4 691 GcGlPolygonBit = 8 692 GcGlPolygonStippleBit = 16 693 GcGlPixelModeBit = 32 694 GcGlLightingBit = 64 695 GcGlFogBit = 128 696 GcGlDepthBufferBit = 256 697 GcGlAccumBufferBit = 512 698 GcGlStencilBufferBit = 1024 699 GcGlViewportBit = 2048 700 GcGlTransformBit = 4096 701 GcGlEnableBit = 8192 702 GcGlColorBufferBit = 16384 703 GcGlHintBit = 32768 704 GcGlEvalBit = 65536 705 GcGlListBit = 131072 706 GcGlTextureBit = 262144 707 GcGlScissorBit = 524288 708 GcGlAllAttribBits = 16777215 709 ) 710 711 // BadGeneric is the error number for a BadGeneric. 712 const BadGeneric = -1 713 714 type GenericError struct { 715 Sequence uint16 716 NiceName string 717 BadValue uint32 718 MinorOpcode uint16 719 MajorOpcode byte 720 // padding: 21 bytes 721 } 722 723 // GenericErrorNew constructs a GenericError value that implements xgb.Error from a byte slice. 724 func GenericErrorNew(buf []byte) xgb.Error { 725 v := GenericError{} 726 v.NiceName = "Generic" 727 728 b := 1 // skip error determinant 729 b += 1 // don't read error number 730 731 v.Sequence = xgb.Get16(buf[b:]) 732 b += 2 733 734 v.BadValue = xgb.Get32(buf[b:]) 735 b += 4 736 737 v.MinorOpcode = xgb.Get16(buf[b:]) 738 b += 2 739 740 v.MajorOpcode = buf[b] 741 b += 1 742 743 b += 21 // padding 744 745 return v 746 } 747 748 // SequenceId returns the sequence id attached to the BadGeneric error. 749 // This is mostly used internally. 750 func (err GenericError) SequenceId() uint16 { 751 return err.Sequence 752 } 753 754 // BadId returns the 'BadValue' number if one exists for the BadGeneric error. If no bad value exists, 0 is returned. 755 func (err GenericError) BadId() uint32 { 756 return 0 757 } 758 759 // Error returns a rudimentary string representation of the BadGeneric error. 760 761 func (err GenericError) Error() string { 762 fieldVals := make([]string, 0, 4) 763 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 764 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 765 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 766 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 767 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 768 return "BadGeneric {" + xgb.StringsJoin(fieldVals, ", ") + "}" 769 } 770 771 func init() { 772 xgb.NewExtErrorFuncs["GLX"][-1] = GenericErrorNew 773 } 774 775 const ( 776 PbcdtWindow = 32793 777 PbcdtPbuffer = 32794 778 ) 779 780 const ( 781 PbcetDamaged = 32791 782 PbcetSaved = 32792 783 ) 784 785 type Pbuffer uint32 786 787 func NewPbufferId(c *xgb.Conn) (Pbuffer, error) { 788 id, err := c.NewId() 789 if err != nil { 790 return 0, err 791 } 792 return Pbuffer(id), nil 793 } 794 795 // PbufferClobber is the event number for a PbufferClobberEvent. 796 const PbufferClobber = 0 797 798 type PbufferClobberEvent struct { 799 Sequence uint16 800 // padding: 1 bytes 801 EventType uint16 802 DrawType uint16 803 Drawable Drawable 804 BMask uint32 805 AuxBuffer uint16 806 X uint16 807 Y uint16 808 Width uint16 809 Height uint16 810 Count uint16 811 // padding: 4 bytes 812 } 813 814 // PbufferClobberEventNew constructs a PbufferClobberEvent value that implements xgb.Event from a byte slice. 815 func PbufferClobberEventNew(buf []byte) xgb.Event { 816 v := PbufferClobberEvent{} 817 b := 1 // don't read event number 818 819 b += 1 // padding 820 821 v.Sequence = xgb.Get16(buf[b:]) 822 b += 2 823 824 v.EventType = xgb.Get16(buf[b:]) 825 b += 2 826 827 v.DrawType = xgb.Get16(buf[b:]) 828 b += 2 829 830 v.Drawable = Drawable(xgb.Get32(buf[b:])) 831 b += 4 832 833 v.BMask = xgb.Get32(buf[b:]) 834 b += 4 835 836 v.AuxBuffer = xgb.Get16(buf[b:]) 837 b += 2 838 839 v.X = xgb.Get16(buf[b:]) 840 b += 2 841 842 v.Y = xgb.Get16(buf[b:]) 843 b += 2 844 845 v.Width = xgb.Get16(buf[b:]) 846 b += 2 847 848 v.Height = xgb.Get16(buf[b:]) 849 b += 2 850 851 v.Count = xgb.Get16(buf[b:]) 852 b += 2 853 854 b += 4 // padding 855 856 return v 857 } 858 859 // Bytes writes a PbufferClobberEvent value to a byte slice. 860 func (v PbufferClobberEvent) Bytes() []byte { 861 buf := make([]byte, 32) 862 b := 0 863 864 // write event number 865 buf[b] = 0 866 b += 1 867 868 b += 1 // padding 869 870 b += 2 // skip sequence number 871 872 xgb.Put16(buf[b:], v.EventType) 873 b += 2 874 875 xgb.Put16(buf[b:], v.DrawType) 876 b += 2 877 878 xgb.Put32(buf[b:], uint32(v.Drawable)) 879 b += 4 880 881 xgb.Put32(buf[b:], v.BMask) 882 b += 4 883 884 xgb.Put16(buf[b:], v.AuxBuffer) 885 b += 2 886 887 xgb.Put16(buf[b:], v.X) 888 b += 2 889 890 xgb.Put16(buf[b:], v.Y) 891 b += 2 892 893 xgb.Put16(buf[b:], v.Width) 894 b += 2 895 896 xgb.Put16(buf[b:], v.Height) 897 b += 2 898 899 xgb.Put16(buf[b:], v.Count) 900 b += 2 901 902 b += 4 // padding 903 904 return buf 905 } 906 907 // SequenceId returns the sequence id attached to the PbufferClobber event. 908 // Events without a sequence number (KeymapNotify) return 0. 909 // This is mostly used internally. 910 func (v PbufferClobberEvent) SequenceId() uint16 { 911 return v.Sequence 912 } 913 914 // String is a rudimentary string representation of PbufferClobberEvent. 915 func (v PbufferClobberEvent) String() string { 916 fieldVals := make([]string, 0, 12) 917 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) 918 fieldVals = append(fieldVals, xgb.Sprintf("EventType: %d", v.EventType)) 919 fieldVals = append(fieldVals, xgb.Sprintf("DrawType: %d", v.DrawType)) 920 fieldVals = append(fieldVals, xgb.Sprintf("Drawable: %d", v.Drawable)) 921 fieldVals = append(fieldVals, xgb.Sprintf("BMask: %d", v.BMask)) 922 fieldVals = append(fieldVals, xgb.Sprintf("AuxBuffer: %d", v.AuxBuffer)) 923 fieldVals = append(fieldVals, xgb.Sprintf("X: %d", v.X)) 924 fieldVals = append(fieldVals, xgb.Sprintf("Y: %d", v.Y)) 925 fieldVals = append(fieldVals, xgb.Sprintf("Width: %d", v.Width)) 926 fieldVals = append(fieldVals, xgb.Sprintf("Height: %d", v.Height)) 927 fieldVals = append(fieldVals, xgb.Sprintf("Count: %d", v.Count)) 928 return "PbufferClobber {" + xgb.StringsJoin(fieldVals, ", ") + "}" 929 } 930 931 func init() { 932 xgb.NewExtEventFuncs["GLX"][0] = PbufferClobberEventNew 933 } 934 935 type Pixmap uint32 936 937 func NewPixmapId(c *xgb.Conn) (Pixmap, error) { 938 id, err := c.NewId() 939 if err != nil { 940 return 0, err 941 } 942 return Pixmap(id), nil 943 } 944 945 const ( 946 RmGlRender = 7168 947 RmGlFeedback = 7169 948 RmGlSelect = 7170 949 ) 950 951 // BadUnsupportedPrivateRequest is the error number for a BadUnsupportedPrivateRequest. 952 const BadUnsupportedPrivateRequest = 8 953 954 type UnsupportedPrivateRequestError GenericError 955 956 // UnsupportedPrivateRequestErrorNew constructs a UnsupportedPrivateRequestError value that implements xgb.Error from a byte slice. 957 func UnsupportedPrivateRequestErrorNew(buf []byte) xgb.Error { 958 v := UnsupportedPrivateRequestError(GenericErrorNew(buf).(GenericError)) 959 v.NiceName = "UnsupportedPrivateRequest" 960 return v 961 } 962 963 // SequenceId returns the sequence id attached to the BadUnsupportedPrivateRequest error. 964 // This is mostly used internally. 965 func (err UnsupportedPrivateRequestError) SequenceId() uint16 { 966 return err.Sequence 967 } 968 969 // BadId returns the 'BadValue' number if one exists for the BadUnsupportedPrivateRequest error. If no bad value exists, 0 is returned. 970 func (err UnsupportedPrivateRequestError) BadId() uint32 { 971 return 0 972 } 973 974 // Error returns a rudimentary string representation of the BadUnsupportedPrivateRequest error. 975 func (err UnsupportedPrivateRequestError) Error() string { 976 fieldVals := make([]string, 0, 4) 977 fieldVals = append(fieldVals, "NiceName: "+err.NiceName) 978 fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) 979 fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) 980 fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) 981 fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) 982 return "BadUnsupportedPrivateRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}" 983 } 984 985 func init() { 986 xgb.NewExtErrorFuncs["GLX"][8] = UnsupportedPrivateRequestErrorNew 987 } 988 989 type Window uint32 990 991 func NewWindowId(c *xgb.Conn) (Window, error) { 992 id, err := c.NewId() 993 if err != nil { 994 return 0, err 995 } 996 return Window(id), nil 997 } 998 999 // Skipping definition for base type 'Bool' 1000 1001 // Skipping definition for base type 'Byte' 1002 1003 // Skipping definition for base type 'Card8' 1004 1005 // Skipping definition for base type 'Char' 1006 1007 // Skipping definition for base type 'Void' 1008 1009 // Skipping definition for base type 'Double' 1010 1011 // Skipping definition for base type 'Float' 1012 1013 // Skipping definition for base type 'Int16' 1014 1015 // Skipping definition for base type 'Int32' 1016 1017 // Skipping definition for base type 'Int8' 1018 1019 // Skipping definition for base type 'Card16' 1020 1021 // Skipping definition for base type 'Card32' 1022 1023 // AreTexturesResidentCookie is a cookie used only for AreTexturesResident requests. 1024 type AreTexturesResidentCookie struct { 1025 *xgb.Cookie 1026 } 1027 1028 // AreTexturesResident sends a checked request. 1029 // If an error occurs, it will be returned with the reply by calling AreTexturesResidentCookie.Reply() 1030 func AreTexturesResident(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) AreTexturesResidentCookie { 1031 c.ExtLock.RLock() 1032 defer c.ExtLock.RUnlock() 1033 if _, ok := c.Extensions["GLX"]; !ok { 1034 panic("Cannot issue request 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1035 } 1036 cookie := c.NewCookie(true, true) 1037 c.NewRequest(areTexturesResidentRequest(c, ContextTag, N, Textures), cookie) 1038 return AreTexturesResidentCookie{cookie} 1039 } 1040 1041 // AreTexturesResidentUnchecked sends an unchecked request. 1042 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1043 func AreTexturesResidentUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) AreTexturesResidentCookie { 1044 c.ExtLock.RLock() 1045 defer c.ExtLock.RUnlock() 1046 if _, ok := c.Extensions["GLX"]; !ok { 1047 panic("Cannot issue request 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1048 } 1049 cookie := c.NewCookie(false, true) 1050 c.NewRequest(areTexturesResidentRequest(c, ContextTag, N, Textures), cookie) 1051 return AreTexturesResidentCookie{cookie} 1052 } 1053 1054 // AreTexturesResidentReply represents the data returned from a AreTexturesResident request. 1055 type AreTexturesResidentReply struct { 1056 Sequence uint16 // sequence number of the request for this reply 1057 Length uint32 // number of bytes in this reply 1058 // padding: 1 bytes 1059 RetVal Bool32 1060 // padding: 20 bytes 1061 Data []bool // size: xgb.Pad(((int(Length) * 4) * 1)) 1062 } 1063 1064 // Reply blocks and returns the reply data for a AreTexturesResident request. 1065 func (cook AreTexturesResidentCookie) Reply() (*AreTexturesResidentReply, error) { 1066 buf, err := cook.Cookie.Reply() 1067 if err != nil { 1068 return nil, err 1069 } 1070 if buf == nil { 1071 return nil, nil 1072 } 1073 return areTexturesResidentReply(buf), nil 1074 } 1075 1076 // areTexturesResidentReply reads a byte slice into a AreTexturesResidentReply value. 1077 func areTexturesResidentReply(buf []byte) *AreTexturesResidentReply { 1078 v := new(AreTexturesResidentReply) 1079 b := 1 // skip reply determinant 1080 1081 b += 1 // padding 1082 1083 v.Sequence = xgb.Get16(buf[b:]) 1084 b += 2 1085 1086 v.Length = xgb.Get32(buf[b:]) // 4-byte units 1087 b += 4 1088 1089 v.RetVal = Bool32(xgb.Get32(buf[b:])) 1090 b += 4 1091 1092 b += 20 // padding 1093 1094 v.Data = make([]bool, (int(v.Length) * 4)) 1095 for i := 0; i < int((int(v.Length) * 4)); i++ { 1096 if buf[b] == 1 { 1097 v.Data[i] = true 1098 } else { 1099 v.Data[i] = false 1100 } 1101 b += 1 1102 } 1103 1104 return v 1105 } 1106 1107 // Write request to wire for AreTexturesResident 1108 // areTexturesResidentRequest writes a AreTexturesResident request to a byte slice. 1109 func areTexturesResidentRequest(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) []byte { 1110 size := xgb.Pad((12 + xgb.Pad((int(N) * 4)))) 1111 b := 0 1112 buf := make([]byte, size) 1113 1114 c.ExtLock.RLock() 1115 buf[b] = c.Extensions["GLX"] 1116 c.ExtLock.RUnlock() 1117 b += 1 1118 1119 buf[b] = 143 // request opcode 1120 b += 1 1121 1122 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1123 b += 2 1124 1125 xgb.Put32(buf[b:], uint32(ContextTag)) 1126 b += 4 1127 1128 xgb.Put32(buf[b:], uint32(N)) 1129 b += 4 1130 1131 for i := 0; i < int(N); i++ { 1132 xgb.Put32(buf[b:], Textures[i]) 1133 b += 4 1134 } 1135 1136 return buf 1137 } 1138 1139 // ChangeDrawableAttributesCookie is a cookie used only for ChangeDrawableAttributes requests. 1140 type ChangeDrawableAttributesCookie struct { 1141 *xgb.Cookie 1142 } 1143 1144 // ChangeDrawableAttributes sends an unchecked request. 1145 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1146 func ChangeDrawableAttributes(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) ChangeDrawableAttributesCookie { 1147 c.ExtLock.RLock() 1148 defer c.ExtLock.RUnlock() 1149 if _, ok := c.Extensions["GLX"]; !ok { 1150 panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1151 } 1152 cookie := c.NewCookie(false, false) 1153 c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie) 1154 return ChangeDrawableAttributesCookie{cookie} 1155 } 1156 1157 // ChangeDrawableAttributesChecked sends a checked request. 1158 // If an error occurs, it can be retrieved using ChangeDrawableAttributesCookie.Check() 1159 func ChangeDrawableAttributesChecked(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) ChangeDrawableAttributesCookie { 1160 c.ExtLock.RLock() 1161 defer c.ExtLock.RUnlock() 1162 if _, ok := c.Extensions["GLX"]; !ok { 1163 panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1164 } 1165 cookie := c.NewCookie(true, false) 1166 c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie) 1167 return ChangeDrawableAttributesCookie{cookie} 1168 } 1169 1170 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1171 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1172 func (cook ChangeDrawableAttributesCookie) Check() error { 1173 return cook.Cookie.Check() 1174 } 1175 1176 // Write request to wire for ChangeDrawableAttributes 1177 // changeDrawableAttributesRequest writes a ChangeDrawableAttributes request to a byte slice. 1178 func changeDrawableAttributesRequest(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) []byte { 1179 size := xgb.Pad((12 + xgb.Pad(((int(NumAttribs) * 2) * 4)))) 1180 b := 0 1181 buf := make([]byte, size) 1182 1183 c.ExtLock.RLock() 1184 buf[b] = c.Extensions["GLX"] 1185 c.ExtLock.RUnlock() 1186 b += 1 1187 1188 buf[b] = 30 // request opcode 1189 b += 1 1190 1191 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1192 b += 2 1193 1194 xgb.Put32(buf[b:], uint32(Drawable)) 1195 b += 4 1196 1197 xgb.Put32(buf[b:], NumAttribs) 1198 b += 4 1199 1200 for i := 0; i < int((int(NumAttribs) * 2)); i++ { 1201 xgb.Put32(buf[b:], Attribs[i]) 1202 b += 4 1203 } 1204 1205 return buf 1206 } 1207 1208 // ClientInfoCookie is a cookie used only for ClientInfo requests. 1209 type ClientInfoCookie struct { 1210 *xgb.Cookie 1211 } 1212 1213 // ClientInfo sends an unchecked request. 1214 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1215 func ClientInfo(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) ClientInfoCookie { 1216 c.ExtLock.RLock() 1217 defer c.ExtLock.RUnlock() 1218 if _, ok := c.Extensions["GLX"]; !ok { 1219 panic("Cannot issue request 'ClientInfo' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1220 } 1221 cookie := c.NewCookie(false, false) 1222 c.NewRequest(clientInfoRequest(c, MajorVersion, MinorVersion, StrLen, String), cookie) 1223 return ClientInfoCookie{cookie} 1224 } 1225 1226 // ClientInfoChecked sends a checked request. 1227 // If an error occurs, it can be retrieved using ClientInfoCookie.Check() 1228 func ClientInfoChecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) ClientInfoCookie { 1229 c.ExtLock.RLock() 1230 defer c.ExtLock.RUnlock() 1231 if _, ok := c.Extensions["GLX"]; !ok { 1232 panic("Cannot issue request 'ClientInfo' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1233 } 1234 cookie := c.NewCookie(true, false) 1235 c.NewRequest(clientInfoRequest(c, MajorVersion, MinorVersion, StrLen, String), cookie) 1236 return ClientInfoCookie{cookie} 1237 } 1238 1239 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1240 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1241 func (cook ClientInfoCookie) Check() error { 1242 return cook.Cookie.Check() 1243 } 1244 1245 // Write request to wire for ClientInfo 1246 // clientInfoRequest writes a ClientInfo request to a byte slice. 1247 func clientInfoRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) []byte { 1248 size := xgb.Pad((16 + xgb.Pad((int(StrLen) * 1)))) 1249 b := 0 1250 buf := make([]byte, size) 1251 1252 c.ExtLock.RLock() 1253 buf[b] = c.Extensions["GLX"] 1254 c.ExtLock.RUnlock() 1255 b += 1 1256 1257 buf[b] = 20 // request opcode 1258 b += 1 1259 1260 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1261 b += 2 1262 1263 xgb.Put32(buf[b:], MajorVersion) 1264 b += 4 1265 1266 xgb.Put32(buf[b:], MinorVersion) 1267 b += 4 1268 1269 xgb.Put32(buf[b:], StrLen) 1270 b += 4 1271 1272 copy(buf[b:], String[:StrLen]) 1273 b += int(StrLen) 1274 1275 return buf 1276 } 1277 1278 // CopyContextCookie is a cookie used only for CopyContext requests. 1279 type CopyContextCookie struct { 1280 *xgb.Cookie 1281 } 1282 1283 // CopyContext sends an unchecked request. 1284 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1285 func CopyContext(c *xgb.Conn, Src Context, Dest Context, Mask uint32, SrcContextTag ContextTag) CopyContextCookie { 1286 c.ExtLock.RLock() 1287 defer c.ExtLock.RUnlock() 1288 if _, ok := c.Extensions["GLX"]; !ok { 1289 panic("Cannot issue request 'CopyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1290 } 1291 cookie := c.NewCookie(false, false) 1292 c.NewRequest(copyContextRequest(c, Src, Dest, Mask, SrcContextTag), cookie) 1293 return CopyContextCookie{cookie} 1294 } 1295 1296 // CopyContextChecked sends a checked request. 1297 // If an error occurs, it can be retrieved using CopyContextCookie.Check() 1298 func CopyContextChecked(c *xgb.Conn, Src Context, Dest Context, Mask uint32, SrcContextTag ContextTag) CopyContextCookie { 1299 c.ExtLock.RLock() 1300 defer c.ExtLock.RUnlock() 1301 if _, ok := c.Extensions["GLX"]; !ok { 1302 panic("Cannot issue request 'CopyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1303 } 1304 cookie := c.NewCookie(true, false) 1305 c.NewRequest(copyContextRequest(c, Src, Dest, Mask, SrcContextTag), cookie) 1306 return CopyContextCookie{cookie} 1307 } 1308 1309 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1310 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1311 func (cook CopyContextCookie) Check() error { 1312 return cook.Cookie.Check() 1313 } 1314 1315 // Write request to wire for CopyContext 1316 // copyContextRequest writes a CopyContext request to a byte slice. 1317 func copyContextRequest(c *xgb.Conn, Src Context, Dest Context, Mask uint32, SrcContextTag ContextTag) []byte { 1318 size := 20 1319 b := 0 1320 buf := make([]byte, size) 1321 1322 c.ExtLock.RLock() 1323 buf[b] = c.Extensions["GLX"] 1324 c.ExtLock.RUnlock() 1325 b += 1 1326 1327 buf[b] = 10 // request opcode 1328 b += 1 1329 1330 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1331 b += 2 1332 1333 xgb.Put32(buf[b:], uint32(Src)) 1334 b += 4 1335 1336 xgb.Put32(buf[b:], uint32(Dest)) 1337 b += 4 1338 1339 xgb.Put32(buf[b:], Mask) 1340 b += 4 1341 1342 xgb.Put32(buf[b:], uint32(SrcContextTag)) 1343 b += 4 1344 1345 return buf 1346 } 1347 1348 // CreateContextCookie is a cookie used only for CreateContext requests. 1349 type CreateContextCookie struct { 1350 *xgb.Cookie 1351 } 1352 1353 // CreateContext sends an unchecked request. 1354 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1355 func CreateContext(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen uint32, ShareList Context, IsDirect bool) CreateContextCookie { 1356 c.ExtLock.RLock() 1357 defer c.ExtLock.RUnlock() 1358 if _, ok := c.Extensions["GLX"]; !ok { 1359 panic("Cannot issue request 'CreateContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1360 } 1361 cookie := c.NewCookie(false, false) 1362 c.NewRequest(createContextRequest(c, Context, Visual, Screen, ShareList, IsDirect), cookie) 1363 return CreateContextCookie{cookie} 1364 } 1365 1366 // CreateContextChecked sends a checked request. 1367 // If an error occurs, it can be retrieved using CreateContextCookie.Check() 1368 func CreateContextChecked(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen uint32, ShareList Context, IsDirect bool) CreateContextCookie { 1369 c.ExtLock.RLock() 1370 defer c.ExtLock.RUnlock() 1371 if _, ok := c.Extensions["GLX"]; !ok { 1372 panic("Cannot issue request 'CreateContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1373 } 1374 cookie := c.NewCookie(true, false) 1375 c.NewRequest(createContextRequest(c, Context, Visual, Screen, ShareList, IsDirect), cookie) 1376 return CreateContextCookie{cookie} 1377 } 1378 1379 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1380 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1381 func (cook CreateContextCookie) Check() error { 1382 return cook.Cookie.Check() 1383 } 1384 1385 // Write request to wire for CreateContext 1386 // createContextRequest writes a CreateContext request to a byte slice. 1387 func createContextRequest(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen uint32, ShareList Context, IsDirect bool) []byte { 1388 size := 24 1389 b := 0 1390 buf := make([]byte, size) 1391 1392 c.ExtLock.RLock() 1393 buf[b] = c.Extensions["GLX"] 1394 c.ExtLock.RUnlock() 1395 b += 1 1396 1397 buf[b] = 3 // request opcode 1398 b += 1 1399 1400 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1401 b += 2 1402 1403 xgb.Put32(buf[b:], uint32(Context)) 1404 b += 4 1405 1406 xgb.Put32(buf[b:], uint32(Visual)) 1407 b += 4 1408 1409 xgb.Put32(buf[b:], Screen) 1410 b += 4 1411 1412 xgb.Put32(buf[b:], uint32(ShareList)) 1413 b += 4 1414 1415 if IsDirect { 1416 buf[b] = 1 1417 } else { 1418 buf[b] = 0 1419 } 1420 b += 1 1421 1422 b += 3 // padding 1423 1424 return buf 1425 } 1426 1427 // CreateContextAttribsARBCookie is a cookie used only for CreateContextAttribsARB requests. 1428 type CreateContextAttribsARBCookie struct { 1429 *xgb.Cookie 1430 } 1431 1432 // CreateContextAttribsARB sends an unchecked request. 1433 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1434 func CreateContextAttribsARB(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) CreateContextAttribsARBCookie { 1435 c.ExtLock.RLock() 1436 defer c.ExtLock.RUnlock() 1437 if _, ok := c.Extensions["GLX"]; !ok { 1438 panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1439 } 1440 cookie := c.NewCookie(false, false) 1441 c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie) 1442 return CreateContextAttribsARBCookie{cookie} 1443 } 1444 1445 // CreateContextAttribsARBChecked sends a checked request. 1446 // If an error occurs, it can be retrieved using CreateContextAttribsARBCookie.Check() 1447 func CreateContextAttribsARBChecked(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) CreateContextAttribsARBCookie { 1448 c.ExtLock.RLock() 1449 defer c.ExtLock.RUnlock() 1450 if _, ok := c.Extensions["GLX"]; !ok { 1451 panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1452 } 1453 cookie := c.NewCookie(true, false) 1454 c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie) 1455 return CreateContextAttribsARBCookie{cookie} 1456 } 1457 1458 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1459 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1460 func (cook CreateContextAttribsARBCookie) Check() error { 1461 return cook.Cookie.Check() 1462 } 1463 1464 // Write request to wire for CreateContextAttribsARB 1465 // createContextAttribsARBRequest writes a CreateContextAttribsARB request to a byte slice. 1466 func createContextAttribsARBRequest(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) []byte { 1467 size := xgb.Pad((28 + xgb.Pad(((int(NumAttribs) * 2) * 4)))) 1468 b := 0 1469 buf := make([]byte, size) 1470 1471 c.ExtLock.RLock() 1472 buf[b] = c.Extensions["GLX"] 1473 c.ExtLock.RUnlock() 1474 b += 1 1475 1476 buf[b] = 34 // request opcode 1477 b += 1 1478 1479 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1480 b += 2 1481 1482 xgb.Put32(buf[b:], uint32(Context)) 1483 b += 4 1484 1485 xgb.Put32(buf[b:], uint32(Fbconfig)) 1486 b += 4 1487 1488 xgb.Put32(buf[b:], Screen) 1489 b += 4 1490 1491 xgb.Put32(buf[b:], uint32(ShareList)) 1492 b += 4 1493 1494 if IsDirect { 1495 buf[b] = 1 1496 } else { 1497 buf[b] = 0 1498 } 1499 b += 1 1500 1501 b += 3 // padding 1502 1503 xgb.Put32(buf[b:], NumAttribs) 1504 b += 4 1505 1506 for i := 0; i < int((int(NumAttribs) * 2)); i++ { 1507 xgb.Put32(buf[b:], Attribs[i]) 1508 b += 4 1509 } 1510 1511 return buf 1512 } 1513 1514 // CreateGLXPixmapCookie is a cookie used only for CreateGLXPixmap requests. 1515 type CreateGLXPixmapCookie struct { 1516 *xgb.Cookie 1517 } 1518 1519 // CreateGLXPixmap sends an unchecked request. 1520 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1521 func CreateGLXPixmap(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) CreateGLXPixmapCookie { 1522 c.ExtLock.RLock() 1523 defer c.ExtLock.RUnlock() 1524 if _, ok := c.Extensions["GLX"]; !ok { 1525 panic("Cannot issue request 'CreateGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1526 } 1527 cookie := c.NewCookie(false, false) 1528 c.NewRequest(createGLXPixmapRequest(c, Screen, Visual, Pixmap, GlxPixmap), cookie) 1529 return CreateGLXPixmapCookie{cookie} 1530 } 1531 1532 // CreateGLXPixmapChecked sends a checked request. 1533 // If an error occurs, it can be retrieved using CreateGLXPixmapCookie.Check() 1534 func CreateGLXPixmapChecked(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) CreateGLXPixmapCookie { 1535 c.ExtLock.RLock() 1536 defer c.ExtLock.RUnlock() 1537 if _, ok := c.Extensions["GLX"]; !ok { 1538 panic("Cannot issue request 'CreateGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1539 } 1540 cookie := c.NewCookie(true, false) 1541 c.NewRequest(createGLXPixmapRequest(c, Screen, Visual, Pixmap, GlxPixmap), cookie) 1542 return CreateGLXPixmapCookie{cookie} 1543 } 1544 1545 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1546 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1547 func (cook CreateGLXPixmapCookie) Check() error { 1548 return cook.Cookie.Check() 1549 } 1550 1551 // Write request to wire for CreateGLXPixmap 1552 // createGLXPixmapRequest writes a CreateGLXPixmap request to a byte slice. 1553 func createGLXPixmapRequest(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) []byte { 1554 size := 20 1555 b := 0 1556 buf := make([]byte, size) 1557 1558 c.ExtLock.RLock() 1559 buf[b] = c.Extensions["GLX"] 1560 c.ExtLock.RUnlock() 1561 b += 1 1562 1563 buf[b] = 13 // request opcode 1564 b += 1 1565 1566 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1567 b += 2 1568 1569 xgb.Put32(buf[b:], Screen) 1570 b += 4 1571 1572 xgb.Put32(buf[b:], uint32(Visual)) 1573 b += 4 1574 1575 xgb.Put32(buf[b:], uint32(Pixmap)) 1576 b += 4 1577 1578 xgb.Put32(buf[b:], uint32(GlxPixmap)) 1579 b += 4 1580 1581 return buf 1582 } 1583 1584 // CreateNewContextCookie is a cookie used only for CreateNewContext requests. 1585 type CreateNewContextCookie struct { 1586 *xgb.Cookie 1587 } 1588 1589 // CreateNewContext sends an unchecked request. 1590 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1591 func CreateNewContext(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, RenderType uint32, ShareList Context, IsDirect bool) CreateNewContextCookie { 1592 c.ExtLock.RLock() 1593 defer c.ExtLock.RUnlock() 1594 if _, ok := c.Extensions["GLX"]; !ok { 1595 panic("Cannot issue request 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1596 } 1597 cookie := c.NewCookie(false, false) 1598 c.NewRequest(createNewContextRequest(c, Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie) 1599 return CreateNewContextCookie{cookie} 1600 } 1601 1602 // CreateNewContextChecked sends a checked request. 1603 // If an error occurs, it can be retrieved using CreateNewContextCookie.Check() 1604 func CreateNewContextChecked(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, RenderType uint32, ShareList Context, IsDirect bool) CreateNewContextCookie { 1605 c.ExtLock.RLock() 1606 defer c.ExtLock.RUnlock() 1607 if _, ok := c.Extensions["GLX"]; !ok { 1608 panic("Cannot issue request 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1609 } 1610 cookie := c.NewCookie(true, false) 1611 c.NewRequest(createNewContextRequest(c, Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie) 1612 return CreateNewContextCookie{cookie} 1613 } 1614 1615 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1616 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1617 func (cook CreateNewContextCookie) Check() error { 1618 return cook.Cookie.Check() 1619 } 1620 1621 // Write request to wire for CreateNewContext 1622 // createNewContextRequest writes a CreateNewContext request to a byte slice. 1623 func createNewContextRequest(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, RenderType uint32, ShareList Context, IsDirect bool) []byte { 1624 size := 28 1625 b := 0 1626 buf := make([]byte, size) 1627 1628 c.ExtLock.RLock() 1629 buf[b] = c.Extensions["GLX"] 1630 c.ExtLock.RUnlock() 1631 b += 1 1632 1633 buf[b] = 24 // request opcode 1634 b += 1 1635 1636 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1637 b += 2 1638 1639 xgb.Put32(buf[b:], uint32(Context)) 1640 b += 4 1641 1642 xgb.Put32(buf[b:], uint32(Fbconfig)) 1643 b += 4 1644 1645 xgb.Put32(buf[b:], Screen) 1646 b += 4 1647 1648 xgb.Put32(buf[b:], RenderType) 1649 b += 4 1650 1651 xgb.Put32(buf[b:], uint32(ShareList)) 1652 b += 4 1653 1654 if IsDirect { 1655 buf[b] = 1 1656 } else { 1657 buf[b] = 0 1658 } 1659 b += 1 1660 1661 b += 3 // padding 1662 1663 return buf 1664 } 1665 1666 // CreatePbufferCookie is a cookie used only for CreatePbuffer requests. 1667 type CreatePbufferCookie struct { 1668 *xgb.Cookie 1669 } 1670 1671 // CreatePbuffer sends an unchecked request. 1672 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1673 func CreatePbuffer(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer Pbuffer, NumAttribs uint32, Attribs []uint32) CreatePbufferCookie { 1674 c.ExtLock.RLock() 1675 defer c.ExtLock.RUnlock() 1676 if _, ok := c.Extensions["GLX"]; !ok { 1677 panic("Cannot issue request 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1678 } 1679 cookie := c.NewCookie(false, false) 1680 c.NewRequest(createPbufferRequest(c, Screen, Fbconfig, Pbuffer, NumAttribs, Attribs), cookie) 1681 return CreatePbufferCookie{cookie} 1682 } 1683 1684 // CreatePbufferChecked sends a checked request. 1685 // If an error occurs, it can be retrieved using CreatePbufferCookie.Check() 1686 func CreatePbufferChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer Pbuffer, NumAttribs uint32, Attribs []uint32) CreatePbufferCookie { 1687 c.ExtLock.RLock() 1688 defer c.ExtLock.RUnlock() 1689 if _, ok := c.Extensions["GLX"]; !ok { 1690 panic("Cannot issue request 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1691 } 1692 cookie := c.NewCookie(true, false) 1693 c.NewRequest(createPbufferRequest(c, Screen, Fbconfig, Pbuffer, NumAttribs, Attribs), cookie) 1694 return CreatePbufferCookie{cookie} 1695 } 1696 1697 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1698 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1699 func (cook CreatePbufferCookie) Check() error { 1700 return cook.Cookie.Check() 1701 } 1702 1703 // Write request to wire for CreatePbuffer 1704 // createPbufferRequest writes a CreatePbuffer request to a byte slice. 1705 func createPbufferRequest(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer Pbuffer, NumAttribs uint32, Attribs []uint32) []byte { 1706 size := xgb.Pad((20 + xgb.Pad(((int(NumAttribs) * 2) * 4)))) 1707 b := 0 1708 buf := make([]byte, size) 1709 1710 c.ExtLock.RLock() 1711 buf[b] = c.Extensions["GLX"] 1712 c.ExtLock.RUnlock() 1713 b += 1 1714 1715 buf[b] = 27 // request opcode 1716 b += 1 1717 1718 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1719 b += 2 1720 1721 xgb.Put32(buf[b:], Screen) 1722 b += 4 1723 1724 xgb.Put32(buf[b:], uint32(Fbconfig)) 1725 b += 4 1726 1727 xgb.Put32(buf[b:], uint32(Pbuffer)) 1728 b += 4 1729 1730 xgb.Put32(buf[b:], NumAttribs) 1731 b += 4 1732 1733 for i := 0; i < int((int(NumAttribs) * 2)); i++ { 1734 xgb.Put32(buf[b:], Attribs[i]) 1735 b += 4 1736 } 1737 1738 return buf 1739 } 1740 1741 // CreatePixmapCookie is a cookie used only for CreatePixmap requests. 1742 type CreatePixmapCookie struct { 1743 *xgb.Cookie 1744 } 1745 1746 // CreatePixmap sends an unchecked request. 1747 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1748 func CreatePixmap(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) CreatePixmapCookie { 1749 c.ExtLock.RLock() 1750 defer c.ExtLock.RUnlock() 1751 if _, ok := c.Extensions["GLX"]; !ok { 1752 panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1753 } 1754 cookie := c.NewCookie(false, false) 1755 c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie) 1756 return CreatePixmapCookie{cookie} 1757 } 1758 1759 // CreatePixmapChecked sends a checked request. 1760 // If an error occurs, it can be retrieved using CreatePixmapCookie.Check() 1761 func CreatePixmapChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) CreatePixmapCookie { 1762 c.ExtLock.RLock() 1763 defer c.ExtLock.RUnlock() 1764 if _, ok := c.Extensions["GLX"]; !ok { 1765 panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1766 } 1767 cookie := c.NewCookie(true, false) 1768 c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie) 1769 return CreatePixmapCookie{cookie} 1770 } 1771 1772 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1773 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1774 func (cook CreatePixmapCookie) Check() error { 1775 return cook.Cookie.Check() 1776 } 1777 1778 // Write request to wire for CreatePixmap 1779 // createPixmapRequest writes a CreatePixmap request to a byte slice. 1780 func createPixmapRequest(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) []byte { 1781 size := xgb.Pad((24 + xgb.Pad(((int(NumAttribs) * 2) * 4)))) 1782 b := 0 1783 buf := make([]byte, size) 1784 1785 c.ExtLock.RLock() 1786 buf[b] = c.Extensions["GLX"] 1787 c.ExtLock.RUnlock() 1788 b += 1 1789 1790 buf[b] = 22 // request opcode 1791 b += 1 1792 1793 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1794 b += 2 1795 1796 xgb.Put32(buf[b:], Screen) 1797 b += 4 1798 1799 xgb.Put32(buf[b:], uint32(Fbconfig)) 1800 b += 4 1801 1802 xgb.Put32(buf[b:], uint32(Pixmap)) 1803 b += 4 1804 1805 xgb.Put32(buf[b:], uint32(GlxPixmap)) 1806 b += 4 1807 1808 xgb.Put32(buf[b:], NumAttribs) 1809 b += 4 1810 1811 for i := 0; i < int((int(NumAttribs) * 2)); i++ { 1812 xgb.Put32(buf[b:], Attribs[i]) 1813 b += 4 1814 } 1815 1816 return buf 1817 } 1818 1819 // CreateWindowCookie is a cookie used only for CreateWindow requests. 1820 type CreateWindowCookie struct { 1821 *xgb.Cookie 1822 } 1823 1824 // CreateWindow sends an unchecked request. 1825 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1826 func CreateWindow(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window xproto.Window, GlxWindow Window, NumAttribs uint32, Attribs []uint32) CreateWindowCookie { 1827 c.ExtLock.RLock() 1828 defer c.ExtLock.RUnlock() 1829 if _, ok := c.Extensions["GLX"]; !ok { 1830 panic("Cannot issue request 'CreateWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1831 } 1832 cookie := c.NewCookie(false, false) 1833 c.NewRequest(createWindowRequest(c, Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie) 1834 return CreateWindowCookie{cookie} 1835 } 1836 1837 // CreateWindowChecked sends a checked request. 1838 // If an error occurs, it can be retrieved using CreateWindowCookie.Check() 1839 func CreateWindowChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window xproto.Window, GlxWindow Window, NumAttribs uint32, Attribs []uint32) CreateWindowCookie { 1840 c.ExtLock.RLock() 1841 defer c.ExtLock.RUnlock() 1842 if _, ok := c.Extensions["GLX"]; !ok { 1843 panic("Cannot issue request 'CreateWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1844 } 1845 cookie := c.NewCookie(true, false) 1846 c.NewRequest(createWindowRequest(c, Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie) 1847 return CreateWindowCookie{cookie} 1848 } 1849 1850 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1851 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1852 func (cook CreateWindowCookie) Check() error { 1853 return cook.Cookie.Check() 1854 } 1855 1856 // Write request to wire for CreateWindow 1857 // createWindowRequest writes a CreateWindow request to a byte slice. 1858 func createWindowRequest(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window xproto.Window, GlxWindow Window, NumAttribs uint32, Attribs []uint32) []byte { 1859 size := xgb.Pad((24 + xgb.Pad(((int(NumAttribs) * 2) * 4)))) 1860 b := 0 1861 buf := make([]byte, size) 1862 1863 c.ExtLock.RLock() 1864 buf[b] = c.Extensions["GLX"] 1865 c.ExtLock.RUnlock() 1866 b += 1 1867 1868 buf[b] = 31 // request opcode 1869 b += 1 1870 1871 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1872 b += 2 1873 1874 xgb.Put32(buf[b:], Screen) 1875 b += 4 1876 1877 xgb.Put32(buf[b:], uint32(Fbconfig)) 1878 b += 4 1879 1880 xgb.Put32(buf[b:], uint32(Window)) 1881 b += 4 1882 1883 xgb.Put32(buf[b:], uint32(GlxWindow)) 1884 b += 4 1885 1886 xgb.Put32(buf[b:], NumAttribs) 1887 b += 4 1888 1889 for i := 0; i < int((int(NumAttribs) * 2)); i++ { 1890 xgb.Put32(buf[b:], Attribs[i]) 1891 b += 4 1892 } 1893 1894 return buf 1895 } 1896 1897 // DeleteListsCookie is a cookie used only for DeleteLists requests. 1898 type DeleteListsCookie struct { 1899 *xgb.Cookie 1900 } 1901 1902 // DeleteLists sends an unchecked request. 1903 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1904 func DeleteLists(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) DeleteListsCookie { 1905 c.ExtLock.RLock() 1906 defer c.ExtLock.RUnlock() 1907 if _, ok := c.Extensions["GLX"]; !ok { 1908 panic("Cannot issue request 'DeleteLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1909 } 1910 cookie := c.NewCookie(false, false) 1911 c.NewRequest(deleteListsRequest(c, ContextTag, List, Range), cookie) 1912 return DeleteListsCookie{cookie} 1913 } 1914 1915 // DeleteListsChecked sends a checked request. 1916 // If an error occurs, it can be retrieved using DeleteListsCookie.Check() 1917 func DeleteListsChecked(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) DeleteListsCookie { 1918 c.ExtLock.RLock() 1919 defer c.ExtLock.RUnlock() 1920 if _, ok := c.Extensions["GLX"]; !ok { 1921 panic("Cannot issue request 'DeleteLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1922 } 1923 cookie := c.NewCookie(true, false) 1924 c.NewRequest(deleteListsRequest(c, ContextTag, List, Range), cookie) 1925 return DeleteListsCookie{cookie} 1926 } 1927 1928 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1929 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1930 func (cook DeleteListsCookie) Check() error { 1931 return cook.Cookie.Check() 1932 } 1933 1934 // Write request to wire for DeleteLists 1935 // deleteListsRequest writes a DeleteLists request to a byte slice. 1936 func deleteListsRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) []byte { 1937 size := 16 1938 b := 0 1939 buf := make([]byte, size) 1940 1941 c.ExtLock.RLock() 1942 buf[b] = c.Extensions["GLX"] 1943 c.ExtLock.RUnlock() 1944 b += 1 1945 1946 buf[b] = 103 // request opcode 1947 b += 1 1948 1949 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 1950 b += 2 1951 1952 xgb.Put32(buf[b:], uint32(ContextTag)) 1953 b += 4 1954 1955 xgb.Put32(buf[b:], List) 1956 b += 4 1957 1958 xgb.Put32(buf[b:], uint32(Range)) 1959 b += 4 1960 1961 return buf 1962 } 1963 1964 // DeleteQueriesARBCookie is a cookie used only for DeleteQueriesARB requests. 1965 type DeleteQueriesARBCookie struct { 1966 *xgb.Cookie 1967 } 1968 1969 // DeleteQueriesARB sends an unchecked request. 1970 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 1971 func DeleteQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) DeleteQueriesARBCookie { 1972 c.ExtLock.RLock() 1973 defer c.ExtLock.RUnlock() 1974 if _, ok := c.Extensions["GLX"]; !ok { 1975 panic("Cannot issue request 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1976 } 1977 cookie := c.NewCookie(false, false) 1978 c.NewRequest(deleteQueriesARBRequest(c, ContextTag, N, Ids), cookie) 1979 return DeleteQueriesARBCookie{cookie} 1980 } 1981 1982 // DeleteQueriesARBChecked sends a checked request. 1983 // If an error occurs, it can be retrieved using DeleteQueriesARBCookie.Check() 1984 func DeleteQueriesARBChecked(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) DeleteQueriesARBCookie { 1985 c.ExtLock.RLock() 1986 defer c.ExtLock.RUnlock() 1987 if _, ok := c.Extensions["GLX"]; !ok { 1988 panic("Cannot issue request 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 1989 } 1990 cookie := c.NewCookie(true, false) 1991 c.NewRequest(deleteQueriesARBRequest(c, ContextTag, N, Ids), cookie) 1992 return DeleteQueriesARBCookie{cookie} 1993 } 1994 1995 // Check returns an error if one occurred for checked requests that are not expecting a reply. 1996 // This cannot be called for requests expecting a reply, nor for unchecked requests. 1997 func (cook DeleteQueriesARBCookie) Check() error { 1998 return cook.Cookie.Check() 1999 } 2000 2001 // Write request to wire for DeleteQueriesARB 2002 // deleteQueriesARBRequest writes a DeleteQueriesARB request to a byte slice. 2003 func deleteQueriesARBRequest(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) []byte { 2004 size := xgb.Pad((12 + xgb.Pad((int(N) * 4)))) 2005 b := 0 2006 buf := make([]byte, size) 2007 2008 c.ExtLock.RLock() 2009 buf[b] = c.Extensions["GLX"] 2010 c.ExtLock.RUnlock() 2011 b += 1 2012 2013 buf[b] = 161 // request opcode 2014 b += 1 2015 2016 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2017 b += 2 2018 2019 xgb.Put32(buf[b:], uint32(ContextTag)) 2020 b += 4 2021 2022 xgb.Put32(buf[b:], uint32(N)) 2023 b += 4 2024 2025 for i := 0; i < int(N); i++ { 2026 xgb.Put32(buf[b:], Ids[i]) 2027 b += 4 2028 } 2029 2030 return buf 2031 } 2032 2033 // DeleteTexturesCookie is a cookie used only for DeleteTextures requests. 2034 type DeleteTexturesCookie struct { 2035 *xgb.Cookie 2036 } 2037 2038 // DeleteTextures sends an unchecked request. 2039 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2040 func DeleteTextures(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie { 2041 c.ExtLock.RLock() 2042 defer c.ExtLock.RUnlock() 2043 if _, ok := c.Extensions["GLX"]; !ok { 2044 panic("Cannot issue request 'DeleteTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2045 } 2046 cookie := c.NewCookie(false, false) 2047 c.NewRequest(deleteTexturesRequest(c, ContextTag, N, Textures), cookie) 2048 return DeleteTexturesCookie{cookie} 2049 } 2050 2051 // DeleteTexturesChecked sends a checked request. 2052 // If an error occurs, it can be retrieved using DeleteTexturesCookie.Check() 2053 func DeleteTexturesChecked(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie { 2054 c.ExtLock.RLock() 2055 defer c.ExtLock.RUnlock() 2056 if _, ok := c.Extensions["GLX"]; !ok { 2057 panic("Cannot issue request 'DeleteTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2058 } 2059 cookie := c.NewCookie(true, false) 2060 c.NewRequest(deleteTexturesRequest(c, ContextTag, N, Textures), cookie) 2061 return DeleteTexturesCookie{cookie} 2062 } 2063 2064 // Check returns an error if one occurred for checked requests that are not expecting a reply. 2065 // This cannot be called for requests expecting a reply, nor for unchecked requests. 2066 func (cook DeleteTexturesCookie) Check() error { 2067 return cook.Cookie.Check() 2068 } 2069 2070 // Write request to wire for DeleteTextures 2071 // deleteTexturesRequest writes a DeleteTextures request to a byte slice. 2072 func deleteTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) []byte { 2073 size := xgb.Pad((12 + xgb.Pad((int(N) * 4)))) 2074 b := 0 2075 buf := make([]byte, size) 2076 2077 c.ExtLock.RLock() 2078 buf[b] = c.Extensions["GLX"] 2079 c.ExtLock.RUnlock() 2080 b += 1 2081 2082 buf[b] = 144 // request opcode 2083 b += 1 2084 2085 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2086 b += 2 2087 2088 xgb.Put32(buf[b:], uint32(ContextTag)) 2089 b += 4 2090 2091 xgb.Put32(buf[b:], uint32(N)) 2092 b += 4 2093 2094 for i := 0; i < int(N); i++ { 2095 xgb.Put32(buf[b:], Textures[i]) 2096 b += 4 2097 } 2098 2099 return buf 2100 } 2101 2102 // DeleteWindowCookie is a cookie used only for DeleteWindow requests. 2103 type DeleteWindowCookie struct { 2104 *xgb.Cookie 2105 } 2106 2107 // DeleteWindow sends an unchecked request. 2108 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2109 func DeleteWindow(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie { 2110 c.ExtLock.RLock() 2111 defer c.ExtLock.RUnlock() 2112 if _, ok := c.Extensions["GLX"]; !ok { 2113 panic("Cannot issue request 'DeleteWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2114 } 2115 cookie := c.NewCookie(false, false) 2116 c.NewRequest(deleteWindowRequest(c, Glxwindow), cookie) 2117 return DeleteWindowCookie{cookie} 2118 } 2119 2120 // DeleteWindowChecked sends a checked request. 2121 // If an error occurs, it can be retrieved using DeleteWindowCookie.Check() 2122 func DeleteWindowChecked(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie { 2123 c.ExtLock.RLock() 2124 defer c.ExtLock.RUnlock() 2125 if _, ok := c.Extensions["GLX"]; !ok { 2126 panic("Cannot issue request 'DeleteWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2127 } 2128 cookie := c.NewCookie(true, false) 2129 c.NewRequest(deleteWindowRequest(c, Glxwindow), cookie) 2130 return DeleteWindowCookie{cookie} 2131 } 2132 2133 // Check returns an error if one occurred for checked requests that are not expecting a reply. 2134 // This cannot be called for requests expecting a reply, nor for unchecked requests. 2135 func (cook DeleteWindowCookie) Check() error { 2136 return cook.Cookie.Check() 2137 } 2138 2139 // Write request to wire for DeleteWindow 2140 // deleteWindowRequest writes a DeleteWindow request to a byte slice. 2141 func deleteWindowRequest(c *xgb.Conn, Glxwindow Window) []byte { 2142 size := 8 2143 b := 0 2144 buf := make([]byte, size) 2145 2146 c.ExtLock.RLock() 2147 buf[b] = c.Extensions["GLX"] 2148 c.ExtLock.RUnlock() 2149 b += 1 2150 2151 buf[b] = 32 // request opcode 2152 b += 1 2153 2154 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2155 b += 2 2156 2157 xgb.Put32(buf[b:], uint32(Glxwindow)) 2158 b += 4 2159 2160 return buf 2161 } 2162 2163 // DestroyContextCookie is a cookie used only for DestroyContext requests. 2164 type DestroyContextCookie struct { 2165 *xgb.Cookie 2166 } 2167 2168 // DestroyContext sends an unchecked request. 2169 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2170 func DestroyContext(c *xgb.Conn, Context Context) DestroyContextCookie { 2171 c.ExtLock.RLock() 2172 defer c.ExtLock.RUnlock() 2173 if _, ok := c.Extensions["GLX"]; !ok { 2174 panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2175 } 2176 cookie := c.NewCookie(false, false) 2177 c.NewRequest(destroyContextRequest(c, Context), cookie) 2178 return DestroyContextCookie{cookie} 2179 } 2180 2181 // DestroyContextChecked sends a checked request. 2182 // If an error occurs, it can be retrieved using DestroyContextCookie.Check() 2183 func DestroyContextChecked(c *xgb.Conn, Context Context) DestroyContextCookie { 2184 c.ExtLock.RLock() 2185 defer c.ExtLock.RUnlock() 2186 if _, ok := c.Extensions["GLX"]; !ok { 2187 panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2188 } 2189 cookie := c.NewCookie(true, false) 2190 c.NewRequest(destroyContextRequest(c, Context), cookie) 2191 return DestroyContextCookie{cookie} 2192 } 2193 2194 // Check returns an error if one occurred for checked requests that are not expecting a reply. 2195 // This cannot be called for requests expecting a reply, nor for unchecked requests. 2196 func (cook DestroyContextCookie) Check() error { 2197 return cook.Cookie.Check() 2198 } 2199 2200 // Write request to wire for DestroyContext 2201 // destroyContextRequest writes a DestroyContext request to a byte slice. 2202 func destroyContextRequest(c *xgb.Conn, Context Context) []byte { 2203 size := 8 2204 b := 0 2205 buf := make([]byte, size) 2206 2207 c.ExtLock.RLock() 2208 buf[b] = c.Extensions["GLX"] 2209 c.ExtLock.RUnlock() 2210 b += 1 2211 2212 buf[b] = 4 // request opcode 2213 b += 1 2214 2215 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2216 b += 2 2217 2218 xgb.Put32(buf[b:], uint32(Context)) 2219 b += 4 2220 2221 return buf 2222 } 2223 2224 // DestroyGLXPixmapCookie is a cookie used only for DestroyGLXPixmap requests. 2225 type DestroyGLXPixmapCookie struct { 2226 *xgb.Cookie 2227 } 2228 2229 // DestroyGLXPixmap sends an unchecked request. 2230 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2231 func DestroyGLXPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie { 2232 c.ExtLock.RLock() 2233 defer c.ExtLock.RUnlock() 2234 if _, ok := c.Extensions["GLX"]; !ok { 2235 panic("Cannot issue request 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2236 } 2237 cookie := c.NewCookie(false, false) 2238 c.NewRequest(destroyGLXPixmapRequest(c, GlxPixmap), cookie) 2239 return DestroyGLXPixmapCookie{cookie} 2240 } 2241 2242 // DestroyGLXPixmapChecked sends a checked request. 2243 // If an error occurs, it can be retrieved using DestroyGLXPixmapCookie.Check() 2244 func DestroyGLXPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie { 2245 c.ExtLock.RLock() 2246 defer c.ExtLock.RUnlock() 2247 if _, ok := c.Extensions["GLX"]; !ok { 2248 panic("Cannot issue request 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2249 } 2250 cookie := c.NewCookie(true, false) 2251 c.NewRequest(destroyGLXPixmapRequest(c, GlxPixmap), cookie) 2252 return DestroyGLXPixmapCookie{cookie} 2253 } 2254 2255 // Check returns an error if one occurred for checked requests that are not expecting a reply. 2256 // This cannot be called for requests expecting a reply, nor for unchecked requests. 2257 func (cook DestroyGLXPixmapCookie) Check() error { 2258 return cook.Cookie.Check() 2259 } 2260 2261 // Write request to wire for DestroyGLXPixmap 2262 // destroyGLXPixmapRequest writes a DestroyGLXPixmap request to a byte slice. 2263 func destroyGLXPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte { 2264 size := 8 2265 b := 0 2266 buf := make([]byte, size) 2267 2268 c.ExtLock.RLock() 2269 buf[b] = c.Extensions["GLX"] 2270 c.ExtLock.RUnlock() 2271 b += 1 2272 2273 buf[b] = 15 // request opcode 2274 b += 1 2275 2276 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2277 b += 2 2278 2279 xgb.Put32(buf[b:], uint32(GlxPixmap)) 2280 b += 4 2281 2282 return buf 2283 } 2284 2285 // DestroyPbufferCookie is a cookie used only for DestroyPbuffer requests. 2286 type DestroyPbufferCookie struct { 2287 *xgb.Cookie 2288 } 2289 2290 // DestroyPbuffer sends an unchecked request. 2291 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2292 func DestroyPbuffer(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie { 2293 c.ExtLock.RLock() 2294 defer c.ExtLock.RUnlock() 2295 if _, ok := c.Extensions["GLX"]; !ok { 2296 panic("Cannot issue request 'DestroyPbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2297 } 2298 cookie := c.NewCookie(false, false) 2299 c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie) 2300 return DestroyPbufferCookie{cookie} 2301 } 2302 2303 // DestroyPbufferChecked sends a checked request. 2304 // If an error occurs, it can be retrieved using DestroyPbufferCookie.Check() 2305 func DestroyPbufferChecked(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie { 2306 c.ExtLock.RLock() 2307 defer c.ExtLock.RUnlock() 2308 if _, ok := c.Extensions["GLX"]; !ok { 2309 panic("Cannot issue request 'DestroyPbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2310 } 2311 cookie := c.NewCookie(true, false) 2312 c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie) 2313 return DestroyPbufferCookie{cookie} 2314 } 2315 2316 // Check returns an error if one occurred for checked requests that are not expecting a reply. 2317 // This cannot be called for requests expecting a reply, nor for unchecked requests. 2318 func (cook DestroyPbufferCookie) Check() error { 2319 return cook.Cookie.Check() 2320 } 2321 2322 // Write request to wire for DestroyPbuffer 2323 // destroyPbufferRequest writes a DestroyPbuffer request to a byte slice. 2324 func destroyPbufferRequest(c *xgb.Conn, Pbuffer Pbuffer) []byte { 2325 size := 8 2326 b := 0 2327 buf := make([]byte, size) 2328 2329 c.ExtLock.RLock() 2330 buf[b] = c.Extensions["GLX"] 2331 c.ExtLock.RUnlock() 2332 b += 1 2333 2334 buf[b] = 28 // request opcode 2335 b += 1 2336 2337 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2338 b += 2 2339 2340 xgb.Put32(buf[b:], uint32(Pbuffer)) 2341 b += 4 2342 2343 return buf 2344 } 2345 2346 // DestroyPixmapCookie is a cookie used only for DestroyPixmap requests. 2347 type DestroyPixmapCookie struct { 2348 *xgb.Cookie 2349 } 2350 2351 // DestroyPixmap sends an unchecked request. 2352 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2353 func DestroyPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie { 2354 c.ExtLock.RLock() 2355 defer c.ExtLock.RUnlock() 2356 if _, ok := c.Extensions["GLX"]; !ok { 2357 panic("Cannot issue request 'DestroyPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2358 } 2359 cookie := c.NewCookie(false, false) 2360 c.NewRequest(destroyPixmapRequest(c, GlxPixmap), cookie) 2361 return DestroyPixmapCookie{cookie} 2362 } 2363 2364 // DestroyPixmapChecked sends a checked request. 2365 // If an error occurs, it can be retrieved using DestroyPixmapCookie.Check() 2366 func DestroyPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie { 2367 c.ExtLock.RLock() 2368 defer c.ExtLock.RUnlock() 2369 if _, ok := c.Extensions["GLX"]; !ok { 2370 panic("Cannot issue request 'DestroyPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2371 } 2372 cookie := c.NewCookie(true, false) 2373 c.NewRequest(destroyPixmapRequest(c, GlxPixmap), cookie) 2374 return DestroyPixmapCookie{cookie} 2375 } 2376 2377 // Check returns an error if one occurred for checked requests that are not expecting a reply. 2378 // This cannot be called for requests expecting a reply, nor for unchecked requests. 2379 func (cook DestroyPixmapCookie) Check() error { 2380 return cook.Cookie.Check() 2381 } 2382 2383 // Write request to wire for DestroyPixmap 2384 // destroyPixmapRequest writes a DestroyPixmap request to a byte slice. 2385 func destroyPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte { 2386 size := 8 2387 b := 0 2388 buf := make([]byte, size) 2389 2390 c.ExtLock.RLock() 2391 buf[b] = c.Extensions["GLX"] 2392 c.ExtLock.RUnlock() 2393 b += 1 2394 2395 buf[b] = 23 // request opcode 2396 b += 1 2397 2398 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2399 b += 2 2400 2401 xgb.Put32(buf[b:], uint32(GlxPixmap)) 2402 b += 4 2403 2404 return buf 2405 } 2406 2407 // EndListCookie is a cookie used only for EndList requests. 2408 type EndListCookie struct { 2409 *xgb.Cookie 2410 } 2411 2412 // EndList sends an unchecked request. 2413 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2414 func EndList(c *xgb.Conn, ContextTag ContextTag) EndListCookie { 2415 c.ExtLock.RLock() 2416 defer c.ExtLock.RUnlock() 2417 if _, ok := c.Extensions["GLX"]; !ok { 2418 panic("Cannot issue request 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2419 } 2420 cookie := c.NewCookie(false, false) 2421 c.NewRequest(endListRequest(c, ContextTag), cookie) 2422 return EndListCookie{cookie} 2423 } 2424 2425 // EndListChecked sends a checked request. 2426 // If an error occurs, it can be retrieved using EndListCookie.Check() 2427 func EndListChecked(c *xgb.Conn, ContextTag ContextTag) EndListCookie { 2428 c.ExtLock.RLock() 2429 defer c.ExtLock.RUnlock() 2430 if _, ok := c.Extensions["GLX"]; !ok { 2431 panic("Cannot issue request 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2432 } 2433 cookie := c.NewCookie(true, false) 2434 c.NewRequest(endListRequest(c, ContextTag), cookie) 2435 return EndListCookie{cookie} 2436 } 2437 2438 // Check returns an error if one occurred for checked requests that are not expecting a reply. 2439 // This cannot be called for requests expecting a reply, nor for unchecked requests. 2440 func (cook EndListCookie) Check() error { 2441 return cook.Cookie.Check() 2442 } 2443 2444 // Write request to wire for EndList 2445 // endListRequest writes a EndList request to a byte slice. 2446 func endListRequest(c *xgb.Conn, ContextTag ContextTag) []byte { 2447 size := 8 2448 b := 0 2449 buf := make([]byte, size) 2450 2451 c.ExtLock.RLock() 2452 buf[b] = c.Extensions["GLX"] 2453 c.ExtLock.RUnlock() 2454 b += 1 2455 2456 buf[b] = 102 // request opcode 2457 b += 1 2458 2459 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2460 b += 2 2461 2462 xgb.Put32(buf[b:], uint32(ContextTag)) 2463 b += 4 2464 2465 return buf 2466 } 2467 2468 // FeedbackBufferCookie is a cookie used only for FeedbackBuffer requests. 2469 type FeedbackBufferCookie struct { 2470 *xgb.Cookie 2471 } 2472 2473 // FeedbackBuffer sends an unchecked request. 2474 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2475 func FeedbackBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32, Type int32) FeedbackBufferCookie { 2476 c.ExtLock.RLock() 2477 defer c.ExtLock.RUnlock() 2478 if _, ok := c.Extensions["GLX"]; !ok { 2479 panic("Cannot issue request 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2480 } 2481 cookie := c.NewCookie(false, false) 2482 c.NewRequest(feedbackBufferRequest(c, ContextTag, Size, Type), cookie) 2483 return FeedbackBufferCookie{cookie} 2484 } 2485 2486 // FeedbackBufferChecked sends a checked request. 2487 // If an error occurs, it can be retrieved using FeedbackBufferCookie.Check() 2488 func FeedbackBufferChecked(c *xgb.Conn, ContextTag ContextTag, Size int32, Type int32) FeedbackBufferCookie { 2489 c.ExtLock.RLock() 2490 defer c.ExtLock.RUnlock() 2491 if _, ok := c.Extensions["GLX"]; !ok { 2492 panic("Cannot issue request 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2493 } 2494 cookie := c.NewCookie(true, false) 2495 c.NewRequest(feedbackBufferRequest(c, ContextTag, Size, Type), cookie) 2496 return FeedbackBufferCookie{cookie} 2497 } 2498 2499 // Check returns an error if one occurred for checked requests that are not expecting a reply. 2500 // This cannot be called for requests expecting a reply, nor for unchecked requests. 2501 func (cook FeedbackBufferCookie) Check() error { 2502 return cook.Cookie.Check() 2503 } 2504 2505 // Write request to wire for FeedbackBuffer 2506 // feedbackBufferRequest writes a FeedbackBuffer request to a byte slice. 2507 func feedbackBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size int32, Type int32) []byte { 2508 size := 16 2509 b := 0 2510 buf := make([]byte, size) 2511 2512 c.ExtLock.RLock() 2513 buf[b] = c.Extensions["GLX"] 2514 c.ExtLock.RUnlock() 2515 b += 1 2516 2517 buf[b] = 105 // request opcode 2518 b += 1 2519 2520 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2521 b += 2 2522 2523 xgb.Put32(buf[b:], uint32(ContextTag)) 2524 b += 4 2525 2526 xgb.Put32(buf[b:], uint32(Size)) 2527 b += 4 2528 2529 xgb.Put32(buf[b:], uint32(Type)) 2530 b += 4 2531 2532 return buf 2533 } 2534 2535 // FinishCookie is a cookie used only for Finish requests. 2536 type FinishCookie struct { 2537 *xgb.Cookie 2538 } 2539 2540 // Finish sends a checked request. 2541 // If an error occurs, it will be returned with the reply by calling FinishCookie.Reply() 2542 func Finish(c *xgb.Conn, ContextTag ContextTag) FinishCookie { 2543 c.ExtLock.RLock() 2544 defer c.ExtLock.RUnlock() 2545 if _, ok := c.Extensions["GLX"]; !ok { 2546 panic("Cannot issue request 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2547 } 2548 cookie := c.NewCookie(true, true) 2549 c.NewRequest(finishRequest(c, ContextTag), cookie) 2550 return FinishCookie{cookie} 2551 } 2552 2553 // FinishUnchecked sends an unchecked request. 2554 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2555 func FinishUnchecked(c *xgb.Conn, ContextTag ContextTag) FinishCookie { 2556 c.ExtLock.RLock() 2557 defer c.ExtLock.RUnlock() 2558 if _, ok := c.Extensions["GLX"]; !ok { 2559 panic("Cannot issue request 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2560 } 2561 cookie := c.NewCookie(false, true) 2562 c.NewRequest(finishRequest(c, ContextTag), cookie) 2563 return FinishCookie{cookie} 2564 } 2565 2566 // FinishReply represents the data returned from a Finish request. 2567 type FinishReply struct { 2568 Sequence uint16 // sequence number of the request for this reply 2569 Length uint32 // number of bytes in this reply 2570 // padding: 1 bytes 2571 } 2572 2573 // Reply blocks and returns the reply data for a Finish request. 2574 func (cook FinishCookie) Reply() (*FinishReply, error) { 2575 buf, err := cook.Cookie.Reply() 2576 if err != nil { 2577 return nil, err 2578 } 2579 if buf == nil { 2580 return nil, nil 2581 } 2582 return finishReply(buf), nil 2583 } 2584 2585 // finishReply reads a byte slice into a FinishReply value. 2586 func finishReply(buf []byte) *FinishReply { 2587 v := new(FinishReply) 2588 b := 1 // skip reply determinant 2589 2590 b += 1 // padding 2591 2592 v.Sequence = xgb.Get16(buf[b:]) 2593 b += 2 2594 2595 v.Length = xgb.Get32(buf[b:]) // 4-byte units 2596 b += 4 2597 2598 return v 2599 } 2600 2601 // Write request to wire for Finish 2602 // finishRequest writes a Finish request to a byte slice. 2603 func finishRequest(c *xgb.Conn, ContextTag ContextTag) []byte { 2604 size := 8 2605 b := 0 2606 buf := make([]byte, size) 2607 2608 c.ExtLock.RLock() 2609 buf[b] = c.Extensions["GLX"] 2610 c.ExtLock.RUnlock() 2611 b += 1 2612 2613 buf[b] = 108 // request opcode 2614 b += 1 2615 2616 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2617 b += 2 2618 2619 xgb.Put32(buf[b:], uint32(ContextTag)) 2620 b += 4 2621 2622 return buf 2623 } 2624 2625 // FlushCookie is a cookie used only for Flush requests. 2626 type FlushCookie struct { 2627 *xgb.Cookie 2628 } 2629 2630 // Flush sends an unchecked request. 2631 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2632 func Flush(c *xgb.Conn, ContextTag ContextTag) FlushCookie { 2633 c.ExtLock.RLock() 2634 defer c.ExtLock.RUnlock() 2635 if _, ok := c.Extensions["GLX"]; !ok { 2636 panic("Cannot issue request 'Flush' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2637 } 2638 cookie := c.NewCookie(false, false) 2639 c.NewRequest(flushRequest(c, ContextTag), cookie) 2640 return FlushCookie{cookie} 2641 } 2642 2643 // FlushChecked sends a checked request. 2644 // If an error occurs, it can be retrieved using FlushCookie.Check() 2645 func FlushChecked(c *xgb.Conn, ContextTag ContextTag) FlushCookie { 2646 c.ExtLock.RLock() 2647 defer c.ExtLock.RUnlock() 2648 if _, ok := c.Extensions["GLX"]; !ok { 2649 panic("Cannot issue request 'Flush' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2650 } 2651 cookie := c.NewCookie(true, false) 2652 c.NewRequest(flushRequest(c, ContextTag), cookie) 2653 return FlushCookie{cookie} 2654 } 2655 2656 // Check returns an error if one occurred for checked requests that are not expecting a reply. 2657 // This cannot be called for requests expecting a reply, nor for unchecked requests. 2658 func (cook FlushCookie) Check() error { 2659 return cook.Cookie.Check() 2660 } 2661 2662 // Write request to wire for Flush 2663 // flushRequest writes a Flush request to a byte slice. 2664 func flushRequest(c *xgb.Conn, ContextTag ContextTag) []byte { 2665 size := 8 2666 b := 0 2667 buf := make([]byte, size) 2668 2669 c.ExtLock.RLock() 2670 buf[b] = c.Extensions["GLX"] 2671 c.ExtLock.RUnlock() 2672 b += 1 2673 2674 buf[b] = 142 // request opcode 2675 b += 1 2676 2677 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2678 b += 2 2679 2680 xgb.Put32(buf[b:], uint32(ContextTag)) 2681 b += 4 2682 2683 return buf 2684 } 2685 2686 // GenListsCookie is a cookie used only for GenLists requests. 2687 type GenListsCookie struct { 2688 *xgb.Cookie 2689 } 2690 2691 // GenLists sends a checked request. 2692 // If an error occurs, it will be returned with the reply by calling GenListsCookie.Reply() 2693 func GenLists(c *xgb.Conn, ContextTag ContextTag, Range int32) GenListsCookie { 2694 c.ExtLock.RLock() 2695 defer c.ExtLock.RUnlock() 2696 if _, ok := c.Extensions["GLX"]; !ok { 2697 panic("Cannot issue request 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2698 } 2699 cookie := c.NewCookie(true, true) 2700 c.NewRequest(genListsRequest(c, ContextTag, Range), cookie) 2701 return GenListsCookie{cookie} 2702 } 2703 2704 // GenListsUnchecked sends an unchecked request. 2705 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2706 func GenListsUnchecked(c *xgb.Conn, ContextTag ContextTag, Range int32) GenListsCookie { 2707 c.ExtLock.RLock() 2708 defer c.ExtLock.RUnlock() 2709 if _, ok := c.Extensions["GLX"]; !ok { 2710 panic("Cannot issue request 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2711 } 2712 cookie := c.NewCookie(false, true) 2713 c.NewRequest(genListsRequest(c, ContextTag, Range), cookie) 2714 return GenListsCookie{cookie} 2715 } 2716 2717 // GenListsReply represents the data returned from a GenLists request. 2718 type GenListsReply struct { 2719 Sequence uint16 // sequence number of the request for this reply 2720 Length uint32 // number of bytes in this reply 2721 // padding: 1 bytes 2722 RetVal uint32 2723 } 2724 2725 // Reply blocks and returns the reply data for a GenLists request. 2726 func (cook GenListsCookie) Reply() (*GenListsReply, error) { 2727 buf, err := cook.Cookie.Reply() 2728 if err != nil { 2729 return nil, err 2730 } 2731 if buf == nil { 2732 return nil, nil 2733 } 2734 return genListsReply(buf), nil 2735 } 2736 2737 // genListsReply reads a byte slice into a GenListsReply value. 2738 func genListsReply(buf []byte) *GenListsReply { 2739 v := new(GenListsReply) 2740 b := 1 // skip reply determinant 2741 2742 b += 1 // padding 2743 2744 v.Sequence = xgb.Get16(buf[b:]) 2745 b += 2 2746 2747 v.Length = xgb.Get32(buf[b:]) // 4-byte units 2748 b += 4 2749 2750 v.RetVal = xgb.Get32(buf[b:]) 2751 b += 4 2752 2753 return v 2754 } 2755 2756 // Write request to wire for GenLists 2757 // genListsRequest writes a GenLists request to a byte slice. 2758 func genListsRequest(c *xgb.Conn, ContextTag ContextTag, Range int32) []byte { 2759 size := 12 2760 b := 0 2761 buf := make([]byte, size) 2762 2763 c.ExtLock.RLock() 2764 buf[b] = c.Extensions["GLX"] 2765 c.ExtLock.RUnlock() 2766 b += 1 2767 2768 buf[b] = 104 // request opcode 2769 b += 1 2770 2771 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2772 b += 2 2773 2774 xgb.Put32(buf[b:], uint32(ContextTag)) 2775 b += 4 2776 2777 xgb.Put32(buf[b:], uint32(Range)) 2778 b += 4 2779 2780 return buf 2781 } 2782 2783 // GenQueriesARBCookie is a cookie used only for GenQueriesARB requests. 2784 type GenQueriesARBCookie struct { 2785 *xgb.Cookie 2786 } 2787 2788 // GenQueriesARB sends a checked request. 2789 // If an error occurs, it will be returned with the reply by calling GenQueriesARBCookie.Reply() 2790 func GenQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32) GenQueriesARBCookie { 2791 c.ExtLock.RLock() 2792 defer c.ExtLock.RUnlock() 2793 if _, ok := c.Extensions["GLX"]; !ok { 2794 panic("Cannot issue request 'GenQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2795 } 2796 cookie := c.NewCookie(true, true) 2797 c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie) 2798 return GenQueriesARBCookie{cookie} 2799 } 2800 2801 // GenQueriesARBUnchecked sends an unchecked request. 2802 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2803 func GenQueriesARBUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32) GenQueriesARBCookie { 2804 c.ExtLock.RLock() 2805 defer c.ExtLock.RUnlock() 2806 if _, ok := c.Extensions["GLX"]; !ok { 2807 panic("Cannot issue request 'GenQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2808 } 2809 cookie := c.NewCookie(false, true) 2810 c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie) 2811 return GenQueriesARBCookie{cookie} 2812 } 2813 2814 // GenQueriesARBReply represents the data returned from a GenQueriesARB request. 2815 type GenQueriesARBReply struct { 2816 Sequence uint16 // sequence number of the request for this reply 2817 Length uint32 // number of bytes in this reply 2818 // padding: 1 bytes 2819 // padding: 24 bytes 2820 Data []uint32 // size: xgb.Pad((int(Length) * 4)) 2821 } 2822 2823 // Reply blocks and returns the reply data for a GenQueriesARB request. 2824 func (cook GenQueriesARBCookie) Reply() (*GenQueriesARBReply, error) { 2825 buf, err := cook.Cookie.Reply() 2826 if err != nil { 2827 return nil, err 2828 } 2829 if buf == nil { 2830 return nil, nil 2831 } 2832 return genQueriesARBReply(buf), nil 2833 } 2834 2835 // genQueriesARBReply reads a byte slice into a GenQueriesARBReply value. 2836 func genQueriesARBReply(buf []byte) *GenQueriesARBReply { 2837 v := new(GenQueriesARBReply) 2838 b := 1 // skip reply determinant 2839 2840 b += 1 // padding 2841 2842 v.Sequence = xgb.Get16(buf[b:]) 2843 b += 2 2844 2845 v.Length = xgb.Get32(buf[b:]) // 4-byte units 2846 b += 4 2847 2848 b += 24 // padding 2849 2850 v.Data = make([]uint32, v.Length) 2851 for i := 0; i < int(v.Length); i++ { 2852 v.Data[i] = xgb.Get32(buf[b:]) 2853 b += 4 2854 } 2855 2856 return v 2857 } 2858 2859 // Write request to wire for GenQueriesARB 2860 // genQueriesARBRequest writes a GenQueriesARB request to a byte slice. 2861 func genQueriesARBRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte { 2862 size := 12 2863 b := 0 2864 buf := make([]byte, size) 2865 2866 c.ExtLock.RLock() 2867 buf[b] = c.Extensions["GLX"] 2868 c.ExtLock.RUnlock() 2869 b += 1 2870 2871 buf[b] = 162 // request opcode 2872 b += 1 2873 2874 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2875 b += 2 2876 2877 xgb.Put32(buf[b:], uint32(ContextTag)) 2878 b += 4 2879 2880 xgb.Put32(buf[b:], uint32(N)) 2881 b += 4 2882 2883 return buf 2884 } 2885 2886 // GenTexturesCookie is a cookie used only for GenTextures requests. 2887 type GenTexturesCookie struct { 2888 *xgb.Cookie 2889 } 2890 2891 // GenTextures sends a checked request. 2892 // If an error occurs, it will be returned with the reply by calling GenTexturesCookie.Reply() 2893 func GenTextures(c *xgb.Conn, ContextTag ContextTag, N int32) GenTexturesCookie { 2894 c.ExtLock.RLock() 2895 defer c.ExtLock.RUnlock() 2896 if _, ok := c.Extensions["GLX"]; !ok { 2897 panic("Cannot issue request 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2898 } 2899 cookie := c.NewCookie(true, true) 2900 c.NewRequest(genTexturesRequest(c, ContextTag, N), cookie) 2901 return GenTexturesCookie{cookie} 2902 } 2903 2904 // GenTexturesUnchecked sends an unchecked request. 2905 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 2906 func GenTexturesUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32) GenTexturesCookie { 2907 c.ExtLock.RLock() 2908 defer c.ExtLock.RUnlock() 2909 if _, ok := c.Extensions["GLX"]; !ok { 2910 panic("Cannot issue request 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 2911 } 2912 cookie := c.NewCookie(false, true) 2913 c.NewRequest(genTexturesRequest(c, ContextTag, N), cookie) 2914 return GenTexturesCookie{cookie} 2915 } 2916 2917 // GenTexturesReply represents the data returned from a GenTextures request. 2918 type GenTexturesReply struct { 2919 Sequence uint16 // sequence number of the request for this reply 2920 Length uint32 // number of bytes in this reply 2921 // padding: 1 bytes 2922 // padding: 24 bytes 2923 Data []uint32 // size: xgb.Pad((int(Length) * 4)) 2924 } 2925 2926 // Reply blocks and returns the reply data for a GenTextures request. 2927 func (cook GenTexturesCookie) Reply() (*GenTexturesReply, error) { 2928 buf, err := cook.Cookie.Reply() 2929 if err != nil { 2930 return nil, err 2931 } 2932 if buf == nil { 2933 return nil, nil 2934 } 2935 return genTexturesReply(buf), nil 2936 } 2937 2938 // genTexturesReply reads a byte slice into a GenTexturesReply value. 2939 func genTexturesReply(buf []byte) *GenTexturesReply { 2940 v := new(GenTexturesReply) 2941 b := 1 // skip reply determinant 2942 2943 b += 1 // padding 2944 2945 v.Sequence = xgb.Get16(buf[b:]) 2946 b += 2 2947 2948 v.Length = xgb.Get32(buf[b:]) // 4-byte units 2949 b += 4 2950 2951 b += 24 // padding 2952 2953 v.Data = make([]uint32, v.Length) 2954 for i := 0; i < int(v.Length); i++ { 2955 v.Data[i] = xgb.Get32(buf[b:]) 2956 b += 4 2957 } 2958 2959 return v 2960 } 2961 2962 // Write request to wire for GenTextures 2963 // genTexturesRequest writes a GenTextures request to a byte slice. 2964 func genTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte { 2965 size := 12 2966 b := 0 2967 buf := make([]byte, size) 2968 2969 c.ExtLock.RLock() 2970 buf[b] = c.Extensions["GLX"] 2971 c.ExtLock.RUnlock() 2972 b += 1 2973 2974 buf[b] = 145 // request opcode 2975 b += 1 2976 2977 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 2978 b += 2 2979 2980 xgb.Put32(buf[b:], uint32(ContextTag)) 2981 b += 4 2982 2983 xgb.Put32(buf[b:], uint32(N)) 2984 b += 4 2985 2986 return buf 2987 } 2988 2989 // GetBooleanvCookie is a cookie used only for GetBooleanv requests. 2990 type GetBooleanvCookie struct { 2991 *xgb.Cookie 2992 } 2993 2994 // GetBooleanv sends a checked request. 2995 // If an error occurs, it will be returned with the reply by calling GetBooleanvCookie.Reply() 2996 func GetBooleanv(c *xgb.Conn, ContextTag ContextTag, Pname int32) GetBooleanvCookie { 2997 c.ExtLock.RLock() 2998 defer c.ExtLock.RUnlock() 2999 if _, ok := c.Extensions["GLX"]; !ok { 3000 panic("Cannot issue request 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3001 } 3002 cookie := c.NewCookie(true, true) 3003 c.NewRequest(getBooleanvRequest(c, ContextTag, Pname), cookie) 3004 return GetBooleanvCookie{cookie} 3005 } 3006 3007 // GetBooleanvUnchecked sends an unchecked request. 3008 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 3009 func GetBooleanvUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname int32) GetBooleanvCookie { 3010 c.ExtLock.RLock() 3011 defer c.ExtLock.RUnlock() 3012 if _, ok := c.Extensions["GLX"]; !ok { 3013 panic("Cannot issue request 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3014 } 3015 cookie := c.NewCookie(false, true) 3016 c.NewRequest(getBooleanvRequest(c, ContextTag, Pname), cookie) 3017 return GetBooleanvCookie{cookie} 3018 } 3019 3020 // GetBooleanvReply represents the data returned from a GetBooleanv request. 3021 type GetBooleanvReply struct { 3022 Sequence uint16 // sequence number of the request for this reply 3023 Length uint32 // number of bytes in this reply 3024 // padding: 1 bytes 3025 // padding: 4 bytes 3026 N uint32 3027 Datum bool 3028 // padding: 15 bytes 3029 Data []bool // size: xgb.Pad((int(N) * 1)) 3030 } 3031 3032 // Reply blocks and returns the reply data for a GetBooleanv request. 3033 func (cook GetBooleanvCookie) Reply() (*GetBooleanvReply, error) { 3034 buf, err := cook.Cookie.Reply() 3035 if err != nil { 3036 return nil, err 3037 } 3038 if buf == nil { 3039 return nil, nil 3040 } 3041 return getBooleanvReply(buf), nil 3042 } 3043 3044 // getBooleanvReply reads a byte slice into a GetBooleanvReply value. 3045 func getBooleanvReply(buf []byte) *GetBooleanvReply { 3046 v := new(GetBooleanvReply) 3047 b := 1 // skip reply determinant 3048 3049 b += 1 // padding 3050 3051 v.Sequence = xgb.Get16(buf[b:]) 3052 b += 2 3053 3054 v.Length = xgb.Get32(buf[b:]) // 4-byte units 3055 b += 4 3056 3057 b += 4 // padding 3058 3059 v.N = xgb.Get32(buf[b:]) 3060 b += 4 3061 3062 if buf[b] == 1 { 3063 v.Datum = true 3064 } else { 3065 v.Datum = false 3066 } 3067 b += 1 3068 3069 b += 15 // padding 3070 3071 v.Data = make([]bool, v.N) 3072 for i := 0; i < int(v.N); i++ { 3073 if buf[b] == 1 { 3074 v.Data[i] = true 3075 } else { 3076 v.Data[i] = false 3077 } 3078 b += 1 3079 } 3080 3081 return v 3082 } 3083 3084 // Write request to wire for GetBooleanv 3085 // getBooleanvRequest writes a GetBooleanv request to a byte slice. 3086 func getBooleanvRequest(c *xgb.Conn, ContextTag ContextTag, Pname int32) []byte { 3087 size := 12 3088 b := 0 3089 buf := make([]byte, size) 3090 3091 c.ExtLock.RLock() 3092 buf[b] = c.Extensions["GLX"] 3093 c.ExtLock.RUnlock() 3094 b += 1 3095 3096 buf[b] = 112 // request opcode 3097 b += 1 3098 3099 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 3100 b += 2 3101 3102 xgb.Put32(buf[b:], uint32(ContextTag)) 3103 b += 4 3104 3105 xgb.Put32(buf[b:], uint32(Pname)) 3106 b += 4 3107 3108 return buf 3109 } 3110 3111 // GetClipPlaneCookie is a cookie used only for GetClipPlane requests. 3112 type GetClipPlaneCookie struct { 3113 *xgb.Cookie 3114 } 3115 3116 // GetClipPlane sends a checked request. 3117 // If an error occurs, it will be returned with the reply by calling GetClipPlaneCookie.Reply() 3118 func GetClipPlane(c *xgb.Conn, ContextTag ContextTag, Plane int32) GetClipPlaneCookie { 3119 c.ExtLock.RLock() 3120 defer c.ExtLock.RUnlock() 3121 if _, ok := c.Extensions["GLX"]; !ok { 3122 panic("Cannot issue request 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3123 } 3124 cookie := c.NewCookie(true, true) 3125 c.NewRequest(getClipPlaneRequest(c, ContextTag, Plane), cookie) 3126 return GetClipPlaneCookie{cookie} 3127 } 3128 3129 // GetClipPlaneUnchecked sends an unchecked request. 3130 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 3131 func GetClipPlaneUnchecked(c *xgb.Conn, ContextTag ContextTag, Plane int32) GetClipPlaneCookie { 3132 c.ExtLock.RLock() 3133 defer c.ExtLock.RUnlock() 3134 if _, ok := c.Extensions["GLX"]; !ok { 3135 panic("Cannot issue request 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3136 } 3137 cookie := c.NewCookie(false, true) 3138 c.NewRequest(getClipPlaneRequest(c, ContextTag, Plane), cookie) 3139 return GetClipPlaneCookie{cookie} 3140 } 3141 3142 // GetClipPlaneReply represents the data returned from a GetClipPlane request. 3143 type GetClipPlaneReply struct { 3144 Sequence uint16 // sequence number of the request for this reply 3145 Length uint32 // number of bytes in this reply 3146 // padding: 1 bytes 3147 // padding: 24 bytes 3148 Data []Float64 // size: xgb.Pad(((int(Length) / 2) * 8)) 3149 } 3150 3151 // Reply blocks and returns the reply data for a GetClipPlane request. 3152 func (cook GetClipPlaneCookie) Reply() (*GetClipPlaneReply, error) { 3153 buf, err := cook.Cookie.Reply() 3154 if err != nil { 3155 return nil, err 3156 } 3157 if buf == nil { 3158 return nil, nil 3159 } 3160 return getClipPlaneReply(buf), nil 3161 } 3162 3163 // getClipPlaneReply reads a byte slice into a GetClipPlaneReply value. 3164 func getClipPlaneReply(buf []byte) *GetClipPlaneReply { 3165 v := new(GetClipPlaneReply) 3166 b := 1 // skip reply determinant 3167 3168 b += 1 // padding 3169 3170 v.Sequence = xgb.Get16(buf[b:]) 3171 b += 2 3172 3173 v.Length = xgb.Get32(buf[b:]) // 4-byte units 3174 b += 4 3175 3176 b += 24 // padding 3177 3178 v.Data = make([]Float64, (int(v.Length) / 2)) 3179 for i := 0; i < int((int(v.Length) / 2)); i++ { 3180 v.Data[i] = Float64(xgb.Get64(buf[b:])) 3181 b += 8 3182 } 3183 3184 return v 3185 } 3186 3187 // Write request to wire for GetClipPlane 3188 // getClipPlaneRequest writes a GetClipPlane request to a byte slice. 3189 func getClipPlaneRequest(c *xgb.Conn, ContextTag ContextTag, Plane int32) []byte { 3190 size := 12 3191 b := 0 3192 buf := make([]byte, size) 3193 3194 c.ExtLock.RLock() 3195 buf[b] = c.Extensions["GLX"] 3196 c.ExtLock.RUnlock() 3197 b += 1 3198 3199 buf[b] = 113 // request opcode 3200 b += 1 3201 3202 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 3203 b += 2 3204 3205 xgb.Put32(buf[b:], uint32(ContextTag)) 3206 b += 4 3207 3208 xgb.Put32(buf[b:], uint32(Plane)) 3209 b += 4 3210 3211 return buf 3212 } 3213 3214 // GetColorTableCookie is a cookie used only for GetColorTable requests. 3215 type GetColorTableCookie struct { 3216 *xgb.Cookie 3217 } 3218 3219 // GetColorTable sends a checked request. 3220 // If an error occurs, it will be returned with the reply by calling GetColorTableCookie.Reply() 3221 func GetColorTable(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetColorTableCookie { 3222 c.ExtLock.RLock() 3223 defer c.ExtLock.RUnlock() 3224 if _, ok := c.Extensions["GLX"]; !ok { 3225 panic("Cannot issue request 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3226 } 3227 cookie := c.NewCookie(true, true) 3228 c.NewRequest(getColorTableRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) 3229 return GetColorTableCookie{cookie} 3230 } 3231 3232 // GetColorTableUnchecked sends an unchecked request. 3233 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 3234 func GetColorTableUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetColorTableCookie { 3235 c.ExtLock.RLock() 3236 defer c.ExtLock.RUnlock() 3237 if _, ok := c.Extensions["GLX"]; !ok { 3238 panic("Cannot issue request 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3239 } 3240 cookie := c.NewCookie(false, true) 3241 c.NewRequest(getColorTableRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) 3242 return GetColorTableCookie{cookie} 3243 } 3244 3245 // GetColorTableReply represents the data returned from a GetColorTable request. 3246 type GetColorTableReply struct { 3247 Sequence uint16 // sequence number of the request for this reply 3248 Length uint32 // number of bytes in this reply 3249 // padding: 1 bytes 3250 // padding: 8 bytes 3251 Width int32 3252 // padding: 12 bytes 3253 Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 3254 } 3255 3256 // Reply blocks and returns the reply data for a GetColorTable request. 3257 func (cook GetColorTableCookie) Reply() (*GetColorTableReply, error) { 3258 buf, err := cook.Cookie.Reply() 3259 if err != nil { 3260 return nil, err 3261 } 3262 if buf == nil { 3263 return nil, nil 3264 } 3265 return getColorTableReply(buf), nil 3266 } 3267 3268 // getColorTableReply reads a byte slice into a GetColorTableReply value. 3269 func getColorTableReply(buf []byte) *GetColorTableReply { 3270 v := new(GetColorTableReply) 3271 b := 1 // skip reply determinant 3272 3273 b += 1 // padding 3274 3275 v.Sequence = xgb.Get16(buf[b:]) 3276 b += 2 3277 3278 v.Length = xgb.Get32(buf[b:]) // 4-byte units 3279 b += 4 3280 3281 b += 8 // padding 3282 3283 v.Width = int32(xgb.Get32(buf[b:])) 3284 b += 4 3285 3286 b += 12 // padding 3287 3288 v.Data = make([]byte, (int(v.Length) * 4)) 3289 copy(v.Data[:(int(v.Length)*4)], buf[b:]) 3290 b += int((int(v.Length) * 4)) 3291 3292 return v 3293 } 3294 3295 // Write request to wire for GetColorTable 3296 // getColorTableRequest writes a GetColorTable request to a byte slice. 3297 func getColorTableRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) []byte { 3298 size := 24 3299 b := 0 3300 buf := make([]byte, size) 3301 3302 c.ExtLock.RLock() 3303 buf[b] = c.Extensions["GLX"] 3304 c.ExtLock.RUnlock() 3305 b += 1 3306 3307 buf[b] = 147 // request opcode 3308 b += 1 3309 3310 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 3311 b += 2 3312 3313 xgb.Put32(buf[b:], uint32(ContextTag)) 3314 b += 4 3315 3316 xgb.Put32(buf[b:], Target) 3317 b += 4 3318 3319 xgb.Put32(buf[b:], Format) 3320 b += 4 3321 3322 xgb.Put32(buf[b:], Type) 3323 b += 4 3324 3325 if SwapBytes { 3326 buf[b] = 1 3327 } else { 3328 buf[b] = 0 3329 } 3330 b += 1 3331 3332 return buf 3333 } 3334 3335 // GetColorTableParameterfvCookie is a cookie used only for GetColorTableParameterfv requests. 3336 type GetColorTableParameterfvCookie struct { 3337 *xgb.Cookie 3338 } 3339 3340 // GetColorTableParameterfv sends a checked request. 3341 // If an error occurs, it will be returned with the reply by calling GetColorTableParameterfvCookie.Reply() 3342 func GetColorTableParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterfvCookie { 3343 c.ExtLock.RLock() 3344 defer c.ExtLock.RUnlock() 3345 if _, ok := c.Extensions["GLX"]; !ok { 3346 panic("Cannot issue request 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3347 } 3348 cookie := c.NewCookie(true, true) 3349 c.NewRequest(getColorTableParameterfvRequest(c, ContextTag, Target, Pname), cookie) 3350 return GetColorTableParameterfvCookie{cookie} 3351 } 3352 3353 // GetColorTableParameterfvUnchecked sends an unchecked request. 3354 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 3355 func GetColorTableParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterfvCookie { 3356 c.ExtLock.RLock() 3357 defer c.ExtLock.RUnlock() 3358 if _, ok := c.Extensions["GLX"]; !ok { 3359 panic("Cannot issue request 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3360 } 3361 cookie := c.NewCookie(false, true) 3362 c.NewRequest(getColorTableParameterfvRequest(c, ContextTag, Target, Pname), cookie) 3363 return GetColorTableParameterfvCookie{cookie} 3364 } 3365 3366 // GetColorTableParameterfvReply represents the data returned from a GetColorTableParameterfv request. 3367 type GetColorTableParameterfvReply struct { 3368 Sequence uint16 // sequence number of the request for this reply 3369 Length uint32 // number of bytes in this reply 3370 // padding: 1 bytes 3371 // padding: 4 bytes 3372 N uint32 3373 Datum Float32 3374 // padding: 12 bytes 3375 Data []Float32 // size: xgb.Pad((int(N) * 4)) 3376 } 3377 3378 // Reply blocks and returns the reply data for a GetColorTableParameterfv request. 3379 func (cook GetColorTableParameterfvCookie) Reply() (*GetColorTableParameterfvReply, error) { 3380 buf, err := cook.Cookie.Reply() 3381 if err != nil { 3382 return nil, err 3383 } 3384 if buf == nil { 3385 return nil, nil 3386 } 3387 return getColorTableParameterfvReply(buf), nil 3388 } 3389 3390 // getColorTableParameterfvReply reads a byte slice into a GetColorTableParameterfvReply value. 3391 func getColorTableParameterfvReply(buf []byte) *GetColorTableParameterfvReply { 3392 v := new(GetColorTableParameterfvReply) 3393 b := 1 // skip reply determinant 3394 3395 b += 1 // padding 3396 3397 v.Sequence = xgb.Get16(buf[b:]) 3398 b += 2 3399 3400 v.Length = xgb.Get32(buf[b:]) // 4-byte units 3401 b += 4 3402 3403 b += 4 // padding 3404 3405 v.N = xgb.Get32(buf[b:]) 3406 b += 4 3407 3408 v.Datum = Float32(xgb.Get32(buf[b:])) 3409 b += 4 3410 3411 b += 12 // padding 3412 3413 v.Data = make([]Float32, v.N) 3414 for i := 0; i < int(v.N); i++ { 3415 v.Data[i] = Float32(xgb.Get32(buf[b:])) 3416 b += 4 3417 } 3418 3419 return v 3420 } 3421 3422 // Write request to wire for GetColorTableParameterfv 3423 // getColorTableParameterfvRequest writes a GetColorTableParameterfv request to a byte slice. 3424 func getColorTableParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 3425 size := 16 3426 b := 0 3427 buf := make([]byte, size) 3428 3429 c.ExtLock.RLock() 3430 buf[b] = c.Extensions["GLX"] 3431 c.ExtLock.RUnlock() 3432 b += 1 3433 3434 buf[b] = 148 // request opcode 3435 b += 1 3436 3437 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 3438 b += 2 3439 3440 xgb.Put32(buf[b:], uint32(ContextTag)) 3441 b += 4 3442 3443 xgb.Put32(buf[b:], Target) 3444 b += 4 3445 3446 xgb.Put32(buf[b:], Pname) 3447 b += 4 3448 3449 return buf 3450 } 3451 3452 // GetColorTableParameterivCookie is a cookie used only for GetColorTableParameteriv requests. 3453 type GetColorTableParameterivCookie struct { 3454 *xgb.Cookie 3455 } 3456 3457 // GetColorTableParameteriv sends a checked request. 3458 // If an error occurs, it will be returned with the reply by calling GetColorTableParameterivCookie.Reply() 3459 func GetColorTableParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterivCookie { 3460 c.ExtLock.RLock() 3461 defer c.ExtLock.RUnlock() 3462 if _, ok := c.Extensions["GLX"]; !ok { 3463 panic("Cannot issue request 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3464 } 3465 cookie := c.NewCookie(true, true) 3466 c.NewRequest(getColorTableParameterivRequest(c, ContextTag, Target, Pname), cookie) 3467 return GetColorTableParameterivCookie{cookie} 3468 } 3469 3470 // GetColorTableParameterivUnchecked sends an unchecked request. 3471 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 3472 func GetColorTableParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterivCookie { 3473 c.ExtLock.RLock() 3474 defer c.ExtLock.RUnlock() 3475 if _, ok := c.Extensions["GLX"]; !ok { 3476 panic("Cannot issue request 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3477 } 3478 cookie := c.NewCookie(false, true) 3479 c.NewRequest(getColorTableParameterivRequest(c, ContextTag, Target, Pname), cookie) 3480 return GetColorTableParameterivCookie{cookie} 3481 } 3482 3483 // GetColorTableParameterivReply represents the data returned from a GetColorTableParameteriv request. 3484 type GetColorTableParameterivReply struct { 3485 Sequence uint16 // sequence number of the request for this reply 3486 Length uint32 // number of bytes in this reply 3487 // padding: 1 bytes 3488 // padding: 4 bytes 3489 N uint32 3490 Datum int32 3491 // padding: 12 bytes 3492 Data []int32 // size: xgb.Pad((int(N) * 4)) 3493 } 3494 3495 // Reply blocks and returns the reply data for a GetColorTableParameteriv request. 3496 func (cook GetColorTableParameterivCookie) Reply() (*GetColorTableParameterivReply, error) { 3497 buf, err := cook.Cookie.Reply() 3498 if err != nil { 3499 return nil, err 3500 } 3501 if buf == nil { 3502 return nil, nil 3503 } 3504 return getColorTableParameterivReply(buf), nil 3505 } 3506 3507 // getColorTableParameterivReply reads a byte slice into a GetColorTableParameterivReply value. 3508 func getColorTableParameterivReply(buf []byte) *GetColorTableParameterivReply { 3509 v := new(GetColorTableParameterivReply) 3510 b := 1 // skip reply determinant 3511 3512 b += 1 // padding 3513 3514 v.Sequence = xgb.Get16(buf[b:]) 3515 b += 2 3516 3517 v.Length = xgb.Get32(buf[b:]) // 4-byte units 3518 b += 4 3519 3520 b += 4 // padding 3521 3522 v.N = xgb.Get32(buf[b:]) 3523 b += 4 3524 3525 v.Datum = int32(xgb.Get32(buf[b:])) 3526 b += 4 3527 3528 b += 12 // padding 3529 3530 v.Data = make([]int32, v.N) 3531 for i := 0; i < int(v.N); i++ { 3532 v.Data[i] = int32(xgb.Get32(buf[b:])) 3533 b += 4 3534 } 3535 3536 return v 3537 } 3538 3539 // Write request to wire for GetColorTableParameteriv 3540 // getColorTableParameterivRequest writes a GetColorTableParameteriv request to a byte slice. 3541 func getColorTableParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 3542 size := 16 3543 b := 0 3544 buf := make([]byte, size) 3545 3546 c.ExtLock.RLock() 3547 buf[b] = c.Extensions["GLX"] 3548 c.ExtLock.RUnlock() 3549 b += 1 3550 3551 buf[b] = 149 // request opcode 3552 b += 1 3553 3554 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 3555 b += 2 3556 3557 xgb.Put32(buf[b:], uint32(ContextTag)) 3558 b += 4 3559 3560 xgb.Put32(buf[b:], Target) 3561 b += 4 3562 3563 xgb.Put32(buf[b:], Pname) 3564 b += 4 3565 3566 return buf 3567 } 3568 3569 // GetCompressedTexImageARBCookie is a cookie used only for GetCompressedTexImageARB requests. 3570 type GetCompressedTexImageARBCookie struct { 3571 *xgb.Cookie 3572 } 3573 3574 // GetCompressedTexImageARB sends a checked request. 3575 // If an error occurs, it will be returned with the reply by calling GetCompressedTexImageARBCookie.Reply() 3576 func GetCompressedTexImageARB(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) GetCompressedTexImageARBCookie { 3577 c.ExtLock.RLock() 3578 defer c.ExtLock.RUnlock() 3579 if _, ok := c.Extensions["GLX"]; !ok { 3580 panic("Cannot issue request 'GetCompressedTexImageARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3581 } 3582 cookie := c.NewCookie(true, true) 3583 c.NewRequest(getCompressedTexImageARBRequest(c, ContextTag, Target, Level), cookie) 3584 return GetCompressedTexImageARBCookie{cookie} 3585 } 3586 3587 // GetCompressedTexImageARBUnchecked sends an unchecked request. 3588 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 3589 func GetCompressedTexImageARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) GetCompressedTexImageARBCookie { 3590 c.ExtLock.RLock() 3591 defer c.ExtLock.RUnlock() 3592 if _, ok := c.Extensions["GLX"]; !ok { 3593 panic("Cannot issue request 'GetCompressedTexImageARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3594 } 3595 cookie := c.NewCookie(false, true) 3596 c.NewRequest(getCompressedTexImageARBRequest(c, ContextTag, Target, Level), cookie) 3597 return GetCompressedTexImageARBCookie{cookie} 3598 } 3599 3600 // GetCompressedTexImageARBReply represents the data returned from a GetCompressedTexImageARB request. 3601 type GetCompressedTexImageARBReply struct { 3602 Sequence uint16 // sequence number of the request for this reply 3603 Length uint32 // number of bytes in this reply 3604 // padding: 1 bytes 3605 // padding: 8 bytes 3606 Size int32 3607 // padding: 12 bytes 3608 Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 3609 } 3610 3611 // Reply blocks and returns the reply data for a GetCompressedTexImageARB request. 3612 func (cook GetCompressedTexImageARBCookie) Reply() (*GetCompressedTexImageARBReply, error) { 3613 buf, err := cook.Cookie.Reply() 3614 if err != nil { 3615 return nil, err 3616 } 3617 if buf == nil { 3618 return nil, nil 3619 } 3620 return getCompressedTexImageARBReply(buf), nil 3621 } 3622 3623 // getCompressedTexImageARBReply reads a byte slice into a GetCompressedTexImageARBReply value. 3624 func getCompressedTexImageARBReply(buf []byte) *GetCompressedTexImageARBReply { 3625 v := new(GetCompressedTexImageARBReply) 3626 b := 1 // skip reply determinant 3627 3628 b += 1 // padding 3629 3630 v.Sequence = xgb.Get16(buf[b:]) 3631 b += 2 3632 3633 v.Length = xgb.Get32(buf[b:]) // 4-byte units 3634 b += 4 3635 3636 b += 8 // padding 3637 3638 v.Size = int32(xgb.Get32(buf[b:])) 3639 b += 4 3640 3641 b += 12 // padding 3642 3643 v.Data = make([]byte, (int(v.Length) * 4)) 3644 copy(v.Data[:(int(v.Length)*4)], buf[b:]) 3645 b += int((int(v.Length) * 4)) 3646 3647 return v 3648 } 3649 3650 // Write request to wire for GetCompressedTexImageARB 3651 // getCompressedTexImageARBRequest writes a GetCompressedTexImageARB request to a byte slice. 3652 func getCompressedTexImageARBRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) []byte { 3653 size := 16 3654 b := 0 3655 buf := make([]byte, size) 3656 3657 c.ExtLock.RLock() 3658 buf[b] = c.Extensions["GLX"] 3659 c.ExtLock.RUnlock() 3660 b += 1 3661 3662 buf[b] = 160 // request opcode 3663 b += 1 3664 3665 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 3666 b += 2 3667 3668 xgb.Put32(buf[b:], uint32(ContextTag)) 3669 b += 4 3670 3671 xgb.Put32(buf[b:], Target) 3672 b += 4 3673 3674 xgb.Put32(buf[b:], uint32(Level)) 3675 b += 4 3676 3677 return buf 3678 } 3679 3680 // GetConvolutionFilterCookie is a cookie used only for GetConvolutionFilter requests. 3681 type GetConvolutionFilterCookie struct { 3682 *xgb.Cookie 3683 } 3684 3685 // GetConvolutionFilter sends a checked request. 3686 // If an error occurs, it will be returned with the reply by calling GetConvolutionFilterCookie.Reply() 3687 func GetConvolutionFilter(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetConvolutionFilterCookie { 3688 c.ExtLock.RLock() 3689 defer c.ExtLock.RUnlock() 3690 if _, ok := c.Extensions["GLX"]; !ok { 3691 panic("Cannot issue request 'GetConvolutionFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3692 } 3693 cookie := c.NewCookie(true, true) 3694 c.NewRequest(getConvolutionFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) 3695 return GetConvolutionFilterCookie{cookie} 3696 } 3697 3698 // GetConvolutionFilterUnchecked sends an unchecked request. 3699 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 3700 func GetConvolutionFilterUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetConvolutionFilterCookie { 3701 c.ExtLock.RLock() 3702 defer c.ExtLock.RUnlock() 3703 if _, ok := c.Extensions["GLX"]; !ok { 3704 panic("Cannot issue request 'GetConvolutionFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3705 } 3706 cookie := c.NewCookie(false, true) 3707 c.NewRequest(getConvolutionFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) 3708 return GetConvolutionFilterCookie{cookie} 3709 } 3710 3711 // GetConvolutionFilterReply represents the data returned from a GetConvolutionFilter request. 3712 type GetConvolutionFilterReply struct { 3713 Sequence uint16 // sequence number of the request for this reply 3714 Length uint32 // number of bytes in this reply 3715 // padding: 1 bytes 3716 // padding: 8 bytes 3717 Width int32 3718 Height int32 3719 // padding: 8 bytes 3720 Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 3721 } 3722 3723 // Reply blocks and returns the reply data for a GetConvolutionFilter request. 3724 func (cook GetConvolutionFilterCookie) Reply() (*GetConvolutionFilterReply, error) { 3725 buf, err := cook.Cookie.Reply() 3726 if err != nil { 3727 return nil, err 3728 } 3729 if buf == nil { 3730 return nil, nil 3731 } 3732 return getConvolutionFilterReply(buf), nil 3733 } 3734 3735 // getConvolutionFilterReply reads a byte slice into a GetConvolutionFilterReply value. 3736 func getConvolutionFilterReply(buf []byte) *GetConvolutionFilterReply { 3737 v := new(GetConvolutionFilterReply) 3738 b := 1 // skip reply determinant 3739 3740 b += 1 // padding 3741 3742 v.Sequence = xgb.Get16(buf[b:]) 3743 b += 2 3744 3745 v.Length = xgb.Get32(buf[b:]) // 4-byte units 3746 b += 4 3747 3748 b += 8 // padding 3749 3750 v.Width = int32(xgb.Get32(buf[b:])) 3751 b += 4 3752 3753 v.Height = int32(xgb.Get32(buf[b:])) 3754 b += 4 3755 3756 b += 8 // padding 3757 3758 v.Data = make([]byte, (int(v.Length) * 4)) 3759 copy(v.Data[:(int(v.Length)*4)], buf[b:]) 3760 b += int((int(v.Length) * 4)) 3761 3762 return v 3763 } 3764 3765 // Write request to wire for GetConvolutionFilter 3766 // getConvolutionFilterRequest writes a GetConvolutionFilter request to a byte slice. 3767 func getConvolutionFilterRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) []byte { 3768 size := 24 3769 b := 0 3770 buf := make([]byte, size) 3771 3772 c.ExtLock.RLock() 3773 buf[b] = c.Extensions["GLX"] 3774 c.ExtLock.RUnlock() 3775 b += 1 3776 3777 buf[b] = 150 // request opcode 3778 b += 1 3779 3780 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 3781 b += 2 3782 3783 xgb.Put32(buf[b:], uint32(ContextTag)) 3784 b += 4 3785 3786 xgb.Put32(buf[b:], Target) 3787 b += 4 3788 3789 xgb.Put32(buf[b:], Format) 3790 b += 4 3791 3792 xgb.Put32(buf[b:], Type) 3793 b += 4 3794 3795 if SwapBytes { 3796 buf[b] = 1 3797 } else { 3798 buf[b] = 0 3799 } 3800 b += 1 3801 3802 return buf 3803 } 3804 3805 // GetConvolutionParameterfvCookie is a cookie used only for GetConvolutionParameterfv requests. 3806 type GetConvolutionParameterfvCookie struct { 3807 *xgb.Cookie 3808 } 3809 3810 // GetConvolutionParameterfv sends a checked request. 3811 // If an error occurs, it will be returned with the reply by calling GetConvolutionParameterfvCookie.Reply() 3812 func GetConvolutionParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterfvCookie { 3813 c.ExtLock.RLock() 3814 defer c.ExtLock.RUnlock() 3815 if _, ok := c.Extensions["GLX"]; !ok { 3816 panic("Cannot issue request 'GetConvolutionParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3817 } 3818 cookie := c.NewCookie(true, true) 3819 c.NewRequest(getConvolutionParameterfvRequest(c, ContextTag, Target, Pname), cookie) 3820 return GetConvolutionParameterfvCookie{cookie} 3821 } 3822 3823 // GetConvolutionParameterfvUnchecked sends an unchecked request. 3824 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 3825 func GetConvolutionParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterfvCookie { 3826 c.ExtLock.RLock() 3827 defer c.ExtLock.RUnlock() 3828 if _, ok := c.Extensions["GLX"]; !ok { 3829 panic("Cannot issue request 'GetConvolutionParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3830 } 3831 cookie := c.NewCookie(false, true) 3832 c.NewRequest(getConvolutionParameterfvRequest(c, ContextTag, Target, Pname), cookie) 3833 return GetConvolutionParameterfvCookie{cookie} 3834 } 3835 3836 // GetConvolutionParameterfvReply represents the data returned from a GetConvolutionParameterfv request. 3837 type GetConvolutionParameterfvReply struct { 3838 Sequence uint16 // sequence number of the request for this reply 3839 Length uint32 // number of bytes in this reply 3840 // padding: 1 bytes 3841 // padding: 4 bytes 3842 N uint32 3843 Datum Float32 3844 // padding: 12 bytes 3845 Data []Float32 // size: xgb.Pad((int(N) * 4)) 3846 } 3847 3848 // Reply blocks and returns the reply data for a GetConvolutionParameterfv request. 3849 func (cook GetConvolutionParameterfvCookie) Reply() (*GetConvolutionParameterfvReply, error) { 3850 buf, err := cook.Cookie.Reply() 3851 if err != nil { 3852 return nil, err 3853 } 3854 if buf == nil { 3855 return nil, nil 3856 } 3857 return getConvolutionParameterfvReply(buf), nil 3858 } 3859 3860 // getConvolutionParameterfvReply reads a byte slice into a GetConvolutionParameterfvReply value. 3861 func getConvolutionParameterfvReply(buf []byte) *GetConvolutionParameterfvReply { 3862 v := new(GetConvolutionParameterfvReply) 3863 b := 1 // skip reply determinant 3864 3865 b += 1 // padding 3866 3867 v.Sequence = xgb.Get16(buf[b:]) 3868 b += 2 3869 3870 v.Length = xgb.Get32(buf[b:]) // 4-byte units 3871 b += 4 3872 3873 b += 4 // padding 3874 3875 v.N = xgb.Get32(buf[b:]) 3876 b += 4 3877 3878 v.Datum = Float32(xgb.Get32(buf[b:])) 3879 b += 4 3880 3881 b += 12 // padding 3882 3883 v.Data = make([]Float32, v.N) 3884 for i := 0; i < int(v.N); i++ { 3885 v.Data[i] = Float32(xgb.Get32(buf[b:])) 3886 b += 4 3887 } 3888 3889 return v 3890 } 3891 3892 // Write request to wire for GetConvolutionParameterfv 3893 // getConvolutionParameterfvRequest writes a GetConvolutionParameterfv request to a byte slice. 3894 func getConvolutionParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 3895 size := 16 3896 b := 0 3897 buf := make([]byte, size) 3898 3899 c.ExtLock.RLock() 3900 buf[b] = c.Extensions["GLX"] 3901 c.ExtLock.RUnlock() 3902 b += 1 3903 3904 buf[b] = 151 // request opcode 3905 b += 1 3906 3907 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 3908 b += 2 3909 3910 xgb.Put32(buf[b:], uint32(ContextTag)) 3911 b += 4 3912 3913 xgb.Put32(buf[b:], Target) 3914 b += 4 3915 3916 xgb.Put32(buf[b:], Pname) 3917 b += 4 3918 3919 return buf 3920 } 3921 3922 // GetConvolutionParameterivCookie is a cookie used only for GetConvolutionParameteriv requests. 3923 type GetConvolutionParameterivCookie struct { 3924 *xgb.Cookie 3925 } 3926 3927 // GetConvolutionParameteriv sends a checked request. 3928 // If an error occurs, it will be returned with the reply by calling GetConvolutionParameterivCookie.Reply() 3929 func GetConvolutionParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterivCookie { 3930 c.ExtLock.RLock() 3931 defer c.ExtLock.RUnlock() 3932 if _, ok := c.Extensions["GLX"]; !ok { 3933 panic("Cannot issue request 'GetConvolutionParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3934 } 3935 cookie := c.NewCookie(true, true) 3936 c.NewRequest(getConvolutionParameterivRequest(c, ContextTag, Target, Pname), cookie) 3937 return GetConvolutionParameterivCookie{cookie} 3938 } 3939 3940 // GetConvolutionParameterivUnchecked sends an unchecked request. 3941 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 3942 func GetConvolutionParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterivCookie { 3943 c.ExtLock.RLock() 3944 defer c.ExtLock.RUnlock() 3945 if _, ok := c.Extensions["GLX"]; !ok { 3946 panic("Cannot issue request 'GetConvolutionParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 3947 } 3948 cookie := c.NewCookie(false, true) 3949 c.NewRequest(getConvolutionParameterivRequest(c, ContextTag, Target, Pname), cookie) 3950 return GetConvolutionParameterivCookie{cookie} 3951 } 3952 3953 // GetConvolutionParameterivReply represents the data returned from a GetConvolutionParameteriv request. 3954 type GetConvolutionParameterivReply struct { 3955 Sequence uint16 // sequence number of the request for this reply 3956 Length uint32 // number of bytes in this reply 3957 // padding: 1 bytes 3958 // padding: 4 bytes 3959 N uint32 3960 Datum int32 3961 // padding: 12 bytes 3962 Data []int32 // size: xgb.Pad((int(N) * 4)) 3963 } 3964 3965 // Reply blocks and returns the reply data for a GetConvolutionParameteriv request. 3966 func (cook GetConvolutionParameterivCookie) Reply() (*GetConvolutionParameterivReply, error) { 3967 buf, err := cook.Cookie.Reply() 3968 if err != nil { 3969 return nil, err 3970 } 3971 if buf == nil { 3972 return nil, nil 3973 } 3974 return getConvolutionParameterivReply(buf), nil 3975 } 3976 3977 // getConvolutionParameterivReply reads a byte slice into a GetConvolutionParameterivReply value. 3978 func getConvolutionParameterivReply(buf []byte) *GetConvolutionParameterivReply { 3979 v := new(GetConvolutionParameterivReply) 3980 b := 1 // skip reply determinant 3981 3982 b += 1 // padding 3983 3984 v.Sequence = xgb.Get16(buf[b:]) 3985 b += 2 3986 3987 v.Length = xgb.Get32(buf[b:]) // 4-byte units 3988 b += 4 3989 3990 b += 4 // padding 3991 3992 v.N = xgb.Get32(buf[b:]) 3993 b += 4 3994 3995 v.Datum = int32(xgb.Get32(buf[b:])) 3996 b += 4 3997 3998 b += 12 // padding 3999 4000 v.Data = make([]int32, v.N) 4001 for i := 0; i < int(v.N); i++ { 4002 v.Data[i] = int32(xgb.Get32(buf[b:])) 4003 b += 4 4004 } 4005 4006 return v 4007 } 4008 4009 // Write request to wire for GetConvolutionParameteriv 4010 // getConvolutionParameterivRequest writes a GetConvolutionParameteriv request to a byte slice. 4011 func getConvolutionParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 4012 size := 16 4013 b := 0 4014 buf := make([]byte, size) 4015 4016 c.ExtLock.RLock() 4017 buf[b] = c.Extensions["GLX"] 4018 c.ExtLock.RUnlock() 4019 b += 1 4020 4021 buf[b] = 152 // request opcode 4022 b += 1 4023 4024 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 4025 b += 2 4026 4027 xgb.Put32(buf[b:], uint32(ContextTag)) 4028 b += 4 4029 4030 xgb.Put32(buf[b:], Target) 4031 b += 4 4032 4033 xgb.Put32(buf[b:], Pname) 4034 b += 4 4035 4036 return buf 4037 } 4038 4039 // GetDoublevCookie is a cookie used only for GetDoublev requests. 4040 type GetDoublevCookie struct { 4041 *xgb.Cookie 4042 } 4043 4044 // GetDoublev sends a checked request. 4045 // If an error occurs, it will be returned with the reply by calling GetDoublevCookie.Reply() 4046 func GetDoublev(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetDoublevCookie { 4047 c.ExtLock.RLock() 4048 defer c.ExtLock.RUnlock() 4049 if _, ok := c.Extensions["GLX"]; !ok { 4050 panic("Cannot issue request 'GetDoublev' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4051 } 4052 cookie := c.NewCookie(true, true) 4053 c.NewRequest(getDoublevRequest(c, ContextTag, Pname), cookie) 4054 return GetDoublevCookie{cookie} 4055 } 4056 4057 // GetDoublevUnchecked sends an unchecked request. 4058 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 4059 func GetDoublevUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetDoublevCookie { 4060 c.ExtLock.RLock() 4061 defer c.ExtLock.RUnlock() 4062 if _, ok := c.Extensions["GLX"]; !ok { 4063 panic("Cannot issue request 'GetDoublev' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4064 } 4065 cookie := c.NewCookie(false, true) 4066 c.NewRequest(getDoublevRequest(c, ContextTag, Pname), cookie) 4067 return GetDoublevCookie{cookie} 4068 } 4069 4070 // GetDoublevReply represents the data returned from a GetDoublev request. 4071 type GetDoublevReply struct { 4072 Sequence uint16 // sequence number of the request for this reply 4073 Length uint32 // number of bytes in this reply 4074 // padding: 1 bytes 4075 // padding: 4 bytes 4076 N uint32 4077 Datum Float64 4078 // padding: 8 bytes 4079 Data []Float64 // size: xgb.Pad((int(N) * 8)) 4080 } 4081 4082 // Reply blocks and returns the reply data for a GetDoublev request. 4083 func (cook GetDoublevCookie) Reply() (*GetDoublevReply, error) { 4084 buf, err := cook.Cookie.Reply() 4085 if err != nil { 4086 return nil, err 4087 } 4088 if buf == nil { 4089 return nil, nil 4090 } 4091 return getDoublevReply(buf), nil 4092 } 4093 4094 // getDoublevReply reads a byte slice into a GetDoublevReply value. 4095 func getDoublevReply(buf []byte) *GetDoublevReply { 4096 v := new(GetDoublevReply) 4097 b := 1 // skip reply determinant 4098 4099 b += 1 // padding 4100 4101 v.Sequence = xgb.Get16(buf[b:]) 4102 b += 2 4103 4104 v.Length = xgb.Get32(buf[b:]) // 4-byte units 4105 b += 4 4106 4107 b += 4 // padding 4108 4109 v.N = xgb.Get32(buf[b:]) 4110 b += 4 4111 4112 v.Datum = Float64(xgb.Get64(buf[b:])) 4113 b += 8 4114 4115 b += 8 // padding 4116 4117 v.Data = make([]Float64, v.N) 4118 for i := 0; i < int(v.N); i++ { 4119 v.Data[i] = Float64(xgb.Get64(buf[b:])) 4120 b += 8 4121 } 4122 4123 return v 4124 } 4125 4126 // Write request to wire for GetDoublev 4127 // getDoublevRequest writes a GetDoublev request to a byte slice. 4128 func getDoublevRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte { 4129 size := 12 4130 b := 0 4131 buf := make([]byte, size) 4132 4133 c.ExtLock.RLock() 4134 buf[b] = c.Extensions["GLX"] 4135 c.ExtLock.RUnlock() 4136 b += 1 4137 4138 buf[b] = 114 // request opcode 4139 b += 1 4140 4141 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 4142 b += 2 4143 4144 xgb.Put32(buf[b:], uint32(ContextTag)) 4145 b += 4 4146 4147 xgb.Put32(buf[b:], Pname) 4148 b += 4 4149 4150 return buf 4151 } 4152 4153 // GetDrawableAttributesCookie is a cookie used only for GetDrawableAttributes requests. 4154 type GetDrawableAttributesCookie struct { 4155 *xgb.Cookie 4156 } 4157 4158 // GetDrawableAttributes sends a checked request. 4159 // If an error occurs, it will be returned with the reply by calling GetDrawableAttributesCookie.Reply() 4160 func GetDrawableAttributes(c *xgb.Conn, Drawable Drawable) GetDrawableAttributesCookie { 4161 c.ExtLock.RLock() 4162 defer c.ExtLock.RUnlock() 4163 if _, ok := c.Extensions["GLX"]; !ok { 4164 panic("Cannot issue request 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4165 } 4166 cookie := c.NewCookie(true, true) 4167 c.NewRequest(getDrawableAttributesRequest(c, Drawable), cookie) 4168 return GetDrawableAttributesCookie{cookie} 4169 } 4170 4171 // GetDrawableAttributesUnchecked sends an unchecked request. 4172 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 4173 func GetDrawableAttributesUnchecked(c *xgb.Conn, Drawable Drawable) GetDrawableAttributesCookie { 4174 c.ExtLock.RLock() 4175 defer c.ExtLock.RUnlock() 4176 if _, ok := c.Extensions["GLX"]; !ok { 4177 panic("Cannot issue request 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4178 } 4179 cookie := c.NewCookie(false, true) 4180 c.NewRequest(getDrawableAttributesRequest(c, Drawable), cookie) 4181 return GetDrawableAttributesCookie{cookie} 4182 } 4183 4184 // GetDrawableAttributesReply represents the data returned from a GetDrawableAttributes request. 4185 type GetDrawableAttributesReply struct { 4186 Sequence uint16 // sequence number of the request for this reply 4187 Length uint32 // number of bytes in this reply 4188 // padding: 1 bytes 4189 NumAttribs uint32 4190 // padding: 20 bytes 4191 Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4)) 4192 } 4193 4194 // Reply blocks and returns the reply data for a GetDrawableAttributes request. 4195 func (cook GetDrawableAttributesCookie) Reply() (*GetDrawableAttributesReply, error) { 4196 buf, err := cook.Cookie.Reply() 4197 if err != nil { 4198 return nil, err 4199 } 4200 if buf == nil { 4201 return nil, nil 4202 } 4203 return getDrawableAttributesReply(buf), nil 4204 } 4205 4206 // getDrawableAttributesReply reads a byte slice into a GetDrawableAttributesReply value. 4207 func getDrawableAttributesReply(buf []byte) *GetDrawableAttributesReply { 4208 v := new(GetDrawableAttributesReply) 4209 b := 1 // skip reply determinant 4210 4211 b += 1 // padding 4212 4213 v.Sequence = xgb.Get16(buf[b:]) 4214 b += 2 4215 4216 v.Length = xgb.Get32(buf[b:]) // 4-byte units 4217 b += 4 4218 4219 v.NumAttribs = xgb.Get32(buf[b:]) 4220 b += 4 4221 4222 b += 20 // padding 4223 4224 v.Attribs = make([]uint32, (int(v.NumAttribs) * 2)) 4225 for i := 0; i < int((int(v.NumAttribs) * 2)); i++ { 4226 v.Attribs[i] = xgb.Get32(buf[b:]) 4227 b += 4 4228 } 4229 4230 return v 4231 } 4232 4233 // Write request to wire for GetDrawableAttributes 4234 // getDrawableAttributesRequest writes a GetDrawableAttributes request to a byte slice. 4235 func getDrawableAttributesRequest(c *xgb.Conn, Drawable Drawable) []byte { 4236 size := 8 4237 b := 0 4238 buf := make([]byte, size) 4239 4240 c.ExtLock.RLock() 4241 buf[b] = c.Extensions["GLX"] 4242 c.ExtLock.RUnlock() 4243 b += 1 4244 4245 buf[b] = 29 // request opcode 4246 b += 1 4247 4248 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 4249 b += 2 4250 4251 xgb.Put32(buf[b:], uint32(Drawable)) 4252 b += 4 4253 4254 return buf 4255 } 4256 4257 // GetErrorCookie is a cookie used only for GetError requests. 4258 type GetErrorCookie struct { 4259 *xgb.Cookie 4260 } 4261 4262 // GetError sends a checked request. 4263 // If an error occurs, it will be returned with the reply by calling GetErrorCookie.Reply() 4264 func GetError(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie { 4265 c.ExtLock.RLock() 4266 defer c.ExtLock.RUnlock() 4267 if _, ok := c.Extensions["GLX"]; !ok { 4268 panic("Cannot issue request 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4269 } 4270 cookie := c.NewCookie(true, true) 4271 c.NewRequest(getErrorRequest(c, ContextTag), cookie) 4272 return GetErrorCookie{cookie} 4273 } 4274 4275 // GetErrorUnchecked sends an unchecked request. 4276 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 4277 func GetErrorUnchecked(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie { 4278 c.ExtLock.RLock() 4279 defer c.ExtLock.RUnlock() 4280 if _, ok := c.Extensions["GLX"]; !ok { 4281 panic("Cannot issue request 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4282 } 4283 cookie := c.NewCookie(false, true) 4284 c.NewRequest(getErrorRequest(c, ContextTag), cookie) 4285 return GetErrorCookie{cookie} 4286 } 4287 4288 // GetErrorReply represents the data returned from a GetError request. 4289 type GetErrorReply struct { 4290 Sequence uint16 // sequence number of the request for this reply 4291 Length uint32 // number of bytes in this reply 4292 // padding: 1 bytes 4293 Error int32 4294 } 4295 4296 // Reply blocks and returns the reply data for a GetError request. 4297 func (cook GetErrorCookie) Reply() (*GetErrorReply, error) { 4298 buf, err := cook.Cookie.Reply() 4299 if err != nil { 4300 return nil, err 4301 } 4302 if buf == nil { 4303 return nil, nil 4304 } 4305 return getErrorReply(buf), nil 4306 } 4307 4308 // getErrorReply reads a byte slice into a GetErrorReply value. 4309 func getErrorReply(buf []byte) *GetErrorReply { 4310 v := new(GetErrorReply) 4311 b := 1 // skip reply determinant 4312 4313 b += 1 // padding 4314 4315 v.Sequence = xgb.Get16(buf[b:]) 4316 b += 2 4317 4318 v.Length = xgb.Get32(buf[b:]) // 4-byte units 4319 b += 4 4320 4321 v.Error = int32(xgb.Get32(buf[b:])) 4322 b += 4 4323 4324 return v 4325 } 4326 4327 // Write request to wire for GetError 4328 // getErrorRequest writes a GetError request to a byte slice. 4329 func getErrorRequest(c *xgb.Conn, ContextTag ContextTag) []byte { 4330 size := 8 4331 b := 0 4332 buf := make([]byte, size) 4333 4334 c.ExtLock.RLock() 4335 buf[b] = c.Extensions["GLX"] 4336 c.ExtLock.RUnlock() 4337 b += 1 4338 4339 buf[b] = 115 // request opcode 4340 b += 1 4341 4342 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 4343 b += 2 4344 4345 xgb.Put32(buf[b:], uint32(ContextTag)) 4346 b += 4 4347 4348 return buf 4349 } 4350 4351 // GetFBConfigsCookie is a cookie used only for GetFBConfigs requests. 4352 type GetFBConfigsCookie struct { 4353 *xgb.Cookie 4354 } 4355 4356 // GetFBConfigs sends a checked request. 4357 // If an error occurs, it will be returned with the reply by calling GetFBConfigsCookie.Reply() 4358 func GetFBConfigs(c *xgb.Conn, Screen uint32) GetFBConfigsCookie { 4359 c.ExtLock.RLock() 4360 defer c.ExtLock.RUnlock() 4361 if _, ok := c.Extensions["GLX"]; !ok { 4362 panic("Cannot issue request 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4363 } 4364 cookie := c.NewCookie(true, true) 4365 c.NewRequest(getFBConfigsRequest(c, Screen), cookie) 4366 return GetFBConfigsCookie{cookie} 4367 } 4368 4369 // GetFBConfigsUnchecked sends an unchecked request. 4370 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 4371 func GetFBConfigsUnchecked(c *xgb.Conn, Screen uint32) GetFBConfigsCookie { 4372 c.ExtLock.RLock() 4373 defer c.ExtLock.RUnlock() 4374 if _, ok := c.Extensions["GLX"]; !ok { 4375 panic("Cannot issue request 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4376 } 4377 cookie := c.NewCookie(false, true) 4378 c.NewRequest(getFBConfigsRequest(c, Screen), cookie) 4379 return GetFBConfigsCookie{cookie} 4380 } 4381 4382 // GetFBConfigsReply represents the data returned from a GetFBConfigs request. 4383 type GetFBConfigsReply struct { 4384 Sequence uint16 // sequence number of the request for this reply 4385 Length uint32 // number of bytes in this reply 4386 // padding: 1 bytes 4387 NumFbConfigs uint32 4388 NumProperties uint32 4389 // padding: 16 bytes 4390 PropertyList []uint32 // size: xgb.Pad((int(Length) * 4)) 4391 } 4392 4393 // Reply blocks and returns the reply data for a GetFBConfigs request. 4394 func (cook GetFBConfigsCookie) Reply() (*GetFBConfigsReply, error) { 4395 buf, err := cook.Cookie.Reply() 4396 if err != nil { 4397 return nil, err 4398 } 4399 if buf == nil { 4400 return nil, nil 4401 } 4402 return getFBConfigsReply(buf), nil 4403 } 4404 4405 // getFBConfigsReply reads a byte slice into a GetFBConfigsReply value. 4406 func getFBConfigsReply(buf []byte) *GetFBConfigsReply { 4407 v := new(GetFBConfigsReply) 4408 b := 1 // skip reply determinant 4409 4410 b += 1 // padding 4411 4412 v.Sequence = xgb.Get16(buf[b:]) 4413 b += 2 4414 4415 v.Length = xgb.Get32(buf[b:]) // 4-byte units 4416 b += 4 4417 4418 v.NumFbConfigs = xgb.Get32(buf[b:]) 4419 b += 4 4420 4421 v.NumProperties = xgb.Get32(buf[b:]) 4422 b += 4 4423 4424 b += 16 // padding 4425 4426 v.PropertyList = make([]uint32, v.Length) 4427 for i := 0; i < int(v.Length); i++ { 4428 v.PropertyList[i] = xgb.Get32(buf[b:]) 4429 b += 4 4430 } 4431 4432 return v 4433 } 4434 4435 // Write request to wire for GetFBConfigs 4436 // getFBConfigsRequest writes a GetFBConfigs request to a byte slice. 4437 func getFBConfigsRequest(c *xgb.Conn, Screen uint32) []byte { 4438 size := 8 4439 b := 0 4440 buf := make([]byte, size) 4441 4442 c.ExtLock.RLock() 4443 buf[b] = c.Extensions["GLX"] 4444 c.ExtLock.RUnlock() 4445 b += 1 4446 4447 buf[b] = 21 // request opcode 4448 b += 1 4449 4450 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 4451 b += 2 4452 4453 xgb.Put32(buf[b:], Screen) 4454 b += 4 4455 4456 return buf 4457 } 4458 4459 // GetFloatvCookie is a cookie used only for GetFloatv requests. 4460 type GetFloatvCookie struct { 4461 *xgb.Cookie 4462 } 4463 4464 // GetFloatv sends a checked request. 4465 // If an error occurs, it will be returned with the reply by calling GetFloatvCookie.Reply() 4466 func GetFloatv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie { 4467 c.ExtLock.RLock() 4468 defer c.ExtLock.RUnlock() 4469 if _, ok := c.Extensions["GLX"]; !ok { 4470 panic("Cannot issue request 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4471 } 4472 cookie := c.NewCookie(true, true) 4473 c.NewRequest(getFloatvRequest(c, ContextTag, Pname), cookie) 4474 return GetFloatvCookie{cookie} 4475 } 4476 4477 // GetFloatvUnchecked sends an unchecked request. 4478 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 4479 func GetFloatvUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie { 4480 c.ExtLock.RLock() 4481 defer c.ExtLock.RUnlock() 4482 if _, ok := c.Extensions["GLX"]; !ok { 4483 panic("Cannot issue request 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4484 } 4485 cookie := c.NewCookie(false, true) 4486 c.NewRequest(getFloatvRequest(c, ContextTag, Pname), cookie) 4487 return GetFloatvCookie{cookie} 4488 } 4489 4490 // GetFloatvReply represents the data returned from a GetFloatv request. 4491 type GetFloatvReply struct { 4492 Sequence uint16 // sequence number of the request for this reply 4493 Length uint32 // number of bytes in this reply 4494 // padding: 1 bytes 4495 // padding: 4 bytes 4496 N uint32 4497 Datum Float32 4498 // padding: 12 bytes 4499 Data []Float32 // size: xgb.Pad((int(N) * 4)) 4500 } 4501 4502 // Reply blocks and returns the reply data for a GetFloatv request. 4503 func (cook GetFloatvCookie) Reply() (*GetFloatvReply, error) { 4504 buf, err := cook.Cookie.Reply() 4505 if err != nil { 4506 return nil, err 4507 } 4508 if buf == nil { 4509 return nil, nil 4510 } 4511 return getFloatvReply(buf), nil 4512 } 4513 4514 // getFloatvReply reads a byte slice into a GetFloatvReply value. 4515 func getFloatvReply(buf []byte) *GetFloatvReply { 4516 v := new(GetFloatvReply) 4517 b := 1 // skip reply determinant 4518 4519 b += 1 // padding 4520 4521 v.Sequence = xgb.Get16(buf[b:]) 4522 b += 2 4523 4524 v.Length = xgb.Get32(buf[b:]) // 4-byte units 4525 b += 4 4526 4527 b += 4 // padding 4528 4529 v.N = xgb.Get32(buf[b:]) 4530 b += 4 4531 4532 v.Datum = Float32(xgb.Get32(buf[b:])) 4533 b += 4 4534 4535 b += 12 // padding 4536 4537 v.Data = make([]Float32, v.N) 4538 for i := 0; i < int(v.N); i++ { 4539 v.Data[i] = Float32(xgb.Get32(buf[b:])) 4540 b += 4 4541 } 4542 4543 return v 4544 } 4545 4546 // Write request to wire for GetFloatv 4547 // getFloatvRequest writes a GetFloatv request to a byte slice. 4548 func getFloatvRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte { 4549 size := 12 4550 b := 0 4551 buf := make([]byte, size) 4552 4553 c.ExtLock.RLock() 4554 buf[b] = c.Extensions["GLX"] 4555 c.ExtLock.RUnlock() 4556 b += 1 4557 4558 buf[b] = 116 // request opcode 4559 b += 1 4560 4561 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 4562 b += 2 4563 4564 xgb.Put32(buf[b:], uint32(ContextTag)) 4565 b += 4 4566 4567 xgb.Put32(buf[b:], Pname) 4568 b += 4 4569 4570 return buf 4571 } 4572 4573 // GetHistogramCookie is a cookie used only for GetHistogram requests. 4574 type GetHistogramCookie struct { 4575 *xgb.Cookie 4576 } 4577 4578 // GetHistogram sends a checked request. 4579 // If an error occurs, it will be returned with the reply by calling GetHistogramCookie.Reply() 4580 func GetHistogram(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetHistogramCookie { 4581 c.ExtLock.RLock() 4582 defer c.ExtLock.RUnlock() 4583 if _, ok := c.Extensions["GLX"]; !ok { 4584 panic("Cannot issue request 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4585 } 4586 cookie := c.NewCookie(true, true) 4587 c.NewRequest(getHistogramRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) 4588 return GetHistogramCookie{cookie} 4589 } 4590 4591 // GetHistogramUnchecked sends an unchecked request. 4592 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 4593 func GetHistogramUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetHistogramCookie { 4594 c.ExtLock.RLock() 4595 defer c.ExtLock.RUnlock() 4596 if _, ok := c.Extensions["GLX"]; !ok { 4597 panic("Cannot issue request 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4598 } 4599 cookie := c.NewCookie(false, true) 4600 c.NewRequest(getHistogramRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) 4601 return GetHistogramCookie{cookie} 4602 } 4603 4604 // GetHistogramReply represents the data returned from a GetHistogram request. 4605 type GetHistogramReply struct { 4606 Sequence uint16 // sequence number of the request for this reply 4607 Length uint32 // number of bytes in this reply 4608 // padding: 1 bytes 4609 // padding: 8 bytes 4610 Width int32 4611 // padding: 12 bytes 4612 Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 4613 } 4614 4615 // Reply blocks and returns the reply data for a GetHistogram request. 4616 func (cook GetHistogramCookie) Reply() (*GetHistogramReply, error) { 4617 buf, err := cook.Cookie.Reply() 4618 if err != nil { 4619 return nil, err 4620 } 4621 if buf == nil { 4622 return nil, nil 4623 } 4624 return getHistogramReply(buf), nil 4625 } 4626 4627 // getHistogramReply reads a byte slice into a GetHistogramReply value. 4628 func getHistogramReply(buf []byte) *GetHistogramReply { 4629 v := new(GetHistogramReply) 4630 b := 1 // skip reply determinant 4631 4632 b += 1 // padding 4633 4634 v.Sequence = xgb.Get16(buf[b:]) 4635 b += 2 4636 4637 v.Length = xgb.Get32(buf[b:]) // 4-byte units 4638 b += 4 4639 4640 b += 8 // padding 4641 4642 v.Width = int32(xgb.Get32(buf[b:])) 4643 b += 4 4644 4645 b += 12 // padding 4646 4647 v.Data = make([]byte, (int(v.Length) * 4)) 4648 copy(v.Data[:(int(v.Length)*4)], buf[b:]) 4649 b += int((int(v.Length) * 4)) 4650 4651 return v 4652 } 4653 4654 // Write request to wire for GetHistogram 4655 // getHistogramRequest writes a GetHistogram request to a byte slice. 4656 func getHistogramRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) []byte { 4657 size := 24 4658 b := 0 4659 buf := make([]byte, size) 4660 4661 c.ExtLock.RLock() 4662 buf[b] = c.Extensions["GLX"] 4663 c.ExtLock.RUnlock() 4664 b += 1 4665 4666 buf[b] = 154 // request opcode 4667 b += 1 4668 4669 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 4670 b += 2 4671 4672 xgb.Put32(buf[b:], uint32(ContextTag)) 4673 b += 4 4674 4675 xgb.Put32(buf[b:], Target) 4676 b += 4 4677 4678 xgb.Put32(buf[b:], Format) 4679 b += 4 4680 4681 xgb.Put32(buf[b:], Type) 4682 b += 4 4683 4684 if SwapBytes { 4685 buf[b] = 1 4686 } else { 4687 buf[b] = 0 4688 } 4689 b += 1 4690 4691 if Reset { 4692 buf[b] = 1 4693 } else { 4694 buf[b] = 0 4695 } 4696 b += 1 4697 4698 return buf 4699 } 4700 4701 // GetHistogramParameterfvCookie is a cookie used only for GetHistogramParameterfv requests. 4702 type GetHistogramParameterfvCookie struct { 4703 *xgb.Cookie 4704 } 4705 4706 // GetHistogramParameterfv sends a checked request. 4707 // If an error occurs, it will be returned with the reply by calling GetHistogramParameterfvCookie.Reply() 4708 func GetHistogramParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterfvCookie { 4709 c.ExtLock.RLock() 4710 defer c.ExtLock.RUnlock() 4711 if _, ok := c.Extensions["GLX"]; !ok { 4712 panic("Cannot issue request 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4713 } 4714 cookie := c.NewCookie(true, true) 4715 c.NewRequest(getHistogramParameterfvRequest(c, ContextTag, Target, Pname), cookie) 4716 return GetHistogramParameterfvCookie{cookie} 4717 } 4718 4719 // GetHistogramParameterfvUnchecked sends an unchecked request. 4720 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 4721 func GetHistogramParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterfvCookie { 4722 c.ExtLock.RLock() 4723 defer c.ExtLock.RUnlock() 4724 if _, ok := c.Extensions["GLX"]; !ok { 4725 panic("Cannot issue request 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4726 } 4727 cookie := c.NewCookie(false, true) 4728 c.NewRequest(getHistogramParameterfvRequest(c, ContextTag, Target, Pname), cookie) 4729 return GetHistogramParameterfvCookie{cookie} 4730 } 4731 4732 // GetHistogramParameterfvReply represents the data returned from a GetHistogramParameterfv request. 4733 type GetHistogramParameterfvReply struct { 4734 Sequence uint16 // sequence number of the request for this reply 4735 Length uint32 // number of bytes in this reply 4736 // padding: 1 bytes 4737 // padding: 4 bytes 4738 N uint32 4739 Datum Float32 4740 // padding: 12 bytes 4741 Data []Float32 // size: xgb.Pad((int(N) * 4)) 4742 } 4743 4744 // Reply blocks and returns the reply data for a GetHistogramParameterfv request. 4745 func (cook GetHistogramParameterfvCookie) Reply() (*GetHistogramParameterfvReply, error) { 4746 buf, err := cook.Cookie.Reply() 4747 if err != nil { 4748 return nil, err 4749 } 4750 if buf == nil { 4751 return nil, nil 4752 } 4753 return getHistogramParameterfvReply(buf), nil 4754 } 4755 4756 // getHistogramParameterfvReply reads a byte slice into a GetHistogramParameterfvReply value. 4757 func getHistogramParameterfvReply(buf []byte) *GetHistogramParameterfvReply { 4758 v := new(GetHistogramParameterfvReply) 4759 b := 1 // skip reply determinant 4760 4761 b += 1 // padding 4762 4763 v.Sequence = xgb.Get16(buf[b:]) 4764 b += 2 4765 4766 v.Length = xgb.Get32(buf[b:]) // 4-byte units 4767 b += 4 4768 4769 b += 4 // padding 4770 4771 v.N = xgb.Get32(buf[b:]) 4772 b += 4 4773 4774 v.Datum = Float32(xgb.Get32(buf[b:])) 4775 b += 4 4776 4777 b += 12 // padding 4778 4779 v.Data = make([]Float32, v.N) 4780 for i := 0; i < int(v.N); i++ { 4781 v.Data[i] = Float32(xgb.Get32(buf[b:])) 4782 b += 4 4783 } 4784 4785 return v 4786 } 4787 4788 // Write request to wire for GetHistogramParameterfv 4789 // getHistogramParameterfvRequest writes a GetHistogramParameterfv request to a byte slice. 4790 func getHistogramParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 4791 size := 16 4792 b := 0 4793 buf := make([]byte, size) 4794 4795 c.ExtLock.RLock() 4796 buf[b] = c.Extensions["GLX"] 4797 c.ExtLock.RUnlock() 4798 b += 1 4799 4800 buf[b] = 155 // request opcode 4801 b += 1 4802 4803 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 4804 b += 2 4805 4806 xgb.Put32(buf[b:], uint32(ContextTag)) 4807 b += 4 4808 4809 xgb.Put32(buf[b:], Target) 4810 b += 4 4811 4812 xgb.Put32(buf[b:], Pname) 4813 b += 4 4814 4815 return buf 4816 } 4817 4818 // GetHistogramParameterivCookie is a cookie used only for GetHistogramParameteriv requests. 4819 type GetHistogramParameterivCookie struct { 4820 *xgb.Cookie 4821 } 4822 4823 // GetHistogramParameteriv sends a checked request. 4824 // If an error occurs, it will be returned with the reply by calling GetHistogramParameterivCookie.Reply() 4825 func GetHistogramParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterivCookie { 4826 c.ExtLock.RLock() 4827 defer c.ExtLock.RUnlock() 4828 if _, ok := c.Extensions["GLX"]; !ok { 4829 panic("Cannot issue request 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4830 } 4831 cookie := c.NewCookie(true, true) 4832 c.NewRequest(getHistogramParameterivRequest(c, ContextTag, Target, Pname), cookie) 4833 return GetHistogramParameterivCookie{cookie} 4834 } 4835 4836 // GetHistogramParameterivUnchecked sends an unchecked request. 4837 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 4838 func GetHistogramParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterivCookie { 4839 c.ExtLock.RLock() 4840 defer c.ExtLock.RUnlock() 4841 if _, ok := c.Extensions["GLX"]; !ok { 4842 panic("Cannot issue request 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4843 } 4844 cookie := c.NewCookie(false, true) 4845 c.NewRequest(getHistogramParameterivRequest(c, ContextTag, Target, Pname), cookie) 4846 return GetHistogramParameterivCookie{cookie} 4847 } 4848 4849 // GetHistogramParameterivReply represents the data returned from a GetHistogramParameteriv request. 4850 type GetHistogramParameterivReply struct { 4851 Sequence uint16 // sequence number of the request for this reply 4852 Length uint32 // number of bytes in this reply 4853 // padding: 1 bytes 4854 // padding: 4 bytes 4855 N uint32 4856 Datum int32 4857 // padding: 12 bytes 4858 Data []int32 // size: xgb.Pad((int(N) * 4)) 4859 } 4860 4861 // Reply blocks and returns the reply data for a GetHistogramParameteriv request. 4862 func (cook GetHistogramParameterivCookie) Reply() (*GetHistogramParameterivReply, error) { 4863 buf, err := cook.Cookie.Reply() 4864 if err != nil { 4865 return nil, err 4866 } 4867 if buf == nil { 4868 return nil, nil 4869 } 4870 return getHistogramParameterivReply(buf), nil 4871 } 4872 4873 // getHistogramParameterivReply reads a byte slice into a GetHistogramParameterivReply value. 4874 func getHistogramParameterivReply(buf []byte) *GetHistogramParameterivReply { 4875 v := new(GetHistogramParameterivReply) 4876 b := 1 // skip reply determinant 4877 4878 b += 1 // padding 4879 4880 v.Sequence = xgb.Get16(buf[b:]) 4881 b += 2 4882 4883 v.Length = xgb.Get32(buf[b:]) // 4-byte units 4884 b += 4 4885 4886 b += 4 // padding 4887 4888 v.N = xgb.Get32(buf[b:]) 4889 b += 4 4890 4891 v.Datum = int32(xgb.Get32(buf[b:])) 4892 b += 4 4893 4894 b += 12 // padding 4895 4896 v.Data = make([]int32, v.N) 4897 for i := 0; i < int(v.N); i++ { 4898 v.Data[i] = int32(xgb.Get32(buf[b:])) 4899 b += 4 4900 } 4901 4902 return v 4903 } 4904 4905 // Write request to wire for GetHistogramParameteriv 4906 // getHistogramParameterivRequest writes a GetHistogramParameteriv request to a byte slice. 4907 func getHistogramParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 4908 size := 16 4909 b := 0 4910 buf := make([]byte, size) 4911 4912 c.ExtLock.RLock() 4913 buf[b] = c.Extensions["GLX"] 4914 c.ExtLock.RUnlock() 4915 b += 1 4916 4917 buf[b] = 156 // request opcode 4918 b += 1 4919 4920 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 4921 b += 2 4922 4923 xgb.Put32(buf[b:], uint32(ContextTag)) 4924 b += 4 4925 4926 xgb.Put32(buf[b:], Target) 4927 b += 4 4928 4929 xgb.Put32(buf[b:], Pname) 4930 b += 4 4931 4932 return buf 4933 } 4934 4935 // GetIntegervCookie is a cookie used only for GetIntegerv requests. 4936 type GetIntegervCookie struct { 4937 *xgb.Cookie 4938 } 4939 4940 // GetIntegerv sends a checked request. 4941 // If an error occurs, it will be returned with the reply by calling GetIntegervCookie.Reply() 4942 func GetIntegerv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetIntegervCookie { 4943 c.ExtLock.RLock() 4944 defer c.ExtLock.RUnlock() 4945 if _, ok := c.Extensions["GLX"]; !ok { 4946 panic("Cannot issue request 'GetIntegerv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4947 } 4948 cookie := c.NewCookie(true, true) 4949 c.NewRequest(getIntegervRequest(c, ContextTag, Pname), cookie) 4950 return GetIntegervCookie{cookie} 4951 } 4952 4953 // GetIntegervUnchecked sends an unchecked request. 4954 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 4955 func GetIntegervUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetIntegervCookie { 4956 c.ExtLock.RLock() 4957 defer c.ExtLock.RUnlock() 4958 if _, ok := c.Extensions["GLX"]; !ok { 4959 panic("Cannot issue request 'GetIntegerv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 4960 } 4961 cookie := c.NewCookie(false, true) 4962 c.NewRequest(getIntegervRequest(c, ContextTag, Pname), cookie) 4963 return GetIntegervCookie{cookie} 4964 } 4965 4966 // GetIntegervReply represents the data returned from a GetIntegerv request. 4967 type GetIntegervReply struct { 4968 Sequence uint16 // sequence number of the request for this reply 4969 Length uint32 // number of bytes in this reply 4970 // padding: 1 bytes 4971 // padding: 4 bytes 4972 N uint32 4973 Datum int32 4974 // padding: 12 bytes 4975 Data []int32 // size: xgb.Pad((int(N) * 4)) 4976 } 4977 4978 // Reply blocks and returns the reply data for a GetIntegerv request. 4979 func (cook GetIntegervCookie) Reply() (*GetIntegervReply, error) { 4980 buf, err := cook.Cookie.Reply() 4981 if err != nil { 4982 return nil, err 4983 } 4984 if buf == nil { 4985 return nil, nil 4986 } 4987 return getIntegervReply(buf), nil 4988 } 4989 4990 // getIntegervReply reads a byte slice into a GetIntegervReply value. 4991 func getIntegervReply(buf []byte) *GetIntegervReply { 4992 v := new(GetIntegervReply) 4993 b := 1 // skip reply determinant 4994 4995 b += 1 // padding 4996 4997 v.Sequence = xgb.Get16(buf[b:]) 4998 b += 2 4999 5000 v.Length = xgb.Get32(buf[b:]) // 4-byte units 5001 b += 4 5002 5003 b += 4 // padding 5004 5005 v.N = xgb.Get32(buf[b:]) 5006 b += 4 5007 5008 v.Datum = int32(xgb.Get32(buf[b:])) 5009 b += 4 5010 5011 b += 12 // padding 5012 5013 v.Data = make([]int32, v.N) 5014 for i := 0; i < int(v.N); i++ { 5015 v.Data[i] = int32(xgb.Get32(buf[b:])) 5016 b += 4 5017 } 5018 5019 return v 5020 } 5021 5022 // Write request to wire for GetIntegerv 5023 // getIntegervRequest writes a GetIntegerv request to a byte slice. 5024 func getIntegervRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte { 5025 size := 12 5026 b := 0 5027 buf := make([]byte, size) 5028 5029 c.ExtLock.RLock() 5030 buf[b] = c.Extensions["GLX"] 5031 c.ExtLock.RUnlock() 5032 b += 1 5033 5034 buf[b] = 117 // request opcode 5035 b += 1 5036 5037 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 5038 b += 2 5039 5040 xgb.Put32(buf[b:], uint32(ContextTag)) 5041 b += 4 5042 5043 xgb.Put32(buf[b:], Pname) 5044 b += 4 5045 5046 return buf 5047 } 5048 5049 // GetLightfvCookie is a cookie used only for GetLightfv requests. 5050 type GetLightfvCookie struct { 5051 *xgb.Cookie 5052 } 5053 5054 // GetLightfv sends a checked request. 5055 // If an error occurs, it will be returned with the reply by calling GetLightfvCookie.Reply() 5056 func GetLightfv(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightfvCookie { 5057 c.ExtLock.RLock() 5058 defer c.ExtLock.RUnlock() 5059 if _, ok := c.Extensions["GLX"]; !ok { 5060 panic("Cannot issue request 'GetLightfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5061 } 5062 cookie := c.NewCookie(true, true) 5063 c.NewRequest(getLightfvRequest(c, ContextTag, Light, Pname), cookie) 5064 return GetLightfvCookie{cookie} 5065 } 5066 5067 // GetLightfvUnchecked sends an unchecked request. 5068 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 5069 func GetLightfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightfvCookie { 5070 c.ExtLock.RLock() 5071 defer c.ExtLock.RUnlock() 5072 if _, ok := c.Extensions["GLX"]; !ok { 5073 panic("Cannot issue request 'GetLightfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5074 } 5075 cookie := c.NewCookie(false, true) 5076 c.NewRequest(getLightfvRequest(c, ContextTag, Light, Pname), cookie) 5077 return GetLightfvCookie{cookie} 5078 } 5079 5080 // GetLightfvReply represents the data returned from a GetLightfv request. 5081 type GetLightfvReply struct { 5082 Sequence uint16 // sequence number of the request for this reply 5083 Length uint32 // number of bytes in this reply 5084 // padding: 1 bytes 5085 // padding: 4 bytes 5086 N uint32 5087 Datum Float32 5088 // padding: 12 bytes 5089 Data []Float32 // size: xgb.Pad((int(N) * 4)) 5090 } 5091 5092 // Reply blocks and returns the reply data for a GetLightfv request. 5093 func (cook GetLightfvCookie) Reply() (*GetLightfvReply, error) { 5094 buf, err := cook.Cookie.Reply() 5095 if err != nil { 5096 return nil, err 5097 } 5098 if buf == nil { 5099 return nil, nil 5100 } 5101 return getLightfvReply(buf), nil 5102 } 5103 5104 // getLightfvReply reads a byte slice into a GetLightfvReply value. 5105 func getLightfvReply(buf []byte) *GetLightfvReply { 5106 v := new(GetLightfvReply) 5107 b := 1 // skip reply determinant 5108 5109 b += 1 // padding 5110 5111 v.Sequence = xgb.Get16(buf[b:]) 5112 b += 2 5113 5114 v.Length = xgb.Get32(buf[b:]) // 4-byte units 5115 b += 4 5116 5117 b += 4 // padding 5118 5119 v.N = xgb.Get32(buf[b:]) 5120 b += 4 5121 5122 v.Datum = Float32(xgb.Get32(buf[b:])) 5123 b += 4 5124 5125 b += 12 // padding 5126 5127 v.Data = make([]Float32, v.N) 5128 for i := 0; i < int(v.N); i++ { 5129 v.Data[i] = Float32(xgb.Get32(buf[b:])) 5130 b += 4 5131 } 5132 5133 return v 5134 } 5135 5136 // Write request to wire for GetLightfv 5137 // getLightfvRequest writes a GetLightfv request to a byte slice. 5138 func getLightfvRequest(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) []byte { 5139 size := 16 5140 b := 0 5141 buf := make([]byte, size) 5142 5143 c.ExtLock.RLock() 5144 buf[b] = c.Extensions["GLX"] 5145 c.ExtLock.RUnlock() 5146 b += 1 5147 5148 buf[b] = 118 // request opcode 5149 b += 1 5150 5151 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 5152 b += 2 5153 5154 xgb.Put32(buf[b:], uint32(ContextTag)) 5155 b += 4 5156 5157 xgb.Put32(buf[b:], Light) 5158 b += 4 5159 5160 xgb.Put32(buf[b:], Pname) 5161 b += 4 5162 5163 return buf 5164 } 5165 5166 // GetLightivCookie is a cookie used only for GetLightiv requests. 5167 type GetLightivCookie struct { 5168 *xgb.Cookie 5169 } 5170 5171 // GetLightiv sends a checked request. 5172 // If an error occurs, it will be returned with the reply by calling GetLightivCookie.Reply() 5173 func GetLightiv(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightivCookie { 5174 c.ExtLock.RLock() 5175 defer c.ExtLock.RUnlock() 5176 if _, ok := c.Extensions["GLX"]; !ok { 5177 panic("Cannot issue request 'GetLightiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5178 } 5179 cookie := c.NewCookie(true, true) 5180 c.NewRequest(getLightivRequest(c, ContextTag, Light, Pname), cookie) 5181 return GetLightivCookie{cookie} 5182 } 5183 5184 // GetLightivUnchecked sends an unchecked request. 5185 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 5186 func GetLightivUnchecked(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightivCookie { 5187 c.ExtLock.RLock() 5188 defer c.ExtLock.RUnlock() 5189 if _, ok := c.Extensions["GLX"]; !ok { 5190 panic("Cannot issue request 'GetLightiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5191 } 5192 cookie := c.NewCookie(false, true) 5193 c.NewRequest(getLightivRequest(c, ContextTag, Light, Pname), cookie) 5194 return GetLightivCookie{cookie} 5195 } 5196 5197 // GetLightivReply represents the data returned from a GetLightiv request. 5198 type GetLightivReply struct { 5199 Sequence uint16 // sequence number of the request for this reply 5200 Length uint32 // number of bytes in this reply 5201 // padding: 1 bytes 5202 // padding: 4 bytes 5203 N uint32 5204 Datum int32 5205 // padding: 12 bytes 5206 Data []int32 // size: xgb.Pad((int(N) * 4)) 5207 } 5208 5209 // Reply blocks and returns the reply data for a GetLightiv request. 5210 func (cook GetLightivCookie) Reply() (*GetLightivReply, error) { 5211 buf, err := cook.Cookie.Reply() 5212 if err != nil { 5213 return nil, err 5214 } 5215 if buf == nil { 5216 return nil, nil 5217 } 5218 return getLightivReply(buf), nil 5219 } 5220 5221 // getLightivReply reads a byte slice into a GetLightivReply value. 5222 func getLightivReply(buf []byte) *GetLightivReply { 5223 v := new(GetLightivReply) 5224 b := 1 // skip reply determinant 5225 5226 b += 1 // padding 5227 5228 v.Sequence = xgb.Get16(buf[b:]) 5229 b += 2 5230 5231 v.Length = xgb.Get32(buf[b:]) // 4-byte units 5232 b += 4 5233 5234 b += 4 // padding 5235 5236 v.N = xgb.Get32(buf[b:]) 5237 b += 4 5238 5239 v.Datum = int32(xgb.Get32(buf[b:])) 5240 b += 4 5241 5242 b += 12 // padding 5243 5244 v.Data = make([]int32, v.N) 5245 for i := 0; i < int(v.N); i++ { 5246 v.Data[i] = int32(xgb.Get32(buf[b:])) 5247 b += 4 5248 } 5249 5250 return v 5251 } 5252 5253 // Write request to wire for GetLightiv 5254 // getLightivRequest writes a GetLightiv request to a byte slice. 5255 func getLightivRequest(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) []byte { 5256 size := 16 5257 b := 0 5258 buf := make([]byte, size) 5259 5260 c.ExtLock.RLock() 5261 buf[b] = c.Extensions["GLX"] 5262 c.ExtLock.RUnlock() 5263 b += 1 5264 5265 buf[b] = 119 // request opcode 5266 b += 1 5267 5268 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 5269 b += 2 5270 5271 xgb.Put32(buf[b:], uint32(ContextTag)) 5272 b += 4 5273 5274 xgb.Put32(buf[b:], Light) 5275 b += 4 5276 5277 xgb.Put32(buf[b:], Pname) 5278 b += 4 5279 5280 return buf 5281 } 5282 5283 // GetMapdvCookie is a cookie used only for GetMapdv requests. 5284 type GetMapdvCookie struct { 5285 *xgb.Cookie 5286 } 5287 5288 // GetMapdv sends a checked request. 5289 // If an error occurs, it will be returned with the reply by calling GetMapdvCookie.Reply() 5290 func GetMapdv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapdvCookie { 5291 c.ExtLock.RLock() 5292 defer c.ExtLock.RUnlock() 5293 if _, ok := c.Extensions["GLX"]; !ok { 5294 panic("Cannot issue request 'GetMapdv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5295 } 5296 cookie := c.NewCookie(true, true) 5297 c.NewRequest(getMapdvRequest(c, ContextTag, Target, Query), cookie) 5298 return GetMapdvCookie{cookie} 5299 } 5300 5301 // GetMapdvUnchecked sends an unchecked request. 5302 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 5303 func GetMapdvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapdvCookie { 5304 c.ExtLock.RLock() 5305 defer c.ExtLock.RUnlock() 5306 if _, ok := c.Extensions["GLX"]; !ok { 5307 panic("Cannot issue request 'GetMapdv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5308 } 5309 cookie := c.NewCookie(false, true) 5310 c.NewRequest(getMapdvRequest(c, ContextTag, Target, Query), cookie) 5311 return GetMapdvCookie{cookie} 5312 } 5313 5314 // GetMapdvReply represents the data returned from a GetMapdv request. 5315 type GetMapdvReply struct { 5316 Sequence uint16 // sequence number of the request for this reply 5317 Length uint32 // number of bytes in this reply 5318 // padding: 1 bytes 5319 // padding: 4 bytes 5320 N uint32 5321 Datum Float64 5322 // padding: 8 bytes 5323 Data []Float64 // size: xgb.Pad((int(N) * 8)) 5324 } 5325 5326 // Reply blocks and returns the reply data for a GetMapdv request. 5327 func (cook GetMapdvCookie) Reply() (*GetMapdvReply, error) { 5328 buf, err := cook.Cookie.Reply() 5329 if err != nil { 5330 return nil, err 5331 } 5332 if buf == nil { 5333 return nil, nil 5334 } 5335 return getMapdvReply(buf), nil 5336 } 5337 5338 // getMapdvReply reads a byte slice into a GetMapdvReply value. 5339 func getMapdvReply(buf []byte) *GetMapdvReply { 5340 v := new(GetMapdvReply) 5341 b := 1 // skip reply determinant 5342 5343 b += 1 // padding 5344 5345 v.Sequence = xgb.Get16(buf[b:]) 5346 b += 2 5347 5348 v.Length = xgb.Get32(buf[b:]) // 4-byte units 5349 b += 4 5350 5351 b += 4 // padding 5352 5353 v.N = xgb.Get32(buf[b:]) 5354 b += 4 5355 5356 v.Datum = Float64(xgb.Get64(buf[b:])) 5357 b += 8 5358 5359 b += 8 // padding 5360 5361 v.Data = make([]Float64, v.N) 5362 for i := 0; i < int(v.N); i++ { 5363 v.Data[i] = Float64(xgb.Get64(buf[b:])) 5364 b += 8 5365 } 5366 5367 return v 5368 } 5369 5370 // Write request to wire for GetMapdv 5371 // getMapdvRequest writes a GetMapdv request to a byte slice. 5372 func getMapdvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) []byte { 5373 size := 16 5374 b := 0 5375 buf := make([]byte, size) 5376 5377 c.ExtLock.RLock() 5378 buf[b] = c.Extensions["GLX"] 5379 c.ExtLock.RUnlock() 5380 b += 1 5381 5382 buf[b] = 120 // request opcode 5383 b += 1 5384 5385 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 5386 b += 2 5387 5388 xgb.Put32(buf[b:], uint32(ContextTag)) 5389 b += 4 5390 5391 xgb.Put32(buf[b:], Target) 5392 b += 4 5393 5394 xgb.Put32(buf[b:], Query) 5395 b += 4 5396 5397 return buf 5398 } 5399 5400 // GetMapfvCookie is a cookie used only for GetMapfv requests. 5401 type GetMapfvCookie struct { 5402 *xgb.Cookie 5403 } 5404 5405 // GetMapfv sends a checked request. 5406 // If an error occurs, it will be returned with the reply by calling GetMapfvCookie.Reply() 5407 func GetMapfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapfvCookie { 5408 c.ExtLock.RLock() 5409 defer c.ExtLock.RUnlock() 5410 if _, ok := c.Extensions["GLX"]; !ok { 5411 panic("Cannot issue request 'GetMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5412 } 5413 cookie := c.NewCookie(true, true) 5414 c.NewRequest(getMapfvRequest(c, ContextTag, Target, Query), cookie) 5415 return GetMapfvCookie{cookie} 5416 } 5417 5418 // GetMapfvUnchecked sends an unchecked request. 5419 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 5420 func GetMapfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapfvCookie { 5421 c.ExtLock.RLock() 5422 defer c.ExtLock.RUnlock() 5423 if _, ok := c.Extensions["GLX"]; !ok { 5424 panic("Cannot issue request 'GetMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5425 } 5426 cookie := c.NewCookie(false, true) 5427 c.NewRequest(getMapfvRequest(c, ContextTag, Target, Query), cookie) 5428 return GetMapfvCookie{cookie} 5429 } 5430 5431 // GetMapfvReply represents the data returned from a GetMapfv request. 5432 type GetMapfvReply struct { 5433 Sequence uint16 // sequence number of the request for this reply 5434 Length uint32 // number of bytes in this reply 5435 // padding: 1 bytes 5436 // padding: 4 bytes 5437 N uint32 5438 Datum Float32 5439 // padding: 12 bytes 5440 Data []Float32 // size: xgb.Pad((int(N) * 4)) 5441 } 5442 5443 // Reply blocks and returns the reply data for a GetMapfv request. 5444 func (cook GetMapfvCookie) Reply() (*GetMapfvReply, error) { 5445 buf, err := cook.Cookie.Reply() 5446 if err != nil { 5447 return nil, err 5448 } 5449 if buf == nil { 5450 return nil, nil 5451 } 5452 return getMapfvReply(buf), nil 5453 } 5454 5455 // getMapfvReply reads a byte slice into a GetMapfvReply value. 5456 func getMapfvReply(buf []byte) *GetMapfvReply { 5457 v := new(GetMapfvReply) 5458 b := 1 // skip reply determinant 5459 5460 b += 1 // padding 5461 5462 v.Sequence = xgb.Get16(buf[b:]) 5463 b += 2 5464 5465 v.Length = xgb.Get32(buf[b:]) // 4-byte units 5466 b += 4 5467 5468 b += 4 // padding 5469 5470 v.N = xgb.Get32(buf[b:]) 5471 b += 4 5472 5473 v.Datum = Float32(xgb.Get32(buf[b:])) 5474 b += 4 5475 5476 b += 12 // padding 5477 5478 v.Data = make([]Float32, v.N) 5479 for i := 0; i < int(v.N); i++ { 5480 v.Data[i] = Float32(xgb.Get32(buf[b:])) 5481 b += 4 5482 } 5483 5484 return v 5485 } 5486 5487 // Write request to wire for GetMapfv 5488 // getMapfvRequest writes a GetMapfv request to a byte slice. 5489 func getMapfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) []byte { 5490 size := 16 5491 b := 0 5492 buf := make([]byte, size) 5493 5494 c.ExtLock.RLock() 5495 buf[b] = c.Extensions["GLX"] 5496 c.ExtLock.RUnlock() 5497 b += 1 5498 5499 buf[b] = 121 // request opcode 5500 b += 1 5501 5502 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 5503 b += 2 5504 5505 xgb.Put32(buf[b:], uint32(ContextTag)) 5506 b += 4 5507 5508 xgb.Put32(buf[b:], Target) 5509 b += 4 5510 5511 xgb.Put32(buf[b:], Query) 5512 b += 4 5513 5514 return buf 5515 } 5516 5517 // GetMapivCookie is a cookie used only for GetMapiv requests. 5518 type GetMapivCookie struct { 5519 *xgb.Cookie 5520 } 5521 5522 // GetMapiv sends a checked request. 5523 // If an error occurs, it will be returned with the reply by calling GetMapivCookie.Reply() 5524 func GetMapiv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapivCookie { 5525 c.ExtLock.RLock() 5526 defer c.ExtLock.RUnlock() 5527 if _, ok := c.Extensions["GLX"]; !ok { 5528 panic("Cannot issue request 'GetMapiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5529 } 5530 cookie := c.NewCookie(true, true) 5531 c.NewRequest(getMapivRequest(c, ContextTag, Target, Query), cookie) 5532 return GetMapivCookie{cookie} 5533 } 5534 5535 // GetMapivUnchecked sends an unchecked request. 5536 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 5537 func GetMapivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapivCookie { 5538 c.ExtLock.RLock() 5539 defer c.ExtLock.RUnlock() 5540 if _, ok := c.Extensions["GLX"]; !ok { 5541 panic("Cannot issue request 'GetMapiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5542 } 5543 cookie := c.NewCookie(false, true) 5544 c.NewRequest(getMapivRequest(c, ContextTag, Target, Query), cookie) 5545 return GetMapivCookie{cookie} 5546 } 5547 5548 // GetMapivReply represents the data returned from a GetMapiv request. 5549 type GetMapivReply struct { 5550 Sequence uint16 // sequence number of the request for this reply 5551 Length uint32 // number of bytes in this reply 5552 // padding: 1 bytes 5553 // padding: 4 bytes 5554 N uint32 5555 Datum int32 5556 // padding: 12 bytes 5557 Data []int32 // size: xgb.Pad((int(N) * 4)) 5558 } 5559 5560 // Reply blocks and returns the reply data for a GetMapiv request. 5561 func (cook GetMapivCookie) Reply() (*GetMapivReply, error) { 5562 buf, err := cook.Cookie.Reply() 5563 if err != nil { 5564 return nil, err 5565 } 5566 if buf == nil { 5567 return nil, nil 5568 } 5569 return getMapivReply(buf), nil 5570 } 5571 5572 // getMapivReply reads a byte slice into a GetMapivReply value. 5573 func getMapivReply(buf []byte) *GetMapivReply { 5574 v := new(GetMapivReply) 5575 b := 1 // skip reply determinant 5576 5577 b += 1 // padding 5578 5579 v.Sequence = xgb.Get16(buf[b:]) 5580 b += 2 5581 5582 v.Length = xgb.Get32(buf[b:]) // 4-byte units 5583 b += 4 5584 5585 b += 4 // padding 5586 5587 v.N = xgb.Get32(buf[b:]) 5588 b += 4 5589 5590 v.Datum = int32(xgb.Get32(buf[b:])) 5591 b += 4 5592 5593 b += 12 // padding 5594 5595 v.Data = make([]int32, v.N) 5596 for i := 0; i < int(v.N); i++ { 5597 v.Data[i] = int32(xgb.Get32(buf[b:])) 5598 b += 4 5599 } 5600 5601 return v 5602 } 5603 5604 // Write request to wire for GetMapiv 5605 // getMapivRequest writes a GetMapiv request to a byte slice. 5606 func getMapivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) []byte { 5607 size := 16 5608 b := 0 5609 buf := make([]byte, size) 5610 5611 c.ExtLock.RLock() 5612 buf[b] = c.Extensions["GLX"] 5613 c.ExtLock.RUnlock() 5614 b += 1 5615 5616 buf[b] = 122 // request opcode 5617 b += 1 5618 5619 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 5620 b += 2 5621 5622 xgb.Put32(buf[b:], uint32(ContextTag)) 5623 b += 4 5624 5625 xgb.Put32(buf[b:], Target) 5626 b += 4 5627 5628 xgb.Put32(buf[b:], Query) 5629 b += 4 5630 5631 return buf 5632 } 5633 5634 // GetMaterialfvCookie is a cookie used only for GetMaterialfv requests. 5635 type GetMaterialfvCookie struct { 5636 *xgb.Cookie 5637 } 5638 5639 // GetMaterialfv sends a checked request. 5640 // If an error occurs, it will be returned with the reply by calling GetMaterialfvCookie.Reply() 5641 func GetMaterialfv(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialfvCookie { 5642 c.ExtLock.RLock() 5643 defer c.ExtLock.RUnlock() 5644 if _, ok := c.Extensions["GLX"]; !ok { 5645 panic("Cannot issue request 'GetMaterialfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5646 } 5647 cookie := c.NewCookie(true, true) 5648 c.NewRequest(getMaterialfvRequest(c, ContextTag, Face, Pname), cookie) 5649 return GetMaterialfvCookie{cookie} 5650 } 5651 5652 // GetMaterialfvUnchecked sends an unchecked request. 5653 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 5654 func GetMaterialfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialfvCookie { 5655 c.ExtLock.RLock() 5656 defer c.ExtLock.RUnlock() 5657 if _, ok := c.Extensions["GLX"]; !ok { 5658 panic("Cannot issue request 'GetMaterialfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5659 } 5660 cookie := c.NewCookie(false, true) 5661 c.NewRequest(getMaterialfvRequest(c, ContextTag, Face, Pname), cookie) 5662 return GetMaterialfvCookie{cookie} 5663 } 5664 5665 // GetMaterialfvReply represents the data returned from a GetMaterialfv request. 5666 type GetMaterialfvReply struct { 5667 Sequence uint16 // sequence number of the request for this reply 5668 Length uint32 // number of bytes in this reply 5669 // padding: 1 bytes 5670 // padding: 4 bytes 5671 N uint32 5672 Datum Float32 5673 // padding: 12 bytes 5674 Data []Float32 // size: xgb.Pad((int(N) * 4)) 5675 } 5676 5677 // Reply blocks and returns the reply data for a GetMaterialfv request. 5678 func (cook GetMaterialfvCookie) Reply() (*GetMaterialfvReply, error) { 5679 buf, err := cook.Cookie.Reply() 5680 if err != nil { 5681 return nil, err 5682 } 5683 if buf == nil { 5684 return nil, nil 5685 } 5686 return getMaterialfvReply(buf), nil 5687 } 5688 5689 // getMaterialfvReply reads a byte slice into a GetMaterialfvReply value. 5690 func getMaterialfvReply(buf []byte) *GetMaterialfvReply { 5691 v := new(GetMaterialfvReply) 5692 b := 1 // skip reply determinant 5693 5694 b += 1 // padding 5695 5696 v.Sequence = xgb.Get16(buf[b:]) 5697 b += 2 5698 5699 v.Length = xgb.Get32(buf[b:]) // 4-byte units 5700 b += 4 5701 5702 b += 4 // padding 5703 5704 v.N = xgb.Get32(buf[b:]) 5705 b += 4 5706 5707 v.Datum = Float32(xgb.Get32(buf[b:])) 5708 b += 4 5709 5710 b += 12 // padding 5711 5712 v.Data = make([]Float32, v.N) 5713 for i := 0; i < int(v.N); i++ { 5714 v.Data[i] = Float32(xgb.Get32(buf[b:])) 5715 b += 4 5716 } 5717 5718 return v 5719 } 5720 5721 // Write request to wire for GetMaterialfv 5722 // getMaterialfvRequest writes a GetMaterialfv request to a byte slice. 5723 func getMaterialfvRequest(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) []byte { 5724 size := 16 5725 b := 0 5726 buf := make([]byte, size) 5727 5728 c.ExtLock.RLock() 5729 buf[b] = c.Extensions["GLX"] 5730 c.ExtLock.RUnlock() 5731 b += 1 5732 5733 buf[b] = 123 // request opcode 5734 b += 1 5735 5736 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 5737 b += 2 5738 5739 xgb.Put32(buf[b:], uint32(ContextTag)) 5740 b += 4 5741 5742 xgb.Put32(buf[b:], Face) 5743 b += 4 5744 5745 xgb.Put32(buf[b:], Pname) 5746 b += 4 5747 5748 return buf 5749 } 5750 5751 // GetMaterialivCookie is a cookie used only for GetMaterialiv requests. 5752 type GetMaterialivCookie struct { 5753 *xgb.Cookie 5754 } 5755 5756 // GetMaterialiv sends a checked request. 5757 // If an error occurs, it will be returned with the reply by calling GetMaterialivCookie.Reply() 5758 func GetMaterialiv(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialivCookie { 5759 c.ExtLock.RLock() 5760 defer c.ExtLock.RUnlock() 5761 if _, ok := c.Extensions["GLX"]; !ok { 5762 panic("Cannot issue request 'GetMaterialiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5763 } 5764 cookie := c.NewCookie(true, true) 5765 c.NewRequest(getMaterialivRequest(c, ContextTag, Face, Pname), cookie) 5766 return GetMaterialivCookie{cookie} 5767 } 5768 5769 // GetMaterialivUnchecked sends an unchecked request. 5770 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 5771 func GetMaterialivUnchecked(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialivCookie { 5772 c.ExtLock.RLock() 5773 defer c.ExtLock.RUnlock() 5774 if _, ok := c.Extensions["GLX"]; !ok { 5775 panic("Cannot issue request 'GetMaterialiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5776 } 5777 cookie := c.NewCookie(false, true) 5778 c.NewRequest(getMaterialivRequest(c, ContextTag, Face, Pname), cookie) 5779 return GetMaterialivCookie{cookie} 5780 } 5781 5782 // GetMaterialivReply represents the data returned from a GetMaterialiv request. 5783 type GetMaterialivReply struct { 5784 Sequence uint16 // sequence number of the request for this reply 5785 Length uint32 // number of bytes in this reply 5786 // padding: 1 bytes 5787 // padding: 4 bytes 5788 N uint32 5789 Datum int32 5790 // padding: 12 bytes 5791 Data []int32 // size: xgb.Pad((int(N) * 4)) 5792 } 5793 5794 // Reply blocks and returns the reply data for a GetMaterialiv request. 5795 func (cook GetMaterialivCookie) Reply() (*GetMaterialivReply, error) { 5796 buf, err := cook.Cookie.Reply() 5797 if err != nil { 5798 return nil, err 5799 } 5800 if buf == nil { 5801 return nil, nil 5802 } 5803 return getMaterialivReply(buf), nil 5804 } 5805 5806 // getMaterialivReply reads a byte slice into a GetMaterialivReply value. 5807 func getMaterialivReply(buf []byte) *GetMaterialivReply { 5808 v := new(GetMaterialivReply) 5809 b := 1 // skip reply determinant 5810 5811 b += 1 // padding 5812 5813 v.Sequence = xgb.Get16(buf[b:]) 5814 b += 2 5815 5816 v.Length = xgb.Get32(buf[b:]) // 4-byte units 5817 b += 4 5818 5819 b += 4 // padding 5820 5821 v.N = xgb.Get32(buf[b:]) 5822 b += 4 5823 5824 v.Datum = int32(xgb.Get32(buf[b:])) 5825 b += 4 5826 5827 b += 12 // padding 5828 5829 v.Data = make([]int32, v.N) 5830 for i := 0; i < int(v.N); i++ { 5831 v.Data[i] = int32(xgb.Get32(buf[b:])) 5832 b += 4 5833 } 5834 5835 return v 5836 } 5837 5838 // Write request to wire for GetMaterialiv 5839 // getMaterialivRequest writes a GetMaterialiv request to a byte slice. 5840 func getMaterialivRequest(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) []byte { 5841 size := 16 5842 b := 0 5843 buf := make([]byte, size) 5844 5845 c.ExtLock.RLock() 5846 buf[b] = c.Extensions["GLX"] 5847 c.ExtLock.RUnlock() 5848 b += 1 5849 5850 buf[b] = 124 // request opcode 5851 b += 1 5852 5853 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 5854 b += 2 5855 5856 xgb.Put32(buf[b:], uint32(ContextTag)) 5857 b += 4 5858 5859 xgb.Put32(buf[b:], Face) 5860 b += 4 5861 5862 xgb.Put32(buf[b:], Pname) 5863 b += 4 5864 5865 return buf 5866 } 5867 5868 // GetMinmaxCookie is a cookie used only for GetMinmax requests. 5869 type GetMinmaxCookie struct { 5870 *xgb.Cookie 5871 } 5872 5873 // GetMinmax sends a checked request. 5874 // If an error occurs, it will be returned with the reply by calling GetMinmaxCookie.Reply() 5875 func GetMinmax(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetMinmaxCookie { 5876 c.ExtLock.RLock() 5877 defer c.ExtLock.RUnlock() 5878 if _, ok := c.Extensions["GLX"]; !ok { 5879 panic("Cannot issue request 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5880 } 5881 cookie := c.NewCookie(true, true) 5882 c.NewRequest(getMinmaxRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) 5883 return GetMinmaxCookie{cookie} 5884 } 5885 5886 // GetMinmaxUnchecked sends an unchecked request. 5887 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 5888 func GetMinmaxUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetMinmaxCookie { 5889 c.ExtLock.RLock() 5890 defer c.ExtLock.RUnlock() 5891 if _, ok := c.Extensions["GLX"]; !ok { 5892 panic("Cannot issue request 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 5893 } 5894 cookie := c.NewCookie(false, true) 5895 c.NewRequest(getMinmaxRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) 5896 return GetMinmaxCookie{cookie} 5897 } 5898 5899 // GetMinmaxReply represents the data returned from a GetMinmax request. 5900 type GetMinmaxReply struct { 5901 Sequence uint16 // sequence number of the request for this reply 5902 Length uint32 // number of bytes in this reply 5903 // padding: 1 bytes 5904 // padding: 24 bytes 5905 Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 5906 } 5907 5908 // Reply blocks and returns the reply data for a GetMinmax request. 5909 func (cook GetMinmaxCookie) Reply() (*GetMinmaxReply, error) { 5910 buf, err := cook.Cookie.Reply() 5911 if err != nil { 5912 return nil, err 5913 } 5914 if buf == nil { 5915 return nil, nil 5916 } 5917 return getMinmaxReply(buf), nil 5918 } 5919 5920 // getMinmaxReply reads a byte slice into a GetMinmaxReply value. 5921 func getMinmaxReply(buf []byte) *GetMinmaxReply { 5922 v := new(GetMinmaxReply) 5923 b := 1 // skip reply determinant 5924 5925 b += 1 // padding 5926 5927 v.Sequence = xgb.Get16(buf[b:]) 5928 b += 2 5929 5930 v.Length = xgb.Get32(buf[b:]) // 4-byte units 5931 b += 4 5932 5933 b += 24 // padding 5934 5935 v.Data = make([]byte, (int(v.Length) * 4)) 5936 copy(v.Data[:(int(v.Length)*4)], buf[b:]) 5937 b += int((int(v.Length) * 4)) 5938 5939 return v 5940 } 5941 5942 // Write request to wire for GetMinmax 5943 // getMinmaxRequest writes a GetMinmax request to a byte slice. 5944 func getMinmaxRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) []byte { 5945 size := 24 5946 b := 0 5947 buf := make([]byte, size) 5948 5949 c.ExtLock.RLock() 5950 buf[b] = c.Extensions["GLX"] 5951 c.ExtLock.RUnlock() 5952 b += 1 5953 5954 buf[b] = 157 // request opcode 5955 b += 1 5956 5957 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 5958 b += 2 5959 5960 xgb.Put32(buf[b:], uint32(ContextTag)) 5961 b += 4 5962 5963 xgb.Put32(buf[b:], Target) 5964 b += 4 5965 5966 xgb.Put32(buf[b:], Format) 5967 b += 4 5968 5969 xgb.Put32(buf[b:], Type) 5970 b += 4 5971 5972 if SwapBytes { 5973 buf[b] = 1 5974 } else { 5975 buf[b] = 0 5976 } 5977 b += 1 5978 5979 if Reset { 5980 buf[b] = 1 5981 } else { 5982 buf[b] = 0 5983 } 5984 b += 1 5985 5986 return buf 5987 } 5988 5989 // GetMinmaxParameterfvCookie is a cookie used only for GetMinmaxParameterfv requests. 5990 type GetMinmaxParameterfvCookie struct { 5991 *xgb.Cookie 5992 } 5993 5994 // GetMinmaxParameterfv sends a checked request. 5995 // If an error occurs, it will be returned with the reply by calling GetMinmaxParameterfvCookie.Reply() 5996 func GetMinmaxParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterfvCookie { 5997 c.ExtLock.RLock() 5998 defer c.ExtLock.RUnlock() 5999 if _, ok := c.Extensions["GLX"]; !ok { 6000 panic("Cannot issue request 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6001 } 6002 cookie := c.NewCookie(true, true) 6003 c.NewRequest(getMinmaxParameterfvRequest(c, ContextTag, Target, Pname), cookie) 6004 return GetMinmaxParameterfvCookie{cookie} 6005 } 6006 6007 // GetMinmaxParameterfvUnchecked sends an unchecked request. 6008 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 6009 func GetMinmaxParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterfvCookie { 6010 c.ExtLock.RLock() 6011 defer c.ExtLock.RUnlock() 6012 if _, ok := c.Extensions["GLX"]; !ok { 6013 panic("Cannot issue request 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6014 } 6015 cookie := c.NewCookie(false, true) 6016 c.NewRequest(getMinmaxParameterfvRequest(c, ContextTag, Target, Pname), cookie) 6017 return GetMinmaxParameterfvCookie{cookie} 6018 } 6019 6020 // GetMinmaxParameterfvReply represents the data returned from a GetMinmaxParameterfv request. 6021 type GetMinmaxParameterfvReply struct { 6022 Sequence uint16 // sequence number of the request for this reply 6023 Length uint32 // number of bytes in this reply 6024 // padding: 1 bytes 6025 // padding: 4 bytes 6026 N uint32 6027 Datum Float32 6028 // padding: 12 bytes 6029 Data []Float32 // size: xgb.Pad((int(N) * 4)) 6030 } 6031 6032 // Reply blocks and returns the reply data for a GetMinmaxParameterfv request. 6033 func (cook GetMinmaxParameterfvCookie) Reply() (*GetMinmaxParameterfvReply, error) { 6034 buf, err := cook.Cookie.Reply() 6035 if err != nil { 6036 return nil, err 6037 } 6038 if buf == nil { 6039 return nil, nil 6040 } 6041 return getMinmaxParameterfvReply(buf), nil 6042 } 6043 6044 // getMinmaxParameterfvReply reads a byte slice into a GetMinmaxParameterfvReply value. 6045 func getMinmaxParameterfvReply(buf []byte) *GetMinmaxParameterfvReply { 6046 v := new(GetMinmaxParameterfvReply) 6047 b := 1 // skip reply determinant 6048 6049 b += 1 // padding 6050 6051 v.Sequence = xgb.Get16(buf[b:]) 6052 b += 2 6053 6054 v.Length = xgb.Get32(buf[b:]) // 4-byte units 6055 b += 4 6056 6057 b += 4 // padding 6058 6059 v.N = xgb.Get32(buf[b:]) 6060 b += 4 6061 6062 v.Datum = Float32(xgb.Get32(buf[b:])) 6063 b += 4 6064 6065 b += 12 // padding 6066 6067 v.Data = make([]Float32, v.N) 6068 for i := 0; i < int(v.N); i++ { 6069 v.Data[i] = Float32(xgb.Get32(buf[b:])) 6070 b += 4 6071 } 6072 6073 return v 6074 } 6075 6076 // Write request to wire for GetMinmaxParameterfv 6077 // getMinmaxParameterfvRequest writes a GetMinmaxParameterfv request to a byte slice. 6078 func getMinmaxParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 6079 size := 16 6080 b := 0 6081 buf := make([]byte, size) 6082 6083 c.ExtLock.RLock() 6084 buf[b] = c.Extensions["GLX"] 6085 c.ExtLock.RUnlock() 6086 b += 1 6087 6088 buf[b] = 158 // request opcode 6089 b += 1 6090 6091 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 6092 b += 2 6093 6094 xgb.Put32(buf[b:], uint32(ContextTag)) 6095 b += 4 6096 6097 xgb.Put32(buf[b:], Target) 6098 b += 4 6099 6100 xgb.Put32(buf[b:], Pname) 6101 b += 4 6102 6103 return buf 6104 } 6105 6106 // GetMinmaxParameterivCookie is a cookie used only for GetMinmaxParameteriv requests. 6107 type GetMinmaxParameterivCookie struct { 6108 *xgb.Cookie 6109 } 6110 6111 // GetMinmaxParameteriv sends a checked request. 6112 // If an error occurs, it will be returned with the reply by calling GetMinmaxParameterivCookie.Reply() 6113 func GetMinmaxParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterivCookie { 6114 c.ExtLock.RLock() 6115 defer c.ExtLock.RUnlock() 6116 if _, ok := c.Extensions["GLX"]; !ok { 6117 panic("Cannot issue request 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6118 } 6119 cookie := c.NewCookie(true, true) 6120 c.NewRequest(getMinmaxParameterivRequest(c, ContextTag, Target, Pname), cookie) 6121 return GetMinmaxParameterivCookie{cookie} 6122 } 6123 6124 // GetMinmaxParameterivUnchecked sends an unchecked request. 6125 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 6126 func GetMinmaxParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterivCookie { 6127 c.ExtLock.RLock() 6128 defer c.ExtLock.RUnlock() 6129 if _, ok := c.Extensions["GLX"]; !ok { 6130 panic("Cannot issue request 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6131 } 6132 cookie := c.NewCookie(false, true) 6133 c.NewRequest(getMinmaxParameterivRequest(c, ContextTag, Target, Pname), cookie) 6134 return GetMinmaxParameterivCookie{cookie} 6135 } 6136 6137 // GetMinmaxParameterivReply represents the data returned from a GetMinmaxParameteriv request. 6138 type GetMinmaxParameterivReply struct { 6139 Sequence uint16 // sequence number of the request for this reply 6140 Length uint32 // number of bytes in this reply 6141 // padding: 1 bytes 6142 // padding: 4 bytes 6143 N uint32 6144 Datum int32 6145 // padding: 12 bytes 6146 Data []int32 // size: xgb.Pad((int(N) * 4)) 6147 } 6148 6149 // Reply blocks and returns the reply data for a GetMinmaxParameteriv request. 6150 func (cook GetMinmaxParameterivCookie) Reply() (*GetMinmaxParameterivReply, error) { 6151 buf, err := cook.Cookie.Reply() 6152 if err != nil { 6153 return nil, err 6154 } 6155 if buf == nil { 6156 return nil, nil 6157 } 6158 return getMinmaxParameterivReply(buf), nil 6159 } 6160 6161 // getMinmaxParameterivReply reads a byte slice into a GetMinmaxParameterivReply value. 6162 func getMinmaxParameterivReply(buf []byte) *GetMinmaxParameterivReply { 6163 v := new(GetMinmaxParameterivReply) 6164 b := 1 // skip reply determinant 6165 6166 b += 1 // padding 6167 6168 v.Sequence = xgb.Get16(buf[b:]) 6169 b += 2 6170 6171 v.Length = xgb.Get32(buf[b:]) // 4-byte units 6172 b += 4 6173 6174 b += 4 // padding 6175 6176 v.N = xgb.Get32(buf[b:]) 6177 b += 4 6178 6179 v.Datum = int32(xgb.Get32(buf[b:])) 6180 b += 4 6181 6182 b += 12 // padding 6183 6184 v.Data = make([]int32, v.N) 6185 for i := 0; i < int(v.N); i++ { 6186 v.Data[i] = int32(xgb.Get32(buf[b:])) 6187 b += 4 6188 } 6189 6190 return v 6191 } 6192 6193 // Write request to wire for GetMinmaxParameteriv 6194 // getMinmaxParameterivRequest writes a GetMinmaxParameteriv request to a byte slice. 6195 func getMinmaxParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 6196 size := 16 6197 b := 0 6198 buf := make([]byte, size) 6199 6200 c.ExtLock.RLock() 6201 buf[b] = c.Extensions["GLX"] 6202 c.ExtLock.RUnlock() 6203 b += 1 6204 6205 buf[b] = 159 // request opcode 6206 b += 1 6207 6208 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 6209 b += 2 6210 6211 xgb.Put32(buf[b:], uint32(ContextTag)) 6212 b += 4 6213 6214 xgb.Put32(buf[b:], Target) 6215 b += 4 6216 6217 xgb.Put32(buf[b:], Pname) 6218 b += 4 6219 6220 return buf 6221 } 6222 6223 // GetPixelMapfvCookie is a cookie used only for GetPixelMapfv requests. 6224 type GetPixelMapfvCookie struct { 6225 *xgb.Cookie 6226 } 6227 6228 // GetPixelMapfv sends a checked request. 6229 // If an error occurs, it will be returned with the reply by calling GetPixelMapfvCookie.Reply() 6230 func GetPixelMapfv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapfvCookie { 6231 c.ExtLock.RLock() 6232 defer c.ExtLock.RUnlock() 6233 if _, ok := c.Extensions["GLX"]; !ok { 6234 panic("Cannot issue request 'GetPixelMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6235 } 6236 cookie := c.NewCookie(true, true) 6237 c.NewRequest(getPixelMapfvRequest(c, ContextTag, Map), cookie) 6238 return GetPixelMapfvCookie{cookie} 6239 } 6240 6241 // GetPixelMapfvUnchecked sends an unchecked request. 6242 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 6243 func GetPixelMapfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapfvCookie { 6244 c.ExtLock.RLock() 6245 defer c.ExtLock.RUnlock() 6246 if _, ok := c.Extensions["GLX"]; !ok { 6247 panic("Cannot issue request 'GetPixelMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6248 } 6249 cookie := c.NewCookie(false, true) 6250 c.NewRequest(getPixelMapfvRequest(c, ContextTag, Map), cookie) 6251 return GetPixelMapfvCookie{cookie} 6252 } 6253 6254 // GetPixelMapfvReply represents the data returned from a GetPixelMapfv request. 6255 type GetPixelMapfvReply struct { 6256 Sequence uint16 // sequence number of the request for this reply 6257 Length uint32 // number of bytes in this reply 6258 // padding: 1 bytes 6259 // padding: 4 bytes 6260 N uint32 6261 Datum Float32 6262 // padding: 12 bytes 6263 Data []Float32 // size: xgb.Pad((int(N) * 4)) 6264 } 6265 6266 // Reply blocks and returns the reply data for a GetPixelMapfv request. 6267 func (cook GetPixelMapfvCookie) Reply() (*GetPixelMapfvReply, error) { 6268 buf, err := cook.Cookie.Reply() 6269 if err != nil { 6270 return nil, err 6271 } 6272 if buf == nil { 6273 return nil, nil 6274 } 6275 return getPixelMapfvReply(buf), nil 6276 } 6277 6278 // getPixelMapfvReply reads a byte slice into a GetPixelMapfvReply value. 6279 func getPixelMapfvReply(buf []byte) *GetPixelMapfvReply { 6280 v := new(GetPixelMapfvReply) 6281 b := 1 // skip reply determinant 6282 6283 b += 1 // padding 6284 6285 v.Sequence = xgb.Get16(buf[b:]) 6286 b += 2 6287 6288 v.Length = xgb.Get32(buf[b:]) // 4-byte units 6289 b += 4 6290 6291 b += 4 // padding 6292 6293 v.N = xgb.Get32(buf[b:]) 6294 b += 4 6295 6296 v.Datum = Float32(xgb.Get32(buf[b:])) 6297 b += 4 6298 6299 b += 12 // padding 6300 6301 v.Data = make([]Float32, v.N) 6302 for i := 0; i < int(v.N); i++ { 6303 v.Data[i] = Float32(xgb.Get32(buf[b:])) 6304 b += 4 6305 } 6306 6307 return v 6308 } 6309 6310 // Write request to wire for GetPixelMapfv 6311 // getPixelMapfvRequest writes a GetPixelMapfv request to a byte slice. 6312 func getPixelMapfvRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte { 6313 size := 12 6314 b := 0 6315 buf := make([]byte, size) 6316 6317 c.ExtLock.RLock() 6318 buf[b] = c.Extensions["GLX"] 6319 c.ExtLock.RUnlock() 6320 b += 1 6321 6322 buf[b] = 125 // request opcode 6323 b += 1 6324 6325 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 6326 b += 2 6327 6328 xgb.Put32(buf[b:], uint32(ContextTag)) 6329 b += 4 6330 6331 xgb.Put32(buf[b:], Map) 6332 b += 4 6333 6334 return buf 6335 } 6336 6337 // GetPixelMapuivCookie is a cookie used only for GetPixelMapuiv requests. 6338 type GetPixelMapuivCookie struct { 6339 *xgb.Cookie 6340 } 6341 6342 // GetPixelMapuiv sends a checked request. 6343 // If an error occurs, it will be returned with the reply by calling GetPixelMapuivCookie.Reply() 6344 func GetPixelMapuiv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapuivCookie { 6345 c.ExtLock.RLock() 6346 defer c.ExtLock.RUnlock() 6347 if _, ok := c.Extensions["GLX"]; !ok { 6348 panic("Cannot issue request 'GetPixelMapuiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6349 } 6350 cookie := c.NewCookie(true, true) 6351 c.NewRequest(getPixelMapuivRequest(c, ContextTag, Map), cookie) 6352 return GetPixelMapuivCookie{cookie} 6353 } 6354 6355 // GetPixelMapuivUnchecked sends an unchecked request. 6356 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 6357 func GetPixelMapuivUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapuivCookie { 6358 c.ExtLock.RLock() 6359 defer c.ExtLock.RUnlock() 6360 if _, ok := c.Extensions["GLX"]; !ok { 6361 panic("Cannot issue request 'GetPixelMapuiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6362 } 6363 cookie := c.NewCookie(false, true) 6364 c.NewRequest(getPixelMapuivRequest(c, ContextTag, Map), cookie) 6365 return GetPixelMapuivCookie{cookie} 6366 } 6367 6368 // GetPixelMapuivReply represents the data returned from a GetPixelMapuiv request. 6369 type GetPixelMapuivReply struct { 6370 Sequence uint16 // sequence number of the request for this reply 6371 Length uint32 // number of bytes in this reply 6372 // padding: 1 bytes 6373 // padding: 4 bytes 6374 N uint32 6375 Datum uint32 6376 // padding: 12 bytes 6377 Data []uint32 // size: xgb.Pad((int(N) * 4)) 6378 } 6379 6380 // Reply blocks and returns the reply data for a GetPixelMapuiv request. 6381 func (cook GetPixelMapuivCookie) Reply() (*GetPixelMapuivReply, error) { 6382 buf, err := cook.Cookie.Reply() 6383 if err != nil { 6384 return nil, err 6385 } 6386 if buf == nil { 6387 return nil, nil 6388 } 6389 return getPixelMapuivReply(buf), nil 6390 } 6391 6392 // getPixelMapuivReply reads a byte slice into a GetPixelMapuivReply value. 6393 func getPixelMapuivReply(buf []byte) *GetPixelMapuivReply { 6394 v := new(GetPixelMapuivReply) 6395 b := 1 // skip reply determinant 6396 6397 b += 1 // padding 6398 6399 v.Sequence = xgb.Get16(buf[b:]) 6400 b += 2 6401 6402 v.Length = xgb.Get32(buf[b:]) // 4-byte units 6403 b += 4 6404 6405 b += 4 // padding 6406 6407 v.N = xgb.Get32(buf[b:]) 6408 b += 4 6409 6410 v.Datum = xgb.Get32(buf[b:]) 6411 b += 4 6412 6413 b += 12 // padding 6414 6415 v.Data = make([]uint32, v.N) 6416 for i := 0; i < int(v.N); i++ { 6417 v.Data[i] = xgb.Get32(buf[b:]) 6418 b += 4 6419 } 6420 6421 return v 6422 } 6423 6424 // Write request to wire for GetPixelMapuiv 6425 // getPixelMapuivRequest writes a GetPixelMapuiv request to a byte slice. 6426 func getPixelMapuivRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte { 6427 size := 12 6428 b := 0 6429 buf := make([]byte, size) 6430 6431 c.ExtLock.RLock() 6432 buf[b] = c.Extensions["GLX"] 6433 c.ExtLock.RUnlock() 6434 b += 1 6435 6436 buf[b] = 126 // request opcode 6437 b += 1 6438 6439 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 6440 b += 2 6441 6442 xgb.Put32(buf[b:], uint32(ContextTag)) 6443 b += 4 6444 6445 xgb.Put32(buf[b:], Map) 6446 b += 4 6447 6448 return buf 6449 } 6450 6451 // GetPixelMapusvCookie is a cookie used only for GetPixelMapusv requests. 6452 type GetPixelMapusvCookie struct { 6453 *xgb.Cookie 6454 } 6455 6456 // GetPixelMapusv sends a checked request. 6457 // If an error occurs, it will be returned with the reply by calling GetPixelMapusvCookie.Reply() 6458 func GetPixelMapusv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapusvCookie { 6459 c.ExtLock.RLock() 6460 defer c.ExtLock.RUnlock() 6461 if _, ok := c.Extensions["GLX"]; !ok { 6462 panic("Cannot issue request 'GetPixelMapusv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6463 } 6464 cookie := c.NewCookie(true, true) 6465 c.NewRequest(getPixelMapusvRequest(c, ContextTag, Map), cookie) 6466 return GetPixelMapusvCookie{cookie} 6467 } 6468 6469 // GetPixelMapusvUnchecked sends an unchecked request. 6470 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 6471 func GetPixelMapusvUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapusvCookie { 6472 c.ExtLock.RLock() 6473 defer c.ExtLock.RUnlock() 6474 if _, ok := c.Extensions["GLX"]; !ok { 6475 panic("Cannot issue request 'GetPixelMapusv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6476 } 6477 cookie := c.NewCookie(false, true) 6478 c.NewRequest(getPixelMapusvRequest(c, ContextTag, Map), cookie) 6479 return GetPixelMapusvCookie{cookie} 6480 } 6481 6482 // GetPixelMapusvReply represents the data returned from a GetPixelMapusv request. 6483 type GetPixelMapusvReply struct { 6484 Sequence uint16 // sequence number of the request for this reply 6485 Length uint32 // number of bytes in this reply 6486 // padding: 1 bytes 6487 // padding: 4 bytes 6488 N uint32 6489 Datum uint16 6490 // padding: 16 bytes 6491 Data []uint16 // size: xgb.Pad((int(N) * 2)) 6492 } 6493 6494 // Reply blocks and returns the reply data for a GetPixelMapusv request. 6495 func (cook GetPixelMapusvCookie) Reply() (*GetPixelMapusvReply, error) { 6496 buf, err := cook.Cookie.Reply() 6497 if err != nil { 6498 return nil, err 6499 } 6500 if buf == nil { 6501 return nil, nil 6502 } 6503 return getPixelMapusvReply(buf), nil 6504 } 6505 6506 // getPixelMapusvReply reads a byte slice into a GetPixelMapusvReply value. 6507 func getPixelMapusvReply(buf []byte) *GetPixelMapusvReply { 6508 v := new(GetPixelMapusvReply) 6509 b := 1 // skip reply determinant 6510 6511 b += 1 // padding 6512 6513 v.Sequence = xgb.Get16(buf[b:]) 6514 b += 2 6515 6516 v.Length = xgb.Get32(buf[b:]) // 4-byte units 6517 b += 4 6518 6519 b += 4 // padding 6520 6521 v.N = xgb.Get32(buf[b:]) 6522 b += 4 6523 6524 v.Datum = xgb.Get16(buf[b:]) 6525 b += 2 6526 6527 b += 16 // padding 6528 6529 v.Data = make([]uint16, v.N) 6530 for i := 0; i < int(v.N); i++ { 6531 v.Data[i] = xgb.Get16(buf[b:]) 6532 b += 2 6533 } 6534 6535 return v 6536 } 6537 6538 // Write request to wire for GetPixelMapusv 6539 // getPixelMapusvRequest writes a GetPixelMapusv request to a byte slice. 6540 func getPixelMapusvRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte { 6541 size := 12 6542 b := 0 6543 buf := make([]byte, size) 6544 6545 c.ExtLock.RLock() 6546 buf[b] = c.Extensions["GLX"] 6547 c.ExtLock.RUnlock() 6548 b += 1 6549 6550 buf[b] = 127 // request opcode 6551 b += 1 6552 6553 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 6554 b += 2 6555 6556 xgb.Put32(buf[b:], uint32(ContextTag)) 6557 b += 4 6558 6559 xgb.Put32(buf[b:], Map) 6560 b += 4 6561 6562 return buf 6563 } 6564 6565 // GetPolygonStippleCookie is a cookie used only for GetPolygonStipple requests. 6566 type GetPolygonStippleCookie struct { 6567 *xgb.Cookie 6568 } 6569 6570 // GetPolygonStipple sends a checked request. 6571 // If an error occurs, it will be returned with the reply by calling GetPolygonStippleCookie.Reply() 6572 func GetPolygonStipple(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) GetPolygonStippleCookie { 6573 c.ExtLock.RLock() 6574 defer c.ExtLock.RUnlock() 6575 if _, ok := c.Extensions["GLX"]; !ok { 6576 panic("Cannot issue request 'GetPolygonStipple' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6577 } 6578 cookie := c.NewCookie(true, true) 6579 c.NewRequest(getPolygonStippleRequest(c, ContextTag, LsbFirst), cookie) 6580 return GetPolygonStippleCookie{cookie} 6581 } 6582 6583 // GetPolygonStippleUnchecked sends an unchecked request. 6584 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 6585 func GetPolygonStippleUnchecked(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) GetPolygonStippleCookie { 6586 c.ExtLock.RLock() 6587 defer c.ExtLock.RUnlock() 6588 if _, ok := c.Extensions["GLX"]; !ok { 6589 panic("Cannot issue request 'GetPolygonStipple' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6590 } 6591 cookie := c.NewCookie(false, true) 6592 c.NewRequest(getPolygonStippleRequest(c, ContextTag, LsbFirst), cookie) 6593 return GetPolygonStippleCookie{cookie} 6594 } 6595 6596 // GetPolygonStippleReply represents the data returned from a GetPolygonStipple request. 6597 type GetPolygonStippleReply struct { 6598 Sequence uint16 // sequence number of the request for this reply 6599 Length uint32 // number of bytes in this reply 6600 // padding: 1 bytes 6601 // padding: 24 bytes 6602 Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 6603 } 6604 6605 // Reply blocks and returns the reply data for a GetPolygonStipple request. 6606 func (cook GetPolygonStippleCookie) Reply() (*GetPolygonStippleReply, error) { 6607 buf, err := cook.Cookie.Reply() 6608 if err != nil { 6609 return nil, err 6610 } 6611 if buf == nil { 6612 return nil, nil 6613 } 6614 return getPolygonStippleReply(buf), nil 6615 } 6616 6617 // getPolygonStippleReply reads a byte slice into a GetPolygonStippleReply value. 6618 func getPolygonStippleReply(buf []byte) *GetPolygonStippleReply { 6619 v := new(GetPolygonStippleReply) 6620 b := 1 // skip reply determinant 6621 6622 b += 1 // padding 6623 6624 v.Sequence = xgb.Get16(buf[b:]) 6625 b += 2 6626 6627 v.Length = xgb.Get32(buf[b:]) // 4-byte units 6628 b += 4 6629 6630 b += 24 // padding 6631 6632 v.Data = make([]byte, (int(v.Length) * 4)) 6633 copy(v.Data[:(int(v.Length)*4)], buf[b:]) 6634 b += int((int(v.Length) * 4)) 6635 6636 return v 6637 } 6638 6639 // Write request to wire for GetPolygonStipple 6640 // getPolygonStippleRequest writes a GetPolygonStipple request to a byte slice. 6641 func getPolygonStippleRequest(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) []byte { 6642 size := 12 6643 b := 0 6644 buf := make([]byte, size) 6645 6646 c.ExtLock.RLock() 6647 buf[b] = c.Extensions["GLX"] 6648 c.ExtLock.RUnlock() 6649 b += 1 6650 6651 buf[b] = 128 // request opcode 6652 b += 1 6653 6654 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 6655 b += 2 6656 6657 xgb.Put32(buf[b:], uint32(ContextTag)) 6658 b += 4 6659 6660 if LsbFirst { 6661 buf[b] = 1 6662 } else { 6663 buf[b] = 0 6664 } 6665 b += 1 6666 6667 return buf 6668 } 6669 6670 // GetQueryObjectivARBCookie is a cookie used only for GetQueryObjectivARB requests. 6671 type GetQueryObjectivARBCookie struct { 6672 *xgb.Cookie 6673 } 6674 6675 // GetQueryObjectivARB sends a checked request. 6676 // If an error occurs, it will be returned with the reply by calling GetQueryObjectivARBCookie.Reply() 6677 func GetQueryObjectivARB(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectivARBCookie { 6678 c.ExtLock.RLock() 6679 defer c.ExtLock.RUnlock() 6680 if _, ok := c.Extensions["GLX"]; !ok { 6681 panic("Cannot issue request 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6682 } 6683 cookie := c.NewCookie(true, true) 6684 c.NewRequest(getQueryObjectivARBRequest(c, ContextTag, Id, Pname), cookie) 6685 return GetQueryObjectivARBCookie{cookie} 6686 } 6687 6688 // GetQueryObjectivARBUnchecked sends an unchecked request. 6689 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 6690 func GetQueryObjectivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectivARBCookie { 6691 c.ExtLock.RLock() 6692 defer c.ExtLock.RUnlock() 6693 if _, ok := c.Extensions["GLX"]; !ok { 6694 panic("Cannot issue request 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6695 } 6696 cookie := c.NewCookie(false, true) 6697 c.NewRequest(getQueryObjectivARBRequest(c, ContextTag, Id, Pname), cookie) 6698 return GetQueryObjectivARBCookie{cookie} 6699 } 6700 6701 // GetQueryObjectivARBReply represents the data returned from a GetQueryObjectivARB request. 6702 type GetQueryObjectivARBReply struct { 6703 Sequence uint16 // sequence number of the request for this reply 6704 Length uint32 // number of bytes in this reply 6705 // padding: 1 bytes 6706 // padding: 4 bytes 6707 N uint32 6708 Datum int32 6709 // padding: 12 bytes 6710 Data []int32 // size: xgb.Pad((int(N) * 4)) 6711 } 6712 6713 // Reply blocks and returns the reply data for a GetQueryObjectivARB request. 6714 func (cook GetQueryObjectivARBCookie) Reply() (*GetQueryObjectivARBReply, error) { 6715 buf, err := cook.Cookie.Reply() 6716 if err != nil { 6717 return nil, err 6718 } 6719 if buf == nil { 6720 return nil, nil 6721 } 6722 return getQueryObjectivARBReply(buf), nil 6723 } 6724 6725 // getQueryObjectivARBReply reads a byte slice into a GetQueryObjectivARBReply value. 6726 func getQueryObjectivARBReply(buf []byte) *GetQueryObjectivARBReply { 6727 v := new(GetQueryObjectivARBReply) 6728 b := 1 // skip reply determinant 6729 6730 b += 1 // padding 6731 6732 v.Sequence = xgb.Get16(buf[b:]) 6733 b += 2 6734 6735 v.Length = xgb.Get32(buf[b:]) // 4-byte units 6736 b += 4 6737 6738 b += 4 // padding 6739 6740 v.N = xgb.Get32(buf[b:]) 6741 b += 4 6742 6743 v.Datum = int32(xgb.Get32(buf[b:])) 6744 b += 4 6745 6746 b += 12 // padding 6747 6748 v.Data = make([]int32, v.N) 6749 for i := 0; i < int(v.N); i++ { 6750 v.Data[i] = int32(xgb.Get32(buf[b:])) 6751 b += 4 6752 } 6753 6754 return v 6755 } 6756 6757 // Write request to wire for GetQueryObjectivARB 6758 // getQueryObjectivARBRequest writes a GetQueryObjectivARB request to a byte slice. 6759 func getQueryObjectivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) []byte { 6760 size := 16 6761 b := 0 6762 buf := make([]byte, size) 6763 6764 c.ExtLock.RLock() 6765 buf[b] = c.Extensions["GLX"] 6766 c.ExtLock.RUnlock() 6767 b += 1 6768 6769 buf[b] = 165 // request opcode 6770 b += 1 6771 6772 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 6773 b += 2 6774 6775 xgb.Put32(buf[b:], uint32(ContextTag)) 6776 b += 4 6777 6778 xgb.Put32(buf[b:], Id) 6779 b += 4 6780 6781 xgb.Put32(buf[b:], Pname) 6782 b += 4 6783 6784 return buf 6785 } 6786 6787 // GetQueryObjectuivARBCookie is a cookie used only for GetQueryObjectuivARB requests. 6788 type GetQueryObjectuivARBCookie struct { 6789 *xgb.Cookie 6790 } 6791 6792 // GetQueryObjectuivARB sends a checked request. 6793 // If an error occurs, it will be returned with the reply by calling GetQueryObjectuivARBCookie.Reply() 6794 func GetQueryObjectuivARB(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectuivARBCookie { 6795 c.ExtLock.RLock() 6796 defer c.ExtLock.RUnlock() 6797 if _, ok := c.Extensions["GLX"]; !ok { 6798 panic("Cannot issue request 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6799 } 6800 cookie := c.NewCookie(true, true) 6801 c.NewRequest(getQueryObjectuivARBRequest(c, ContextTag, Id, Pname), cookie) 6802 return GetQueryObjectuivARBCookie{cookie} 6803 } 6804 6805 // GetQueryObjectuivARBUnchecked sends an unchecked request. 6806 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 6807 func GetQueryObjectuivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectuivARBCookie { 6808 c.ExtLock.RLock() 6809 defer c.ExtLock.RUnlock() 6810 if _, ok := c.Extensions["GLX"]; !ok { 6811 panic("Cannot issue request 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6812 } 6813 cookie := c.NewCookie(false, true) 6814 c.NewRequest(getQueryObjectuivARBRequest(c, ContextTag, Id, Pname), cookie) 6815 return GetQueryObjectuivARBCookie{cookie} 6816 } 6817 6818 // GetQueryObjectuivARBReply represents the data returned from a GetQueryObjectuivARB request. 6819 type GetQueryObjectuivARBReply struct { 6820 Sequence uint16 // sequence number of the request for this reply 6821 Length uint32 // number of bytes in this reply 6822 // padding: 1 bytes 6823 // padding: 4 bytes 6824 N uint32 6825 Datum uint32 6826 // padding: 12 bytes 6827 Data []uint32 // size: xgb.Pad((int(N) * 4)) 6828 } 6829 6830 // Reply blocks and returns the reply data for a GetQueryObjectuivARB request. 6831 func (cook GetQueryObjectuivARBCookie) Reply() (*GetQueryObjectuivARBReply, error) { 6832 buf, err := cook.Cookie.Reply() 6833 if err != nil { 6834 return nil, err 6835 } 6836 if buf == nil { 6837 return nil, nil 6838 } 6839 return getQueryObjectuivARBReply(buf), nil 6840 } 6841 6842 // getQueryObjectuivARBReply reads a byte slice into a GetQueryObjectuivARBReply value. 6843 func getQueryObjectuivARBReply(buf []byte) *GetQueryObjectuivARBReply { 6844 v := new(GetQueryObjectuivARBReply) 6845 b := 1 // skip reply determinant 6846 6847 b += 1 // padding 6848 6849 v.Sequence = xgb.Get16(buf[b:]) 6850 b += 2 6851 6852 v.Length = xgb.Get32(buf[b:]) // 4-byte units 6853 b += 4 6854 6855 b += 4 // padding 6856 6857 v.N = xgb.Get32(buf[b:]) 6858 b += 4 6859 6860 v.Datum = xgb.Get32(buf[b:]) 6861 b += 4 6862 6863 b += 12 // padding 6864 6865 v.Data = make([]uint32, v.N) 6866 for i := 0; i < int(v.N); i++ { 6867 v.Data[i] = xgb.Get32(buf[b:]) 6868 b += 4 6869 } 6870 6871 return v 6872 } 6873 6874 // Write request to wire for GetQueryObjectuivARB 6875 // getQueryObjectuivARBRequest writes a GetQueryObjectuivARB request to a byte slice. 6876 func getQueryObjectuivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) []byte { 6877 size := 16 6878 b := 0 6879 buf := make([]byte, size) 6880 6881 c.ExtLock.RLock() 6882 buf[b] = c.Extensions["GLX"] 6883 c.ExtLock.RUnlock() 6884 b += 1 6885 6886 buf[b] = 166 // request opcode 6887 b += 1 6888 6889 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 6890 b += 2 6891 6892 xgb.Put32(buf[b:], uint32(ContextTag)) 6893 b += 4 6894 6895 xgb.Put32(buf[b:], Id) 6896 b += 4 6897 6898 xgb.Put32(buf[b:], Pname) 6899 b += 4 6900 6901 return buf 6902 } 6903 6904 // GetQueryivARBCookie is a cookie used only for GetQueryivARB requests. 6905 type GetQueryivARBCookie struct { 6906 *xgb.Cookie 6907 } 6908 6909 // GetQueryivARB sends a checked request. 6910 // If an error occurs, it will be returned with the reply by calling GetQueryivARBCookie.Reply() 6911 func GetQueryivARB(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetQueryivARBCookie { 6912 c.ExtLock.RLock() 6913 defer c.ExtLock.RUnlock() 6914 if _, ok := c.Extensions["GLX"]; !ok { 6915 panic("Cannot issue request 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6916 } 6917 cookie := c.NewCookie(true, true) 6918 c.NewRequest(getQueryivARBRequest(c, ContextTag, Target, Pname), cookie) 6919 return GetQueryivARBCookie{cookie} 6920 } 6921 6922 // GetQueryivARBUnchecked sends an unchecked request. 6923 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 6924 func GetQueryivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetQueryivARBCookie { 6925 c.ExtLock.RLock() 6926 defer c.ExtLock.RUnlock() 6927 if _, ok := c.Extensions["GLX"]; !ok { 6928 panic("Cannot issue request 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 6929 } 6930 cookie := c.NewCookie(false, true) 6931 c.NewRequest(getQueryivARBRequest(c, ContextTag, Target, Pname), cookie) 6932 return GetQueryivARBCookie{cookie} 6933 } 6934 6935 // GetQueryivARBReply represents the data returned from a GetQueryivARB request. 6936 type GetQueryivARBReply struct { 6937 Sequence uint16 // sequence number of the request for this reply 6938 Length uint32 // number of bytes in this reply 6939 // padding: 1 bytes 6940 // padding: 4 bytes 6941 N uint32 6942 Datum int32 6943 // padding: 12 bytes 6944 Data []int32 // size: xgb.Pad((int(N) * 4)) 6945 } 6946 6947 // Reply blocks and returns the reply data for a GetQueryivARB request. 6948 func (cook GetQueryivARBCookie) Reply() (*GetQueryivARBReply, error) { 6949 buf, err := cook.Cookie.Reply() 6950 if err != nil { 6951 return nil, err 6952 } 6953 if buf == nil { 6954 return nil, nil 6955 } 6956 return getQueryivARBReply(buf), nil 6957 } 6958 6959 // getQueryivARBReply reads a byte slice into a GetQueryivARBReply value. 6960 func getQueryivARBReply(buf []byte) *GetQueryivARBReply { 6961 v := new(GetQueryivARBReply) 6962 b := 1 // skip reply determinant 6963 6964 b += 1 // padding 6965 6966 v.Sequence = xgb.Get16(buf[b:]) 6967 b += 2 6968 6969 v.Length = xgb.Get32(buf[b:]) // 4-byte units 6970 b += 4 6971 6972 b += 4 // padding 6973 6974 v.N = xgb.Get32(buf[b:]) 6975 b += 4 6976 6977 v.Datum = int32(xgb.Get32(buf[b:])) 6978 b += 4 6979 6980 b += 12 // padding 6981 6982 v.Data = make([]int32, v.N) 6983 for i := 0; i < int(v.N); i++ { 6984 v.Data[i] = int32(xgb.Get32(buf[b:])) 6985 b += 4 6986 } 6987 6988 return v 6989 } 6990 6991 // Write request to wire for GetQueryivARB 6992 // getQueryivARBRequest writes a GetQueryivARB request to a byte slice. 6993 func getQueryivARBRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 6994 size := 16 6995 b := 0 6996 buf := make([]byte, size) 6997 6998 c.ExtLock.RLock() 6999 buf[b] = c.Extensions["GLX"] 7000 c.ExtLock.RUnlock() 7001 b += 1 7002 7003 buf[b] = 164 // request opcode 7004 b += 1 7005 7006 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 7007 b += 2 7008 7009 xgb.Put32(buf[b:], uint32(ContextTag)) 7010 b += 4 7011 7012 xgb.Put32(buf[b:], Target) 7013 b += 4 7014 7015 xgb.Put32(buf[b:], Pname) 7016 b += 4 7017 7018 return buf 7019 } 7020 7021 // GetSeparableFilterCookie is a cookie used only for GetSeparableFilter requests. 7022 type GetSeparableFilterCookie struct { 7023 *xgb.Cookie 7024 } 7025 7026 // GetSeparableFilter sends a checked request. 7027 // If an error occurs, it will be returned with the reply by calling GetSeparableFilterCookie.Reply() 7028 func GetSeparableFilter(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetSeparableFilterCookie { 7029 c.ExtLock.RLock() 7030 defer c.ExtLock.RUnlock() 7031 if _, ok := c.Extensions["GLX"]; !ok { 7032 panic("Cannot issue request 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7033 } 7034 cookie := c.NewCookie(true, true) 7035 c.NewRequest(getSeparableFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) 7036 return GetSeparableFilterCookie{cookie} 7037 } 7038 7039 // GetSeparableFilterUnchecked sends an unchecked request. 7040 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 7041 func GetSeparableFilterUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetSeparableFilterCookie { 7042 c.ExtLock.RLock() 7043 defer c.ExtLock.RUnlock() 7044 if _, ok := c.Extensions["GLX"]; !ok { 7045 panic("Cannot issue request 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7046 } 7047 cookie := c.NewCookie(false, true) 7048 c.NewRequest(getSeparableFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) 7049 return GetSeparableFilterCookie{cookie} 7050 } 7051 7052 // GetSeparableFilterReply represents the data returned from a GetSeparableFilter request. 7053 type GetSeparableFilterReply struct { 7054 Sequence uint16 // sequence number of the request for this reply 7055 Length uint32 // number of bytes in this reply 7056 // padding: 1 bytes 7057 // padding: 8 bytes 7058 RowW int32 7059 ColH int32 7060 // padding: 8 bytes 7061 RowsAndCols []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 7062 } 7063 7064 // Reply blocks and returns the reply data for a GetSeparableFilter request. 7065 func (cook GetSeparableFilterCookie) Reply() (*GetSeparableFilterReply, error) { 7066 buf, err := cook.Cookie.Reply() 7067 if err != nil { 7068 return nil, err 7069 } 7070 if buf == nil { 7071 return nil, nil 7072 } 7073 return getSeparableFilterReply(buf), nil 7074 } 7075 7076 // getSeparableFilterReply reads a byte slice into a GetSeparableFilterReply value. 7077 func getSeparableFilterReply(buf []byte) *GetSeparableFilterReply { 7078 v := new(GetSeparableFilterReply) 7079 b := 1 // skip reply determinant 7080 7081 b += 1 // padding 7082 7083 v.Sequence = xgb.Get16(buf[b:]) 7084 b += 2 7085 7086 v.Length = xgb.Get32(buf[b:]) // 4-byte units 7087 b += 4 7088 7089 b += 8 // padding 7090 7091 v.RowW = int32(xgb.Get32(buf[b:])) 7092 b += 4 7093 7094 v.ColH = int32(xgb.Get32(buf[b:])) 7095 b += 4 7096 7097 b += 8 // padding 7098 7099 v.RowsAndCols = make([]byte, (int(v.Length) * 4)) 7100 copy(v.RowsAndCols[:(int(v.Length)*4)], buf[b:]) 7101 b += int((int(v.Length) * 4)) 7102 7103 return v 7104 } 7105 7106 // Write request to wire for GetSeparableFilter 7107 // getSeparableFilterRequest writes a GetSeparableFilter request to a byte slice. 7108 func getSeparableFilterRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) []byte { 7109 size := 24 7110 b := 0 7111 buf := make([]byte, size) 7112 7113 c.ExtLock.RLock() 7114 buf[b] = c.Extensions["GLX"] 7115 c.ExtLock.RUnlock() 7116 b += 1 7117 7118 buf[b] = 153 // request opcode 7119 b += 1 7120 7121 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 7122 b += 2 7123 7124 xgb.Put32(buf[b:], uint32(ContextTag)) 7125 b += 4 7126 7127 xgb.Put32(buf[b:], Target) 7128 b += 4 7129 7130 xgb.Put32(buf[b:], Format) 7131 b += 4 7132 7133 xgb.Put32(buf[b:], Type) 7134 b += 4 7135 7136 if SwapBytes { 7137 buf[b] = 1 7138 } else { 7139 buf[b] = 0 7140 } 7141 b += 1 7142 7143 return buf 7144 } 7145 7146 // GetStringCookie is a cookie used only for GetString requests. 7147 type GetStringCookie struct { 7148 *xgb.Cookie 7149 } 7150 7151 // GetString sends a checked request. 7152 // If an error occurs, it will be returned with the reply by calling GetStringCookie.Reply() 7153 func GetString(c *xgb.Conn, ContextTag ContextTag, Name uint32) GetStringCookie { 7154 c.ExtLock.RLock() 7155 defer c.ExtLock.RUnlock() 7156 if _, ok := c.Extensions["GLX"]; !ok { 7157 panic("Cannot issue request 'GetString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7158 } 7159 cookie := c.NewCookie(true, true) 7160 c.NewRequest(getStringRequest(c, ContextTag, Name), cookie) 7161 return GetStringCookie{cookie} 7162 } 7163 7164 // GetStringUnchecked sends an unchecked request. 7165 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 7166 func GetStringUnchecked(c *xgb.Conn, ContextTag ContextTag, Name uint32) GetStringCookie { 7167 c.ExtLock.RLock() 7168 defer c.ExtLock.RUnlock() 7169 if _, ok := c.Extensions["GLX"]; !ok { 7170 panic("Cannot issue request 'GetString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7171 } 7172 cookie := c.NewCookie(false, true) 7173 c.NewRequest(getStringRequest(c, ContextTag, Name), cookie) 7174 return GetStringCookie{cookie} 7175 } 7176 7177 // GetStringReply represents the data returned from a GetString request. 7178 type GetStringReply struct { 7179 Sequence uint16 // sequence number of the request for this reply 7180 Length uint32 // number of bytes in this reply 7181 // padding: 1 bytes 7182 // padding: 4 bytes 7183 N uint32 7184 // padding: 16 bytes 7185 String string // size: xgb.Pad((int(N) * 1)) 7186 } 7187 7188 // Reply blocks and returns the reply data for a GetString request. 7189 func (cook GetStringCookie) Reply() (*GetStringReply, error) { 7190 buf, err := cook.Cookie.Reply() 7191 if err != nil { 7192 return nil, err 7193 } 7194 if buf == nil { 7195 return nil, nil 7196 } 7197 return getStringReply(buf), nil 7198 } 7199 7200 // getStringReply reads a byte slice into a GetStringReply value. 7201 func getStringReply(buf []byte) *GetStringReply { 7202 v := new(GetStringReply) 7203 b := 1 // skip reply determinant 7204 7205 b += 1 // padding 7206 7207 v.Sequence = xgb.Get16(buf[b:]) 7208 b += 2 7209 7210 v.Length = xgb.Get32(buf[b:]) // 4-byte units 7211 b += 4 7212 7213 b += 4 // padding 7214 7215 v.N = xgb.Get32(buf[b:]) 7216 b += 4 7217 7218 b += 16 // padding 7219 7220 { 7221 byteString := make([]byte, v.N) 7222 copy(byteString[:v.N], buf[b:]) 7223 v.String = string(byteString) 7224 b += int(v.N) 7225 } 7226 7227 return v 7228 } 7229 7230 // Write request to wire for GetString 7231 // getStringRequest writes a GetString request to a byte slice. 7232 func getStringRequest(c *xgb.Conn, ContextTag ContextTag, Name uint32) []byte { 7233 size := 12 7234 b := 0 7235 buf := make([]byte, size) 7236 7237 c.ExtLock.RLock() 7238 buf[b] = c.Extensions["GLX"] 7239 c.ExtLock.RUnlock() 7240 b += 1 7241 7242 buf[b] = 129 // request opcode 7243 b += 1 7244 7245 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 7246 b += 2 7247 7248 xgb.Put32(buf[b:], uint32(ContextTag)) 7249 b += 4 7250 7251 xgb.Put32(buf[b:], Name) 7252 b += 4 7253 7254 return buf 7255 } 7256 7257 // GetTexEnvfvCookie is a cookie used only for GetTexEnvfv requests. 7258 type GetTexEnvfvCookie struct { 7259 *xgb.Cookie 7260 } 7261 7262 // GetTexEnvfv sends a checked request. 7263 // If an error occurs, it will be returned with the reply by calling GetTexEnvfvCookie.Reply() 7264 func GetTexEnvfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvfvCookie { 7265 c.ExtLock.RLock() 7266 defer c.ExtLock.RUnlock() 7267 if _, ok := c.Extensions["GLX"]; !ok { 7268 panic("Cannot issue request 'GetTexEnvfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7269 } 7270 cookie := c.NewCookie(true, true) 7271 c.NewRequest(getTexEnvfvRequest(c, ContextTag, Target, Pname), cookie) 7272 return GetTexEnvfvCookie{cookie} 7273 } 7274 7275 // GetTexEnvfvUnchecked sends an unchecked request. 7276 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 7277 func GetTexEnvfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvfvCookie { 7278 c.ExtLock.RLock() 7279 defer c.ExtLock.RUnlock() 7280 if _, ok := c.Extensions["GLX"]; !ok { 7281 panic("Cannot issue request 'GetTexEnvfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7282 } 7283 cookie := c.NewCookie(false, true) 7284 c.NewRequest(getTexEnvfvRequest(c, ContextTag, Target, Pname), cookie) 7285 return GetTexEnvfvCookie{cookie} 7286 } 7287 7288 // GetTexEnvfvReply represents the data returned from a GetTexEnvfv request. 7289 type GetTexEnvfvReply struct { 7290 Sequence uint16 // sequence number of the request for this reply 7291 Length uint32 // number of bytes in this reply 7292 // padding: 1 bytes 7293 // padding: 4 bytes 7294 N uint32 7295 Datum Float32 7296 // padding: 12 bytes 7297 Data []Float32 // size: xgb.Pad((int(N) * 4)) 7298 } 7299 7300 // Reply blocks and returns the reply data for a GetTexEnvfv request. 7301 func (cook GetTexEnvfvCookie) Reply() (*GetTexEnvfvReply, error) { 7302 buf, err := cook.Cookie.Reply() 7303 if err != nil { 7304 return nil, err 7305 } 7306 if buf == nil { 7307 return nil, nil 7308 } 7309 return getTexEnvfvReply(buf), nil 7310 } 7311 7312 // getTexEnvfvReply reads a byte slice into a GetTexEnvfvReply value. 7313 func getTexEnvfvReply(buf []byte) *GetTexEnvfvReply { 7314 v := new(GetTexEnvfvReply) 7315 b := 1 // skip reply determinant 7316 7317 b += 1 // padding 7318 7319 v.Sequence = xgb.Get16(buf[b:]) 7320 b += 2 7321 7322 v.Length = xgb.Get32(buf[b:]) // 4-byte units 7323 b += 4 7324 7325 b += 4 // padding 7326 7327 v.N = xgb.Get32(buf[b:]) 7328 b += 4 7329 7330 v.Datum = Float32(xgb.Get32(buf[b:])) 7331 b += 4 7332 7333 b += 12 // padding 7334 7335 v.Data = make([]Float32, v.N) 7336 for i := 0; i < int(v.N); i++ { 7337 v.Data[i] = Float32(xgb.Get32(buf[b:])) 7338 b += 4 7339 } 7340 7341 return v 7342 } 7343 7344 // Write request to wire for GetTexEnvfv 7345 // getTexEnvfvRequest writes a GetTexEnvfv request to a byte slice. 7346 func getTexEnvfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 7347 size := 16 7348 b := 0 7349 buf := make([]byte, size) 7350 7351 c.ExtLock.RLock() 7352 buf[b] = c.Extensions["GLX"] 7353 c.ExtLock.RUnlock() 7354 b += 1 7355 7356 buf[b] = 130 // request opcode 7357 b += 1 7358 7359 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 7360 b += 2 7361 7362 xgb.Put32(buf[b:], uint32(ContextTag)) 7363 b += 4 7364 7365 xgb.Put32(buf[b:], Target) 7366 b += 4 7367 7368 xgb.Put32(buf[b:], Pname) 7369 b += 4 7370 7371 return buf 7372 } 7373 7374 // GetTexEnvivCookie is a cookie used only for GetTexEnviv requests. 7375 type GetTexEnvivCookie struct { 7376 *xgb.Cookie 7377 } 7378 7379 // GetTexEnviv sends a checked request. 7380 // If an error occurs, it will be returned with the reply by calling GetTexEnvivCookie.Reply() 7381 func GetTexEnviv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvivCookie { 7382 c.ExtLock.RLock() 7383 defer c.ExtLock.RUnlock() 7384 if _, ok := c.Extensions["GLX"]; !ok { 7385 panic("Cannot issue request 'GetTexEnviv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7386 } 7387 cookie := c.NewCookie(true, true) 7388 c.NewRequest(getTexEnvivRequest(c, ContextTag, Target, Pname), cookie) 7389 return GetTexEnvivCookie{cookie} 7390 } 7391 7392 // GetTexEnvivUnchecked sends an unchecked request. 7393 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 7394 func GetTexEnvivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvivCookie { 7395 c.ExtLock.RLock() 7396 defer c.ExtLock.RUnlock() 7397 if _, ok := c.Extensions["GLX"]; !ok { 7398 panic("Cannot issue request 'GetTexEnviv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7399 } 7400 cookie := c.NewCookie(false, true) 7401 c.NewRequest(getTexEnvivRequest(c, ContextTag, Target, Pname), cookie) 7402 return GetTexEnvivCookie{cookie} 7403 } 7404 7405 // GetTexEnvivReply represents the data returned from a GetTexEnviv request. 7406 type GetTexEnvivReply struct { 7407 Sequence uint16 // sequence number of the request for this reply 7408 Length uint32 // number of bytes in this reply 7409 // padding: 1 bytes 7410 // padding: 4 bytes 7411 N uint32 7412 Datum int32 7413 // padding: 12 bytes 7414 Data []int32 // size: xgb.Pad((int(N) * 4)) 7415 } 7416 7417 // Reply blocks and returns the reply data for a GetTexEnviv request. 7418 func (cook GetTexEnvivCookie) Reply() (*GetTexEnvivReply, error) { 7419 buf, err := cook.Cookie.Reply() 7420 if err != nil { 7421 return nil, err 7422 } 7423 if buf == nil { 7424 return nil, nil 7425 } 7426 return getTexEnvivReply(buf), nil 7427 } 7428 7429 // getTexEnvivReply reads a byte slice into a GetTexEnvivReply value. 7430 func getTexEnvivReply(buf []byte) *GetTexEnvivReply { 7431 v := new(GetTexEnvivReply) 7432 b := 1 // skip reply determinant 7433 7434 b += 1 // padding 7435 7436 v.Sequence = xgb.Get16(buf[b:]) 7437 b += 2 7438 7439 v.Length = xgb.Get32(buf[b:]) // 4-byte units 7440 b += 4 7441 7442 b += 4 // padding 7443 7444 v.N = xgb.Get32(buf[b:]) 7445 b += 4 7446 7447 v.Datum = int32(xgb.Get32(buf[b:])) 7448 b += 4 7449 7450 b += 12 // padding 7451 7452 v.Data = make([]int32, v.N) 7453 for i := 0; i < int(v.N); i++ { 7454 v.Data[i] = int32(xgb.Get32(buf[b:])) 7455 b += 4 7456 } 7457 7458 return v 7459 } 7460 7461 // Write request to wire for GetTexEnviv 7462 // getTexEnvivRequest writes a GetTexEnviv request to a byte slice. 7463 func getTexEnvivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 7464 size := 16 7465 b := 0 7466 buf := make([]byte, size) 7467 7468 c.ExtLock.RLock() 7469 buf[b] = c.Extensions["GLX"] 7470 c.ExtLock.RUnlock() 7471 b += 1 7472 7473 buf[b] = 131 // request opcode 7474 b += 1 7475 7476 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 7477 b += 2 7478 7479 xgb.Put32(buf[b:], uint32(ContextTag)) 7480 b += 4 7481 7482 xgb.Put32(buf[b:], Target) 7483 b += 4 7484 7485 xgb.Put32(buf[b:], Pname) 7486 b += 4 7487 7488 return buf 7489 } 7490 7491 // GetTexGendvCookie is a cookie used only for GetTexGendv requests. 7492 type GetTexGendvCookie struct { 7493 *xgb.Cookie 7494 } 7495 7496 // GetTexGendv sends a checked request. 7497 // If an error occurs, it will be returned with the reply by calling GetTexGendvCookie.Reply() 7498 func GetTexGendv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGendvCookie { 7499 c.ExtLock.RLock() 7500 defer c.ExtLock.RUnlock() 7501 if _, ok := c.Extensions["GLX"]; !ok { 7502 panic("Cannot issue request 'GetTexGendv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7503 } 7504 cookie := c.NewCookie(true, true) 7505 c.NewRequest(getTexGendvRequest(c, ContextTag, Coord, Pname), cookie) 7506 return GetTexGendvCookie{cookie} 7507 } 7508 7509 // GetTexGendvUnchecked sends an unchecked request. 7510 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 7511 func GetTexGendvUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGendvCookie { 7512 c.ExtLock.RLock() 7513 defer c.ExtLock.RUnlock() 7514 if _, ok := c.Extensions["GLX"]; !ok { 7515 panic("Cannot issue request 'GetTexGendv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7516 } 7517 cookie := c.NewCookie(false, true) 7518 c.NewRequest(getTexGendvRequest(c, ContextTag, Coord, Pname), cookie) 7519 return GetTexGendvCookie{cookie} 7520 } 7521 7522 // GetTexGendvReply represents the data returned from a GetTexGendv request. 7523 type GetTexGendvReply struct { 7524 Sequence uint16 // sequence number of the request for this reply 7525 Length uint32 // number of bytes in this reply 7526 // padding: 1 bytes 7527 // padding: 4 bytes 7528 N uint32 7529 Datum Float64 7530 // padding: 8 bytes 7531 Data []Float64 // size: xgb.Pad((int(N) * 8)) 7532 } 7533 7534 // Reply blocks and returns the reply data for a GetTexGendv request. 7535 func (cook GetTexGendvCookie) Reply() (*GetTexGendvReply, error) { 7536 buf, err := cook.Cookie.Reply() 7537 if err != nil { 7538 return nil, err 7539 } 7540 if buf == nil { 7541 return nil, nil 7542 } 7543 return getTexGendvReply(buf), nil 7544 } 7545 7546 // getTexGendvReply reads a byte slice into a GetTexGendvReply value. 7547 func getTexGendvReply(buf []byte) *GetTexGendvReply { 7548 v := new(GetTexGendvReply) 7549 b := 1 // skip reply determinant 7550 7551 b += 1 // padding 7552 7553 v.Sequence = xgb.Get16(buf[b:]) 7554 b += 2 7555 7556 v.Length = xgb.Get32(buf[b:]) // 4-byte units 7557 b += 4 7558 7559 b += 4 // padding 7560 7561 v.N = xgb.Get32(buf[b:]) 7562 b += 4 7563 7564 v.Datum = Float64(xgb.Get64(buf[b:])) 7565 b += 8 7566 7567 b += 8 // padding 7568 7569 v.Data = make([]Float64, v.N) 7570 for i := 0; i < int(v.N); i++ { 7571 v.Data[i] = Float64(xgb.Get64(buf[b:])) 7572 b += 8 7573 } 7574 7575 return v 7576 } 7577 7578 // Write request to wire for GetTexGendv 7579 // getTexGendvRequest writes a GetTexGendv request to a byte slice. 7580 func getTexGendvRequest(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) []byte { 7581 size := 16 7582 b := 0 7583 buf := make([]byte, size) 7584 7585 c.ExtLock.RLock() 7586 buf[b] = c.Extensions["GLX"] 7587 c.ExtLock.RUnlock() 7588 b += 1 7589 7590 buf[b] = 132 // request opcode 7591 b += 1 7592 7593 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 7594 b += 2 7595 7596 xgb.Put32(buf[b:], uint32(ContextTag)) 7597 b += 4 7598 7599 xgb.Put32(buf[b:], Coord) 7600 b += 4 7601 7602 xgb.Put32(buf[b:], Pname) 7603 b += 4 7604 7605 return buf 7606 } 7607 7608 // GetTexGenfvCookie is a cookie used only for GetTexGenfv requests. 7609 type GetTexGenfvCookie struct { 7610 *xgb.Cookie 7611 } 7612 7613 // GetTexGenfv sends a checked request. 7614 // If an error occurs, it will be returned with the reply by calling GetTexGenfvCookie.Reply() 7615 func GetTexGenfv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenfvCookie { 7616 c.ExtLock.RLock() 7617 defer c.ExtLock.RUnlock() 7618 if _, ok := c.Extensions["GLX"]; !ok { 7619 panic("Cannot issue request 'GetTexGenfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7620 } 7621 cookie := c.NewCookie(true, true) 7622 c.NewRequest(getTexGenfvRequest(c, ContextTag, Coord, Pname), cookie) 7623 return GetTexGenfvCookie{cookie} 7624 } 7625 7626 // GetTexGenfvUnchecked sends an unchecked request. 7627 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 7628 func GetTexGenfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenfvCookie { 7629 c.ExtLock.RLock() 7630 defer c.ExtLock.RUnlock() 7631 if _, ok := c.Extensions["GLX"]; !ok { 7632 panic("Cannot issue request 'GetTexGenfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7633 } 7634 cookie := c.NewCookie(false, true) 7635 c.NewRequest(getTexGenfvRequest(c, ContextTag, Coord, Pname), cookie) 7636 return GetTexGenfvCookie{cookie} 7637 } 7638 7639 // GetTexGenfvReply represents the data returned from a GetTexGenfv request. 7640 type GetTexGenfvReply struct { 7641 Sequence uint16 // sequence number of the request for this reply 7642 Length uint32 // number of bytes in this reply 7643 // padding: 1 bytes 7644 // padding: 4 bytes 7645 N uint32 7646 Datum Float32 7647 // padding: 12 bytes 7648 Data []Float32 // size: xgb.Pad((int(N) * 4)) 7649 } 7650 7651 // Reply blocks and returns the reply data for a GetTexGenfv request. 7652 func (cook GetTexGenfvCookie) Reply() (*GetTexGenfvReply, error) { 7653 buf, err := cook.Cookie.Reply() 7654 if err != nil { 7655 return nil, err 7656 } 7657 if buf == nil { 7658 return nil, nil 7659 } 7660 return getTexGenfvReply(buf), nil 7661 } 7662 7663 // getTexGenfvReply reads a byte slice into a GetTexGenfvReply value. 7664 func getTexGenfvReply(buf []byte) *GetTexGenfvReply { 7665 v := new(GetTexGenfvReply) 7666 b := 1 // skip reply determinant 7667 7668 b += 1 // padding 7669 7670 v.Sequence = xgb.Get16(buf[b:]) 7671 b += 2 7672 7673 v.Length = xgb.Get32(buf[b:]) // 4-byte units 7674 b += 4 7675 7676 b += 4 // padding 7677 7678 v.N = xgb.Get32(buf[b:]) 7679 b += 4 7680 7681 v.Datum = Float32(xgb.Get32(buf[b:])) 7682 b += 4 7683 7684 b += 12 // padding 7685 7686 v.Data = make([]Float32, v.N) 7687 for i := 0; i < int(v.N); i++ { 7688 v.Data[i] = Float32(xgb.Get32(buf[b:])) 7689 b += 4 7690 } 7691 7692 return v 7693 } 7694 7695 // Write request to wire for GetTexGenfv 7696 // getTexGenfvRequest writes a GetTexGenfv request to a byte slice. 7697 func getTexGenfvRequest(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) []byte { 7698 size := 16 7699 b := 0 7700 buf := make([]byte, size) 7701 7702 c.ExtLock.RLock() 7703 buf[b] = c.Extensions["GLX"] 7704 c.ExtLock.RUnlock() 7705 b += 1 7706 7707 buf[b] = 133 // request opcode 7708 b += 1 7709 7710 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 7711 b += 2 7712 7713 xgb.Put32(buf[b:], uint32(ContextTag)) 7714 b += 4 7715 7716 xgb.Put32(buf[b:], Coord) 7717 b += 4 7718 7719 xgb.Put32(buf[b:], Pname) 7720 b += 4 7721 7722 return buf 7723 } 7724 7725 // GetTexGenivCookie is a cookie used only for GetTexGeniv requests. 7726 type GetTexGenivCookie struct { 7727 *xgb.Cookie 7728 } 7729 7730 // GetTexGeniv sends a checked request. 7731 // If an error occurs, it will be returned with the reply by calling GetTexGenivCookie.Reply() 7732 func GetTexGeniv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenivCookie { 7733 c.ExtLock.RLock() 7734 defer c.ExtLock.RUnlock() 7735 if _, ok := c.Extensions["GLX"]; !ok { 7736 panic("Cannot issue request 'GetTexGeniv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7737 } 7738 cookie := c.NewCookie(true, true) 7739 c.NewRequest(getTexGenivRequest(c, ContextTag, Coord, Pname), cookie) 7740 return GetTexGenivCookie{cookie} 7741 } 7742 7743 // GetTexGenivUnchecked sends an unchecked request. 7744 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 7745 func GetTexGenivUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenivCookie { 7746 c.ExtLock.RLock() 7747 defer c.ExtLock.RUnlock() 7748 if _, ok := c.Extensions["GLX"]; !ok { 7749 panic("Cannot issue request 'GetTexGeniv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7750 } 7751 cookie := c.NewCookie(false, true) 7752 c.NewRequest(getTexGenivRequest(c, ContextTag, Coord, Pname), cookie) 7753 return GetTexGenivCookie{cookie} 7754 } 7755 7756 // GetTexGenivReply represents the data returned from a GetTexGeniv request. 7757 type GetTexGenivReply struct { 7758 Sequence uint16 // sequence number of the request for this reply 7759 Length uint32 // number of bytes in this reply 7760 // padding: 1 bytes 7761 // padding: 4 bytes 7762 N uint32 7763 Datum int32 7764 // padding: 12 bytes 7765 Data []int32 // size: xgb.Pad((int(N) * 4)) 7766 } 7767 7768 // Reply blocks and returns the reply data for a GetTexGeniv request. 7769 func (cook GetTexGenivCookie) Reply() (*GetTexGenivReply, error) { 7770 buf, err := cook.Cookie.Reply() 7771 if err != nil { 7772 return nil, err 7773 } 7774 if buf == nil { 7775 return nil, nil 7776 } 7777 return getTexGenivReply(buf), nil 7778 } 7779 7780 // getTexGenivReply reads a byte slice into a GetTexGenivReply value. 7781 func getTexGenivReply(buf []byte) *GetTexGenivReply { 7782 v := new(GetTexGenivReply) 7783 b := 1 // skip reply determinant 7784 7785 b += 1 // padding 7786 7787 v.Sequence = xgb.Get16(buf[b:]) 7788 b += 2 7789 7790 v.Length = xgb.Get32(buf[b:]) // 4-byte units 7791 b += 4 7792 7793 b += 4 // padding 7794 7795 v.N = xgb.Get32(buf[b:]) 7796 b += 4 7797 7798 v.Datum = int32(xgb.Get32(buf[b:])) 7799 b += 4 7800 7801 b += 12 // padding 7802 7803 v.Data = make([]int32, v.N) 7804 for i := 0; i < int(v.N); i++ { 7805 v.Data[i] = int32(xgb.Get32(buf[b:])) 7806 b += 4 7807 } 7808 7809 return v 7810 } 7811 7812 // Write request to wire for GetTexGeniv 7813 // getTexGenivRequest writes a GetTexGeniv request to a byte slice. 7814 func getTexGenivRequest(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) []byte { 7815 size := 16 7816 b := 0 7817 buf := make([]byte, size) 7818 7819 c.ExtLock.RLock() 7820 buf[b] = c.Extensions["GLX"] 7821 c.ExtLock.RUnlock() 7822 b += 1 7823 7824 buf[b] = 134 // request opcode 7825 b += 1 7826 7827 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 7828 b += 2 7829 7830 xgb.Put32(buf[b:], uint32(ContextTag)) 7831 b += 4 7832 7833 xgb.Put32(buf[b:], Coord) 7834 b += 4 7835 7836 xgb.Put32(buf[b:], Pname) 7837 b += 4 7838 7839 return buf 7840 } 7841 7842 // GetTexImageCookie is a cookie used only for GetTexImage requests. 7843 type GetTexImageCookie struct { 7844 *xgb.Cookie 7845 } 7846 7847 // GetTexImage sends a checked request. 7848 // If an error occurs, it will be returned with the reply by calling GetTexImageCookie.Reply() 7849 func GetTexImage(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) GetTexImageCookie { 7850 c.ExtLock.RLock() 7851 defer c.ExtLock.RUnlock() 7852 if _, ok := c.Extensions["GLX"]; !ok { 7853 panic("Cannot issue request 'GetTexImage' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7854 } 7855 cookie := c.NewCookie(true, true) 7856 c.NewRequest(getTexImageRequest(c, ContextTag, Target, Level, Format, Type, SwapBytes), cookie) 7857 return GetTexImageCookie{cookie} 7858 } 7859 7860 // GetTexImageUnchecked sends an unchecked request. 7861 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 7862 func GetTexImageUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) GetTexImageCookie { 7863 c.ExtLock.RLock() 7864 defer c.ExtLock.RUnlock() 7865 if _, ok := c.Extensions["GLX"]; !ok { 7866 panic("Cannot issue request 'GetTexImage' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7867 } 7868 cookie := c.NewCookie(false, true) 7869 c.NewRequest(getTexImageRequest(c, ContextTag, Target, Level, Format, Type, SwapBytes), cookie) 7870 return GetTexImageCookie{cookie} 7871 } 7872 7873 // GetTexImageReply represents the data returned from a GetTexImage request. 7874 type GetTexImageReply struct { 7875 Sequence uint16 // sequence number of the request for this reply 7876 Length uint32 // number of bytes in this reply 7877 // padding: 1 bytes 7878 // padding: 8 bytes 7879 Width int32 7880 Height int32 7881 Depth int32 7882 // padding: 4 bytes 7883 Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 7884 } 7885 7886 // Reply blocks and returns the reply data for a GetTexImage request. 7887 func (cook GetTexImageCookie) Reply() (*GetTexImageReply, error) { 7888 buf, err := cook.Cookie.Reply() 7889 if err != nil { 7890 return nil, err 7891 } 7892 if buf == nil { 7893 return nil, nil 7894 } 7895 return getTexImageReply(buf), nil 7896 } 7897 7898 // getTexImageReply reads a byte slice into a GetTexImageReply value. 7899 func getTexImageReply(buf []byte) *GetTexImageReply { 7900 v := new(GetTexImageReply) 7901 b := 1 // skip reply determinant 7902 7903 b += 1 // padding 7904 7905 v.Sequence = xgb.Get16(buf[b:]) 7906 b += 2 7907 7908 v.Length = xgb.Get32(buf[b:]) // 4-byte units 7909 b += 4 7910 7911 b += 8 // padding 7912 7913 v.Width = int32(xgb.Get32(buf[b:])) 7914 b += 4 7915 7916 v.Height = int32(xgb.Get32(buf[b:])) 7917 b += 4 7918 7919 v.Depth = int32(xgb.Get32(buf[b:])) 7920 b += 4 7921 7922 b += 4 // padding 7923 7924 v.Data = make([]byte, (int(v.Length) * 4)) 7925 copy(v.Data[:(int(v.Length)*4)], buf[b:]) 7926 b += int((int(v.Length) * 4)) 7927 7928 return v 7929 } 7930 7931 // Write request to wire for GetTexImage 7932 // getTexImageRequest writes a GetTexImage request to a byte slice. 7933 func getTexImageRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) []byte { 7934 size := 28 7935 b := 0 7936 buf := make([]byte, size) 7937 7938 c.ExtLock.RLock() 7939 buf[b] = c.Extensions["GLX"] 7940 c.ExtLock.RUnlock() 7941 b += 1 7942 7943 buf[b] = 135 // request opcode 7944 b += 1 7945 7946 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 7947 b += 2 7948 7949 xgb.Put32(buf[b:], uint32(ContextTag)) 7950 b += 4 7951 7952 xgb.Put32(buf[b:], Target) 7953 b += 4 7954 7955 xgb.Put32(buf[b:], uint32(Level)) 7956 b += 4 7957 7958 xgb.Put32(buf[b:], Format) 7959 b += 4 7960 7961 xgb.Put32(buf[b:], Type) 7962 b += 4 7963 7964 if SwapBytes { 7965 buf[b] = 1 7966 } else { 7967 buf[b] = 0 7968 } 7969 b += 1 7970 7971 return buf 7972 } 7973 7974 // GetTexLevelParameterfvCookie is a cookie used only for GetTexLevelParameterfv requests. 7975 type GetTexLevelParameterfvCookie struct { 7976 *xgb.Cookie 7977 } 7978 7979 // GetTexLevelParameterfv sends a checked request. 7980 // If an error occurs, it will be returned with the reply by calling GetTexLevelParameterfvCookie.Reply() 7981 func GetTexLevelParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterfvCookie { 7982 c.ExtLock.RLock() 7983 defer c.ExtLock.RUnlock() 7984 if _, ok := c.Extensions["GLX"]; !ok { 7985 panic("Cannot issue request 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7986 } 7987 cookie := c.NewCookie(true, true) 7988 c.NewRequest(getTexLevelParameterfvRequest(c, ContextTag, Target, Level, Pname), cookie) 7989 return GetTexLevelParameterfvCookie{cookie} 7990 } 7991 7992 // GetTexLevelParameterfvUnchecked sends an unchecked request. 7993 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 7994 func GetTexLevelParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterfvCookie { 7995 c.ExtLock.RLock() 7996 defer c.ExtLock.RUnlock() 7997 if _, ok := c.Extensions["GLX"]; !ok { 7998 panic("Cannot issue request 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 7999 } 8000 cookie := c.NewCookie(false, true) 8001 c.NewRequest(getTexLevelParameterfvRequest(c, ContextTag, Target, Level, Pname), cookie) 8002 return GetTexLevelParameterfvCookie{cookie} 8003 } 8004 8005 // GetTexLevelParameterfvReply represents the data returned from a GetTexLevelParameterfv request. 8006 type GetTexLevelParameterfvReply struct { 8007 Sequence uint16 // sequence number of the request for this reply 8008 Length uint32 // number of bytes in this reply 8009 // padding: 1 bytes 8010 // padding: 4 bytes 8011 N uint32 8012 Datum Float32 8013 // padding: 12 bytes 8014 Data []Float32 // size: xgb.Pad((int(N) * 4)) 8015 } 8016 8017 // Reply blocks and returns the reply data for a GetTexLevelParameterfv request. 8018 func (cook GetTexLevelParameterfvCookie) Reply() (*GetTexLevelParameterfvReply, error) { 8019 buf, err := cook.Cookie.Reply() 8020 if err != nil { 8021 return nil, err 8022 } 8023 if buf == nil { 8024 return nil, nil 8025 } 8026 return getTexLevelParameterfvReply(buf), nil 8027 } 8028 8029 // getTexLevelParameterfvReply reads a byte slice into a GetTexLevelParameterfvReply value. 8030 func getTexLevelParameterfvReply(buf []byte) *GetTexLevelParameterfvReply { 8031 v := new(GetTexLevelParameterfvReply) 8032 b := 1 // skip reply determinant 8033 8034 b += 1 // padding 8035 8036 v.Sequence = xgb.Get16(buf[b:]) 8037 b += 2 8038 8039 v.Length = xgb.Get32(buf[b:]) // 4-byte units 8040 b += 4 8041 8042 b += 4 // padding 8043 8044 v.N = xgb.Get32(buf[b:]) 8045 b += 4 8046 8047 v.Datum = Float32(xgb.Get32(buf[b:])) 8048 b += 4 8049 8050 b += 12 // padding 8051 8052 v.Data = make([]Float32, v.N) 8053 for i := 0; i < int(v.N); i++ { 8054 v.Data[i] = Float32(xgb.Get32(buf[b:])) 8055 b += 4 8056 } 8057 8058 return v 8059 } 8060 8061 // Write request to wire for GetTexLevelParameterfv 8062 // getTexLevelParameterfvRequest writes a GetTexLevelParameterfv request to a byte slice. 8063 func getTexLevelParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) []byte { 8064 size := 20 8065 b := 0 8066 buf := make([]byte, size) 8067 8068 c.ExtLock.RLock() 8069 buf[b] = c.Extensions["GLX"] 8070 c.ExtLock.RUnlock() 8071 b += 1 8072 8073 buf[b] = 138 // request opcode 8074 b += 1 8075 8076 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 8077 b += 2 8078 8079 xgb.Put32(buf[b:], uint32(ContextTag)) 8080 b += 4 8081 8082 xgb.Put32(buf[b:], Target) 8083 b += 4 8084 8085 xgb.Put32(buf[b:], uint32(Level)) 8086 b += 4 8087 8088 xgb.Put32(buf[b:], Pname) 8089 b += 4 8090 8091 return buf 8092 } 8093 8094 // GetTexLevelParameterivCookie is a cookie used only for GetTexLevelParameteriv requests. 8095 type GetTexLevelParameterivCookie struct { 8096 *xgb.Cookie 8097 } 8098 8099 // GetTexLevelParameteriv sends a checked request. 8100 // If an error occurs, it will be returned with the reply by calling GetTexLevelParameterivCookie.Reply() 8101 func GetTexLevelParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterivCookie { 8102 c.ExtLock.RLock() 8103 defer c.ExtLock.RUnlock() 8104 if _, ok := c.Extensions["GLX"]; !ok { 8105 panic("Cannot issue request 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8106 } 8107 cookie := c.NewCookie(true, true) 8108 c.NewRequest(getTexLevelParameterivRequest(c, ContextTag, Target, Level, Pname), cookie) 8109 return GetTexLevelParameterivCookie{cookie} 8110 } 8111 8112 // GetTexLevelParameterivUnchecked sends an unchecked request. 8113 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 8114 func GetTexLevelParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterivCookie { 8115 c.ExtLock.RLock() 8116 defer c.ExtLock.RUnlock() 8117 if _, ok := c.Extensions["GLX"]; !ok { 8118 panic("Cannot issue request 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8119 } 8120 cookie := c.NewCookie(false, true) 8121 c.NewRequest(getTexLevelParameterivRequest(c, ContextTag, Target, Level, Pname), cookie) 8122 return GetTexLevelParameterivCookie{cookie} 8123 } 8124 8125 // GetTexLevelParameterivReply represents the data returned from a GetTexLevelParameteriv request. 8126 type GetTexLevelParameterivReply struct { 8127 Sequence uint16 // sequence number of the request for this reply 8128 Length uint32 // number of bytes in this reply 8129 // padding: 1 bytes 8130 // padding: 4 bytes 8131 N uint32 8132 Datum int32 8133 // padding: 12 bytes 8134 Data []int32 // size: xgb.Pad((int(N) * 4)) 8135 } 8136 8137 // Reply blocks and returns the reply data for a GetTexLevelParameteriv request. 8138 func (cook GetTexLevelParameterivCookie) Reply() (*GetTexLevelParameterivReply, error) { 8139 buf, err := cook.Cookie.Reply() 8140 if err != nil { 8141 return nil, err 8142 } 8143 if buf == nil { 8144 return nil, nil 8145 } 8146 return getTexLevelParameterivReply(buf), nil 8147 } 8148 8149 // getTexLevelParameterivReply reads a byte slice into a GetTexLevelParameterivReply value. 8150 func getTexLevelParameterivReply(buf []byte) *GetTexLevelParameterivReply { 8151 v := new(GetTexLevelParameterivReply) 8152 b := 1 // skip reply determinant 8153 8154 b += 1 // padding 8155 8156 v.Sequence = xgb.Get16(buf[b:]) 8157 b += 2 8158 8159 v.Length = xgb.Get32(buf[b:]) // 4-byte units 8160 b += 4 8161 8162 b += 4 // padding 8163 8164 v.N = xgb.Get32(buf[b:]) 8165 b += 4 8166 8167 v.Datum = int32(xgb.Get32(buf[b:])) 8168 b += 4 8169 8170 b += 12 // padding 8171 8172 v.Data = make([]int32, v.N) 8173 for i := 0; i < int(v.N); i++ { 8174 v.Data[i] = int32(xgb.Get32(buf[b:])) 8175 b += 4 8176 } 8177 8178 return v 8179 } 8180 8181 // Write request to wire for GetTexLevelParameteriv 8182 // getTexLevelParameterivRequest writes a GetTexLevelParameteriv request to a byte slice. 8183 func getTexLevelParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) []byte { 8184 size := 20 8185 b := 0 8186 buf := make([]byte, size) 8187 8188 c.ExtLock.RLock() 8189 buf[b] = c.Extensions["GLX"] 8190 c.ExtLock.RUnlock() 8191 b += 1 8192 8193 buf[b] = 139 // request opcode 8194 b += 1 8195 8196 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 8197 b += 2 8198 8199 xgb.Put32(buf[b:], uint32(ContextTag)) 8200 b += 4 8201 8202 xgb.Put32(buf[b:], Target) 8203 b += 4 8204 8205 xgb.Put32(buf[b:], uint32(Level)) 8206 b += 4 8207 8208 xgb.Put32(buf[b:], Pname) 8209 b += 4 8210 8211 return buf 8212 } 8213 8214 // GetTexParameterfvCookie is a cookie used only for GetTexParameterfv requests. 8215 type GetTexParameterfvCookie struct { 8216 *xgb.Cookie 8217 } 8218 8219 // GetTexParameterfv sends a checked request. 8220 // If an error occurs, it will be returned with the reply by calling GetTexParameterfvCookie.Reply() 8221 func GetTexParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterfvCookie { 8222 c.ExtLock.RLock() 8223 defer c.ExtLock.RUnlock() 8224 if _, ok := c.Extensions["GLX"]; !ok { 8225 panic("Cannot issue request 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8226 } 8227 cookie := c.NewCookie(true, true) 8228 c.NewRequest(getTexParameterfvRequest(c, ContextTag, Target, Pname), cookie) 8229 return GetTexParameterfvCookie{cookie} 8230 } 8231 8232 // GetTexParameterfvUnchecked sends an unchecked request. 8233 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 8234 func GetTexParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterfvCookie { 8235 c.ExtLock.RLock() 8236 defer c.ExtLock.RUnlock() 8237 if _, ok := c.Extensions["GLX"]; !ok { 8238 panic("Cannot issue request 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8239 } 8240 cookie := c.NewCookie(false, true) 8241 c.NewRequest(getTexParameterfvRequest(c, ContextTag, Target, Pname), cookie) 8242 return GetTexParameterfvCookie{cookie} 8243 } 8244 8245 // GetTexParameterfvReply represents the data returned from a GetTexParameterfv request. 8246 type GetTexParameterfvReply struct { 8247 Sequence uint16 // sequence number of the request for this reply 8248 Length uint32 // number of bytes in this reply 8249 // padding: 1 bytes 8250 // padding: 4 bytes 8251 N uint32 8252 Datum Float32 8253 // padding: 12 bytes 8254 Data []Float32 // size: xgb.Pad((int(N) * 4)) 8255 } 8256 8257 // Reply blocks and returns the reply data for a GetTexParameterfv request. 8258 func (cook GetTexParameterfvCookie) Reply() (*GetTexParameterfvReply, error) { 8259 buf, err := cook.Cookie.Reply() 8260 if err != nil { 8261 return nil, err 8262 } 8263 if buf == nil { 8264 return nil, nil 8265 } 8266 return getTexParameterfvReply(buf), nil 8267 } 8268 8269 // getTexParameterfvReply reads a byte slice into a GetTexParameterfvReply value. 8270 func getTexParameterfvReply(buf []byte) *GetTexParameterfvReply { 8271 v := new(GetTexParameterfvReply) 8272 b := 1 // skip reply determinant 8273 8274 b += 1 // padding 8275 8276 v.Sequence = xgb.Get16(buf[b:]) 8277 b += 2 8278 8279 v.Length = xgb.Get32(buf[b:]) // 4-byte units 8280 b += 4 8281 8282 b += 4 // padding 8283 8284 v.N = xgb.Get32(buf[b:]) 8285 b += 4 8286 8287 v.Datum = Float32(xgb.Get32(buf[b:])) 8288 b += 4 8289 8290 b += 12 // padding 8291 8292 v.Data = make([]Float32, v.N) 8293 for i := 0; i < int(v.N); i++ { 8294 v.Data[i] = Float32(xgb.Get32(buf[b:])) 8295 b += 4 8296 } 8297 8298 return v 8299 } 8300 8301 // Write request to wire for GetTexParameterfv 8302 // getTexParameterfvRequest writes a GetTexParameterfv request to a byte slice. 8303 func getTexParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 8304 size := 16 8305 b := 0 8306 buf := make([]byte, size) 8307 8308 c.ExtLock.RLock() 8309 buf[b] = c.Extensions["GLX"] 8310 c.ExtLock.RUnlock() 8311 b += 1 8312 8313 buf[b] = 136 // request opcode 8314 b += 1 8315 8316 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 8317 b += 2 8318 8319 xgb.Put32(buf[b:], uint32(ContextTag)) 8320 b += 4 8321 8322 xgb.Put32(buf[b:], Target) 8323 b += 4 8324 8325 xgb.Put32(buf[b:], Pname) 8326 b += 4 8327 8328 return buf 8329 } 8330 8331 // GetTexParameterivCookie is a cookie used only for GetTexParameteriv requests. 8332 type GetTexParameterivCookie struct { 8333 *xgb.Cookie 8334 } 8335 8336 // GetTexParameteriv sends a checked request. 8337 // If an error occurs, it will be returned with the reply by calling GetTexParameterivCookie.Reply() 8338 func GetTexParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterivCookie { 8339 c.ExtLock.RLock() 8340 defer c.ExtLock.RUnlock() 8341 if _, ok := c.Extensions["GLX"]; !ok { 8342 panic("Cannot issue request 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8343 } 8344 cookie := c.NewCookie(true, true) 8345 c.NewRequest(getTexParameterivRequest(c, ContextTag, Target, Pname), cookie) 8346 return GetTexParameterivCookie{cookie} 8347 } 8348 8349 // GetTexParameterivUnchecked sends an unchecked request. 8350 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 8351 func GetTexParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterivCookie { 8352 c.ExtLock.RLock() 8353 defer c.ExtLock.RUnlock() 8354 if _, ok := c.Extensions["GLX"]; !ok { 8355 panic("Cannot issue request 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8356 } 8357 cookie := c.NewCookie(false, true) 8358 c.NewRequest(getTexParameterivRequest(c, ContextTag, Target, Pname), cookie) 8359 return GetTexParameterivCookie{cookie} 8360 } 8361 8362 // GetTexParameterivReply represents the data returned from a GetTexParameteriv request. 8363 type GetTexParameterivReply struct { 8364 Sequence uint16 // sequence number of the request for this reply 8365 Length uint32 // number of bytes in this reply 8366 // padding: 1 bytes 8367 // padding: 4 bytes 8368 N uint32 8369 Datum int32 8370 // padding: 12 bytes 8371 Data []int32 // size: xgb.Pad((int(N) * 4)) 8372 } 8373 8374 // Reply blocks and returns the reply data for a GetTexParameteriv request. 8375 func (cook GetTexParameterivCookie) Reply() (*GetTexParameterivReply, error) { 8376 buf, err := cook.Cookie.Reply() 8377 if err != nil { 8378 return nil, err 8379 } 8380 if buf == nil { 8381 return nil, nil 8382 } 8383 return getTexParameterivReply(buf), nil 8384 } 8385 8386 // getTexParameterivReply reads a byte slice into a GetTexParameterivReply value. 8387 func getTexParameterivReply(buf []byte) *GetTexParameterivReply { 8388 v := new(GetTexParameterivReply) 8389 b := 1 // skip reply determinant 8390 8391 b += 1 // padding 8392 8393 v.Sequence = xgb.Get16(buf[b:]) 8394 b += 2 8395 8396 v.Length = xgb.Get32(buf[b:]) // 4-byte units 8397 b += 4 8398 8399 b += 4 // padding 8400 8401 v.N = xgb.Get32(buf[b:]) 8402 b += 4 8403 8404 v.Datum = int32(xgb.Get32(buf[b:])) 8405 b += 4 8406 8407 b += 12 // padding 8408 8409 v.Data = make([]int32, v.N) 8410 for i := 0; i < int(v.N); i++ { 8411 v.Data[i] = int32(xgb.Get32(buf[b:])) 8412 b += 4 8413 } 8414 8415 return v 8416 } 8417 8418 // Write request to wire for GetTexParameteriv 8419 // getTexParameterivRequest writes a GetTexParameteriv request to a byte slice. 8420 func getTexParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { 8421 size := 16 8422 b := 0 8423 buf := make([]byte, size) 8424 8425 c.ExtLock.RLock() 8426 buf[b] = c.Extensions["GLX"] 8427 c.ExtLock.RUnlock() 8428 b += 1 8429 8430 buf[b] = 137 // request opcode 8431 b += 1 8432 8433 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 8434 b += 2 8435 8436 xgb.Put32(buf[b:], uint32(ContextTag)) 8437 b += 4 8438 8439 xgb.Put32(buf[b:], Target) 8440 b += 4 8441 8442 xgb.Put32(buf[b:], Pname) 8443 b += 4 8444 8445 return buf 8446 } 8447 8448 // GetVisualConfigsCookie is a cookie used only for GetVisualConfigs requests. 8449 type GetVisualConfigsCookie struct { 8450 *xgb.Cookie 8451 } 8452 8453 // GetVisualConfigs sends a checked request. 8454 // If an error occurs, it will be returned with the reply by calling GetVisualConfigsCookie.Reply() 8455 func GetVisualConfigs(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie { 8456 c.ExtLock.RLock() 8457 defer c.ExtLock.RUnlock() 8458 if _, ok := c.Extensions["GLX"]; !ok { 8459 panic("Cannot issue request 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8460 } 8461 cookie := c.NewCookie(true, true) 8462 c.NewRequest(getVisualConfigsRequest(c, Screen), cookie) 8463 return GetVisualConfigsCookie{cookie} 8464 } 8465 8466 // GetVisualConfigsUnchecked sends an unchecked request. 8467 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 8468 func GetVisualConfigsUnchecked(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie { 8469 c.ExtLock.RLock() 8470 defer c.ExtLock.RUnlock() 8471 if _, ok := c.Extensions["GLX"]; !ok { 8472 panic("Cannot issue request 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8473 } 8474 cookie := c.NewCookie(false, true) 8475 c.NewRequest(getVisualConfigsRequest(c, Screen), cookie) 8476 return GetVisualConfigsCookie{cookie} 8477 } 8478 8479 // GetVisualConfigsReply represents the data returned from a GetVisualConfigs request. 8480 type GetVisualConfigsReply struct { 8481 Sequence uint16 // sequence number of the request for this reply 8482 Length uint32 // number of bytes in this reply 8483 // padding: 1 bytes 8484 NumVisuals uint32 8485 NumProperties uint32 8486 // padding: 16 bytes 8487 PropertyList []uint32 // size: xgb.Pad((int(Length) * 4)) 8488 } 8489 8490 // Reply blocks and returns the reply data for a GetVisualConfigs request. 8491 func (cook GetVisualConfigsCookie) Reply() (*GetVisualConfigsReply, error) { 8492 buf, err := cook.Cookie.Reply() 8493 if err != nil { 8494 return nil, err 8495 } 8496 if buf == nil { 8497 return nil, nil 8498 } 8499 return getVisualConfigsReply(buf), nil 8500 } 8501 8502 // getVisualConfigsReply reads a byte slice into a GetVisualConfigsReply value. 8503 func getVisualConfigsReply(buf []byte) *GetVisualConfigsReply { 8504 v := new(GetVisualConfigsReply) 8505 b := 1 // skip reply determinant 8506 8507 b += 1 // padding 8508 8509 v.Sequence = xgb.Get16(buf[b:]) 8510 b += 2 8511 8512 v.Length = xgb.Get32(buf[b:]) // 4-byte units 8513 b += 4 8514 8515 v.NumVisuals = xgb.Get32(buf[b:]) 8516 b += 4 8517 8518 v.NumProperties = xgb.Get32(buf[b:]) 8519 b += 4 8520 8521 b += 16 // padding 8522 8523 v.PropertyList = make([]uint32, v.Length) 8524 for i := 0; i < int(v.Length); i++ { 8525 v.PropertyList[i] = xgb.Get32(buf[b:]) 8526 b += 4 8527 } 8528 8529 return v 8530 } 8531 8532 // Write request to wire for GetVisualConfigs 8533 // getVisualConfigsRequest writes a GetVisualConfigs request to a byte slice. 8534 func getVisualConfigsRequest(c *xgb.Conn, Screen uint32) []byte { 8535 size := 8 8536 b := 0 8537 buf := make([]byte, size) 8538 8539 c.ExtLock.RLock() 8540 buf[b] = c.Extensions["GLX"] 8541 c.ExtLock.RUnlock() 8542 b += 1 8543 8544 buf[b] = 14 // request opcode 8545 b += 1 8546 8547 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 8548 b += 2 8549 8550 xgb.Put32(buf[b:], Screen) 8551 b += 4 8552 8553 return buf 8554 } 8555 8556 // IsDirectCookie is a cookie used only for IsDirect requests. 8557 type IsDirectCookie struct { 8558 *xgb.Cookie 8559 } 8560 8561 // IsDirect sends a checked request. 8562 // If an error occurs, it will be returned with the reply by calling IsDirectCookie.Reply() 8563 func IsDirect(c *xgb.Conn, Context Context) IsDirectCookie { 8564 c.ExtLock.RLock() 8565 defer c.ExtLock.RUnlock() 8566 if _, ok := c.Extensions["GLX"]; !ok { 8567 panic("Cannot issue request 'IsDirect' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8568 } 8569 cookie := c.NewCookie(true, true) 8570 c.NewRequest(isDirectRequest(c, Context), cookie) 8571 return IsDirectCookie{cookie} 8572 } 8573 8574 // IsDirectUnchecked sends an unchecked request. 8575 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 8576 func IsDirectUnchecked(c *xgb.Conn, Context Context) IsDirectCookie { 8577 c.ExtLock.RLock() 8578 defer c.ExtLock.RUnlock() 8579 if _, ok := c.Extensions["GLX"]; !ok { 8580 panic("Cannot issue request 'IsDirect' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8581 } 8582 cookie := c.NewCookie(false, true) 8583 c.NewRequest(isDirectRequest(c, Context), cookie) 8584 return IsDirectCookie{cookie} 8585 } 8586 8587 // IsDirectReply represents the data returned from a IsDirect request. 8588 type IsDirectReply struct { 8589 Sequence uint16 // sequence number of the request for this reply 8590 Length uint32 // number of bytes in this reply 8591 // padding: 1 bytes 8592 IsDirect bool 8593 // padding: 23 bytes 8594 } 8595 8596 // Reply blocks and returns the reply data for a IsDirect request. 8597 func (cook IsDirectCookie) Reply() (*IsDirectReply, error) { 8598 buf, err := cook.Cookie.Reply() 8599 if err != nil { 8600 return nil, err 8601 } 8602 if buf == nil { 8603 return nil, nil 8604 } 8605 return isDirectReply(buf), nil 8606 } 8607 8608 // isDirectReply reads a byte slice into a IsDirectReply value. 8609 func isDirectReply(buf []byte) *IsDirectReply { 8610 v := new(IsDirectReply) 8611 b := 1 // skip reply determinant 8612 8613 b += 1 // padding 8614 8615 v.Sequence = xgb.Get16(buf[b:]) 8616 b += 2 8617 8618 v.Length = xgb.Get32(buf[b:]) // 4-byte units 8619 b += 4 8620 8621 if buf[b] == 1 { 8622 v.IsDirect = true 8623 } else { 8624 v.IsDirect = false 8625 } 8626 b += 1 8627 8628 b += 23 // padding 8629 8630 return v 8631 } 8632 8633 // Write request to wire for IsDirect 8634 // isDirectRequest writes a IsDirect request to a byte slice. 8635 func isDirectRequest(c *xgb.Conn, Context Context) []byte { 8636 size := 8 8637 b := 0 8638 buf := make([]byte, size) 8639 8640 c.ExtLock.RLock() 8641 buf[b] = c.Extensions["GLX"] 8642 c.ExtLock.RUnlock() 8643 b += 1 8644 8645 buf[b] = 6 // request opcode 8646 b += 1 8647 8648 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 8649 b += 2 8650 8651 xgb.Put32(buf[b:], uint32(Context)) 8652 b += 4 8653 8654 return buf 8655 } 8656 8657 // IsListCookie is a cookie used only for IsList requests. 8658 type IsListCookie struct { 8659 *xgb.Cookie 8660 } 8661 8662 // IsList sends a checked request. 8663 // If an error occurs, it will be returned with the reply by calling IsListCookie.Reply() 8664 func IsList(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie { 8665 c.ExtLock.RLock() 8666 defer c.ExtLock.RUnlock() 8667 if _, ok := c.Extensions["GLX"]; !ok { 8668 panic("Cannot issue request 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8669 } 8670 cookie := c.NewCookie(true, true) 8671 c.NewRequest(isListRequest(c, ContextTag, List), cookie) 8672 return IsListCookie{cookie} 8673 } 8674 8675 // IsListUnchecked sends an unchecked request. 8676 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 8677 func IsListUnchecked(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie { 8678 c.ExtLock.RLock() 8679 defer c.ExtLock.RUnlock() 8680 if _, ok := c.Extensions["GLX"]; !ok { 8681 panic("Cannot issue request 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8682 } 8683 cookie := c.NewCookie(false, true) 8684 c.NewRequest(isListRequest(c, ContextTag, List), cookie) 8685 return IsListCookie{cookie} 8686 } 8687 8688 // IsListReply represents the data returned from a IsList request. 8689 type IsListReply struct { 8690 Sequence uint16 // sequence number of the request for this reply 8691 Length uint32 // number of bytes in this reply 8692 // padding: 1 bytes 8693 RetVal Bool32 8694 } 8695 8696 // Reply blocks and returns the reply data for a IsList request. 8697 func (cook IsListCookie) Reply() (*IsListReply, error) { 8698 buf, err := cook.Cookie.Reply() 8699 if err != nil { 8700 return nil, err 8701 } 8702 if buf == nil { 8703 return nil, nil 8704 } 8705 return isListReply(buf), nil 8706 } 8707 8708 // isListReply reads a byte slice into a IsListReply value. 8709 func isListReply(buf []byte) *IsListReply { 8710 v := new(IsListReply) 8711 b := 1 // skip reply determinant 8712 8713 b += 1 // padding 8714 8715 v.Sequence = xgb.Get16(buf[b:]) 8716 b += 2 8717 8718 v.Length = xgb.Get32(buf[b:]) // 4-byte units 8719 b += 4 8720 8721 v.RetVal = Bool32(xgb.Get32(buf[b:])) 8722 b += 4 8723 8724 return v 8725 } 8726 8727 // Write request to wire for IsList 8728 // isListRequest writes a IsList request to a byte slice. 8729 func isListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32) []byte { 8730 size := 12 8731 b := 0 8732 buf := make([]byte, size) 8733 8734 c.ExtLock.RLock() 8735 buf[b] = c.Extensions["GLX"] 8736 c.ExtLock.RUnlock() 8737 b += 1 8738 8739 buf[b] = 141 // request opcode 8740 b += 1 8741 8742 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 8743 b += 2 8744 8745 xgb.Put32(buf[b:], uint32(ContextTag)) 8746 b += 4 8747 8748 xgb.Put32(buf[b:], List) 8749 b += 4 8750 8751 return buf 8752 } 8753 8754 // IsQueryARBCookie is a cookie used only for IsQueryARB requests. 8755 type IsQueryARBCookie struct { 8756 *xgb.Cookie 8757 } 8758 8759 // IsQueryARB sends a checked request. 8760 // If an error occurs, it will be returned with the reply by calling IsQueryARBCookie.Reply() 8761 func IsQueryARB(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie { 8762 c.ExtLock.RLock() 8763 defer c.ExtLock.RUnlock() 8764 if _, ok := c.Extensions["GLX"]; !ok { 8765 panic("Cannot issue request 'IsQueryARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8766 } 8767 cookie := c.NewCookie(true, true) 8768 c.NewRequest(isQueryARBRequest(c, ContextTag, Id), cookie) 8769 return IsQueryARBCookie{cookie} 8770 } 8771 8772 // IsQueryARBUnchecked sends an unchecked request. 8773 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 8774 func IsQueryARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie { 8775 c.ExtLock.RLock() 8776 defer c.ExtLock.RUnlock() 8777 if _, ok := c.Extensions["GLX"]; !ok { 8778 panic("Cannot issue request 'IsQueryARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8779 } 8780 cookie := c.NewCookie(false, true) 8781 c.NewRequest(isQueryARBRequest(c, ContextTag, Id), cookie) 8782 return IsQueryARBCookie{cookie} 8783 } 8784 8785 // IsQueryARBReply represents the data returned from a IsQueryARB request. 8786 type IsQueryARBReply struct { 8787 Sequence uint16 // sequence number of the request for this reply 8788 Length uint32 // number of bytes in this reply 8789 // padding: 1 bytes 8790 RetVal Bool32 8791 } 8792 8793 // Reply blocks and returns the reply data for a IsQueryARB request. 8794 func (cook IsQueryARBCookie) Reply() (*IsQueryARBReply, error) { 8795 buf, err := cook.Cookie.Reply() 8796 if err != nil { 8797 return nil, err 8798 } 8799 if buf == nil { 8800 return nil, nil 8801 } 8802 return isQueryARBReply(buf), nil 8803 } 8804 8805 // isQueryARBReply reads a byte slice into a IsQueryARBReply value. 8806 func isQueryARBReply(buf []byte) *IsQueryARBReply { 8807 v := new(IsQueryARBReply) 8808 b := 1 // skip reply determinant 8809 8810 b += 1 // padding 8811 8812 v.Sequence = xgb.Get16(buf[b:]) 8813 b += 2 8814 8815 v.Length = xgb.Get32(buf[b:]) // 4-byte units 8816 b += 4 8817 8818 v.RetVal = Bool32(xgb.Get32(buf[b:])) 8819 b += 4 8820 8821 return v 8822 } 8823 8824 // Write request to wire for IsQueryARB 8825 // isQueryARBRequest writes a IsQueryARB request to a byte slice. 8826 func isQueryARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32) []byte { 8827 size := 12 8828 b := 0 8829 buf := make([]byte, size) 8830 8831 c.ExtLock.RLock() 8832 buf[b] = c.Extensions["GLX"] 8833 c.ExtLock.RUnlock() 8834 b += 1 8835 8836 buf[b] = 163 // request opcode 8837 b += 1 8838 8839 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 8840 b += 2 8841 8842 xgb.Put32(buf[b:], uint32(ContextTag)) 8843 b += 4 8844 8845 xgb.Put32(buf[b:], Id) 8846 b += 4 8847 8848 return buf 8849 } 8850 8851 // IsTextureCookie is a cookie used only for IsTexture requests. 8852 type IsTextureCookie struct { 8853 *xgb.Cookie 8854 } 8855 8856 // IsTexture sends a checked request. 8857 // If an error occurs, it will be returned with the reply by calling IsTextureCookie.Reply() 8858 func IsTexture(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCookie { 8859 c.ExtLock.RLock() 8860 defer c.ExtLock.RUnlock() 8861 if _, ok := c.Extensions["GLX"]; !ok { 8862 panic("Cannot issue request 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8863 } 8864 cookie := c.NewCookie(true, true) 8865 c.NewRequest(isTextureRequest(c, ContextTag, Texture), cookie) 8866 return IsTextureCookie{cookie} 8867 } 8868 8869 // IsTextureUnchecked sends an unchecked request. 8870 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 8871 func IsTextureUnchecked(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCookie { 8872 c.ExtLock.RLock() 8873 defer c.ExtLock.RUnlock() 8874 if _, ok := c.Extensions["GLX"]; !ok { 8875 panic("Cannot issue request 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8876 } 8877 cookie := c.NewCookie(false, true) 8878 c.NewRequest(isTextureRequest(c, ContextTag, Texture), cookie) 8879 return IsTextureCookie{cookie} 8880 } 8881 8882 // IsTextureReply represents the data returned from a IsTexture request. 8883 type IsTextureReply struct { 8884 Sequence uint16 // sequence number of the request for this reply 8885 Length uint32 // number of bytes in this reply 8886 // padding: 1 bytes 8887 RetVal Bool32 8888 } 8889 8890 // Reply blocks and returns the reply data for a IsTexture request. 8891 func (cook IsTextureCookie) Reply() (*IsTextureReply, error) { 8892 buf, err := cook.Cookie.Reply() 8893 if err != nil { 8894 return nil, err 8895 } 8896 if buf == nil { 8897 return nil, nil 8898 } 8899 return isTextureReply(buf), nil 8900 } 8901 8902 // isTextureReply reads a byte slice into a IsTextureReply value. 8903 func isTextureReply(buf []byte) *IsTextureReply { 8904 v := new(IsTextureReply) 8905 b := 1 // skip reply determinant 8906 8907 b += 1 // padding 8908 8909 v.Sequence = xgb.Get16(buf[b:]) 8910 b += 2 8911 8912 v.Length = xgb.Get32(buf[b:]) // 4-byte units 8913 b += 4 8914 8915 v.RetVal = Bool32(xgb.Get32(buf[b:])) 8916 b += 4 8917 8918 return v 8919 } 8920 8921 // Write request to wire for IsTexture 8922 // isTextureRequest writes a IsTexture request to a byte slice. 8923 func isTextureRequest(c *xgb.Conn, ContextTag ContextTag, Texture uint32) []byte { 8924 size := 12 8925 b := 0 8926 buf := make([]byte, size) 8927 8928 c.ExtLock.RLock() 8929 buf[b] = c.Extensions["GLX"] 8930 c.ExtLock.RUnlock() 8931 b += 1 8932 8933 buf[b] = 146 // request opcode 8934 b += 1 8935 8936 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 8937 b += 2 8938 8939 xgb.Put32(buf[b:], uint32(ContextTag)) 8940 b += 4 8941 8942 xgb.Put32(buf[b:], Texture) 8943 b += 4 8944 8945 return buf 8946 } 8947 8948 // MakeContextCurrentCookie is a cookie used only for MakeContextCurrent requests. 8949 type MakeContextCurrentCookie struct { 8950 *xgb.Cookie 8951 } 8952 8953 // MakeContextCurrent sends a checked request. 8954 // If an error occurs, it will be returned with the reply by calling MakeContextCurrentCookie.Reply() 8955 func MakeContextCurrent(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable, ReadDrawable Drawable, Context Context) MakeContextCurrentCookie { 8956 c.ExtLock.RLock() 8957 defer c.ExtLock.RUnlock() 8958 if _, ok := c.Extensions["GLX"]; !ok { 8959 panic("Cannot issue request 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8960 } 8961 cookie := c.NewCookie(true, true) 8962 c.NewRequest(makeContextCurrentRequest(c, OldContextTag, Drawable, ReadDrawable, Context), cookie) 8963 return MakeContextCurrentCookie{cookie} 8964 } 8965 8966 // MakeContextCurrentUnchecked sends an unchecked request. 8967 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 8968 func MakeContextCurrentUnchecked(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable, ReadDrawable Drawable, Context Context) MakeContextCurrentCookie { 8969 c.ExtLock.RLock() 8970 defer c.ExtLock.RUnlock() 8971 if _, ok := c.Extensions["GLX"]; !ok { 8972 panic("Cannot issue request 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 8973 } 8974 cookie := c.NewCookie(false, true) 8975 c.NewRequest(makeContextCurrentRequest(c, OldContextTag, Drawable, ReadDrawable, Context), cookie) 8976 return MakeContextCurrentCookie{cookie} 8977 } 8978 8979 // MakeContextCurrentReply represents the data returned from a MakeContextCurrent request. 8980 type MakeContextCurrentReply struct { 8981 Sequence uint16 // sequence number of the request for this reply 8982 Length uint32 // number of bytes in this reply 8983 // padding: 1 bytes 8984 ContextTag ContextTag 8985 // padding: 20 bytes 8986 } 8987 8988 // Reply blocks and returns the reply data for a MakeContextCurrent request. 8989 func (cook MakeContextCurrentCookie) Reply() (*MakeContextCurrentReply, error) { 8990 buf, err := cook.Cookie.Reply() 8991 if err != nil { 8992 return nil, err 8993 } 8994 if buf == nil { 8995 return nil, nil 8996 } 8997 return makeContextCurrentReply(buf), nil 8998 } 8999 9000 // makeContextCurrentReply reads a byte slice into a MakeContextCurrentReply value. 9001 func makeContextCurrentReply(buf []byte) *MakeContextCurrentReply { 9002 v := new(MakeContextCurrentReply) 9003 b := 1 // skip reply determinant 9004 9005 b += 1 // padding 9006 9007 v.Sequence = xgb.Get16(buf[b:]) 9008 b += 2 9009 9010 v.Length = xgb.Get32(buf[b:]) // 4-byte units 9011 b += 4 9012 9013 v.ContextTag = ContextTag(xgb.Get32(buf[b:])) 9014 b += 4 9015 9016 b += 20 // padding 9017 9018 return v 9019 } 9020 9021 // Write request to wire for MakeContextCurrent 9022 // makeContextCurrentRequest writes a MakeContextCurrent request to a byte slice. 9023 func makeContextCurrentRequest(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable, ReadDrawable Drawable, Context Context) []byte { 9024 size := 20 9025 b := 0 9026 buf := make([]byte, size) 9027 9028 c.ExtLock.RLock() 9029 buf[b] = c.Extensions["GLX"] 9030 c.ExtLock.RUnlock() 9031 b += 1 9032 9033 buf[b] = 26 // request opcode 9034 b += 1 9035 9036 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9037 b += 2 9038 9039 xgb.Put32(buf[b:], uint32(OldContextTag)) 9040 b += 4 9041 9042 xgb.Put32(buf[b:], uint32(Drawable)) 9043 b += 4 9044 9045 xgb.Put32(buf[b:], uint32(ReadDrawable)) 9046 b += 4 9047 9048 xgb.Put32(buf[b:], uint32(Context)) 9049 b += 4 9050 9051 return buf 9052 } 9053 9054 // MakeCurrentCookie is a cookie used only for MakeCurrent requests. 9055 type MakeCurrentCookie struct { 9056 *xgb.Cookie 9057 } 9058 9059 // MakeCurrent sends a checked request. 9060 // If an error occurs, it will be returned with the reply by calling MakeCurrentCookie.Reply() 9061 func MakeCurrent(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) MakeCurrentCookie { 9062 c.ExtLock.RLock() 9063 defer c.ExtLock.RUnlock() 9064 if _, ok := c.Extensions["GLX"]; !ok { 9065 panic("Cannot issue request 'MakeCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9066 } 9067 cookie := c.NewCookie(true, true) 9068 c.NewRequest(makeCurrentRequest(c, Drawable, Context, OldContextTag), cookie) 9069 return MakeCurrentCookie{cookie} 9070 } 9071 9072 // MakeCurrentUnchecked sends an unchecked request. 9073 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9074 func MakeCurrentUnchecked(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) MakeCurrentCookie { 9075 c.ExtLock.RLock() 9076 defer c.ExtLock.RUnlock() 9077 if _, ok := c.Extensions["GLX"]; !ok { 9078 panic("Cannot issue request 'MakeCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9079 } 9080 cookie := c.NewCookie(false, true) 9081 c.NewRequest(makeCurrentRequest(c, Drawable, Context, OldContextTag), cookie) 9082 return MakeCurrentCookie{cookie} 9083 } 9084 9085 // MakeCurrentReply represents the data returned from a MakeCurrent request. 9086 type MakeCurrentReply struct { 9087 Sequence uint16 // sequence number of the request for this reply 9088 Length uint32 // number of bytes in this reply 9089 // padding: 1 bytes 9090 ContextTag ContextTag 9091 // padding: 20 bytes 9092 } 9093 9094 // Reply blocks and returns the reply data for a MakeCurrent request. 9095 func (cook MakeCurrentCookie) Reply() (*MakeCurrentReply, error) { 9096 buf, err := cook.Cookie.Reply() 9097 if err != nil { 9098 return nil, err 9099 } 9100 if buf == nil { 9101 return nil, nil 9102 } 9103 return makeCurrentReply(buf), nil 9104 } 9105 9106 // makeCurrentReply reads a byte slice into a MakeCurrentReply value. 9107 func makeCurrentReply(buf []byte) *MakeCurrentReply { 9108 v := new(MakeCurrentReply) 9109 b := 1 // skip reply determinant 9110 9111 b += 1 // padding 9112 9113 v.Sequence = xgb.Get16(buf[b:]) 9114 b += 2 9115 9116 v.Length = xgb.Get32(buf[b:]) // 4-byte units 9117 b += 4 9118 9119 v.ContextTag = ContextTag(xgb.Get32(buf[b:])) 9120 b += 4 9121 9122 b += 20 // padding 9123 9124 return v 9125 } 9126 9127 // Write request to wire for MakeCurrent 9128 // makeCurrentRequest writes a MakeCurrent request to a byte slice. 9129 func makeCurrentRequest(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) []byte { 9130 size := 16 9131 b := 0 9132 buf := make([]byte, size) 9133 9134 c.ExtLock.RLock() 9135 buf[b] = c.Extensions["GLX"] 9136 c.ExtLock.RUnlock() 9137 b += 1 9138 9139 buf[b] = 5 // request opcode 9140 b += 1 9141 9142 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9143 b += 2 9144 9145 xgb.Put32(buf[b:], uint32(Drawable)) 9146 b += 4 9147 9148 xgb.Put32(buf[b:], uint32(Context)) 9149 b += 4 9150 9151 xgb.Put32(buf[b:], uint32(OldContextTag)) 9152 b += 4 9153 9154 return buf 9155 } 9156 9157 // NewListCookie is a cookie used only for NewList requests. 9158 type NewListCookie struct { 9159 *xgb.Cookie 9160 } 9161 9162 // NewList sends an unchecked request. 9163 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9164 func NewList(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) NewListCookie { 9165 c.ExtLock.RLock() 9166 defer c.ExtLock.RUnlock() 9167 if _, ok := c.Extensions["GLX"]; !ok { 9168 panic("Cannot issue request 'NewList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9169 } 9170 cookie := c.NewCookie(false, false) 9171 c.NewRequest(newListRequest(c, ContextTag, List, Mode), cookie) 9172 return NewListCookie{cookie} 9173 } 9174 9175 // NewListChecked sends a checked request. 9176 // If an error occurs, it can be retrieved using NewListCookie.Check() 9177 func NewListChecked(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) NewListCookie { 9178 c.ExtLock.RLock() 9179 defer c.ExtLock.RUnlock() 9180 if _, ok := c.Extensions["GLX"]; !ok { 9181 panic("Cannot issue request 'NewList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9182 } 9183 cookie := c.NewCookie(true, false) 9184 c.NewRequest(newListRequest(c, ContextTag, List, Mode), cookie) 9185 return NewListCookie{cookie} 9186 } 9187 9188 // Check returns an error if one occurred for checked requests that are not expecting a reply. 9189 // This cannot be called for requests expecting a reply, nor for unchecked requests. 9190 func (cook NewListCookie) Check() error { 9191 return cook.Cookie.Check() 9192 } 9193 9194 // Write request to wire for NewList 9195 // newListRequest writes a NewList request to a byte slice. 9196 func newListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) []byte { 9197 size := 16 9198 b := 0 9199 buf := make([]byte, size) 9200 9201 c.ExtLock.RLock() 9202 buf[b] = c.Extensions["GLX"] 9203 c.ExtLock.RUnlock() 9204 b += 1 9205 9206 buf[b] = 101 // request opcode 9207 b += 1 9208 9209 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9210 b += 2 9211 9212 xgb.Put32(buf[b:], uint32(ContextTag)) 9213 b += 4 9214 9215 xgb.Put32(buf[b:], List) 9216 b += 4 9217 9218 xgb.Put32(buf[b:], Mode) 9219 b += 4 9220 9221 return buf 9222 } 9223 9224 // PixelStorefCookie is a cookie used only for PixelStoref requests. 9225 type PixelStorefCookie struct { 9226 *xgb.Cookie 9227 } 9228 9229 // PixelStoref sends an unchecked request. 9230 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9231 func PixelStoref(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) PixelStorefCookie { 9232 c.ExtLock.RLock() 9233 defer c.ExtLock.RUnlock() 9234 if _, ok := c.Extensions["GLX"]; !ok { 9235 panic("Cannot issue request 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9236 } 9237 cookie := c.NewCookie(false, false) 9238 c.NewRequest(pixelStorefRequest(c, ContextTag, Pname, Datum), cookie) 9239 return PixelStorefCookie{cookie} 9240 } 9241 9242 // PixelStorefChecked sends a checked request. 9243 // If an error occurs, it can be retrieved using PixelStorefCookie.Check() 9244 func PixelStorefChecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) PixelStorefCookie { 9245 c.ExtLock.RLock() 9246 defer c.ExtLock.RUnlock() 9247 if _, ok := c.Extensions["GLX"]; !ok { 9248 panic("Cannot issue request 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9249 } 9250 cookie := c.NewCookie(true, false) 9251 c.NewRequest(pixelStorefRequest(c, ContextTag, Pname, Datum), cookie) 9252 return PixelStorefCookie{cookie} 9253 } 9254 9255 // Check returns an error if one occurred for checked requests that are not expecting a reply. 9256 // This cannot be called for requests expecting a reply, nor for unchecked requests. 9257 func (cook PixelStorefCookie) Check() error { 9258 return cook.Cookie.Check() 9259 } 9260 9261 // Write request to wire for PixelStoref 9262 // pixelStorefRequest writes a PixelStoref request to a byte slice. 9263 func pixelStorefRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) []byte { 9264 size := 16 9265 b := 0 9266 buf := make([]byte, size) 9267 9268 c.ExtLock.RLock() 9269 buf[b] = c.Extensions["GLX"] 9270 c.ExtLock.RUnlock() 9271 b += 1 9272 9273 buf[b] = 109 // request opcode 9274 b += 1 9275 9276 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9277 b += 2 9278 9279 xgb.Put32(buf[b:], uint32(ContextTag)) 9280 b += 4 9281 9282 xgb.Put32(buf[b:], Pname) 9283 b += 4 9284 9285 xgb.Put32(buf[b:], uint32(Datum)) 9286 b += 4 9287 9288 return buf 9289 } 9290 9291 // PixelStoreiCookie is a cookie used only for PixelStorei requests. 9292 type PixelStoreiCookie struct { 9293 *xgb.Cookie 9294 } 9295 9296 // PixelStorei sends an unchecked request. 9297 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9298 func PixelStorei(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie { 9299 c.ExtLock.RLock() 9300 defer c.ExtLock.RUnlock() 9301 if _, ok := c.Extensions["GLX"]; !ok { 9302 panic("Cannot issue request 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9303 } 9304 cookie := c.NewCookie(false, false) 9305 c.NewRequest(pixelStoreiRequest(c, ContextTag, Pname, Datum), cookie) 9306 return PixelStoreiCookie{cookie} 9307 } 9308 9309 // PixelStoreiChecked sends a checked request. 9310 // If an error occurs, it can be retrieved using PixelStoreiCookie.Check() 9311 func PixelStoreiChecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie { 9312 c.ExtLock.RLock() 9313 defer c.ExtLock.RUnlock() 9314 if _, ok := c.Extensions["GLX"]; !ok { 9315 panic("Cannot issue request 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9316 } 9317 cookie := c.NewCookie(true, false) 9318 c.NewRequest(pixelStoreiRequest(c, ContextTag, Pname, Datum), cookie) 9319 return PixelStoreiCookie{cookie} 9320 } 9321 9322 // Check returns an error if one occurred for checked requests that are not expecting a reply. 9323 // This cannot be called for requests expecting a reply, nor for unchecked requests. 9324 func (cook PixelStoreiCookie) Check() error { 9325 return cook.Cookie.Check() 9326 } 9327 9328 // Write request to wire for PixelStorei 9329 // pixelStoreiRequest writes a PixelStorei request to a byte slice. 9330 func pixelStoreiRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) []byte { 9331 size := 16 9332 b := 0 9333 buf := make([]byte, size) 9334 9335 c.ExtLock.RLock() 9336 buf[b] = c.Extensions["GLX"] 9337 c.ExtLock.RUnlock() 9338 b += 1 9339 9340 buf[b] = 110 // request opcode 9341 b += 1 9342 9343 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9344 b += 2 9345 9346 xgb.Put32(buf[b:], uint32(ContextTag)) 9347 b += 4 9348 9349 xgb.Put32(buf[b:], Pname) 9350 b += 4 9351 9352 xgb.Put32(buf[b:], uint32(Datum)) 9353 b += 4 9354 9355 return buf 9356 } 9357 9358 // QueryContextCookie is a cookie used only for QueryContext requests. 9359 type QueryContextCookie struct { 9360 *xgb.Cookie 9361 } 9362 9363 // QueryContext sends a checked request. 9364 // If an error occurs, it will be returned with the reply by calling QueryContextCookie.Reply() 9365 func QueryContext(c *xgb.Conn, Context Context) QueryContextCookie { 9366 c.ExtLock.RLock() 9367 defer c.ExtLock.RUnlock() 9368 if _, ok := c.Extensions["GLX"]; !ok { 9369 panic("Cannot issue request 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9370 } 9371 cookie := c.NewCookie(true, true) 9372 c.NewRequest(queryContextRequest(c, Context), cookie) 9373 return QueryContextCookie{cookie} 9374 } 9375 9376 // QueryContextUnchecked sends an unchecked request. 9377 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9378 func QueryContextUnchecked(c *xgb.Conn, Context Context) QueryContextCookie { 9379 c.ExtLock.RLock() 9380 defer c.ExtLock.RUnlock() 9381 if _, ok := c.Extensions["GLX"]; !ok { 9382 panic("Cannot issue request 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9383 } 9384 cookie := c.NewCookie(false, true) 9385 c.NewRequest(queryContextRequest(c, Context), cookie) 9386 return QueryContextCookie{cookie} 9387 } 9388 9389 // QueryContextReply represents the data returned from a QueryContext request. 9390 type QueryContextReply struct { 9391 Sequence uint16 // sequence number of the request for this reply 9392 Length uint32 // number of bytes in this reply 9393 // padding: 1 bytes 9394 NumAttribs uint32 9395 // padding: 20 bytes 9396 Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4)) 9397 } 9398 9399 // Reply blocks and returns the reply data for a QueryContext request. 9400 func (cook QueryContextCookie) Reply() (*QueryContextReply, error) { 9401 buf, err := cook.Cookie.Reply() 9402 if err != nil { 9403 return nil, err 9404 } 9405 if buf == nil { 9406 return nil, nil 9407 } 9408 return queryContextReply(buf), nil 9409 } 9410 9411 // queryContextReply reads a byte slice into a QueryContextReply value. 9412 func queryContextReply(buf []byte) *QueryContextReply { 9413 v := new(QueryContextReply) 9414 b := 1 // skip reply determinant 9415 9416 b += 1 // padding 9417 9418 v.Sequence = xgb.Get16(buf[b:]) 9419 b += 2 9420 9421 v.Length = xgb.Get32(buf[b:]) // 4-byte units 9422 b += 4 9423 9424 v.NumAttribs = xgb.Get32(buf[b:]) 9425 b += 4 9426 9427 b += 20 // padding 9428 9429 v.Attribs = make([]uint32, (int(v.NumAttribs) * 2)) 9430 for i := 0; i < int((int(v.NumAttribs) * 2)); i++ { 9431 v.Attribs[i] = xgb.Get32(buf[b:]) 9432 b += 4 9433 } 9434 9435 return v 9436 } 9437 9438 // Write request to wire for QueryContext 9439 // queryContextRequest writes a QueryContext request to a byte slice. 9440 func queryContextRequest(c *xgb.Conn, Context Context) []byte { 9441 size := 8 9442 b := 0 9443 buf := make([]byte, size) 9444 9445 c.ExtLock.RLock() 9446 buf[b] = c.Extensions["GLX"] 9447 c.ExtLock.RUnlock() 9448 b += 1 9449 9450 buf[b] = 25 // request opcode 9451 b += 1 9452 9453 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9454 b += 2 9455 9456 xgb.Put32(buf[b:], uint32(Context)) 9457 b += 4 9458 9459 return buf 9460 } 9461 9462 // QueryExtensionsStringCookie is a cookie used only for QueryExtensionsString requests. 9463 type QueryExtensionsStringCookie struct { 9464 *xgb.Cookie 9465 } 9466 9467 // QueryExtensionsString sends a checked request. 9468 // If an error occurs, it will be returned with the reply by calling QueryExtensionsStringCookie.Reply() 9469 func QueryExtensionsString(c *xgb.Conn, Screen uint32) QueryExtensionsStringCookie { 9470 c.ExtLock.RLock() 9471 defer c.ExtLock.RUnlock() 9472 if _, ok := c.Extensions["GLX"]; !ok { 9473 panic("Cannot issue request 'QueryExtensionsString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9474 } 9475 cookie := c.NewCookie(true, true) 9476 c.NewRequest(queryExtensionsStringRequest(c, Screen), cookie) 9477 return QueryExtensionsStringCookie{cookie} 9478 } 9479 9480 // QueryExtensionsStringUnchecked sends an unchecked request. 9481 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9482 func QueryExtensionsStringUnchecked(c *xgb.Conn, Screen uint32) QueryExtensionsStringCookie { 9483 c.ExtLock.RLock() 9484 defer c.ExtLock.RUnlock() 9485 if _, ok := c.Extensions["GLX"]; !ok { 9486 panic("Cannot issue request 'QueryExtensionsString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9487 } 9488 cookie := c.NewCookie(false, true) 9489 c.NewRequest(queryExtensionsStringRequest(c, Screen), cookie) 9490 return QueryExtensionsStringCookie{cookie} 9491 } 9492 9493 // QueryExtensionsStringReply represents the data returned from a QueryExtensionsString request. 9494 type QueryExtensionsStringReply struct { 9495 Sequence uint16 // sequence number of the request for this reply 9496 Length uint32 // number of bytes in this reply 9497 // padding: 1 bytes 9498 // padding: 4 bytes 9499 N uint32 9500 // padding: 16 bytes 9501 } 9502 9503 // Reply blocks and returns the reply data for a QueryExtensionsString request. 9504 func (cook QueryExtensionsStringCookie) Reply() (*QueryExtensionsStringReply, error) { 9505 buf, err := cook.Cookie.Reply() 9506 if err != nil { 9507 return nil, err 9508 } 9509 if buf == nil { 9510 return nil, nil 9511 } 9512 return queryExtensionsStringReply(buf), nil 9513 } 9514 9515 // queryExtensionsStringReply reads a byte slice into a QueryExtensionsStringReply value. 9516 func queryExtensionsStringReply(buf []byte) *QueryExtensionsStringReply { 9517 v := new(QueryExtensionsStringReply) 9518 b := 1 // skip reply determinant 9519 9520 b += 1 // padding 9521 9522 v.Sequence = xgb.Get16(buf[b:]) 9523 b += 2 9524 9525 v.Length = xgb.Get32(buf[b:]) // 4-byte units 9526 b += 4 9527 9528 b += 4 // padding 9529 9530 v.N = xgb.Get32(buf[b:]) 9531 b += 4 9532 9533 b += 16 // padding 9534 9535 return v 9536 } 9537 9538 // Write request to wire for QueryExtensionsString 9539 // queryExtensionsStringRequest writes a QueryExtensionsString request to a byte slice. 9540 func queryExtensionsStringRequest(c *xgb.Conn, Screen uint32) []byte { 9541 size := 8 9542 b := 0 9543 buf := make([]byte, size) 9544 9545 c.ExtLock.RLock() 9546 buf[b] = c.Extensions["GLX"] 9547 c.ExtLock.RUnlock() 9548 b += 1 9549 9550 buf[b] = 18 // request opcode 9551 b += 1 9552 9553 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9554 b += 2 9555 9556 xgb.Put32(buf[b:], Screen) 9557 b += 4 9558 9559 return buf 9560 } 9561 9562 // QueryServerStringCookie is a cookie used only for QueryServerString requests. 9563 type QueryServerStringCookie struct { 9564 *xgb.Cookie 9565 } 9566 9567 // QueryServerString sends a checked request. 9568 // If an error occurs, it will be returned with the reply by calling QueryServerStringCookie.Reply() 9569 func QueryServerString(c *xgb.Conn, Screen uint32, Name uint32) QueryServerStringCookie { 9570 c.ExtLock.RLock() 9571 defer c.ExtLock.RUnlock() 9572 if _, ok := c.Extensions["GLX"]; !ok { 9573 panic("Cannot issue request 'QueryServerString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9574 } 9575 cookie := c.NewCookie(true, true) 9576 c.NewRequest(queryServerStringRequest(c, Screen, Name), cookie) 9577 return QueryServerStringCookie{cookie} 9578 } 9579 9580 // QueryServerStringUnchecked sends an unchecked request. 9581 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9582 func QueryServerStringUnchecked(c *xgb.Conn, Screen uint32, Name uint32) QueryServerStringCookie { 9583 c.ExtLock.RLock() 9584 defer c.ExtLock.RUnlock() 9585 if _, ok := c.Extensions["GLX"]; !ok { 9586 panic("Cannot issue request 'QueryServerString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9587 } 9588 cookie := c.NewCookie(false, true) 9589 c.NewRequest(queryServerStringRequest(c, Screen, Name), cookie) 9590 return QueryServerStringCookie{cookie} 9591 } 9592 9593 // QueryServerStringReply represents the data returned from a QueryServerString request. 9594 type QueryServerStringReply struct { 9595 Sequence uint16 // sequence number of the request for this reply 9596 Length uint32 // number of bytes in this reply 9597 // padding: 1 bytes 9598 // padding: 4 bytes 9599 StrLen uint32 9600 // padding: 16 bytes 9601 String string // size: xgb.Pad((int(StrLen) * 1)) 9602 } 9603 9604 // Reply blocks and returns the reply data for a QueryServerString request. 9605 func (cook QueryServerStringCookie) Reply() (*QueryServerStringReply, error) { 9606 buf, err := cook.Cookie.Reply() 9607 if err != nil { 9608 return nil, err 9609 } 9610 if buf == nil { 9611 return nil, nil 9612 } 9613 return queryServerStringReply(buf), nil 9614 } 9615 9616 // queryServerStringReply reads a byte slice into a QueryServerStringReply value. 9617 func queryServerStringReply(buf []byte) *QueryServerStringReply { 9618 v := new(QueryServerStringReply) 9619 b := 1 // skip reply determinant 9620 9621 b += 1 // padding 9622 9623 v.Sequence = xgb.Get16(buf[b:]) 9624 b += 2 9625 9626 v.Length = xgb.Get32(buf[b:]) // 4-byte units 9627 b += 4 9628 9629 b += 4 // padding 9630 9631 v.StrLen = xgb.Get32(buf[b:]) 9632 b += 4 9633 9634 b += 16 // padding 9635 9636 { 9637 byteString := make([]byte, v.StrLen) 9638 copy(byteString[:v.StrLen], buf[b:]) 9639 v.String = string(byteString) 9640 b += int(v.StrLen) 9641 } 9642 9643 return v 9644 } 9645 9646 // Write request to wire for QueryServerString 9647 // queryServerStringRequest writes a QueryServerString request to a byte slice. 9648 func queryServerStringRequest(c *xgb.Conn, Screen uint32, Name uint32) []byte { 9649 size := 12 9650 b := 0 9651 buf := make([]byte, size) 9652 9653 c.ExtLock.RLock() 9654 buf[b] = c.Extensions["GLX"] 9655 c.ExtLock.RUnlock() 9656 b += 1 9657 9658 buf[b] = 19 // request opcode 9659 b += 1 9660 9661 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9662 b += 2 9663 9664 xgb.Put32(buf[b:], Screen) 9665 b += 4 9666 9667 xgb.Put32(buf[b:], Name) 9668 b += 4 9669 9670 return buf 9671 } 9672 9673 // QueryVersionCookie is a cookie used only for QueryVersion requests. 9674 type QueryVersionCookie struct { 9675 *xgb.Cookie 9676 } 9677 9678 // QueryVersion sends a checked request. 9679 // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() 9680 func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { 9681 c.ExtLock.RLock() 9682 defer c.ExtLock.RUnlock() 9683 if _, ok := c.Extensions["GLX"]; !ok { 9684 panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9685 } 9686 cookie := c.NewCookie(true, true) 9687 c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie) 9688 return QueryVersionCookie{cookie} 9689 } 9690 9691 // QueryVersionUnchecked sends an unchecked request. 9692 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9693 func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { 9694 c.ExtLock.RLock() 9695 defer c.ExtLock.RUnlock() 9696 if _, ok := c.Extensions["GLX"]; !ok { 9697 panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9698 } 9699 cookie := c.NewCookie(false, true) 9700 c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie) 9701 return QueryVersionCookie{cookie} 9702 } 9703 9704 // QueryVersionReply represents the data returned from a QueryVersion request. 9705 type QueryVersionReply struct { 9706 Sequence uint16 // sequence number of the request for this reply 9707 Length uint32 // number of bytes in this reply 9708 // padding: 1 bytes 9709 MajorVersion uint32 9710 MinorVersion uint32 9711 // padding: 16 bytes 9712 } 9713 9714 // Reply blocks and returns the reply data for a QueryVersion request. 9715 func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { 9716 buf, err := cook.Cookie.Reply() 9717 if err != nil { 9718 return nil, err 9719 } 9720 if buf == nil { 9721 return nil, nil 9722 } 9723 return queryVersionReply(buf), nil 9724 } 9725 9726 // queryVersionReply reads a byte slice into a QueryVersionReply value. 9727 func queryVersionReply(buf []byte) *QueryVersionReply { 9728 v := new(QueryVersionReply) 9729 b := 1 // skip reply determinant 9730 9731 b += 1 // padding 9732 9733 v.Sequence = xgb.Get16(buf[b:]) 9734 b += 2 9735 9736 v.Length = xgb.Get32(buf[b:]) // 4-byte units 9737 b += 4 9738 9739 v.MajorVersion = xgb.Get32(buf[b:]) 9740 b += 4 9741 9742 v.MinorVersion = xgb.Get32(buf[b:]) 9743 b += 4 9744 9745 b += 16 // padding 9746 9747 return v 9748 } 9749 9750 // Write request to wire for QueryVersion 9751 // queryVersionRequest writes a QueryVersion request to a byte slice. 9752 func queryVersionRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) []byte { 9753 size := 12 9754 b := 0 9755 buf := make([]byte, size) 9756 9757 c.ExtLock.RLock() 9758 buf[b] = c.Extensions["GLX"] 9759 c.ExtLock.RUnlock() 9760 b += 1 9761 9762 buf[b] = 7 // request opcode 9763 b += 1 9764 9765 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9766 b += 2 9767 9768 xgb.Put32(buf[b:], MajorVersion) 9769 b += 4 9770 9771 xgb.Put32(buf[b:], MinorVersion) 9772 b += 4 9773 9774 return buf 9775 } 9776 9777 // ReadPixelsCookie is a cookie used only for ReadPixels requests. 9778 type ReadPixelsCookie struct { 9779 *xgb.Cookie 9780 } 9781 9782 // ReadPixels sends a checked request. 9783 // If an error occurs, it will be returned with the reply by calling ReadPixelsCookie.Reply() 9784 func ReadPixels(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) ReadPixelsCookie { 9785 c.ExtLock.RLock() 9786 defer c.ExtLock.RUnlock() 9787 if _, ok := c.Extensions["GLX"]; !ok { 9788 panic("Cannot issue request 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9789 } 9790 cookie := c.NewCookie(true, true) 9791 c.NewRequest(readPixelsRequest(c, ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie) 9792 return ReadPixelsCookie{cookie} 9793 } 9794 9795 // ReadPixelsUnchecked sends an unchecked request. 9796 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9797 func ReadPixelsUnchecked(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) ReadPixelsCookie { 9798 c.ExtLock.RLock() 9799 defer c.ExtLock.RUnlock() 9800 if _, ok := c.Extensions["GLX"]; !ok { 9801 panic("Cannot issue request 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9802 } 9803 cookie := c.NewCookie(false, true) 9804 c.NewRequest(readPixelsRequest(c, ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie) 9805 return ReadPixelsCookie{cookie} 9806 } 9807 9808 // ReadPixelsReply represents the data returned from a ReadPixels request. 9809 type ReadPixelsReply struct { 9810 Sequence uint16 // sequence number of the request for this reply 9811 Length uint32 // number of bytes in this reply 9812 // padding: 1 bytes 9813 // padding: 24 bytes 9814 Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 9815 } 9816 9817 // Reply blocks and returns the reply data for a ReadPixels request. 9818 func (cook ReadPixelsCookie) Reply() (*ReadPixelsReply, error) { 9819 buf, err := cook.Cookie.Reply() 9820 if err != nil { 9821 return nil, err 9822 } 9823 if buf == nil { 9824 return nil, nil 9825 } 9826 return readPixelsReply(buf), nil 9827 } 9828 9829 // readPixelsReply reads a byte slice into a ReadPixelsReply value. 9830 func readPixelsReply(buf []byte) *ReadPixelsReply { 9831 v := new(ReadPixelsReply) 9832 b := 1 // skip reply determinant 9833 9834 b += 1 // padding 9835 9836 v.Sequence = xgb.Get16(buf[b:]) 9837 b += 2 9838 9839 v.Length = xgb.Get32(buf[b:]) // 4-byte units 9840 b += 4 9841 9842 b += 24 // padding 9843 9844 v.Data = make([]byte, (int(v.Length) * 4)) 9845 copy(v.Data[:(int(v.Length)*4)], buf[b:]) 9846 b += int((int(v.Length) * 4)) 9847 9848 return v 9849 } 9850 9851 // Write request to wire for ReadPixels 9852 // readPixelsRequest writes a ReadPixels request to a byte slice. 9853 func readPixelsRequest(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) []byte { 9854 size := 36 9855 b := 0 9856 buf := make([]byte, size) 9857 9858 c.ExtLock.RLock() 9859 buf[b] = c.Extensions["GLX"] 9860 c.ExtLock.RUnlock() 9861 b += 1 9862 9863 buf[b] = 111 // request opcode 9864 b += 1 9865 9866 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9867 b += 2 9868 9869 xgb.Put32(buf[b:], uint32(ContextTag)) 9870 b += 4 9871 9872 xgb.Put32(buf[b:], uint32(X)) 9873 b += 4 9874 9875 xgb.Put32(buf[b:], uint32(Y)) 9876 b += 4 9877 9878 xgb.Put32(buf[b:], uint32(Width)) 9879 b += 4 9880 9881 xgb.Put32(buf[b:], uint32(Height)) 9882 b += 4 9883 9884 xgb.Put32(buf[b:], Format) 9885 b += 4 9886 9887 xgb.Put32(buf[b:], Type) 9888 b += 4 9889 9890 if SwapBytes { 9891 buf[b] = 1 9892 } else { 9893 buf[b] = 0 9894 } 9895 b += 1 9896 9897 if LsbFirst { 9898 buf[b] = 1 9899 } else { 9900 buf[b] = 0 9901 } 9902 b += 1 9903 9904 return buf 9905 } 9906 9907 // RenderCookie is a cookie used only for Render requests. 9908 type RenderCookie struct { 9909 *xgb.Cookie 9910 } 9911 9912 // Render sends an unchecked request. 9913 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9914 func Render(c *xgb.Conn, ContextTag ContextTag, Data []byte) RenderCookie { 9915 c.ExtLock.RLock() 9916 defer c.ExtLock.RUnlock() 9917 if _, ok := c.Extensions["GLX"]; !ok { 9918 panic("Cannot issue request 'Render' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9919 } 9920 cookie := c.NewCookie(false, false) 9921 c.NewRequest(renderRequest(c, ContextTag, Data), cookie) 9922 return RenderCookie{cookie} 9923 } 9924 9925 // RenderChecked sends a checked request. 9926 // If an error occurs, it can be retrieved using RenderCookie.Check() 9927 func RenderChecked(c *xgb.Conn, ContextTag ContextTag, Data []byte) RenderCookie { 9928 c.ExtLock.RLock() 9929 defer c.ExtLock.RUnlock() 9930 if _, ok := c.Extensions["GLX"]; !ok { 9931 panic("Cannot issue request 'Render' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9932 } 9933 cookie := c.NewCookie(true, false) 9934 c.NewRequest(renderRequest(c, ContextTag, Data), cookie) 9935 return RenderCookie{cookie} 9936 } 9937 9938 // Check returns an error if one occurred for checked requests that are not expecting a reply. 9939 // This cannot be called for requests expecting a reply, nor for unchecked requests. 9940 func (cook RenderCookie) Check() error { 9941 return cook.Cookie.Check() 9942 } 9943 9944 // Write request to wire for Render 9945 // renderRequest writes a Render request to a byte slice. 9946 func renderRequest(c *xgb.Conn, ContextTag ContextTag, Data []byte) []byte { 9947 size := xgb.Pad((8 + xgb.Pad((len(Data) * 1)))) 9948 b := 0 9949 buf := make([]byte, size) 9950 9951 c.ExtLock.RLock() 9952 buf[b] = c.Extensions["GLX"] 9953 c.ExtLock.RUnlock() 9954 b += 1 9955 9956 buf[b] = 1 // request opcode 9957 b += 1 9958 9959 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 9960 b += 2 9961 9962 xgb.Put32(buf[b:], uint32(ContextTag)) 9963 b += 4 9964 9965 copy(buf[b:], Data[:]) 9966 b += int(len(Data)) 9967 9968 return buf 9969 } 9970 9971 // RenderLargeCookie is a cookie used only for RenderLarge requests. 9972 type RenderLargeCookie struct { 9973 *xgb.Cookie 9974 } 9975 9976 // RenderLarge sends an unchecked request. 9977 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 9978 func RenderLarge(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) RenderLargeCookie { 9979 c.ExtLock.RLock() 9980 defer c.ExtLock.RUnlock() 9981 if _, ok := c.Extensions["GLX"]; !ok { 9982 panic("Cannot issue request 'RenderLarge' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9983 } 9984 cookie := c.NewCookie(false, false) 9985 c.NewRequest(renderLargeRequest(c, ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie) 9986 return RenderLargeCookie{cookie} 9987 } 9988 9989 // RenderLargeChecked sends a checked request. 9990 // If an error occurs, it can be retrieved using RenderLargeCookie.Check() 9991 func RenderLargeChecked(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) RenderLargeCookie { 9992 c.ExtLock.RLock() 9993 defer c.ExtLock.RUnlock() 9994 if _, ok := c.Extensions["GLX"]; !ok { 9995 panic("Cannot issue request 'RenderLarge' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 9996 } 9997 cookie := c.NewCookie(true, false) 9998 c.NewRequest(renderLargeRequest(c, ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie) 9999 return RenderLargeCookie{cookie} 10000 } 10001 10002 // Check returns an error if one occurred for checked requests that are not expecting a reply. 10003 // This cannot be called for requests expecting a reply, nor for unchecked requests. 10004 func (cook RenderLargeCookie) Check() error { 10005 return cook.Cookie.Check() 10006 } 10007 10008 // Write request to wire for RenderLarge 10009 // renderLargeRequest writes a RenderLarge request to a byte slice. 10010 func renderLargeRequest(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) []byte { 10011 size := xgb.Pad((16 + xgb.Pad((int(DataLen) * 1)))) 10012 b := 0 10013 buf := make([]byte, size) 10014 10015 c.ExtLock.RLock() 10016 buf[b] = c.Extensions["GLX"] 10017 c.ExtLock.RUnlock() 10018 b += 1 10019 10020 buf[b] = 2 // request opcode 10021 b += 1 10022 10023 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10024 b += 2 10025 10026 xgb.Put32(buf[b:], uint32(ContextTag)) 10027 b += 4 10028 10029 xgb.Put16(buf[b:], RequestNum) 10030 b += 2 10031 10032 xgb.Put16(buf[b:], RequestTotal) 10033 b += 2 10034 10035 xgb.Put32(buf[b:], DataLen) 10036 b += 4 10037 10038 copy(buf[b:], Data[:DataLen]) 10039 b += int(DataLen) 10040 10041 return buf 10042 } 10043 10044 // RenderModeCookie is a cookie used only for RenderMode requests. 10045 type RenderModeCookie struct { 10046 *xgb.Cookie 10047 } 10048 10049 // RenderMode sends a checked request. 10050 // If an error occurs, it will be returned with the reply by calling RenderModeCookie.Reply() 10051 func RenderMode(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCookie { 10052 c.ExtLock.RLock() 10053 defer c.ExtLock.RUnlock() 10054 if _, ok := c.Extensions["GLX"]; !ok { 10055 panic("Cannot issue request 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10056 } 10057 cookie := c.NewCookie(true, true) 10058 c.NewRequest(renderModeRequest(c, ContextTag, Mode), cookie) 10059 return RenderModeCookie{cookie} 10060 } 10061 10062 // RenderModeUnchecked sends an unchecked request. 10063 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10064 func RenderModeUnchecked(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCookie { 10065 c.ExtLock.RLock() 10066 defer c.ExtLock.RUnlock() 10067 if _, ok := c.Extensions["GLX"]; !ok { 10068 panic("Cannot issue request 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10069 } 10070 cookie := c.NewCookie(false, true) 10071 c.NewRequest(renderModeRequest(c, ContextTag, Mode), cookie) 10072 return RenderModeCookie{cookie} 10073 } 10074 10075 // RenderModeReply represents the data returned from a RenderMode request. 10076 type RenderModeReply struct { 10077 Sequence uint16 // sequence number of the request for this reply 10078 Length uint32 // number of bytes in this reply 10079 // padding: 1 bytes 10080 RetVal uint32 10081 N uint32 10082 NewMode uint32 10083 // padding: 12 bytes 10084 Data []uint32 // size: xgb.Pad((int(N) * 4)) 10085 } 10086 10087 // Reply blocks and returns the reply data for a RenderMode request. 10088 func (cook RenderModeCookie) Reply() (*RenderModeReply, error) { 10089 buf, err := cook.Cookie.Reply() 10090 if err != nil { 10091 return nil, err 10092 } 10093 if buf == nil { 10094 return nil, nil 10095 } 10096 return renderModeReply(buf), nil 10097 } 10098 10099 // renderModeReply reads a byte slice into a RenderModeReply value. 10100 func renderModeReply(buf []byte) *RenderModeReply { 10101 v := new(RenderModeReply) 10102 b := 1 // skip reply determinant 10103 10104 b += 1 // padding 10105 10106 v.Sequence = xgb.Get16(buf[b:]) 10107 b += 2 10108 10109 v.Length = xgb.Get32(buf[b:]) // 4-byte units 10110 b += 4 10111 10112 v.RetVal = xgb.Get32(buf[b:]) 10113 b += 4 10114 10115 v.N = xgb.Get32(buf[b:]) 10116 b += 4 10117 10118 v.NewMode = xgb.Get32(buf[b:]) 10119 b += 4 10120 10121 b += 12 // padding 10122 10123 v.Data = make([]uint32, v.N) 10124 for i := 0; i < int(v.N); i++ { 10125 v.Data[i] = xgb.Get32(buf[b:]) 10126 b += 4 10127 } 10128 10129 return v 10130 } 10131 10132 // Write request to wire for RenderMode 10133 // renderModeRequest writes a RenderMode request to a byte slice. 10134 func renderModeRequest(c *xgb.Conn, ContextTag ContextTag, Mode uint32) []byte { 10135 size := 12 10136 b := 0 10137 buf := make([]byte, size) 10138 10139 c.ExtLock.RLock() 10140 buf[b] = c.Extensions["GLX"] 10141 c.ExtLock.RUnlock() 10142 b += 1 10143 10144 buf[b] = 107 // request opcode 10145 b += 1 10146 10147 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10148 b += 2 10149 10150 xgb.Put32(buf[b:], uint32(ContextTag)) 10151 b += 4 10152 10153 xgb.Put32(buf[b:], Mode) 10154 b += 4 10155 10156 return buf 10157 } 10158 10159 // SelectBufferCookie is a cookie used only for SelectBuffer requests. 10160 type SelectBufferCookie struct { 10161 *xgb.Cookie 10162 } 10163 10164 // SelectBuffer sends an unchecked request. 10165 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10166 func SelectBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCookie { 10167 c.ExtLock.RLock() 10168 defer c.ExtLock.RUnlock() 10169 if _, ok := c.Extensions["GLX"]; !ok { 10170 panic("Cannot issue request 'SelectBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10171 } 10172 cookie := c.NewCookie(false, false) 10173 c.NewRequest(selectBufferRequest(c, ContextTag, Size), cookie) 10174 return SelectBufferCookie{cookie} 10175 } 10176 10177 // SelectBufferChecked sends a checked request. 10178 // If an error occurs, it can be retrieved using SelectBufferCookie.Check() 10179 func SelectBufferChecked(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCookie { 10180 c.ExtLock.RLock() 10181 defer c.ExtLock.RUnlock() 10182 if _, ok := c.Extensions["GLX"]; !ok { 10183 panic("Cannot issue request 'SelectBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10184 } 10185 cookie := c.NewCookie(true, false) 10186 c.NewRequest(selectBufferRequest(c, ContextTag, Size), cookie) 10187 return SelectBufferCookie{cookie} 10188 } 10189 10190 // Check returns an error if one occurred for checked requests that are not expecting a reply. 10191 // This cannot be called for requests expecting a reply, nor for unchecked requests. 10192 func (cook SelectBufferCookie) Check() error { 10193 return cook.Cookie.Check() 10194 } 10195 10196 // Write request to wire for SelectBuffer 10197 // selectBufferRequest writes a SelectBuffer request to a byte slice. 10198 func selectBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size int32) []byte { 10199 size := 12 10200 b := 0 10201 buf := make([]byte, size) 10202 10203 c.ExtLock.RLock() 10204 buf[b] = c.Extensions["GLX"] 10205 c.ExtLock.RUnlock() 10206 b += 1 10207 10208 buf[b] = 106 // request opcode 10209 b += 1 10210 10211 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10212 b += 2 10213 10214 xgb.Put32(buf[b:], uint32(ContextTag)) 10215 b += 4 10216 10217 xgb.Put32(buf[b:], uint32(Size)) 10218 b += 4 10219 10220 return buf 10221 } 10222 10223 // SetClientInfo2ARBCookie is a cookie used only for SetClientInfo2ARB requests. 10224 type SetClientInfo2ARBCookie struct { 10225 *xgb.Cookie 10226 } 10227 10228 // SetClientInfo2ARB sends an unchecked request. 10229 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10230 func SetClientInfo2ARB(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfo2ARBCookie { 10231 c.ExtLock.RLock() 10232 defer c.ExtLock.RUnlock() 10233 if _, ok := c.Extensions["GLX"]; !ok { 10234 panic("Cannot issue request 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10235 } 10236 cookie := c.NewCookie(false, false) 10237 c.NewRequest(setClientInfo2ARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) 10238 return SetClientInfo2ARBCookie{cookie} 10239 } 10240 10241 // SetClientInfo2ARBChecked sends a checked request. 10242 // If an error occurs, it can be retrieved using SetClientInfo2ARBCookie.Check() 10243 func SetClientInfo2ARBChecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfo2ARBCookie { 10244 c.ExtLock.RLock() 10245 defer c.ExtLock.RUnlock() 10246 if _, ok := c.Extensions["GLX"]; !ok { 10247 panic("Cannot issue request 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10248 } 10249 cookie := c.NewCookie(true, false) 10250 c.NewRequest(setClientInfo2ARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) 10251 return SetClientInfo2ARBCookie{cookie} 10252 } 10253 10254 // Check returns an error if one occurred for checked requests that are not expecting a reply. 10255 // This cannot be called for requests expecting a reply, nor for unchecked requests. 10256 func (cook SetClientInfo2ARBCookie) Check() error { 10257 return cook.Cookie.Check() 10258 } 10259 10260 // Write request to wire for SetClientInfo2ARB 10261 // setClientInfo2ARBRequest writes a SetClientInfo2ARB request to a byte slice. 10262 func setClientInfo2ARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { 10263 size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 3) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1)))) 10264 b := 0 10265 buf := make([]byte, size) 10266 10267 c.ExtLock.RLock() 10268 buf[b] = c.Extensions["GLX"] 10269 c.ExtLock.RUnlock() 10270 b += 1 10271 10272 buf[b] = 35 // request opcode 10273 b += 1 10274 10275 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10276 b += 2 10277 10278 xgb.Put32(buf[b:], MajorVersion) 10279 b += 4 10280 10281 xgb.Put32(buf[b:], MinorVersion) 10282 b += 4 10283 10284 xgb.Put32(buf[b:], NumVersions) 10285 b += 4 10286 10287 xgb.Put32(buf[b:], GlStrLen) 10288 b += 4 10289 10290 xgb.Put32(buf[b:], GlxStrLen) 10291 b += 4 10292 10293 for i := 0; i < int((int(NumVersions) * 3)); i++ { 10294 xgb.Put32(buf[b:], GlVersions[i]) 10295 b += 4 10296 } 10297 10298 copy(buf[b:], GlExtensionString[:GlStrLen]) 10299 b += int(GlStrLen) 10300 10301 copy(buf[b:], GlxExtensionString[:GlxStrLen]) 10302 b += int(GlxStrLen) 10303 10304 return buf 10305 } 10306 10307 // SetClientInfoARBCookie is a cookie used only for SetClientInfoARB requests. 10308 type SetClientInfoARBCookie struct { 10309 *xgb.Cookie 10310 } 10311 10312 // SetClientInfoARB sends an unchecked request. 10313 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10314 func SetClientInfoARB(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfoARBCookie { 10315 c.ExtLock.RLock() 10316 defer c.ExtLock.RUnlock() 10317 if _, ok := c.Extensions["GLX"]; !ok { 10318 panic("Cannot issue request 'SetClientInfoARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10319 } 10320 cookie := c.NewCookie(false, false) 10321 c.NewRequest(setClientInfoARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) 10322 return SetClientInfoARBCookie{cookie} 10323 } 10324 10325 // SetClientInfoARBChecked sends a checked request. 10326 // If an error occurs, it can be retrieved using SetClientInfoARBCookie.Check() 10327 func SetClientInfoARBChecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfoARBCookie { 10328 c.ExtLock.RLock() 10329 defer c.ExtLock.RUnlock() 10330 if _, ok := c.Extensions["GLX"]; !ok { 10331 panic("Cannot issue request 'SetClientInfoARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10332 } 10333 cookie := c.NewCookie(true, false) 10334 c.NewRequest(setClientInfoARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) 10335 return SetClientInfoARBCookie{cookie} 10336 } 10337 10338 // Check returns an error if one occurred for checked requests that are not expecting a reply. 10339 // This cannot be called for requests expecting a reply, nor for unchecked requests. 10340 func (cook SetClientInfoARBCookie) Check() error { 10341 return cook.Cookie.Check() 10342 } 10343 10344 // Write request to wire for SetClientInfoARB 10345 // setClientInfoARBRequest writes a SetClientInfoARB request to a byte slice. 10346 func setClientInfoARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { 10347 size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 2) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1)))) 10348 b := 0 10349 buf := make([]byte, size) 10350 10351 c.ExtLock.RLock() 10352 buf[b] = c.Extensions["GLX"] 10353 c.ExtLock.RUnlock() 10354 b += 1 10355 10356 buf[b] = 33 // request opcode 10357 b += 1 10358 10359 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10360 b += 2 10361 10362 xgb.Put32(buf[b:], MajorVersion) 10363 b += 4 10364 10365 xgb.Put32(buf[b:], MinorVersion) 10366 b += 4 10367 10368 xgb.Put32(buf[b:], NumVersions) 10369 b += 4 10370 10371 xgb.Put32(buf[b:], GlStrLen) 10372 b += 4 10373 10374 xgb.Put32(buf[b:], GlxStrLen) 10375 b += 4 10376 10377 for i := 0; i < int((int(NumVersions) * 2)); i++ { 10378 xgb.Put32(buf[b:], GlVersions[i]) 10379 b += 4 10380 } 10381 10382 copy(buf[b:], GlExtensionString[:GlStrLen]) 10383 b += int(GlStrLen) 10384 10385 copy(buf[b:], GlxExtensionString[:GlxStrLen]) 10386 b += int(GlxStrLen) 10387 10388 return buf 10389 } 10390 10391 // SwapBuffersCookie is a cookie used only for SwapBuffers requests. 10392 type SwapBuffersCookie struct { 10393 *xgb.Cookie 10394 } 10395 10396 // SwapBuffers sends an unchecked request. 10397 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10398 func SwapBuffers(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuffersCookie { 10399 c.ExtLock.RLock() 10400 defer c.ExtLock.RUnlock() 10401 if _, ok := c.Extensions["GLX"]; !ok { 10402 panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10403 } 10404 cookie := c.NewCookie(false, false) 10405 c.NewRequest(swapBuffersRequest(c, ContextTag, Drawable), cookie) 10406 return SwapBuffersCookie{cookie} 10407 } 10408 10409 // SwapBuffersChecked sends a checked request. 10410 // If an error occurs, it can be retrieved using SwapBuffersCookie.Check() 10411 func SwapBuffersChecked(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuffersCookie { 10412 c.ExtLock.RLock() 10413 defer c.ExtLock.RUnlock() 10414 if _, ok := c.Extensions["GLX"]; !ok { 10415 panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10416 } 10417 cookie := c.NewCookie(true, false) 10418 c.NewRequest(swapBuffersRequest(c, ContextTag, Drawable), cookie) 10419 return SwapBuffersCookie{cookie} 10420 } 10421 10422 // Check returns an error if one occurred for checked requests that are not expecting a reply. 10423 // This cannot be called for requests expecting a reply, nor for unchecked requests. 10424 func (cook SwapBuffersCookie) Check() error { 10425 return cook.Cookie.Check() 10426 } 10427 10428 // Write request to wire for SwapBuffers 10429 // swapBuffersRequest writes a SwapBuffers request to a byte slice. 10430 func swapBuffersRequest(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) []byte { 10431 size := 12 10432 b := 0 10433 buf := make([]byte, size) 10434 10435 c.ExtLock.RLock() 10436 buf[b] = c.Extensions["GLX"] 10437 c.ExtLock.RUnlock() 10438 b += 1 10439 10440 buf[b] = 11 // request opcode 10441 b += 1 10442 10443 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10444 b += 2 10445 10446 xgb.Put32(buf[b:], uint32(ContextTag)) 10447 b += 4 10448 10449 xgb.Put32(buf[b:], uint32(Drawable)) 10450 b += 4 10451 10452 return buf 10453 } 10454 10455 // UseXFontCookie is a cookie used only for UseXFont requests. 10456 type UseXFontCookie struct { 10457 *xgb.Cookie 10458 } 10459 10460 // UseXFont sends an unchecked request. 10461 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10462 func UseXFont(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First uint32, Count uint32, ListBase uint32) UseXFontCookie { 10463 c.ExtLock.RLock() 10464 defer c.ExtLock.RUnlock() 10465 if _, ok := c.Extensions["GLX"]; !ok { 10466 panic("Cannot issue request 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10467 } 10468 cookie := c.NewCookie(false, false) 10469 c.NewRequest(useXFontRequest(c, ContextTag, Font, First, Count, ListBase), cookie) 10470 return UseXFontCookie{cookie} 10471 } 10472 10473 // UseXFontChecked sends a checked request. 10474 // If an error occurs, it can be retrieved using UseXFontCookie.Check() 10475 func UseXFontChecked(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First uint32, Count uint32, ListBase uint32) UseXFontCookie { 10476 c.ExtLock.RLock() 10477 defer c.ExtLock.RUnlock() 10478 if _, ok := c.Extensions["GLX"]; !ok { 10479 panic("Cannot issue request 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10480 } 10481 cookie := c.NewCookie(true, false) 10482 c.NewRequest(useXFontRequest(c, ContextTag, Font, First, Count, ListBase), cookie) 10483 return UseXFontCookie{cookie} 10484 } 10485 10486 // Check returns an error if one occurred for checked requests that are not expecting a reply. 10487 // This cannot be called for requests expecting a reply, nor for unchecked requests. 10488 func (cook UseXFontCookie) Check() error { 10489 return cook.Cookie.Check() 10490 } 10491 10492 // Write request to wire for UseXFont 10493 // useXFontRequest writes a UseXFont request to a byte slice. 10494 func useXFontRequest(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First uint32, Count uint32, ListBase uint32) []byte { 10495 size := 24 10496 b := 0 10497 buf := make([]byte, size) 10498 10499 c.ExtLock.RLock() 10500 buf[b] = c.Extensions["GLX"] 10501 c.ExtLock.RUnlock() 10502 b += 1 10503 10504 buf[b] = 12 // request opcode 10505 b += 1 10506 10507 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10508 b += 2 10509 10510 xgb.Put32(buf[b:], uint32(ContextTag)) 10511 b += 4 10512 10513 xgb.Put32(buf[b:], uint32(Font)) 10514 b += 4 10515 10516 xgb.Put32(buf[b:], First) 10517 b += 4 10518 10519 xgb.Put32(buf[b:], Count) 10520 b += 4 10521 10522 xgb.Put32(buf[b:], ListBase) 10523 b += 4 10524 10525 return buf 10526 } 10527 10528 // VendorPrivateCookie is a cookie used only for VendorPrivate requests. 10529 type VendorPrivateCookie struct { 10530 *xgb.Cookie 10531 } 10532 10533 // VendorPrivate sends an unchecked request. 10534 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10535 func VendorPrivate(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateCookie { 10536 c.ExtLock.RLock() 10537 defer c.ExtLock.RUnlock() 10538 if _, ok := c.Extensions["GLX"]; !ok { 10539 panic("Cannot issue request 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10540 } 10541 cookie := c.NewCookie(false, false) 10542 c.NewRequest(vendorPrivateRequest(c, VendorCode, ContextTag, Data), cookie) 10543 return VendorPrivateCookie{cookie} 10544 } 10545 10546 // VendorPrivateChecked sends a checked request. 10547 // If an error occurs, it can be retrieved using VendorPrivateCookie.Check() 10548 func VendorPrivateChecked(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateCookie { 10549 c.ExtLock.RLock() 10550 defer c.ExtLock.RUnlock() 10551 if _, ok := c.Extensions["GLX"]; !ok { 10552 panic("Cannot issue request 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10553 } 10554 cookie := c.NewCookie(true, false) 10555 c.NewRequest(vendorPrivateRequest(c, VendorCode, ContextTag, Data), cookie) 10556 return VendorPrivateCookie{cookie} 10557 } 10558 10559 // Check returns an error if one occurred for checked requests that are not expecting a reply. 10560 // This cannot be called for requests expecting a reply, nor for unchecked requests. 10561 func (cook VendorPrivateCookie) Check() error { 10562 return cook.Cookie.Check() 10563 } 10564 10565 // Write request to wire for VendorPrivate 10566 // vendorPrivateRequest writes a VendorPrivate request to a byte slice. 10567 func vendorPrivateRequest(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) []byte { 10568 size := xgb.Pad((12 + xgb.Pad((len(Data) * 1)))) 10569 b := 0 10570 buf := make([]byte, size) 10571 10572 c.ExtLock.RLock() 10573 buf[b] = c.Extensions["GLX"] 10574 c.ExtLock.RUnlock() 10575 b += 1 10576 10577 buf[b] = 16 // request opcode 10578 b += 1 10579 10580 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10581 b += 2 10582 10583 xgb.Put32(buf[b:], VendorCode) 10584 b += 4 10585 10586 xgb.Put32(buf[b:], uint32(ContextTag)) 10587 b += 4 10588 10589 copy(buf[b:], Data[:]) 10590 b += int(len(Data)) 10591 10592 return buf 10593 } 10594 10595 // VendorPrivateWithReplyCookie is a cookie used only for VendorPrivateWithReply requests. 10596 type VendorPrivateWithReplyCookie struct { 10597 *xgb.Cookie 10598 } 10599 10600 // VendorPrivateWithReply sends a checked request. 10601 // If an error occurs, it will be returned with the reply by calling VendorPrivateWithReplyCookie.Reply() 10602 func VendorPrivateWithReply(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateWithReplyCookie { 10603 c.ExtLock.RLock() 10604 defer c.ExtLock.RUnlock() 10605 if _, ok := c.Extensions["GLX"]; !ok { 10606 panic("Cannot issue request 'VendorPrivateWithReply' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10607 } 10608 cookie := c.NewCookie(true, true) 10609 c.NewRequest(vendorPrivateWithReplyRequest(c, VendorCode, ContextTag, Data), cookie) 10610 return VendorPrivateWithReplyCookie{cookie} 10611 } 10612 10613 // VendorPrivateWithReplyUnchecked sends an unchecked request. 10614 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10615 func VendorPrivateWithReplyUnchecked(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateWithReplyCookie { 10616 c.ExtLock.RLock() 10617 defer c.ExtLock.RUnlock() 10618 if _, ok := c.Extensions["GLX"]; !ok { 10619 panic("Cannot issue request 'VendorPrivateWithReply' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10620 } 10621 cookie := c.NewCookie(false, true) 10622 c.NewRequest(vendorPrivateWithReplyRequest(c, VendorCode, ContextTag, Data), cookie) 10623 return VendorPrivateWithReplyCookie{cookie} 10624 } 10625 10626 // VendorPrivateWithReplyReply represents the data returned from a VendorPrivateWithReply request. 10627 type VendorPrivateWithReplyReply struct { 10628 Sequence uint16 // sequence number of the request for this reply 10629 Length uint32 // number of bytes in this reply 10630 // padding: 1 bytes 10631 Retval uint32 10632 Data1 []byte // size: 24 10633 Data2 []byte // size: xgb.Pad(((int(Length) * 4) * 1)) 10634 } 10635 10636 // Reply blocks and returns the reply data for a VendorPrivateWithReply request. 10637 func (cook VendorPrivateWithReplyCookie) Reply() (*VendorPrivateWithReplyReply, error) { 10638 buf, err := cook.Cookie.Reply() 10639 if err != nil { 10640 return nil, err 10641 } 10642 if buf == nil { 10643 return nil, nil 10644 } 10645 return vendorPrivateWithReplyReply(buf), nil 10646 } 10647 10648 // vendorPrivateWithReplyReply reads a byte slice into a VendorPrivateWithReplyReply value. 10649 func vendorPrivateWithReplyReply(buf []byte) *VendorPrivateWithReplyReply { 10650 v := new(VendorPrivateWithReplyReply) 10651 b := 1 // skip reply determinant 10652 10653 b += 1 // padding 10654 10655 v.Sequence = xgb.Get16(buf[b:]) 10656 b += 2 10657 10658 v.Length = xgb.Get32(buf[b:]) // 4-byte units 10659 b += 4 10660 10661 v.Retval = xgb.Get32(buf[b:]) 10662 b += 4 10663 10664 v.Data1 = make([]byte, 24) 10665 copy(v.Data1[:24], buf[b:]) 10666 b += int(24) 10667 10668 v.Data2 = make([]byte, (int(v.Length) * 4)) 10669 copy(v.Data2[:(int(v.Length)*4)], buf[b:]) 10670 b += int((int(v.Length) * 4)) 10671 10672 return v 10673 } 10674 10675 // Write request to wire for VendorPrivateWithReply 10676 // vendorPrivateWithReplyRequest writes a VendorPrivateWithReply request to a byte slice. 10677 func vendorPrivateWithReplyRequest(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) []byte { 10678 size := xgb.Pad((12 + xgb.Pad((len(Data) * 1)))) 10679 b := 0 10680 buf := make([]byte, size) 10681 10682 c.ExtLock.RLock() 10683 buf[b] = c.Extensions["GLX"] 10684 c.ExtLock.RUnlock() 10685 b += 1 10686 10687 buf[b] = 17 // request opcode 10688 b += 1 10689 10690 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10691 b += 2 10692 10693 xgb.Put32(buf[b:], VendorCode) 10694 b += 4 10695 10696 xgb.Put32(buf[b:], uint32(ContextTag)) 10697 b += 4 10698 10699 copy(buf[b:], Data[:]) 10700 b += int(len(Data)) 10701 10702 return buf 10703 } 10704 10705 // WaitGLCookie is a cookie used only for WaitGL requests. 10706 type WaitGLCookie struct { 10707 *xgb.Cookie 10708 } 10709 10710 // WaitGL sends an unchecked request. 10711 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10712 func WaitGL(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie { 10713 c.ExtLock.RLock() 10714 defer c.ExtLock.RUnlock() 10715 if _, ok := c.Extensions["GLX"]; !ok { 10716 panic("Cannot issue request 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10717 } 10718 cookie := c.NewCookie(false, false) 10719 c.NewRequest(waitGLRequest(c, ContextTag), cookie) 10720 return WaitGLCookie{cookie} 10721 } 10722 10723 // WaitGLChecked sends a checked request. 10724 // If an error occurs, it can be retrieved using WaitGLCookie.Check() 10725 func WaitGLChecked(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie { 10726 c.ExtLock.RLock() 10727 defer c.ExtLock.RUnlock() 10728 if _, ok := c.Extensions["GLX"]; !ok { 10729 panic("Cannot issue request 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10730 } 10731 cookie := c.NewCookie(true, false) 10732 c.NewRequest(waitGLRequest(c, ContextTag), cookie) 10733 return WaitGLCookie{cookie} 10734 } 10735 10736 // Check returns an error if one occurred for checked requests that are not expecting a reply. 10737 // This cannot be called for requests expecting a reply, nor for unchecked requests. 10738 func (cook WaitGLCookie) Check() error { 10739 return cook.Cookie.Check() 10740 } 10741 10742 // Write request to wire for WaitGL 10743 // waitGLRequest writes a WaitGL request to a byte slice. 10744 func waitGLRequest(c *xgb.Conn, ContextTag ContextTag) []byte { 10745 size := 8 10746 b := 0 10747 buf := make([]byte, size) 10748 10749 c.ExtLock.RLock() 10750 buf[b] = c.Extensions["GLX"] 10751 c.ExtLock.RUnlock() 10752 b += 1 10753 10754 buf[b] = 8 // request opcode 10755 b += 1 10756 10757 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10758 b += 2 10759 10760 xgb.Put32(buf[b:], uint32(ContextTag)) 10761 b += 4 10762 10763 return buf 10764 } 10765 10766 // WaitXCookie is a cookie used only for WaitX requests. 10767 type WaitXCookie struct { 10768 *xgb.Cookie 10769 } 10770 10771 // WaitX sends an unchecked request. 10772 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. 10773 func WaitX(c *xgb.Conn, ContextTag ContextTag) WaitXCookie { 10774 c.ExtLock.RLock() 10775 defer c.ExtLock.RUnlock() 10776 if _, ok := c.Extensions["GLX"]; !ok { 10777 panic("Cannot issue request 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10778 } 10779 cookie := c.NewCookie(false, false) 10780 c.NewRequest(waitXRequest(c, ContextTag), cookie) 10781 return WaitXCookie{cookie} 10782 } 10783 10784 // WaitXChecked sends a checked request. 10785 // If an error occurs, it can be retrieved using WaitXCookie.Check() 10786 func WaitXChecked(c *xgb.Conn, ContextTag ContextTag) WaitXCookie { 10787 c.ExtLock.RLock() 10788 defer c.ExtLock.RUnlock() 10789 if _, ok := c.Extensions["GLX"]; !ok { 10790 panic("Cannot issue request 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") 10791 } 10792 cookie := c.NewCookie(true, false) 10793 c.NewRequest(waitXRequest(c, ContextTag), cookie) 10794 return WaitXCookie{cookie} 10795 } 10796 10797 // Check returns an error if one occurred for checked requests that are not expecting a reply. 10798 // This cannot be called for requests expecting a reply, nor for unchecked requests. 10799 func (cook WaitXCookie) Check() error { 10800 return cook.Cookie.Check() 10801 } 10802 10803 // Write request to wire for WaitX 10804 // waitXRequest writes a WaitX request to a byte slice. 10805 func waitXRequest(c *xgb.Conn, ContextTag ContextTag) []byte { 10806 size := 8 10807 b := 0 10808 buf := make([]byte, size) 10809 10810 c.ExtLock.RLock() 10811 buf[b] = c.Extensions["GLX"] 10812 c.ExtLock.RUnlock() 10813 b += 1 10814 10815 buf[b] = 9 // request opcode 10816 b += 1 10817 10818 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units 10819 b += 2 10820 10821 xgb.Put32(buf[b:], uint32(ContextTag)) 10822 b += 4 10823 10824 return buf 10825 }