aboutsummaryrefslogtreecommitdiff
path: root/nexgb/randr/randr.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexgb/randr/randr.go')
-rw-r--r--nexgb/randr/randr.go3982
1 files changed, 1991 insertions, 1991 deletions
diff --git a/nexgb/randr/randr.go b/nexgb/randr/randr.go
index 6e2eecc..81104eb 100644
--- a/nexgb/randr/randr.go
+++ b/nexgb/randr/randr.go
@@ -2,7 +2,7 @@
package randr
/*
- This file was generated by randr.xml on Jun 5 2012 12:11:59am EDT.
+ This file was generated by randr.xml on Aug 11 2013 8:39:43pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -41,69 +41,143 @@ func init() {
xgb.NewExtErrorFuncs["RANDR"] = make(map[int]xgb.NewErrorFun)
}
-// Skipping definition for base type 'Card16'
+// BadBadCrtc is the error number for a BadBadCrtc.
+const BadBadCrtc = 1
-// Skipping definition for base type 'Char'
+type BadCrtcError struct {
+ Sequence uint16
+ NiceName string
+}
-// Skipping definition for base type 'Card32'
+// BadCrtcErrorNew constructs a BadCrtcError value that implements xgb.Error from a byte slice.
+func BadCrtcErrorNew(buf []byte) xgb.Error {
+ v := BadCrtcError{}
+ v.NiceName = "BadCrtc"
-// Skipping definition for base type 'Double'
+ b := 1 // skip error determinant
+ b += 1 // don't read error number
-// Skipping definition for base type 'Bool'
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
-// Skipping definition for base type 'Float'
+ return v
+}
-// Skipping definition for base type 'Card8'
+// SequenceId returns the sequence id attached to the BadBadCrtc error.
+// This is mostly used internally.
+func (err BadCrtcError) SequenceId() uint16 {
+ return err.Sequence
+}
-// Skipping definition for base type 'Int16'
+// BadId returns the 'BadValue' number if one exists for the BadBadCrtc error. If no bad value exists, 0 is returned.
+func (err BadCrtcError) BadId() uint32 {
+ return 0
+}
-// Skipping definition for base type 'Int32'
+// Error returns a rudimentary string representation of the BadBadCrtc error.
-// Skipping definition for base type 'Void'
+func (err BadCrtcError) Error() string {
+ fieldVals := make([]string, 0, 0)
+ fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
+ return "BadBadCrtc {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+}
-// Skipping definition for base type 'Byte'
+func init() {
+ xgb.NewExtErrorFuncs["RANDR"][1] = BadCrtcErrorNew
+}
-// Skipping definition for base type 'Int8'
+// BadBadMode is the error number for a BadBadMode.
+const BadBadMode = 2
-const (
- RotationRotate0 = 1
- RotationRotate90 = 2
- RotationRotate180 = 4
- RotationRotate270 = 8
- RotationReflectX = 16
- RotationReflectY = 32
-)
+type BadModeError struct {
+ Sequence uint16
+ NiceName string
+}
-const (
- SetConfigSuccess = 0
- SetConfigInvalidConfigTime = 1
- SetConfigInvalidTime = 2
- SetConfigFailed = 3
-)
+// BadModeErrorNew constructs a BadModeError value that implements xgb.Error from a byte slice.
+func BadModeErrorNew(buf []byte) xgb.Error {
+ v := BadModeError{}
+ v.NiceName = "BadMode"
-const (
- NotifyMaskScreenChange = 1
- NotifyMaskCrtcChange = 2
- NotifyMaskOutputChange = 4
- NotifyMaskOutputProperty = 8
-)
+ b := 1 // skip error determinant
+ b += 1 // don't read error number
-const (
- ModeFlagHsyncPositive = 1
- ModeFlagHsyncNegative = 2
- ModeFlagVsyncPositive = 4
- ModeFlagVsyncNegative = 8
- ModeFlagInterlace = 16
- ModeFlagDoubleScan = 32
- ModeFlagCsync = 64
- ModeFlagCsyncPositive = 128
- ModeFlagCsyncNegative = 256
- ModeFlagHskewPresent = 512
- ModeFlagBcast = 1024
- ModeFlagPixelMultiplex = 2048
- ModeFlagDoubleClock = 4096
- ModeFlagHalveClock = 8192
-)
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
+
+ return v
+}
+
+// SequenceId returns the sequence id attached to the BadBadMode error.
+// This is mostly used internally.
+func (err BadModeError) SequenceId() uint16 {
+ return err.Sequence
+}
+
+// BadId returns the 'BadValue' number if one exists for the BadBadMode error. If no bad value exists, 0 is returned.
+func (err BadModeError) BadId() uint32 {
+ return 0
+}
+
+// Error returns a rudimentary string representation of the BadBadMode error.
+
+func (err BadModeError) Error() string {
+ fieldVals := make([]string, 0, 0)
+ fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
+ return "BadBadMode {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+}
+
+func init() {
+ xgb.NewExtErrorFuncs["RANDR"][2] = BadModeErrorNew
+}
+
+// BadBadOutput is the error number for a BadBadOutput.
+const BadBadOutput = 0
+
+type BadOutputError struct {
+ Sequence uint16
+ NiceName string
+}
+
+// BadOutputErrorNew constructs a BadOutputError value that implements xgb.Error from a byte slice.
+func BadOutputErrorNew(buf []byte) xgb.Error {
+ v := BadOutputError{}
+ v.NiceName = "BadOutput"
+
+ b := 1 // skip error determinant
+ b += 1 // don't read error number
+
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
+
+ return v
+}
+
+// SequenceId returns the sequence id attached to the BadBadOutput error.
+// This is mostly used internally.
+func (err BadOutputError) SequenceId() uint16 {
+ return err.Sequence
+}
+
+// BadId returns the 'BadValue' number if one exists for the BadBadOutput error. If no bad value exists, 0 is returned.
+func (err BadOutputError) BadId() uint32 {
+ return 0
+}
+
+// Error returns a rudimentary string representation of the BadBadOutput error.
+
+func (err BadOutputError) Error() string {
+ fieldVals := make([]string, 0, 0)
+ fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
+ return "BadBadOutput {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+}
+
+func init() {
+ xgb.NewExtErrorFuncs["RANDR"][0] = BadOutputErrorNew
+}
const (
ConnectionConnected = 0
@@ -111,22 +185,6 @@ const (
ConnectionUnknown = 2
)
-const (
- NotifyCrtcChange = 0
- NotifyOutputChange = 1
- NotifyOutputProperty = 2
-)
-
-type Mode uint32
-
-func NewModeId(c *xgb.Conn) (Mode, error) {
- id, err := c.NewId()
- if err != nil {
- return 0, err
- }
- return Mode(id), nil
-}
-
type Crtc uint32
func NewCrtcId(c *xgb.Conn) (Crtc, error) {
@@ -137,135 +195,104 @@ func NewCrtcId(c *xgb.Conn) (Crtc, error) {
return Crtc(id), nil
}
-type Output uint32
-
-func NewOutputId(c *xgb.Conn) (Output, error) {
- id, err := c.NewId()
- if err != nil {
- return 0, err
- }
- return Output(id), nil
-}
-
-type ScreenSize struct {
- Width uint16
- Height uint16
- Mwidth uint16
- Mheight uint16
+type CrtcChange struct {
+ Timestamp xproto.Timestamp
+ Window xproto.Window
+ Crtc Crtc
+ Mode Mode
+ Rotation uint16
+ // padding: 2 bytes
+ X int16
+ Y int16
+ Width uint16
+ Height uint16
}
-// ScreenSizeRead reads a byte slice into a ScreenSize value.
-func ScreenSizeRead(buf []byte, v *ScreenSize) int {
+// CrtcChangeRead reads a byte slice into a CrtcChange value.
+func CrtcChangeRead(buf []byte, v *CrtcChange) int {
b := 0
- v.Width = xgb.Get16(buf[b:])
+ v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Window = xproto.Window(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Crtc = Crtc(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Mode = Mode(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Rotation = xgb.Get16(buf[b:])
b += 2
- v.Height = xgb.Get16(buf[b:])
+ b += 2 // padding
+
+ v.X = int16(xgb.Get16(buf[b:]))
b += 2
- v.Mwidth = xgb.Get16(buf[b:])
+ v.Y = int16(xgb.Get16(buf[b:]))
b += 2
- v.Mheight = xgb.Get16(buf[b:])
+ v.Width = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Height = xgb.Get16(buf[b:])
b += 2
return b
}
-// ScreenSizeReadList reads a byte slice into a list of ScreenSize values.
-func ScreenSizeReadList(buf []byte, dest []ScreenSize) int {
+// CrtcChangeReadList reads a byte slice into a list of CrtcChange values.
+func CrtcChangeReadList(buf []byte, dest []CrtcChange) int {
b := 0
for i := 0; i < len(dest); i++ {
- dest[i] = ScreenSize{}
- b += ScreenSizeRead(buf[b:], &dest[i])
+ dest[i] = CrtcChange{}
+ b += CrtcChangeRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
-// Bytes writes a ScreenSize value to a byte slice.
-func (v ScreenSize) Bytes() []byte {
- buf := make([]byte, 8)
+// Bytes writes a CrtcChange value to a byte slice.
+func (v CrtcChange) Bytes() []byte {
+ buf := make([]byte, 28)
b := 0
- xgb.Put16(buf[b:], v.Width)
- b += 2
-
- xgb.Put16(buf[b:], v.Height)
- b += 2
-
- xgb.Put16(buf[b:], v.Mwidth)
- b += 2
-
- xgb.Put16(buf[b:], v.Mheight)
- b += 2
-
- return buf
-}
+ xgb.Put32(buf[b:], uint32(v.Timestamp))
+ b += 4
-// ScreenSizeListBytes writes a list of ScreenSize values to a byte slice.
-func ScreenSizeListBytes(buf []byte, list []ScreenSize) int {
- b := 0
- var structBytes []byte
- for _, item := range list {
- structBytes = item.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
- return b
-}
+ xgb.Put32(buf[b:], uint32(v.Window))
+ b += 4
-type RefreshRates struct {
- NRates uint16
- Rates []uint16 // size: xgb.Pad((int(NRates) * 2))
-}
+ xgb.Put32(buf[b:], uint32(v.Crtc))
+ b += 4
-// RefreshRatesRead reads a byte slice into a RefreshRates value.
-func RefreshRatesRead(buf []byte, v *RefreshRates) int {
- b := 0
+ xgb.Put32(buf[b:], uint32(v.Mode))
+ b += 4
- v.NRates = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], v.Rotation)
b += 2
- v.Rates = make([]uint16, v.NRates)
- for i := 0; i < int(v.NRates); i++ {
- v.Rates[i] = xgb.Get16(buf[b:])
- b += 2
- }
- b = xgb.Pad(b)
-
- return b
-}
+ b += 2 // padding
-// RefreshRatesReadList reads a byte slice into a list of RefreshRates values.
-func RefreshRatesReadList(buf []byte, dest []RefreshRates) int {
- b := 0
- for i := 0; i < len(dest); i++ {
- dest[i] = RefreshRates{}
- b += RefreshRatesRead(buf[b:], &dest[i])
- }
- return xgb.Pad(b)
-}
+ xgb.Put16(buf[b:], uint16(v.X))
+ b += 2
-// Bytes writes a RefreshRates value to a byte slice.
-func (v RefreshRates) Bytes() []byte {
- buf := make([]byte, (2 + xgb.Pad((int(v.NRates) * 2))))
- b := 0
+ xgb.Put16(buf[b:], uint16(v.Y))
+ b += 2
- xgb.Put16(buf[b:], v.NRates)
+ xgb.Put16(buf[b:], v.Width)
b += 2
- for i := 0; i < int(v.NRates); i++ {
- xgb.Put16(buf[b:], v.Rates[i])
- b += 2
- }
- b = xgb.Pad(b)
+ xgb.Put16(buf[b:], v.Height)
+ b += 2
return buf
}
-// RefreshRatesListBytes writes a list of RefreshRates values to a byte slice.
-func RefreshRatesListBytes(buf []byte, list []RefreshRates) int {
+// CrtcChangeListBytes writes a list of CrtcChange values to a byte slice.
+func CrtcChangeListBytes(buf []byte, list []CrtcChange) int {
b := 0
var structBytes []byte
for _, item := range list {
@@ -276,15 +303,33 @@ func RefreshRatesListBytes(buf []byte, list []RefreshRates) int {
return b
}
-// RefreshRatesListSize computes the size (bytes) of a list of RefreshRates values.
-func RefreshRatesListSize(list []RefreshRates) int {
- size := 0
- for _, item := range list {
- size += (2 + xgb.Pad((int(item.NRates) * 2)))
+type Mode uint32
+
+func NewModeId(c *xgb.Conn) (Mode, error) {
+ id, err := c.NewId()
+ if err != nil {
+ return 0, err
}
- return size
+ return Mode(id), nil
}
+const (
+ ModeFlagHsyncPositive = 1
+ ModeFlagHsyncNegative = 2
+ ModeFlagVsyncPositive = 4
+ ModeFlagVsyncNegative = 8
+ ModeFlagInterlace = 16
+ ModeFlagDoubleScan = 32
+ ModeFlagCsync = 64
+ ModeFlagCsyncPositive = 128
+ ModeFlagCsyncNegative = 256
+ ModeFlagHskewPresent = 512
+ ModeFlagBcast = 1024
+ ModeFlagPixelMultiplex = 2048
+ ModeFlagDoubleClock = 4096
+ ModeFlagHalveClock = 8192
+)
+
type ModeInfo struct {
Id uint32
Width uint16
@@ -416,114 +461,259 @@ func ModeInfoListBytes(buf []byte, list []ModeInfo) int {
return b
}
-type CrtcChange struct {
- Timestamp xproto.Timestamp
- Window xproto.Window
- Crtc Crtc
- Mode Mode
- Rotation uint16
- // padding: 2 bytes
- X int16
- Y int16
- Width uint16
- Height uint16
+// Notify is the event number for a NotifyEvent.
+const Notify = 1
+
+type NotifyEvent struct {
+ Sequence uint16
+ SubCode byte
+ U NotifyDataUnion
}
-// CrtcChangeRead reads a byte slice into a CrtcChange value.
-func CrtcChangeRead(buf []byte, v *CrtcChange) int {
+// NotifyEventNew constructs a NotifyEvent value that implements xgb.Event from a byte slice.
+func NotifyEventNew(buf []byte) xgb.Event {
+ v := NotifyEvent{}
+ b := 1 // don't read event number
+
+ v.SubCode = buf[b]
+ b += 1
+
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
+
+ v.U = NotifyDataUnion{}
+ b += NotifyDataUnionRead(buf[b:], &v.U)
+
+ return v
+}
+
+// Bytes writes a NotifyEvent value to a byte slice.
+func (v NotifyEvent) Bytes() []byte {
+ buf := make([]byte, 32)
b := 0
- v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
+ // write event number
+ buf[b] = 1
+ b += 1
- v.Window = xproto.Window(xgb.Get32(buf[b:]))
- b += 4
+ buf[b] = v.SubCode
+ b += 1
- v.Crtc = Crtc(xgb.Get32(buf[b:]))
- b += 4
+ b += 2 // skip sequence number
- v.Mode = Mode(xgb.Get32(buf[b:]))
- b += 4
+ {
+ unionBytes := v.U.Bytes()
+ copy(buf[b:], unionBytes)
+ b += xgb.Pad(len(unionBytes))
+ }
- v.Rotation = xgb.Get16(buf[b:])
- b += 2
+ return buf
+}
- b += 2 // padding
+// SequenceId returns the sequence id attached to the Notify event.
+// Events without a sequence number (KeymapNotify) return 0.
+// This is mostly used internally.
+func (v NotifyEvent) SequenceId() uint16 {
+ return v.Sequence
+}
- v.X = int16(xgb.Get16(buf[b:]))
- b += 2
+// String is a rudimentary string representation of NotifyEvent.
+func (v NotifyEvent) String() string {
+ fieldVals := make([]string, 0, 2)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
+ fieldVals = append(fieldVals, xgb.Sprintf("SubCode: %d", v.SubCode))
+ return "Notify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+}
- v.Y = int16(xgb.Get16(buf[b:]))
- b += 2
+func init() {
+ xgb.NewExtEventFuncs["RANDR"][1] = NotifyEventNew
+}
- v.Width = xgb.Get16(buf[b:])
- b += 2
+const (
+ NotifyCrtcChange = 0
+ NotifyOutputChange = 1
+ NotifyOutputProperty = 2
+)
- v.Height = xgb.Get16(buf[b:])
- b += 2
+// NotifyDataUnion is a represention of the NotifyDataUnion union type.
+// Note that to *create* a Union, you should *never* create
+// this struct directly (unless you know what you're doing).
+// Instead use one of the following constructors for 'NotifyDataUnion':
+// NotifyDataUnionCcNew(Cc CrtcChange) NotifyDataUnion
+// NotifyDataUnionOcNew(Oc OutputChange) NotifyDataUnion
+// NotifyDataUnionOpNew(Op OutputProperty) NotifyDataUnion
+type NotifyDataUnion struct {
+ Cc CrtcChange
+ Oc OutputChange
+ Op OutputProperty
+}
- return b
+// NotifyDataUnionCcNew constructs a new NotifyDataUnion union type with the Cc field.
+func NotifyDataUnionCcNew(Cc CrtcChange) NotifyDataUnion {
+ var b int
+ buf := make([]byte, 28)
+
+ {
+ structBytes := Cc.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+
+ // Create the Union type
+ v := NotifyDataUnion{}
+
+ // Now copy buf into all fields
+
+ b = 0 // always read the same bytes
+ v.Cc = CrtcChange{}
+ b += CrtcChangeRead(buf[b:], &v.Cc)
+
+ b = 0 // always read the same bytes
+ v.Oc = OutputChange{}
+ b += OutputChangeRead(buf[b:], &v.Oc)
+
+ b = 0 // always read the same bytes
+ v.Op = OutputProperty{}
+ b += OutputPropertyRead(buf[b:], &v.Op)
+
+ return v
}
-// CrtcChangeReadList reads a byte slice into a list of CrtcChange values.
-func CrtcChangeReadList(buf []byte, dest []CrtcChange) int {
- b := 0
- for i := 0; i < len(dest); i++ {
- dest[i] = CrtcChange{}
- b += CrtcChangeRead(buf[b:], &dest[i])
+// NotifyDataUnionOcNew constructs a new NotifyDataUnion union type with the Oc field.
+func NotifyDataUnionOcNew(Oc OutputChange) NotifyDataUnion {
+ var b int
+ buf := make([]byte, 28)
+
+ {
+ structBytes := Oc.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
}
- return xgb.Pad(b)
+
+ // Create the Union type
+ v := NotifyDataUnion{}
+
+ // Now copy buf into all fields
+
+ b = 0 // always read the same bytes
+ v.Cc = CrtcChange{}
+ b += CrtcChangeRead(buf[b:], &v.Cc)
+
+ b = 0 // always read the same bytes
+ v.Oc = OutputChange{}
+ b += OutputChangeRead(buf[b:], &v.Oc)
+
+ b = 0 // always read the same bytes
+ v.Op = OutputProperty{}
+ b += OutputPropertyRead(buf[b:], &v.Op)
+
+ return v
}
-// Bytes writes a CrtcChange value to a byte slice.
-func (v CrtcChange) Bytes() []byte {
+// NotifyDataUnionOpNew constructs a new NotifyDataUnion union type with the Op field.
+func NotifyDataUnionOpNew(Op OutputProperty) NotifyDataUnion {
+ var b int
buf := make([]byte, 28)
- b := 0
- xgb.Put32(buf[b:], uint32(v.Timestamp))
- b += 4
+ {
+ structBytes := Op.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
- xgb.Put32(buf[b:], uint32(v.Window))
- b += 4
+ // Create the Union type
+ v := NotifyDataUnion{}
- xgb.Put32(buf[b:], uint32(v.Crtc))
- b += 4
+ // Now copy buf into all fields
- xgb.Put32(buf[b:], uint32(v.Mode))
- b += 4
+ b = 0 // always read the same bytes
+ v.Cc = CrtcChange{}
+ b += CrtcChangeRead(buf[b:], &v.Cc)
- xgb.Put16(buf[b:], v.Rotation)
- b += 2
+ b = 0 // always read the same bytes
+ v.Oc = OutputChange{}
+ b += OutputChangeRead(buf[b:], &v.Oc)
- b += 2 // padding
+ b = 0 // always read the same bytes
+ v.Op = OutputProperty{}
+ b += OutputPropertyRead(buf[b:], &v.Op)
- xgb.Put16(buf[b:], uint16(v.X))
- b += 2
+ return v
+}
- xgb.Put16(buf[b:], uint16(v.Y))
- b += 2
+// NotifyDataUnionRead reads a byte slice into a NotifyDataUnion value.
+func NotifyDataUnionRead(buf []byte, v *NotifyDataUnion) int {
+ var b int
- xgb.Put16(buf[b:], v.Width)
- b += 2
+ b = 0 // re-read the same bytes
+ v.Cc = CrtcChange{}
+ b += CrtcChangeRead(buf[b:], &v.Cc)
- xgb.Put16(buf[b:], v.Height)
- b += 2
+ b = 0 // re-read the same bytes
+ v.Oc = OutputChange{}
+ b += OutputChangeRead(buf[b:], &v.Oc)
- return buf
+ b = 0 // re-read the same bytes
+ v.Op = OutputProperty{}
+ b += OutputPropertyRead(buf[b:], &v.Op)
+
+ return 28
}
-// CrtcChangeListBytes writes a list of CrtcChange values to a byte slice.
-func CrtcChangeListBytes(buf []byte, list []CrtcChange) int {
+// NotifyDataUnionReadList reads a byte slice into a list of NotifyDataUnion values.
+func NotifyDataUnionReadList(buf []byte, dest []NotifyDataUnion) int {
b := 0
- var structBytes []byte
- for _, item := range list {
- structBytes = item.Bytes()
+ for i := 0; i < len(dest); i++ {
+ dest[i] = NotifyDataUnion{}
+ b += NotifyDataUnionRead(buf[b:], &dest[i])
+ }
+ return xgb.Pad(b)
+}
+
+// Bytes writes a NotifyDataUnion value to a byte slice.
+// Each field in a union must contain the same data.
+// So simply pick the first field and write that to the wire.
+func (v NotifyDataUnion) Bytes() []byte {
+ buf := make([]byte, 28)
+ b := 0
+
+ {
+ structBytes := v.Cc.Bytes()
copy(buf[b:], structBytes)
b += xgb.Pad(len(structBytes))
}
+ return buf
+}
+
+// NotifyDataUnionListBytes writes a list of %s(MISSING) values to a byte slice.
+func NotifyDataUnionListBytes(buf []byte, list []NotifyDataUnion) int {
+ b := 0
+ var unionBytes []byte
+ for _, item := range list {
+ unionBytes = item.Bytes()
+ copy(buf[b:], unionBytes)
+ b += xgb.Pad(len(unionBytes))
+ }
return b
}
+const (
+ NotifyMaskScreenChange = 1
+ NotifyMaskCrtcChange = 2
+ NotifyMaskOutputChange = 4
+ NotifyMaskOutputProperty = 8
+)
+
+type Output uint32
+
+func NewOutputId(c *xgb.Conn) (Output, error) {
+ id, err := c.NewId()
+ if err != nil {
+ return 0, err
+ }
+ return Output(id), nil
+}
+
type OutputChange struct {
Timestamp xproto.Timestamp
ConfigTimestamp xproto.Timestamp
@@ -707,168 +897,85 @@ func OutputPropertyListBytes(buf []byte, list []OutputProperty) int {
return b
}
-// NotifyDataUnion is a represention of the NotifyDataUnion union type.
-// Note that to *create* a Union, you should *never* create
-// this struct directly (unless you know what you're doing).
-// Instead use one of the following constructors for 'NotifyDataUnion':
-// NotifyDataUnionCcNew(Cc CrtcChange) NotifyDataUnion
-// NotifyDataUnionOcNew(Oc OutputChange) NotifyDataUnion
-// NotifyDataUnionOpNew(Op OutputProperty) NotifyDataUnion
-type NotifyDataUnion struct {
- Cc CrtcChange
- Oc OutputChange
- Op OutputProperty
-}
-
-// NotifyDataUnionCcNew constructs a new NotifyDataUnion union type with the Cc field.
-func NotifyDataUnionCcNew(Cc CrtcChange) NotifyDataUnion {
- var b int
- buf := make([]byte, 28)
-
- {
- structBytes := Cc.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
-
- // Create the Union type
- v := NotifyDataUnion{}
-
- // Now copy buf into all fields
-
- b = 0 // always read the same bytes
- v.Cc = CrtcChange{}
- b += CrtcChangeRead(buf[b:], &v.Cc)
-
- b = 0 // always read the same bytes
- v.Oc = OutputChange{}
- b += OutputChangeRead(buf[b:], &v.Oc)
-
- b = 0 // always read the same bytes
- v.Op = OutputProperty{}
- b += OutputPropertyRead(buf[b:], &v.Op)
-
- return v
+type RefreshRates struct {
+ NRates uint16
+ Rates []uint16 // size: xgb.Pad((int(NRates) * 2))
}
-// NotifyDataUnionOcNew constructs a new NotifyDataUnion union type with the Oc field.
-func NotifyDataUnionOcNew(Oc OutputChange) NotifyDataUnion {
- var b int
- buf := make([]byte, 28)
-
- {
- structBytes := Oc.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
-
- // Create the Union type
- v := NotifyDataUnion{}
-
- // Now copy buf into all fields
-
- b = 0 // always read the same bytes
- v.Cc = CrtcChange{}
- b += CrtcChangeRead(buf[b:], &v.Cc)
-
- b = 0 // always read the same bytes
- v.Oc = OutputChange{}
- b += OutputChangeRead(buf[b:], &v.Oc)
-
- b = 0 // always read the same bytes
- v.Op = OutputProperty{}
- b += OutputPropertyRead(buf[b:], &v.Op)
-
- return v
-}
+// RefreshRatesRead reads a byte slice into a RefreshRates value.
+func RefreshRatesRead(buf []byte, v *RefreshRates) int {
+ b := 0
-// NotifyDataUnionOpNew constructs a new NotifyDataUnion union type with the Op field.
-func NotifyDataUnionOpNew(Op OutputProperty) NotifyDataUnion {
- var b int
- buf := make([]byte, 28)
+ v.NRates = xgb.Get16(buf[b:])
+ b += 2
- {
- structBytes := Op.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ v.Rates = make([]uint16, v.NRates)
+ for i := 0; i < int(v.NRates); i++ {
+ v.Rates[i] = xgb.Get16(buf[b:])
+ b += 2
}
+ b = xgb.Pad(b)
- // Create the Union type
- v := NotifyDataUnion{}
-
- // Now copy buf into all fields
-
- b = 0 // always read the same bytes
- v.Cc = CrtcChange{}
- b += CrtcChangeRead(buf[b:], &v.Cc)
-
- b = 0 // always read the same bytes
- v.Oc = OutputChange{}
- b += OutputChangeRead(buf[b:], &v.Oc)
-
- b = 0 // always read the same bytes
- v.Op = OutputProperty{}
- b += OutputPropertyRead(buf[b:], &v.Op)
-
- return v
-}
-
-// NotifyDataUnionRead reads a byte slice into a NotifyDataUnion value.
-func NotifyDataUnionRead(buf []byte, v *NotifyDataUnion) int {
- var b int
-
- b = 0 // re-read the same bytes
- v.Cc = CrtcChange{}
- b += CrtcChangeRead(buf[b:], &v.Cc)
-
- b = 0 // re-read the same bytes
- v.Oc = OutputChange{}
- b += OutputChangeRead(buf[b:], &v.Oc)
-
- b = 0 // re-read the same bytes
- v.Op = OutputProperty{}
- b += OutputPropertyRead(buf[b:], &v.Op)
-
- return 28
+ return b
}
-// NotifyDataUnionReadList reads a byte slice into a list of NotifyDataUnion values.
-func NotifyDataUnionReadList(buf []byte, dest []NotifyDataUnion) int {
+// RefreshRatesReadList reads a byte slice into a list of RefreshRates values.
+func RefreshRatesReadList(buf []byte, dest []RefreshRates) int {
b := 0
for i := 0; i < len(dest); i++ {
- dest[i] = NotifyDataUnion{}
- b += NotifyDataUnionRead(buf[b:], &dest[i])
+ dest[i] = RefreshRates{}
+ b += RefreshRatesRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
-// Bytes writes a NotifyDataUnion value to a byte slice.
-// Each field in a union must contain the same data.
-// So simply pick the first field and write that to the wire.
-func (v NotifyDataUnion) Bytes() []byte {
- buf := make([]byte, 28)
+// Bytes writes a RefreshRates value to a byte slice.
+func (v RefreshRates) Bytes() []byte {
+ buf := make([]byte, (2 + xgb.Pad((int(v.NRates) * 2))))
b := 0
- {
- structBytes := v.Cc.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ xgb.Put16(buf[b:], v.NRates)
+ b += 2
+
+ for i := 0; i < int(v.NRates); i++ {
+ xgb.Put16(buf[b:], v.Rates[i])
+ b += 2
}
+ b = xgb.Pad(b)
+
return buf
}
-// NotifyDataUnionListBytes writes a list of %s(MISSING) values to a byte slice.
-func NotifyDataUnionListBytes(buf []byte, list []NotifyDataUnion) int {
+// RefreshRatesListBytes writes a list of RefreshRates values to a byte slice.
+func RefreshRatesListBytes(buf []byte, list []RefreshRates) int {
b := 0
- var unionBytes []byte
+ var structBytes []byte
for _, item := range list {
- unionBytes = item.Bytes()
- copy(buf[b:], unionBytes)
- b += xgb.Pad(len(unionBytes))
+ structBytes = item.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
}
return b
}
+// RefreshRatesListSize computes the size (bytes) of a list of RefreshRates values.
+func RefreshRatesListSize(list []RefreshRates) int {
+ size := 0
+ for _, item := range list {
+ size += (2 + xgb.Pad((int(item.NRates) * 2)))
+ }
+ return size
+}
+
+const (
+ RotationRotate0 = 1
+ RotationRotate90 = 2
+ RotationRotate180 = 4
+ RotationRotate270 = 8
+ RotationReflectX = 16
+ RotationReflectY = 32
+)
+
// ScreenChangeNotify is the event number for a ScreenChangeNotifyEvent.
const ScreenChangeNotify = 0
@@ -1007,251 +1114,356 @@ func init() {
xgb.NewExtEventFuncs["RANDR"][0] = ScreenChangeNotifyEventNew
}
-// Notify is the event number for a NotifyEvent.
-const Notify = 1
-
-type NotifyEvent struct {
- Sequence uint16
- SubCode byte
- U NotifyDataUnion
+type ScreenSize struct {
+ Width uint16
+ Height uint16
+ Mwidth uint16
+ Mheight uint16
}
-// NotifyEventNew constructs a NotifyEvent value that implements xgb.Event from a byte slice.
-func NotifyEventNew(buf []byte) xgb.Event {
- v := NotifyEvent{}
- b := 1 // don't read event number
+// ScreenSizeRead reads a byte slice into a ScreenSize value.
+func ScreenSizeRead(buf []byte, v *ScreenSize) int {
+ b := 0
- v.SubCode = buf[b]
- b += 1
+ v.Width = xgb.Get16(buf[b:])
+ b += 2
- v.Sequence = xgb.Get16(buf[b:])
+ v.Height = xgb.Get16(buf[b:])
b += 2
- v.U = NotifyDataUnion{}
- b += NotifyDataUnionRead(buf[b:], &v.U)
+ v.Mwidth = xgb.Get16(buf[b:])
+ b += 2
- return v
+ v.Mheight = xgb.Get16(buf[b:])
+ b += 2
+
+ return b
}
-// Bytes writes a NotifyEvent value to a byte slice.
-func (v NotifyEvent) Bytes() []byte {
- buf := make([]byte, 32)
+// ScreenSizeReadList reads a byte slice into a list of ScreenSize values.
+func ScreenSizeReadList(buf []byte, dest []ScreenSize) int {
b := 0
+ for i := 0; i < len(dest); i++ {
+ dest[i] = ScreenSize{}
+ b += ScreenSizeRead(buf[b:], &dest[i])
+ }
+ return xgb.Pad(b)
+}
- // write event number
- buf[b] = 1
- b += 1
+// Bytes writes a ScreenSize value to a byte slice.
+func (v ScreenSize) Bytes() []byte {
+ buf := make([]byte, 8)
+ b := 0
- buf[b] = v.SubCode
- b += 1
+ xgb.Put16(buf[b:], v.Width)
+ b += 2
- b += 2 // skip sequence number
+ xgb.Put16(buf[b:], v.Height)
+ b += 2
- {
- unionBytes := v.U.Bytes()
- copy(buf[b:], unionBytes)
- b += xgb.Pad(len(unionBytes))
- }
+ xgb.Put16(buf[b:], v.Mwidth)
+ b += 2
+
+ xgb.Put16(buf[b:], v.Mheight)
+ b += 2
return buf
}
-// SequenceId returns the sequence id attached to the Notify event.
-// Events without a sequence number (KeymapNotify) return 0.
-// This is mostly used internally.
-func (v NotifyEvent) SequenceId() uint16 {
- return v.Sequence
+// ScreenSizeListBytes writes a list of ScreenSize values to a byte slice.
+func ScreenSizeListBytes(buf []byte, list []ScreenSize) int {
+ b := 0
+ var structBytes []byte
+ for _, item := range list {
+ structBytes = item.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+ return b
}
-// String is a rudimentary string representation of NotifyEvent.
-func (v NotifyEvent) String() string {
- fieldVals := make([]string, 0, 2)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
- fieldVals = append(fieldVals, xgb.Sprintf("SubCode: %d", v.SubCode))
- return "Notify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
-}
+const (
+ SetConfigSuccess = 0
+ SetConfigInvalidConfigTime = 1
+ SetConfigInvalidTime = 2
+ SetConfigFailed = 3
+)
-func init() {
- xgb.NewExtEventFuncs["RANDR"][1] = NotifyEventNew
-}
+// Skipping definition for base type 'Bool'
-// BadBadOutput is the error number for a BadBadOutput.
-const BadBadOutput = 0
+// Skipping definition for base type 'Byte'
-type BadOutputError struct {
- Sequence uint16
- NiceName string
-}
+// Skipping definition for base type 'Card8'
-// BadOutputErrorNew constructs a BadOutputError value that implements xgb.Error from a byte slice.
-func BadOutputErrorNew(buf []byte) xgb.Error {
- v := BadOutputError{}
- v.NiceName = "BadOutput"
+// Skipping definition for base type 'Char'
- b := 1 // skip error determinant
- b += 1 // don't read error number
+// Skipping definition for base type 'Void'
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
+// Skipping definition for base type 'Double'
- return v
-}
+// Skipping definition for base type 'Float'
-// SequenceId returns the sequence id attached to the BadBadOutput error.
-// This is mostly used internally.
-func (err BadOutputError) SequenceId() uint16 {
- return err.Sequence
-}
+// Skipping definition for base type 'Int16'
-// BadId returns the 'BadValue' number if one exists for the BadBadOutput error. If no bad value exists, 0 is returned.
-func (err BadOutputError) BadId() uint32 {
- return 0
-}
+// Skipping definition for base type 'Int32'
-// Error returns a rudimentary string representation of the BadBadOutput error.
+// Skipping definition for base type 'Int8'
-func (err BadOutputError) Error() string {
- fieldVals := make([]string, 0, 0)
- fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- return "BadBadOutput {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+// Skipping definition for base type 'Card16'
+
+// Skipping definition for base type 'Card32'
+
+// AddOutputModeCookie is a cookie used only for AddOutputMode requests.
+type AddOutputModeCookie struct {
+ *xgb.Cookie
}
-func init() {
- xgb.NewExtErrorFuncs["RANDR"][0] = BadOutputErrorNew
+// AddOutputMode sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func AddOutputMode(c *xgb.Conn, Output Output, Mode Mode) AddOutputModeCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'AddOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(addOutputModeRequest(c, Output, Mode), cookie)
+ return AddOutputModeCookie{cookie}
}
-// BadBadCrtc is the error number for a BadBadCrtc.
-const BadBadCrtc = 1
+// AddOutputModeChecked sends a checked request.
+// If an error occurs, it can be retrieved using AddOutputModeCookie.Check()
+func AddOutputModeChecked(c *xgb.Conn, Output Output, Mode Mode) AddOutputModeCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'AddOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(addOutputModeRequest(c, Output, Mode), cookie)
+ return AddOutputModeCookie{cookie}
+}
-type BadCrtcError struct {
- Sequence uint16
- NiceName string
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook AddOutputModeCookie) Check() error {
+ return cook.Cookie.Check()
}
-// BadCrtcErrorNew constructs a BadCrtcError value that implements xgb.Error from a byte slice.
-func BadCrtcErrorNew(buf []byte) xgb.Error {
- v := BadCrtcError{}
- v.NiceName = "BadCrtc"
+// Write request to wire for AddOutputMode
+// addOutputModeRequest writes a AddOutputMode request to a byte slice.
+func addOutputModeRequest(c *xgb.Conn, Output Output, Mode Mode) []byte {
+ size := 12
+ b := 0
+ buf := make([]byte, size)
- b := 1 // skip error determinant
- b += 1 // don't read error number
+ buf[b] = c.Extensions["RANDR"]
+ b += 1
- v.Sequence = xgb.Get16(buf[b:])
+ buf[b] = 18 // request opcode
+ b += 1
+
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- return v
-}
+ xgb.Put32(buf[b:], uint32(Output))
+ b += 4
-// SequenceId returns the sequence id attached to the BadBadCrtc error.
-// This is mostly used internally.
-func (err BadCrtcError) SequenceId() uint16 {
- return err.Sequence
-}
+ xgb.Put32(buf[b:], uint32(Mode))
+ b += 4
-// BadId returns the 'BadValue' number if one exists for the BadBadCrtc error. If no bad value exists, 0 is returned.
-func (err BadCrtcError) BadId() uint32 {
- return 0
+ return buf
}
-// Error returns a rudimentary string representation of the BadBadCrtc error.
-
-func (err BadCrtcError) Error() string {
- fieldVals := make([]string, 0, 0)
- fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- return "BadBadCrtc {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+// ChangeOutputPropertyCookie is a cookie used only for ChangeOutputProperty requests.
+type ChangeOutputPropertyCookie struct {
+ *xgb.Cookie
}
-func init() {
- xgb.NewExtErrorFuncs["RANDR"][1] = BadCrtcErrorNew
+// ChangeOutputProperty sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func ChangeOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) ChangeOutputPropertyCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'ChangeOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(changeOutputPropertyRequest(c, Output, Property, Type, Format, Mode, NumUnits, Data), cookie)
+ return ChangeOutputPropertyCookie{cookie}
}
-// BadBadMode is the error number for a BadBadMode.
-const BadBadMode = 2
+// ChangeOutputPropertyChecked sends a checked request.
+// If an error occurs, it can be retrieved using ChangeOutputPropertyCookie.Check()
+func ChangeOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) ChangeOutputPropertyCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'ChangeOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(changeOutputPropertyRequest(c, Output, Property, Type, Format, Mode, NumUnits, Data), cookie)
+ return ChangeOutputPropertyCookie{cookie}
+}
-type BadModeError struct {
- Sequence uint16
- NiceName string
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook ChangeOutputPropertyCookie) Check() error {
+ return cook.Cookie.Check()
}
-// BadModeErrorNew constructs a BadModeError value that implements xgb.Error from a byte slice.
-func BadModeErrorNew(buf []byte) xgb.Error {
- v := BadModeError{}
- v.NiceName = "BadMode"
+// Write request to wire for ChangeOutputProperty
+// changeOutputPropertyRequest writes a ChangeOutputProperty request to a byte slice.
+func changeOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) []byte {
+ size := xgb.Pad((24 + xgb.Pad((((int(NumUnits) * int(Format)) / 8) * 1))))
+ b := 0
+ buf := make([]byte, size)
- b := 1 // skip error determinant
- b += 1 // don't read error number
+ buf[b] = c.Extensions["RANDR"]
+ b += 1
- v.Sequence = xgb.Get16(buf[b:])
+ buf[b] = 13 // request opcode
+ b += 1
+
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- return v
+ xgb.Put32(buf[b:], uint32(Output))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Property))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Type))
+ b += 4
+
+ buf[b] = Format
+ b += 1
+
+ buf[b] = Mode
+ b += 1
+
+ b += 2 // padding
+
+ xgb.Put32(buf[b:], NumUnits)
+ b += 4
+
+ copy(buf[b:], Data[:((int(NumUnits)*int(Format))/8)])
+ b += xgb.Pad(int(((int(NumUnits) * int(Format)) / 8)))
+
+ return buf
}
-// SequenceId returns the sequence id attached to the BadBadMode error.
-// This is mostly used internally.
-func (err BadModeError) SequenceId() uint16 {
- return err.Sequence
+// ConfigureOutputPropertyCookie is a cookie used only for ConfigureOutputProperty requests.
+type ConfigureOutputPropertyCookie struct {
+ *xgb.Cookie
}
-// BadId returns the 'BadValue' number if one exists for the BadBadMode error. If no bad value exists, 0 is returned.
-func (err BadModeError) BadId() uint32 {
- return 0
+// ConfigureOutputProperty sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func ConfigureOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureOutputPropertyCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'ConfigureOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(configureOutputPropertyRequest(c, Output, Property, Pending, Range, Values), cookie)
+ return ConfigureOutputPropertyCookie{cookie}
}
-// Error returns a rudimentary string representation of the BadBadMode error.
+// ConfigureOutputPropertyChecked sends a checked request.
+// If an error occurs, it can be retrieved using ConfigureOutputPropertyCookie.Check()
+func ConfigureOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureOutputPropertyCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'ConfigureOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(configureOutputPropertyRequest(c, Output, Property, Pending, Range, Values), cookie)
+ return ConfigureOutputPropertyCookie{cookie}
+}
-func (err BadModeError) Error() string {
- fieldVals := make([]string, 0, 0)
- fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- return "BadBadMode {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook ConfigureOutputPropertyCookie) Check() error {
+ return cook.Cookie.Check()
}
-func init() {
- xgb.NewExtErrorFuncs["RANDR"][2] = BadModeErrorNew
+// Write request to wire for ConfigureOutputProperty
+// configureOutputPropertyRequest writes a ConfigureOutputProperty request to a byte slice.
+func configureOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) []byte {
+ size := xgb.Pad((16 + xgb.Pad((len(Values) * 4))))
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["RANDR"]
+ b += 1
+
+ buf[b] = 12 // request opcode
+ b += 1
+
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ b += 2
+
+ xgb.Put32(buf[b:], uint32(Output))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Property))
+ b += 4
+
+ if Pending {
+ buf[b] = 1
+ } else {
+ buf[b] = 0
+ }
+ b += 1
+
+ if Range {
+ buf[b] = 1
+ } else {
+ buf[b] = 0
+ }
+ b += 1
+
+ b += 2 // padding
+
+ for i := 0; i < int(len(Values)); i++ {
+ xgb.Put32(buf[b:], uint32(Values[i]))
+ b += 4
+ }
+ b = xgb.Pad(b)
+
+ return buf
}
-// QueryVersionCookie is a cookie used only for QueryVersion requests.
-type QueryVersionCookie struct {
+// CreateModeCookie is a cookie used only for CreateMode requests.
+type CreateModeCookie struct {
*xgb.Cookie
}
-// QueryVersion sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
-func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie {
+// CreateMode sends a checked request.
+// If an error occurs, it will be returned with the reply by calling CreateModeCookie.Reply()
+func CreateMode(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) CreateModeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'CreateMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
- return QueryVersionCookie{cookie}
+ c.NewRequest(createModeRequest(c, Window, ModeInfo, Name), cookie)
+ return CreateModeCookie{cookie}
}
-// QueryVersionUnchecked sends an unchecked request.
+// CreateModeUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie {
+func CreateModeUnchecked(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) CreateModeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'CreateMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
- return QueryVersionCookie{cookie}
+ c.NewRequest(createModeRequest(c, Window, ModeInfo, Name), cookie)
+ return CreateModeCookie{cookie}
}
-// QueryVersionReply represents the data returned from a QueryVersion request.
-type QueryVersionReply struct {
+// CreateModeReply represents the data returned from a CreateMode request.
+type CreateModeReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- MajorVersion uint32
- MinorVersion uint32
- // padding: 16 bytes
+ Mode Mode
+ // padding: 20 bytes
}
-// Reply blocks and returns the reply data for a QueryVersion request.
-func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
+// Reply blocks and returns the reply data for a CreateMode request.
+func (cook CreateModeCookie) Reply() (*CreateModeReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1259,12 +1471,12 @@ func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
if buf == nil {
return nil, nil
}
- return queryVersionReply(buf), nil
+ return createModeReply(buf), nil
}
-// queryVersionReply reads a byte slice into a QueryVersionReply value.
-func queryVersionReply(buf []byte) *QueryVersionReply {
- v := new(QueryVersionReply)
+// createModeReply reads a byte slice into a CreateModeReply value.
+func createModeReply(buf []byte) *CreateModeReply {
+ v := new(CreateModeReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1275,270 +1487,257 @@ func queryVersionReply(buf []byte) *QueryVersionReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.MajorVersion = xgb.Get32(buf[b:])
- b += 4
-
- v.MinorVersion = xgb.Get32(buf[b:])
+ v.Mode = Mode(xgb.Get32(buf[b:]))
b += 4
- b += 16 // padding
+ b += 20 // padding
return v
}
-// Write request to wire for QueryVersion
-// queryVersionRequest writes a QueryVersion request to a byte slice.
-func queryVersionRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) []byte {
- size := 12
+// Write request to wire for CreateMode
+// createModeRequest writes a CreateMode request to a byte slice.
+func createModeRequest(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) []byte {
+ size := xgb.Pad((40 + xgb.Pad((len(Name) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 0 // request opcode
+ buf[b] = 16 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], MajorVersion)
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
- xgb.Put32(buf[b:], MinorVersion)
- b += 4
+ {
+ structBytes := ModeInfo.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+
+ copy(buf[b:], Name[:len(Name)])
+ b += xgb.Pad(int(len(Name)))
return buf
}
-// SetScreenConfigCookie is a cookie used only for SetScreenConfig requests.
-type SetScreenConfigCookie struct {
+// DeleteOutputModeCookie is a cookie used only for DeleteOutputMode requests.
+type DeleteOutputModeCookie struct {
*xgb.Cookie
}
-// SetScreenConfig sends a checked request.
-// If an error occurs, it will be returned with the reply by calling SetScreenConfigCookie.Reply()
-func SetScreenConfig(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) SetScreenConfigCookie {
+// DeleteOutputMode sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func DeleteOutputMode(c *xgb.Conn, Output Output, Mode Mode) DeleteOutputModeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetScreenConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DeleteOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, true)
- c.NewRequest(setScreenConfigRequest(c, Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie)
- return SetScreenConfigCookie{cookie}
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(deleteOutputModeRequest(c, Output, Mode), cookie)
+ return DeleteOutputModeCookie{cookie}
}
-// SetScreenConfigUnchecked sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetScreenConfigUnchecked(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) SetScreenConfigCookie {
+// DeleteOutputModeChecked sends a checked request.
+// If an error occurs, it can be retrieved using DeleteOutputModeCookie.Check()
+func DeleteOutputModeChecked(c *xgb.Conn, Output Output, Mode Mode) DeleteOutputModeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetScreenConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DeleteOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(setScreenConfigRequest(c, Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie)
- return SetScreenConfigCookie{cookie}
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(deleteOutputModeRequest(c, Output, Mode), cookie)
+ return DeleteOutputModeCookie{cookie}
}
-// SetScreenConfigReply represents the data returned from a SetScreenConfig request.
-type SetScreenConfigReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- Status byte
- NewTimestamp xproto.Timestamp
- ConfigTimestamp xproto.Timestamp
- Root xproto.Window
- SubpixelOrder uint16
- // padding: 10 bytes
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook DeleteOutputModeCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Reply blocks and returns the reply data for a SetScreenConfig request.
-func (cook SetScreenConfigCookie) Reply() (*SetScreenConfigReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
- }
- return setScreenConfigReply(buf), nil
-}
+// Write request to wire for DeleteOutputMode
+// deleteOutputModeRequest writes a DeleteOutputMode request to a byte slice.
+func deleteOutputModeRequest(c *xgb.Conn, Output Output, Mode Mode) []byte {
+ size := 12
+ b := 0
+ buf := make([]byte, size)
-// setScreenConfigReply reads a byte slice into a SetScreenConfigReply value.
-func setScreenConfigReply(buf []byte) *SetScreenConfigReply {
- v := new(SetScreenConfigReply)
- b := 1 // skip reply determinant
+ buf[b] = c.Extensions["RANDR"]
+ b += 1
- v.Status = buf[b]
+ buf[b] = 19 // request opcode
b += 1
- v.Sequence = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
+ xgb.Put32(buf[b:], uint32(Output))
b += 4
- v.NewTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ xgb.Put32(buf[b:], uint32(Mode))
b += 4
- v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
+ return buf
+}
- v.Root = xproto.Window(xgb.Get32(buf[b:]))
- b += 4
+// DeleteOutputPropertyCookie is a cookie used only for DeleteOutputProperty requests.
+type DeleteOutputPropertyCookie struct {
+ *xgb.Cookie
+}
- v.SubpixelOrder = xgb.Get16(buf[b:])
- b += 2
+// DeleteOutputProperty sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func DeleteOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) DeleteOutputPropertyCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'DeleteOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(deleteOutputPropertyRequest(c, Output, Property), cookie)
+ return DeleteOutputPropertyCookie{cookie}
+}
- b += 10 // padding
+// DeleteOutputPropertyChecked sends a checked request.
+// If an error occurs, it can be retrieved using DeleteOutputPropertyCookie.Check()
+func DeleteOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom) DeleteOutputPropertyCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'DeleteOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(deleteOutputPropertyRequest(c, Output, Property), cookie)
+ return DeleteOutputPropertyCookie{cookie}
+}
- return v
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook DeleteOutputPropertyCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Write request to wire for SetScreenConfig
-// setScreenConfigRequest writes a SetScreenConfig request to a byte slice.
-func setScreenConfigRequest(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) []byte {
- size := 24
+// Write request to wire for DeleteOutputProperty
+// deleteOutputPropertyRequest writes a DeleteOutputProperty request to a byte slice.
+func deleteOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 2 // request opcode
+ buf[b] = 14 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Window))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Timestamp))
+ xgb.Put32(buf[b:], uint32(Output))
b += 4
- xgb.Put32(buf[b:], uint32(ConfigTimestamp))
+ xgb.Put32(buf[b:], uint32(Property))
b += 4
- xgb.Put16(buf[b:], SizeID)
- b += 2
-
- xgb.Put16(buf[b:], Rotation)
- b += 2
-
- xgb.Put16(buf[b:], Rate)
- b += 2
-
- b += 2 // padding
-
return buf
}
-// SelectInputCookie is a cookie used only for SelectInput requests.
-type SelectInputCookie struct {
+// DestroyModeCookie is a cookie used only for DestroyMode requests.
+type DestroyModeCookie struct {
*xgb.Cookie
}
-// SelectInput sends an unchecked request.
+// DestroyMode sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SelectInput(c *xgb.Conn, Window xproto.Window, Enable uint16) SelectInputCookie {
+func DestroyMode(c *xgb.Conn, Mode Mode) DestroyModeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SelectInput' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DestroyMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(selectInputRequest(c, Window, Enable), cookie)
- return SelectInputCookie{cookie}
+ c.NewRequest(destroyModeRequest(c, Mode), cookie)
+ return DestroyModeCookie{cookie}
}
-// SelectInputChecked sends a checked request.
-// If an error occurs, it can be retrieved using SelectInputCookie.Check()
-func SelectInputChecked(c *xgb.Conn, Window xproto.Window, Enable uint16) SelectInputCookie {
+// DestroyModeChecked sends a checked request.
+// If an error occurs, it can be retrieved using DestroyModeCookie.Check()
+func DestroyModeChecked(c *xgb.Conn, Mode Mode) DestroyModeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SelectInput' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DestroyMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(selectInputRequest(c, Window, Enable), cookie)
- return SelectInputCookie{cookie}
+ c.NewRequest(destroyModeRequest(c, Mode), cookie)
+ return DestroyModeCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SelectInputCookie) Check() error {
+func (cook DestroyModeCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for SelectInput
-// selectInputRequest writes a SelectInput request to a byte slice.
-func selectInputRequest(c *xgb.Conn, Window xproto.Window, Enable uint16) []byte {
- size := 12
+// Write request to wire for DestroyMode
+// destroyModeRequest writes a DestroyMode request to a byte slice.
+func destroyModeRequest(c *xgb.Conn, Mode Mode) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 4 // request opcode
+ buf[b] = 17 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Window))
+ xgb.Put32(buf[b:], uint32(Mode))
b += 4
- xgb.Put16(buf[b:], Enable)
- b += 2
-
- b += 2 // padding
-
return buf
}
-// GetScreenInfoCookie is a cookie used only for GetScreenInfo requests.
-type GetScreenInfoCookie struct {
+// GetCrtcGammaCookie is a cookie used only for GetCrtcGamma requests.
+type GetCrtcGammaCookie struct {
*xgb.Cookie
}
-// GetScreenInfo sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetScreenInfoCookie.Reply()
-func GetScreenInfo(c *xgb.Conn, Window xproto.Window) GetScreenInfoCookie {
+// GetCrtcGamma sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetCrtcGammaCookie.Reply()
+func GetCrtcGamma(c *xgb.Conn, Crtc Crtc) GetCrtcGammaCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetScreenInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getScreenInfoRequest(c, Window), cookie)
- return GetScreenInfoCookie{cookie}
+ c.NewRequest(getCrtcGammaRequest(c, Crtc), cookie)
+ return GetCrtcGammaCookie{cookie}
}
-// GetScreenInfoUnchecked sends an unchecked request.
+// GetCrtcGammaUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetScreenInfoUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenInfoCookie {
+func GetCrtcGammaUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcGammaCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetScreenInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getScreenInfoRequest(c, Window), cookie)
- return GetScreenInfoCookie{cookie}
+ c.NewRequest(getCrtcGammaRequest(c, Crtc), cookie)
+ return GetCrtcGammaCookie{cookie}
}
-// GetScreenInfoReply represents the data returned from a GetScreenInfo request.
-type GetScreenInfoReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- Rotations byte
- Root xproto.Window
- Timestamp xproto.Timestamp
- ConfigTimestamp xproto.Timestamp
- NSizes uint16
- SizeID uint16
- Rotation uint16
- Rate uint16
- NInfo uint16
- // padding: 2 bytes
- Sizes []ScreenSize // size: xgb.Pad((int(NSizes) * 8))
- Rates []RefreshRates // size: RefreshRatesListSize(Rates)
+// GetCrtcGammaReply represents the data returned from a GetCrtcGamma request.
+type GetCrtcGammaReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ Size uint16
+ // padding: 22 bytes
+ Red []uint16 // size: xgb.Pad((int(Size) * 2))
+ Green []uint16 // size: xgb.Pad((int(Size) * 2))
+ Blue []uint16 // size: xgb.Pad((int(Size) * 2))
}
-// Reply blocks and returns the reply data for a GetScreenInfo request.
-func (cook GetScreenInfoCookie) Reply() (*GetScreenInfoReply, error) {
+// Reply blocks and returns the reply data for a GetCrtcGamma request.
+func (cook GetCrtcGammaCookie) Reply() (*GetCrtcGammaReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1546,16 +1745,15 @@ func (cook GetScreenInfoCookie) Reply() (*GetScreenInfoReply, error) {
if buf == nil {
return nil, nil
}
- return getScreenInfoReply(buf), nil
+ return getCrtcGammaReply(buf), nil
}
-// getScreenInfoReply reads a byte slice into a GetScreenInfoReply value.
-func getScreenInfoReply(buf []byte) *GetScreenInfoReply {
- v := new(GetScreenInfoReply)
+// getCrtcGammaReply reads a byte slice into a GetCrtcGammaReply value.
+func getCrtcGammaReply(buf []byte) *GetCrtcGammaReply {
+ v := new(GetCrtcGammaReply)
b := 1 // skip reply determinant
- v.Rotations = buf[b]
- b += 1
+ b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
@@ -1563,44 +1761,38 @@ func getScreenInfoReply(buf []byte) *GetScreenInfoReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Root = xproto.Window(xgb.Get32(buf[b:]))
- b += 4
-
- v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
-
- v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
-
- v.NSizes = xgb.Get16(buf[b:])
- b += 2
-
- v.SizeID = xgb.Get16(buf[b:])
- b += 2
-
- v.Rotation = xgb.Get16(buf[b:])
- b += 2
-
- v.Rate = xgb.Get16(buf[b:])
+ v.Size = xgb.Get16(buf[b:])
b += 2
- v.NInfo = xgb.Get16(buf[b:])
- b += 2
+ b += 22 // padding
- b += 2 // padding
+ v.Red = make([]uint16, v.Size)
+ for i := 0; i < int(v.Size); i++ {
+ v.Red[i] = xgb.Get16(buf[b:])
+ b += 2
+ }
+ b = xgb.Pad(b)
- v.Sizes = make([]ScreenSize, v.NSizes)
- b += ScreenSizeReadList(buf[b:], v.Sizes)
+ v.Green = make([]uint16, v.Size)
+ for i := 0; i < int(v.Size); i++ {
+ v.Green[i] = xgb.Get16(buf[b:])
+ b += 2
+ }
+ b = xgb.Pad(b)
- v.Rates = make([]RefreshRates, (int(v.NInfo) - int(v.NSizes)))
- b += RefreshRatesReadList(buf[b:], v.Rates)
+ v.Blue = make([]uint16, v.Size)
+ for i := 0; i < int(v.Size); i++ {
+ v.Blue[i] = xgb.Get16(buf[b:])
+ b += 2
+ }
+ b = xgb.Pad(b)
return v
}
-// Write request to wire for GetScreenInfo
-// getScreenInfoRequest writes a GetScreenInfo request to a byte slice.
-func getScreenInfoRequest(c *xgb.Conn, Window xproto.Window) []byte {
+// Write request to wire for GetCrtcGamma
+// getCrtcGammaRequest writes a GetCrtcGamma request to a byte slice.
+func getCrtcGammaRequest(c *xgb.Conn, Crtc Crtc) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1608,59 +1800,56 @@ func getScreenInfoRequest(c *xgb.Conn, Window xproto.Window) []byte {
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 5 // request opcode
+ buf[b] = 23 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Window))
+ xgb.Put32(buf[b:], uint32(Crtc))
b += 4
return buf
}
-// GetScreenSizeRangeCookie is a cookie used only for GetScreenSizeRange requests.
-type GetScreenSizeRangeCookie struct {
+// GetCrtcGammaSizeCookie is a cookie used only for GetCrtcGammaSize requests.
+type GetCrtcGammaSizeCookie struct {
*xgb.Cookie
}
-// GetScreenSizeRange sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetScreenSizeRangeCookie.Reply()
-func GetScreenSizeRange(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie {
+// GetCrtcGammaSize sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetCrtcGammaSizeCookie.Reply()
+func GetCrtcGammaSize(c *xgb.Conn, Crtc Crtc) GetCrtcGammaSizeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetCrtcGammaSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getScreenSizeRangeRequest(c, Window), cookie)
- return GetScreenSizeRangeCookie{cookie}
+ c.NewRequest(getCrtcGammaSizeRequest(c, Crtc), cookie)
+ return GetCrtcGammaSizeCookie{cookie}
}
-// GetScreenSizeRangeUnchecked sends an unchecked request.
+// GetCrtcGammaSizeUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetScreenSizeRangeUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie {
+func GetCrtcGammaSizeUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcGammaSizeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetCrtcGammaSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getScreenSizeRangeRequest(c, Window), cookie)
- return GetScreenSizeRangeCookie{cookie}
+ c.NewRequest(getCrtcGammaSizeRequest(c, Crtc), cookie)
+ return GetCrtcGammaSizeCookie{cookie}
}
-// GetScreenSizeRangeReply represents the data returned from a GetScreenSizeRange request.
-type GetScreenSizeRangeReply struct {
+// GetCrtcGammaSizeReply represents the data returned from a GetCrtcGammaSize request.
+type GetCrtcGammaSizeReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- MinWidth uint16
- MinHeight uint16
- MaxWidth uint16
- MaxHeight uint16
- // padding: 16 bytes
+ Size uint16
+ // padding: 22 bytes
}
-// Reply blocks and returns the reply data for a GetScreenSizeRange request.
-func (cook GetScreenSizeRangeCookie) Reply() (*GetScreenSizeRangeReply, error) {
+// Reply blocks and returns the reply data for a GetCrtcGammaSize request.
+func (cook GetCrtcGammaSizeCookie) Reply() (*GetCrtcGammaSizeReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1668,12 +1857,12 @@ func (cook GetScreenSizeRangeCookie) Reply() (*GetScreenSizeRangeReply, error) {
if buf == nil {
return nil, nil
}
- return getScreenSizeRangeReply(buf), nil
+ return getCrtcGammaSizeReply(buf), nil
}
-// getScreenSizeRangeReply reads a byte slice into a GetScreenSizeRangeReply value.
-func getScreenSizeRangeReply(buf []byte) *GetScreenSizeRangeReply {
- v := new(GetScreenSizeRangeReply)
+// getCrtcGammaSizeReply reads a byte slice into a GetCrtcGammaSizeReply value.
+func getCrtcGammaSizeReply(buf []byte) *GetCrtcGammaSizeReply {
+ v := new(GetCrtcGammaSizeReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1684,26 +1873,17 @@ func getScreenSizeRangeReply(buf []byte) *GetScreenSizeRangeReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.MinWidth = xgb.Get16(buf[b:])
- b += 2
-
- v.MinHeight = xgb.Get16(buf[b:])
- b += 2
-
- v.MaxWidth = xgb.Get16(buf[b:])
- b += 2
-
- v.MaxHeight = xgb.Get16(buf[b:])
+ v.Size = xgb.Get16(buf[b:])
b += 2
- b += 16 // padding
+ b += 22 // padding
return v
}
-// Write request to wire for GetScreenSizeRange
-// getScreenSizeRangeRequest writes a GetScreenSizeRange request to a byte slice.
-func getScreenSizeRangeRequest(c *xgb.Conn, Window xproto.Window) []byte {
+// Write request to wire for GetCrtcGammaSize
+// getCrtcGammaSizeRequest writes a GetCrtcGammaSize request to a byte slice.
+func getCrtcGammaSizeRequest(c *xgb.Conn, Crtc Crtc) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1711,132 +1891,211 @@ func getScreenSizeRangeRequest(c *xgb.Conn, Window xproto.Window) []byte {
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 6 // request opcode
+ buf[b] = 22 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Window))
+ xgb.Put32(buf[b:], uint32(Crtc))
b += 4
return buf
}
-// SetScreenSizeCookie is a cookie used only for SetScreenSize requests.
-type SetScreenSizeCookie struct {
+// GetCrtcInfoCookie is a cookie used only for GetCrtcInfo requests.
+type GetCrtcInfoCookie struct {
*xgb.Cookie
}
-// SetScreenSize sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetScreenSize(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) SetScreenSizeCookie {
+// GetCrtcInfo sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetCrtcInfoCookie.Reply()
+func GetCrtcInfo(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) GetCrtcInfoCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetScreenSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetCrtcInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(setScreenSizeRequest(c, Window, Width, Height, MmWidth, MmHeight), cookie)
- return SetScreenSizeCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getCrtcInfoRequest(c, Crtc, ConfigTimestamp), cookie)
+ return GetCrtcInfoCookie{cookie}
}
-// SetScreenSizeChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetScreenSizeCookie.Check()
-func SetScreenSizeChecked(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) SetScreenSizeCookie {
+// GetCrtcInfoUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetCrtcInfoUnchecked(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) GetCrtcInfoCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetScreenSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetCrtcInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(setScreenSizeRequest(c, Window, Width, Height, MmWidth, MmHeight), cookie)
- return SetScreenSizeCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getCrtcInfoRequest(c, Crtc, ConfigTimestamp), cookie)
+ return GetCrtcInfoCookie{cookie}
}
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetScreenSizeCookie) Check() error {
- return cook.Cookie.Check()
+// GetCrtcInfoReply represents the data returned from a GetCrtcInfo request.
+type GetCrtcInfoReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ Status byte
+ Timestamp xproto.Timestamp
+ X int16
+ Y int16
+ Width uint16
+ Height uint16
+ Mode Mode
+ Rotation uint16
+ Rotations uint16
+ NumOutputs uint16
+ NumPossibleOutputs uint16
+ Outputs []Output // size: xgb.Pad((int(NumOutputs) * 4))
+ Possible []Output // size: xgb.Pad((int(NumPossibleOutputs) * 4))
}
-// Write request to wire for SetScreenSize
-// setScreenSizeRequest writes a SetScreenSize request to a byte slice.
-func setScreenSizeRequest(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) []byte {
- size := 20
- b := 0
- buf := make([]byte, size)
+// Reply blocks and returns the reply data for a GetCrtcInfo request.
+func (cook GetCrtcInfoCookie) Reply() (*GetCrtcInfoReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getCrtcInfoReply(buf), nil
+}
- buf[b] = c.Extensions["RANDR"]
- b += 1
+// getCrtcInfoReply reads a byte slice into a GetCrtcInfoReply value.
+func getCrtcInfoReply(buf []byte) *GetCrtcInfoReply {
+ v := new(GetCrtcInfoReply)
+ b := 1 // skip reply determinant
- buf[b] = 7 // request opcode
+ v.Status = buf[b]
b += 1
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ v.Sequence = xgb.Get16(buf[b:])
b += 2
- xgb.Put32(buf[b:], uint32(Window))
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- xgb.Put16(buf[b:], Width)
+ v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.X = int16(xgb.Get16(buf[b:]))
b += 2
- xgb.Put16(buf[b:], Height)
+ v.Y = int16(xgb.Get16(buf[b:]))
b += 2
- xgb.Put32(buf[b:], MmWidth)
+ v.Width = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Height = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Mode = Mode(xgb.Get32(buf[b:]))
b += 4
- xgb.Put32(buf[b:], MmHeight)
+ v.Rotation = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Rotations = xgb.Get16(buf[b:])
+ b += 2
+
+ v.NumOutputs = xgb.Get16(buf[b:])
+ b += 2
+
+ v.NumPossibleOutputs = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Outputs = make([]Output, v.NumOutputs)
+ for i := 0; i < int(v.NumOutputs); i++ {
+ v.Outputs[i] = Output(xgb.Get32(buf[b:]))
+ b += 4
+ }
+ b = xgb.Pad(b)
+
+ v.Possible = make([]Output, v.NumPossibleOutputs)
+ for i := 0; i < int(v.NumPossibleOutputs); i++ {
+ v.Possible[i] = Output(xgb.Get32(buf[b:]))
+ b += 4
+ }
+ b = xgb.Pad(b)
+
+ return v
+}
+
+// Write request to wire for GetCrtcInfo
+// getCrtcInfoRequest writes a GetCrtcInfo request to a byte slice.
+func getCrtcInfoRequest(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) []byte {
+ size := 12
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["RANDR"]
+ b += 1
+
+ buf[b] = 20 // request opcode
+ b += 1
+
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ b += 2
+
+ xgb.Put32(buf[b:], uint32(Crtc))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(ConfigTimestamp))
b += 4
return buf
}
-// GetScreenResourcesCookie is a cookie used only for GetScreenResources requests.
-type GetScreenResourcesCookie struct {
+// GetCrtcTransformCookie is a cookie used only for GetCrtcTransform requests.
+type GetCrtcTransformCookie struct {
*xgb.Cookie
}
-// GetScreenResources sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetScreenResourcesCookie.Reply()
-func GetScreenResources(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCookie {
+// GetCrtcTransform sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetCrtcTransformCookie.Reply()
+func GetCrtcTransform(c *xgb.Conn, Crtc Crtc) GetCrtcTransformCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetScreenResources' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getScreenResourcesRequest(c, Window), cookie)
- return GetScreenResourcesCookie{cookie}
+ c.NewRequest(getCrtcTransformRequest(c, Crtc), cookie)
+ return GetCrtcTransformCookie{cookie}
}
-// GetScreenResourcesUnchecked sends an unchecked request.
+// GetCrtcTransformUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetScreenResourcesUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCookie {
+func GetCrtcTransformUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcTransformCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetScreenResources' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getScreenResourcesRequest(c, Window), cookie)
- return GetScreenResourcesCookie{cookie}
+ c.NewRequest(getCrtcTransformRequest(c, Crtc), cookie)
+ return GetCrtcTransformCookie{cookie}
}
-// GetScreenResourcesReply represents the data returned from a GetScreenResources request.
-type GetScreenResourcesReply struct {
+// GetCrtcTransformReply represents the data returned from a GetCrtcTransform request.
+type GetCrtcTransformReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Timestamp xproto.Timestamp
- ConfigTimestamp xproto.Timestamp
- NumCrtcs uint16
- NumOutputs uint16
- NumModes uint16
- NamesLen uint16
- // padding: 8 bytes
- Crtcs []Crtc // size: xgb.Pad((int(NumCrtcs) * 4))
- Outputs []Output // size: xgb.Pad((int(NumOutputs) * 4))
- Modes []ModeInfo // size: xgb.Pad((int(NumModes) * 32))
- Names []byte // size: xgb.Pad((int(NamesLen) * 1))
+ PendingTransform render.Transform
+ HasTransforms bool
+ // padding: 3 bytes
+ CurrentTransform render.Transform
+ // padding: 4 bytes
+ PendingLen uint16
+ PendingNparams uint16
+ CurrentLen uint16
+ CurrentNparams uint16
+ PendingFilterName string // size: xgb.Pad((int(PendingLen) * 1))
+ PendingParams []render.Fixed // size: xgb.Pad((int(PendingNparams) * 4))
+ CurrentFilterName string // size: xgb.Pad((int(CurrentLen) * 1))
+ CurrentParams []render.Fixed // size: xgb.Pad((int(CurrentNparams) * 4))
}
-// Reply blocks and returns the reply data for a GetScreenResources request.
-func (cook GetScreenResourcesCookie) Reply() (*GetScreenResourcesReply, error) {
+// Reply blocks and returns the reply data for a GetCrtcTransform request.
+func (cook GetCrtcTransformCookie) Reply() (*GetCrtcTransformReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1844,12 +2103,12 @@ func (cook GetScreenResourcesCookie) Reply() (*GetScreenResourcesReply, error) {
if buf == nil {
return nil, nil
}
- return getScreenResourcesReply(buf), nil
+ return getCrtcTransformReply(buf), nil
}
-// getScreenResourcesReply reads a byte slice into a GetScreenResourcesReply value.
-func getScreenResourcesReply(buf []byte) *GetScreenResourcesReply {
- v := new(GetScreenResourcesReply)
+// getCrtcTransformReply reads a byte slice into a GetCrtcTransformReply value.
+func getCrtcTransformReply(buf []byte) *GetCrtcTransformReply {
+ v := new(GetCrtcTransformReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1860,53 +2119,69 @@ func getScreenResourcesReply(buf []byte) *GetScreenResourcesReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
+ v.PendingTransform = render.Transform{}
+ b += render.TransformRead(buf[b:], &v.PendingTransform)
- v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
+ if buf[b] == 1 {
+ v.HasTransforms = true
+ } else {
+ v.HasTransforms = false
+ }
+ b += 1
- v.NumCrtcs = xgb.Get16(buf[b:])
+ b += 3 // padding
+
+ v.CurrentTransform = render.Transform{}
+ b += render.TransformRead(buf[b:], &v.CurrentTransform)
+
+ b += 4 // padding
+
+ v.PendingLen = xgb.Get16(buf[b:])
b += 2
- v.NumOutputs = xgb.Get16(buf[b:])
+ v.PendingNparams = xgb.Get16(buf[b:])
b += 2
- v.NumModes = xgb.Get16(buf[b:])
+ v.CurrentLen = xgb.Get16(buf[b:])
b += 2
- v.NamesLen = xgb.Get16(buf[b:])
+ v.CurrentNparams = xgb.Get16(buf[b:])
b += 2
- b += 8 // padding
+ {
+ byteString := make([]byte, v.PendingLen)
+ copy(byteString[:v.PendingLen], buf[b:])
+ v.PendingFilterName = string(byteString)
+ b += xgb.Pad(int(v.PendingLen))
+ }
- v.Crtcs = make([]Crtc, v.NumCrtcs)
- for i := 0; i < int(v.NumCrtcs); i++ {
- v.Crtcs[i] = Crtc(xgb.Get32(buf[b:]))
+ v.PendingParams = make([]render.Fixed, v.PendingNparams)
+ for i := 0; i < int(v.PendingNparams); i++ {
+ v.PendingParams[i] = render.Fixed(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
- v.Outputs = make([]Output, v.NumOutputs)
- for i := 0; i < int(v.NumOutputs); i++ {
- v.Outputs[i] = Output(xgb.Get32(buf[b:]))
+ {
+ byteString := make([]byte, v.CurrentLen)
+ copy(byteString[:v.CurrentLen], buf[b:])
+ v.CurrentFilterName = string(byteString)
+ b += xgb.Pad(int(v.CurrentLen))
+ }
+
+ v.CurrentParams = make([]render.Fixed, v.CurrentNparams)
+ for i := 0; i < int(v.CurrentNparams); i++ {
+ v.CurrentParams[i] = render.Fixed(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
- v.Modes = make([]ModeInfo, v.NumModes)
- b += ModeInfoReadList(buf[b:], v.Modes)
-
- v.Names = make([]byte, v.NamesLen)
- copy(v.Names[:v.NamesLen], buf[b:])
- b += xgb.Pad(int(v.NamesLen))
-
return v
}
-// Write request to wire for GetScreenResources
-// getScreenResourcesRequest writes a GetScreenResources request to a byte slice.
-func getScreenResourcesRequest(c *xgb.Conn, Window xproto.Window) []byte {
+// Write request to wire for GetCrtcTransform
+// getCrtcTransformRequest writes a GetCrtcTransform request to a byte slice.
+func getCrtcTransformRequest(c *xgb.Conn, Crtc Crtc) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1914,13 +2189,13 @@ func getScreenResourcesRequest(c *xgb.Conn, Window xproto.Window) []byte {
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 8 // request opcode
+ buf[b] = 27 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Window))
+ xgb.Put32(buf[b:], uint32(Crtc))
b += 4
return buf
@@ -2087,45 +2362,43 @@ func getOutputInfoRequest(c *xgb.Conn, Output Output, ConfigTimestamp xproto.Tim
return buf
}
-// ListOutputPropertiesCookie is a cookie used only for ListOutputProperties requests.
-type ListOutputPropertiesCookie struct {
+// GetOutputPrimaryCookie is a cookie used only for GetOutputPrimary requests.
+type GetOutputPrimaryCookie struct {
*xgb.Cookie
}
-// ListOutputProperties sends a checked request.
-// If an error occurs, it will be returned with the reply by calling ListOutputPropertiesCookie.Reply()
-func ListOutputProperties(c *xgb.Conn, Output Output) ListOutputPropertiesCookie {
+// GetOutputPrimary sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetOutputPrimaryCookie.Reply()
+func GetOutputPrimary(c *xgb.Conn, Window xproto.Window) GetOutputPrimaryCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'ListOutputProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(listOutputPropertiesRequest(c, Output), cookie)
- return ListOutputPropertiesCookie{cookie}
+ c.NewRequest(getOutputPrimaryRequest(c, Window), cookie)
+ return GetOutputPrimaryCookie{cookie}
}
-// ListOutputPropertiesUnchecked sends an unchecked request.
+// GetOutputPrimaryUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ListOutputPropertiesUnchecked(c *xgb.Conn, Output Output) ListOutputPropertiesCookie {
+func GetOutputPrimaryUnchecked(c *xgb.Conn, Window xproto.Window) GetOutputPrimaryCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'ListOutputProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(listOutputPropertiesRequest(c, Output), cookie)
- return ListOutputPropertiesCookie{cookie}
+ c.NewRequest(getOutputPrimaryRequest(c, Window), cookie)
+ return GetOutputPrimaryCookie{cookie}
}
-// ListOutputPropertiesReply represents the data returned from a ListOutputProperties request.
-type ListOutputPropertiesReply struct {
+// GetOutputPrimaryReply represents the data returned from a GetOutputPrimary request.
+type GetOutputPrimaryReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- NumAtoms uint16
- // padding: 22 bytes
- Atoms []xproto.Atom // size: xgb.Pad((int(NumAtoms) * 4))
+ Output Output
}
-// Reply blocks and returns the reply data for a ListOutputProperties request.
-func (cook ListOutputPropertiesCookie) Reply() (*ListOutputPropertiesReply, error) {
+// Reply blocks and returns the reply data for a GetOutputPrimary request.
+func (cook GetOutputPrimaryCookie) Reply() (*GetOutputPrimaryReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -2133,12 +2406,12 @@ func (cook ListOutputPropertiesCookie) Reply() (*ListOutputPropertiesReply, erro
if buf == nil {
return nil, nil
}
- return listOutputPropertiesReply(buf), nil
+ return getOutputPrimaryReply(buf), nil
}
-// listOutputPropertiesReply reads a byte slice into a ListOutputPropertiesReply value.
-func listOutputPropertiesReply(buf []byte) *ListOutputPropertiesReply {
- v := new(ListOutputPropertiesReply)
+// getOutputPrimaryReply reads a byte slice into a GetOutputPrimaryReply value.
+func getOutputPrimaryReply(buf []byte) *GetOutputPrimaryReply {
+ v := new(GetOutputPrimaryReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -2149,24 +2422,15 @@ func listOutputPropertiesReply(buf []byte) *ListOutputPropertiesReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.NumAtoms = xgb.Get16(buf[b:])
- b += 2
-
- b += 22 // padding
-
- v.Atoms = make([]xproto.Atom, v.NumAtoms)
- for i := 0; i < int(v.NumAtoms); i++ {
- v.Atoms[i] = xproto.Atom(xgb.Get32(buf[b:]))
- b += 4
- }
- b = xgb.Pad(b)
+ v.Output = Output(xgb.Get32(buf[b:]))
+ b += 4
return v
}
-// Write request to wire for ListOutputProperties
-// listOutputPropertiesRequest writes a ListOutputProperties request to a byte slice.
-func listOutputPropertiesRequest(c *xgb.Conn, Output Output) []byte {
+// Write request to wire for GetOutputPrimary
+// getOutputPrimaryRequest writes a GetOutputPrimary request to a byte slice.
+func getOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -2174,59 +2438,59 @@ func listOutputPropertiesRequest(c *xgb.Conn, Output Output) []byte {
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 10 // request opcode
+ buf[b] = 31 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Output))
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
return buf
}
-// QueryOutputPropertyCookie is a cookie used only for QueryOutputProperty requests.
-type QueryOutputPropertyCookie struct {
+// GetOutputPropertyCookie is a cookie used only for GetOutputProperty requests.
+type GetOutputPropertyCookie struct {
*xgb.Cookie
}
-// QueryOutputProperty sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryOutputPropertyCookie.Reply()
-func QueryOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) QueryOutputPropertyCookie {
+// GetOutputProperty sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetOutputPropertyCookie.Reply()
+func GetOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetOutputPropertyCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'QueryOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(queryOutputPropertyRequest(c, Output, Property), cookie)
- return QueryOutputPropertyCookie{cookie}
+ c.NewRequest(getOutputPropertyRequest(c, Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie)
+ return GetOutputPropertyCookie{cookie}
}
-// QueryOutputPropertyUnchecked sends an unchecked request.
+// GetOutputPropertyUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryOutputPropertyUnchecked(c *xgb.Conn, Output Output, Property xproto.Atom) QueryOutputPropertyCookie {
+func GetOutputPropertyUnchecked(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetOutputPropertyCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'QueryOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(queryOutputPropertyRequest(c, Output, Property), cookie)
- return QueryOutputPropertyCookie{cookie}
+ c.NewRequest(getOutputPropertyRequest(c, Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie)
+ return GetOutputPropertyCookie{cookie}
}
-// QueryOutputPropertyReply represents the data returned from a QueryOutputProperty request.
-type QueryOutputPropertyReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- Pending bool
- Range bool
- Immutable bool
- // padding: 21 bytes
- ValidValues []int32 // size: xgb.Pad((int(Length) * 4))
+// GetOutputPropertyReply represents the data returned from a GetOutputProperty request.
+type GetOutputPropertyReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ Format byte
+ Type xproto.Atom
+ BytesAfter uint32
+ NumItems uint32
+ // padding: 12 bytes
+ Data []byte // size: xgb.Pad(((int(NumItems) * (int(Format) / 8)) * 1))
}
-// Reply blocks and returns the reply data for a QueryOutputProperty request.
-func (cook QueryOutputPropertyCookie) Reply() (*QueryOutputPropertyReply, error) {
+// Reply blocks and returns the reply data for a GetOutputProperty request.
+func (cook GetOutputPropertyCookie) Reply() (*GetOutputPropertyReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -2234,15 +2498,16 @@ func (cook QueryOutputPropertyCookie) Reply() (*QueryOutputPropertyReply, error)
if buf == nil {
return nil, nil
}
- return queryOutputPropertyReply(buf), nil
+ return getOutputPropertyReply(buf), nil
}
-// queryOutputPropertyReply reads a byte slice into a QueryOutputPropertyReply value.
-func queryOutputPropertyReply(buf []byte) *QueryOutputPropertyReply {
- v := new(QueryOutputPropertyReply)
+// getOutputPropertyReply reads a byte slice into a GetOutputPropertyReply value.
+func getOutputPropertyReply(buf []byte) *GetOutputPropertyReply {
+ v := new(GetOutputPropertyReply)
b := 1 // skip reply determinant
- b += 1 // padding
+ v.Format = buf[b]
+ b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
@@ -2250,50 +2515,35 @@ func queryOutputPropertyReply(buf []byte) *QueryOutputPropertyReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- if buf[b] == 1 {
- v.Pending = true
- } else {
- v.Pending = false
- }
- b += 1
+ v.Type = xproto.Atom(xgb.Get32(buf[b:]))
+ b += 4
- if buf[b] == 1 {
- v.Range = true
- } else {
- v.Range = false
- }
- b += 1
+ v.BytesAfter = xgb.Get32(buf[b:])
+ b += 4
- if buf[b] == 1 {
- v.Immutable = true
- } else {
- v.Immutable = false
- }
- b += 1
+ v.NumItems = xgb.Get32(buf[b:])
+ b += 4
- b += 21 // padding
+ b += 12 // padding
- v.ValidValues = make([]int32, v.Length)
- for i := 0; i < int(v.Length); i++ {
- v.ValidValues[i] = int32(xgb.Get32(buf[b:]))
- b += 4
- }
- b = xgb.Pad(b)
+ v.Data = make([]byte, (int(v.NumItems) * (int(v.Format) / 8)))
+ copy(v.Data[:(int(v.NumItems)*(int(v.Format)/8))], buf[b:])
+ b += xgb.Pad(int((int(v.NumItems) * (int(v.Format) / 8))))
return v
}
-// Write request to wire for QueryOutputProperty
-// queryOutputPropertyRequest writes a QueryOutputProperty request to a byte slice.
-func queryOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom) []byte {
- size := 12
+// Write request to wire for GetOutputProperty
+// getOutputPropertyRequest writes a GetOutputProperty request to a byte slice.
+func getOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) []byte {
+ size := 28
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 11 // request opcode
+ buf[b] = 15 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -2305,72 +2555,23 @@ func queryOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom
xgb.Put32(buf[b:], uint32(Property))
b += 4
- return buf
-}
-
-// ConfigureOutputPropertyCookie is a cookie used only for ConfigureOutputProperty requests.
-type ConfigureOutputPropertyCookie struct {
- *xgb.Cookie
-}
-
-// ConfigureOutputProperty sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ConfigureOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureOutputPropertyCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'ConfigureOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(configureOutputPropertyRequest(c, Output, Property, Pending, Range, Values), cookie)
- return ConfigureOutputPropertyCookie{cookie}
-}
-
-// ConfigureOutputPropertyChecked sends a checked request.
-// If an error occurs, it can be retrieved using ConfigureOutputPropertyCookie.Check()
-func ConfigureOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureOutputPropertyCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'ConfigureOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(configureOutputPropertyRequest(c, Output, Property, Pending, Range, Values), cookie)
- return ConfigureOutputPropertyCookie{cookie}
-}
-
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook ConfigureOutputPropertyCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for ConfigureOutputProperty
-// configureOutputPropertyRequest writes a ConfigureOutputProperty request to a byte slice.
-func configureOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) []byte {
- size := xgb.Pad((16 + xgb.Pad((len(Values) * 4))))
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["RANDR"]
- b += 1
-
- buf[b] = 12 // request opcode
- b += 1
-
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
- b += 2
+ xgb.Put32(buf[b:], uint32(Type))
+ b += 4
- xgb.Put32(buf[b:], uint32(Output))
+ xgb.Put32(buf[b:], LongOffset)
b += 4
- xgb.Put32(buf[b:], uint32(Property))
+ xgb.Put32(buf[b:], LongLength)
b += 4
- if Pending {
+ if Delete {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
- if Range {
+ if Pending {
buf[b] = 1
} else {
buf[b] = 0
@@ -2379,189 +2580,193 @@ func configureOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.
b += 2 // padding
- for i := 0; i < int(len(Values)); i++ {
- xgb.Put32(buf[b:], uint32(Values[i]))
- b += 4
- }
- b = xgb.Pad(b)
-
return buf
}
-// ChangeOutputPropertyCookie is a cookie used only for ChangeOutputProperty requests.
-type ChangeOutputPropertyCookie struct {
+// GetPanningCookie is a cookie used only for GetPanning requests.
+type GetPanningCookie struct {
*xgb.Cookie
}
-// ChangeOutputProperty sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ChangeOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) ChangeOutputPropertyCookie {
+// GetPanning sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetPanningCookie.Reply()
+func GetPanning(c *xgb.Conn, Crtc Crtc) GetPanningCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'ChangeOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(changeOutputPropertyRequest(c, Output, Property, Type, Format, Mode, NumUnits, Data), cookie)
- return ChangeOutputPropertyCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getPanningRequest(c, Crtc), cookie)
+ return GetPanningCookie{cookie}
}
-// ChangeOutputPropertyChecked sends a checked request.
-// If an error occurs, it can be retrieved using ChangeOutputPropertyCookie.Check()
-func ChangeOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) ChangeOutputPropertyCookie {
+// GetPanningUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetPanningUnchecked(c *xgb.Conn, Crtc Crtc) GetPanningCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'ChangeOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(changeOutputPropertyRequest(c, Output, Property, Type, Format, Mode, NumUnits, Data), cookie)
- return ChangeOutputPropertyCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getPanningRequest(c, Crtc), cookie)
+ return GetPanningCookie{cookie}
}
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook ChangeOutputPropertyCookie) Check() error {
- return cook.Cookie.Check()
+// GetPanningReply represents the data returned from a GetPanning request.
+type GetPanningReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ Status byte
+ 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
}
-// Write request to wire for ChangeOutputProperty
-// changeOutputPropertyRequest writes a ChangeOutputProperty request to a byte slice.
-func changeOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) []byte {
- size := xgb.Pad((24 + xgb.Pad((((int(NumUnits) * int(Format)) / 8) * 1))))
- b := 0
- buf := make([]byte, size)
+// Reply blocks and returns the reply data for a GetPanning request.
+func (cook GetPanningCookie) Reply() (*GetPanningReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getPanningReply(buf), nil
+}
- buf[b] = c.Extensions["RANDR"]
- b += 1
+// getPanningReply reads a byte slice into a GetPanningReply value.
+func getPanningReply(buf []byte) *GetPanningReply {
+ v := new(GetPanningReply)
+ b := 1 // skip reply determinant
- buf[b] = 13 // request opcode
+ v.Status = buf[b]
b += 1
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ v.Sequence = xgb.Get16(buf[b:])
b += 2
- xgb.Put32(buf[b:], uint32(Output))
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- xgb.Put32(buf[b:], uint32(Property))
+ v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
b += 4
- xgb.Put32(buf[b:], uint32(Type))
- b += 4
+ v.Left = xgb.Get16(buf[b:])
+ b += 2
- buf[b] = Format
- b += 1
+ v.Top = xgb.Get16(buf[b:])
+ b += 2
- buf[b] = Mode
- b += 1
+ v.Width = xgb.Get16(buf[b:])
+ b += 2
- b += 2 // padding
+ v.Height = xgb.Get16(buf[b:])
+ b += 2
- xgb.Put32(buf[b:], NumUnits)
- b += 4
+ v.TrackLeft = xgb.Get16(buf[b:])
+ b += 2
- copy(buf[b:], Data[:((int(NumUnits)*int(Format))/8)])
- b += xgb.Pad(int(((int(NumUnits) * int(Format)) / 8)))
+ v.TrackTop = xgb.Get16(buf[b:])
+ b += 2
- return buf
-}
+ v.TrackWidth = xgb.Get16(buf[b:])
+ b += 2
-// DeleteOutputPropertyCookie is a cookie used only for DeleteOutputProperty requests.
-type DeleteOutputPropertyCookie struct {
- *xgb.Cookie
-}
+ v.TrackHeight = xgb.Get16(buf[b:])
+ b += 2
-// DeleteOutputProperty sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func DeleteOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) DeleteOutputPropertyCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'DeleteOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(deleteOutputPropertyRequest(c, Output, Property), cookie)
- return DeleteOutputPropertyCookie{cookie}
-}
+ v.BorderLeft = int16(xgb.Get16(buf[b:]))
+ b += 2
-// DeleteOutputPropertyChecked sends a checked request.
-// If an error occurs, it can be retrieved using DeleteOutputPropertyCookie.Check()
-func DeleteOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom) DeleteOutputPropertyCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'DeleteOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(deleteOutputPropertyRequest(c, Output, Property), cookie)
- return DeleteOutputPropertyCookie{cookie}
-}
+ v.BorderTop = int16(xgb.Get16(buf[b:]))
+ b += 2
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook DeleteOutputPropertyCookie) Check() error {
- return cook.Cookie.Check()
+ v.BorderRight = int16(xgb.Get16(buf[b:]))
+ b += 2
+
+ v.BorderBottom = int16(xgb.Get16(buf[b:]))
+ b += 2
+
+ return v
}
-// Write request to wire for DeleteOutputProperty
-// deleteOutputPropertyRequest writes a DeleteOutputProperty request to a byte slice.
-func deleteOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom) []byte {
- size := 12
+// Write request to wire for GetPanning
+// getPanningRequest writes a GetPanning request to a byte slice.
+func getPanningRequest(c *xgb.Conn, Crtc Crtc) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 14 // request opcode
+ buf[b] = 28 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Output))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Property))
+ xgb.Put32(buf[b:], uint32(Crtc))
b += 4
return buf
}
-// GetOutputPropertyCookie is a cookie used only for GetOutputProperty requests.
-type GetOutputPropertyCookie struct {
+// GetScreenInfoCookie is a cookie used only for GetScreenInfo requests.
+type GetScreenInfoCookie struct {
*xgb.Cookie
}
-// GetOutputProperty sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetOutputPropertyCookie.Reply()
-func GetOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetOutputPropertyCookie {
+// GetScreenInfo sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetScreenInfoCookie.Reply()
+func GetScreenInfo(c *xgb.Conn, Window xproto.Window) GetScreenInfoCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetScreenInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getOutputPropertyRequest(c, Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie)
- return GetOutputPropertyCookie{cookie}
+ c.NewRequest(getScreenInfoRequest(c, Window), cookie)
+ return GetScreenInfoCookie{cookie}
}
-// GetOutputPropertyUnchecked sends an unchecked request.
+// GetScreenInfoUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetOutputPropertyUnchecked(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetOutputPropertyCookie {
+func GetScreenInfoUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenInfoCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetScreenInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getOutputPropertyRequest(c, Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie)
- return GetOutputPropertyCookie{cookie}
+ c.NewRequest(getScreenInfoRequest(c, Window), cookie)
+ return GetScreenInfoCookie{cookie}
}
-// GetOutputPropertyReply represents the data returned from a GetOutputProperty request.
-type GetOutputPropertyReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- Format byte
- Type xproto.Atom
- BytesAfter uint32
- NumItems uint32
- // padding: 12 bytes
- Data []byte // size: xgb.Pad(((int(NumItems) * (int(Format) / 8)) * 1))
+// GetScreenInfoReply represents the data returned from a GetScreenInfo request.
+type GetScreenInfoReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ Rotations byte
+ Root xproto.Window
+ Timestamp xproto.Timestamp
+ ConfigTimestamp xproto.Timestamp
+ NSizes uint16
+ SizeID uint16
+ Rotation uint16
+ Rate uint16
+ NInfo uint16
+ // padding: 2 bytes
+ Sizes []ScreenSize // size: xgb.Pad((int(NSizes) * 8))
+ Rates []RefreshRates // size: RefreshRatesListSize(Rates)
}
-// Reply blocks and returns the reply data for a GetOutputProperty request.
-func (cook GetOutputPropertyCookie) Reply() (*GetOutputPropertyReply, error) {
+// Reply blocks and returns the reply data for a GetScreenInfo request.
+func (cook GetScreenInfoCookie) Reply() (*GetScreenInfoReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -2569,15 +2774,15 @@ func (cook GetOutputPropertyCookie) Reply() (*GetOutputPropertyReply, error) {
if buf == nil {
return nil, nil
}
- return getOutputPropertyReply(buf), nil
+ return getScreenInfoReply(buf), nil
}
-// getOutputPropertyReply reads a byte slice into a GetOutputPropertyReply value.
-func getOutputPropertyReply(buf []byte) *GetOutputPropertyReply {
- v := new(GetOutputPropertyReply)
+// getScreenInfoReply reads a byte slice into a GetScreenInfoReply value.
+func getScreenInfoReply(buf []byte) *GetScreenInfoReply {
+ v := new(GetScreenInfoReply)
b := 1 // skip reply determinant
- v.Format = buf[b]
+ v.Rotations = buf[b]
b += 1
v.Sequence = xgb.Get16(buf[b:])
@@ -2586,112 +2791,110 @@ func getOutputPropertyReply(buf []byte) *GetOutputPropertyReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Type = xproto.Atom(xgb.Get32(buf[b:]))
+ v.Root = xproto.Window(xgb.Get32(buf[b:]))
b += 4
- v.BytesAfter = xgb.Get32(buf[b:])
+ v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
b += 4
- v.NumItems = xgb.Get32(buf[b:])
+ v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
b += 4
- b += 12 // padding
+ v.NSizes = xgb.Get16(buf[b:])
+ b += 2
- v.Data = make([]byte, (int(v.NumItems) * (int(v.Format) / 8)))
- copy(v.Data[:(int(v.NumItems)*(int(v.Format)/8))], buf[b:])
- b += xgb.Pad(int((int(v.NumItems) * (int(v.Format) / 8))))
+ v.SizeID = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Rotation = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Rate = xgb.Get16(buf[b:])
+ b += 2
+
+ v.NInfo = xgb.Get16(buf[b:])
+ b += 2
+
+ b += 2 // padding
+
+ v.Sizes = make([]ScreenSize, v.NSizes)
+ b += ScreenSizeReadList(buf[b:], v.Sizes)
+
+ v.Rates = make([]RefreshRates, (int(v.NInfo) - int(v.NSizes)))
+ b += RefreshRatesReadList(buf[b:], v.Rates)
return v
}
-// Write request to wire for GetOutputProperty
-// getOutputPropertyRequest writes a GetOutputProperty request to a byte slice.
-func getOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) []byte {
- size := 28
+// Write request to wire for GetScreenInfo
+// getScreenInfoRequest writes a GetScreenInfo request to a byte slice.
+func getScreenInfoRequest(c *xgb.Conn, Window xproto.Window) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 15 // request opcode
+ buf[b] = 5 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Output))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Property))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Type))
- b += 4
-
- xgb.Put32(buf[b:], LongOffset)
- b += 4
-
- xgb.Put32(buf[b:], LongLength)
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
- if Delete {
- buf[b] = 1
- } else {
- buf[b] = 0
- }
- b += 1
-
- if Pending {
- buf[b] = 1
- } else {
- buf[b] = 0
- }
- b += 1
-
- b += 2 // padding
-
return buf
}
-// CreateModeCookie is a cookie used only for CreateMode requests.
-type CreateModeCookie struct {
+// GetScreenResourcesCookie is a cookie used only for GetScreenResources requests.
+type GetScreenResourcesCookie struct {
*xgb.Cookie
}
-// CreateMode sends a checked request.
-// If an error occurs, it will be returned with the reply by calling CreateModeCookie.Reply()
-func CreateMode(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) CreateModeCookie {
+// GetScreenResources sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetScreenResourcesCookie.Reply()
+func GetScreenResources(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'CreateMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetScreenResources' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(createModeRequest(c, Window, ModeInfo, Name), cookie)
- return CreateModeCookie{cookie}
+ c.NewRequest(getScreenResourcesRequest(c, Window), cookie)
+ return GetScreenResourcesCookie{cookie}
}
-// CreateModeUnchecked sends an unchecked request.
+// GetScreenResourcesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func CreateModeUnchecked(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) CreateModeCookie {
+func GetScreenResourcesUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'CreateMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetScreenResources' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(createModeRequest(c, Window, ModeInfo, Name), cookie)
- return CreateModeCookie{cookie}
+ c.NewRequest(getScreenResourcesRequest(c, Window), cookie)
+ return GetScreenResourcesCookie{cookie}
}
-// CreateModeReply represents the data returned from a CreateMode request.
-type CreateModeReply struct {
+// GetScreenResourcesReply represents the data returned from a GetScreenResources request.
+type GetScreenResourcesReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Mode Mode
- // padding: 20 bytes
+ Timestamp xproto.Timestamp
+ ConfigTimestamp xproto.Timestamp
+ NumCrtcs uint16
+ NumOutputs uint16
+ NumModes uint16
+ NamesLen uint16
+ // padding: 8 bytes
+ Crtcs []Crtc // size: xgb.Pad((int(NumCrtcs) * 4))
+ Outputs []Output // size: xgb.Pad((int(NumOutputs) * 4))
+ Modes []ModeInfo // size: xgb.Pad((int(NumModes) * 32))
+ Names []byte // size: xgb.Pad((int(NamesLen) * 1))
}
-// Reply blocks and returns the reply data for a CreateMode request.
-func (cook CreateModeCookie) Reply() (*CreateModeReply, error) {
+// Reply blocks and returns the reply data for a GetScreenResources request.
+func (cook GetScreenResourcesCookie) Reply() (*GetScreenResourcesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -2699,12 +2902,12 @@ func (cook CreateModeCookie) Reply() (*CreateModeReply, error) {
if buf == nil {
return nil, nil
}
- return createModeReply(buf), nil
+ return getScreenResourcesReply(buf), nil
}
-// createModeReply reads a byte slice into a CreateModeReply value.
-func createModeReply(buf []byte) *CreateModeReply {
- v := new(CreateModeReply)
+// getScreenResourcesReply reads a byte slice into a GetScreenResourcesReply value.
+func getScreenResourcesReply(buf []byte) *GetScreenResourcesReply {
+ v := new(GetScreenResourcesReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -2715,81 +2918,53 @@ func createModeReply(buf []byte) *CreateModeReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Mode = Mode(xgb.Get32(buf[b:]))
+ v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
b += 4
- b += 20 // padding
-
- return v
-}
+ v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ b += 4
-// Write request to wire for CreateMode
-// createModeRequest writes a CreateMode request to a byte slice.
-func createModeRequest(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) []byte {
- size := xgb.Pad((40 + xgb.Pad((len(Name) * 1))))
- b := 0
- buf := make([]byte, size)
+ v.NumCrtcs = xgb.Get16(buf[b:])
+ b += 2
- buf[b] = c.Extensions["RANDR"]
- b += 1
+ v.NumOutputs = xgb.Get16(buf[b:])
+ b += 2
- buf[b] = 16 // request opcode
- b += 1
+ v.NumModes = xgb.Get16(buf[b:])
+ b += 2
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ v.NamesLen = xgb.Get16(buf[b:])
b += 2
- xgb.Put32(buf[b:], uint32(Window))
- b += 4
+ b += 8 // padding
- {
- structBytes := ModeInfo.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ v.Crtcs = make([]Crtc, v.NumCrtcs)
+ for i := 0; i < int(v.NumCrtcs); i++ {
+ v.Crtcs[i] = Crtc(xgb.Get32(buf[b:]))
+ b += 4
}
+ b = xgb.Pad(b)
- copy(buf[b:], Name[:len(Name)])
- b += xgb.Pad(int(len(Name)))
-
- return buf
-}
-
-// DestroyModeCookie is a cookie used only for DestroyMode requests.
-type DestroyModeCookie struct {
- *xgb.Cookie
-}
-
-// DestroyMode sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func DestroyMode(c *xgb.Conn, Mode Mode) DestroyModeCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'DestroyMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ v.Outputs = make([]Output, v.NumOutputs)
+ for i := 0; i < int(v.NumOutputs); i++ {
+ v.Outputs[i] = Output(xgb.Get32(buf[b:]))
+ b += 4
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(destroyModeRequest(c, Mode), cookie)
- return DestroyModeCookie{cookie}
-}
+ b = xgb.Pad(b)
-// DestroyModeChecked sends a checked request.
-// If an error occurs, it can be retrieved using DestroyModeCookie.Check()
-func DestroyModeChecked(c *xgb.Conn, Mode Mode) DestroyModeCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'DestroyMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(destroyModeRequest(c, Mode), cookie)
- return DestroyModeCookie{cookie}
-}
+ v.Modes = make([]ModeInfo, v.NumModes)
+ b += ModeInfoReadList(buf[b:], v.Modes)
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook DestroyModeCookie) Check() error {
- return cook.Cookie.Check()
+ v.Names = make([]byte, v.NamesLen)
+ copy(v.Names[:v.NamesLen], buf[b:])
+ b += xgb.Pad(int(v.NamesLen))
+
+ return v
}
-// Write request to wire for DestroyMode
-// destroyModeRequest writes a DestroyMode request to a byte slice.
-func destroyModeRequest(c *xgb.Conn, Mode Mode) []byte {
+// Write request to wire for GetScreenResources
+// getScreenResourcesRequest writes a GetScreenResources request to a byte slice.
+func getScreenResourcesRequest(c *xgb.Conn, Window xproto.Window) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -2797,182 +2972,195 @@ func destroyModeRequest(c *xgb.Conn, Mode Mode) []byte {
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 17 // request opcode
+ buf[b] = 8 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Mode))
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
return buf
}
-// AddOutputModeCookie is a cookie used only for AddOutputMode requests.
-type AddOutputModeCookie struct {
+// GetScreenResourcesCurrentCookie is a cookie used only for GetScreenResourcesCurrent requests.
+type GetScreenResourcesCurrentCookie struct {
*xgb.Cookie
}
-// AddOutputMode sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func AddOutputMode(c *xgb.Conn, Output Output, Mode Mode) AddOutputModeCookie {
+// GetScreenResourcesCurrent sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetScreenResourcesCurrentCookie.Reply()
+func GetScreenResourcesCurrent(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCurrentCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'AddOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetScreenResourcesCurrent' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(addOutputModeRequest(c, Output, Mode), cookie)
- return AddOutputModeCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getScreenResourcesCurrentRequest(c, Window), cookie)
+ return GetScreenResourcesCurrentCookie{cookie}
}
-// AddOutputModeChecked sends a checked request.
-// If an error occurs, it can be retrieved using AddOutputModeCookie.Check()
-func AddOutputModeChecked(c *xgb.Conn, Output Output, Mode Mode) AddOutputModeCookie {
+// GetScreenResourcesCurrentUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetScreenResourcesCurrentUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCurrentCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'AddOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetScreenResourcesCurrent' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(addOutputModeRequest(c, Output, Mode), cookie)
- return AddOutputModeCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getScreenResourcesCurrentRequest(c, Window), cookie)
+ return GetScreenResourcesCurrentCookie{cookie}
}
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook AddOutputModeCookie) Check() error {
- return cook.Cookie.Check()
+// GetScreenResourcesCurrentReply represents the data returned from a GetScreenResourcesCurrent request.
+type GetScreenResourcesCurrentReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ Timestamp xproto.Timestamp
+ ConfigTimestamp xproto.Timestamp
+ NumCrtcs uint16
+ NumOutputs uint16
+ NumModes uint16
+ NamesLen uint16
+ // padding: 8 bytes
+ Crtcs []Crtc // size: xgb.Pad((int(NumCrtcs) * 4))
+ Outputs []Output // size: xgb.Pad((int(NumOutputs) * 4))
+ Modes []ModeInfo // size: xgb.Pad((int(NumModes) * 32))
+ Names []byte // size: xgb.Pad((int(NamesLen) * 1))
}
-// Write request to wire for AddOutputMode
-// addOutputModeRequest writes a AddOutputMode request to a byte slice.
-func addOutputModeRequest(c *xgb.Conn, Output Output, Mode Mode) []byte {
- size := 12
- b := 0
- buf := make([]byte, size)
+// Reply blocks and returns the reply data for a GetScreenResourcesCurrent request.
+func (cook GetScreenResourcesCurrentCookie) Reply() (*GetScreenResourcesCurrentReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getScreenResourcesCurrentReply(buf), nil
+}
- buf[b] = c.Extensions["RANDR"]
- b += 1
+// getScreenResourcesCurrentReply reads a byte slice into a GetScreenResourcesCurrentReply value.
+func getScreenResourcesCurrentReply(buf []byte) *GetScreenResourcesCurrentReply {
+ v := new(GetScreenResourcesCurrentReply)
+ b := 1 // skip reply determinant
- buf[b] = 18 // request opcode
- b += 1
+ b += 1 // padding
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ v.Sequence = xgb.Get16(buf[b:])
b += 2
- xgb.Put32(buf[b:], uint32(Output))
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- xgb.Put32(buf[b:], uint32(Mode))
+ v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
b += 4
- return buf
-}
+ v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ b += 4
-// DeleteOutputModeCookie is a cookie used only for DeleteOutputMode requests.
-type DeleteOutputModeCookie struct {
- *xgb.Cookie
-}
+ v.NumCrtcs = xgb.Get16(buf[b:])
+ b += 2
-// DeleteOutputMode sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func DeleteOutputMode(c *xgb.Conn, Output Output, Mode Mode) DeleteOutputModeCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'DeleteOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ v.NumOutputs = xgb.Get16(buf[b:])
+ b += 2
+
+ v.NumModes = xgb.Get16(buf[b:])
+ b += 2
+
+ v.NamesLen = xgb.Get16(buf[b:])
+ b += 2
+
+ b += 8 // padding
+
+ v.Crtcs = make([]Crtc, v.NumCrtcs)
+ for i := 0; i < int(v.NumCrtcs); i++ {
+ v.Crtcs[i] = Crtc(xgb.Get32(buf[b:]))
+ b += 4
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(deleteOutputModeRequest(c, Output, Mode), cookie)
- return DeleteOutputModeCookie{cookie}
-}
+ b = xgb.Pad(b)
-// DeleteOutputModeChecked sends a checked request.
-// If an error occurs, it can be retrieved using DeleteOutputModeCookie.Check()
-func DeleteOutputModeChecked(c *xgb.Conn, Output Output, Mode Mode) DeleteOutputModeCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'DeleteOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ v.Outputs = make([]Output, v.NumOutputs)
+ for i := 0; i < int(v.NumOutputs); i++ {
+ v.Outputs[i] = Output(xgb.Get32(buf[b:]))
+ b += 4
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(deleteOutputModeRequest(c, Output, Mode), cookie)
- return DeleteOutputModeCookie{cookie}
-}
+ b = xgb.Pad(b)
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook DeleteOutputModeCookie) Check() error {
- return cook.Cookie.Check()
+ v.Modes = make([]ModeInfo, v.NumModes)
+ b += ModeInfoReadList(buf[b:], v.Modes)
+
+ v.Names = make([]byte, v.NamesLen)
+ copy(v.Names[:v.NamesLen], buf[b:])
+ b += xgb.Pad(int(v.NamesLen))
+
+ return v
}
-// Write request to wire for DeleteOutputMode
-// deleteOutputModeRequest writes a DeleteOutputMode request to a byte slice.
-func deleteOutputModeRequest(c *xgb.Conn, Output Output, Mode Mode) []byte {
- size := 12
+// Write request to wire for GetScreenResourcesCurrent
+// getScreenResourcesCurrentRequest writes a GetScreenResourcesCurrent request to a byte slice.
+func getScreenResourcesCurrentRequest(c *xgb.Conn, Window xproto.Window) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 19 // request opcode
+ buf[b] = 25 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Output))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Mode))
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
return buf
}
-// GetCrtcInfoCookie is a cookie used only for GetCrtcInfo requests.
-type GetCrtcInfoCookie struct {
+// GetScreenSizeRangeCookie is a cookie used only for GetScreenSizeRange requests.
+type GetScreenSizeRangeCookie struct {
*xgb.Cookie
}
-// GetCrtcInfo sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetCrtcInfoCookie.Reply()
-func GetCrtcInfo(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) GetCrtcInfoCookie {
+// GetScreenSizeRange sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetScreenSizeRangeCookie.Reply()
+func GetScreenSizeRange(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetCrtcInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getCrtcInfoRequest(c, Crtc, ConfigTimestamp), cookie)
- return GetCrtcInfoCookie{cookie}
+ c.NewRequest(getScreenSizeRangeRequest(c, Window), cookie)
+ return GetScreenSizeRangeCookie{cookie}
}
-// GetCrtcInfoUnchecked sends an unchecked request.
+// GetScreenSizeRangeUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetCrtcInfoUnchecked(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) GetCrtcInfoCookie {
+func GetScreenSizeRangeUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetCrtcInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getCrtcInfoRequest(c, Crtc, ConfigTimestamp), cookie)
- return GetCrtcInfoCookie{cookie}
+ c.NewRequest(getScreenSizeRangeRequest(c, Window), cookie)
+ return GetScreenSizeRangeCookie{cookie}
}
-// GetCrtcInfoReply represents the data returned from a GetCrtcInfo request.
-type GetCrtcInfoReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- Status byte
- Timestamp xproto.Timestamp
- X int16
- Y int16
- Width uint16
- Height uint16
- Mode Mode
- Rotation uint16
- Rotations uint16
- NumOutputs uint16
- NumPossibleOutputs uint16
- Outputs []Output // size: xgb.Pad((int(NumOutputs) * 4))
- Possible []Output // size: xgb.Pad((int(NumPossibleOutputs) * 4))
+// GetScreenSizeRangeReply represents the data returned from a GetScreenSizeRange request.
+type GetScreenSizeRangeReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ MinWidth uint16
+ MinHeight uint16
+ MaxWidth uint16
+ MaxHeight uint16
+ // padding: 16 bytes
}
-// Reply blocks and returns the reply data for a GetCrtcInfo request.
-func (cook GetCrtcInfoCookie) Reply() (*GetCrtcInfoReply, error) {
+// Reply blocks and returns the reply data for a GetScreenSizeRange request.
+func (cook GetScreenSizeRangeCookie) Reply() (*GetScreenSizeRangeReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -2980,16 +3168,15 @@ func (cook GetCrtcInfoCookie) Reply() (*GetCrtcInfoReply, error) {
if buf == nil {
return nil, nil
}
- return getCrtcInfoReply(buf), nil
+ return getScreenSizeRangeReply(buf), nil
}
-// getCrtcInfoReply reads a byte slice into a GetCrtcInfoReply value.
-func getCrtcInfoReply(buf []byte) *GetCrtcInfoReply {
- v := new(GetCrtcInfoReply)
+// getScreenSizeRangeReply reads a byte slice into a GetScreenSizeRangeReply value.
+func getScreenSizeRangeReply(buf []byte) *GetScreenSizeRangeReply {
+ v := new(GetScreenSizeRangeReply)
b := 1 // skip reply determinant
- v.Status = buf[b]
- b += 1
+ b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
@@ -2997,116 +3184,84 @@ func getCrtcInfoReply(buf []byte) *GetCrtcInfoReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
-
- v.X = int16(xgb.Get16(buf[b:]))
- b += 2
-
- v.Y = int16(xgb.Get16(buf[b:]))
- b += 2
-
- v.Width = xgb.Get16(buf[b:])
- b += 2
-
- v.Height = xgb.Get16(buf[b:])
- b += 2
-
- v.Mode = Mode(xgb.Get32(buf[b:]))
- b += 4
-
- v.Rotation = xgb.Get16(buf[b:])
+ v.MinWidth = xgb.Get16(buf[b:])
b += 2
- v.Rotations = xgb.Get16(buf[b:])
+ v.MinHeight = xgb.Get16(buf[b:])
b += 2
- v.NumOutputs = xgb.Get16(buf[b:])
+ v.MaxWidth = xgb.Get16(buf[b:])
b += 2
- v.NumPossibleOutputs = xgb.Get16(buf[b:])
+ v.MaxHeight = xgb.Get16(buf[b:])
b += 2
- v.Outputs = make([]Output, v.NumOutputs)
- for i := 0; i < int(v.NumOutputs); i++ {
- v.Outputs[i] = Output(xgb.Get32(buf[b:]))
- b += 4
- }
- b = xgb.Pad(b)
-
- v.Possible = make([]Output, v.NumPossibleOutputs)
- for i := 0; i < int(v.NumPossibleOutputs); i++ {
- v.Possible[i] = Output(xgb.Get32(buf[b:]))
- b += 4
- }
- b = xgb.Pad(b)
+ b += 16 // padding
return v
}
-// Write request to wire for GetCrtcInfo
-// getCrtcInfoRequest writes a GetCrtcInfo request to a byte slice.
-func getCrtcInfoRequest(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) []byte {
- size := 12
+// Write request to wire for GetScreenSizeRange
+// getScreenSizeRangeRequest writes a GetScreenSizeRange request to a byte slice.
+func getScreenSizeRangeRequest(c *xgb.Conn, Window xproto.Window) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 20 // request opcode
+ buf[b] = 6 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Crtc))
- b += 4
-
- xgb.Put32(buf[b:], uint32(ConfigTimestamp))
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
return buf
}
-// SetCrtcConfigCookie is a cookie used only for SetCrtcConfig requests.
-type SetCrtcConfigCookie struct {
+// ListOutputPropertiesCookie is a cookie used only for ListOutputProperties requests.
+type ListOutputPropertiesCookie struct {
*xgb.Cookie
}
-// SetCrtcConfig sends a checked request.
-// If an error occurs, it will be returned with the reply by calling SetCrtcConfigCookie.Reply()
-func SetCrtcConfig(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) SetCrtcConfigCookie {
+// ListOutputProperties sends a checked request.
+// If an error occurs, it will be returned with the reply by calling ListOutputPropertiesCookie.Reply()
+func ListOutputProperties(c *xgb.Conn, Output Output) ListOutputPropertiesCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetCrtcConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ListOutputProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(setCrtcConfigRequest(c, Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie)
- return SetCrtcConfigCookie{cookie}
+ c.NewRequest(listOutputPropertiesRequest(c, Output), cookie)
+ return ListOutputPropertiesCookie{cookie}
}
-// SetCrtcConfigUnchecked sends an unchecked request.
+// ListOutputPropertiesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetCrtcConfigUnchecked(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) SetCrtcConfigCookie {
+func ListOutputPropertiesUnchecked(c *xgb.Conn, Output Output) ListOutputPropertiesCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetCrtcConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ListOutputProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(setCrtcConfigRequest(c, Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie)
- return SetCrtcConfigCookie{cookie}
+ c.NewRequest(listOutputPropertiesRequest(c, Output), cookie)
+ return ListOutputPropertiesCookie{cookie}
}
-// SetCrtcConfigReply represents the data returned from a SetCrtcConfig request.
-type SetCrtcConfigReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- Status byte
- Timestamp xproto.Timestamp
- // padding: 20 bytes
+// ListOutputPropertiesReply represents the data returned from a ListOutputProperties request.
+type ListOutputPropertiesReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ NumAtoms uint16
+ // padding: 22 bytes
+ Atoms []xproto.Atom // size: xgb.Pad((int(NumAtoms) * 4))
}
-// Reply blocks and returns the reply data for a SetCrtcConfig request.
-func (cook SetCrtcConfigCookie) Reply() (*SetCrtcConfigReply, error) {
+// Reply blocks and returns the reply data for a ListOutputProperties request.
+func (cook ListOutputPropertiesCookie) Reply() (*ListOutputPropertiesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -3114,16 +3269,15 @@ func (cook SetCrtcConfigCookie) Reply() (*SetCrtcConfigReply, error) {
if buf == nil {
return nil, nil
}
- return setCrtcConfigReply(buf), nil
+ return listOutputPropertiesReply(buf), nil
}
-// setCrtcConfigReply reads a byte slice into a SetCrtcConfigReply value.
-func setCrtcConfigReply(buf []byte) *SetCrtcConfigReply {
- v := new(SetCrtcConfigReply)
+// listOutputPropertiesReply reads a byte slice into a ListOutputPropertiesReply value.
+func listOutputPropertiesReply(buf []byte) *ListOutputPropertiesReply {
+ v := new(ListOutputPropertiesReply)
b := 1 // skip reply determinant
- v.Status = buf[b]
- b += 1
+ b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
@@ -3131,100 +3285,84 @@ func setCrtcConfigReply(buf []byte) *SetCrtcConfigReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
+ v.NumAtoms = xgb.Get16(buf[b:])
+ b += 2
- b += 20 // padding
+ b += 22 // padding
+
+ v.Atoms = make([]xproto.Atom, v.NumAtoms)
+ for i := 0; i < int(v.NumAtoms); i++ {
+ v.Atoms[i] = xproto.Atom(xgb.Get32(buf[b:]))
+ b += 4
+ }
+ b = xgb.Pad(b)
return v
}
-// Write request to wire for SetCrtcConfig
-// setCrtcConfigRequest writes a SetCrtcConfig request to a byte slice.
-func setCrtcConfigRequest(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) []byte {
- size := xgb.Pad((28 + xgb.Pad((len(Outputs) * 4))))
+// Write request to wire for ListOutputProperties
+// listOutputPropertiesRequest writes a ListOutputProperties request to a byte slice.
+func listOutputPropertiesRequest(c *xgb.Conn, Output Output) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 21 // request opcode
+ buf[b] = 10 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Crtc))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Timestamp))
- b += 4
-
- xgb.Put32(buf[b:], uint32(ConfigTimestamp))
- b += 4
-
- xgb.Put16(buf[b:], uint16(X))
- b += 2
-
- xgb.Put16(buf[b:], uint16(Y))
- b += 2
-
- xgb.Put32(buf[b:], uint32(Mode))
+ xgb.Put32(buf[b:], uint32(Output))
b += 4
- xgb.Put16(buf[b:], Rotation)
- b += 2
-
- b += 2 // padding
-
- for i := 0; i < int(len(Outputs)); i++ {
- xgb.Put32(buf[b:], uint32(Outputs[i]))
- b += 4
- }
- b = xgb.Pad(b)
-
return buf
}
-// GetCrtcGammaSizeCookie is a cookie used only for GetCrtcGammaSize requests.
-type GetCrtcGammaSizeCookie struct {
+// QueryOutputPropertyCookie is a cookie used only for QueryOutputProperty requests.
+type QueryOutputPropertyCookie struct {
*xgb.Cookie
}
-// GetCrtcGammaSize sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetCrtcGammaSizeCookie.Reply()
-func GetCrtcGammaSize(c *xgb.Conn, Crtc Crtc) GetCrtcGammaSizeCookie {
+// QueryOutputProperty sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryOutputPropertyCookie.Reply()
+func QueryOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) QueryOutputPropertyCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetCrtcGammaSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getCrtcGammaSizeRequest(c, Crtc), cookie)
- return GetCrtcGammaSizeCookie{cookie}
+ c.NewRequest(queryOutputPropertyRequest(c, Output, Property), cookie)
+ return QueryOutputPropertyCookie{cookie}
}
-// GetCrtcGammaSizeUnchecked sends an unchecked request.
+// QueryOutputPropertyUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetCrtcGammaSizeUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcGammaSizeCookie {
+func QueryOutputPropertyUnchecked(c *xgb.Conn, Output Output, Property xproto.Atom) QueryOutputPropertyCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetCrtcGammaSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getCrtcGammaSizeRequest(c, Crtc), cookie)
- return GetCrtcGammaSizeCookie{cookie}
+ c.NewRequest(queryOutputPropertyRequest(c, Output, Property), cookie)
+ return QueryOutputPropertyCookie{cookie}
}
-// GetCrtcGammaSizeReply represents the data returned from a GetCrtcGammaSize request.
-type GetCrtcGammaSizeReply struct {
+// QueryOutputPropertyReply represents the data returned from a QueryOutputProperty request.
+type QueryOutputPropertyReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Size uint16
- // padding: 22 bytes
+ Pending bool
+ Range bool
+ Immutable bool
+ // padding: 21 bytes
+ ValidValues []int32 // size: xgb.Pad((int(Length) * 4))
}
-// Reply blocks and returns the reply data for a GetCrtcGammaSize request.
-func (cook GetCrtcGammaSizeCookie) Reply() (*GetCrtcGammaSizeReply, error) {
+// Reply blocks and returns the reply data for a QueryOutputProperty request.
+func (cook QueryOutputPropertyCookie) Reply() (*QueryOutputPropertyReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -3232,12 +3370,12 @@ func (cook GetCrtcGammaSizeCookie) Reply() (*GetCrtcGammaSizeReply, error) {
if buf == nil {
return nil, nil
}
- return getCrtcGammaSizeReply(buf), nil
+ return queryOutputPropertyReply(buf), nil
}
-// getCrtcGammaSizeReply reads a byte slice into a GetCrtcGammaSizeReply value.
-func getCrtcGammaSizeReply(buf []byte) *GetCrtcGammaSizeReply {
- v := new(GetCrtcGammaSizeReply)
+// queryOutputPropertyReply reads a byte slice into a QueryOutputPropertyReply value.
+func queryOutputPropertyReply(buf []byte) *QueryOutputPropertyReply {
+ v := new(QueryOutputPropertyReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -3248,77 +3386,103 @@ func getCrtcGammaSizeReply(buf []byte) *GetCrtcGammaSizeReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Size = xgb.Get16(buf[b:])
- b += 2
+ if buf[b] == 1 {
+ v.Pending = true
+ } else {
+ v.Pending = false
+ }
+ b += 1
- b += 22 // padding
+ if buf[b] == 1 {
+ v.Range = true
+ } else {
+ v.Range = false
+ }
+ b += 1
+
+ if buf[b] == 1 {
+ v.Immutable = true
+ } else {
+ v.Immutable = false
+ }
+ b += 1
+
+ b += 21 // padding
+
+ v.ValidValues = make([]int32, v.Length)
+ for i := 0; i < int(v.Length); i++ {
+ v.ValidValues[i] = int32(xgb.Get32(buf[b:]))
+ b += 4
+ }
+ b = xgb.Pad(b)
return v
}
-// Write request to wire for GetCrtcGammaSize
-// getCrtcGammaSizeRequest writes a GetCrtcGammaSize request to a byte slice.
-func getCrtcGammaSizeRequest(c *xgb.Conn, Crtc Crtc) []byte {
- size := 8
+// Write request to wire for QueryOutputProperty
+// queryOutputPropertyRequest writes a QueryOutputProperty request to a byte slice.
+func queryOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 22 // request opcode
+ buf[b] = 11 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Crtc))
+ xgb.Put32(buf[b:], uint32(Output))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Property))
b += 4
return buf
}
-// GetCrtcGammaCookie is a cookie used only for GetCrtcGamma requests.
-type GetCrtcGammaCookie struct {
+// QueryVersionCookie is a cookie used only for QueryVersion requests.
+type QueryVersionCookie struct {
*xgb.Cookie
}
-// GetCrtcGamma sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetCrtcGammaCookie.Reply()
-func GetCrtcGamma(c *xgb.Conn, Crtc Crtc) GetCrtcGammaCookie {
+// QueryVersion sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
+func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getCrtcGammaRequest(c, Crtc), cookie)
- return GetCrtcGammaCookie{cookie}
+ c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
+ return QueryVersionCookie{cookie}
}
-// GetCrtcGammaUnchecked sends an unchecked request.
+// QueryVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetCrtcGammaUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcGammaCookie {
+func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getCrtcGammaRequest(c, Crtc), cookie)
- return GetCrtcGammaCookie{cookie}
+ c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
+ return QueryVersionCookie{cookie}
}
-// GetCrtcGammaReply represents the data returned from a GetCrtcGamma request.
-type GetCrtcGammaReply struct {
+// QueryVersionReply represents the data returned from a QueryVersion request.
+type QueryVersionReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Size uint16
- // padding: 22 bytes
- Red []uint16 // size: xgb.Pad((int(Size) * 2))
- Green []uint16 // size: xgb.Pad((int(Size) * 2))
- Blue []uint16 // size: xgb.Pad((int(Size) * 2))
+ MajorVersion uint32
+ MinorVersion uint32
+ // padding: 16 bytes
}
-// Reply blocks and returns the reply data for a GetCrtcGamma request.
-func (cook GetCrtcGammaCookie) Reply() (*GetCrtcGammaReply, error) {
+// Reply blocks and returns the reply data for a QueryVersion request.
+func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -3326,12 +3490,12 @@ func (cook GetCrtcGammaCookie) Reply() (*GetCrtcGammaReply, error) {
if buf == nil {
return nil, nil
}
- return getCrtcGammaReply(buf), nil
+ return queryVersionReply(buf), nil
}
-// getCrtcGammaReply reads a byte slice into a GetCrtcGammaReply value.
-func getCrtcGammaReply(buf []byte) *GetCrtcGammaReply {
- v := new(GetCrtcGammaReply)
+// queryVersionReply reads a byte slice into a QueryVersionReply value.
+func queryVersionReply(buf []byte) *QueryVersionReply {
+ v := new(QueryVersionReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -3342,182 +3506,140 @@ func getCrtcGammaReply(buf []byte) *GetCrtcGammaReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Size = xgb.Get16(buf[b:])
- b += 2
-
- b += 22 // padding
-
- v.Red = make([]uint16, v.Size)
- for i := 0; i < int(v.Size); i++ {
- v.Red[i] = xgb.Get16(buf[b:])
- b += 2
- }
- b = xgb.Pad(b)
+ v.MajorVersion = xgb.Get32(buf[b:])
+ b += 4
- v.Green = make([]uint16, v.Size)
- for i := 0; i < int(v.Size); i++ {
- v.Green[i] = xgb.Get16(buf[b:])
- b += 2
- }
- b = xgb.Pad(b)
+ v.MinorVersion = xgb.Get32(buf[b:])
+ b += 4
- v.Blue = make([]uint16, v.Size)
- for i := 0; i < int(v.Size); i++ {
- v.Blue[i] = xgb.Get16(buf[b:])
- b += 2
- }
- b = xgb.Pad(b)
+ b += 16 // padding
return v
}
-// Write request to wire for GetCrtcGamma
-// getCrtcGammaRequest writes a GetCrtcGamma request to a byte slice.
-func getCrtcGammaRequest(c *xgb.Conn, Crtc Crtc) []byte {
- size := 8
+// Write request to wire for QueryVersion
+// queryVersionRequest writes a QueryVersion request to a byte slice.
+func queryVersionRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 23 // request opcode
+ buf[b] = 0 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Crtc))
+ xgb.Put32(buf[b:], MajorVersion)
+ b += 4
+
+ xgb.Put32(buf[b:], MinorVersion)
b += 4
return buf
}
-// SetCrtcGammaCookie is a cookie used only for SetCrtcGamma requests.
-type SetCrtcGammaCookie struct {
+// SelectInputCookie is a cookie used only for SelectInput requests.
+type SelectInputCookie struct {
*xgb.Cookie
}
-// SetCrtcGamma sends an unchecked request.
+// SelectInput sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetCrtcGamma(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetCrtcGammaCookie {
+func SelectInput(c *xgb.Conn, Window xproto.Window, Enable uint16) SelectInputCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SelectInput' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(setCrtcGammaRequest(c, Crtc, Size, Red, Green, Blue), cookie)
- return SetCrtcGammaCookie{cookie}
+ c.NewRequest(selectInputRequest(c, Window, Enable), cookie)
+ return SelectInputCookie{cookie}
}
-// SetCrtcGammaChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetCrtcGammaCookie.Check()
-func SetCrtcGammaChecked(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetCrtcGammaCookie {
+// SelectInputChecked sends a checked request.
+// If an error occurs, it can be retrieved using SelectInputCookie.Check()
+func SelectInputChecked(c *xgb.Conn, Window xproto.Window, Enable uint16) SelectInputCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SelectInput' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(setCrtcGammaRequest(c, Crtc, Size, Red, Green, Blue), cookie)
- return SetCrtcGammaCookie{cookie}
+ c.NewRequest(selectInputRequest(c, Window, Enable), cookie)
+ return SelectInputCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetCrtcGammaCookie) Check() error {
+func (cook SelectInputCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for SetCrtcGamma
-// setCrtcGammaRequest writes a SetCrtcGamma request to a byte slice.
-func setCrtcGammaRequest(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) []byte {
- size := xgb.Pad((((12 + xgb.Pad((int(Size) * 2))) + xgb.Pad((int(Size) * 2))) + xgb.Pad((int(Size) * 2))))
+// Write request to wire for SelectInput
+// selectInputRequest writes a SelectInput request to a byte slice.
+func selectInputRequest(c *xgb.Conn, Window xproto.Window, Enable uint16) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 24 // request opcode
+ buf[b] = 4 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Crtc))
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
- xgb.Put16(buf[b:], Size)
+ xgb.Put16(buf[b:], Enable)
b += 2
b += 2 // padding
- for i := 0; i < int(Size); i++ {
- xgb.Put16(buf[b:], Red[i])
- b += 2
- }
- b = xgb.Pad(b)
-
- for i := 0; i < int(Size); i++ {
- xgb.Put16(buf[b:], Green[i])
- b += 2
- }
- b = xgb.Pad(b)
-
- for i := 0; i < int(Size); i++ {
- xgb.Put16(buf[b:], Blue[i])
- b += 2
- }
- b = xgb.Pad(b)
-
return buf
}
-// GetScreenResourcesCurrentCookie is a cookie used only for GetScreenResourcesCurrent requests.
-type GetScreenResourcesCurrentCookie struct {
+// SetCrtcConfigCookie is a cookie used only for SetCrtcConfig requests.
+type SetCrtcConfigCookie struct {
*xgb.Cookie
}
-// GetScreenResourcesCurrent sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetScreenResourcesCurrentCookie.Reply()
-func GetScreenResourcesCurrent(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCurrentCookie {
+// SetCrtcConfig sends a checked request.
+// If an error occurs, it will be returned with the reply by calling SetCrtcConfigCookie.Reply()
+func SetCrtcConfig(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) SetCrtcConfigCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetScreenResourcesCurrent' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetCrtcConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getScreenResourcesCurrentRequest(c, Window), cookie)
- return GetScreenResourcesCurrentCookie{cookie}
+ c.NewRequest(setCrtcConfigRequest(c, Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie)
+ return SetCrtcConfigCookie{cookie}
}
-// GetScreenResourcesCurrentUnchecked sends an unchecked request.
+// SetCrtcConfigUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetScreenResourcesCurrentUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCurrentCookie {
+func SetCrtcConfigUnchecked(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) SetCrtcConfigCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetScreenResourcesCurrent' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetCrtcConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getScreenResourcesCurrentRequest(c, Window), cookie)
- return GetScreenResourcesCurrentCookie{cookie}
+ c.NewRequest(setCrtcConfigRequest(c, Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie)
+ return SetCrtcConfigCookie{cookie}
}
-// GetScreenResourcesCurrentReply represents the data returned from a GetScreenResourcesCurrent request.
-type GetScreenResourcesCurrentReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- Timestamp xproto.Timestamp
- ConfigTimestamp xproto.Timestamp
- NumCrtcs uint16
- NumOutputs uint16
- NumModes uint16
- NamesLen uint16
- // padding: 8 bytes
- Crtcs []Crtc // size: xgb.Pad((int(NumCrtcs) * 4))
- Outputs []Output // size: xgb.Pad((int(NumOutputs) * 4))
- Modes []ModeInfo // size: xgb.Pad((int(NumModes) * 32))
- Names []byte // size: xgb.Pad((int(NamesLen) * 1))
+// SetCrtcConfigReply represents the data returned from a SetCrtcConfig request.
+type SetCrtcConfigReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ Status byte
+ Timestamp xproto.Timestamp
+ // padding: 20 bytes
}
-// Reply blocks and returns the reply data for a GetScreenResourcesCurrent request.
-func (cook GetScreenResourcesCurrentCookie) Reply() (*GetScreenResourcesCurrentReply, error) {
+// Reply blocks and returns the reply data for a SetCrtcConfig request.
+func (cook SetCrtcConfigCookie) Reply() (*SetCrtcConfigReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -3525,15 +3647,16 @@ func (cook GetScreenResourcesCurrentCookie) Reply() (*GetScreenResourcesCurrentR
if buf == nil {
return nil, nil
}
- return getScreenResourcesCurrentReply(buf), nil
+ return setCrtcConfigReply(buf), nil
}
-// getScreenResourcesCurrentReply reads a byte slice into a GetScreenResourcesCurrentReply value.
-func getScreenResourcesCurrentReply(buf []byte) *GetScreenResourcesCurrentReply {
- v := new(GetScreenResourcesCurrentReply)
+// setCrtcConfigReply reads a byte slice into a SetCrtcConfigReply value.
+func setCrtcConfigReply(buf []byte) *SetCrtcConfigReply {
+ v := new(SetCrtcConfigReply)
b := 1 // skip reply determinant
- b += 1 // padding
+ v.Status = buf[b]
+ b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
@@ -3544,66 +3667,134 @@ func getScreenResourcesCurrentReply(buf []byte) *GetScreenResourcesCurrentReply
v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
b += 4
- v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
+ b += 20 // padding
- v.NumCrtcs = xgb.Get16(buf[b:])
+ return v
+}
+
+// Write request to wire for SetCrtcConfig
+// setCrtcConfigRequest writes a SetCrtcConfig request to a byte slice.
+func setCrtcConfigRequest(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) []byte {
+ size := xgb.Pad((28 + xgb.Pad((len(Outputs) * 4))))
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["RANDR"]
+ b += 1
+
+ buf[b] = 21 // request opcode
+ b += 1
+
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- v.NumOutputs = xgb.Get16(buf[b:])
+ xgb.Put32(buf[b:], uint32(Crtc))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Timestamp))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(ConfigTimestamp))
+ b += 4
+
+ xgb.Put16(buf[b:], uint16(X))
b += 2
- v.NumModes = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], uint16(Y))
b += 2
- v.NamesLen = xgb.Get16(buf[b:])
+ xgb.Put32(buf[b:], uint32(Mode))
+ b += 4
+
+ xgb.Put16(buf[b:], Rotation)
b += 2
- b += 8 // padding
+ b += 2 // padding
- v.Crtcs = make([]Crtc, v.NumCrtcs)
- for i := 0; i < int(v.NumCrtcs); i++ {
- v.Crtcs[i] = Crtc(xgb.Get32(buf[b:]))
+ for i := 0; i < int(len(Outputs)); i++ {
+ xgb.Put32(buf[b:], uint32(Outputs[i]))
b += 4
}
b = xgb.Pad(b)
- v.Outputs = make([]Output, v.NumOutputs)
- for i := 0; i < int(v.NumOutputs); i++ {
- v.Outputs[i] = Output(xgb.Get32(buf[b:]))
- b += 4
- }
- b = xgb.Pad(b)
+ return buf
+}
- v.Modes = make([]ModeInfo, v.NumModes)
- b += ModeInfoReadList(buf[b:], v.Modes)
+// SetCrtcGammaCookie is a cookie used only for SetCrtcGamma requests.
+type SetCrtcGammaCookie struct {
+ *xgb.Cookie
+}
- v.Names = make([]byte, v.NamesLen)
- copy(v.Names[:v.NamesLen], buf[b:])
- b += xgb.Pad(int(v.NamesLen))
+// SetCrtcGamma sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetCrtcGamma(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetCrtcGammaCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'SetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setCrtcGammaRequest(c, Crtc, Size, Red, Green, Blue), cookie)
+ return SetCrtcGammaCookie{cookie}
+}
- return v
+// SetCrtcGammaChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetCrtcGammaCookie.Check()
+func SetCrtcGammaChecked(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetCrtcGammaCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'SetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setCrtcGammaRequest(c, Crtc, Size, Red, Green, Blue), cookie)
+ return SetCrtcGammaCookie{cookie}
}
-// Write request to wire for GetScreenResourcesCurrent
-// getScreenResourcesCurrentRequest writes a GetScreenResourcesCurrent request to a byte slice.
-func getScreenResourcesCurrentRequest(c *xgb.Conn, Window xproto.Window) []byte {
- size := 8
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetCrtcGammaCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for SetCrtcGamma
+// setCrtcGammaRequest writes a SetCrtcGamma request to a byte slice.
+func setCrtcGammaRequest(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) []byte {
+ size := xgb.Pad((((12 + xgb.Pad((int(Size) * 2))) + xgb.Pad((int(Size) * 2))) + xgb.Pad((int(Size) * 2))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 25 // request opcode
+ buf[b] = 24 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Window))
+ xgb.Put32(buf[b:], uint32(Crtc))
b += 4
+ xgb.Put16(buf[b:], Size)
+ b += 2
+
+ b += 2 // padding
+
+ for i := 0; i < int(Size); i++ {
+ xgb.Put16(buf[b:], Red[i])
+ b += 2
+ }
+ b = xgb.Pad(b)
+
+ for i := 0; i < int(Size); i++ {
+ xgb.Put16(buf[b:], Green[i])
+ b += 2
+ }
+ b = xgb.Pad(b)
+
+ for i := 0; i < int(Size); i++ {
+ xgb.Put16(buf[b:], Blue[i])
+ b += 2
+ }
+ b = xgb.Pad(b)
+
return buf
}
@@ -3682,292 +3873,59 @@ func setCrtcTransformRequest(c *xgb.Conn, Crtc Crtc, Transform render.Transform,
return buf
}
-// GetCrtcTransformCookie is a cookie used only for GetCrtcTransform requests.
-type GetCrtcTransformCookie struct {
+// SetOutputPrimaryCookie is a cookie used only for SetOutputPrimary requests.
+type SetOutputPrimaryCookie struct {
*xgb.Cookie
}
-// GetCrtcTransform sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetCrtcTransformCookie.Reply()
-func GetCrtcTransform(c *xgb.Conn, Crtc Crtc) GetCrtcTransformCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(getCrtcTransformRequest(c, Crtc), cookie)
- return GetCrtcTransformCookie{cookie}
-}
-
-// GetCrtcTransformUnchecked sends an unchecked request.
+// SetOutputPrimary sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetCrtcTransformUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcTransformCookie {
+func SetOutputPrimary(c *xgb.Conn, Window xproto.Window, Output Output) SetOutputPrimaryCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(getCrtcTransformRequest(c, Crtc), cookie)
- return GetCrtcTransformCookie{cookie}
-}
-
-// GetCrtcTransformReply represents the data returned from a GetCrtcTransform request.
-type GetCrtcTransformReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- PendingTransform render.Transform
- HasTransforms bool
- // padding: 3 bytes
- CurrentTransform render.Transform
- // padding: 4 bytes
- PendingLen uint16
- PendingNparams uint16
- CurrentLen uint16
- CurrentNparams uint16
- PendingFilterName string // size: xgb.Pad((int(PendingLen) * 1))
- PendingParams []render.Fixed // size: xgb.Pad((int(PendingNparams) * 4))
- CurrentFilterName string // size: xgb.Pad((int(CurrentLen) * 1))
- CurrentParams []render.Fixed // size: xgb.Pad((int(CurrentNparams) * 4))
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setOutputPrimaryRequest(c, Window, Output), cookie)
+ return SetOutputPrimaryCookie{cookie}
}
-// Reply blocks and returns the reply data for a GetCrtcTransform request.
-func (cook GetCrtcTransformCookie) Reply() (*GetCrtcTransformReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
+// SetOutputPrimaryChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetOutputPrimaryCookie.Check()
+func SetOutputPrimaryChecked(c *xgb.Conn, Window xproto.Window, Output Output) SetOutputPrimaryCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'SetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- return getCrtcTransformReply(buf), nil
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setOutputPrimaryRequest(c, Window, Output), cookie)
+ return SetOutputPrimaryCookie{cookie}
}
-// getCrtcTransformReply reads a byte slice into a GetCrtcTransformReply value.
-func getCrtcTransformReply(buf []byte) *GetCrtcTransformReply {
- v := new(GetCrtcTransformReply)
- b := 1 // skip reply determinant
-
- b += 1 // padding
-
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
-
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
- b += 4
-
- v.PendingTransform = render.Transform{}
- b += render.TransformRead(buf[b:], &v.PendingTransform)
-
- if buf[b] == 1 {
- v.HasTransforms = true
- } else {
- v.HasTransforms = false
- }
- b += 1
-
- b += 3 // padding
-
- v.CurrentTransform = render.Transform{}
- b += render.TransformRead(buf[b:], &v.CurrentTransform)
-
- b += 4 // padding
-
- v.PendingLen = xgb.Get16(buf[b:])
- b += 2
-
- v.PendingNparams = xgb.Get16(buf[b:])
- b += 2
-
- v.CurrentLen = xgb.Get16(buf[b:])
- b += 2
-
- v.CurrentNparams = xgb.Get16(buf[b:])
- b += 2
-
- {
- byteString := make([]byte, v.PendingLen)
- copy(byteString[:v.PendingLen], buf[b:])
- v.PendingFilterName = string(byteString)
- b += xgb.Pad(int(v.PendingLen))
- }
-
- v.PendingParams = make([]render.Fixed, v.PendingNparams)
- for i := 0; i < int(v.PendingNparams); i++ {
- v.PendingParams[i] = render.Fixed(xgb.Get32(buf[b:]))
- b += 4
- }
- b = xgb.Pad(b)
-
- {
- byteString := make([]byte, v.CurrentLen)
- copy(byteString[:v.CurrentLen], buf[b:])
- v.CurrentFilterName = string(byteString)
- b += xgb.Pad(int(v.CurrentLen))
- }
-
- v.CurrentParams = make([]render.Fixed, v.CurrentNparams)
- for i := 0; i < int(v.CurrentNparams); i++ {
- v.CurrentParams[i] = render.Fixed(xgb.Get32(buf[b:]))
- b += 4
- }
- b = xgb.Pad(b)
-
- return v
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetOutputPrimaryCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Write request to wire for GetCrtcTransform
-// getCrtcTransformRequest writes a GetCrtcTransform request to a byte slice.
-func getCrtcTransformRequest(c *xgb.Conn, Crtc Crtc) []byte {
- size := 8
+// Write request to wire for SetOutputPrimary
+// setOutputPrimaryRequest writes a SetOutputPrimary request to a byte slice.
+func setOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window, Output Output) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 27 // request opcode
+ buf[b] = 30 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put32(buf[b:], uint32(Crtc))
- b += 4
-
- return buf
-}
-
-// GetPanningCookie is a cookie used only for GetPanning requests.
-type GetPanningCookie struct {
- *xgb.Cookie
-}
-
-// GetPanning sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetPanningCookie.Reply()
-func GetPanning(c *xgb.Conn, Crtc Crtc) GetPanningCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(getPanningRequest(c, Crtc), cookie)
- return GetPanningCookie{cookie}
-}
-
-// GetPanningUnchecked sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetPanningUnchecked(c *xgb.Conn, Crtc Crtc) GetPanningCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, true)
- c.NewRequest(getPanningRequest(c, Crtc), cookie)
- return GetPanningCookie{cookie}
-}
-
-// GetPanningReply represents the data returned from a GetPanning request.
-type GetPanningReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- Status byte
- 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
-}
-
-// Reply blocks and returns the reply data for a GetPanning request.
-func (cook GetPanningCookie) Reply() (*GetPanningReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
- }
- return getPanningReply(buf), nil
-}
-
-// getPanningReply reads a byte slice into a GetPanningReply value.
-func getPanningReply(buf []byte) *GetPanningReply {
- v := new(GetPanningReply)
- b := 1 // skip reply determinant
-
- v.Status = buf[b]
- b += 1
-
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
-
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
- b += 4
-
- v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
- v.Left = xgb.Get16(buf[b:])
- b += 2
-
- v.Top = xgb.Get16(buf[b:])
- b += 2
-
- v.Width = xgb.Get16(buf[b:])
- b += 2
-
- v.Height = xgb.Get16(buf[b:])
- b += 2
-
- v.TrackLeft = xgb.Get16(buf[b:])
- b += 2
-
- v.TrackTop = xgb.Get16(buf[b:])
- b += 2
-
- v.TrackWidth = xgb.Get16(buf[b:])
- b += 2
-
- v.TrackHeight = xgb.Get16(buf[b:])
- b += 2
-
- v.BorderLeft = int16(xgb.Get16(buf[b:]))
- b += 2
-
- v.BorderTop = int16(xgb.Get16(buf[b:]))
- b += 2
-
- v.BorderRight = int16(xgb.Get16(buf[b:]))
- b += 2
-
- v.BorderBottom = int16(xgb.Get16(buf[b:]))
- b += 2
-
- return v
-}
-
-// Write request to wire for GetPanning
-// getPanningRequest writes a GetPanning request to a byte slice.
-func getPanningRequest(c *xgb.Conn, Crtc Crtc) []byte {
- size := 8
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["RANDR"]
- b += 1
-
- buf[b] = 28 // request opcode
- b += 1
-
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
- b += 2
-
- xgb.Put32(buf[b:], uint32(Crtc))
+ xgb.Put32(buf[b:], uint32(Output))
b += 4
return buf
@@ -4101,50 +4059,99 @@ func setPanningRequest(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, Left
return buf
}
-// SetOutputPrimaryCookie is a cookie used only for SetOutputPrimary requests.
-type SetOutputPrimaryCookie struct {
+// SetScreenConfigCookie is a cookie used only for SetScreenConfig requests.
+type SetScreenConfigCookie struct {
*xgb.Cookie
}
-// SetOutputPrimary sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetOutputPrimary(c *xgb.Conn, Window xproto.Window, Output Output) SetOutputPrimaryCookie {
+// SetScreenConfig sends a checked request.
+// If an error occurs, it will be returned with the reply by calling SetScreenConfigCookie.Reply()
+func SetScreenConfig(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) SetScreenConfigCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetScreenConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(setOutputPrimaryRequest(c, Window, Output), cookie)
- return SetOutputPrimaryCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(setScreenConfigRequest(c, Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie)
+ return SetScreenConfigCookie{cookie}
}
-// SetOutputPrimaryChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetOutputPrimaryCookie.Check()
-func SetOutputPrimaryChecked(c *xgb.Conn, Window xproto.Window, Output Output) SetOutputPrimaryCookie {
+// SetScreenConfigUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetScreenConfigUnchecked(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) SetScreenConfigCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'SetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetScreenConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(setOutputPrimaryRequest(c, Window, Output), cookie)
- return SetOutputPrimaryCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(setScreenConfigRequest(c, Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie)
+ return SetScreenConfigCookie{cookie}
}
-// Check returns an error if one occurred for checked requests that are not expecting a reply.
-// This cannot be called for requests expecting a reply, nor for unchecked requests.
-func (cook SetOutputPrimaryCookie) Check() error {
- return cook.Cookie.Check()
+// SetScreenConfigReply represents the data returned from a SetScreenConfig request.
+type SetScreenConfigReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ Status byte
+ NewTimestamp xproto.Timestamp
+ ConfigTimestamp xproto.Timestamp
+ Root xproto.Window
+ SubpixelOrder uint16
+ // padding: 10 bytes
}
-// Write request to wire for SetOutputPrimary
-// setOutputPrimaryRequest writes a SetOutputPrimary request to a byte slice.
-func setOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window, Output Output) []byte {
- size := 12
+// Reply blocks and returns the reply data for a SetScreenConfig request.
+func (cook SetScreenConfigCookie) Reply() (*SetScreenConfigReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return setScreenConfigReply(buf), nil
+}
+
+// setScreenConfigReply reads a byte slice into a SetScreenConfigReply value.
+func setScreenConfigReply(buf []byte) *SetScreenConfigReply {
+ v := new(SetScreenConfigReply)
+ b := 1 // skip reply determinant
+
+ v.Status = buf[b]
+ b += 1
+
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
+ b += 4
+
+ v.NewTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.ConfigTimestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Root = xproto.Window(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.SubpixelOrder = xgb.Get16(buf[b:])
+ b += 2
+
+ b += 10 // padding
+
+ return v
+}
+
+// Write request to wire for SetScreenConfig
+// setScreenConfigRequest writes a SetScreenConfig request to a byte slice.
+func setScreenConfigRequest(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) []byte {
+ size := 24
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 30 // request opcode
+ buf[b] = 2 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -4153,89 +4160,70 @@ func setOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window, Output Output) [
xgb.Put32(buf[b:], uint32(Window))
b += 4
- xgb.Put32(buf[b:], uint32(Output))
+ xgb.Put32(buf[b:], uint32(Timestamp))
b += 4
+ xgb.Put32(buf[b:], uint32(ConfigTimestamp))
+ b += 4
+
+ xgb.Put16(buf[b:], SizeID)
+ b += 2
+
+ xgb.Put16(buf[b:], Rotation)
+ b += 2
+
+ xgb.Put16(buf[b:], Rate)
+ b += 2
+
+ b += 2 // padding
+
return buf
}
-// GetOutputPrimaryCookie is a cookie used only for GetOutputPrimary requests.
-type GetOutputPrimaryCookie struct {
+// SetScreenSizeCookie is a cookie used only for SetScreenSize requests.
+type SetScreenSizeCookie struct {
*xgb.Cookie
}
-// GetOutputPrimary sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetOutputPrimaryCookie.Reply()
-func GetOutputPrimary(c *xgb.Conn, Window xproto.Window) GetOutputPrimaryCookie {
- if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(getOutputPrimaryRequest(c, Window), cookie)
- return GetOutputPrimaryCookie{cookie}
-}
-
-// GetOutputPrimaryUnchecked sends an unchecked request.
+// SetScreenSize sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetOutputPrimaryUnchecked(c *xgb.Conn, Window xproto.Window) GetOutputPrimaryCookie {
+func SetScreenSize(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) SetScreenSizeCookie {
if _, ok := c.Extensions["RANDR"]; !ok {
- panic("Cannot issue request 'GetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetScreenSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(getOutputPrimaryRequest(c, Window), cookie)
- return GetOutputPrimaryCookie{cookie}
-}
-
-// GetOutputPrimaryReply represents the data returned from a GetOutputPrimary request.
-type GetOutputPrimaryReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- Output Output
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setScreenSizeRequest(c, Window, Width, Height, MmWidth, MmHeight), cookie)
+ return SetScreenSizeCookie{cookie}
}
-// Reply blocks and returns the reply data for a GetOutputPrimary request.
-func (cook GetOutputPrimaryCookie) Reply() (*GetOutputPrimaryReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
+// SetScreenSizeChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetScreenSizeCookie.Check()
+func SetScreenSizeChecked(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) SetScreenSizeCookie {
+ if _, ok := c.Extensions["RANDR"]; !ok {
+ panic("Cannot issue request 'SetScreenSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.")
}
- return getOutputPrimaryReply(buf), nil
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setScreenSizeRequest(c, Window, Width, Height, MmWidth, MmHeight), cookie)
+ return SetScreenSizeCookie{cookie}
}
-// getOutputPrimaryReply reads a byte slice into a GetOutputPrimaryReply value.
-func getOutputPrimaryReply(buf []byte) *GetOutputPrimaryReply {
- v := new(GetOutputPrimaryReply)
- b := 1 // skip reply determinant
-
- b += 1 // padding
-
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
-
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
- b += 4
-
- v.Output = Output(xgb.Get32(buf[b:]))
- b += 4
-
- return v
+// Check returns an error if one occurred for checked requests that are not expecting a reply.
+// This cannot be called for requests expecting a reply, nor for unchecked requests.
+func (cook SetScreenSizeCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Write request to wire for GetOutputPrimary
-// getOutputPrimaryRequest writes a GetOutputPrimary request to a byte slice.
-func getOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window) []byte {
- size := 8
+// Write request to wire for SetScreenSize
+// setScreenSizeRequest writes a SetScreenSize request to a byte slice.
+func setScreenSizeRequest(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) []byte {
+ size := 20
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RANDR"]
b += 1
- buf[b] = 31 // request opcode
+ buf[b] = 7 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -4244,5 +4232,17 @@ func getOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window) []byte {
xgb.Put32(buf[b:], uint32(Window))
b += 4
+ xgb.Put16(buf[b:], Width)
+ b += 2
+
+ xgb.Put16(buf[b:], Height)
+ b += 2
+
+ xgb.Put32(buf[b:], MmWidth)
+ b += 4
+
+ xgb.Put32(buf[b:], MmHeight)
+ b += 4
+
return buf
}