zorldo

Goofing around with Ebiten
git clone git://bsandro.tech/zorldo
Log | Files | Refs | README

randr.go (163538B)


      1 // Package randr is the X client API for the RANDR extension.
      2 package randr
      3 
      4 // This file is automatically generated from randr.xml. Edit at your peril!
      5 
      6 import (
      7 	"github.com/jezek/xgb"
      8 
      9 	"github.com/jezek/xgb/render"
     10 	"github.com/jezek/xgb/xproto"
     11 )
     12 
     13 // Init must be called before using the RANDR extension.
     14 func Init(c *xgb.Conn) error {
     15 	reply, err := xproto.QueryExtension(c, 5, "RANDR").Reply()
     16 	switch {
     17 	case err != nil:
     18 		return err
     19 	case !reply.Present:
     20 		return xgb.Errorf("No extension named RANDR could be found on on the server.")
     21 	}
     22 
     23 	c.ExtLock.Lock()
     24 	c.Extensions["RANDR"] = reply.MajorOpcode
     25 	c.ExtLock.Unlock()
     26 	for evNum, fun := range xgb.NewExtEventFuncs["RANDR"] {
     27 		xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun
     28 	}
     29 	for errNum, fun := range xgb.NewExtErrorFuncs["RANDR"] {
     30 		xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun
     31 	}
     32 	return nil
     33 }
     34 
     35 func init() {
     36 	xgb.NewExtEventFuncs["RANDR"] = make(map[int]xgb.NewEventFun)
     37 	xgb.NewExtErrorFuncs["RANDR"] = make(map[int]xgb.NewErrorFun)
     38 }
     39 
     40 // BadBadCrtc is the error number for a BadBadCrtc.
     41 const BadBadCrtc = 1
     42 
     43 type BadCrtcError struct {
     44 	Sequence uint16
     45 	NiceName string
     46 }
     47 
     48 // BadCrtcErrorNew constructs a BadCrtcError value that implements xgb.Error from a byte slice.
     49 func BadCrtcErrorNew(buf []byte) xgb.Error {
     50 	v := BadCrtcError{}
     51 	v.NiceName = "BadCrtc"
     52 
     53 	b := 1 // skip error determinant
     54 	b += 1 // don't read error number
     55 
     56 	v.Sequence = xgb.Get16(buf[b:])
     57 	b += 2
     58 
     59 	return v
     60 }
     61 
     62 // SequenceId returns the sequence id attached to the BadBadCrtc error.
     63 // This is mostly used internally.
     64 func (err BadCrtcError) SequenceId() uint16 {
     65 	return err.Sequence
     66 }
     67 
     68 // BadId returns the 'BadValue' number if one exists for the BadBadCrtc error. If no bad value exists, 0 is returned.
     69 func (err BadCrtcError) BadId() uint32 {
     70 	return 0
     71 }
     72 
     73 // Error returns a rudimentary string representation of the BadBadCrtc error.
     74 
     75 func (err BadCrtcError) Error() string {
     76 	fieldVals := make([]string, 0, 0)
     77 	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
     78 	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
     79 	return "BadBadCrtc {" + xgb.StringsJoin(fieldVals, ", ") + "}"
     80 }
     81 
     82 func init() {
     83 	xgb.NewExtErrorFuncs["RANDR"][1] = BadCrtcErrorNew
     84 }
     85 
     86 // BadBadMode is the error number for a BadBadMode.
     87 const BadBadMode = 2
     88 
     89 type BadModeError struct {
     90 	Sequence uint16
     91 	NiceName string
     92 }
     93 
     94 // BadModeErrorNew constructs a BadModeError value that implements xgb.Error from a byte slice.
     95 func BadModeErrorNew(buf []byte) xgb.Error {
     96 	v := BadModeError{}
     97 	v.NiceName = "BadMode"
     98 
     99 	b := 1 // skip error determinant
    100 	b += 1 // don't read error number
    101 
    102 	v.Sequence = xgb.Get16(buf[b:])
    103 	b += 2
    104 
    105 	return v
    106 }
    107 
    108 // SequenceId returns the sequence id attached to the BadBadMode error.
    109 // This is mostly used internally.
    110 func (err BadModeError) SequenceId() uint16 {
    111 	return err.Sequence
    112 }
    113 
    114 // BadId returns the 'BadValue' number if one exists for the BadBadMode error. If no bad value exists, 0 is returned.
    115 func (err BadModeError) BadId() uint32 {
    116 	return 0
    117 }
    118 
    119 // Error returns a rudimentary string representation of the BadBadMode error.
    120 
    121 func (err BadModeError) Error() string {
    122 	fieldVals := make([]string, 0, 0)
    123 	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
    124 	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
    125 	return "BadBadMode {" + xgb.StringsJoin(fieldVals, ", ") + "}"
    126 }
    127 
    128 func init() {
    129 	xgb.NewExtErrorFuncs["RANDR"][2] = BadModeErrorNew
    130 }
    131 
    132 // BadBadOutput is the error number for a BadBadOutput.
    133 const BadBadOutput = 0
    134 
    135 type BadOutputError struct {
    136 	Sequence uint16
    137 	NiceName string
    138 }
    139 
    140 // BadOutputErrorNew constructs a BadOutputError value that implements xgb.Error from a byte slice.
    141 func BadOutputErrorNew(buf []byte) xgb.Error {
    142 	v := BadOutputError{}
    143 	v.NiceName = "BadOutput"
    144 
    145 	b := 1 // skip error determinant
    146 	b += 1 // don't read error number
    147 
    148 	v.Sequence = xgb.Get16(buf[b:])
    149 	b += 2
    150 
    151 	return v
    152 }
    153 
    154 // SequenceId returns the sequence id attached to the BadBadOutput error.
    155 // This is mostly used internally.
    156 func (err BadOutputError) SequenceId() uint16 {
    157 	return err.Sequence
    158 }
    159 
    160 // BadId returns the 'BadValue' number if one exists for the BadBadOutput error. If no bad value exists, 0 is returned.
    161 func (err BadOutputError) BadId() uint32 {
    162 	return 0
    163 }
    164 
    165 // Error returns a rudimentary string representation of the BadBadOutput error.
    166 
    167 func (err BadOutputError) Error() string {
    168 	fieldVals := make([]string, 0, 0)
    169 	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
    170 	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
    171 	return "BadBadOutput {" + xgb.StringsJoin(fieldVals, ", ") + "}"
    172 }
    173 
    174 func init() {
    175 	xgb.NewExtErrorFuncs["RANDR"][0] = BadOutputErrorNew
    176 }
    177 
    178 // BadBadProvider is the error number for a BadBadProvider.
    179 const BadBadProvider = 3
    180 
    181 type BadProviderError struct {
    182 	Sequence uint16
    183 	NiceName string
    184 }
    185 
    186 // BadProviderErrorNew constructs a BadProviderError value that implements xgb.Error from a byte slice.
    187 func BadProviderErrorNew(buf []byte) xgb.Error {
    188 	v := BadProviderError{}
    189 	v.NiceName = "BadProvider"
    190 
    191 	b := 1 // skip error determinant
    192 	b += 1 // don't read error number
    193 
    194 	v.Sequence = xgb.Get16(buf[b:])
    195 	b += 2
    196 
    197 	return v
    198 }
    199 
    200 // SequenceId returns the sequence id attached to the BadBadProvider error.
    201 // This is mostly used internally.
    202 func (err BadProviderError) SequenceId() uint16 {
    203 	return err.Sequence
    204 }
    205 
    206 // BadId returns the 'BadValue' number if one exists for the BadBadProvider error. If no bad value exists, 0 is returned.
    207 func (err BadProviderError) BadId() uint32 {
    208 	return 0
    209 }
    210 
    211 // Error returns a rudimentary string representation of the BadBadProvider error.
    212 
    213 func (err BadProviderError) Error() string {
    214 	fieldVals := make([]string, 0, 0)
    215 	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
    216 	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
    217 	return "BadBadProvider {" + xgb.StringsJoin(fieldVals, ", ") + "}"
    218 }
    219 
    220 func init() {
    221 	xgb.NewExtErrorFuncs["RANDR"][3] = BadProviderErrorNew
    222 }
    223 
    224 const (
    225 	ConnectionConnected    = 0
    226 	ConnectionDisconnected = 1
    227 	ConnectionUnknown      = 2
    228 )
    229 
    230 type Crtc uint32
    231 
    232 func NewCrtcId(c *xgb.Conn) (Crtc, error) {
    233 	id, err := c.NewId()
    234 	if err != nil {
    235 		return 0, err
    236 	}
    237 	return Crtc(id), nil
    238 }
    239 
    240 type CrtcChange struct {
    241 	Timestamp xproto.Timestamp
    242 	Window    xproto.Window
    243 	Crtc      Crtc
    244 	Mode      Mode
    245 	Rotation  uint16
    246 	// padding: 2 bytes
    247 	X      int16
    248 	Y      int16
    249 	Width  uint16
    250 	Height uint16
    251 }
    252 
    253 // CrtcChangeRead reads a byte slice into a CrtcChange value.
    254 func CrtcChangeRead(buf []byte, v *CrtcChange) int {
    255 	b := 0
    256 
    257 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
    258 	b += 4
    259 
    260 	v.Window = xproto.Window(xgb.Get32(buf[b:]))
    261 	b += 4
    262 
    263 	v.Crtc = Crtc(xgb.Get32(buf[b:]))
    264 	b += 4
    265 
    266 	v.Mode = Mode(xgb.Get32(buf[b:]))
    267 	b += 4
    268 
    269 	v.Rotation = xgb.Get16(buf[b:])
    270 	b += 2
    271 
    272 	b += 2 // padding
    273 
    274 	v.X = int16(xgb.Get16(buf[b:]))
    275 	b += 2
    276 
    277 	v.Y = int16(xgb.Get16(buf[b:]))
    278 	b += 2
    279 
    280 	v.Width = xgb.Get16(buf[b:])
    281 	b += 2
    282 
    283 	v.Height = xgb.Get16(buf[b:])
    284 	b += 2
    285 
    286 	return b
    287 }
    288 
    289 // CrtcChangeReadList reads a byte slice into a list of CrtcChange values.
    290 func CrtcChangeReadList(buf []byte, dest []CrtcChange) int {
    291 	b := 0
    292 	for i := 0; i < len(dest); i++ {
    293 		dest[i] = CrtcChange{}
    294 		b += CrtcChangeRead(buf[b:], &dest[i])
    295 	}
    296 	return xgb.Pad(b)
    297 }
    298 
    299 // Bytes writes a CrtcChange value to a byte slice.
    300 func (v CrtcChange) Bytes() []byte {
    301 	buf := make([]byte, 28)
    302 	b := 0
    303 
    304 	xgb.Put32(buf[b:], uint32(v.Timestamp))
    305 	b += 4
    306 
    307 	xgb.Put32(buf[b:], uint32(v.Window))
    308 	b += 4
    309 
    310 	xgb.Put32(buf[b:], uint32(v.Crtc))
    311 	b += 4
    312 
    313 	xgb.Put32(buf[b:], uint32(v.Mode))
    314 	b += 4
    315 
    316 	xgb.Put16(buf[b:], v.Rotation)
    317 	b += 2
    318 
    319 	b += 2 // padding
    320 
    321 	xgb.Put16(buf[b:], uint16(v.X))
    322 	b += 2
    323 
    324 	xgb.Put16(buf[b:], uint16(v.Y))
    325 	b += 2
    326 
    327 	xgb.Put16(buf[b:], v.Width)
    328 	b += 2
    329 
    330 	xgb.Put16(buf[b:], v.Height)
    331 	b += 2
    332 
    333 	return buf[:b]
    334 }
    335 
    336 // CrtcChangeListBytes writes a list of CrtcChange values to a byte slice.
    337 func CrtcChangeListBytes(buf []byte, list []CrtcChange) int {
    338 	b := 0
    339 	var structBytes []byte
    340 	for _, item := range list {
    341 		structBytes = item.Bytes()
    342 		copy(buf[b:], structBytes)
    343 		b += len(structBytes)
    344 	}
    345 	return xgb.Pad(b)
    346 }
    347 
    348 type Mode uint32
    349 
    350 func NewModeId(c *xgb.Conn) (Mode, error) {
    351 	id, err := c.NewId()
    352 	if err != nil {
    353 		return 0, err
    354 	}
    355 	return Mode(id), nil
    356 }
    357 
    358 const (
    359 	ModeFlagHsyncPositive  = 1
    360 	ModeFlagHsyncNegative  = 2
    361 	ModeFlagVsyncPositive  = 4
    362 	ModeFlagVsyncNegative  = 8
    363 	ModeFlagInterlace      = 16
    364 	ModeFlagDoubleScan     = 32
    365 	ModeFlagCsync          = 64
    366 	ModeFlagCsyncPositive  = 128
    367 	ModeFlagCsyncNegative  = 256
    368 	ModeFlagHskewPresent   = 512
    369 	ModeFlagBcast          = 1024
    370 	ModeFlagPixelMultiplex = 2048
    371 	ModeFlagDoubleClock    = 4096
    372 	ModeFlagHalveClock     = 8192
    373 )
    374 
    375 type ModeInfo struct {
    376 	Id         uint32
    377 	Width      uint16
    378 	Height     uint16
    379 	DotClock   uint32
    380 	HsyncStart uint16
    381 	HsyncEnd   uint16
    382 	Htotal     uint16
    383 	Hskew      uint16
    384 	VsyncStart uint16
    385 	VsyncEnd   uint16
    386 	Vtotal     uint16
    387 	NameLen    uint16
    388 	ModeFlags  uint32
    389 }
    390 
    391 // ModeInfoRead reads a byte slice into a ModeInfo value.
    392 func ModeInfoRead(buf []byte, v *ModeInfo) int {
    393 	b := 0
    394 
    395 	v.Id = xgb.Get32(buf[b:])
    396 	b += 4
    397 
    398 	v.Width = xgb.Get16(buf[b:])
    399 	b += 2
    400 
    401 	v.Height = xgb.Get16(buf[b:])
    402 	b += 2
    403 
    404 	v.DotClock = xgb.Get32(buf[b:])
    405 	b += 4
    406 
    407 	v.HsyncStart = xgb.Get16(buf[b:])
    408 	b += 2
    409 
    410 	v.HsyncEnd = xgb.Get16(buf[b:])
    411 	b += 2
    412 
    413 	v.Htotal = xgb.Get16(buf[b:])
    414 	b += 2
    415 
    416 	v.Hskew = xgb.Get16(buf[b:])
    417 	b += 2
    418 
    419 	v.VsyncStart = xgb.Get16(buf[b:])
    420 	b += 2
    421 
    422 	v.VsyncEnd = xgb.Get16(buf[b:])
    423 	b += 2
    424 
    425 	v.Vtotal = xgb.Get16(buf[b:])
    426 	b += 2
    427 
    428 	v.NameLen = xgb.Get16(buf[b:])
    429 	b += 2
    430 
    431 	v.ModeFlags = xgb.Get32(buf[b:])
    432 	b += 4
    433 
    434 	return b
    435 }
    436 
    437 // ModeInfoReadList reads a byte slice into a list of ModeInfo values.
    438 func ModeInfoReadList(buf []byte, dest []ModeInfo) int {
    439 	b := 0
    440 	for i := 0; i < len(dest); i++ {
    441 		dest[i] = ModeInfo{}
    442 		b += ModeInfoRead(buf[b:], &dest[i])
    443 	}
    444 	return xgb.Pad(b)
    445 }
    446 
    447 // Bytes writes a ModeInfo value to a byte slice.
    448 func (v ModeInfo) Bytes() []byte {
    449 	buf := make([]byte, 32)
    450 	b := 0
    451 
    452 	xgb.Put32(buf[b:], v.Id)
    453 	b += 4
    454 
    455 	xgb.Put16(buf[b:], v.Width)
    456 	b += 2
    457 
    458 	xgb.Put16(buf[b:], v.Height)
    459 	b += 2
    460 
    461 	xgb.Put32(buf[b:], v.DotClock)
    462 	b += 4
    463 
    464 	xgb.Put16(buf[b:], v.HsyncStart)
    465 	b += 2
    466 
    467 	xgb.Put16(buf[b:], v.HsyncEnd)
    468 	b += 2
    469 
    470 	xgb.Put16(buf[b:], v.Htotal)
    471 	b += 2
    472 
    473 	xgb.Put16(buf[b:], v.Hskew)
    474 	b += 2
    475 
    476 	xgb.Put16(buf[b:], v.VsyncStart)
    477 	b += 2
    478 
    479 	xgb.Put16(buf[b:], v.VsyncEnd)
    480 	b += 2
    481 
    482 	xgb.Put16(buf[b:], v.Vtotal)
    483 	b += 2
    484 
    485 	xgb.Put16(buf[b:], v.NameLen)
    486 	b += 2
    487 
    488 	xgb.Put32(buf[b:], v.ModeFlags)
    489 	b += 4
    490 
    491 	return buf[:b]
    492 }
    493 
    494 // ModeInfoListBytes writes a list of ModeInfo values to a byte slice.
    495 func ModeInfoListBytes(buf []byte, list []ModeInfo) int {
    496 	b := 0
    497 	var structBytes []byte
    498 	for _, item := range list {
    499 		structBytes = item.Bytes()
    500 		copy(buf[b:], structBytes)
    501 		b += len(structBytes)
    502 	}
    503 	return xgb.Pad(b)
    504 }
    505 
    506 const (
    507 	NotifyCrtcChange       = 0
    508 	NotifyOutputChange     = 1
    509 	NotifyOutputProperty   = 2
    510 	NotifyProviderChange   = 3
    511 	NotifyProviderProperty = 4
    512 	NotifyResourceChange   = 5
    513 )
    514 
    515 // Notify is the event number for a NotifyEvent.
    516 const Notify = 1
    517 
    518 type NotifyEvent struct {
    519 	Sequence uint16
    520 	SubCode  byte
    521 	U        NotifyDataUnion
    522 }
    523 
    524 // NotifyEventNew constructs a NotifyEvent value that implements xgb.Event from a byte slice.
    525 func NotifyEventNew(buf []byte) xgb.Event {
    526 	v := NotifyEvent{}
    527 	b := 1 // don't read event number
    528 
    529 	v.SubCode = buf[b]
    530 	b += 1
    531 
    532 	v.Sequence = xgb.Get16(buf[b:])
    533 	b += 2
    534 
    535 	v.U = NotifyDataUnion{}
    536 	b += NotifyDataUnionRead(buf[b:], &v.U)
    537 
    538 	return v
    539 }
    540 
    541 // Bytes writes a NotifyEvent value to a byte slice.
    542 func (v NotifyEvent) Bytes() []byte {
    543 	buf := make([]byte, 32)
    544 	b := 0
    545 
    546 	// write event number
    547 	buf[b] = 1
    548 	b += 1
    549 
    550 	buf[b] = v.SubCode
    551 	b += 1
    552 
    553 	b += 2 // skip sequence number
    554 
    555 	{
    556 		unionBytes := v.U.Bytes()
    557 		copy(buf[b:], unionBytes)
    558 		b += len(unionBytes)
    559 	}
    560 
    561 	return buf
    562 }
    563 
    564 // SequenceId returns the sequence id attached to the Notify event.
    565 // Events without a sequence number (KeymapNotify) return 0.
    566 // This is mostly used internally.
    567 func (v NotifyEvent) SequenceId() uint16 {
    568 	return v.Sequence
    569 }
    570 
    571 // String is a rudimentary string representation of NotifyEvent.
    572 func (v NotifyEvent) String() string {
    573 	fieldVals := make([]string, 0, 2)
    574 	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
    575 	fieldVals = append(fieldVals, xgb.Sprintf("SubCode: %d", v.SubCode))
    576 	return "Notify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
    577 }
    578 
    579 func init() {
    580 	xgb.NewExtEventFuncs["RANDR"][1] = NotifyEventNew
    581 }
    582 
    583 // NotifyDataUnion is a represention of the NotifyDataUnion union type.
    584 // Note that to *create* a Union, you should *never* create
    585 // this struct directly (unless you know what you're doing).
    586 // Instead use one of the following constructors for 'NotifyDataUnion':
    587 //     NotifyDataUnionCcNew(Cc CrtcChange) NotifyDataUnion
    588 //     NotifyDataUnionOcNew(Oc OutputChange) NotifyDataUnion
    589 //     NotifyDataUnionOpNew(Op OutputProperty) NotifyDataUnion
    590 //     NotifyDataUnionPcNew(Pc ProviderChange) NotifyDataUnion
    591 //     NotifyDataUnionPpNew(Pp ProviderProperty) NotifyDataUnion
    592 //     NotifyDataUnionRcNew(Rc ResourceChange) NotifyDataUnion
    593 type NotifyDataUnion struct {
    594 	Cc CrtcChange
    595 	Oc OutputChange
    596 	Op OutputProperty
    597 	Pc ProviderChange
    598 	Pp ProviderProperty
    599 	Rc ResourceChange
    600 }
    601 
    602 // NotifyDataUnionCcNew constructs a new NotifyDataUnion union type with the Cc field.
    603 func NotifyDataUnionCcNew(Cc CrtcChange) NotifyDataUnion {
    604 	var b int
    605 	buf := make([]byte, 28)
    606 
    607 	{
    608 		structBytes := Cc.Bytes()
    609 		copy(buf[b:], structBytes)
    610 		b += len(structBytes)
    611 	}
    612 
    613 	// Create the Union type
    614 	v := NotifyDataUnion{}
    615 
    616 	// Now copy buf into all fields
    617 
    618 	b = 0 // always read the same bytes
    619 	v.Cc = CrtcChange{}
    620 	b += CrtcChangeRead(buf[b:], &v.Cc)
    621 
    622 	b = 0 // always read the same bytes
    623 	v.Oc = OutputChange{}
    624 	b += OutputChangeRead(buf[b:], &v.Oc)
    625 
    626 	b = 0 // always read the same bytes
    627 	v.Op = OutputProperty{}
    628 	b += OutputPropertyRead(buf[b:], &v.Op)
    629 
    630 	b = 0 // always read the same bytes
    631 	v.Pc = ProviderChange{}
    632 	b += ProviderChangeRead(buf[b:], &v.Pc)
    633 
    634 	b = 0 // always read the same bytes
    635 	v.Pp = ProviderProperty{}
    636 	b += ProviderPropertyRead(buf[b:], &v.Pp)
    637 
    638 	b = 0 // always read the same bytes
    639 	v.Rc = ResourceChange{}
    640 	b += ResourceChangeRead(buf[b:], &v.Rc)
    641 
    642 	return v
    643 }
    644 
    645 // NotifyDataUnionOcNew constructs a new NotifyDataUnion union type with the Oc field.
    646 func NotifyDataUnionOcNew(Oc OutputChange) NotifyDataUnion {
    647 	var b int
    648 	buf := make([]byte, 28)
    649 
    650 	{
    651 		structBytes := Oc.Bytes()
    652 		copy(buf[b:], structBytes)
    653 		b += len(structBytes)
    654 	}
    655 
    656 	// Create the Union type
    657 	v := NotifyDataUnion{}
    658 
    659 	// Now copy buf into all fields
    660 
    661 	b = 0 // always read the same bytes
    662 	v.Cc = CrtcChange{}
    663 	b += CrtcChangeRead(buf[b:], &v.Cc)
    664 
    665 	b = 0 // always read the same bytes
    666 	v.Oc = OutputChange{}
    667 	b += OutputChangeRead(buf[b:], &v.Oc)
    668 
    669 	b = 0 // always read the same bytes
    670 	v.Op = OutputProperty{}
    671 	b += OutputPropertyRead(buf[b:], &v.Op)
    672 
    673 	b = 0 // always read the same bytes
    674 	v.Pc = ProviderChange{}
    675 	b += ProviderChangeRead(buf[b:], &v.Pc)
    676 
    677 	b = 0 // always read the same bytes
    678 	v.Pp = ProviderProperty{}
    679 	b += ProviderPropertyRead(buf[b:], &v.Pp)
    680 
    681 	b = 0 // always read the same bytes
    682 	v.Rc = ResourceChange{}
    683 	b += ResourceChangeRead(buf[b:], &v.Rc)
    684 
    685 	return v
    686 }
    687 
    688 // NotifyDataUnionOpNew constructs a new NotifyDataUnion union type with the Op field.
    689 func NotifyDataUnionOpNew(Op OutputProperty) NotifyDataUnion {
    690 	var b int
    691 	buf := make([]byte, 28)
    692 
    693 	{
    694 		structBytes := Op.Bytes()
    695 		copy(buf[b:], structBytes)
    696 		b += len(structBytes)
    697 	}
    698 
    699 	// Create the Union type
    700 	v := NotifyDataUnion{}
    701 
    702 	// Now copy buf into all fields
    703 
    704 	b = 0 // always read the same bytes
    705 	v.Cc = CrtcChange{}
    706 	b += CrtcChangeRead(buf[b:], &v.Cc)
    707 
    708 	b = 0 // always read the same bytes
    709 	v.Oc = OutputChange{}
    710 	b += OutputChangeRead(buf[b:], &v.Oc)
    711 
    712 	b = 0 // always read the same bytes
    713 	v.Op = OutputProperty{}
    714 	b += OutputPropertyRead(buf[b:], &v.Op)
    715 
    716 	b = 0 // always read the same bytes
    717 	v.Pc = ProviderChange{}
    718 	b += ProviderChangeRead(buf[b:], &v.Pc)
    719 
    720 	b = 0 // always read the same bytes
    721 	v.Pp = ProviderProperty{}
    722 	b += ProviderPropertyRead(buf[b:], &v.Pp)
    723 
    724 	b = 0 // always read the same bytes
    725 	v.Rc = ResourceChange{}
    726 	b += ResourceChangeRead(buf[b:], &v.Rc)
    727 
    728 	return v
    729 }
    730 
    731 // NotifyDataUnionPcNew constructs a new NotifyDataUnion union type with the Pc field.
    732 func NotifyDataUnionPcNew(Pc ProviderChange) NotifyDataUnion {
    733 	var b int
    734 	buf := make([]byte, 28)
    735 
    736 	{
    737 		structBytes := Pc.Bytes()
    738 		copy(buf[b:], structBytes)
    739 		b += len(structBytes)
    740 	}
    741 
    742 	// Create the Union type
    743 	v := NotifyDataUnion{}
    744 
    745 	// Now copy buf into all fields
    746 
    747 	b = 0 // always read the same bytes
    748 	v.Cc = CrtcChange{}
    749 	b += CrtcChangeRead(buf[b:], &v.Cc)
    750 
    751 	b = 0 // always read the same bytes
    752 	v.Oc = OutputChange{}
    753 	b += OutputChangeRead(buf[b:], &v.Oc)
    754 
    755 	b = 0 // always read the same bytes
    756 	v.Op = OutputProperty{}
    757 	b += OutputPropertyRead(buf[b:], &v.Op)
    758 
    759 	b = 0 // always read the same bytes
    760 	v.Pc = ProviderChange{}
    761 	b += ProviderChangeRead(buf[b:], &v.Pc)
    762 
    763 	b = 0 // always read the same bytes
    764 	v.Pp = ProviderProperty{}
    765 	b += ProviderPropertyRead(buf[b:], &v.Pp)
    766 
    767 	b = 0 // always read the same bytes
    768 	v.Rc = ResourceChange{}
    769 	b += ResourceChangeRead(buf[b:], &v.Rc)
    770 
    771 	return v
    772 }
    773 
    774 // NotifyDataUnionPpNew constructs a new NotifyDataUnion union type with the Pp field.
    775 func NotifyDataUnionPpNew(Pp ProviderProperty) NotifyDataUnion {
    776 	var b int
    777 	buf := make([]byte, 28)
    778 
    779 	{
    780 		structBytes := Pp.Bytes()
    781 		copy(buf[b:], structBytes)
    782 		b += len(structBytes)
    783 	}
    784 
    785 	// Create the Union type
    786 	v := NotifyDataUnion{}
    787 
    788 	// Now copy buf into all fields
    789 
    790 	b = 0 // always read the same bytes
    791 	v.Cc = CrtcChange{}
    792 	b += CrtcChangeRead(buf[b:], &v.Cc)
    793 
    794 	b = 0 // always read the same bytes
    795 	v.Oc = OutputChange{}
    796 	b += OutputChangeRead(buf[b:], &v.Oc)
    797 
    798 	b = 0 // always read the same bytes
    799 	v.Op = OutputProperty{}
    800 	b += OutputPropertyRead(buf[b:], &v.Op)
    801 
    802 	b = 0 // always read the same bytes
    803 	v.Pc = ProviderChange{}
    804 	b += ProviderChangeRead(buf[b:], &v.Pc)
    805 
    806 	b = 0 // always read the same bytes
    807 	v.Pp = ProviderProperty{}
    808 	b += ProviderPropertyRead(buf[b:], &v.Pp)
    809 
    810 	b = 0 // always read the same bytes
    811 	v.Rc = ResourceChange{}
    812 	b += ResourceChangeRead(buf[b:], &v.Rc)
    813 
    814 	return v
    815 }
    816 
    817 // NotifyDataUnionRcNew constructs a new NotifyDataUnion union type with the Rc field.
    818 func NotifyDataUnionRcNew(Rc ResourceChange) NotifyDataUnion {
    819 	var b int
    820 	buf := make([]byte, 28)
    821 
    822 	{
    823 		structBytes := Rc.Bytes()
    824 		copy(buf[b:], structBytes)
    825 		b += len(structBytes)
    826 	}
    827 
    828 	// Create the Union type
    829 	v := NotifyDataUnion{}
    830 
    831 	// Now copy buf into all fields
    832 
    833 	b = 0 // always read the same bytes
    834 	v.Cc = CrtcChange{}
    835 	b += CrtcChangeRead(buf[b:], &v.Cc)
    836 
    837 	b = 0 // always read the same bytes
    838 	v.Oc = OutputChange{}
    839 	b += OutputChangeRead(buf[b:], &v.Oc)
    840 
    841 	b = 0 // always read the same bytes
    842 	v.Op = OutputProperty{}
    843 	b += OutputPropertyRead(buf[b:], &v.Op)
    844 
    845 	b = 0 // always read the same bytes
    846 	v.Pc = ProviderChange{}
    847 	b += ProviderChangeRead(buf[b:], &v.Pc)
    848 
    849 	b = 0 // always read the same bytes
    850 	v.Pp = ProviderProperty{}
    851 	b += ProviderPropertyRead(buf[b:], &v.Pp)
    852 
    853 	b = 0 // always read the same bytes
    854 	v.Rc = ResourceChange{}
    855 	b += ResourceChangeRead(buf[b:], &v.Rc)
    856 
    857 	return v
    858 }
    859 
    860 // NotifyDataUnionRead reads a byte slice into a NotifyDataUnion value.
    861 func NotifyDataUnionRead(buf []byte, v *NotifyDataUnion) int {
    862 	var b int
    863 
    864 	b = 0 // re-read the same bytes
    865 	v.Cc = CrtcChange{}
    866 	b += CrtcChangeRead(buf[b:], &v.Cc)
    867 
    868 	b = 0 // re-read the same bytes
    869 	v.Oc = OutputChange{}
    870 	b += OutputChangeRead(buf[b:], &v.Oc)
    871 
    872 	b = 0 // re-read the same bytes
    873 	v.Op = OutputProperty{}
    874 	b += OutputPropertyRead(buf[b:], &v.Op)
    875 
    876 	b = 0 // re-read the same bytes
    877 	v.Pc = ProviderChange{}
    878 	b += ProviderChangeRead(buf[b:], &v.Pc)
    879 
    880 	b = 0 // re-read the same bytes
    881 	v.Pp = ProviderProperty{}
    882 	b += ProviderPropertyRead(buf[b:], &v.Pp)
    883 
    884 	b = 0 // re-read the same bytes
    885 	v.Rc = ResourceChange{}
    886 	b += ResourceChangeRead(buf[b:], &v.Rc)
    887 
    888 	return 28
    889 }
    890 
    891 // NotifyDataUnionReadList reads a byte slice into a list of NotifyDataUnion values.
    892 func NotifyDataUnionReadList(buf []byte, dest []NotifyDataUnion) int {
    893 	b := 0
    894 	for i := 0; i < len(dest); i++ {
    895 		dest[i] = NotifyDataUnion{}
    896 		b += NotifyDataUnionRead(buf[b:], &dest[i])
    897 	}
    898 	return xgb.Pad(b)
    899 }
    900 
    901 // Bytes writes a NotifyDataUnion value to a byte slice.
    902 // Each field in a union must contain the same data.
    903 // So simply pick the first field and write that to the wire.
    904 func (v NotifyDataUnion) Bytes() []byte {
    905 	buf := make([]byte, 28)
    906 	b := 0
    907 
    908 	{
    909 		structBytes := v.Cc.Bytes()
    910 		copy(buf[b:], structBytes)
    911 		b += len(structBytes)
    912 	}
    913 	return buf
    914 }
    915 
    916 // NotifyDataUnionListBytes writes a list of NotifyDataUnion values to a byte slice.
    917 func NotifyDataUnionListBytes(buf []byte, list []NotifyDataUnion) int {
    918 	b := 0
    919 	var unionBytes []byte
    920 	for _, item := range list {
    921 		unionBytes = item.Bytes()
    922 		copy(buf[b:], unionBytes)
    923 		b += xgb.Pad(len(unionBytes))
    924 	}
    925 	return b
    926 }
    927 
    928 const (
    929 	NotifyMaskScreenChange     = 1
    930 	NotifyMaskCrtcChange       = 2
    931 	NotifyMaskOutputChange     = 4
    932 	NotifyMaskOutputProperty   = 8
    933 	NotifyMaskProviderChange   = 16
    934 	NotifyMaskProviderProperty = 32
    935 	NotifyMaskResourceChange   = 64
    936 )
    937 
    938 type Output uint32
    939 
    940 func NewOutputId(c *xgb.Conn) (Output, error) {
    941 	id, err := c.NewId()
    942 	if err != nil {
    943 		return 0, err
    944 	}
    945 	return Output(id), nil
    946 }
    947 
    948 type OutputChange struct {
    949 	Timestamp       xproto.Timestamp
    950 	ConfigTimestamp xproto.Timestamp
    951 	Window          xproto.Window
    952 	Output          Output
    953 	Crtc            Crtc
    954 	Mode            Mode
    955 	Rotation        uint16
    956 	Connection      byte
    957 	SubpixelOrder   byte
    958 }
    959 
    960 // OutputChangeRead reads a byte slice into a OutputChange value.
    961 func OutputChangeRead(buf []byte, v *OutputChange) int {
    962 	b := 0
    963 
    964 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
    965 	b += 4
    966 
    967 	v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
    968 	b += 4
    969 
    970 	v.Window = xproto.Window(xgb.Get32(buf[b:]))
    971 	b += 4
    972 
    973 	v.Output = Output(xgb.Get32(buf[b:]))
    974 	b += 4
    975 
    976 	v.Crtc = Crtc(xgb.Get32(buf[b:]))
    977 	b += 4
    978 
    979 	v.Mode = Mode(xgb.Get32(buf[b:]))
    980 	b += 4
    981 
    982 	v.Rotation = xgb.Get16(buf[b:])
    983 	b += 2
    984 
    985 	v.Connection = buf[b]
    986 	b += 1
    987 
    988 	v.SubpixelOrder = buf[b]
    989 	b += 1
    990 
    991 	return b
    992 }
    993 
    994 // OutputChangeReadList reads a byte slice into a list of OutputChange values.
    995 func OutputChangeReadList(buf []byte, dest []OutputChange) int {
    996 	b := 0
    997 	for i := 0; i < len(dest); i++ {
    998 		dest[i] = OutputChange{}
    999 		b += OutputChangeRead(buf[b:], &dest[i])
   1000 	}
   1001 	return xgb.Pad(b)
   1002 }
   1003 
   1004 // Bytes writes a OutputChange value to a byte slice.
   1005 func (v OutputChange) Bytes() []byte {
   1006 	buf := make([]byte, 28)
   1007 	b := 0
   1008 
   1009 	xgb.Put32(buf[b:], uint32(v.Timestamp))
   1010 	b += 4
   1011 
   1012 	xgb.Put32(buf[b:], uint32(v.ConfigTimestamp))
   1013 	b += 4
   1014 
   1015 	xgb.Put32(buf[b:], uint32(v.Window))
   1016 	b += 4
   1017 
   1018 	xgb.Put32(buf[b:], uint32(v.Output))
   1019 	b += 4
   1020 
   1021 	xgb.Put32(buf[b:], uint32(v.Crtc))
   1022 	b += 4
   1023 
   1024 	xgb.Put32(buf[b:], uint32(v.Mode))
   1025 	b += 4
   1026 
   1027 	xgb.Put16(buf[b:], v.Rotation)
   1028 	b += 2
   1029 
   1030 	buf[b] = v.Connection
   1031 	b += 1
   1032 
   1033 	buf[b] = v.SubpixelOrder
   1034 	b += 1
   1035 
   1036 	return buf[:b]
   1037 }
   1038 
   1039 // OutputChangeListBytes writes a list of OutputChange values to a byte slice.
   1040 func OutputChangeListBytes(buf []byte, list []OutputChange) int {
   1041 	b := 0
   1042 	var structBytes []byte
   1043 	for _, item := range list {
   1044 		structBytes = item.Bytes()
   1045 		copy(buf[b:], structBytes)
   1046 		b += len(structBytes)
   1047 	}
   1048 	return xgb.Pad(b)
   1049 }
   1050 
   1051 type OutputProperty struct {
   1052 	Window    xproto.Window
   1053 	Output    Output
   1054 	Atom      xproto.Atom
   1055 	Timestamp xproto.Timestamp
   1056 	Status    byte
   1057 	// padding: 11 bytes
   1058 }
   1059 
   1060 // OutputPropertyRead reads a byte slice into a OutputProperty value.
   1061 func OutputPropertyRead(buf []byte, v *OutputProperty) int {
   1062 	b := 0
   1063 
   1064 	v.Window = xproto.Window(xgb.Get32(buf[b:]))
   1065 	b += 4
   1066 
   1067 	v.Output = Output(xgb.Get32(buf[b:]))
   1068 	b += 4
   1069 
   1070 	v.Atom = xproto.Atom(xgb.Get32(buf[b:]))
   1071 	b += 4
   1072 
   1073 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   1074 	b += 4
   1075 
   1076 	v.Status = buf[b]
   1077 	b += 1
   1078 
   1079 	b += 11 // padding
   1080 
   1081 	return b
   1082 }
   1083 
   1084 // OutputPropertyReadList reads a byte slice into a list of OutputProperty values.
   1085 func OutputPropertyReadList(buf []byte, dest []OutputProperty) int {
   1086 	b := 0
   1087 	for i := 0; i < len(dest); i++ {
   1088 		dest[i] = OutputProperty{}
   1089 		b += OutputPropertyRead(buf[b:], &dest[i])
   1090 	}
   1091 	return xgb.Pad(b)
   1092 }
   1093 
   1094 // Bytes writes a OutputProperty value to a byte slice.
   1095 func (v OutputProperty) Bytes() []byte {
   1096 	buf := make([]byte, 28)
   1097 	b := 0
   1098 
   1099 	xgb.Put32(buf[b:], uint32(v.Window))
   1100 	b += 4
   1101 
   1102 	xgb.Put32(buf[b:], uint32(v.Output))
   1103 	b += 4
   1104 
   1105 	xgb.Put32(buf[b:], uint32(v.Atom))
   1106 	b += 4
   1107 
   1108 	xgb.Put32(buf[b:], uint32(v.Timestamp))
   1109 	b += 4
   1110 
   1111 	buf[b] = v.Status
   1112 	b += 1
   1113 
   1114 	b += 11 // padding
   1115 
   1116 	return buf[:b]
   1117 }
   1118 
   1119 // OutputPropertyListBytes writes a list of OutputProperty values to a byte slice.
   1120 func OutputPropertyListBytes(buf []byte, list []OutputProperty) int {
   1121 	b := 0
   1122 	var structBytes []byte
   1123 	for _, item := range list {
   1124 		structBytes = item.Bytes()
   1125 		copy(buf[b:], structBytes)
   1126 		b += len(structBytes)
   1127 	}
   1128 	return xgb.Pad(b)
   1129 }
   1130 
   1131 type Provider uint32
   1132 
   1133 func NewProviderId(c *xgb.Conn) (Provider, error) {
   1134 	id, err := c.NewId()
   1135 	if err != nil {
   1136 		return 0, err
   1137 	}
   1138 	return Provider(id), nil
   1139 }
   1140 
   1141 const (
   1142 	ProviderCapabilitySourceOutput  = 1
   1143 	ProviderCapabilitySinkOutput    = 2
   1144 	ProviderCapabilitySourceOffload = 4
   1145 	ProviderCapabilitySinkOffload   = 8
   1146 )
   1147 
   1148 type ProviderChange struct {
   1149 	Timestamp xproto.Timestamp
   1150 	Window    xproto.Window
   1151 	Provider  Provider
   1152 	// padding: 16 bytes
   1153 }
   1154 
   1155 // ProviderChangeRead reads a byte slice into a ProviderChange value.
   1156 func ProviderChangeRead(buf []byte, v *ProviderChange) int {
   1157 	b := 0
   1158 
   1159 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   1160 	b += 4
   1161 
   1162 	v.Window = xproto.Window(xgb.Get32(buf[b:]))
   1163 	b += 4
   1164 
   1165 	v.Provider = Provider(xgb.Get32(buf[b:]))
   1166 	b += 4
   1167 
   1168 	b += 16 // padding
   1169 
   1170 	return b
   1171 }
   1172 
   1173 // ProviderChangeReadList reads a byte slice into a list of ProviderChange values.
   1174 func ProviderChangeReadList(buf []byte, dest []ProviderChange) int {
   1175 	b := 0
   1176 	for i := 0; i < len(dest); i++ {
   1177 		dest[i] = ProviderChange{}
   1178 		b += ProviderChangeRead(buf[b:], &dest[i])
   1179 	}
   1180 	return xgb.Pad(b)
   1181 }
   1182 
   1183 // Bytes writes a ProviderChange value to a byte slice.
   1184 func (v ProviderChange) Bytes() []byte {
   1185 	buf := make([]byte, 28)
   1186 	b := 0
   1187 
   1188 	xgb.Put32(buf[b:], uint32(v.Timestamp))
   1189 	b += 4
   1190 
   1191 	xgb.Put32(buf[b:], uint32(v.Window))
   1192 	b += 4
   1193 
   1194 	xgb.Put32(buf[b:], uint32(v.Provider))
   1195 	b += 4
   1196 
   1197 	b += 16 // padding
   1198 
   1199 	return buf[:b]
   1200 }
   1201 
   1202 // ProviderChangeListBytes writes a list of ProviderChange values to a byte slice.
   1203 func ProviderChangeListBytes(buf []byte, list []ProviderChange) int {
   1204 	b := 0
   1205 	var structBytes []byte
   1206 	for _, item := range list {
   1207 		structBytes = item.Bytes()
   1208 		copy(buf[b:], structBytes)
   1209 		b += len(structBytes)
   1210 	}
   1211 	return xgb.Pad(b)
   1212 }
   1213 
   1214 type ProviderProperty struct {
   1215 	Window    xproto.Window
   1216 	Provider  Provider
   1217 	Atom      xproto.Atom
   1218 	Timestamp xproto.Timestamp
   1219 	State     byte
   1220 	// padding: 11 bytes
   1221 }
   1222 
   1223 // ProviderPropertyRead reads a byte slice into a ProviderProperty value.
   1224 func ProviderPropertyRead(buf []byte, v *ProviderProperty) int {
   1225 	b := 0
   1226 
   1227 	v.Window = xproto.Window(xgb.Get32(buf[b:]))
   1228 	b += 4
   1229 
   1230 	v.Provider = Provider(xgb.Get32(buf[b:]))
   1231 	b += 4
   1232 
   1233 	v.Atom = xproto.Atom(xgb.Get32(buf[b:]))
   1234 	b += 4
   1235 
   1236 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   1237 	b += 4
   1238 
   1239 	v.State = buf[b]
   1240 	b += 1
   1241 
   1242 	b += 11 // padding
   1243 
   1244 	return b
   1245 }
   1246 
   1247 // ProviderPropertyReadList reads a byte slice into a list of ProviderProperty values.
   1248 func ProviderPropertyReadList(buf []byte, dest []ProviderProperty) int {
   1249 	b := 0
   1250 	for i := 0; i < len(dest); i++ {
   1251 		dest[i] = ProviderProperty{}
   1252 		b += ProviderPropertyRead(buf[b:], &dest[i])
   1253 	}
   1254 	return xgb.Pad(b)
   1255 }
   1256 
   1257 // Bytes writes a ProviderProperty value to a byte slice.
   1258 func (v ProviderProperty) Bytes() []byte {
   1259 	buf := make([]byte, 28)
   1260 	b := 0
   1261 
   1262 	xgb.Put32(buf[b:], uint32(v.Window))
   1263 	b += 4
   1264 
   1265 	xgb.Put32(buf[b:], uint32(v.Provider))
   1266 	b += 4
   1267 
   1268 	xgb.Put32(buf[b:], uint32(v.Atom))
   1269 	b += 4
   1270 
   1271 	xgb.Put32(buf[b:], uint32(v.Timestamp))
   1272 	b += 4
   1273 
   1274 	buf[b] = v.State
   1275 	b += 1
   1276 
   1277 	b += 11 // padding
   1278 
   1279 	return buf[:b]
   1280 }
   1281 
   1282 // ProviderPropertyListBytes writes a list of ProviderProperty values to a byte slice.
   1283 func ProviderPropertyListBytes(buf []byte, list []ProviderProperty) int {
   1284 	b := 0
   1285 	var structBytes []byte
   1286 	for _, item := range list {
   1287 		structBytes = item.Bytes()
   1288 		copy(buf[b:], structBytes)
   1289 		b += len(structBytes)
   1290 	}
   1291 	return xgb.Pad(b)
   1292 }
   1293 
   1294 type RefreshRates struct {
   1295 	NRates uint16
   1296 	Rates  []uint16 // size: xgb.Pad((int(NRates) * 2))
   1297 }
   1298 
   1299 // RefreshRatesRead reads a byte slice into a RefreshRates value.
   1300 func RefreshRatesRead(buf []byte, v *RefreshRates) int {
   1301 	b := 0
   1302 
   1303 	v.NRates = xgb.Get16(buf[b:])
   1304 	b += 2
   1305 
   1306 	v.Rates = make([]uint16, v.NRates)
   1307 	for i := 0; i < int(v.NRates); i++ {
   1308 		v.Rates[i] = xgb.Get16(buf[b:])
   1309 		b += 2
   1310 	}
   1311 
   1312 	return b
   1313 }
   1314 
   1315 // RefreshRatesReadList reads a byte slice into a list of RefreshRates values.
   1316 func RefreshRatesReadList(buf []byte, dest []RefreshRates) int {
   1317 	b := 0
   1318 	for i := 0; i < len(dest); i++ {
   1319 		dest[i] = RefreshRates{}
   1320 		b += RefreshRatesRead(buf[b:], &dest[i])
   1321 	}
   1322 	return xgb.Pad(b)
   1323 }
   1324 
   1325 // Bytes writes a RefreshRates value to a byte slice.
   1326 func (v RefreshRates) Bytes() []byte {
   1327 	buf := make([]byte, (2 + xgb.Pad((int(v.NRates) * 2))))
   1328 	b := 0
   1329 
   1330 	xgb.Put16(buf[b:], v.NRates)
   1331 	b += 2
   1332 
   1333 	for i := 0; i < int(v.NRates); i++ {
   1334 		xgb.Put16(buf[b:], v.Rates[i])
   1335 		b += 2
   1336 	}
   1337 
   1338 	return buf[:b]
   1339 }
   1340 
   1341 // RefreshRatesListBytes writes a list of RefreshRates values to a byte slice.
   1342 func RefreshRatesListBytes(buf []byte, list []RefreshRates) int {
   1343 	b := 0
   1344 	var structBytes []byte
   1345 	for _, item := range list {
   1346 		structBytes = item.Bytes()
   1347 		copy(buf[b:], structBytes)
   1348 		b += len(structBytes)
   1349 	}
   1350 	return xgb.Pad(b)
   1351 }
   1352 
   1353 // RefreshRatesListSize computes the size (bytes) of a list of RefreshRates values.
   1354 func RefreshRatesListSize(list []RefreshRates) int {
   1355 	size := 0
   1356 	for _, item := range list {
   1357 		size += (2 + xgb.Pad((int(item.NRates) * 2)))
   1358 	}
   1359 	return size
   1360 }
   1361 
   1362 type ResourceChange struct {
   1363 	Timestamp xproto.Timestamp
   1364 	Window    xproto.Window
   1365 	// padding: 20 bytes
   1366 }
   1367 
   1368 // ResourceChangeRead reads a byte slice into a ResourceChange value.
   1369 func ResourceChangeRead(buf []byte, v *ResourceChange) int {
   1370 	b := 0
   1371 
   1372 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   1373 	b += 4
   1374 
   1375 	v.Window = xproto.Window(xgb.Get32(buf[b:]))
   1376 	b += 4
   1377 
   1378 	b += 20 // padding
   1379 
   1380 	return b
   1381 }
   1382 
   1383 // ResourceChangeReadList reads a byte slice into a list of ResourceChange values.
   1384 func ResourceChangeReadList(buf []byte, dest []ResourceChange) int {
   1385 	b := 0
   1386 	for i := 0; i < len(dest); i++ {
   1387 		dest[i] = ResourceChange{}
   1388 		b += ResourceChangeRead(buf[b:], &dest[i])
   1389 	}
   1390 	return xgb.Pad(b)
   1391 }
   1392 
   1393 // Bytes writes a ResourceChange value to a byte slice.
   1394 func (v ResourceChange) Bytes() []byte {
   1395 	buf := make([]byte, 28)
   1396 	b := 0
   1397 
   1398 	xgb.Put32(buf[b:], uint32(v.Timestamp))
   1399 	b += 4
   1400 
   1401 	xgb.Put32(buf[b:], uint32(v.Window))
   1402 	b += 4
   1403 
   1404 	b += 20 // padding
   1405 
   1406 	return buf[:b]
   1407 }
   1408 
   1409 // ResourceChangeListBytes writes a list of ResourceChange values to a byte slice.
   1410 func ResourceChangeListBytes(buf []byte, list []ResourceChange) int {
   1411 	b := 0
   1412 	var structBytes []byte
   1413 	for _, item := range list {
   1414 		structBytes = item.Bytes()
   1415 		copy(buf[b:], structBytes)
   1416 		b += len(structBytes)
   1417 	}
   1418 	return xgb.Pad(b)
   1419 }
   1420 
   1421 const (
   1422 	RotationRotate0   = 1
   1423 	RotationRotate90  = 2
   1424 	RotationRotate180 = 4
   1425 	RotationRotate270 = 8
   1426 	RotationReflectX  = 16
   1427 	RotationReflectY  = 32
   1428 )
   1429 
   1430 // ScreenChangeNotify is the event number for a ScreenChangeNotifyEvent.
   1431 const ScreenChangeNotify = 0
   1432 
   1433 type ScreenChangeNotifyEvent struct {
   1434 	Sequence        uint16
   1435 	Rotation        byte
   1436 	Timestamp       xproto.Timestamp
   1437 	ConfigTimestamp xproto.Timestamp
   1438 	Root            xproto.Window
   1439 	RequestWindow   xproto.Window
   1440 	SizeID          uint16
   1441 	SubpixelOrder   uint16
   1442 	Width           uint16
   1443 	Height          uint16
   1444 	Mwidth          uint16
   1445 	Mheight         uint16
   1446 }
   1447 
   1448 // ScreenChangeNotifyEventNew constructs a ScreenChangeNotifyEvent value that implements xgb.Event from a byte slice.
   1449 func ScreenChangeNotifyEventNew(buf []byte) xgb.Event {
   1450 	v := ScreenChangeNotifyEvent{}
   1451 	b := 1 // don't read event number
   1452 
   1453 	v.Rotation = buf[b]
   1454 	b += 1
   1455 
   1456 	v.Sequence = xgb.Get16(buf[b:])
   1457 	b += 2
   1458 
   1459 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   1460 	b += 4
   1461 
   1462 	v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   1463 	b += 4
   1464 
   1465 	v.Root = xproto.Window(xgb.Get32(buf[b:]))
   1466 	b += 4
   1467 
   1468 	v.RequestWindow = xproto.Window(xgb.Get32(buf[b:]))
   1469 	b += 4
   1470 
   1471 	v.SizeID = xgb.Get16(buf[b:])
   1472 	b += 2
   1473 
   1474 	v.SubpixelOrder = xgb.Get16(buf[b:])
   1475 	b += 2
   1476 
   1477 	v.Width = xgb.Get16(buf[b:])
   1478 	b += 2
   1479 
   1480 	v.Height = xgb.Get16(buf[b:])
   1481 	b += 2
   1482 
   1483 	v.Mwidth = xgb.Get16(buf[b:])
   1484 	b += 2
   1485 
   1486 	v.Mheight = xgb.Get16(buf[b:])
   1487 	b += 2
   1488 
   1489 	return v
   1490 }
   1491 
   1492 // Bytes writes a ScreenChangeNotifyEvent value to a byte slice.
   1493 func (v ScreenChangeNotifyEvent) Bytes() []byte {
   1494 	buf := make([]byte, 32)
   1495 	b := 0
   1496 
   1497 	// write event number
   1498 	buf[b] = 0
   1499 	b += 1
   1500 
   1501 	buf[b] = v.Rotation
   1502 	b += 1
   1503 
   1504 	b += 2 // skip sequence number
   1505 
   1506 	xgb.Put32(buf[b:], uint32(v.Timestamp))
   1507 	b += 4
   1508 
   1509 	xgb.Put32(buf[b:], uint32(v.ConfigTimestamp))
   1510 	b += 4
   1511 
   1512 	xgb.Put32(buf[b:], uint32(v.Root))
   1513 	b += 4
   1514 
   1515 	xgb.Put32(buf[b:], uint32(v.RequestWindow))
   1516 	b += 4
   1517 
   1518 	xgb.Put16(buf[b:], v.SizeID)
   1519 	b += 2
   1520 
   1521 	xgb.Put16(buf[b:], v.SubpixelOrder)
   1522 	b += 2
   1523 
   1524 	xgb.Put16(buf[b:], v.Width)
   1525 	b += 2
   1526 
   1527 	xgb.Put16(buf[b:], v.Height)
   1528 	b += 2
   1529 
   1530 	xgb.Put16(buf[b:], v.Mwidth)
   1531 	b += 2
   1532 
   1533 	xgb.Put16(buf[b:], v.Mheight)
   1534 	b += 2
   1535 
   1536 	return buf
   1537 }
   1538 
   1539 // SequenceId returns the sequence id attached to the ScreenChangeNotify event.
   1540 // Events without a sequence number (KeymapNotify) return 0.
   1541 // This is mostly used internally.
   1542 func (v ScreenChangeNotifyEvent) SequenceId() uint16 {
   1543 	return v.Sequence
   1544 }
   1545 
   1546 // String is a rudimentary string representation of ScreenChangeNotifyEvent.
   1547 func (v ScreenChangeNotifyEvent) String() string {
   1548 	fieldVals := make([]string, 0, 11)
   1549 	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
   1550 	fieldVals = append(fieldVals, xgb.Sprintf("Rotation: %d", v.Rotation))
   1551 	fieldVals = append(fieldVals, xgb.Sprintf("Timestamp: %d", v.Timestamp))
   1552 	fieldVals = append(fieldVals, xgb.Sprintf("ConfigTimestamp: %d", v.ConfigTimestamp))
   1553 	fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
   1554 	fieldVals = append(fieldVals, xgb.Sprintf("RequestWindow: %d", v.RequestWindow))
   1555 	fieldVals = append(fieldVals, xgb.Sprintf("SizeID: %d", v.SizeID))
   1556 	fieldVals = append(fieldVals, xgb.Sprintf("SubpixelOrder: %d", v.SubpixelOrder))
   1557 	fieldVals = append(fieldVals, xgb.Sprintf("Width: %d", v.Width))
   1558 	fieldVals = append(fieldVals, xgb.Sprintf("Height: %d", v.Height))
   1559 	fieldVals = append(fieldVals, xgb.Sprintf("Mwidth: %d", v.Mwidth))
   1560 	fieldVals = append(fieldVals, xgb.Sprintf("Mheight: %d", v.Mheight))
   1561 	return "ScreenChangeNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
   1562 }
   1563 
   1564 func init() {
   1565 	xgb.NewExtEventFuncs["RANDR"][0] = ScreenChangeNotifyEventNew
   1566 }
   1567 
   1568 type ScreenSize struct {
   1569 	Width   uint16
   1570 	Height  uint16
   1571 	Mwidth  uint16
   1572 	Mheight uint16
   1573 }
   1574 
   1575 // ScreenSizeRead reads a byte slice into a ScreenSize value.
   1576 func ScreenSizeRead(buf []byte, v *ScreenSize) int {
   1577 	b := 0
   1578 
   1579 	v.Width = xgb.Get16(buf[b:])
   1580 	b += 2
   1581 
   1582 	v.Height = xgb.Get16(buf[b:])
   1583 	b += 2
   1584 
   1585 	v.Mwidth = xgb.Get16(buf[b:])
   1586 	b += 2
   1587 
   1588 	v.Mheight = xgb.Get16(buf[b:])
   1589 	b += 2
   1590 
   1591 	return b
   1592 }
   1593 
   1594 // ScreenSizeReadList reads a byte slice into a list of ScreenSize values.
   1595 func ScreenSizeReadList(buf []byte, dest []ScreenSize) int {
   1596 	b := 0
   1597 	for i := 0; i < len(dest); i++ {
   1598 		dest[i] = ScreenSize{}
   1599 		b += ScreenSizeRead(buf[b:], &dest[i])
   1600 	}
   1601 	return xgb.Pad(b)
   1602 }
   1603 
   1604 // Bytes writes a ScreenSize value to a byte slice.
   1605 func (v ScreenSize) Bytes() []byte {
   1606 	buf := make([]byte, 8)
   1607 	b := 0
   1608 
   1609 	xgb.Put16(buf[b:], v.Width)
   1610 	b += 2
   1611 
   1612 	xgb.Put16(buf[b:], v.Height)
   1613 	b += 2
   1614 
   1615 	xgb.Put16(buf[b:], v.Mwidth)
   1616 	b += 2
   1617 
   1618 	xgb.Put16(buf[b:], v.Mheight)
   1619 	b += 2
   1620 
   1621 	return buf[:b]
   1622 }
   1623 
   1624 // ScreenSizeListBytes writes a list of ScreenSize values to a byte slice.
   1625 func ScreenSizeListBytes(buf []byte, list []ScreenSize) int {
   1626 	b := 0
   1627 	var structBytes []byte
   1628 	for _, item := range list {
   1629 		structBytes = item.Bytes()
   1630 		copy(buf[b:], structBytes)
   1631 		b += len(structBytes)
   1632 	}
   1633 	return xgb.Pad(b)
   1634 }
   1635 
   1636 const (
   1637 	SetConfigSuccess           = 0
   1638 	SetConfigInvalidConfigTime = 1
   1639 	SetConfigInvalidTime       = 2
   1640 	SetConfigFailed            = 3
   1641 )
   1642 
   1643 const (
   1644 	TransformUnit       = 1
   1645 	TransformScaleUp    = 2
   1646 	TransformScaleDown  = 4
   1647 	TransformProjective = 8
   1648 )
   1649 
   1650 // Skipping definition for base type 'Bool'
   1651 
   1652 // Skipping definition for base type 'Byte'
   1653 
   1654 // Skipping definition for base type 'Card8'
   1655 
   1656 // Skipping definition for base type 'Char'
   1657 
   1658 // Skipping definition for base type 'Void'
   1659 
   1660 // Skipping definition for base type 'Double'
   1661 
   1662 // Skipping definition for base type 'Float'
   1663 
   1664 // Skipping definition for base type 'Int16'
   1665 
   1666 // Skipping definition for base type 'Int32'
   1667 
   1668 // Skipping definition for base type 'Int8'
   1669 
   1670 // Skipping definition for base type 'Card16'
   1671 
   1672 // Skipping definition for base type 'Card32'
   1673 
   1674 // AddOutputModeCookie is a cookie used only for AddOutputMode requests.
   1675 type AddOutputModeCookie struct {
   1676 	*xgb.Cookie
   1677 }
   1678 
   1679 // AddOutputMode sends an unchecked request.
   1680 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   1681 func AddOutputMode(c *xgb.Conn, Output Output, Mode Mode) AddOutputModeCookie {
   1682 	c.ExtLock.RLock()
   1683 	defer c.ExtLock.RUnlock()
   1684 	if _, ok := c.Extensions["RANDR"]; !ok {
   1685 		panic("Cannot issue request 'AddOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   1686 	}
   1687 	cookie := c.NewCookie(false, false)
   1688 	c.NewRequest(addOutputModeRequest(c, Output, Mode), cookie)
   1689 	return AddOutputModeCookie{cookie}
   1690 }
   1691 
   1692 // AddOutputModeChecked sends a checked request.
   1693 // If an error occurs, it can be retrieved using AddOutputModeCookie.Check()
   1694 func AddOutputModeChecked(c *xgb.Conn, Output Output, Mode Mode) AddOutputModeCookie {
   1695 	c.ExtLock.RLock()
   1696 	defer c.ExtLock.RUnlock()
   1697 	if _, ok := c.Extensions["RANDR"]; !ok {
   1698 		panic("Cannot issue request 'AddOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   1699 	}
   1700 	cookie := c.NewCookie(true, false)
   1701 	c.NewRequest(addOutputModeRequest(c, Output, Mode), cookie)
   1702 	return AddOutputModeCookie{cookie}
   1703 }
   1704 
   1705 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   1706 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   1707 func (cook AddOutputModeCookie) Check() error {
   1708 	return cook.Cookie.Check()
   1709 }
   1710 
   1711 // Write request to wire for AddOutputMode
   1712 // addOutputModeRequest writes a AddOutputMode request to a byte slice.
   1713 func addOutputModeRequest(c *xgb.Conn, Output Output, Mode Mode) []byte {
   1714 	size := 12
   1715 	b := 0
   1716 	buf := make([]byte, size)
   1717 
   1718 	c.ExtLock.RLock()
   1719 	buf[b] = c.Extensions["RANDR"]
   1720 	c.ExtLock.RUnlock()
   1721 	b += 1
   1722 
   1723 	buf[b] = 18 // request opcode
   1724 	b += 1
   1725 
   1726 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   1727 	b += 2
   1728 
   1729 	xgb.Put32(buf[b:], uint32(Output))
   1730 	b += 4
   1731 
   1732 	xgb.Put32(buf[b:], uint32(Mode))
   1733 	b += 4
   1734 
   1735 	return buf
   1736 }
   1737 
   1738 // ChangeOutputPropertyCookie is a cookie used only for ChangeOutputProperty requests.
   1739 type ChangeOutputPropertyCookie struct {
   1740 	*xgb.Cookie
   1741 }
   1742 
   1743 // ChangeOutputProperty sends an unchecked request.
   1744 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   1745 func ChangeOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) ChangeOutputPropertyCookie {
   1746 	c.ExtLock.RLock()
   1747 	defer c.ExtLock.RUnlock()
   1748 	if _, ok := c.Extensions["RANDR"]; !ok {
   1749 		panic("Cannot issue request 'ChangeOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   1750 	}
   1751 	cookie := c.NewCookie(false, false)
   1752 	c.NewRequest(changeOutputPropertyRequest(c, Output, Property, Type, Format, Mode, NumUnits, Data), cookie)
   1753 	return ChangeOutputPropertyCookie{cookie}
   1754 }
   1755 
   1756 // ChangeOutputPropertyChecked sends a checked request.
   1757 // If an error occurs, it can be retrieved using ChangeOutputPropertyCookie.Check()
   1758 func ChangeOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) ChangeOutputPropertyCookie {
   1759 	c.ExtLock.RLock()
   1760 	defer c.ExtLock.RUnlock()
   1761 	if _, ok := c.Extensions["RANDR"]; !ok {
   1762 		panic("Cannot issue request 'ChangeOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   1763 	}
   1764 	cookie := c.NewCookie(true, false)
   1765 	c.NewRequest(changeOutputPropertyRequest(c, Output, Property, Type, Format, Mode, NumUnits, Data), cookie)
   1766 	return ChangeOutputPropertyCookie{cookie}
   1767 }
   1768 
   1769 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   1770 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   1771 func (cook ChangeOutputPropertyCookie) Check() error {
   1772 	return cook.Cookie.Check()
   1773 }
   1774 
   1775 // Write request to wire for ChangeOutputProperty
   1776 // changeOutputPropertyRequest writes a ChangeOutputProperty request to a byte slice.
   1777 func changeOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) []byte {
   1778 	size := xgb.Pad((24 + xgb.Pad((((int(NumUnits) * int(Format)) / 8) * 1))))
   1779 	b := 0
   1780 	buf := make([]byte, size)
   1781 
   1782 	c.ExtLock.RLock()
   1783 	buf[b] = c.Extensions["RANDR"]
   1784 	c.ExtLock.RUnlock()
   1785 	b += 1
   1786 
   1787 	buf[b] = 13 // request opcode
   1788 	b += 1
   1789 
   1790 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   1791 	b += 2
   1792 
   1793 	xgb.Put32(buf[b:], uint32(Output))
   1794 	b += 4
   1795 
   1796 	xgb.Put32(buf[b:], uint32(Property))
   1797 	b += 4
   1798 
   1799 	xgb.Put32(buf[b:], uint32(Type))
   1800 	b += 4
   1801 
   1802 	buf[b] = Format
   1803 	b += 1
   1804 
   1805 	buf[b] = Mode
   1806 	b += 1
   1807 
   1808 	b += 2 // padding
   1809 
   1810 	xgb.Put32(buf[b:], NumUnits)
   1811 	b += 4
   1812 
   1813 	copy(buf[b:], Data[:((int(NumUnits)*int(Format))/8)])
   1814 	b += int(((int(NumUnits) * int(Format)) / 8))
   1815 
   1816 	return buf
   1817 }
   1818 
   1819 // ChangeProviderPropertyCookie is a cookie used only for ChangeProviderProperty requests.
   1820 type ChangeProviderPropertyCookie struct {
   1821 	*xgb.Cookie
   1822 }
   1823 
   1824 // ChangeProviderProperty sends an unchecked request.
   1825 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   1826 func ChangeProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumItems uint32, Data []byte) ChangeProviderPropertyCookie {
   1827 	c.ExtLock.RLock()
   1828 	defer c.ExtLock.RUnlock()
   1829 	if _, ok := c.Extensions["RANDR"]; !ok {
   1830 		panic("Cannot issue request 'ChangeProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   1831 	}
   1832 	cookie := c.NewCookie(false, false)
   1833 	c.NewRequest(changeProviderPropertyRequest(c, Provider, Property, Type, Format, Mode, NumItems, Data), cookie)
   1834 	return ChangeProviderPropertyCookie{cookie}
   1835 }
   1836 
   1837 // ChangeProviderPropertyChecked sends a checked request.
   1838 // If an error occurs, it can be retrieved using ChangeProviderPropertyCookie.Check()
   1839 func ChangeProviderPropertyChecked(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumItems uint32, Data []byte) ChangeProviderPropertyCookie {
   1840 	c.ExtLock.RLock()
   1841 	defer c.ExtLock.RUnlock()
   1842 	if _, ok := c.Extensions["RANDR"]; !ok {
   1843 		panic("Cannot issue request 'ChangeProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   1844 	}
   1845 	cookie := c.NewCookie(true, false)
   1846 	c.NewRequest(changeProviderPropertyRequest(c, Provider, Property, Type, Format, Mode, NumItems, Data), cookie)
   1847 	return ChangeProviderPropertyCookie{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 ChangeProviderPropertyCookie) Check() error {
   1853 	return cook.Cookie.Check()
   1854 }
   1855 
   1856 // Write request to wire for ChangeProviderProperty
   1857 // changeProviderPropertyRequest writes a ChangeProviderProperty request to a byte slice.
   1858 func changeProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumItems uint32, Data []byte) []byte {
   1859 	size := xgb.Pad((24 + xgb.Pad(((int(NumItems) * (int(Format) / 8)) * 1))))
   1860 	b := 0
   1861 	buf := make([]byte, size)
   1862 
   1863 	c.ExtLock.RLock()
   1864 	buf[b] = c.Extensions["RANDR"]
   1865 	c.ExtLock.RUnlock()
   1866 	b += 1
   1867 
   1868 	buf[b] = 39 // 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:], uint32(Provider))
   1875 	b += 4
   1876 
   1877 	xgb.Put32(buf[b:], uint32(Property))
   1878 	b += 4
   1879 
   1880 	xgb.Put32(buf[b:], uint32(Type))
   1881 	b += 4
   1882 
   1883 	buf[b] = Format
   1884 	b += 1
   1885 
   1886 	buf[b] = Mode
   1887 	b += 1
   1888 
   1889 	b += 2 // padding
   1890 
   1891 	xgb.Put32(buf[b:], NumItems)
   1892 	b += 4
   1893 
   1894 	copy(buf[b:], Data[:(int(NumItems)*(int(Format)/8))])
   1895 	b += int((int(NumItems) * (int(Format) / 8)))
   1896 
   1897 	return buf
   1898 }
   1899 
   1900 // ConfigureOutputPropertyCookie is a cookie used only for ConfigureOutputProperty requests.
   1901 type ConfigureOutputPropertyCookie struct {
   1902 	*xgb.Cookie
   1903 }
   1904 
   1905 // ConfigureOutputProperty sends an unchecked request.
   1906 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   1907 func ConfigureOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureOutputPropertyCookie {
   1908 	c.ExtLock.RLock()
   1909 	defer c.ExtLock.RUnlock()
   1910 	if _, ok := c.Extensions["RANDR"]; !ok {
   1911 		panic("Cannot issue request 'ConfigureOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   1912 	}
   1913 	cookie := c.NewCookie(false, false)
   1914 	c.NewRequest(configureOutputPropertyRequest(c, Output, Property, Pending, Range, Values), cookie)
   1915 	return ConfigureOutputPropertyCookie{cookie}
   1916 }
   1917 
   1918 // ConfigureOutputPropertyChecked sends a checked request.
   1919 // If an error occurs, it can be retrieved using ConfigureOutputPropertyCookie.Check()
   1920 func ConfigureOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureOutputPropertyCookie {
   1921 	c.ExtLock.RLock()
   1922 	defer c.ExtLock.RUnlock()
   1923 	if _, ok := c.Extensions["RANDR"]; !ok {
   1924 		panic("Cannot issue request 'ConfigureOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   1925 	}
   1926 	cookie := c.NewCookie(true, false)
   1927 	c.NewRequest(configureOutputPropertyRequest(c, Output, Property, Pending, Range, Values), cookie)
   1928 	return ConfigureOutputPropertyCookie{cookie}
   1929 }
   1930 
   1931 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   1932 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   1933 func (cook ConfigureOutputPropertyCookie) Check() error {
   1934 	return cook.Cookie.Check()
   1935 }
   1936 
   1937 // Write request to wire for ConfigureOutputProperty
   1938 // configureOutputPropertyRequest writes a ConfigureOutputProperty request to a byte slice.
   1939 func configureOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) []byte {
   1940 	size := xgb.Pad((16 + xgb.Pad((len(Values) * 4))))
   1941 	b := 0
   1942 	buf := make([]byte, size)
   1943 
   1944 	c.ExtLock.RLock()
   1945 	buf[b] = c.Extensions["RANDR"]
   1946 	c.ExtLock.RUnlock()
   1947 	b += 1
   1948 
   1949 	buf[b] = 12 // request opcode
   1950 	b += 1
   1951 
   1952 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   1953 	b += 2
   1954 
   1955 	xgb.Put32(buf[b:], uint32(Output))
   1956 	b += 4
   1957 
   1958 	xgb.Put32(buf[b:], uint32(Property))
   1959 	b += 4
   1960 
   1961 	if Pending {
   1962 		buf[b] = 1
   1963 	} else {
   1964 		buf[b] = 0
   1965 	}
   1966 	b += 1
   1967 
   1968 	if Range {
   1969 		buf[b] = 1
   1970 	} else {
   1971 		buf[b] = 0
   1972 	}
   1973 	b += 1
   1974 
   1975 	b += 2 // padding
   1976 
   1977 	for i := 0; i < int(len(Values)); i++ {
   1978 		xgb.Put32(buf[b:], uint32(Values[i]))
   1979 		b += 4
   1980 	}
   1981 
   1982 	return buf
   1983 }
   1984 
   1985 // ConfigureProviderPropertyCookie is a cookie used only for ConfigureProviderProperty requests.
   1986 type ConfigureProviderPropertyCookie struct {
   1987 	*xgb.Cookie
   1988 }
   1989 
   1990 // ConfigureProviderProperty sends an unchecked request.
   1991 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   1992 func ConfigureProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureProviderPropertyCookie {
   1993 	c.ExtLock.RLock()
   1994 	defer c.ExtLock.RUnlock()
   1995 	if _, ok := c.Extensions["RANDR"]; !ok {
   1996 		panic("Cannot issue request 'ConfigureProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   1997 	}
   1998 	cookie := c.NewCookie(false, false)
   1999 	c.NewRequest(configureProviderPropertyRequest(c, Provider, Property, Pending, Range, Values), cookie)
   2000 	return ConfigureProviderPropertyCookie{cookie}
   2001 }
   2002 
   2003 // ConfigureProviderPropertyChecked sends a checked request.
   2004 // If an error occurs, it can be retrieved using ConfigureProviderPropertyCookie.Check()
   2005 func ConfigureProviderPropertyChecked(c *xgb.Conn, Provider Provider, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureProviderPropertyCookie {
   2006 	c.ExtLock.RLock()
   2007 	defer c.ExtLock.RUnlock()
   2008 	if _, ok := c.Extensions["RANDR"]; !ok {
   2009 		panic("Cannot issue request 'ConfigureProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2010 	}
   2011 	cookie := c.NewCookie(true, false)
   2012 	c.NewRequest(configureProviderPropertyRequest(c, Provider, Property, Pending, Range, Values), cookie)
   2013 	return ConfigureProviderPropertyCookie{cookie}
   2014 }
   2015 
   2016 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   2017 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   2018 func (cook ConfigureProviderPropertyCookie) Check() error {
   2019 	return cook.Cookie.Check()
   2020 }
   2021 
   2022 // Write request to wire for ConfigureProviderProperty
   2023 // configureProviderPropertyRequest writes a ConfigureProviderProperty request to a byte slice.
   2024 func configureProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property xproto.Atom, Pending bool, Range bool, Values []int32) []byte {
   2025 	size := xgb.Pad((16 + xgb.Pad((len(Values) * 4))))
   2026 	b := 0
   2027 	buf := make([]byte, size)
   2028 
   2029 	c.ExtLock.RLock()
   2030 	buf[b] = c.Extensions["RANDR"]
   2031 	c.ExtLock.RUnlock()
   2032 	b += 1
   2033 
   2034 	buf[b] = 38 // request opcode
   2035 	b += 1
   2036 
   2037 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2038 	b += 2
   2039 
   2040 	xgb.Put32(buf[b:], uint32(Provider))
   2041 	b += 4
   2042 
   2043 	xgb.Put32(buf[b:], uint32(Property))
   2044 	b += 4
   2045 
   2046 	if Pending {
   2047 		buf[b] = 1
   2048 	} else {
   2049 		buf[b] = 0
   2050 	}
   2051 	b += 1
   2052 
   2053 	if Range {
   2054 		buf[b] = 1
   2055 	} else {
   2056 		buf[b] = 0
   2057 	}
   2058 	b += 1
   2059 
   2060 	b += 2 // padding
   2061 
   2062 	for i := 0; i < int(len(Values)); i++ {
   2063 		xgb.Put32(buf[b:], uint32(Values[i]))
   2064 		b += 4
   2065 	}
   2066 
   2067 	return buf
   2068 }
   2069 
   2070 // CreateModeCookie is a cookie used only for CreateMode requests.
   2071 type CreateModeCookie struct {
   2072 	*xgb.Cookie
   2073 }
   2074 
   2075 // CreateMode sends a checked request.
   2076 // If an error occurs, it will be returned with the reply by calling CreateModeCookie.Reply()
   2077 func CreateMode(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) CreateModeCookie {
   2078 	c.ExtLock.RLock()
   2079 	defer c.ExtLock.RUnlock()
   2080 	if _, ok := c.Extensions["RANDR"]; !ok {
   2081 		panic("Cannot issue request 'CreateMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2082 	}
   2083 	cookie := c.NewCookie(true, true)
   2084 	c.NewRequest(createModeRequest(c, Window, ModeInfo, Name), cookie)
   2085 	return CreateModeCookie{cookie}
   2086 }
   2087 
   2088 // CreateModeUnchecked sends an unchecked request.
   2089 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2090 func CreateModeUnchecked(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) CreateModeCookie {
   2091 	c.ExtLock.RLock()
   2092 	defer c.ExtLock.RUnlock()
   2093 	if _, ok := c.Extensions["RANDR"]; !ok {
   2094 		panic("Cannot issue request 'CreateMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2095 	}
   2096 	cookie := c.NewCookie(false, true)
   2097 	c.NewRequest(createModeRequest(c, Window, ModeInfo, Name), cookie)
   2098 	return CreateModeCookie{cookie}
   2099 }
   2100 
   2101 // CreateModeReply represents the data returned from a CreateMode request.
   2102 type CreateModeReply struct {
   2103 	Sequence uint16 // sequence number of the request for this reply
   2104 	Length   uint32 // number of bytes in this reply
   2105 	// padding: 1 bytes
   2106 	Mode Mode
   2107 	// padding: 20 bytes
   2108 }
   2109 
   2110 // Reply blocks and returns the reply data for a CreateMode request.
   2111 func (cook CreateModeCookie) Reply() (*CreateModeReply, error) {
   2112 	buf, err := cook.Cookie.Reply()
   2113 	if err != nil {
   2114 		return nil, err
   2115 	}
   2116 	if buf == nil {
   2117 		return nil, nil
   2118 	}
   2119 	return createModeReply(buf), nil
   2120 }
   2121 
   2122 // createModeReply reads a byte slice into a CreateModeReply value.
   2123 func createModeReply(buf []byte) *CreateModeReply {
   2124 	v := new(CreateModeReply)
   2125 	b := 1 // skip reply determinant
   2126 
   2127 	b += 1 // padding
   2128 
   2129 	v.Sequence = xgb.Get16(buf[b:])
   2130 	b += 2
   2131 
   2132 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   2133 	b += 4
   2134 
   2135 	v.Mode = Mode(xgb.Get32(buf[b:]))
   2136 	b += 4
   2137 
   2138 	b += 20 // padding
   2139 
   2140 	return v
   2141 }
   2142 
   2143 // Write request to wire for CreateMode
   2144 // createModeRequest writes a CreateMode request to a byte slice.
   2145 func createModeRequest(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) []byte {
   2146 	size := xgb.Pad((40 + xgb.Pad((len(Name) * 1))))
   2147 	b := 0
   2148 	buf := make([]byte, size)
   2149 
   2150 	c.ExtLock.RLock()
   2151 	buf[b] = c.Extensions["RANDR"]
   2152 	c.ExtLock.RUnlock()
   2153 	b += 1
   2154 
   2155 	buf[b] = 16 // request opcode
   2156 	b += 1
   2157 
   2158 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2159 	b += 2
   2160 
   2161 	xgb.Put32(buf[b:], uint32(Window))
   2162 	b += 4
   2163 
   2164 	{
   2165 		structBytes := ModeInfo.Bytes()
   2166 		copy(buf[b:], structBytes)
   2167 		b += len(structBytes)
   2168 	}
   2169 
   2170 	copy(buf[b:], Name[:len(Name)])
   2171 	b += int(len(Name))
   2172 
   2173 	return buf
   2174 }
   2175 
   2176 // DeleteOutputModeCookie is a cookie used only for DeleteOutputMode requests.
   2177 type DeleteOutputModeCookie struct {
   2178 	*xgb.Cookie
   2179 }
   2180 
   2181 // DeleteOutputMode sends an unchecked request.
   2182 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2183 func DeleteOutputMode(c *xgb.Conn, Output Output, Mode Mode) DeleteOutputModeCookie {
   2184 	c.ExtLock.RLock()
   2185 	defer c.ExtLock.RUnlock()
   2186 	if _, ok := c.Extensions["RANDR"]; !ok {
   2187 		panic("Cannot issue request 'DeleteOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2188 	}
   2189 	cookie := c.NewCookie(false, false)
   2190 	c.NewRequest(deleteOutputModeRequest(c, Output, Mode), cookie)
   2191 	return DeleteOutputModeCookie{cookie}
   2192 }
   2193 
   2194 // DeleteOutputModeChecked sends a checked request.
   2195 // If an error occurs, it can be retrieved using DeleteOutputModeCookie.Check()
   2196 func DeleteOutputModeChecked(c *xgb.Conn, Output Output, Mode Mode) DeleteOutputModeCookie {
   2197 	c.ExtLock.RLock()
   2198 	defer c.ExtLock.RUnlock()
   2199 	if _, ok := c.Extensions["RANDR"]; !ok {
   2200 		panic("Cannot issue request 'DeleteOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2201 	}
   2202 	cookie := c.NewCookie(true, false)
   2203 	c.NewRequest(deleteOutputModeRequest(c, Output, Mode), cookie)
   2204 	return DeleteOutputModeCookie{cookie}
   2205 }
   2206 
   2207 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   2208 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   2209 func (cook DeleteOutputModeCookie) Check() error {
   2210 	return cook.Cookie.Check()
   2211 }
   2212 
   2213 // Write request to wire for DeleteOutputMode
   2214 // deleteOutputModeRequest writes a DeleteOutputMode request to a byte slice.
   2215 func deleteOutputModeRequest(c *xgb.Conn, Output Output, Mode Mode) []byte {
   2216 	size := 12
   2217 	b := 0
   2218 	buf := make([]byte, size)
   2219 
   2220 	c.ExtLock.RLock()
   2221 	buf[b] = c.Extensions["RANDR"]
   2222 	c.ExtLock.RUnlock()
   2223 	b += 1
   2224 
   2225 	buf[b] = 19 // request opcode
   2226 	b += 1
   2227 
   2228 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2229 	b += 2
   2230 
   2231 	xgb.Put32(buf[b:], uint32(Output))
   2232 	b += 4
   2233 
   2234 	xgb.Put32(buf[b:], uint32(Mode))
   2235 	b += 4
   2236 
   2237 	return buf
   2238 }
   2239 
   2240 // DeleteOutputPropertyCookie is a cookie used only for DeleteOutputProperty requests.
   2241 type DeleteOutputPropertyCookie struct {
   2242 	*xgb.Cookie
   2243 }
   2244 
   2245 // DeleteOutputProperty sends an unchecked request.
   2246 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2247 func DeleteOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) DeleteOutputPropertyCookie {
   2248 	c.ExtLock.RLock()
   2249 	defer c.ExtLock.RUnlock()
   2250 	if _, ok := c.Extensions["RANDR"]; !ok {
   2251 		panic("Cannot issue request 'DeleteOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2252 	}
   2253 	cookie := c.NewCookie(false, false)
   2254 	c.NewRequest(deleteOutputPropertyRequest(c, Output, Property), cookie)
   2255 	return DeleteOutputPropertyCookie{cookie}
   2256 }
   2257 
   2258 // DeleteOutputPropertyChecked sends a checked request.
   2259 // If an error occurs, it can be retrieved using DeleteOutputPropertyCookie.Check()
   2260 func DeleteOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom) DeleteOutputPropertyCookie {
   2261 	c.ExtLock.RLock()
   2262 	defer c.ExtLock.RUnlock()
   2263 	if _, ok := c.Extensions["RANDR"]; !ok {
   2264 		panic("Cannot issue request 'DeleteOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2265 	}
   2266 	cookie := c.NewCookie(true, false)
   2267 	c.NewRequest(deleteOutputPropertyRequest(c, Output, Property), cookie)
   2268 	return DeleteOutputPropertyCookie{cookie}
   2269 }
   2270 
   2271 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   2272 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   2273 func (cook DeleteOutputPropertyCookie) Check() error {
   2274 	return cook.Cookie.Check()
   2275 }
   2276 
   2277 // Write request to wire for DeleteOutputProperty
   2278 // deleteOutputPropertyRequest writes a DeleteOutputProperty request to a byte slice.
   2279 func deleteOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom) []byte {
   2280 	size := 12
   2281 	b := 0
   2282 	buf := make([]byte, size)
   2283 
   2284 	c.ExtLock.RLock()
   2285 	buf[b] = c.Extensions["RANDR"]
   2286 	c.ExtLock.RUnlock()
   2287 	b += 1
   2288 
   2289 	buf[b] = 14 // request opcode
   2290 	b += 1
   2291 
   2292 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2293 	b += 2
   2294 
   2295 	xgb.Put32(buf[b:], uint32(Output))
   2296 	b += 4
   2297 
   2298 	xgb.Put32(buf[b:], uint32(Property))
   2299 	b += 4
   2300 
   2301 	return buf
   2302 }
   2303 
   2304 // DeleteProviderPropertyCookie is a cookie used only for DeleteProviderProperty requests.
   2305 type DeleteProviderPropertyCookie struct {
   2306 	*xgb.Cookie
   2307 }
   2308 
   2309 // DeleteProviderProperty sends an unchecked request.
   2310 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2311 func DeleteProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom) DeleteProviderPropertyCookie {
   2312 	c.ExtLock.RLock()
   2313 	defer c.ExtLock.RUnlock()
   2314 	if _, ok := c.Extensions["RANDR"]; !ok {
   2315 		panic("Cannot issue request 'DeleteProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2316 	}
   2317 	cookie := c.NewCookie(false, false)
   2318 	c.NewRequest(deleteProviderPropertyRequest(c, Provider, Property), cookie)
   2319 	return DeleteProviderPropertyCookie{cookie}
   2320 }
   2321 
   2322 // DeleteProviderPropertyChecked sends a checked request.
   2323 // If an error occurs, it can be retrieved using DeleteProviderPropertyCookie.Check()
   2324 func DeleteProviderPropertyChecked(c *xgb.Conn, Provider Provider, Property xproto.Atom) DeleteProviderPropertyCookie {
   2325 	c.ExtLock.RLock()
   2326 	defer c.ExtLock.RUnlock()
   2327 	if _, ok := c.Extensions["RANDR"]; !ok {
   2328 		panic("Cannot issue request 'DeleteProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2329 	}
   2330 	cookie := c.NewCookie(true, false)
   2331 	c.NewRequest(deleteProviderPropertyRequest(c, Provider, Property), cookie)
   2332 	return DeleteProviderPropertyCookie{cookie}
   2333 }
   2334 
   2335 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   2336 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   2337 func (cook DeleteProviderPropertyCookie) Check() error {
   2338 	return cook.Cookie.Check()
   2339 }
   2340 
   2341 // Write request to wire for DeleteProviderProperty
   2342 // deleteProviderPropertyRequest writes a DeleteProviderProperty request to a byte slice.
   2343 func deleteProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property xproto.Atom) []byte {
   2344 	size := 12
   2345 	b := 0
   2346 	buf := make([]byte, size)
   2347 
   2348 	c.ExtLock.RLock()
   2349 	buf[b] = c.Extensions["RANDR"]
   2350 	c.ExtLock.RUnlock()
   2351 	b += 1
   2352 
   2353 	buf[b] = 40 // request opcode
   2354 	b += 1
   2355 
   2356 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2357 	b += 2
   2358 
   2359 	xgb.Put32(buf[b:], uint32(Provider))
   2360 	b += 4
   2361 
   2362 	xgb.Put32(buf[b:], uint32(Property))
   2363 	b += 4
   2364 
   2365 	return buf
   2366 }
   2367 
   2368 // DestroyModeCookie is a cookie used only for DestroyMode requests.
   2369 type DestroyModeCookie struct {
   2370 	*xgb.Cookie
   2371 }
   2372 
   2373 // DestroyMode sends an unchecked request.
   2374 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2375 func DestroyMode(c *xgb.Conn, Mode Mode) DestroyModeCookie {
   2376 	c.ExtLock.RLock()
   2377 	defer c.ExtLock.RUnlock()
   2378 	if _, ok := c.Extensions["RANDR"]; !ok {
   2379 		panic("Cannot issue request 'DestroyMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2380 	}
   2381 	cookie := c.NewCookie(false, false)
   2382 	c.NewRequest(destroyModeRequest(c, Mode), cookie)
   2383 	return DestroyModeCookie{cookie}
   2384 }
   2385 
   2386 // DestroyModeChecked sends a checked request.
   2387 // If an error occurs, it can be retrieved using DestroyModeCookie.Check()
   2388 func DestroyModeChecked(c *xgb.Conn, Mode Mode) DestroyModeCookie {
   2389 	c.ExtLock.RLock()
   2390 	defer c.ExtLock.RUnlock()
   2391 	if _, ok := c.Extensions["RANDR"]; !ok {
   2392 		panic("Cannot issue request 'DestroyMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2393 	}
   2394 	cookie := c.NewCookie(true, false)
   2395 	c.NewRequest(destroyModeRequest(c, Mode), cookie)
   2396 	return DestroyModeCookie{cookie}
   2397 }
   2398 
   2399 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   2400 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   2401 func (cook DestroyModeCookie) Check() error {
   2402 	return cook.Cookie.Check()
   2403 }
   2404 
   2405 // Write request to wire for DestroyMode
   2406 // destroyModeRequest writes a DestroyMode request to a byte slice.
   2407 func destroyModeRequest(c *xgb.Conn, Mode Mode) []byte {
   2408 	size := 8
   2409 	b := 0
   2410 	buf := make([]byte, size)
   2411 
   2412 	c.ExtLock.RLock()
   2413 	buf[b] = c.Extensions["RANDR"]
   2414 	c.ExtLock.RUnlock()
   2415 	b += 1
   2416 
   2417 	buf[b] = 17 // request opcode
   2418 	b += 1
   2419 
   2420 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2421 	b += 2
   2422 
   2423 	xgb.Put32(buf[b:], uint32(Mode))
   2424 	b += 4
   2425 
   2426 	return buf
   2427 }
   2428 
   2429 // GetCrtcGammaCookie is a cookie used only for GetCrtcGamma requests.
   2430 type GetCrtcGammaCookie struct {
   2431 	*xgb.Cookie
   2432 }
   2433 
   2434 // GetCrtcGamma sends a checked request.
   2435 // If an error occurs, it will be returned with the reply by calling GetCrtcGammaCookie.Reply()
   2436 func GetCrtcGamma(c *xgb.Conn, Crtc Crtc) GetCrtcGammaCookie {
   2437 	c.ExtLock.RLock()
   2438 	defer c.ExtLock.RUnlock()
   2439 	if _, ok := c.Extensions["RANDR"]; !ok {
   2440 		panic("Cannot issue request 'GetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2441 	}
   2442 	cookie := c.NewCookie(true, true)
   2443 	c.NewRequest(getCrtcGammaRequest(c, Crtc), cookie)
   2444 	return GetCrtcGammaCookie{cookie}
   2445 }
   2446 
   2447 // GetCrtcGammaUnchecked sends an unchecked request.
   2448 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2449 func GetCrtcGammaUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcGammaCookie {
   2450 	c.ExtLock.RLock()
   2451 	defer c.ExtLock.RUnlock()
   2452 	if _, ok := c.Extensions["RANDR"]; !ok {
   2453 		panic("Cannot issue request 'GetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2454 	}
   2455 	cookie := c.NewCookie(false, true)
   2456 	c.NewRequest(getCrtcGammaRequest(c, Crtc), cookie)
   2457 	return GetCrtcGammaCookie{cookie}
   2458 }
   2459 
   2460 // GetCrtcGammaReply represents the data returned from a GetCrtcGamma request.
   2461 type GetCrtcGammaReply struct {
   2462 	Sequence uint16 // sequence number of the request for this reply
   2463 	Length   uint32 // number of bytes in this reply
   2464 	// padding: 1 bytes
   2465 	Size uint16
   2466 	// padding: 22 bytes
   2467 	Red []uint16 // size: xgb.Pad((int(Size) * 2))
   2468 	// alignment gap to multiple of 2
   2469 	Green []uint16 // size: xgb.Pad((int(Size) * 2))
   2470 	// alignment gap to multiple of 2
   2471 	Blue []uint16 // size: xgb.Pad((int(Size) * 2))
   2472 }
   2473 
   2474 // Reply blocks and returns the reply data for a GetCrtcGamma request.
   2475 func (cook GetCrtcGammaCookie) Reply() (*GetCrtcGammaReply, error) {
   2476 	buf, err := cook.Cookie.Reply()
   2477 	if err != nil {
   2478 		return nil, err
   2479 	}
   2480 	if buf == nil {
   2481 		return nil, nil
   2482 	}
   2483 	return getCrtcGammaReply(buf), nil
   2484 }
   2485 
   2486 // getCrtcGammaReply reads a byte slice into a GetCrtcGammaReply value.
   2487 func getCrtcGammaReply(buf []byte) *GetCrtcGammaReply {
   2488 	v := new(GetCrtcGammaReply)
   2489 	b := 1 // skip reply determinant
   2490 
   2491 	b += 1 // padding
   2492 
   2493 	v.Sequence = xgb.Get16(buf[b:])
   2494 	b += 2
   2495 
   2496 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   2497 	b += 4
   2498 
   2499 	v.Size = xgb.Get16(buf[b:])
   2500 	b += 2
   2501 
   2502 	b += 22 // padding
   2503 
   2504 	v.Red = make([]uint16, v.Size)
   2505 	for i := 0; i < int(v.Size); i++ {
   2506 		v.Red[i] = xgb.Get16(buf[b:])
   2507 		b += 2
   2508 	}
   2509 
   2510 	b = (b + 1) & ^1 // alignment gap
   2511 
   2512 	v.Green = make([]uint16, v.Size)
   2513 	for i := 0; i < int(v.Size); i++ {
   2514 		v.Green[i] = xgb.Get16(buf[b:])
   2515 		b += 2
   2516 	}
   2517 
   2518 	b = (b + 1) & ^1 // alignment gap
   2519 
   2520 	v.Blue = make([]uint16, v.Size)
   2521 	for i := 0; i < int(v.Size); i++ {
   2522 		v.Blue[i] = xgb.Get16(buf[b:])
   2523 		b += 2
   2524 	}
   2525 
   2526 	return v
   2527 }
   2528 
   2529 // Write request to wire for GetCrtcGamma
   2530 // getCrtcGammaRequest writes a GetCrtcGamma request to a byte slice.
   2531 func getCrtcGammaRequest(c *xgb.Conn, Crtc Crtc) []byte {
   2532 	size := 8
   2533 	b := 0
   2534 	buf := make([]byte, size)
   2535 
   2536 	c.ExtLock.RLock()
   2537 	buf[b] = c.Extensions["RANDR"]
   2538 	c.ExtLock.RUnlock()
   2539 	b += 1
   2540 
   2541 	buf[b] = 23 // request opcode
   2542 	b += 1
   2543 
   2544 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2545 	b += 2
   2546 
   2547 	xgb.Put32(buf[b:], uint32(Crtc))
   2548 	b += 4
   2549 
   2550 	return buf
   2551 }
   2552 
   2553 // GetCrtcGammaSizeCookie is a cookie used only for GetCrtcGammaSize requests.
   2554 type GetCrtcGammaSizeCookie struct {
   2555 	*xgb.Cookie
   2556 }
   2557 
   2558 // GetCrtcGammaSize sends a checked request.
   2559 // If an error occurs, it will be returned with the reply by calling GetCrtcGammaSizeCookie.Reply()
   2560 func GetCrtcGammaSize(c *xgb.Conn, Crtc Crtc) GetCrtcGammaSizeCookie {
   2561 	c.ExtLock.RLock()
   2562 	defer c.ExtLock.RUnlock()
   2563 	if _, ok := c.Extensions["RANDR"]; !ok {
   2564 		panic("Cannot issue request 'GetCrtcGammaSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2565 	}
   2566 	cookie := c.NewCookie(true, true)
   2567 	c.NewRequest(getCrtcGammaSizeRequest(c, Crtc), cookie)
   2568 	return GetCrtcGammaSizeCookie{cookie}
   2569 }
   2570 
   2571 // GetCrtcGammaSizeUnchecked sends an unchecked request.
   2572 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2573 func GetCrtcGammaSizeUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcGammaSizeCookie {
   2574 	c.ExtLock.RLock()
   2575 	defer c.ExtLock.RUnlock()
   2576 	if _, ok := c.Extensions["RANDR"]; !ok {
   2577 		panic("Cannot issue request 'GetCrtcGammaSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2578 	}
   2579 	cookie := c.NewCookie(false, true)
   2580 	c.NewRequest(getCrtcGammaSizeRequest(c, Crtc), cookie)
   2581 	return GetCrtcGammaSizeCookie{cookie}
   2582 }
   2583 
   2584 // GetCrtcGammaSizeReply represents the data returned from a GetCrtcGammaSize request.
   2585 type GetCrtcGammaSizeReply struct {
   2586 	Sequence uint16 // sequence number of the request for this reply
   2587 	Length   uint32 // number of bytes in this reply
   2588 	// padding: 1 bytes
   2589 	Size uint16
   2590 	// padding: 22 bytes
   2591 }
   2592 
   2593 // Reply blocks and returns the reply data for a GetCrtcGammaSize request.
   2594 func (cook GetCrtcGammaSizeCookie) Reply() (*GetCrtcGammaSizeReply, error) {
   2595 	buf, err := cook.Cookie.Reply()
   2596 	if err != nil {
   2597 		return nil, err
   2598 	}
   2599 	if buf == nil {
   2600 		return nil, nil
   2601 	}
   2602 	return getCrtcGammaSizeReply(buf), nil
   2603 }
   2604 
   2605 // getCrtcGammaSizeReply reads a byte slice into a GetCrtcGammaSizeReply value.
   2606 func getCrtcGammaSizeReply(buf []byte) *GetCrtcGammaSizeReply {
   2607 	v := new(GetCrtcGammaSizeReply)
   2608 	b := 1 // skip reply determinant
   2609 
   2610 	b += 1 // padding
   2611 
   2612 	v.Sequence = xgb.Get16(buf[b:])
   2613 	b += 2
   2614 
   2615 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   2616 	b += 4
   2617 
   2618 	v.Size = xgb.Get16(buf[b:])
   2619 	b += 2
   2620 
   2621 	b += 22 // padding
   2622 
   2623 	return v
   2624 }
   2625 
   2626 // Write request to wire for GetCrtcGammaSize
   2627 // getCrtcGammaSizeRequest writes a GetCrtcGammaSize request to a byte slice.
   2628 func getCrtcGammaSizeRequest(c *xgb.Conn, Crtc Crtc) []byte {
   2629 	size := 8
   2630 	b := 0
   2631 	buf := make([]byte, size)
   2632 
   2633 	c.ExtLock.RLock()
   2634 	buf[b] = c.Extensions["RANDR"]
   2635 	c.ExtLock.RUnlock()
   2636 	b += 1
   2637 
   2638 	buf[b] = 22 // request opcode
   2639 	b += 1
   2640 
   2641 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2642 	b += 2
   2643 
   2644 	xgb.Put32(buf[b:], uint32(Crtc))
   2645 	b += 4
   2646 
   2647 	return buf
   2648 }
   2649 
   2650 // GetCrtcInfoCookie is a cookie used only for GetCrtcInfo requests.
   2651 type GetCrtcInfoCookie struct {
   2652 	*xgb.Cookie
   2653 }
   2654 
   2655 // GetCrtcInfo sends a checked request.
   2656 // If an error occurs, it will be returned with the reply by calling GetCrtcInfoCookie.Reply()
   2657 func GetCrtcInfo(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) GetCrtcInfoCookie {
   2658 	c.ExtLock.RLock()
   2659 	defer c.ExtLock.RUnlock()
   2660 	if _, ok := c.Extensions["RANDR"]; !ok {
   2661 		panic("Cannot issue request 'GetCrtcInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2662 	}
   2663 	cookie := c.NewCookie(true, true)
   2664 	c.NewRequest(getCrtcInfoRequest(c, Crtc, ConfigTimestamp), cookie)
   2665 	return GetCrtcInfoCookie{cookie}
   2666 }
   2667 
   2668 // GetCrtcInfoUnchecked sends an unchecked request.
   2669 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2670 func GetCrtcInfoUnchecked(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) GetCrtcInfoCookie {
   2671 	c.ExtLock.RLock()
   2672 	defer c.ExtLock.RUnlock()
   2673 	if _, ok := c.Extensions["RANDR"]; !ok {
   2674 		panic("Cannot issue request 'GetCrtcInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2675 	}
   2676 	cookie := c.NewCookie(false, true)
   2677 	c.NewRequest(getCrtcInfoRequest(c, Crtc, ConfigTimestamp), cookie)
   2678 	return GetCrtcInfoCookie{cookie}
   2679 }
   2680 
   2681 // GetCrtcInfoReply represents the data returned from a GetCrtcInfo request.
   2682 type GetCrtcInfoReply struct {
   2683 	Sequence           uint16 // sequence number of the request for this reply
   2684 	Length             uint32 // number of bytes in this reply
   2685 	Status             byte
   2686 	Timestamp          xproto.Timestamp
   2687 	X                  int16
   2688 	Y                  int16
   2689 	Width              uint16
   2690 	Height             uint16
   2691 	Mode               Mode
   2692 	Rotation           uint16
   2693 	Rotations          uint16
   2694 	NumOutputs         uint16
   2695 	NumPossibleOutputs uint16
   2696 	Outputs            []Output // size: xgb.Pad((int(NumOutputs) * 4))
   2697 	// alignment gap to multiple of 4
   2698 	Possible []Output // size: xgb.Pad((int(NumPossibleOutputs) * 4))
   2699 }
   2700 
   2701 // Reply blocks and returns the reply data for a GetCrtcInfo request.
   2702 func (cook GetCrtcInfoCookie) Reply() (*GetCrtcInfoReply, error) {
   2703 	buf, err := cook.Cookie.Reply()
   2704 	if err != nil {
   2705 		return nil, err
   2706 	}
   2707 	if buf == nil {
   2708 		return nil, nil
   2709 	}
   2710 	return getCrtcInfoReply(buf), nil
   2711 }
   2712 
   2713 // getCrtcInfoReply reads a byte slice into a GetCrtcInfoReply value.
   2714 func getCrtcInfoReply(buf []byte) *GetCrtcInfoReply {
   2715 	v := new(GetCrtcInfoReply)
   2716 	b := 1 // skip reply determinant
   2717 
   2718 	v.Status = buf[b]
   2719 	b += 1
   2720 
   2721 	v.Sequence = xgb.Get16(buf[b:])
   2722 	b += 2
   2723 
   2724 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   2725 	b += 4
   2726 
   2727 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   2728 	b += 4
   2729 
   2730 	v.X = int16(xgb.Get16(buf[b:]))
   2731 	b += 2
   2732 
   2733 	v.Y = int16(xgb.Get16(buf[b:]))
   2734 	b += 2
   2735 
   2736 	v.Width = xgb.Get16(buf[b:])
   2737 	b += 2
   2738 
   2739 	v.Height = xgb.Get16(buf[b:])
   2740 	b += 2
   2741 
   2742 	v.Mode = Mode(xgb.Get32(buf[b:]))
   2743 	b += 4
   2744 
   2745 	v.Rotation = xgb.Get16(buf[b:])
   2746 	b += 2
   2747 
   2748 	v.Rotations = xgb.Get16(buf[b:])
   2749 	b += 2
   2750 
   2751 	v.NumOutputs = xgb.Get16(buf[b:])
   2752 	b += 2
   2753 
   2754 	v.NumPossibleOutputs = xgb.Get16(buf[b:])
   2755 	b += 2
   2756 
   2757 	v.Outputs = make([]Output, v.NumOutputs)
   2758 	for i := 0; i < int(v.NumOutputs); i++ {
   2759 		v.Outputs[i] = Output(xgb.Get32(buf[b:]))
   2760 		b += 4
   2761 	}
   2762 
   2763 	b = (b + 3) & ^3 // alignment gap
   2764 
   2765 	v.Possible = make([]Output, v.NumPossibleOutputs)
   2766 	for i := 0; i < int(v.NumPossibleOutputs); i++ {
   2767 		v.Possible[i] = Output(xgb.Get32(buf[b:]))
   2768 		b += 4
   2769 	}
   2770 
   2771 	return v
   2772 }
   2773 
   2774 // Write request to wire for GetCrtcInfo
   2775 // getCrtcInfoRequest writes a GetCrtcInfo request to a byte slice.
   2776 func getCrtcInfoRequest(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) []byte {
   2777 	size := 12
   2778 	b := 0
   2779 	buf := make([]byte, size)
   2780 
   2781 	c.ExtLock.RLock()
   2782 	buf[b] = c.Extensions["RANDR"]
   2783 	c.ExtLock.RUnlock()
   2784 	b += 1
   2785 
   2786 	buf[b] = 20 // request opcode
   2787 	b += 1
   2788 
   2789 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2790 	b += 2
   2791 
   2792 	xgb.Put32(buf[b:], uint32(Crtc))
   2793 	b += 4
   2794 
   2795 	xgb.Put32(buf[b:], uint32(ConfigTimestamp))
   2796 	b += 4
   2797 
   2798 	return buf
   2799 }
   2800 
   2801 // GetCrtcTransformCookie is a cookie used only for GetCrtcTransform requests.
   2802 type GetCrtcTransformCookie struct {
   2803 	*xgb.Cookie
   2804 }
   2805 
   2806 // GetCrtcTransform sends a checked request.
   2807 // If an error occurs, it will be returned with the reply by calling GetCrtcTransformCookie.Reply()
   2808 func GetCrtcTransform(c *xgb.Conn, Crtc Crtc) GetCrtcTransformCookie {
   2809 	c.ExtLock.RLock()
   2810 	defer c.ExtLock.RUnlock()
   2811 	if _, ok := c.Extensions["RANDR"]; !ok {
   2812 		panic("Cannot issue request 'GetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2813 	}
   2814 	cookie := c.NewCookie(true, true)
   2815 	c.NewRequest(getCrtcTransformRequest(c, Crtc), cookie)
   2816 	return GetCrtcTransformCookie{cookie}
   2817 }
   2818 
   2819 // GetCrtcTransformUnchecked sends an unchecked request.
   2820 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2821 func GetCrtcTransformUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcTransformCookie {
   2822 	c.ExtLock.RLock()
   2823 	defer c.ExtLock.RUnlock()
   2824 	if _, ok := c.Extensions["RANDR"]; !ok {
   2825 		panic("Cannot issue request 'GetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2826 	}
   2827 	cookie := c.NewCookie(false, true)
   2828 	c.NewRequest(getCrtcTransformRequest(c, Crtc), cookie)
   2829 	return GetCrtcTransformCookie{cookie}
   2830 }
   2831 
   2832 // GetCrtcTransformReply represents the data returned from a GetCrtcTransform request.
   2833 type GetCrtcTransformReply struct {
   2834 	Sequence uint16 // sequence number of the request for this reply
   2835 	Length   uint32 // number of bytes in this reply
   2836 	// padding: 1 bytes
   2837 	PendingTransform render.Transform
   2838 	HasTransforms    bool
   2839 	// padding: 3 bytes
   2840 	CurrentTransform render.Transform
   2841 	// padding: 4 bytes
   2842 	PendingLen        uint16
   2843 	PendingNparams    uint16
   2844 	CurrentLen        uint16
   2845 	CurrentNparams    uint16
   2846 	PendingFilterName string // size: xgb.Pad((int(PendingLen) * 1))
   2847 	// alignment gap to multiple of 4
   2848 	PendingParams     []render.Fixed // size: xgb.Pad((int(PendingNparams) * 4))
   2849 	CurrentFilterName string         // size: xgb.Pad((int(CurrentLen) * 1))
   2850 	// alignment gap to multiple of 4
   2851 	CurrentParams []render.Fixed // size: xgb.Pad((int(CurrentNparams) * 4))
   2852 }
   2853 
   2854 // Reply blocks and returns the reply data for a GetCrtcTransform request.
   2855 func (cook GetCrtcTransformCookie) Reply() (*GetCrtcTransformReply, error) {
   2856 	buf, err := cook.Cookie.Reply()
   2857 	if err != nil {
   2858 		return nil, err
   2859 	}
   2860 	if buf == nil {
   2861 		return nil, nil
   2862 	}
   2863 	return getCrtcTransformReply(buf), nil
   2864 }
   2865 
   2866 // getCrtcTransformReply reads a byte slice into a GetCrtcTransformReply value.
   2867 func getCrtcTransformReply(buf []byte) *GetCrtcTransformReply {
   2868 	v := new(GetCrtcTransformReply)
   2869 	b := 1 // skip reply determinant
   2870 
   2871 	b += 1 // padding
   2872 
   2873 	v.Sequence = xgb.Get16(buf[b:])
   2874 	b += 2
   2875 
   2876 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   2877 	b += 4
   2878 
   2879 	v.PendingTransform = render.Transform{}
   2880 	b += render.TransformRead(buf[b:], &v.PendingTransform)
   2881 
   2882 	if buf[b] == 1 {
   2883 		v.HasTransforms = true
   2884 	} else {
   2885 		v.HasTransforms = false
   2886 	}
   2887 	b += 1
   2888 
   2889 	b += 3 // padding
   2890 
   2891 	v.CurrentTransform = render.Transform{}
   2892 	b += render.TransformRead(buf[b:], &v.CurrentTransform)
   2893 
   2894 	b += 4 // padding
   2895 
   2896 	v.PendingLen = xgb.Get16(buf[b:])
   2897 	b += 2
   2898 
   2899 	v.PendingNparams = xgb.Get16(buf[b:])
   2900 	b += 2
   2901 
   2902 	v.CurrentLen = xgb.Get16(buf[b:])
   2903 	b += 2
   2904 
   2905 	v.CurrentNparams = xgb.Get16(buf[b:])
   2906 	b += 2
   2907 
   2908 	{
   2909 		byteString := make([]byte, v.PendingLen)
   2910 		copy(byteString[:v.PendingLen], buf[b:])
   2911 		v.PendingFilterName = string(byteString)
   2912 		b += int(v.PendingLen)
   2913 	}
   2914 
   2915 	b = (b + 3) & ^3 // alignment gap
   2916 
   2917 	v.PendingParams = make([]render.Fixed, v.PendingNparams)
   2918 	for i := 0; i < int(v.PendingNparams); i++ {
   2919 		v.PendingParams[i] = render.Fixed(xgb.Get32(buf[b:]))
   2920 		b += 4
   2921 	}
   2922 
   2923 	{
   2924 		byteString := make([]byte, v.CurrentLen)
   2925 		copy(byteString[:v.CurrentLen], buf[b:])
   2926 		v.CurrentFilterName = string(byteString)
   2927 		b += int(v.CurrentLen)
   2928 	}
   2929 
   2930 	b = (b + 3) & ^3 // alignment gap
   2931 
   2932 	v.CurrentParams = make([]render.Fixed, v.CurrentNparams)
   2933 	for i := 0; i < int(v.CurrentNparams); i++ {
   2934 		v.CurrentParams[i] = render.Fixed(xgb.Get32(buf[b:]))
   2935 		b += 4
   2936 	}
   2937 
   2938 	return v
   2939 }
   2940 
   2941 // Write request to wire for GetCrtcTransform
   2942 // getCrtcTransformRequest writes a GetCrtcTransform request to a byte slice.
   2943 func getCrtcTransformRequest(c *xgb.Conn, Crtc Crtc) []byte {
   2944 	size := 8
   2945 	b := 0
   2946 	buf := make([]byte, size)
   2947 
   2948 	c.ExtLock.RLock()
   2949 	buf[b] = c.Extensions["RANDR"]
   2950 	c.ExtLock.RUnlock()
   2951 	b += 1
   2952 
   2953 	buf[b] = 27 // request opcode
   2954 	b += 1
   2955 
   2956 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   2957 	b += 2
   2958 
   2959 	xgb.Put32(buf[b:], uint32(Crtc))
   2960 	b += 4
   2961 
   2962 	return buf
   2963 }
   2964 
   2965 // GetOutputInfoCookie is a cookie used only for GetOutputInfo requests.
   2966 type GetOutputInfoCookie struct {
   2967 	*xgb.Cookie
   2968 }
   2969 
   2970 // GetOutputInfo sends a checked request.
   2971 // If an error occurs, it will be returned with the reply by calling GetOutputInfoCookie.Reply()
   2972 func GetOutputInfo(c *xgb.Conn, Output Output, ConfigTimestamp xproto.Timestamp) GetOutputInfoCookie {
   2973 	c.ExtLock.RLock()
   2974 	defer c.ExtLock.RUnlock()
   2975 	if _, ok := c.Extensions["RANDR"]; !ok {
   2976 		panic("Cannot issue request 'GetOutputInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2977 	}
   2978 	cookie := c.NewCookie(true, true)
   2979 	c.NewRequest(getOutputInfoRequest(c, Output, ConfigTimestamp), cookie)
   2980 	return GetOutputInfoCookie{cookie}
   2981 }
   2982 
   2983 // GetOutputInfoUnchecked sends an unchecked request.
   2984 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   2985 func GetOutputInfoUnchecked(c *xgb.Conn, Output Output, ConfigTimestamp xproto.Timestamp) GetOutputInfoCookie {
   2986 	c.ExtLock.RLock()
   2987 	defer c.ExtLock.RUnlock()
   2988 	if _, ok := c.Extensions["RANDR"]; !ok {
   2989 		panic("Cannot issue request 'GetOutputInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   2990 	}
   2991 	cookie := c.NewCookie(false, true)
   2992 	c.NewRequest(getOutputInfoRequest(c, Output, ConfigTimestamp), cookie)
   2993 	return GetOutputInfoCookie{cookie}
   2994 }
   2995 
   2996 // GetOutputInfoReply represents the data returned from a GetOutputInfo request.
   2997 type GetOutputInfoReply struct {
   2998 	Sequence      uint16 // sequence number of the request for this reply
   2999 	Length        uint32 // number of bytes in this reply
   3000 	Status        byte
   3001 	Timestamp     xproto.Timestamp
   3002 	Crtc          Crtc
   3003 	MmWidth       uint32
   3004 	MmHeight      uint32
   3005 	Connection    byte
   3006 	SubpixelOrder byte
   3007 	NumCrtcs      uint16
   3008 	NumModes      uint16
   3009 	NumPreferred  uint16
   3010 	NumClones     uint16
   3011 	NameLen       uint16
   3012 	Crtcs         []Crtc // size: xgb.Pad((int(NumCrtcs) * 4))
   3013 	// alignment gap to multiple of 4
   3014 	Modes []Mode // size: xgb.Pad((int(NumModes) * 4))
   3015 	// alignment gap to multiple of 4
   3016 	Clones []Output // size: xgb.Pad((int(NumClones) * 4))
   3017 	Name   []byte   // size: xgb.Pad((int(NameLen) * 1))
   3018 }
   3019 
   3020 // Reply blocks and returns the reply data for a GetOutputInfo request.
   3021 func (cook GetOutputInfoCookie) Reply() (*GetOutputInfoReply, error) {
   3022 	buf, err := cook.Cookie.Reply()
   3023 	if err != nil {
   3024 		return nil, err
   3025 	}
   3026 	if buf == nil {
   3027 		return nil, nil
   3028 	}
   3029 	return getOutputInfoReply(buf), nil
   3030 }
   3031 
   3032 // getOutputInfoReply reads a byte slice into a GetOutputInfoReply value.
   3033 func getOutputInfoReply(buf []byte) *GetOutputInfoReply {
   3034 	v := new(GetOutputInfoReply)
   3035 	b := 1 // skip reply determinant
   3036 
   3037 	v.Status = buf[b]
   3038 	b += 1
   3039 
   3040 	v.Sequence = xgb.Get16(buf[b:])
   3041 	b += 2
   3042 
   3043 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   3044 	b += 4
   3045 
   3046 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   3047 	b += 4
   3048 
   3049 	v.Crtc = Crtc(xgb.Get32(buf[b:]))
   3050 	b += 4
   3051 
   3052 	v.MmWidth = xgb.Get32(buf[b:])
   3053 	b += 4
   3054 
   3055 	v.MmHeight = xgb.Get32(buf[b:])
   3056 	b += 4
   3057 
   3058 	v.Connection = buf[b]
   3059 	b += 1
   3060 
   3061 	v.SubpixelOrder = buf[b]
   3062 	b += 1
   3063 
   3064 	v.NumCrtcs = xgb.Get16(buf[b:])
   3065 	b += 2
   3066 
   3067 	v.NumModes = xgb.Get16(buf[b:])
   3068 	b += 2
   3069 
   3070 	v.NumPreferred = xgb.Get16(buf[b:])
   3071 	b += 2
   3072 
   3073 	v.NumClones = xgb.Get16(buf[b:])
   3074 	b += 2
   3075 
   3076 	v.NameLen = xgb.Get16(buf[b:])
   3077 	b += 2
   3078 
   3079 	v.Crtcs = make([]Crtc, v.NumCrtcs)
   3080 	for i := 0; i < int(v.NumCrtcs); i++ {
   3081 		v.Crtcs[i] = Crtc(xgb.Get32(buf[b:]))
   3082 		b += 4
   3083 	}
   3084 
   3085 	b = (b + 3) & ^3 // alignment gap
   3086 
   3087 	v.Modes = make([]Mode, v.NumModes)
   3088 	for i := 0; i < int(v.NumModes); i++ {
   3089 		v.Modes[i] = Mode(xgb.Get32(buf[b:]))
   3090 		b += 4
   3091 	}
   3092 
   3093 	b = (b + 3) & ^3 // alignment gap
   3094 
   3095 	v.Clones = make([]Output, v.NumClones)
   3096 	for i := 0; i < int(v.NumClones); i++ {
   3097 		v.Clones[i] = Output(xgb.Get32(buf[b:]))
   3098 		b += 4
   3099 	}
   3100 
   3101 	v.Name = make([]byte, v.NameLen)
   3102 	copy(v.Name[:v.NameLen], buf[b:])
   3103 	b += int(v.NameLen)
   3104 
   3105 	return v
   3106 }
   3107 
   3108 // Write request to wire for GetOutputInfo
   3109 // getOutputInfoRequest writes a GetOutputInfo request to a byte slice.
   3110 func getOutputInfoRequest(c *xgb.Conn, Output Output, ConfigTimestamp xproto.Timestamp) []byte {
   3111 	size := 12
   3112 	b := 0
   3113 	buf := make([]byte, size)
   3114 
   3115 	c.ExtLock.RLock()
   3116 	buf[b] = c.Extensions["RANDR"]
   3117 	c.ExtLock.RUnlock()
   3118 	b += 1
   3119 
   3120 	buf[b] = 9 // request opcode
   3121 	b += 1
   3122 
   3123 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   3124 	b += 2
   3125 
   3126 	xgb.Put32(buf[b:], uint32(Output))
   3127 	b += 4
   3128 
   3129 	xgb.Put32(buf[b:], uint32(ConfigTimestamp))
   3130 	b += 4
   3131 
   3132 	return buf
   3133 }
   3134 
   3135 // GetOutputPrimaryCookie is a cookie used only for GetOutputPrimary requests.
   3136 type GetOutputPrimaryCookie struct {
   3137 	*xgb.Cookie
   3138 }
   3139 
   3140 // GetOutputPrimary sends a checked request.
   3141 // If an error occurs, it will be returned with the reply by calling GetOutputPrimaryCookie.Reply()
   3142 func GetOutputPrimary(c *xgb.Conn, Window xproto.Window) GetOutputPrimaryCookie {
   3143 	c.ExtLock.RLock()
   3144 	defer c.ExtLock.RUnlock()
   3145 	if _, ok := c.Extensions["RANDR"]; !ok {
   3146 		panic("Cannot issue request 'GetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3147 	}
   3148 	cookie := c.NewCookie(true, true)
   3149 	c.NewRequest(getOutputPrimaryRequest(c, Window), cookie)
   3150 	return GetOutputPrimaryCookie{cookie}
   3151 }
   3152 
   3153 // GetOutputPrimaryUnchecked sends an unchecked request.
   3154 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   3155 func GetOutputPrimaryUnchecked(c *xgb.Conn, Window xproto.Window) GetOutputPrimaryCookie {
   3156 	c.ExtLock.RLock()
   3157 	defer c.ExtLock.RUnlock()
   3158 	if _, ok := c.Extensions["RANDR"]; !ok {
   3159 		panic("Cannot issue request 'GetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3160 	}
   3161 	cookie := c.NewCookie(false, true)
   3162 	c.NewRequest(getOutputPrimaryRequest(c, Window), cookie)
   3163 	return GetOutputPrimaryCookie{cookie}
   3164 }
   3165 
   3166 // GetOutputPrimaryReply represents the data returned from a GetOutputPrimary request.
   3167 type GetOutputPrimaryReply struct {
   3168 	Sequence uint16 // sequence number of the request for this reply
   3169 	Length   uint32 // number of bytes in this reply
   3170 	// padding: 1 bytes
   3171 	Output Output
   3172 }
   3173 
   3174 // Reply blocks and returns the reply data for a GetOutputPrimary request.
   3175 func (cook GetOutputPrimaryCookie) Reply() (*GetOutputPrimaryReply, error) {
   3176 	buf, err := cook.Cookie.Reply()
   3177 	if err != nil {
   3178 		return nil, err
   3179 	}
   3180 	if buf == nil {
   3181 		return nil, nil
   3182 	}
   3183 	return getOutputPrimaryReply(buf), nil
   3184 }
   3185 
   3186 // getOutputPrimaryReply reads a byte slice into a GetOutputPrimaryReply value.
   3187 func getOutputPrimaryReply(buf []byte) *GetOutputPrimaryReply {
   3188 	v := new(GetOutputPrimaryReply)
   3189 	b := 1 // skip reply determinant
   3190 
   3191 	b += 1 // padding
   3192 
   3193 	v.Sequence = xgb.Get16(buf[b:])
   3194 	b += 2
   3195 
   3196 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   3197 	b += 4
   3198 
   3199 	v.Output = Output(xgb.Get32(buf[b:]))
   3200 	b += 4
   3201 
   3202 	return v
   3203 }
   3204 
   3205 // Write request to wire for GetOutputPrimary
   3206 // getOutputPrimaryRequest writes a GetOutputPrimary request to a byte slice.
   3207 func getOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window) []byte {
   3208 	size := 8
   3209 	b := 0
   3210 	buf := make([]byte, size)
   3211 
   3212 	c.ExtLock.RLock()
   3213 	buf[b] = c.Extensions["RANDR"]
   3214 	c.ExtLock.RUnlock()
   3215 	b += 1
   3216 
   3217 	buf[b] = 31 // request opcode
   3218 	b += 1
   3219 
   3220 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   3221 	b += 2
   3222 
   3223 	xgb.Put32(buf[b:], uint32(Window))
   3224 	b += 4
   3225 
   3226 	return buf
   3227 }
   3228 
   3229 // GetOutputPropertyCookie is a cookie used only for GetOutputProperty requests.
   3230 type GetOutputPropertyCookie struct {
   3231 	*xgb.Cookie
   3232 }
   3233 
   3234 // GetOutputProperty sends a checked request.
   3235 // If an error occurs, it will be returned with the reply by calling GetOutputPropertyCookie.Reply()
   3236 func GetOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetOutputPropertyCookie {
   3237 	c.ExtLock.RLock()
   3238 	defer c.ExtLock.RUnlock()
   3239 	if _, ok := c.Extensions["RANDR"]; !ok {
   3240 		panic("Cannot issue request 'GetOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3241 	}
   3242 	cookie := c.NewCookie(true, true)
   3243 	c.NewRequest(getOutputPropertyRequest(c, Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie)
   3244 	return GetOutputPropertyCookie{cookie}
   3245 }
   3246 
   3247 // GetOutputPropertyUnchecked sends an unchecked request.
   3248 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   3249 func GetOutputPropertyUnchecked(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetOutputPropertyCookie {
   3250 	c.ExtLock.RLock()
   3251 	defer c.ExtLock.RUnlock()
   3252 	if _, ok := c.Extensions["RANDR"]; !ok {
   3253 		panic("Cannot issue request 'GetOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3254 	}
   3255 	cookie := c.NewCookie(false, true)
   3256 	c.NewRequest(getOutputPropertyRequest(c, Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie)
   3257 	return GetOutputPropertyCookie{cookie}
   3258 }
   3259 
   3260 // GetOutputPropertyReply represents the data returned from a GetOutputProperty request.
   3261 type GetOutputPropertyReply struct {
   3262 	Sequence   uint16 // sequence number of the request for this reply
   3263 	Length     uint32 // number of bytes in this reply
   3264 	Format     byte
   3265 	Type       xproto.Atom
   3266 	BytesAfter uint32
   3267 	NumItems   uint32
   3268 	// padding: 12 bytes
   3269 	Data []byte // size: xgb.Pad(((int(NumItems) * (int(Format) / 8)) * 1))
   3270 }
   3271 
   3272 // Reply blocks and returns the reply data for a GetOutputProperty request.
   3273 func (cook GetOutputPropertyCookie) Reply() (*GetOutputPropertyReply, error) {
   3274 	buf, err := cook.Cookie.Reply()
   3275 	if err != nil {
   3276 		return nil, err
   3277 	}
   3278 	if buf == nil {
   3279 		return nil, nil
   3280 	}
   3281 	return getOutputPropertyReply(buf), nil
   3282 }
   3283 
   3284 // getOutputPropertyReply reads a byte slice into a GetOutputPropertyReply value.
   3285 func getOutputPropertyReply(buf []byte) *GetOutputPropertyReply {
   3286 	v := new(GetOutputPropertyReply)
   3287 	b := 1 // skip reply determinant
   3288 
   3289 	v.Format = buf[b]
   3290 	b += 1
   3291 
   3292 	v.Sequence = xgb.Get16(buf[b:])
   3293 	b += 2
   3294 
   3295 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   3296 	b += 4
   3297 
   3298 	v.Type = xproto.Atom(xgb.Get32(buf[b:]))
   3299 	b += 4
   3300 
   3301 	v.BytesAfter = xgb.Get32(buf[b:])
   3302 	b += 4
   3303 
   3304 	v.NumItems = xgb.Get32(buf[b:])
   3305 	b += 4
   3306 
   3307 	b += 12 // padding
   3308 
   3309 	v.Data = make([]byte, (int(v.NumItems) * (int(v.Format) / 8)))
   3310 	copy(v.Data[:(int(v.NumItems)*(int(v.Format)/8))], buf[b:])
   3311 	b += int((int(v.NumItems) * (int(v.Format) / 8)))
   3312 
   3313 	return v
   3314 }
   3315 
   3316 // Write request to wire for GetOutputProperty
   3317 // getOutputPropertyRequest writes a GetOutputProperty request to a byte slice.
   3318 func getOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) []byte {
   3319 	size := 28
   3320 	b := 0
   3321 	buf := make([]byte, size)
   3322 
   3323 	c.ExtLock.RLock()
   3324 	buf[b] = c.Extensions["RANDR"]
   3325 	c.ExtLock.RUnlock()
   3326 	b += 1
   3327 
   3328 	buf[b] = 15 // request opcode
   3329 	b += 1
   3330 
   3331 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   3332 	b += 2
   3333 
   3334 	xgb.Put32(buf[b:], uint32(Output))
   3335 	b += 4
   3336 
   3337 	xgb.Put32(buf[b:], uint32(Property))
   3338 	b += 4
   3339 
   3340 	xgb.Put32(buf[b:], uint32(Type))
   3341 	b += 4
   3342 
   3343 	xgb.Put32(buf[b:], LongOffset)
   3344 	b += 4
   3345 
   3346 	xgb.Put32(buf[b:], LongLength)
   3347 	b += 4
   3348 
   3349 	if Delete {
   3350 		buf[b] = 1
   3351 	} else {
   3352 		buf[b] = 0
   3353 	}
   3354 	b += 1
   3355 
   3356 	if Pending {
   3357 		buf[b] = 1
   3358 	} else {
   3359 		buf[b] = 0
   3360 	}
   3361 	b += 1
   3362 
   3363 	b += 2 // padding
   3364 
   3365 	return buf
   3366 }
   3367 
   3368 // GetPanningCookie is a cookie used only for GetPanning requests.
   3369 type GetPanningCookie struct {
   3370 	*xgb.Cookie
   3371 }
   3372 
   3373 // GetPanning sends a checked request.
   3374 // If an error occurs, it will be returned with the reply by calling GetPanningCookie.Reply()
   3375 func GetPanning(c *xgb.Conn, Crtc Crtc) GetPanningCookie {
   3376 	c.ExtLock.RLock()
   3377 	defer c.ExtLock.RUnlock()
   3378 	if _, ok := c.Extensions["RANDR"]; !ok {
   3379 		panic("Cannot issue request 'GetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3380 	}
   3381 	cookie := c.NewCookie(true, true)
   3382 	c.NewRequest(getPanningRequest(c, Crtc), cookie)
   3383 	return GetPanningCookie{cookie}
   3384 }
   3385 
   3386 // GetPanningUnchecked sends an unchecked request.
   3387 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   3388 func GetPanningUnchecked(c *xgb.Conn, Crtc Crtc) GetPanningCookie {
   3389 	c.ExtLock.RLock()
   3390 	defer c.ExtLock.RUnlock()
   3391 	if _, ok := c.Extensions["RANDR"]; !ok {
   3392 		panic("Cannot issue request 'GetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3393 	}
   3394 	cookie := c.NewCookie(false, true)
   3395 	c.NewRequest(getPanningRequest(c, Crtc), cookie)
   3396 	return GetPanningCookie{cookie}
   3397 }
   3398 
   3399 // GetPanningReply represents the data returned from a GetPanning request.
   3400 type GetPanningReply struct {
   3401 	Sequence     uint16 // sequence number of the request for this reply
   3402 	Length       uint32 // number of bytes in this reply
   3403 	Status       byte
   3404 	Timestamp    xproto.Timestamp
   3405 	Left         uint16
   3406 	Top          uint16
   3407 	Width        uint16
   3408 	Height       uint16
   3409 	TrackLeft    uint16
   3410 	TrackTop     uint16
   3411 	TrackWidth   uint16
   3412 	TrackHeight  uint16
   3413 	BorderLeft   int16
   3414 	BorderTop    int16
   3415 	BorderRight  int16
   3416 	BorderBottom int16
   3417 }
   3418 
   3419 // Reply blocks and returns the reply data for a GetPanning request.
   3420 func (cook GetPanningCookie) Reply() (*GetPanningReply, error) {
   3421 	buf, err := cook.Cookie.Reply()
   3422 	if err != nil {
   3423 		return nil, err
   3424 	}
   3425 	if buf == nil {
   3426 		return nil, nil
   3427 	}
   3428 	return getPanningReply(buf), nil
   3429 }
   3430 
   3431 // getPanningReply reads a byte slice into a GetPanningReply value.
   3432 func getPanningReply(buf []byte) *GetPanningReply {
   3433 	v := new(GetPanningReply)
   3434 	b := 1 // skip reply determinant
   3435 
   3436 	v.Status = buf[b]
   3437 	b += 1
   3438 
   3439 	v.Sequence = xgb.Get16(buf[b:])
   3440 	b += 2
   3441 
   3442 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   3443 	b += 4
   3444 
   3445 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   3446 	b += 4
   3447 
   3448 	v.Left = xgb.Get16(buf[b:])
   3449 	b += 2
   3450 
   3451 	v.Top = xgb.Get16(buf[b:])
   3452 	b += 2
   3453 
   3454 	v.Width = xgb.Get16(buf[b:])
   3455 	b += 2
   3456 
   3457 	v.Height = xgb.Get16(buf[b:])
   3458 	b += 2
   3459 
   3460 	v.TrackLeft = xgb.Get16(buf[b:])
   3461 	b += 2
   3462 
   3463 	v.TrackTop = xgb.Get16(buf[b:])
   3464 	b += 2
   3465 
   3466 	v.TrackWidth = xgb.Get16(buf[b:])
   3467 	b += 2
   3468 
   3469 	v.TrackHeight = xgb.Get16(buf[b:])
   3470 	b += 2
   3471 
   3472 	v.BorderLeft = int16(xgb.Get16(buf[b:]))
   3473 	b += 2
   3474 
   3475 	v.BorderTop = int16(xgb.Get16(buf[b:]))
   3476 	b += 2
   3477 
   3478 	v.BorderRight = int16(xgb.Get16(buf[b:]))
   3479 	b += 2
   3480 
   3481 	v.BorderBottom = int16(xgb.Get16(buf[b:]))
   3482 	b += 2
   3483 
   3484 	return v
   3485 }
   3486 
   3487 // Write request to wire for GetPanning
   3488 // getPanningRequest writes a GetPanning request to a byte slice.
   3489 func getPanningRequest(c *xgb.Conn, Crtc Crtc) []byte {
   3490 	size := 8
   3491 	b := 0
   3492 	buf := make([]byte, size)
   3493 
   3494 	c.ExtLock.RLock()
   3495 	buf[b] = c.Extensions["RANDR"]
   3496 	c.ExtLock.RUnlock()
   3497 	b += 1
   3498 
   3499 	buf[b] = 28 // request opcode
   3500 	b += 1
   3501 
   3502 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   3503 	b += 2
   3504 
   3505 	xgb.Put32(buf[b:], uint32(Crtc))
   3506 	b += 4
   3507 
   3508 	return buf
   3509 }
   3510 
   3511 // GetProviderInfoCookie is a cookie used only for GetProviderInfo requests.
   3512 type GetProviderInfoCookie struct {
   3513 	*xgb.Cookie
   3514 }
   3515 
   3516 // GetProviderInfo sends a checked request.
   3517 // If an error occurs, it will be returned with the reply by calling GetProviderInfoCookie.Reply()
   3518 func GetProviderInfo(c *xgb.Conn, Provider Provider, ConfigTimestamp xproto.Timestamp) GetProviderInfoCookie {
   3519 	c.ExtLock.RLock()
   3520 	defer c.ExtLock.RUnlock()
   3521 	if _, ok := c.Extensions["RANDR"]; !ok {
   3522 		panic("Cannot issue request 'GetProviderInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3523 	}
   3524 	cookie := c.NewCookie(true, true)
   3525 	c.NewRequest(getProviderInfoRequest(c, Provider, ConfigTimestamp), cookie)
   3526 	return GetProviderInfoCookie{cookie}
   3527 }
   3528 
   3529 // GetProviderInfoUnchecked sends an unchecked request.
   3530 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   3531 func GetProviderInfoUnchecked(c *xgb.Conn, Provider Provider, ConfigTimestamp xproto.Timestamp) GetProviderInfoCookie {
   3532 	c.ExtLock.RLock()
   3533 	defer c.ExtLock.RUnlock()
   3534 	if _, ok := c.Extensions["RANDR"]; !ok {
   3535 		panic("Cannot issue request 'GetProviderInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3536 	}
   3537 	cookie := c.NewCookie(false, true)
   3538 	c.NewRequest(getProviderInfoRequest(c, Provider, ConfigTimestamp), cookie)
   3539 	return GetProviderInfoCookie{cookie}
   3540 }
   3541 
   3542 // GetProviderInfoReply represents the data returned from a GetProviderInfo request.
   3543 type GetProviderInfoReply struct {
   3544 	Sequence               uint16 // sequence number of the request for this reply
   3545 	Length                 uint32 // number of bytes in this reply
   3546 	Status                 byte
   3547 	Timestamp              xproto.Timestamp
   3548 	Capabilities           uint32
   3549 	NumCrtcs               uint16
   3550 	NumOutputs             uint16
   3551 	NumAssociatedProviders uint16
   3552 	NameLen                uint16
   3553 	// padding: 8 bytes
   3554 	Crtcs []Crtc // size: xgb.Pad((int(NumCrtcs) * 4))
   3555 	// alignment gap to multiple of 4
   3556 	Outputs []Output // size: xgb.Pad((int(NumOutputs) * 4))
   3557 	// alignment gap to multiple of 4
   3558 	AssociatedProviders []Provider // size: xgb.Pad((int(NumAssociatedProviders) * 4))
   3559 	// alignment gap to multiple of 4
   3560 	AssociatedCapability []uint32 // size: xgb.Pad((int(NumAssociatedProviders) * 4))
   3561 	Name                 string   // size: xgb.Pad((int(NameLen) * 1))
   3562 }
   3563 
   3564 // Reply blocks and returns the reply data for a GetProviderInfo request.
   3565 func (cook GetProviderInfoCookie) Reply() (*GetProviderInfoReply, error) {
   3566 	buf, err := cook.Cookie.Reply()
   3567 	if err != nil {
   3568 		return nil, err
   3569 	}
   3570 	if buf == nil {
   3571 		return nil, nil
   3572 	}
   3573 	return getProviderInfoReply(buf), nil
   3574 }
   3575 
   3576 // getProviderInfoReply reads a byte slice into a GetProviderInfoReply value.
   3577 func getProviderInfoReply(buf []byte) *GetProviderInfoReply {
   3578 	v := new(GetProviderInfoReply)
   3579 	b := 1 // skip reply determinant
   3580 
   3581 	v.Status = buf[b]
   3582 	b += 1
   3583 
   3584 	v.Sequence = xgb.Get16(buf[b:])
   3585 	b += 2
   3586 
   3587 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   3588 	b += 4
   3589 
   3590 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   3591 	b += 4
   3592 
   3593 	v.Capabilities = xgb.Get32(buf[b:])
   3594 	b += 4
   3595 
   3596 	v.NumCrtcs = xgb.Get16(buf[b:])
   3597 	b += 2
   3598 
   3599 	v.NumOutputs = xgb.Get16(buf[b:])
   3600 	b += 2
   3601 
   3602 	v.NumAssociatedProviders = xgb.Get16(buf[b:])
   3603 	b += 2
   3604 
   3605 	v.NameLen = xgb.Get16(buf[b:])
   3606 	b += 2
   3607 
   3608 	b += 8 // padding
   3609 
   3610 	v.Crtcs = make([]Crtc, v.NumCrtcs)
   3611 	for i := 0; i < int(v.NumCrtcs); i++ {
   3612 		v.Crtcs[i] = Crtc(xgb.Get32(buf[b:]))
   3613 		b += 4
   3614 	}
   3615 
   3616 	b = (b + 3) & ^3 // alignment gap
   3617 
   3618 	v.Outputs = make([]Output, v.NumOutputs)
   3619 	for i := 0; i < int(v.NumOutputs); i++ {
   3620 		v.Outputs[i] = Output(xgb.Get32(buf[b:]))
   3621 		b += 4
   3622 	}
   3623 
   3624 	b = (b + 3) & ^3 // alignment gap
   3625 
   3626 	v.AssociatedProviders = make([]Provider, v.NumAssociatedProviders)
   3627 	for i := 0; i < int(v.NumAssociatedProviders); i++ {
   3628 		v.AssociatedProviders[i] = Provider(xgb.Get32(buf[b:]))
   3629 		b += 4
   3630 	}
   3631 
   3632 	b = (b + 3) & ^3 // alignment gap
   3633 
   3634 	v.AssociatedCapability = make([]uint32, v.NumAssociatedProviders)
   3635 	for i := 0; i < int(v.NumAssociatedProviders); i++ {
   3636 		v.AssociatedCapability[i] = xgb.Get32(buf[b:])
   3637 		b += 4
   3638 	}
   3639 
   3640 	{
   3641 		byteString := make([]byte, v.NameLen)
   3642 		copy(byteString[:v.NameLen], buf[b:])
   3643 		v.Name = string(byteString)
   3644 		b += int(v.NameLen)
   3645 	}
   3646 
   3647 	return v
   3648 }
   3649 
   3650 // Write request to wire for GetProviderInfo
   3651 // getProviderInfoRequest writes a GetProviderInfo request to a byte slice.
   3652 func getProviderInfoRequest(c *xgb.Conn, Provider Provider, ConfigTimestamp xproto.Timestamp) []byte {
   3653 	size := 12
   3654 	b := 0
   3655 	buf := make([]byte, size)
   3656 
   3657 	c.ExtLock.RLock()
   3658 	buf[b] = c.Extensions["RANDR"]
   3659 	c.ExtLock.RUnlock()
   3660 	b += 1
   3661 
   3662 	buf[b] = 33 // 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(Provider))
   3669 	b += 4
   3670 
   3671 	xgb.Put32(buf[b:], uint32(ConfigTimestamp))
   3672 	b += 4
   3673 
   3674 	return buf
   3675 }
   3676 
   3677 // GetProviderPropertyCookie is a cookie used only for GetProviderProperty requests.
   3678 type GetProviderPropertyCookie struct {
   3679 	*xgb.Cookie
   3680 }
   3681 
   3682 // GetProviderProperty sends a checked request.
   3683 // If an error occurs, it will be returned with the reply by calling GetProviderPropertyCookie.Reply()
   3684 func GetProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetProviderPropertyCookie {
   3685 	c.ExtLock.RLock()
   3686 	defer c.ExtLock.RUnlock()
   3687 	if _, ok := c.Extensions["RANDR"]; !ok {
   3688 		panic("Cannot issue request 'GetProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3689 	}
   3690 	cookie := c.NewCookie(true, true)
   3691 	c.NewRequest(getProviderPropertyRequest(c, Provider, Property, Type, LongOffset, LongLength, Delete, Pending), cookie)
   3692 	return GetProviderPropertyCookie{cookie}
   3693 }
   3694 
   3695 // GetProviderPropertyUnchecked sends an unchecked request.
   3696 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   3697 func GetProviderPropertyUnchecked(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetProviderPropertyCookie {
   3698 	c.ExtLock.RLock()
   3699 	defer c.ExtLock.RUnlock()
   3700 	if _, ok := c.Extensions["RANDR"]; !ok {
   3701 		panic("Cannot issue request 'GetProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3702 	}
   3703 	cookie := c.NewCookie(false, true)
   3704 	c.NewRequest(getProviderPropertyRequest(c, Provider, Property, Type, LongOffset, LongLength, Delete, Pending), cookie)
   3705 	return GetProviderPropertyCookie{cookie}
   3706 }
   3707 
   3708 // GetProviderPropertyReply represents the data returned from a GetProviderProperty request.
   3709 type GetProviderPropertyReply struct {
   3710 	Sequence   uint16 // sequence number of the request for this reply
   3711 	Length     uint32 // number of bytes in this reply
   3712 	Format     byte
   3713 	Type       xproto.Atom
   3714 	BytesAfter uint32
   3715 	NumItems   uint32
   3716 	// padding: 12 bytes
   3717 	Data []byte // size: xgb.Pad(((int(NumItems) * (int(Format) / 8)) * 1))
   3718 }
   3719 
   3720 // Reply blocks and returns the reply data for a GetProviderProperty request.
   3721 func (cook GetProviderPropertyCookie) Reply() (*GetProviderPropertyReply, error) {
   3722 	buf, err := cook.Cookie.Reply()
   3723 	if err != nil {
   3724 		return nil, err
   3725 	}
   3726 	if buf == nil {
   3727 		return nil, nil
   3728 	}
   3729 	return getProviderPropertyReply(buf), nil
   3730 }
   3731 
   3732 // getProviderPropertyReply reads a byte slice into a GetProviderPropertyReply value.
   3733 func getProviderPropertyReply(buf []byte) *GetProviderPropertyReply {
   3734 	v := new(GetProviderPropertyReply)
   3735 	b := 1 // skip reply determinant
   3736 
   3737 	v.Format = buf[b]
   3738 	b += 1
   3739 
   3740 	v.Sequence = xgb.Get16(buf[b:])
   3741 	b += 2
   3742 
   3743 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   3744 	b += 4
   3745 
   3746 	v.Type = xproto.Atom(xgb.Get32(buf[b:]))
   3747 	b += 4
   3748 
   3749 	v.BytesAfter = xgb.Get32(buf[b:])
   3750 	b += 4
   3751 
   3752 	v.NumItems = xgb.Get32(buf[b:])
   3753 	b += 4
   3754 
   3755 	b += 12 // padding
   3756 
   3757 	v.Data = make([]byte, (int(v.NumItems) * (int(v.Format) / 8)))
   3758 	copy(v.Data[:(int(v.NumItems)*(int(v.Format)/8))], buf[b:])
   3759 	b += int((int(v.NumItems) * (int(v.Format) / 8)))
   3760 
   3761 	return v
   3762 }
   3763 
   3764 // Write request to wire for GetProviderProperty
   3765 // getProviderPropertyRequest writes a GetProviderProperty request to a byte slice.
   3766 func getProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) []byte {
   3767 	size := 28
   3768 	b := 0
   3769 	buf := make([]byte, size)
   3770 
   3771 	c.ExtLock.RLock()
   3772 	buf[b] = c.Extensions["RANDR"]
   3773 	c.ExtLock.RUnlock()
   3774 	b += 1
   3775 
   3776 	buf[b] = 41 // request opcode
   3777 	b += 1
   3778 
   3779 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   3780 	b += 2
   3781 
   3782 	xgb.Put32(buf[b:], uint32(Provider))
   3783 	b += 4
   3784 
   3785 	xgb.Put32(buf[b:], uint32(Property))
   3786 	b += 4
   3787 
   3788 	xgb.Put32(buf[b:], uint32(Type))
   3789 	b += 4
   3790 
   3791 	xgb.Put32(buf[b:], LongOffset)
   3792 	b += 4
   3793 
   3794 	xgb.Put32(buf[b:], LongLength)
   3795 	b += 4
   3796 
   3797 	if Delete {
   3798 		buf[b] = 1
   3799 	} else {
   3800 		buf[b] = 0
   3801 	}
   3802 	b += 1
   3803 
   3804 	if Pending {
   3805 		buf[b] = 1
   3806 	} else {
   3807 		buf[b] = 0
   3808 	}
   3809 	b += 1
   3810 
   3811 	b += 2 // padding
   3812 
   3813 	return buf
   3814 }
   3815 
   3816 // GetProvidersCookie is a cookie used only for GetProviders requests.
   3817 type GetProvidersCookie struct {
   3818 	*xgb.Cookie
   3819 }
   3820 
   3821 // GetProviders sends a checked request.
   3822 // If an error occurs, it will be returned with the reply by calling GetProvidersCookie.Reply()
   3823 func GetProviders(c *xgb.Conn, Window xproto.Window) GetProvidersCookie {
   3824 	c.ExtLock.RLock()
   3825 	defer c.ExtLock.RUnlock()
   3826 	if _, ok := c.Extensions["RANDR"]; !ok {
   3827 		panic("Cannot issue request 'GetProviders' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3828 	}
   3829 	cookie := c.NewCookie(true, true)
   3830 	c.NewRequest(getProvidersRequest(c, Window), cookie)
   3831 	return GetProvidersCookie{cookie}
   3832 }
   3833 
   3834 // GetProvidersUnchecked sends an unchecked request.
   3835 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   3836 func GetProvidersUnchecked(c *xgb.Conn, Window xproto.Window) GetProvidersCookie {
   3837 	c.ExtLock.RLock()
   3838 	defer c.ExtLock.RUnlock()
   3839 	if _, ok := c.Extensions["RANDR"]; !ok {
   3840 		panic("Cannot issue request 'GetProviders' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3841 	}
   3842 	cookie := c.NewCookie(false, true)
   3843 	c.NewRequest(getProvidersRequest(c, Window), cookie)
   3844 	return GetProvidersCookie{cookie}
   3845 }
   3846 
   3847 // GetProvidersReply represents the data returned from a GetProviders request.
   3848 type GetProvidersReply struct {
   3849 	Sequence uint16 // sequence number of the request for this reply
   3850 	Length   uint32 // number of bytes in this reply
   3851 	// padding: 1 bytes
   3852 	Timestamp    xproto.Timestamp
   3853 	NumProviders uint16
   3854 	// padding: 18 bytes
   3855 	Providers []Provider // size: xgb.Pad((int(NumProviders) * 4))
   3856 }
   3857 
   3858 // Reply blocks and returns the reply data for a GetProviders request.
   3859 func (cook GetProvidersCookie) Reply() (*GetProvidersReply, error) {
   3860 	buf, err := cook.Cookie.Reply()
   3861 	if err != nil {
   3862 		return nil, err
   3863 	}
   3864 	if buf == nil {
   3865 		return nil, nil
   3866 	}
   3867 	return getProvidersReply(buf), nil
   3868 }
   3869 
   3870 // getProvidersReply reads a byte slice into a GetProvidersReply value.
   3871 func getProvidersReply(buf []byte) *GetProvidersReply {
   3872 	v := new(GetProvidersReply)
   3873 	b := 1 // skip reply determinant
   3874 
   3875 	b += 1 // padding
   3876 
   3877 	v.Sequence = xgb.Get16(buf[b:])
   3878 	b += 2
   3879 
   3880 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   3881 	b += 4
   3882 
   3883 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   3884 	b += 4
   3885 
   3886 	v.NumProviders = xgb.Get16(buf[b:])
   3887 	b += 2
   3888 
   3889 	b += 18 // padding
   3890 
   3891 	v.Providers = make([]Provider, v.NumProviders)
   3892 	for i := 0; i < int(v.NumProviders); i++ {
   3893 		v.Providers[i] = Provider(xgb.Get32(buf[b:]))
   3894 		b += 4
   3895 	}
   3896 
   3897 	return v
   3898 }
   3899 
   3900 // Write request to wire for GetProviders
   3901 // getProvidersRequest writes a GetProviders request to a byte slice.
   3902 func getProvidersRequest(c *xgb.Conn, Window xproto.Window) []byte {
   3903 	size := 8
   3904 	b := 0
   3905 	buf := make([]byte, size)
   3906 
   3907 	c.ExtLock.RLock()
   3908 	buf[b] = c.Extensions["RANDR"]
   3909 	c.ExtLock.RUnlock()
   3910 	b += 1
   3911 
   3912 	buf[b] = 32 // request opcode
   3913 	b += 1
   3914 
   3915 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   3916 	b += 2
   3917 
   3918 	xgb.Put32(buf[b:], uint32(Window))
   3919 	b += 4
   3920 
   3921 	return buf
   3922 }
   3923 
   3924 // GetScreenInfoCookie is a cookie used only for GetScreenInfo requests.
   3925 type GetScreenInfoCookie struct {
   3926 	*xgb.Cookie
   3927 }
   3928 
   3929 // GetScreenInfo sends a checked request.
   3930 // If an error occurs, it will be returned with the reply by calling GetScreenInfoCookie.Reply()
   3931 func GetScreenInfo(c *xgb.Conn, Window xproto.Window) GetScreenInfoCookie {
   3932 	c.ExtLock.RLock()
   3933 	defer c.ExtLock.RUnlock()
   3934 	if _, ok := c.Extensions["RANDR"]; !ok {
   3935 		panic("Cannot issue request 'GetScreenInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3936 	}
   3937 	cookie := c.NewCookie(true, true)
   3938 	c.NewRequest(getScreenInfoRequest(c, Window), cookie)
   3939 	return GetScreenInfoCookie{cookie}
   3940 }
   3941 
   3942 // GetScreenInfoUnchecked sends an unchecked request.
   3943 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   3944 func GetScreenInfoUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenInfoCookie {
   3945 	c.ExtLock.RLock()
   3946 	defer c.ExtLock.RUnlock()
   3947 	if _, ok := c.Extensions["RANDR"]; !ok {
   3948 		panic("Cannot issue request 'GetScreenInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   3949 	}
   3950 	cookie := c.NewCookie(false, true)
   3951 	c.NewRequest(getScreenInfoRequest(c, Window), cookie)
   3952 	return GetScreenInfoCookie{cookie}
   3953 }
   3954 
   3955 // GetScreenInfoReply represents the data returned from a GetScreenInfo request.
   3956 type GetScreenInfoReply struct {
   3957 	Sequence        uint16 // sequence number of the request for this reply
   3958 	Length          uint32 // number of bytes in this reply
   3959 	Rotations       byte
   3960 	Root            xproto.Window
   3961 	Timestamp       xproto.Timestamp
   3962 	ConfigTimestamp xproto.Timestamp
   3963 	NSizes          uint16
   3964 	SizeID          uint16
   3965 	Rotation        uint16
   3966 	Rate            uint16
   3967 	NInfo           uint16
   3968 	// padding: 2 bytes
   3969 	Sizes []ScreenSize // size: xgb.Pad((int(NSizes) * 8))
   3970 	// alignment gap to multiple of 2
   3971 	Rates []RefreshRates // size: RefreshRatesListSize(Rates)
   3972 }
   3973 
   3974 // Reply blocks and returns the reply data for a GetScreenInfo request.
   3975 func (cook GetScreenInfoCookie) Reply() (*GetScreenInfoReply, error) {
   3976 	buf, err := cook.Cookie.Reply()
   3977 	if err != nil {
   3978 		return nil, err
   3979 	}
   3980 	if buf == nil {
   3981 		return nil, nil
   3982 	}
   3983 	return getScreenInfoReply(buf), nil
   3984 }
   3985 
   3986 // getScreenInfoReply reads a byte slice into a GetScreenInfoReply value.
   3987 func getScreenInfoReply(buf []byte) *GetScreenInfoReply {
   3988 	v := new(GetScreenInfoReply)
   3989 	b := 1 // skip reply determinant
   3990 
   3991 	v.Rotations = buf[b]
   3992 	b += 1
   3993 
   3994 	v.Sequence = xgb.Get16(buf[b:])
   3995 	b += 2
   3996 
   3997 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   3998 	b += 4
   3999 
   4000 	v.Root = xproto.Window(xgb.Get32(buf[b:]))
   4001 	b += 4
   4002 
   4003 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   4004 	b += 4
   4005 
   4006 	v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   4007 	b += 4
   4008 
   4009 	v.NSizes = xgb.Get16(buf[b:])
   4010 	b += 2
   4011 
   4012 	v.SizeID = xgb.Get16(buf[b:])
   4013 	b += 2
   4014 
   4015 	v.Rotation = xgb.Get16(buf[b:])
   4016 	b += 2
   4017 
   4018 	v.Rate = xgb.Get16(buf[b:])
   4019 	b += 2
   4020 
   4021 	v.NInfo = xgb.Get16(buf[b:])
   4022 	b += 2
   4023 
   4024 	b += 2 // padding
   4025 
   4026 	v.Sizes = make([]ScreenSize, v.NSizes)
   4027 	b += ScreenSizeReadList(buf[b:], v.Sizes)
   4028 
   4029 	b = (b + 1) & ^1 // alignment gap
   4030 
   4031 	v.Rates = make([]RefreshRates, (int(v.NInfo) - int(v.NSizes)))
   4032 	b += RefreshRatesReadList(buf[b:], v.Rates)
   4033 
   4034 	return v
   4035 }
   4036 
   4037 // Write request to wire for GetScreenInfo
   4038 // getScreenInfoRequest writes a GetScreenInfo request to a byte slice.
   4039 func getScreenInfoRequest(c *xgb.Conn, Window xproto.Window) []byte {
   4040 	size := 8
   4041 	b := 0
   4042 	buf := make([]byte, size)
   4043 
   4044 	c.ExtLock.RLock()
   4045 	buf[b] = c.Extensions["RANDR"]
   4046 	c.ExtLock.RUnlock()
   4047 	b += 1
   4048 
   4049 	buf[b] = 5 // request opcode
   4050 	b += 1
   4051 
   4052 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   4053 	b += 2
   4054 
   4055 	xgb.Put32(buf[b:], uint32(Window))
   4056 	b += 4
   4057 
   4058 	return buf
   4059 }
   4060 
   4061 // GetScreenResourcesCookie is a cookie used only for GetScreenResources requests.
   4062 type GetScreenResourcesCookie struct {
   4063 	*xgb.Cookie
   4064 }
   4065 
   4066 // GetScreenResources sends a checked request.
   4067 // If an error occurs, it will be returned with the reply by calling GetScreenResourcesCookie.Reply()
   4068 func GetScreenResources(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCookie {
   4069 	c.ExtLock.RLock()
   4070 	defer c.ExtLock.RUnlock()
   4071 	if _, ok := c.Extensions["RANDR"]; !ok {
   4072 		panic("Cannot issue request 'GetScreenResources' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4073 	}
   4074 	cookie := c.NewCookie(true, true)
   4075 	c.NewRequest(getScreenResourcesRequest(c, Window), cookie)
   4076 	return GetScreenResourcesCookie{cookie}
   4077 }
   4078 
   4079 // GetScreenResourcesUnchecked sends an unchecked request.
   4080 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   4081 func GetScreenResourcesUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCookie {
   4082 	c.ExtLock.RLock()
   4083 	defer c.ExtLock.RUnlock()
   4084 	if _, ok := c.Extensions["RANDR"]; !ok {
   4085 		panic("Cannot issue request 'GetScreenResources' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4086 	}
   4087 	cookie := c.NewCookie(false, true)
   4088 	c.NewRequest(getScreenResourcesRequest(c, Window), cookie)
   4089 	return GetScreenResourcesCookie{cookie}
   4090 }
   4091 
   4092 // GetScreenResourcesReply represents the data returned from a GetScreenResources request.
   4093 type GetScreenResourcesReply struct {
   4094 	Sequence uint16 // sequence number of the request for this reply
   4095 	Length   uint32 // number of bytes in this reply
   4096 	// padding: 1 bytes
   4097 	Timestamp       xproto.Timestamp
   4098 	ConfigTimestamp xproto.Timestamp
   4099 	NumCrtcs        uint16
   4100 	NumOutputs      uint16
   4101 	NumModes        uint16
   4102 	NamesLen        uint16
   4103 	// padding: 8 bytes
   4104 	Crtcs []Crtc // size: xgb.Pad((int(NumCrtcs) * 4))
   4105 	// alignment gap to multiple of 4
   4106 	Outputs []Output // size: xgb.Pad((int(NumOutputs) * 4))
   4107 	// alignment gap to multiple of 4
   4108 	Modes []ModeInfo // size: xgb.Pad((int(NumModes) * 32))
   4109 	Names []byte     // size: xgb.Pad((int(NamesLen) * 1))
   4110 }
   4111 
   4112 // Reply blocks and returns the reply data for a GetScreenResources request.
   4113 func (cook GetScreenResourcesCookie) Reply() (*GetScreenResourcesReply, error) {
   4114 	buf, err := cook.Cookie.Reply()
   4115 	if err != nil {
   4116 		return nil, err
   4117 	}
   4118 	if buf == nil {
   4119 		return nil, nil
   4120 	}
   4121 	return getScreenResourcesReply(buf), nil
   4122 }
   4123 
   4124 // getScreenResourcesReply reads a byte slice into a GetScreenResourcesReply value.
   4125 func getScreenResourcesReply(buf []byte) *GetScreenResourcesReply {
   4126 	v := new(GetScreenResourcesReply)
   4127 	b := 1 // skip reply determinant
   4128 
   4129 	b += 1 // padding
   4130 
   4131 	v.Sequence = xgb.Get16(buf[b:])
   4132 	b += 2
   4133 
   4134 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   4135 	b += 4
   4136 
   4137 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   4138 	b += 4
   4139 
   4140 	v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   4141 	b += 4
   4142 
   4143 	v.NumCrtcs = xgb.Get16(buf[b:])
   4144 	b += 2
   4145 
   4146 	v.NumOutputs = xgb.Get16(buf[b:])
   4147 	b += 2
   4148 
   4149 	v.NumModes = xgb.Get16(buf[b:])
   4150 	b += 2
   4151 
   4152 	v.NamesLen = xgb.Get16(buf[b:])
   4153 	b += 2
   4154 
   4155 	b += 8 // padding
   4156 
   4157 	v.Crtcs = make([]Crtc, v.NumCrtcs)
   4158 	for i := 0; i < int(v.NumCrtcs); i++ {
   4159 		v.Crtcs[i] = Crtc(xgb.Get32(buf[b:]))
   4160 		b += 4
   4161 	}
   4162 
   4163 	b = (b + 3) & ^3 // alignment gap
   4164 
   4165 	v.Outputs = make([]Output, v.NumOutputs)
   4166 	for i := 0; i < int(v.NumOutputs); i++ {
   4167 		v.Outputs[i] = Output(xgb.Get32(buf[b:]))
   4168 		b += 4
   4169 	}
   4170 
   4171 	b = (b + 3) & ^3 // alignment gap
   4172 
   4173 	v.Modes = make([]ModeInfo, v.NumModes)
   4174 	b += ModeInfoReadList(buf[b:], v.Modes)
   4175 
   4176 	v.Names = make([]byte, v.NamesLen)
   4177 	copy(v.Names[:v.NamesLen], buf[b:])
   4178 	b += int(v.NamesLen)
   4179 
   4180 	return v
   4181 }
   4182 
   4183 // Write request to wire for GetScreenResources
   4184 // getScreenResourcesRequest writes a GetScreenResources request to a byte slice.
   4185 func getScreenResourcesRequest(c *xgb.Conn, Window xproto.Window) []byte {
   4186 	size := 8
   4187 	b := 0
   4188 	buf := make([]byte, size)
   4189 
   4190 	c.ExtLock.RLock()
   4191 	buf[b] = c.Extensions["RANDR"]
   4192 	c.ExtLock.RUnlock()
   4193 	b += 1
   4194 
   4195 	buf[b] = 8 // request opcode
   4196 	b += 1
   4197 
   4198 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   4199 	b += 2
   4200 
   4201 	xgb.Put32(buf[b:], uint32(Window))
   4202 	b += 4
   4203 
   4204 	return buf
   4205 }
   4206 
   4207 // GetScreenResourcesCurrentCookie is a cookie used only for GetScreenResourcesCurrent requests.
   4208 type GetScreenResourcesCurrentCookie struct {
   4209 	*xgb.Cookie
   4210 }
   4211 
   4212 // GetScreenResourcesCurrent sends a checked request.
   4213 // If an error occurs, it will be returned with the reply by calling GetScreenResourcesCurrentCookie.Reply()
   4214 func GetScreenResourcesCurrent(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCurrentCookie {
   4215 	c.ExtLock.RLock()
   4216 	defer c.ExtLock.RUnlock()
   4217 	if _, ok := c.Extensions["RANDR"]; !ok {
   4218 		panic("Cannot issue request 'GetScreenResourcesCurrent' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4219 	}
   4220 	cookie := c.NewCookie(true, true)
   4221 	c.NewRequest(getScreenResourcesCurrentRequest(c, Window), cookie)
   4222 	return GetScreenResourcesCurrentCookie{cookie}
   4223 }
   4224 
   4225 // GetScreenResourcesCurrentUnchecked sends an unchecked request.
   4226 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   4227 func GetScreenResourcesCurrentUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCurrentCookie {
   4228 	c.ExtLock.RLock()
   4229 	defer c.ExtLock.RUnlock()
   4230 	if _, ok := c.Extensions["RANDR"]; !ok {
   4231 		panic("Cannot issue request 'GetScreenResourcesCurrent' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4232 	}
   4233 	cookie := c.NewCookie(false, true)
   4234 	c.NewRequest(getScreenResourcesCurrentRequest(c, Window), cookie)
   4235 	return GetScreenResourcesCurrentCookie{cookie}
   4236 }
   4237 
   4238 // GetScreenResourcesCurrentReply represents the data returned from a GetScreenResourcesCurrent request.
   4239 type GetScreenResourcesCurrentReply struct {
   4240 	Sequence uint16 // sequence number of the request for this reply
   4241 	Length   uint32 // number of bytes in this reply
   4242 	// padding: 1 bytes
   4243 	Timestamp       xproto.Timestamp
   4244 	ConfigTimestamp xproto.Timestamp
   4245 	NumCrtcs        uint16
   4246 	NumOutputs      uint16
   4247 	NumModes        uint16
   4248 	NamesLen        uint16
   4249 	// padding: 8 bytes
   4250 	Crtcs []Crtc // size: xgb.Pad((int(NumCrtcs) * 4))
   4251 	// alignment gap to multiple of 4
   4252 	Outputs []Output // size: xgb.Pad((int(NumOutputs) * 4))
   4253 	// alignment gap to multiple of 4
   4254 	Modes []ModeInfo // size: xgb.Pad((int(NumModes) * 32))
   4255 	Names []byte     // size: xgb.Pad((int(NamesLen) * 1))
   4256 }
   4257 
   4258 // Reply blocks and returns the reply data for a GetScreenResourcesCurrent request.
   4259 func (cook GetScreenResourcesCurrentCookie) Reply() (*GetScreenResourcesCurrentReply, error) {
   4260 	buf, err := cook.Cookie.Reply()
   4261 	if err != nil {
   4262 		return nil, err
   4263 	}
   4264 	if buf == nil {
   4265 		return nil, nil
   4266 	}
   4267 	return getScreenResourcesCurrentReply(buf), nil
   4268 }
   4269 
   4270 // getScreenResourcesCurrentReply reads a byte slice into a GetScreenResourcesCurrentReply value.
   4271 func getScreenResourcesCurrentReply(buf []byte) *GetScreenResourcesCurrentReply {
   4272 	v := new(GetScreenResourcesCurrentReply)
   4273 	b := 1 // skip reply determinant
   4274 
   4275 	b += 1 // padding
   4276 
   4277 	v.Sequence = xgb.Get16(buf[b:])
   4278 	b += 2
   4279 
   4280 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   4281 	b += 4
   4282 
   4283 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   4284 	b += 4
   4285 
   4286 	v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   4287 	b += 4
   4288 
   4289 	v.NumCrtcs = xgb.Get16(buf[b:])
   4290 	b += 2
   4291 
   4292 	v.NumOutputs = xgb.Get16(buf[b:])
   4293 	b += 2
   4294 
   4295 	v.NumModes = xgb.Get16(buf[b:])
   4296 	b += 2
   4297 
   4298 	v.NamesLen = xgb.Get16(buf[b:])
   4299 	b += 2
   4300 
   4301 	b += 8 // padding
   4302 
   4303 	v.Crtcs = make([]Crtc, v.NumCrtcs)
   4304 	for i := 0; i < int(v.NumCrtcs); i++ {
   4305 		v.Crtcs[i] = Crtc(xgb.Get32(buf[b:]))
   4306 		b += 4
   4307 	}
   4308 
   4309 	b = (b + 3) & ^3 // alignment gap
   4310 
   4311 	v.Outputs = make([]Output, v.NumOutputs)
   4312 	for i := 0; i < int(v.NumOutputs); i++ {
   4313 		v.Outputs[i] = Output(xgb.Get32(buf[b:]))
   4314 		b += 4
   4315 	}
   4316 
   4317 	b = (b + 3) & ^3 // alignment gap
   4318 
   4319 	v.Modes = make([]ModeInfo, v.NumModes)
   4320 	b += ModeInfoReadList(buf[b:], v.Modes)
   4321 
   4322 	v.Names = make([]byte, v.NamesLen)
   4323 	copy(v.Names[:v.NamesLen], buf[b:])
   4324 	b += int(v.NamesLen)
   4325 
   4326 	return v
   4327 }
   4328 
   4329 // Write request to wire for GetScreenResourcesCurrent
   4330 // getScreenResourcesCurrentRequest writes a GetScreenResourcesCurrent request to a byte slice.
   4331 func getScreenResourcesCurrentRequest(c *xgb.Conn, Window xproto.Window) []byte {
   4332 	size := 8
   4333 	b := 0
   4334 	buf := make([]byte, size)
   4335 
   4336 	c.ExtLock.RLock()
   4337 	buf[b] = c.Extensions["RANDR"]
   4338 	c.ExtLock.RUnlock()
   4339 	b += 1
   4340 
   4341 	buf[b] = 25 // request opcode
   4342 	b += 1
   4343 
   4344 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   4345 	b += 2
   4346 
   4347 	xgb.Put32(buf[b:], uint32(Window))
   4348 	b += 4
   4349 
   4350 	return buf
   4351 }
   4352 
   4353 // GetScreenSizeRangeCookie is a cookie used only for GetScreenSizeRange requests.
   4354 type GetScreenSizeRangeCookie struct {
   4355 	*xgb.Cookie
   4356 }
   4357 
   4358 // GetScreenSizeRange sends a checked request.
   4359 // If an error occurs, it will be returned with the reply by calling GetScreenSizeRangeCookie.Reply()
   4360 func GetScreenSizeRange(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie {
   4361 	c.ExtLock.RLock()
   4362 	defer c.ExtLock.RUnlock()
   4363 	if _, ok := c.Extensions["RANDR"]; !ok {
   4364 		panic("Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4365 	}
   4366 	cookie := c.NewCookie(true, true)
   4367 	c.NewRequest(getScreenSizeRangeRequest(c, Window), cookie)
   4368 	return GetScreenSizeRangeCookie{cookie}
   4369 }
   4370 
   4371 // GetScreenSizeRangeUnchecked sends an unchecked request.
   4372 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   4373 func GetScreenSizeRangeUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie {
   4374 	c.ExtLock.RLock()
   4375 	defer c.ExtLock.RUnlock()
   4376 	if _, ok := c.Extensions["RANDR"]; !ok {
   4377 		panic("Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4378 	}
   4379 	cookie := c.NewCookie(false, true)
   4380 	c.NewRequest(getScreenSizeRangeRequest(c, Window), cookie)
   4381 	return GetScreenSizeRangeCookie{cookie}
   4382 }
   4383 
   4384 // GetScreenSizeRangeReply represents the data returned from a GetScreenSizeRange request.
   4385 type GetScreenSizeRangeReply struct {
   4386 	Sequence uint16 // sequence number of the request for this reply
   4387 	Length   uint32 // number of bytes in this reply
   4388 	// padding: 1 bytes
   4389 	MinWidth  uint16
   4390 	MinHeight uint16
   4391 	MaxWidth  uint16
   4392 	MaxHeight uint16
   4393 	// padding: 16 bytes
   4394 }
   4395 
   4396 // Reply blocks and returns the reply data for a GetScreenSizeRange request.
   4397 func (cook GetScreenSizeRangeCookie) Reply() (*GetScreenSizeRangeReply, error) {
   4398 	buf, err := cook.Cookie.Reply()
   4399 	if err != nil {
   4400 		return nil, err
   4401 	}
   4402 	if buf == nil {
   4403 		return nil, nil
   4404 	}
   4405 	return getScreenSizeRangeReply(buf), nil
   4406 }
   4407 
   4408 // getScreenSizeRangeReply reads a byte slice into a GetScreenSizeRangeReply value.
   4409 func getScreenSizeRangeReply(buf []byte) *GetScreenSizeRangeReply {
   4410 	v := new(GetScreenSizeRangeReply)
   4411 	b := 1 // skip reply determinant
   4412 
   4413 	b += 1 // padding
   4414 
   4415 	v.Sequence = xgb.Get16(buf[b:])
   4416 	b += 2
   4417 
   4418 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   4419 	b += 4
   4420 
   4421 	v.MinWidth = xgb.Get16(buf[b:])
   4422 	b += 2
   4423 
   4424 	v.MinHeight = xgb.Get16(buf[b:])
   4425 	b += 2
   4426 
   4427 	v.MaxWidth = xgb.Get16(buf[b:])
   4428 	b += 2
   4429 
   4430 	v.MaxHeight = xgb.Get16(buf[b:])
   4431 	b += 2
   4432 
   4433 	b += 16 // padding
   4434 
   4435 	return v
   4436 }
   4437 
   4438 // Write request to wire for GetScreenSizeRange
   4439 // getScreenSizeRangeRequest writes a GetScreenSizeRange request to a byte slice.
   4440 func getScreenSizeRangeRequest(c *xgb.Conn, Window xproto.Window) []byte {
   4441 	size := 8
   4442 	b := 0
   4443 	buf := make([]byte, size)
   4444 
   4445 	c.ExtLock.RLock()
   4446 	buf[b] = c.Extensions["RANDR"]
   4447 	c.ExtLock.RUnlock()
   4448 	b += 1
   4449 
   4450 	buf[b] = 6 // request opcode
   4451 	b += 1
   4452 
   4453 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   4454 	b += 2
   4455 
   4456 	xgb.Put32(buf[b:], uint32(Window))
   4457 	b += 4
   4458 
   4459 	return buf
   4460 }
   4461 
   4462 // ListOutputPropertiesCookie is a cookie used only for ListOutputProperties requests.
   4463 type ListOutputPropertiesCookie struct {
   4464 	*xgb.Cookie
   4465 }
   4466 
   4467 // ListOutputProperties sends a checked request.
   4468 // If an error occurs, it will be returned with the reply by calling ListOutputPropertiesCookie.Reply()
   4469 func ListOutputProperties(c *xgb.Conn, Output Output) ListOutputPropertiesCookie {
   4470 	c.ExtLock.RLock()
   4471 	defer c.ExtLock.RUnlock()
   4472 	if _, ok := c.Extensions["RANDR"]; !ok {
   4473 		panic("Cannot issue request 'ListOutputProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4474 	}
   4475 	cookie := c.NewCookie(true, true)
   4476 	c.NewRequest(listOutputPropertiesRequest(c, Output), cookie)
   4477 	return ListOutputPropertiesCookie{cookie}
   4478 }
   4479 
   4480 // ListOutputPropertiesUnchecked sends an unchecked request.
   4481 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   4482 func ListOutputPropertiesUnchecked(c *xgb.Conn, Output Output) ListOutputPropertiesCookie {
   4483 	c.ExtLock.RLock()
   4484 	defer c.ExtLock.RUnlock()
   4485 	if _, ok := c.Extensions["RANDR"]; !ok {
   4486 		panic("Cannot issue request 'ListOutputProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4487 	}
   4488 	cookie := c.NewCookie(false, true)
   4489 	c.NewRequest(listOutputPropertiesRequest(c, Output), cookie)
   4490 	return ListOutputPropertiesCookie{cookie}
   4491 }
   4492 
   4493 // ListOutputPropertiesReply represents the data returned from a ListOutputProperties request.
   4494 type ListOutputPropertiesReply struct {
   4495 	Sequence uint16 // sequence number of the request for this reply
   4496 	Length   uint32 // number of bytes in this reply
   4497 	// padding: 1 bytes
   4498 	NumAtoms uint16
   4499 	// padding: 22 bytes
   4500 	Atoms []xproto.Atom // size: xgb.Pad((int(NumAtoms) * 4))
   4501 }
   4502 
   4503 // Reply blocks and returns the reply data for a ListOutputProperties request.
   4504 func (cook ListOutputPropertiesCookie) Reply() (*ListOutputPropertiesReply, error) {
   4505 	buf, err := cook.Cookie.Reply()
   4506 	if err != nil {
   4507 		return nil, err
   4508 	}
   4509 	if buf == nil {
   4510 		return nil, nil
   4511 	}
   4512 	return listOutputPropertiesReply(buf), nil
   4513 }
   4514 
   4515 // listOutputPropertiesReply reads a byte slice into a ListOutputPropertiesReply value.
   4516 func listOutputPropertiesReply(buf []byte) *ListOutputPropertiesReply {
   4517 	v := new(ListOutputPropertiesReply)
   4518 	b := 1 // skip reply determinant
   4519 
   4520 	b += 1 // padding
   4521 
   4522 	v.Sequence = xgb.Get16(buf[b:])
   4523 	b += 2
   4524 
   4525 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   4526 	b += 4
   4527 
   4528 	v.NumAtoms = xgb.Get16(buf[b:])
   4529 	b += 2
   4530 
   4531 	b += 22 // padding
   4532 
   4533 	v.Atoms = make([]xproto.Atom, v.NumAtoms)
   4534 	for i := 0; i < int(v.NumAtoms); i++ {
   4535 		v.Atoms[i] = xproto.Atom(xgb.Get32(buf[b:]))
   4536 		b += 4
   4537 	}
   4538 
   4539 	return v
   4540 }
   4541 
   4542 // Write request to wire for ListOutputProperties
   4543 // listOutputPropertiesRequest writes a ListOutputProperties request to a byte slice.
   4544 func listOutputPropertiesRequest(c *xgb.Conn, Output Output) []byte {
   4545 	size := 8
   4546 	b := 0
   4547 	buf := make([]byte, size)
   4548 
   4549 	c.ExtLock.RLock()
   4550 	buf[b] = c.Extensions["RANDR"]
   4551 	c.ExtLock.RUnlock()
   4552 	b += 1
   4553 
   4554 	buf[b] = 10 // request opcode
   4555 	b += 1
   4556 
   4557 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   4558 	b += 2
   4559 
   4560 	xgb.Put32(buf[b:], uint32(Output))
   4561 	b += 4
   4562 
   4563 	return buf
   4564 }
   4565 
   4566 // ListProviderPropertiesCookie is a cookie used only for ListProviderProperties requests.
   4567 type ListProviderPropertiesCookie struct {
   4568 	*xgb.Cookie
   4569 }
   4570 
   4571 // ListProviderProperties sends a checked request.
   4572 // If an error occurs, it will be returned with the reply by calling ListProviderPropertiesCookie.Reply()
   4573 func ListProviderProperties(c *xgb.Conn, Provider Provider) ListProviderPropertiesCookie {
   4574 	c.ExtLock.RLock()
   4575 	defer c.ExtLock.RUnlock()
   4576 	if _, ok := c.Extensions["RANDR"]; !ok {
   4577 		panic("Cannot issue request 'ListProviderProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4578 	}
   4579 	cookie := c.NewCookie(true, true)
   4580 	c.NewRequest(listProviderPropertiesRequest(c, Provider), cookie)
   4581 	return ListProviderPropertiesCookie{cookie}
   4582 }
   4583 
   4584 // ListProviderPropertiesUnchecked sends an unchecked request.
   4585 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   4586 func ListProviderPropertiesUnchecked(c *xgb.Conn, Provider Provider) ListProviderPropertiesCookie {
   4587 	c.ExtLock.RLock()
   4588 	defer c.ExtLock.RUnlock()
   4589 	if _, ok := c.Extensions["RANDR"]; !ok {
   4590 		panic("Cannot issue request 'ListProviderProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4591 	}
   4592 	cookie := c.NewCookie(false, true)
   4593 	c.NewRequest(listProviderPropertiesRequest(c, Provider), cookie)
   4594 	return ListProviderPropertiesCookie{cookie}
   4595 }
   4596 
   4597 // ListProviderPropertiesReply represents the data returned from a ListProviderProperties request.
   4598 type ListProviderPropertiesReply struct {
   4599 	Sequence uint16 // sequence number of the request for this reply
   4600 	Length   uint32 // number of bytes in this reply
   4601 	// padding: 1 bytes
   4602 	NumAtoms uint16
   4603 	// padding: 22 bytes
   4604 	Atoms []xproto.Atom // size: xgb.Pad((int(NumAtoms) * 4))
   4605 }
   4606 
   4607 // Reply blocks and returns the reply data for a ListProviderProperties request.
   4608 func (cook ListProviderPropertiesCookie) Reply() (*ListProviderPropertiesReply, error) {
   4609 	buf, err := cook.Cookie.Reply()
   4610 	if err != nil {
   4611 		return nil, err
   4612 	}
   4613 	if buf == nil {
   4614 		return nil, nil
   4615 	}
   4616 	return listProviderPropertiesReply(buf), nil
   4617 }
   4618 
   4619 // listProviderPropertiesReply reads a byte slice into a ListProviderPropertiesReply value.
   4620 func listProviderPropertiesReply(buf []byte) *ListProviderPropertiesReply {
   4621 	v := new(ListProviderPropertiesReply)
   4622 	b := 1 // skip reply determinant
   4623 
   4624 	b += 1 // padding
   4625 
   4626 	v.Sequence = xgb.Get16(buf[b:])
   4627 	b += 2
   4628 
   4629 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   4630 	b += 4
   4631 
   4632 	v.NumAtoms = xgb.Get16(buf[b:])
   4633 	b += 2
   4634 
   4635 	b += 22 // padding
   4636 
   4637 	v.Atoms = make([]xproto.Atom, v.NumAtoms)
   4638 	for i := 0; i < int(v.NumAtoms); i++ {
   4639 		v.Atoms[i] = xproto.Atom(xgb.Get32(buf[b:]))
   4640 		b += 4
   4641 	}
   4642 
   4643 	return v
   4644 }
   4645 
   4646 // Write request to wire for ListProviderProperties
   4647 // listProviderPropertiesRequest writes a ListProviderProperties request to a byte slice.
   4648 func listProviderPropertiesRequest(c *xgb.Conn, Provider Provider) []byte {
   4649 	size := 8
   4650 	b := 0
   4651 	buf := make([]byte, size)
   4652 
   4653 	c.ExtLock.RLock()
   4654 	buf[b] = c.Extensions["RANDR"]
   4655 	c.ExtLock.RUnlock()
   4656 	b += 1
   4657 
   4658 	buf[b] = 36 // request opcode
   4659 	b += 1
   4660 
   4661 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   4662 	b += 2
   4663 
   4664 	xgb.Put32(buf[b:], uint32(Provider))
   4665 	b += 4
   4666 
   4667 	return buf
   4668 }
   4669 
   4670 // QueryOutputPropertyCookie is a cookie used only for QueryOutputProperty requests.
   4671 type QueryOutputPropertyCookie struct {
   4672 	*xgb.Cookie
   4673 }
   4674 
   4675 // QueryOutputProperty sends a checked request.
   4676 // If an error occurs, it will be returned with the reply by calling QueryOutputPropertyCookie.Reply()
   4677 func QueryOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) QueryOutputPropertyCookie {
   4678 	c.ExtLock.RLock()
   4679 	defer c.ExtLock.RUnlock()
   4680 	if _, ok := c.Extensions["RANDR"]; !ok {
   4681 		panic("Cannot issue request 'QueryOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4682 	}
   4683 	cookie := c.NewCookie(true, true)
   4684 	c.NewRequest(queryOutputPropertyRequest(c, Output, Property), cookie)
   4685 	return QueryOutputPropertyCookie{cookie}
   4686 }
   4687 
   4688 // QueryOutputPropertyUnchecked sends an unchecked request.
   4689 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   4690 func QueryOutputPropertyUnchecked(c *xgb.Conn, Output Output, Property xproto.Atom) QueryOutputPropertyCookie {
   4691 	c.ExtLock.RLock()
   4692 	defer c.ExtLock.RUnlock()
   4693 	if _, ok := c.Extensions["RANDR"]; !ok {
   4694 		panic("Cannot issue request 'QueryOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4695 	}
   4696 	cookie := c.NewCookie(false, true)
   4697 	c.NewRequest(queryOutputPropertyRequest(c, Output, Property), cookie)
   4698 	return QueryOutputPropertyCookie{cookie}
   4699 }
   4700 
   4701 // QueryOutputPropertyReply represents the data returned from a QueryOutputProperty request.
   4702 type QueryOutputPropertyReply struct {
   4703 	Sequence uint16 // sequence number of the request for this reply
   4704 	Length   uint32 // number of bytes in this reply
   4705 	// padding: 1 bytes
   4706 	Pending   bool
   4707 	Range     bool
   4708 	Immutable bool
   4709 	// padding: 21 bytes
   4710 	ValidValues []int32 // size: xgb.Pad((int(Length) * 4))
   4711 }
   4712 
   4713 // Reply blocks and returns the reply data for a QueryOutputProperty request.
   4714 func (cook QueryOutputPropertyCookie) Reply() (*QueryOutputPropertyReply, error) {
   4715 	buf, err := cook.Cookie.Reply()
   4716 	if err != nil {
   4717 		return nil, err
   4718 	}
   4719 	if buf == nil {
   4720 		return nil, nil
   4721 	}
   4722 	return queryOutputPropertyReply(buf), nil
   4723 }
   4724 
   4725 // queryOutputPropertyReply reads a byte slice into a QueryOutputPropertyReply value.
   4726 func queryOutputPropertyReply(buf []byte) *QueryOutputPropertyReply {
   4727 	v := new(QueryOutputPropertyReply)
   4728 	b := 1 // skip reply determinant
   4729 
   4730 	b += 1 // padding
   4731 
   4732 	v.Sequence = xgb.Get16(buf[b:])
   4733 	b += 2
   4734 
   4735 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   4736 	b += 4
   4737 
   4738 	if buf[b] == 1 {
   4739 		v.Pending = true
   4740 	} else {
   4741 		v.Pending = false
   4742 	}
   4743 	b += 1
   4744 
   4745 	if buf[b] == 1 {
   4746 		v.Range = true
   4747 	} else {
   4748 		v.Range = false
   4749 	}
   4750 	b += 1
   4751 
   4752 	if buf[b] == 1 {
   4753 		v.Immutable = true
   4754 	} else {
   4755 		v.Immutable = false
   4756 	}
   4757 	b += 1
   4758 
   4759 	b += 21 // padding
   4760 
   4761 	v.ValidValues = make([]int32, v.Length)
   4762 	for i := 0; i < int(v.Length); i++ {
   4763 		v.ValidValues[i] = int32(xgb.Get32(buf[b:]))
   4764 		b += 4
   4765 	}
   4766 
   4767 	return v
   4768 }
   4769 
   4770 // Write request to wire for QueryOutputProperty
   4771 // queryOutputPropertyRequest writes a QueryOutputProperty request to a byte slice.
   4772 func queryOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom) []byte {
   4773 	size := 12
   4774 	b := 0
   4775 	buf := make([]byte, size)
   4776 
   4777 	c.ExtLock.RLock()
   4778 	buf[b] = c.Extensions["RANDR"]
   4779 	c.ExtLock.RUnlock()
   4780 	b += 1
   4781 
   4782 	buf[b] = 11 // request opcode
   4783 	b += 1
   4784 
   4785 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   4786 	b += 2
   4787 
   4788 	xgb.Put32(buf[b:], uint32(Output))
   4789 	b += 4
   4790 
   4791 	xgb.Put32(buf[b:], uint32(Property))
   4792 	b += 4
   4793 
   4794 	return buf
   4795 }
   4796 
   4797 // QueryProviderPropertyCookie is a cookie used only for QueryProviderProperty requests.
   4798 type QueryProviderPropertyCookie struct {
   4799 	*xgb.Cookie
   4800 }
   4801 
   4802 // QueryProviderProperty sends a checked request.
   4803 // If an error occurs, it will be returned with the reply by calling QueryProviderPropertyCookie.Reply()
   4804 func QueryProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom) QueryProviderPropertyCookie {
   4805 	c.ExtLock.RLock()
   4806 	defer c.ExtLock.RUnlock()
   4807 	if _, ok := c.Extensions["RANDR"]; !ok {
   4808 		panic("Cannot issue request 'QueryProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4809 	}
   4810 	cookie := c.NewCookie(true, true)
   4811 	c.NewRequest(queryProviderPropertyRequest(c, Provider, Property), cookie)
   4812 	return QueryProviderPropertyCookie{cookie}
   4813 }
   4814 
   4815 // QueryProviderPropertyUnchecked sends an unchecked request.
   4816 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   4817 func QueryProviderPropertyUnchecked(c *xgb.Conn, Provider Provider, Property xproto.Atom) QueryProviderPropertyCookie {
   4818 	c.ExtLock.RLock()
   4819 	defer c.ExtLock.RUnlock()
   4820 	if _, ok := c.Extensions["RANDR"]; !ok {
   4821 		panic("Cannot issue request 'QueryProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4822 	}
   4823 	cookie := c.NewCookie(false, true)
   4824 	c.NewRequest(queryProviderPropertyRequest(c, Provider, Property), cookie)
   4825 	return QueryProviderPropertyCookie{cookie}
   4826 }
   4827 
   4828 // QueryProviderPropertyReply represents the data returned from a QueryProviderProperty request.
   4829 type QueryProviderPropertyReply struct {
   4830 	Sequence uint16 // sequence number of the request for this reply
   4831 	Length   uint32 // number of bytes in this reply
   4832 	// padding: 1 bytes
   4833 	Pending   bool
   4834 	Range     bool
   4835 	Immutable bool
   4836 	// padding: 21 bytes
   4837 	ValidValues []int32 // size: xgb.Pad((int(Length) * 4))
   4838 }
   4839 
   4840 // Reply blocks and returns the reply data for a QueryProviderProperty request.
   4841 func (cook QueryProviderPropertyCookie) Reply() (*QueryProviderPropertyReply, error) {
   4842 	buf, err := cook.Cookie.Reply()
   4843 	if err != nil {
   4844 		return nil, err
   4845 	}
   4846 	if buf == nil {
   4847 		return nil, nil
   4848 	}
   4849 	return queryProviderPropertyReply(buf), nil
   4850 }
   4851 
   4852 // queryProviderPropertyReply reads a byte slice into a QueryProviderPropertyReply value.
   4853 func queryProviderPropertyReply(buf []byte) *QueryProviderPropertyReply {
   4854 	v := new(QueryProviderPropertyReply)
   4855 	b := 1 // skip reply determinant
   4856 
   4857 	b += 1 // padding
   4858 
   4859 	v.Sequence = xgb.Get16(buf[b:])
   4860 	b += 2
   4861 
   4862 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   4863 	b += 4
   4864 
   4865 	if buf[b] == 1 {
   4866 		v.Pending = true
   4867 	} else {
   4868 		v.Pending = false
   4869 	}
   4870 	b += 1
   4871 
   4872 	if buf[b] == 1 {
   4873 		v.Range = true
   4874 	} else {
   4875 		v.Range = false
   4876 	}
   4877 	b += 1
   4878 
   4879 	if buf[b] == 1 {
   4880 		v.Immutable = true
   4881 	} else {
   4882 		v.Immutable = false
   4883 	}
   4884 	b += 1
   4885 
   4886 	b += 21 // padding
   4887 
   4888 	v.ValidValues = make([]int32, v.Length)
   4889 	for i := 0; i < int(v.Length); i++ {
   4890 		v.ValidValues[i] = int32(xgb.Get32(buf[b:]))
   4891 		b += 4
   4892 	}
   4893 
   4894 	return v
   4895 }
   4896 
   4897 // Write request to wire for QueryProviderProperty
   4898 // queryProviderPropertyRequest writes a QueryProviderProperty request to a byte slice.
   4899 func queryProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property xproto.Atom) []byte {
   4900 	size := 12
   4901 	b := 0
   4902 	buf := make([]byte, size)
   4903 
   4904 	c.ExtLock.RLock()
   4905 	buf[b] = c.Extensions["RANDR"]
   4906 	c.ExtLock.RUnlock()
   4907 	b += 1
   4908 
   4909 	buf[b] = 37 // request opcode
   4910 	b += 1
   4911 
   4912 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   4913 	b += 2
   4914 
   4915 	xgb.Put32(buf[b:], uint32(Provider))
   4916 	b += 4
   4917 
   4918 	xgb.Put32(buf[b:], uint32(Property))
   4919 	b += 4
   4920 
   4921 	return buf
   4922 }
   4923 
   4924 // QueryVersionCookie is a cookie used only for QueryVersion requests.
   4925 type QueryVersionCookie struct {
   4926 	*xgb.Cookie
   4927 }
   4928 
   4929 // QueryVersion sends a checked request.
   4930 // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
   4931 func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie {
   4932 	c.ExtLock.RLock()
   4933 	defer c.ExtLock.RUnlock()
   4934 	if _, ok := c.Extensions["RANDR"]; !ok {
   4935 		panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4936 	}
   4937 	cookie := c.NewCookie(true, true)
   4938 	c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
   4939 	return QueryVersionCookie{cookie}
   4940 }
   4941 
   4942 // QueryVersionUnchecked sends an unchecked request.
   4943 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   4944 func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie {
   4945 	c.ExtLock.RLock()
   4946 	defer c.ExtLock.RUnlock()
   4947 	if _, ok := c.Extensions["RANDR"]; !ok {
   4948 		panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   4949 	}
   4950 	cookie := c.NewCookie(false, true)
   4951 	c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
   4952 	return QueryVersionCookie{cookie}
   4953 }
   4954 
   4955 // QueryVersionReply represents the data returned from a QueryVersion request.
   4956 type QueryVersionReply struct {
   4957 	Sequence uint16 // sequence number of the request for this reply
   4958 	Length   uint32 // number of bytes in this reply
   4959 	// padding: 1 bytes
   4960 	MajorVersion uint32
   4961 	MinorVersion uint32
   4962 	// padding: 16 bytes
   4963 }
   4964 
   4965 // Reply blocks and returns the reply data for a QueryVersion request.
   4966 func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
   4967 	buf, err := cook.Cookie.Reply()
   4968 	if err != nil {
   4969 		return nil, err
   4970 	}
   4971 	if buf == nil {
   4972 		return nil, nil
   4973 	}
   4974 	return queryVersionReply(buf), nil
   4975 }
   4976 
   4977 // queryVersionReply reads a byte slice into a QueryVersionReply value.
   4978 func queryVersionReply(buf []byte) *QueryVersionReply {
   4979 	v := new(QueryVersionReply)
   4980 	b := 1 // skip reply determinant
   4981 
   4982 	b += 1 // padding
   4983 
   4984 	v.Sequence = xgb.Get16(buf[b:])
   4985 	b += 2
   4986 
   4987 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   4988 	b += 4
   4989 
   4990 	v.MajorVersion = xgb.Get32(buf[b:])
   4991 	b += 4
   4992 
   4993 	v.MinorVersion = xgb.Get32(buf[b:])
   4994 	b += 4
   4995 
   4996 	b += 16 // padding
   4997 
   4998 	return v
   4999 }
   5000 
   5001 // Write request to wire for QueryVersion
   5002 // queryVersionRequest writes a QueryVersion request to a byte slice.
   5003 func queryVersionRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) []byte {
   5004 	size := 12
   5005 	b := 0
   5006 	buf := make([]byte, size)
   5007 
   5008 	c.ExtLock.RLock()
   5009 	buf[b] = c.Extensions["RANDR"]
   5010 	c.ExtLock.RUnlock()
   5011 	b += 1
   5012 
   5013 	buf[b] = 0 // request opcode
   5014 	b += 1
   5015 
   5016 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   5017 	b += 2
   5018 
   5019 	xgb.Put32(buf[b:], MajorVersion)
   5020 	b += 4
   5021 
   5022 	xgb.Put32(buf[b:], MinorVersion)
   5023 	b += 4
   5024 
   5025 	return buf
   5026 }
   5027 
   5028 // SelectInputCookie is a cookie used only for SelectInput requests.
   5029 type SelectInputCookie struct {
   5030 	*xgb.Cookie
   5031 }
   5032 
   5033 // SelectInput sends an unchecked request.
   5034 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5035 func SelectInput(c *xgb.Conn, Window xproto.Window, Enable uint16) SelectInputCookie {
   5036 	c.ExtLock.RLock()
   5037 	defer c.ExtLock.RUnlock()
   5038 	if _, ok := c.Extensions["RANDR"]; !ok {
   5039 		panic("Cannot issue request 'SelectInput' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5040 	}
   5041 	cookie := c.NewCookie(false, false)
   5042 	c.NewRequest(selectInputRequest(c, Window, Enable), cookie)
   5043 	return SelectInputCookie{cookie}
   5044 }
   5045 
   5046 // SelectInputChecked sends a checked request.
   5047 // If an error occurs, it can be retrieved using SelectInputCookie.Check()
   5048 func SelectInputChecked(c *xgb.Conn, Window xproto.Window, Enable uint16) SelectInputCookie {
   5049 	c.ExtLock.RLock()
   5050 	defer c.ExtLock.RUnlock()
   5051 	if _, ok := c.Extensions["RANDR"]; !ok {
   5052 		panic("Cannot issue request 'SelectInput' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5053 	}
   5054 	cookie := c.NewCookie(true, false)
   5055 	c.NewRequest(selectInputRequest(c, Window, Enable), cookie)
   5056 	return SelectInputCookie{cookie}
   5057 }
   5058 
   5059 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   5060 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   5061 func (cook SelectInputCookie) Check() error {
   5062 	return cook.Cookie.Check()
   5063 }
   5064 
   5065 // Write request to wire for SelectInput
   5066 // selectInputRequest writes a SelectInput request to a byte slice.
   5067 func selectInputRequest(c *xgb.Conn, Window xproto.Window, Enable uint16) []byte {
   5068 	size := 12
   5069 	b := 0
   5070 	buf := make([]byte, size)
   5071 
   5072 	c.ExtLock.RLock()
   5073 	buf[b] = c.Extensions["RANDR"]
   5074 	c.ExtLock.RUnlock()
   5075 	b += 1
   5076 
   5077 	buf[b] = 4 // request opcode
   5078 	b += 1
   5079 
   5080 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   5081 	b += 2
   5082 
   5083 	xgb.Put32(buf[b:], uint32(Window))
   5084 	b += 4
   5085 
   5086 	xgb.Put16(buf[b:], Enable)
   5087 	b += 2
   5088 
   5089 	b += 2 // padding
   5090 
   5091 	return buf
   5092 }
   5093 
   5094 // SetCrtcConfigCookie is a cookie used only for SetCrtcConfig requests.
   5095 type SetCrtcConfigCookie struct {
   5096 	*xgb.Cookie
   5097 }
   5098 
   5099 // SetCrtcConfig sends a checked request.
   5100 // If an error occurs, it will be returned with the reply by calling SetCrtcConfigCookie.Reply()
   5101 func SetCrtcConfig(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) SetCrtcConfigCookie {
   5102 	c.ExtLock.RLock()
   5103 	defer c.ExtLock.RUnlock()
   5104 	if _, ok := c.Extensions["RANDR"]; !ok {
   5105 		panic("Cannot issue request 'SetCrtcConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5106 	}
   5107 	cookie := c.NewCookie(true, true)
   5108 	c.NewRequest(setCrtcConfigRequest(c, Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie)
   5109 	return SetCrtcConfigCookie{cookie}
   5110 }
   5111 
   5112 // SetCrtcConfigUnchecked sends an unchecked request.
   5113 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5114 func SetCrtcConfigUnchecked(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) SetCrtcConfigCookie {
   5115 	c.ExtLock.RLock()
   5116 	defer c.ExtLock.RUnlock()
   5117 	if _, ok := c.Extensions["RANDR"]; !ok {
   5118 		panic("Cannot issue request 'SetCrtcConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5119 	}
   5120 	cookie := c.NewCookie(false, true)
   5121 	c.NewRequest(setCrtcConfigRequest(c, Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie)
   5122 	return SetCrtcConfigCookie{cookie}
   5123 }
   5124 
   5125 // SetCrtcConfigReply represents the data returned from a SetCrtcConfig request.
   5126 type SetCrtcConfigReply struct {
   5127 	Sequence  uint16 // sequence number of the request for this reply
   5128 	Length    uint32 // number of bytes in this reply
   5129 	Status    byte
   5130 	Timestamp xproto.Timestamp
   5131 	// padding: 20 bytes
   5132 }
   5133 
   5134 // Reply blocks and returns the reply data for a SetCrtcConfig request.
   5135 func (cook SetCrtcConfigCookie) Reply() (*SetCrtcConfigReply, error) {
   5136 	buf, err := cook.Cookie.Reply()
   5137 	if err != nil {
   5138 		return nil, err
   5139 	}
   5140 	if buf == nil {
   5141 		return nil, nil
   5142 	}
   5143 	return setCrtcConfigReply(buf), nil
   5144 }
   5145 
   5146 // setCrtcConfigReply reads a byte slice into a SetCrtcConfigReply value.
   5147 func setCrtcConfigReply(buf []byte) *SetCrtcConfigReply {
   5148 	v := new(SetCrtcConfigReply)
   5149 	b := 1 // skip reply determinant
   5150 
   5151 	v.Status = buf[b]
   5152 	b += 1
   5153 
   5154 	v.Sequence = xgb.Get16(buf[b:])
   5155 	b += 2
   5156 
   5157 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   5158 	b += 4
   5159 
   5160 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   5161 	b += 4
   5162 
   5163 	b += 20 // padding
   5164 
   5165 	return v
   5166 }
   5167 
   5168 // Write request to wire for SetCrtcConfig
   5169 // setCrtcConfigRequest writes a SetCrtcConfig request to a byte slice.
   5170 func setCrtcConfigRequest(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) []byte {
   5171 	size := xgb.Pad((28 + xgb.Pad((len(Outputs) * 4))))
   5172 	b := 0
   5173 	buf := make([]byte, size)
   5174 
   5175 	c.ExtLock.RLock()
   5176 	buf[b] = c.Extensions["RANDR"]
   5177 	c.ExtLock.RUnlock()
   5178 	b += 1
   5179 
   5180 	buf[b] = 21 // request opcode
   5181 	b += 1
   5182 
   5183 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   5184 	b += 2
   5185 
   5186 	xgb.Put32(buf[b:], uint32(Crtc))
   5187 	b += 4
   5188 
   5189 	xgb.Put32(buf[b:], uint32(Timestamp))
   5190 	b += 4
   5191 
   5192 	xgb.Put32(buf[b:], uint32(ConfigTimestamp))
   5193 	b += 4
   5194 
   5195 	xgb.Put16(buf[b:], uint16(X))
   5196 	b += 2
   5197 
   5198 	xgb.Put16(buf[b:], uint16(Y))
   5199 	b += 2
   5200 
   5201 	xgb.Put32(buf[b:], uint32(Mode))
   5202 	b += 4
   5203 
   5204 	xgb.Put16(buf[b:], Rotation)
   5205 	b += 2
   5206 
   5207 	b += 2 // padding
   5208 
   5209 	for i := 0; i < int(len(Outputs)); i++ {
   5210 		xgb.Put32(buf[b:], uint32(Outputs[i]))
   5211 		b += 4
   5212 	}
   5213 
   5214 	return buf
   5215 }
   5216 
   5217 // SetCrtcGammaCookie is a cookie used only for SetCrtcGamma requests.
   5218 type SetCrtcGammaCookie struct {
   5219 	*xgb.Cookie
   5220 }
   5221 
   5222 // SetCrtcGamma sends an unchecked request.
   5223 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5224 func SetCrtcGamma(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetCrtcGammaCookie {
   5225 	c.ExtLock.RLock()
   5226 	defer c.ExtLock.RUnlock()
   5227 	if _, ok := c.Extensions["RANDR"]; !ok {
   5228 		panic("Cannot issue request 'SetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5229 	}
   5230 	cookie := c.NewCookie(false, false)
   5231 	c.NewRequest(setCrtcGammaRequest(c, Crtc, Size, Red, Green, Blue), cookie)
   5232 	return SetCrtcGammaCookie{cookie}
   5233 }
   5234 
   5235 // SetCrtcGammaChecked sends a checked request.
   5236 // If an error occurs, it can be retrieved using SetCrtcGammaCookie.Check()
   5237 func SetCrtcGammaChecked(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetCrtcGammaCookie {
   5238 	c.ExtLock.RLock()
   5239 	defer c.ExtLock.RUnlock()
   5240 	if _, ok := c.Extensions["RANDR"]; !ok {
   5241 		panic("Cannot issue request 'SetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5242 	}
   5243 	cookie := c.NewCookie(true, false)
   5244 	c.NewRequest(setCrtcGammaRequest(c, Crtc, Size, Red, Green, Blue), cookie)
   5245 	return SetCrtcGammaCookie{cookie}
   5246 }
   5247 
   5248 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   5249 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   5250 func (cook SetCrtcGammaCookie) Check() error {
   5251 	return cook.Cookie.Check()
   5252 }
   5253 
   5254 // Write request to wire for SetCrtcGamma
   5255 // setCrtcGammaRequest writes a SetCrtcGamma request to a byte slice.
   5256 func setCrtcGammaRequest(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) []byte {
   5257 	size := xgb.Pad((((((12 + xgb.Pad((int(Size) * 2))) + 2) + xgb.Pad((int(Size) * 2))) + 2) + xgb.Pad((int(Size) * 2))))
   5258 	b := 0
   5259 	buf := make([]byte, size)
   5260 
   5261 	c.ExtLock.RLock()
   5262 	buf[b] = c.Extensions["RANDR"]
   5263 	c.ExtLock.RUnlock()
   5264 	b += 1
   5265 
   5266 	buf[b] = 24 // request opcode
   5267 	b += 1
   5268 
   5269 	blen := b
   5270 	b += 2
   5271 
   5272 	xgb.Put32(buf[b:], uint32(Crtc))
   5273 	b += 4
   5274 
   5275 	xgb.Put16(buf[b:], Size)
   5276 	b += 2
   5277 
   5278 	b += 2 // padding
   5279 
   5280 	for i := 0; i < int(Size); i++ {
   5281 		xgb.Put16(buf[b:], Red[i])
   5282 		b += 2
   5283 	}
   5284 
   5285 	b = (b + 1) & ^1 // alignment gap
   5286 
   5287 	for i := 0; i < int(Size); i++ {
   5288 		xgb.Put16(buf[b:], Green[i])
   5289 		b += 2
   5290 	}
   5291 
   5292 	b = (b + 1) & ^1 // alignment gap
   5293 
   5294 	for i := 0; i < int(Size); i++ {
   5295 		xgb.Put16(buf[b:], Blue[i])
   5296 		b += 2
   5297 	}
   5298 
   5299 	b = xgb.Pad(b)
   5300 	xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units
   5301 	return buf[:b]
   5302 }
   5303 
   5304 // SetCrtcTransformCookie is a cookie used only for SetCrtcTransform requests.
   5305 type SetCrtcTransformCookie struct {
   5306 	*xgb.Cookie
   5307 }
   5308 
   5309 // SetCrtcTransform sends an unchecked request.
   5310 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5311 func SetCrtcTransform(c *xgb.Conn, Crtc Crtc, Transform render.Transform, FilterLen uint16, FilterName string, FilterParams []render.Fixed) SetCrtcTransformCookie {
   5312 	c.ExtLock.RLock()
   5313 	defer c.ExtLock.RUnlock()
   5314 	if _, ok := c.Extensions["RANDR"]; !ok {
   5315 		panic("Cannot issue request 'SetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5316 	}
   5317 	cookie := c.NewCookie(false, false)
   5318 	c.NewRequest(setCrtcTransformRequest(c, Crtc, Transform, FilterLen, FilterName, FilterParams), cookie)
   5319 	return SetCrtcTransformCookie{cookie}
   5320 }
   5321 
   5322 // SetCrtcTransformChecked sends a checked request.
   5323 // If an error occurs, it can be retrieved using SetCrtcTransformCookie.Check()
   5324 func SetCrtcTransformChecked(c *xgb.Conn, Crtc Crtc, Transform render.Transform, FilterLen uint16, FilterName string, FilterParams []render.Fixed) SetCrtcTransformCookie {
   5325 	c.ExtLock.RLock()
   5326 	defer c.ExtLock.RUnlock()
   5327 	if _, ok := c.Extensions["RANDR"]; !ok {
   5328 		panic("Cannot issue request 'SetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5329 	}
   5330 	cookie := c.NewCookie(true, false)
   5331 	c.NewRequest(setCrtcTransformRequest(c, Crtc, Transform, FilterLen, FilterName, FilterParams), cookie)
   5332 	return SetCrtcTransformCookie{cookie}
   5333 }
   5334 
   5335 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   5336 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   5337 func (cook SetCrtcTransformCookie) Check() error {
   5338 	return cook.Cookie.Check()
   5339 }
   5340 
   5341 // Write request to wire for SetCrtcTransform
   5342 // setCrtcTransformRequest writes a SetCrtcTransform request to a byte slice.
   5343 func setCrtcTransformRequest(c *xgb.Conn, Crtc Crtc, Transform render.Transform, FilterLen uint16, FilterName string, FilterParams []render.Fixed) []byte {
   5344 	size := xgb.Pad((((48 + xgb.Pad((int(FilterLen) * 1))) + 4) + xgb.Pad((len(FilterParams) * 4))))
   5345 	b := 0
   5346 	buf := make([]byte, size)
   5347 
   5348 	c.ExtLock.RLock()
   5349 	buf[b] = c.Extensions["RANDR"]
   5350 	c.ExtLock.RUnlock()
   5351 	b += 1
   5352 
   5353 	buf[b] = 26 // request opcode
   5354 	b += 1
   5355 
   5356 	blen := b
   5357 	b += 2
   5358 
   5359 	xgb.Put32(buf[b:], uint32(Crtc))
   5360 	b += 4
   5361 
   5362 	{
   5363 		structBytes := Transform.Bytes()
   5364 		copy(buf[b:], structBytes)
   5365 		b += len(structBytes)
   5366 	}
   5367 
   5368 	xgb.Put16(buf[b:], FilterLen)
   5369 	b += 2
   5370 
   5371 	b += 2 // padding
   5372 
   5373 	copy(buf[b:], FilterName[:FilterLen])
   5374 	b += int(FilterLen)
   5375 
   5376 	b = (b + 3) & ^3 // alignment gap
   5377 
   5378 	for i := 0; i < int(len(FilterParams)); i++ {
   5379 		xgb.Put32(buf[b:], uint32(FilterParams[i]))
   5380 		b += 4
   5381 	}
   5382 
   5383 	b = xgb.Pad(b)
   5384 	xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units
   5385 	return buf[:b]
   5386 }
   5387 
   5388 // SetOutputPrimaryCookie is a cookie used only for SetOutputPrimary requests.
   5389 type SetOutputPrimaryCookie struct {
   5390 	*xgb.Cookie
   5391 }
   5392 
   5393 // SetOutputPrimary sends an unchecked request.
   5394 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5395 func SetOutputPrimary(c *xgb.Conn, Window xproto.Window, Output Output) SetOutputPrimaryCookie {
   5396 	c.ExtLock.RLock()
   5397 	defer c.ExtLock.RUnlock()
   5398 	if _, ok := c.Extensions["RANDR"]; !ok {
   5399 		panic("Cannot issue request 'SetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5400 	}
   5401 	cookie := c.NewCookie(false, false)
   5402 	c.NewRequest(setOutputPrimaryRequest(c, Window, Output), cookie)
   5403 	return SetOutputPrimaryCookie{cookie}
   5404 }
   5405 
   5406 // SetOutputPrimaryChecked sends a checked request.
   5407 // If an error occurs, it can be retrieved using SetOutputPrimaryCookie.Check()
   5408 func SetOutputPrimaryChecked(c *xgb.Conn, Window xproto.Window, Output Output) SetOutputPrimaryCookie {
   5409 	c.ExtLock.RLock()
   5410 	defer c.ExtLock.RUnlock()
   5411 	if _, ok := c.Extensions["RANDR"]; !ok {
   5412 		panic("Cannot issue request 'SetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5413 	}
   5414 	cookie := c.NewCookie(true, false)
   5415 	c.NewRequest(setOutputPrimaryRequest(c, Window, Output), cookie)
   5416 	return SetOutputPrimaryCookie{cookie}
   5417 }
   5418 
   5419 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   5420 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   5421 func (cook SetOutputPrimaryCookie) Check() error {
   5422 	return cook.Cookie.Check()
   5423 }
   5424 
   5425 // Write request to wire for SetOutputPrimary
   5426 // setOutputPrimaryRequest writes a SetOutputPrimary request to a byte slice.
   5427 func setOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window, Output Output) []byte {
   5428 	size := 12
   5429 	b := 0
   5430 	buf := make([]byte, size)
   5431 
   5432 	c.ExtLock.RLock()
   5433 	buf[b] = c.Extensions["RANDR"]
   5434 	c.ExtLock.RUnlock()
   5435 	b += 1
   5436 
   5437 	buf[b] = 30 // request opcode
   5438 	b += 1
   5439 
   5440 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   5441 	b += 2
   5442 
   5443 	xgb.Put32(buf[b:], uint32(Window))
   5444 	b += 4
   5445 
   5446 	xgb.Put32(buf[b:], uint32(Output))
   5447 	b += 4
   5448 
   5449 	return buf
   5450 }
   5451 
   5452 // SetPanningCookie is a cookie used only for SetPanning requests.
   5453 type SetPanningCookie struct {
   5454 	*xgb.Cookie
   5455 }
   5456 
   5457 // SetPanning sends a checked request.
   5458 // If an error occurs, it will be returned with the reply by calling SetPanningCookie.Reply()
   5459 func SetPanning(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) SetPanningCookie {
   5460 	c.ExtLock.RLock()
   5461 	defer c.ExtLock.RUnlock()
   5462 	if _, ok := c.Extensions["RANDR"]; !ok {
   5463 		panic("Cannot issue request 'SetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5464 	}
   5465 	cookie := c.NewCookie(true, true)
   5466 	c.NewRequest(setPanningRequest(c, Crtc, Timestamp, Left, Top, Width, Height, TrackLeft, TrackTop, TrackWidth, TrackHeight, BorderLeft, BorderTop, BorderRight, BorderBottom), cookie)
   5467 	return SetPanningCookie{cookie}
   5468 }
   5469 
   5470 // SetPanningUnchecked sends an unchecked request.
   5471 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5472 func SetPanningUnchecked(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) SetPanningCookie {
   5473 	c.ExtLock.RLock()
   5474 	defer c.ExtLock.RUnlock()
   5475 	if _, ok := c.Extensions["RANDR"]; !ok {
   5476 		panic("Cannot issue request 'SetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5477 	}
   5478 	cookie := c.NewCookie(false, true)
   5479 	c.NewRequest(setPanningRequest(c, Crtc, Timestamp, Left, Top, Width, Height, TrackLeft, TrackTop, TrackWidth, TrackHeight, BorderLeft, BorderTop, BorderRight, BorderBottom), cookie)
   5480 	return SetPanningCookie{cookie}
   5481 }
   5482 
   5483 // SetPanningReply represents the data returned from a SetPanning request.
   5484 type SetPanningReply struct {
   5485 	Sequence  uint16 // sequence number of the request for this reply
   5486 	Length    uint32 // number of bytes in this reply
   5487 	Status    byte
   5488 	Timestamp xproto.Timestamp
   5489 }
   5490 
   5491 // Reply blocks and returns the reply data for a SetPanning request.
   5492 func (cook SetPanningCookie) Reply() (*SetPanningReply, error) {
   5493 	buf, err := cook.Cookie.Reply()
   5494 	if err != nil {
   5495 		return nil, err
   5496 	}
   5497 	if buf == nil {
   5498 		return nil, nil
   5499 	}
   5500 	return setPanningReply(buf), nil
   5501 }
   5502 
   5503 // setPanningReply reads a byte slice into a SetPanningReply value.
   5504 func setPanningReply(buf []byte) *SetPanningReply {
   5505 	v := new(SetPanningReply)
   5506 	b := 1 // skip reply determinant
   5507 
   5508 	v.Status = buf[b]
   5509 	b += 1
   5510 
   5511 	v.Sequence = xgb.Get16(buf[b:])
   5512 	b += 2
   5513 
   5514 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   5515 	b += 4
   5516 
   5517 	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   5518 	b += 4
   5519 
   5520 	return v
   5521 }
   5522 
   5523 // Write request to wire for SetPanning
   5524 // setPanningRequest writes a SetPanning request to a byte slice.
   5525 func setPanningRequest(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) []byte {
   5526 	size := 36
   5527 	b := 0
   5528 	buf := make([]byte, size)
   5529 
   5530 	c.ExtLock.RLock()
   5531 	buf[b] = c.Extensions["RANDR"]
   5532 	c.ExtLock.RUnlock()
   5533 	b += 1
   5534 
   5535 	buf[b] = 29 // request opcode
   5536 	b += 1
   5537 
   5538 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   5539 	b += 2
   5540 
   5541 	xgb.Put32(buf[b:], uint32(Crtc))
   5542 	b += 4
   5543 
   5544 	xgb.Put32(buf[b:], uint32(Timestamp))
   5545 	b += 4
   5546 
   5547 	xgb.Put16(buf[b:], Left)
   5548 	b += 2
   5549 
   5550 	xgb.Put16(buf[b:], Top)
   5551 	b += 2
   5552 
   5553 	xgb.Put16(buf[b:], Width)
   5554 	b += 2
   5555 
   5556 	xgb.Put16(buf[b:], Height)
   5557 	b += 2
   5558 
   5559 	xgb.Put16(buf[b:], TrackLeft)
   5560 	b += 2
   5561 
   5562 	xgb.Put16(buf[b:], TrackTop)
   5563 	b += 2
   5564 
   5565 	xgb.Put16(buf[b:], TrackWidth)
   5566 	b += 2
   5567 
   5568 	xgb.Put16(buf[b:], TrackHeight)
   5569 	b += 2
   5570 
   5571 	xgb.Put16(buf[b:], uint16(BorderLeft))
   5572 	b += 2
   5573 
   5574 	xgb.Put16(buf[b:], uint16(BorderTop))
   5575 	b += 2
   5576 
   5577 	xgb.Put16(buf[b:], uint16(BorderRight))
   5578 	b += 2
   5579 
   5580 	xgb.Put16(buf[b:], uint16(BorderBottom))
   5581 	b += 2
   5582 
   5583 	return buf
   5584 }
   5585 
   5586 // SetProviderOffloadSinkCookie is a cookie used only for SetProviderOffloadSink requests.
   5587 type SetProviderOffloadSinkCookie struct {
   5588 	*xgb.Cookie
   5589 }
   5590 
   5591 // SetProviderOffloadSink sends an unchecked request.
   5592 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5593 func SetProviderOffloadSink(c *xgb.Conn, Provider Provider, SinkProvider Provider, ConfigTimestamp xproto.Timestamp) SetProviderOffloadSinkCookie {
   5594 	c.ExtLock.RLock()
   5595 	defer c.ExtLock.RUnlock()
   5596 	if _, ok := c.Extensions["RANDR"]; !ok {
   5597 		panic("Cannot issue request 'SetProviderOffloadSink' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5598 	}
   5599 	cookie := c.NewCookie(false, false)
   5600 	c.NewRequest(setProviderOffloadSinkRequest(c, Provider, SinkProvider, ConfigTimestamp), cookie)
   5601 	return SetProviderOffloadSinkCookie{cookie}
   5602 }
   5603 
   5604 // SetProviderOffloadSinkChecked sends a checked request.
   5605 // If an error occurs, it can be retrieved using SetProviderOffloadSinkCookie.Check()
   5606 func SetProviderOffloadSinkChecked(c *xgb.Conn, Provider Provider, SinkProvider Provider, ConfigTimestamp xproto.Timestamp) SetProviderOffloadSinkCookie {
   5607 	c.ExtLock.RLock()
   5608 	defer c.ExtLock.RUnlock()
   5609 	if _, ok := c.Extensions["RANDR"]; !ok {
   5610 		panic("Cannot issue request 'SetProviderOffloadSink' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5611 	}
   5612 	cookie := c.NewCookie(true, false)
   5613 	c.NewRequest(setProviderOffloadSinkRequest(c, Provider, SinkProvider, ConfigTimestamp), cookie)
   5614 	return SetProviderOffloadSinkCookie{cookie}
   5615 }
   5616 
   5617 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   5618 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   5619 func (cook SetProviderOffloadSinkCookie) Check() error {
   5620 	return cook.Cookie.Check()
   5621 }
   5622 
   5623 // Write request to wire for SetProviderOffloadSink
   5624 // setProviderOffloadSinkRequest writes a SetProviderOffloadSink request to a byte slice.
   5625 func setProviderOffloadSinkRequest(c *xgb.Conn, Provider Provider, SinkProvider Provider, ConfigTimestamp xproto.Timestamp) []byte {
   5626 	size := 16
   5627 	b := 0
   5628 	buf := make([]byte, size)
   5629 
   5630 	c.ExtLock.RLock()
   5631 	buf[b] = c.Extensions["RANDR"]
   5632 	c.ExtLock.RUnlock()
   5633 	b += 1
   5634 
   5635 	buf[b] = 34 // request opcode
   5636 	b += 1
   5637 
   5638 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   5639 	b += 2
   5640 
   5641 	xgb.Put32(buf[b:], uint32(Provider))
   5642 	b += 4
   5643 
   5644 	xgb.Put32(buf[b:], uint32(SinkProvider))
   5645 	b += 4
   5646 
   5647 	xgb.Put32(buf[b:], uint32(ConfigTimestamp))
   5648 	b += 4
   5649 
   5650 	return buf
   5651 }
   5652 
   5653 // SetProviderOutputSourceCookie is a cookie used only for SetProviderOutputSource requests.
   5654 type SetProviderOutputSourceCookie struct {
   5655 	*xgb.Cookie
   5656 }
   5657 
   5658 // SetProviderOutputSource sends an unchecked request.
   5659 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5660 func SetProviderOutputSource(c *xgb.Conn, Provider Provider, SourceProvider Provider, ConfigTimestamp xproto.Timestamp) SetProviderOutputSourceCookie {
   5661 	c.ExtLock.RLock()
   5662 	defer c.ExtLock.RUnlock()
   5663 	if _, ok := c.Extensions["RANDR"]; !ok {
   5664 		panic("Cannot issue request 'SetProviderOutputSource' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5665 	}
   5666 	cookie := c.NewCookie(false, false)
   5667 	c.NewRequest(setProviderOutputSourceRequest(c, Provider, SourceProvider, ConfigTimestamp), cookie)
   5668 	return SetProviderOutputSourceCookie{cookie}
   5669 }
   5670 
   5671 // SetProviderOutputSourceChecked sends a checked request.
   5672 // If an error occurs, it can be retrieved using SetProviderOutputSourceCookie.Check()
   5673 func SetProviderOutputSourceChecked(c *xgb.Conn, Provider Provider, SourceProvider Provider, ConfigTimestamp xproto.Timestamp) SetProviderOutputSourceCookie {
   5674 	c.ExtLock.RLock()
   5675 	defer c.ExtLock.RUnlock()
   5676 	if _, ok := c.Extensions["RANDR"]; !ok {
   5677 		panic("Cannot issue request 'SetProviderOutputSource' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5678 	}
   5679 	cookie := c.NewCookie(true, false)
   5680 	c.NewRequest(setProviderOutputSourceRequest(c, Provider, SourceProvider, ConfigTimestamp), cookie)
   5681 	return SetProviderOutputSourceCookie{cookie}
   5682 }
   5683 
   5684 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   5685 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   5686 func (cook SetProviderOutputSourceCookie) Check() error {
   5687 	return cook.Cookie.Check()
   5688 }
   5689 
   5690 // Write request to wire for SetProviderOutputSource
   5691 // setProviderOutputSourceRequest writes a SetProviderOutputSource request to a byte slice.
   5692 func setProviderOutputSourceRequest(c *xgb.Conn, Provider Provider, SourceProvider Provider, ConfigTimestamp xproto.Timestamp) []byte {
   5693 	size := 16
   5694 	b := 0
   5695 	buf := make([]byte, size)
   5696 
   5697 	c.ExtLock.RLock()
   5698 	buf[b] = c.Extensions["RANDR"]
   5699 	c.ExtLock.RUnlock()
   5700 	b += 1
   5701 
   5702 	buf[b] = 35 // request opcode
   5703 	b += 1
   5704 
   5705 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   5706 	b += 2
   5707 
   5708 	xgb.Put32(buf[b:], uint32(Provider))
   5709 	b += 4
   5710 
   5711 	xgb.Put32(buf[b:], uint32(SourceProvider))
   5712 	b += 4
   5713 
   5714 	xgb.Put32(buf[b:], uint32(ConfigTimestamp))
   5715 	b += 4
   5716 
   5717 	return buf
   5718 }
   5719 
   5720 // SetScreenConfigCookie is a cookie used only for SetScreenConfig requests.
   5721 type SetScreenConfigCookie struct {
   5722 	*xgb.Cookie
   5723 }
   5724 
   5725 // SetScreenConfig sends a checked request.
   5726 // If an error occurs, it will be returned with the reply by calling SetScreenConfigCookie.Reply()
   5727 func SetScreenConfig(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) SetScreenConfigCookie {
   5728 	c.ExtLock.RLock()
   5729 	defer c.ExtLock.RUnlock()
   5730 	if _, ok := c.Extensions["RANDR"]; !ok {
   5731 		panic("Cannot issue request 'SetScreenConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5732 	}
   5733 	cookie := c.NewCookie(true, true)
   5734 	c.NewRequest(setScreenConfigRequest(c, Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie)
   5735 	return SetScreenConfigCookie{cookie}
   5736 }
   5737 
   5738 // SetScreenConfigUnchecked sends an unchecked request.
   5739 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5740 func SetScreenConfigUnchecked(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) SetScreenConfigCookie {
   5741 	c.ExtLock.RLock()
   5742 	defer c.ExtLock.RUnlock()
   5743 	if _, ok := c.Extensions["RANDR"]; !ok {
   5744 		panic("Cannot issue request 'SetScreenConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5745 	}
   5746 	cookie := c.NewCookie(false, true)
   5747 	c.NewRequest(setScreenConfigRequest(c, Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie)
   5748 	return SetScreenConfigCookie{cookie}
   5749 }
   5750 
   5751 // SetScreenConfigReply represents the data returned from a SetScreenConfig request.
   5752 type SetScreenConfigReply struct {
   5753 	Sequence        uint16 // sequence number of the request for this reply
   5754 	Length          uint32 // number of bytes in this reply
   5755 	Status          byte
   5756 	NewTimestamp    xproto.Timestamp
   5757 	ConfigTimestamp xproto.Timestamp
   5758 	Root            xproto.Window
   5759 	SubpixelOrder   uint16
   5760 	// padding: 10 bytes
   5761 }
   5762 
   5763 // Reply blocks and returns the reply data for a SetScreenConfig request.
   5764 func (cook SetScreenConfigCookie) Reply() (*SetScreenConfigReply, error) {
   5765 	buf, err := cook.Cookie.Reply()
   5766 	if err != nil {
   5767 		return nil, err
   5768 	}
   5769 	if buf == nil {
   5770 		return nil, nil
   5771 	}
   5772 	return setScreenConfigReply(buf), nil
   5773 }
   5774 
   5775 // setScreenConfigReply reads a byte slice into a SetScreenConfigReply value.
   5776 func setScreenConfigReply(buf []byte) *SetScreenConfigReply {
   5777 	v := new(SetScreenConfigReply)
   5778 	b := 1 // skip reply determinant
   5779 
   5780 	v.Status = buf[b]
   5781 	b += 1
   5782 
   5783 	v.Sequence = xgb.Get16(buf[b:])
   5784 	b += 2
   5785 
   5786 	v.Length = xgb.Get32(buf[b:]) // 4-byte units
   5787 	b += 4
   5788 
   5789 	v.NewTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   5790 	b += 4
   5791 
   5792 	v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
   5793 	b += 4
   5794 
   5795 	v.Root = xproto.Window(xgb.Get32(buf[b:]))
   5796 	b += 4
   5797 
   5798 	v.SubpixelOrder = xgb.Get16(buf[b:])
   5799 	b += 2
   5800 
   5801 	b += 10 // padding
   5802 
   5803 	return v
   5804 }
   5805 
   5806 // Write request to wire for SetScreenConfig
   5807 // setScreenConfigRequest writes a SetScreenConfig request to a byte slice.
   5808 func setScreenConfigRequest(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) []byte {
   5809 	size := 24
   5810 	b := 0
   5811 	buf := make([]byte, size)
   5812 
   5813 	c.ExtLock.RLock()
   5814 	buf[b] = c.Extensions["RANDR"]
   5815 	c.ExtLock.RUnlock()
   5816 	b += 1
   5817 
   5818 	buf[b] = 2 // request opcode
   5819 	b += 1
   5820 
   5821 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   5822 	b += 2
   5823 
   5824 	xgb.Put32(buf[b:], uint32(Window))
   5825 	b += 4
   5826 
   5827 	xgb.Put32(buf[b:], uint32(Timestamp))
   5828 	b += 4
   5829 
   5830 	xgb.Put32(buf[b:], uint32(ConfigTimestamp))
   5831 	b += 4
   5832 
   5833 	xgb.Put16(buf[b:], SizeID)
   5834 	b += 2
   5835 
   5836 	xgb.Put16(buf[b:], Rotation)
   5837 	b += 2
   5838 
   5839 	xgb.Put16(buf[b:], Rate)
   5840 	b += 2
   5841 
   5842 	b += 2 // padding
   5843 
   5844 	return buf
   5845 }
   5846 
   5847 // SetScreenSizeCookie is a cookie used only for SetScreenSize requests.
   5848 type SetScreenSizeCookie struct {
   5849 	*xgb.Cookie
   5850 }
   5851 
   5852 // SetScreenSize sends an unchecked request.
   5853 // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
   5854 func SetScreenSize(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) SetScreenSizeCookie {
   5855 	c.ExtLock.RLock()
   5856 	defer c.ExtLock.RUnlock()
   5857 	if _, ok := c.Extensions["RANDR"]; !ok {
   5858 		panic("Cannot issue request 'SetScreenSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5859 	}
   5860 	cookie := c.NewCookie(false, false)
   5861 	c.NewRequest(setScreenSizeRequest(c, Window, Width, Height, MmWidth, MmHeight), cookie)
   5862 	return SetScreenSizeCookie{cookie}
   5863 }
   5864 
   5865 // SetScreenSizeChecked sends a checked request.
   5866 // If an error occurs, it can be retrieved using SetScreenSizeCookie.Check()
   5867 func SetScreenSizeChecked(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) SetScreenSizeCookie {
   5868 	c.ExtLock.RLock()
   5869 	defer c.ExtLock.RUnlock()
   5870 	if _, ok := c.Extensions["RANDR"]; !ok {
   5871 		panic("Cannot issue request 'SetScreenSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
   5872 	}
   5873 	cookie := c.NewCookie(true, false)
   5874 	c.NewRequest(setScreenSizeRequest(c, Window, Width, Height, MmWidth, MmHeight), cookie)
   5875 	return SetScreenSizeCookie{cookie}
   5876 }
   5877 
   5878 // Check returns an error if one occurred for checked requests that are not expecting a reply.
   5879 // This cannot be called for requests expecting a reply, nor for unchecked requests.
   5880 func (cook SetScreenSizeCookie) Check() error {
   5881 	return cook.Cookie.Check()
   5882 }
   5883 
   5884 // Write request to wire for SetScreenSize
   5885 // setScreenSizeRequest writes a SetScreenSize request to a byte slice.
   5886 func setScreenSizeRequest(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) []byte {
   5887 	size := 20
   5888 	b := 0
   5889 	buf := make([]byte, size)
   5890 
   5891 	c.ExtLock.RLock()
   5892 	buf[b] = c.Extensions["RANDR"]
   5893 	c.ExtLock.RUnlock()
   5894 	b += 1
   5895 
   5896 	buf[b] = 7 // request opcode
   5897 	b += 1
   5898 
   5899 	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
   5900 	b += 2
   5901 
   5902 	xgb.Put32(buf[b:], uint32(Window))
   5903 	b += 4
   5904 
   5905 	xgb.Put16(buf[b:], Width)
   5906 	b += 2
   5907 
   5908 	xgb.Put16(buf[b:], Height)
   5909 	b += 2
   5910 
   5911 	xgb.Put32(buf[b:], MmWidth)
   5912 	b += 4
   5913 
   5914 	xgb.Put32(buf[b:], MmHeight)
   5915 	b += 4
   5916 
   5917 	return buf
   5918 }