aboutsummaryrefslogtreecommitdiff
path: root/nexgb/sync/sync.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexgb/sync/sync.go')
-rw-r--r--nexgb/sync/sync.go1988
1 files changed, 994 insertions, 994 deletions
diff --git a/nexgb/sync/sync.go b/nexgb/sync/sync.go
index a7046b7..ff83384 100644
--- a/nexgb/sync/sync.go
+++ b/nexgb/sync/sync.go
@@ -2,7 +2,7 @@
package sync
/*
- This file was generated by sync.xml on Jun 5 2012 12:11:59am EDT.
+ This file was generated by sync.xml on Aug 11 2013 8:39:43pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -40,29 +40,183 @@ func init() {
xgb.NewExtErrorFuncs["SYNC"] = make(map[int]xgb.NewErrorFun)
}
-// Skipping definition for base type 'Float'
+type Alarm uint32
-// Skipping definition for base type 'Card8'
+func NewAlarmId(c *xgb.Conn) (Alarm, error) {
+ id, err := c.NewId()
+ if err != nil {
+ return 0, err
+ }
+ return Alarm(id), nil
+}
-// Skipping definition for base type 'Int16'
+// BadAlarm is the error number for a BadAlarm.
+const BadAlarm = 1
-// Skipping definition for base type 'Int32'
+type AlarmError struct {
+ Sequence uint16
+ NiceName string
+ BadAlarm uint32
+ MinorOpcode uint16
+ MajorOpcode byte
+}
-// Skipping definition for base type 'Void'
+// AlarmErrorNew constructs a AlarmError value that implements xgb.Error from a byte slice.
+func AlarmErrorNew(buf []byte) xgb.Error {
+ v := AlarmError{}
+ v.NiceName = "Alarm"
-// Skipping definition for base type 'Byte'
+ b := 1 // skip error determinant
+ b += 1 // don't read error number
-// Skipping definition for base type 'Int8'
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
-// Skipping definition for base type 'Card16'
+ v.BadAlarm = xgb.Get32(buf[b:])
+ b += 4
-// Skipping definition for base type 'Char'
+ v.MinorOpcode = xgb.Get16(buf[b:])
+ b += 2
-// Skipping definition for base type 'Card32'
+ v.MajorOpcode = buf[b]
+ b += 1
-// Skipping definition for base type 'Double'
+ return v
+}
-// Skipping definition for base type 'Bool'
+// SequenceId returns the sequence id attached to the BadAlarm error.
+// This is mostly used internally.
+func (err AlarmError) SequenceId() uint16 {
+ return err.Sequence
+}
+
+// BadId returns the 'BadValue' number if one exists for the BadAlarm error. If no bad value exists, 0 is returned.
+func (err AlarmError) BadId() uint32 {
+ return 0
+}
+
+// Error returns a rudimentary string representation of the BadAlarm error.
+
+func (err AlarmError) Error() string {
+ fieldVals := make([]string, 0, 3)
+ fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
+ fieldVals = append(fieldVals, xgb.Sprintf("BadAlarm: %d", err.BadAlarm))
+ fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
+ fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
+ return "BadAlarm {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+}
+
+func init() {
+ xgb.NewExtErrorFuncs["SYNC"][1] = AlarmErrorNew
+}
+
+// AlarmNotify is the event number for a AlarmNotifyEvent.
+const AlarmNotify = 1
+
+type AlarmNotifyEvent struct {
+ Sequence uint16
+ Kind byte
+ Alarm Alarm
+ CounterValue Int64
+ AlarmValue Int64
+ Timestamp xproto.Timestamp
+ State byte
+ // padding: 3 bytes
+}
+
+// AlarmNotifyEventNew constructs a AlarmNotifyEvent value that implements xgb.Event from a byte slice.
+func AlarmNotifyEventNew(buf []byte) xgb.Event {
+ v := AlarmNotifyEvent{}
+ b := 1 // don't read event number
+
+ v.Kind = buf[b]
+ b += 1
+
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Alarm = Alarm(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.CounterValue = Int64{}
+ b += Int64Read(buf[b:], &v.CounterValue)
+
+ v.AlarmValue = Int64{}
+ b += Int64Read(buf[b:], &v.AlarmValue)
+
+ v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.State = buf[b]
+ b += 1
+
+ b += 3 // padding
+
+ return v
+}
+
+// Bytes writes a AlarmNotifyEvent value to a byte slice.
+func (v AlarmNotifyEvent) Bytes() []byte {
+ buf := make([]byte, 32)
+ b := 0
+
+ // write event number
+ buf[b] = 1
+ b += 1
+
+ buf[b] = v.Kind
+ b += 1
+
+ b += 2 // skip sequence number
+
+ xgb.Put32(buf[b:], uint32(v.Alarm))
+ b += 4
+
+ {
+ structBytes := v.CounterValue.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+
+ {
+ structBytes := v.AlarmValue.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+
+ xgb.Put32(buf[b:], uint32(v.Timestamp))
+ b += 4
+
+ buf[b] = v.State
+ b += 1
+
+ b += 3 // padding
+
+ return buf
+}
+
+// SequenceId returns the sequence id attached to the AlarmNotify event.
+// Events without a sequence number (KeymapNotify) return 0.
+// This is mostly used internally.
+func (v AlarmNotifyEvent) SequenceId() uint16 {
+ return v.Sequence
+}
+
+// String is a rudimentary string representation of AlarmNotifyEvent.
+func (v AlarmNotifyEvent) String() string {
+ fieldVals := make([]string, 0, 7)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
+ fieldVals = append(fieldVals, xgb.Sprintf("Kind: %d", v.Kind))
+ fieldVals = append(fieldVals, xgb.Sprintf("Alarm: %d", v.Alarm))
+ fieldVals = append(fieldVals, xgb.Sprintf("Timestamp: %d", v.Timestamp))
+ fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
+ return "AlarmNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+}
+
+func init() {
+ xgb.NewExtEventFuncs["SYNC"][1] = AlarmNotifyEventNew
+}
const (
AlarmstateActive = 0
@@ -71,18 +225,6 @@ const (
)
const (
- TesttypePositiveTransition = 0
- TesttypeNegativeTransition = 1
- TesttypePositiveComparison = 2
- TesttypeNegativeComparison = 3
-)
-
-const (
- ValuetypeAbsolute = 0
- ValuetypeRelative = 1
-)
-
-const (
CaCounter = 1
CaValueType = 2
CaValue = 4
@@ -91,24 +233,198 @@ const (
CaEvents = 32
)
-type Alarm uint32
+type Counter uint32
-func NewAlarmId(c *xgb.Conn) (Alarm, error) {
+func NewCounterId(c *xgb.Conn) (Counter, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
- return Alarm(id), nil
+ return Counter(id), nil
}
-type Counter uint32
+// BadCounter is the error number for a BadCounter.
+const BadCounter = 0
-func NewCounterId(c *xgb.Conn) (Counter, error) {
- id, err := c.NewId()
- if err != nil {
- return 0, err
+type CounterError struct {
+ Sequence uint16
+ NiceName string
+ BadCounter uint32
+ MinorOpcode uint16
+ MajorOpcode byte
+}
+
+// CounterErrorNew constructs a CounterError value that implements xgb.Error from a byte slice.
+func CounterErrorNew(buf []byte) xgb.Error {
+ v := CounterError{}
+ v.NiceName = "Counter"
+
+ b := 1 // skip error determinant
+ b += 1 // don't read error number
+
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
+
+ v.BadCounter = xgb.Get32(buf[b:])
+ b += 4
+
+ v.MinorOpcode = xgb.Get16(buf[b:])
+ b += 2
+
+ v.MajorOpcode = buf[b]
+ b += 1
+
+ return v
+}
+
+// SequenceId returns the sequence id attached to the BadCounter error.
+// This is mostly used internally.
+func (err CounterError) SequenceId() uint16 {
+ return err.Sequence
+}
+
+// BadId returns the 'BadValue' number if one exists for the BadCounter error. If no bad value exists, 0 is returned.
+func (err CounterError) BadId() uint32 {
+ return 0
+}
+
+// Error returns a rudimentary string representation of the BadCounter error.
+
+func (err CounterError) Error() string {
+ fieldVals := make([]string, 0, 3)
+ fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
+ fieldVals = append(fieldVals, xgb.Sprintf("BadCounter: %d", err.BadCounter))
+ fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
+ fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
+ return "BadCounter {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+}
+
+func init() {
+ xgb.NewExtErrorFuncs["SYNC"][0] = CounterErrorNew
+}
+
+// CounterNotify is the event number for a CounterNotifyEvent.
+const CounterNotify = 0
+
+type CounterNotifyEvent struct {
+ Sequence uint16
+ Kind byte
+ Counter Counter
+ WaitValue Int64
+ CounterValue Int64
+ Timestamp xproto.Timestamp
+ Count uint16
+ Destroyed bool
+ // padding: 1 bytes
+}
+
+// CounterNotifyEventNew constructs a CounterNotifyEvent value that implements xgb.Event from a byte slice.
+func CounterNotifyEventNew(buf []byte) xgb.Event {
+ v := CounterNotifyEvent{}
+ b := 1 // don't read event number
+
+ v.Kind = buf[b]
+ b += 1
+
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
+
+ v.Counter = Counter(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.WaitValue = Int64{}
+ b += Int64Read(buf[b:], &v.WaitValue)
+
+ v.CounterValue = Int64{}
+ b += Int64Read(buf[b:], &v.CounterValue)
+
+ v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Count = xgb.Get16(buf[b:])
+ b += 2
+
+ if buf[b] == 1 {
+ v.Destroyed = true
+ } else {
+ v.Destroyed = false
}
- return Counter(id), nil
+ b += 1
+
+ b += 1 // padding
+
+ return v
+}
+
+// Bytes writes a CounterNotifyEvent value to a byte slice.
+func (v CounterNotifyEvent) Bytes() []byte {
+ buf := make([]byte, 32)
+ b := 0
+
+ // write event number
+ buf[b] = 0
+ b += 1
+
+ buf[b] = v.Kind
+ b += 1
+
+ b += 2 // skip sequence number
+
+ xgb.Put32(buf[b:], uint32(v.Counter))
+ b += 4
+
+ {
+ structBytes := v.WaitValue.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+
+ {
+ structBytes := v.CounterValue.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+
+ xgb.Put32(buf[b:], uint32(v.Timestamp))
+ b += 4
+
+ xgb.Put16(buf[b:], v.Count)
+ b += 2
+
+ if v.Destroyed {
+ buf[b] = 1
+ } else {
+ buf[b] = 0
+ }
+ b += 1
+
+ b += 1 // padding
+
+ return buf
+}
+
+// SequenceId returns the sequence id attached to the CounterNotify event.
+// Events without a sequence number (KeymapNotify) return 0.
+// This is mostly used internally.
+func (v CounterNotifyEvent) SequenceId() uint16 {
+ return v.Sequence
+}
+
+// String is a rudimentary string representation of CounterNotifyEvent.
+func (v CounterNotifyEvent) String() string {
+ fieldVals := make([]string, 0, 8)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
+ fieldVals = append(fieldVals, xgb.Sprintf("Kind: %d", v.Kind))
+ fieldVals = append(fieldVals, xgb.Sprintf("Counter: %d", v.Counter))
+ fieldVals = append(fieldVals, xgb.Sprintf("Timestamp: %d", v.Timestamp))
+ fieldVals = append(fieldVals, xgb.Sprintf("Count: %d", v.Count))
+ fieldVals = append(fieldVals, xgb.Sprintf("Destroyed: %t", v.Destroyed))
+ return "CounterNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+}
+
+func init() {
+ xgb.NewExtEventFuncs["SYNC"][0] = CounterNotifyEventNew
}
type Fence uint32
@@ -259,6 +575,13 @@ func SystemcounterListSize(list []Systemcounter) int {
return size
}
+const (
+ TesttypePositiveTransition = 0
+ TesttypeNegativeTransition = 1
+ TesttypePositiveComparison = 2
+ TesttypeNegativeComparison = 3
+)
+
type Trigger struct {
Counter Counter
WaitType uint32
@@ -330,6 +653,11 @@ func TriggerListBytes(buf []byte, list []Trigger) int {
return b
}
+const (
+ ValuetypeAbsolute = 0
+ ValuetypeRelative = 1
+)
+
type Waitcondition struct {
Trigger Trigger
EventThreshold Int64
@@ -390,545 +718,326 @@ func WaitconditionListBytes(buf []byte, list []Waitcondition) int {
return b
}
-// CounterNotify is the event number for a CounterNotifyEvent.
-const CounterNotify = 0
+// Skipping definition for base type 'Bool'
-type CounterNotifyEvent struct {
- Sequence uint16
- Kind byte
- Counter Counter
- WaitValue Int64
- CounterValue Int64
- Timestamp xproto.Timestamp
- Count uint16
- Destroyed bool
- // padding: 1 bytes
-}
+// Skipping definition for base type 'Byte'
-// CounterNotifyEventNew constructs a CounterNotifyEvent value that implements xgb.Event from a byte slice.
-func CounterNotifyEventNew(buf []byte) xgb.Event {
- v := CounterNotifyEvent{}
- b := 1 // don't read event number
+// Skipping definition for base type 'Card8'
- v.Kind = buf[b]
- b += 1
+// Skipping definition for base type 'Char'
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
+// Skipping definition for base type 'Void'
- v.Counter = Counter(xgb.Get32(buf[b:]))
- b += 4
+// Skipping definition for base type 'Double'
- v.WaitValue = Int64{}
- b += Int64Read(buf[b:], &v.WaitValue)
+// Skipping definition for base type 'Float'
- v.CounterValue = Int64{}
- b += Int64Read(buf[b:], &v.CounterValue)
+// Skipping definition for base type 'Int16'
- v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
+// Skipping definition for base type 'Int32'
- v.Count = xgb.Get16(buf[b:])
- b += 2
+// Skipping definition for base type 'Int8'
- if buf[b] == 1 {
- v.Destroyed = true
- } else {
- v.Destroyed = false
- }
- b += 1
+// Skipping definition for base type 'Card16'
- b += 1 // padding
+// Skipping definition for base type 'Card32'
- return v
+// AwaitCookie is a cookie used only for Await requests.
+type AwaitCookie struct {
+ *xgb.Cookie
}
-// Bytes writes a CounterNotifyEvent value to a byte slice.
-func (v CounterNotifyEvent) Bytes() []byte {
- buf := make([]byte, 32)
- b := 0
-
- // write event number
- buf[b] = 0
- b += 1
-
- buf[b] = v.Kind
- b += 1
-
- b += 2 // skip sequence number
-
- xgb.Put32(buf[b:], uint32(v.Counter))
- b += 4
-
- {
- structBytes := v.WaitValue.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
-
- {
- structBytes := v.CounterValue.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
-
- xgb.Put32(buf[b:], uint32(v.Timestamp))
- b += 4
-
- xgb.Put16(buf[b:], v.Count)
- b += 2
-
- if v.Destroyed {
- buf[b] = 1
- } else {
- buf[b] = 0
+// Await sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func Await(c *xgb.Conn, WaitList []Waitcondition) AwaitCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'Await' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- b += 1
-
- b += 1 // padding
-
- return buf
-}
-
-// SequenceId returns the sequence id attached to the CounterNotify event.
-// Events without a sequence number (KeymapNotify) return 0.
-// This is mostly used internally.
-func (v CounterNotifyEvent) SequenceId() uint16 {
- return v.Sequence
-}
-
-// String is a rudimentary string representation of CounterNotifyEvent.
-func (v CounterNotifyEvent) String() string {
- fieldVals := make([]string, 0, 8)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
- fieldVals = append(fieldVals, xgb.Sprintf("Kind: %d", v.Kind))
- fieldVals = append(fieldVals, xgb.Sprintf("Counter: %d", v.Counter))
- fieldVals = append(fieldVals, xgb.Sprintf("Timestamp: %d", v.Timestamp))
- fieldVals = append(fieldVals, xgb.Sprintf("Count: %d", v.Count))
- fieldVals = append(fieldVals, xgb.Sprintf("Destroyed: %t", v.Destroyed))
- return "CounterNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
-}
-
-func init() {
- xgb.NewExtEventFuncs["SYNC"][0] = CounterNotifyEventNew
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(awaitRequest(c, WaitList), cookie)
+ return AwaitCookie{cookie}
}
-// AlarmNotify is the event number for a AlarmNotifyEvent.
-const AlarmNotify = 1
-
-type AlarmNotifyEvent struct {
- Sequence uint16
- Kind byte
- Alarm Alarm
- CounterValue Int64
- AlarmValue Int64
- Timestamp xproto.Timestamp
- State byte
- // padding: 3 bytes
+// AwaitChecked sends a checked request.
+// If an error occurs, it can be retrieved using AwaitCookie.Check()
+func AwaitChecked(c *xgb.Conn, WaitList []Waitcondition) AwaitCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'Await' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(awaitRequest(c, WaitList), cookie)
+ return AwaitCookie{cookie}
}
-// AlarmNotifyEventNew constructs a AlarmNotifyEvent value that implements xgb.Event from a byte slice.
-func AlarmNotifyEventNew(buf []byte) xgb.Event {
- v := AlarmNotifyEvent{}
- b := 1 // don't read event number
-
- v.Kind = buf[b]
- b += 1
-
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
-
- v.Alarm = Alarm(xgb.Get32(buf[b:]))
- b += 4
-
- v.CounterValue = Int64{}
- b += Int64Read(buf[b:], &v.CounterValue)
-
- v.AlarmValue = Int64{}
- b += Int64Read(buf[b:], &v.AlarmValue)
-
- v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
-
- v.State = buf[b]
- b += 1
-
- b += 3 // padding
-
- 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 AwaitCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Bytes writes a AlarmNotifyEvent value to a byte slice.
-func (v AlarmNotifyEvent) Bytes() []byte {
- buf := make([]byte, 32)
+// Write request to wire for Await
+// awaitRequest writes a Await request to a byte slice.
+func awaitRequest(c *xgb.Conn, WaitList []Waitcondition) []byte {
+ size := xgb.Pad((4 + xgb.Pad((len(WaitList) * 28))))
b := 0
+ buf := make([]byte, size)
- // write event number
- buf[b] = 1
+ buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = v.Kind
+ buf[b] = 7 // request opcode
b += 1
- b += 2 // skip sequence number
-
- xgb.Put32(buf[b:], uint32(v.Alarm))
- b += 4
-
- {
- structBytes := v.CounterValue.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
-
- {
- structBytes := v.AlarmValue.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
-
- xgb.Put32(buf[b:], uint32(v.Timestamp))
- b += 4
-
- buf[b] = v.State
- b += 1
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ b += 2
- b += 3 // padding
+ b += WaitconditionListBytes(buf[b:], WaitList)
return buf
}
-// SequenceId returns the sequence id attached to the AlarmNotify event.
-// Events without a sequence number (KeymapNotify) return 0.
-// This is mostly used internally.
-func (v AlarmNotifyEvent) SequenceId() uint16 {
- return v.Sequence
+// AwaitFenceCookie is a cookie used only for AwaitFence requests.
+type AwaitFenceCookie struct {
+ *xgb.Cookie
}
-// String is a rudimentary string representation of AlarmNotifyEvent.
-func (v AlarmNotifyEvent) String() string {
- fieldVals := make([]string, 0, 7)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
- fieldVals = append(fieldVals, xgb.Sprintf("Kind: %d", v.Kind))
- fieldVals = append(fieldVals, xgb.Sprintf("Alarm: %d", v.Alarm))
- fieldVals = append(fieldVals, xgb.Sprintf("Timestamp: %d", v.Timestamp))
- fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
- return "AlarmNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+// AwaitFence sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func AwaitFence(c *xgb.Conn, FenceList []Fence) AwaitFenceCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'AwaitFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(awaitFenceRequest(c, FenceList), cookie)
+ return AwaitFenceCookie{cookie}
}
-func init() {
- xgb.NewExtEventFuncs["SYNC"][1] = AlarmNotifyEventNew
+// AwaitFenceChecked sends a checked request.
+// If an error occurs, it can be retrieved using AwaitFenceCookie.Check()
+func AwaitFenceChecked(c *xgb.Conn, FenceList []Fence) AwaitFenceCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'AwaitFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(awaitFenceRequest(c, FenceList), cookie)
+ return AwaitFenceCookie{cookie}
}
-// BadCounter is the error number for a BadCounter.
-const BadCounter = 0
-
-type CounterError struct {
- Sequence uint16
- NiceName string
- BadCounter uint32
- MinorOpcode uint16
- MajorOpcode byte
+// 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 AwaitFenceCookie) Check() error {
+ return cook.Cookie.Check()
}
-// CounterErrorNew constructs a CounterError value that implements xgb.Error from a byte slice.
-func CounterErrorNew(buf []byte) xgb.Error {
- v := CounterError{}
- v.NiceName = "Counter"
-
- b := 1 // skip error determinant
- b += 1 // don't read error number
+// Write request to wire for AwaitFence
+// awaitFenceRequest writes a AwaitFence request to a byte slice.
+func awaitFenceRequest(c *xgb.Conn, FenceList []Fence) []byte {
+ size := xgb.Pad((4 + xgb.Pad((len(FenceList) * 4))))
+ b := 0
+ buf := make([]byte, size)
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
+ buf[b] = c.Extensions["SYNC"]
+ b += 1
- v.BadCounter = xgb.Get32(buf[b:])
- b += 4
+ buf[b] = 19 // request opcode
+ b += 1
- v.MinorOpcode = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- v.MajorOpcode = buf[b]
- b += 1
+ for i := 0; i < int(len(FenceList)); i++ {
+ xgb.Put32(buf[b:], uint32(FenceList[i]))
+ b += 4
+ }
+ b = xgb.Pad(b)
- return v
+ return buf
}
-// SequenceId returns the sequence id attached to the BadCounter error.
-// This is mostly used internally.
-func (err CounterError) SequenceId() uint16 {
- return err.Sequence
+// ChangeAlarmCookie is a cookie used only for ChangeAlarm requests.
+type ChangeAlarmCookie struct {
+ *xgb.Cookie
}
-// BadId returns the 'BadValue' number if one exists for the BadCounter error. If no bad value exists, 0 is returned.
-func (err CounterError) BadId() uint32 {
- return 0
+// ChangeAlarm sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func ChangeAlarm(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) ChangeAlarmCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'ChangeAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(changeAlarmRequest(c, Id, ValueMask, ValueList), cookie)
+ return ChangeAlarmCookie{cookie}
}
-// Error returns a rudimentary string representation of the BadCounter error.
-
-func (err CounterError) Error() string {
- fieldVals := make([]string, 0, 3)
- fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- fieldVals = append(fieldVals, xgb.Sprintf("BadCounter: %d", err.BadCounter))
- fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
- fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
- return "BadCounter {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+// ChangeAlarmChecked sends a checked request.
+// If an error occurs, it can be retrieved using ChangeAlarmCookie.Check()
+func ChangeAlarmChecked(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) ChangeAlarmCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'ChangeAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(changeAlarmRequest(c, Id, ValueMask, ValueList), cookie)
+ return ChangeAlarmCookie{cookie}
}
-func init() {
- xgb.NewExtErrorFuncs["SYNC"][0] = CounterErrorNew
+// 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 ChangeAlarmCookie) Check() error {
+ return cook.Cookie.Check()
}
-// BadAlarm is the error number for a BadAlarm.
-const BadAlarm = 1
-
-type AlarmError struct {
- Sequence uint16
- NiceName string
- BadAlarm uint32
- MinorOpcode uint16
- MajorOpcode byte
-}
+// Write request to wire for ChangeAlarm
+// changeAlarmRequest writes a ChangeAlarm request to a byte slice.
+func changeAlarmRequest(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) []byte {
+ size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))))
+ b := 0
+ buf := make([]byte, size)
-// AlarmErrorNew constructs a AlarmError value that implements xgb.Error from a byte slice.
-func AlarmErrorNew(buf []byte) xgb.Error {
- v := AlarmError{}
- v.NiceName = "Alarm"
+ buf[b] = c.Extensions["SYNC"]
+ b += 1
- b := 1 // skip error determinant
- b += 1 // don't read error number
+ buf[b] = 9 // 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.BadAlarm = xgb.Get32(buf[b:])
+ xgb.Put32(buf[b:], uint32(Id))
b += 4
- v.MinorOpcode = xgb.Get16(buf[b:])
- b += 2
-
- v.MajorOpcode = buf[b]
- b += 1
-
- return v
-}
-
-// SequenceId returns the sequence id attached to the BadAlarm error.
-// This is mostly used internally.
-func (err AlarmError) SequenceId() uint16 {
- return err.Sequence
-}
-
-// BadId returns the 'BadValue' number if one exists for the BadAlarm error. If no bad value exists, 0 is returned.
-func (err AlarmError) BadId() uint32 {
- return 0
-}
-
-// Error returns a rudimentary string representation of the BadAlarm error.
-
-func (err AlarmError) Error() string {
- fieldVals := make([]string, 0, 3)
- fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- fieldVals = append(fieldVals, xgb.Sprintf("BadAlarm: %d", err.BadAlarm))
- fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
- fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
- return "BadAlarm {" + xgb.StringsJoin(fieldVals, ", ") + "}"
-}
+ xgb.Put32(buf[b:], ValueMask)
+ b += 4
+ for i := 0; i < xgb.PopCount(int(ValueMask)); i++ {
+ xgb.Put32(buf[b:], ValueList[i])
+ b += 4
+ }
+ b = xgb.Pad(b)
-func init() {
- xgb.NewExtErrorFuncs["SYNC"][1] = AlarmErrorNew
+ return buf
}
-// InitializeCookie is a cookie used only for Initialize requests.
-type InitializeCookie struct {
+// ChangeCounterCookie is a cookie used only for ChangeCounter requests.
+type ChangeCounterCookie struct {
*xgb.Cookie
}
-// Initialize sends a checked request.
-// If an error occurs, it will be returned with the reply by calling InitializeCookie.Reply()
-func Initialize(c *xgb.Conn, DesiredMajorVersion byte, DesiredMinorVersion byte) InitializeCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'Initialize' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(initializeRequest(c, DesiredMajorVersion, DesiredMinorVersion), cookie)
- return InitializeCookie{cookie}
-}
-
-// InitializeUnchecked sends an unchecked request.
+// ChangeCounter sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func InitializeUnchecked(c *xgb.Conn, DesiredMajorVersion byte, DesiredMinorVersion byte) InitializeCookie {
+func ChangeCounter(c *xgb.Conn, Counter Counter, Amount Int64) ChangeCounterCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'Initialize' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ChangeCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(initializeRequest(c, DesiredMajorVersion, DesiredMinorVersion), cookie)
- return InitializeCookie{cookie}
-}
-
-// InitializeReply represents the data returned from a Initialize request.
-type InitializeReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- MajorVersion byte
- MinorVersion byte
- // padding: 22 bytes
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(changeCounterRequest(c, Counter, Amount), cookie)
+ return ChangeCounterCookie{cookie}
}
-// Reply blocks and returns the reply data for a Initialize request.
-func (cook InitializeCookie) Reply() (*InitializeReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
+// ChangeCounterChecked sends a checked request.
+// If an error occurs, it can be retrieved using ChangeCounterCookie.Check()
+func ChangeCounterChecked(c *xgb.Conn, Counter Counter, Amount Int64) ChangeCounterCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'ChangeCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- return initializeReply(buf), nil
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(changeCounterRequest(c, Counter, Amount), cookie)
+ return ChangeCounterCookie{cookie}
}
-// initializeReply reads a byte slice into a InitializeReply value.
-func initializeReply(buf []byte) *InitializeReply {
- v := new(InitializeReply)
- 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.MajorVersion = buf[b]
- b += 1
-
- v.MinorVersion = buf[b]
- b += 1
-
- b += 22 // padding
-
- 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 ChangeCounterCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Write request to wire for Initialize
-// initializeRequest writes a Initialize request to a byte slice.
-func initializeRequest(c *xgb.Conn, DesiredMajorVersion byte, DesiredMinorVersion byte) []byte {
- size := 8
+// Write request to wire for ChangeCounter
+// changeCounterRequest writes a ChangeCounter request to a byte slice.
+func changeCounterRequest(c *xgb.Conn, Counter Counter, Amount Int64) []byte {
+ size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 0 // 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
- buf[b] = DesiredMajorVersion
- b += 1
+ xgb.Put32(buf[b:], uint32(Counter))
+ b += 4
- buf[b] = DesiredMinorVersion
- b += 1
+ {
+ structBytes := Amount.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
return buf
}
-// ListSystemCountersCookie is a cookie used only for ListSystemCounters requests.
-type ListSystemCountersCookie struct {
+// CreateAlarmCookie is a cookie used only for CreateAlarm requests.
+type CreateAlarmCookie struct {
*xgb.Cookie
}
-// ListSystemCounters sends a checked request.
-// If an error occurs, it will be returned with the reply by calling ListSystemCountersCookie.Reply()
-func ListSystemCounters(c *xgb.Conn) ListSystemCountersCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'ListSystemCounters' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(listSystemCountersRequest(c), cookie)
- return ListSystemCountersCookie{cookie}
-}
-
-// ListSystemCountersUnchecked sends an unchecked request.
+// CreateAlarm sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ListSystemCountersUnchecked(c *xgb.Conn) ListSystemCountersCookie {
+func CreateAlarm(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) CreateAlarmCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'ListSystemCounters' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'CreateAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(listSystemCountersRequest(c), cookie)
- return ListSystemCountersCookie{cookie}
-}
-
-// ListSystemCountersReply represents the data returned from a ListSystemCounters request.
-type ListSystemCountersReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- CountersLen uint32
- // padding: 20 bytes
- Counters []Systemcounter // size: SystemcounterListSize(Counters)
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(createAlarmRequest(c, Id, ValueMask, ValueList), cookie)
+ return CreateAlarmCookie{cookie}
}
-// Reply blocks and returns the reply data for a ListSystemCounters request.
-func (cook ListSystemCountersCookie) Reply() (*ListSystemCountersReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
+// CreateAlarmChecked sends a checked request.
+// If an error occurs, it can be retrieved using CreateAlarmCookie.Check()
+func CreateAlarmChecked(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) CreateAlarmCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'CreateAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- return listSystemCountersReply(buf), nil
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(createAlarmRequest(c, Id, ValueMask, ValueList), cookie)
+ return CreateAlarmCookie{cookie}
}
-// listSystemCountersReply reads a byte slice into a ListSystemCountersReply value.
-func listSystemCountersReply(buf []byte) *ListSystemCountersReply {
- v := new(ListSystemCountersReply)
- 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.CountersLen = xgb.Get32(buf[b:])
- b += 4
-
- b += 20 // padding
-
- v.Counters = make([]Systemcounter, v.CountersLen)
- b += SystemcounterReadList(buf[b:], v.Counters)
-
- 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 CreateAlarmCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Write request to wire for ListSystemCounters
-// listSystemCountersRequest writes a ListSystemCounters request to a byte slice.
-func listSystemCountersRequest(c *xgb.Conn) []byte {
- size := 4
+// Write request to wire for CreateAlarm
+// createAlarmRequest writes a CreateAlarm request to a byte slice.
+func createAlarmRequest(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) []byte {
+ size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 1 // 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(Id))
+ b += 4
+
+ xgb.Put32(buf[b:], ValueMask)
+ b += 4
+ for i := 0; i < xgb.PopCount(int(ValueMask)); i++ {
+ xgb.Put32(buf[b:], ValueList[i])
+ b += 4
+ }
+ b = xgb.Pad(b)
+
return buf
}
@@ -993,130 +1102,107 @@ func createCounterRequest(c *xgb.Conn, Id Counter, InitialValue Int64) []byte {
return buf
}
-// DestroyCounterCookie is a cookie used only for DestroyCounter requests.
-type DestroyCounterCookie struct {
+// CreateFenceCookie is a cookie used only for CreateFence requests.
+type CreateFenceCookie struct {
*xgb.Cookie
}
-// DestroyCounter sends an unchecked request.
+// CreateFence sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func DestroyCounter(c *xgb.Conn, Counter Counter) DestroyCounterCookie {
+func CreateFence(c *xgb.Conn, Drawable xproto.Drawable, Fence Fence, InitiallyTriggered bool) CreateFenceCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'DestroyCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'CreateFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(destroyCounterRequest(c, Counter), cookie)
- return DestroyCounterCookie{cookie}
+ c.NewRequest(createFenceRequest(c, Drawable, Fence, InitiallyTriggered), cookie)
+ return CreateFenceCookie{cookie}
}
-// DestroyCounterChecked sends a checked request.
-// If an error occurs, it can be retrieved using DestroyCounterCookie.Check()
-func DestroyCounterChecked(c *xgb.Conn, Counter Counter) DestroyCounterCookie {
+// CreateFenceChecked sends a checked request.
+// If an error occurs, it can be retrieved using CreateFenceCookie.Check()
+func CreateFenceChecked(c *xgb.Conn, Drawable xproto.Drawable, Fence Fence, InitiallyTriggered bool) CreateFenceCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'DestroyCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'CreateFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(destroyCounterRequest(c, Counter), cookie)
- return DestroyCounterCookie{cookie}
+ c.NewRequest(createFenceRequest(c, Drawable, Fence, InitiallyTriggered), cookie)
+ return CreateFenceCookie{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 DestroyCounterCookie) Check() error {
+func (cook CreateFenceCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for DestroyCounter
-// destroyCounterRequest writes a DestroyCounter request to a byte slice.
-func destroyCounterRequest(c *xgb.Conn, Counter Counter) []byte {
- size := 8
+// Write request to wire for CreateFence
+// createFenceRequest writes a CreateFence request to a byte slice.
+func createFenceRequest(c *xgb.Conn, Drawable xproto.Drawable, Fence Fence, InitiallyTriggered bool) []byte {
+ size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 6 // 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(Counter))
+ xgb.Put32(buf[b:], uint32(Drawable))
b += 4
+ xgb.Put32(buf[b:], uint32(Fence))
+ b += 4
+
+ if InitiallyTriggered {
+ buf[b] = 1
+ } else {
+ buf[b] = 0
+ }
+ b += 1
+
return buf
}
-// QueryCounterCookie is a cookie used only for QueryCounter requests.
-type QueryCounterCookie struct {
+// DestroyAlarmCookie is a cookie used only for DestroyAlarm requests.
+type DestroyAlarmCookie struct {
*xgb.Cookie
}
-// QueryCounter sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryCounterCookie.Reply()
-func QueryCounter(c *xgb.Conn, Counter Counter) QueryCounterCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'QueryCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(queryCounterRequest(c, Counter), cookie)
- return QueryCounterCookie{cookie}
-}
-
-// QueryCounterUnchecked sends an unchecked request.
+// DestroyAlarm sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryCounterUnchecked(c *xgb.Conn, Counter Counter) QueryCounterCookie {
+func DestroyAlarm(c *xgb.Conn, Alarm Alarm) DestroyAlarmCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'QueryCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DestroyAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(queryCounterRequest(c, Counter), cookie)
- return QueryCounterCookie{cookie}
-}
-
-// QueryCounterReply represents the data returned from a QueryCounter request.
-type QueryCounterReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- CounterValue Int64
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(destroyAlarmRequest(c, Alarm), cookie)
+ return DestroyAlarmCookie{cookie}
}
-// Reply blocks and returns the reply data for a QueryCounter request.
-func (cook QueryCounterCookie) Reply() (*QueryCounterReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
+// DestroyAlarmChecked sends a checked request.
+// If an error occurs, it can be retrieved using DestroyAlarmCookie.Check()
+func DestroyAlarmChecked(c *xgb.Conn, Alarm Alarm) DestroyAlarmCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'DestroyAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- return queryCounterReply(buf), nil
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(destroyAlarmRequest(c, Alarm), cookie)
+ return DestroyAlarmCookie{cookie}
}
-// queryCounterReply reads a byte slice into a QueryCounterReply value.
-func queryCounterReply(buf []byte) *QueryCounterReply {
- v := new(QueryCounterReply)
- 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.CounterValue = Int64{}
- b += Int64Read(buf[b:], &v.CounterValue)
-
- 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 DestroyAlarmCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Write request to wire for QueryCounter
-// queryCounterRequest writes a QueryCounter request to a byte slice.
-func queryCounterRequest(c *xgb.Conn, Counter Counter) []byte {
+// Write request to wire for DestroyAlarm
+// destroyAlarmRequest writes a DestroyAlarm request to a byte slice.
+func destroyAlarmRequest(c *xgb.Conn, Alarm Alarm) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1124,372 +1210,403 @@ func queryCounterRequest(c *xgb.Conn, Counter Counter) []byte {
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 5 // 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(Counter))
+ xgb.Put32(buf[b:], uint32(Alarm))
b += 4
return buf
}
-// AwaitCookie is a cookie used only for Await requests.
-type AwaitCookie struct {
+// DestroyCounterCookie is a cookie used only for DestroyCounter requests.
+type DestroyCounterCookie struct {
*xgb.Cookie
}
-// Await sends an unchecked request.
+// DestroyCounter sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func Await(c *xgb.Conn, WaitList []Waitcondition) AwaitCookie {
+func DestroyCounter(c *xgb.Conn, Counter Counter) DestroyCounterCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'Await' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DestroyCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(awaitRequest(c, WaitList), cookie)
- return AwaitCookie{cookie}
+ c.NewRequest(destroyCounterRequest(c, Counter), cookie)
+ return DestroyCounterCookie{cookie}
}
-// AwaitChecked sends a checked request.
-// If an error occurs, it can be retrieved using AwaitCookie.Check()
-func AwaitChecked(c *xgb.Conn, WaitList []Waitcondition) AwaitCookie {
+// DestroyCounterChecked sends a checked request.
+// If an error occurs, it can be retrieved using DestroyCounterCookie.Check()
+func DestroyCounterChecked(c *xgb.Conn, Counter Counter) DestroyCounterCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'Await' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DestroyCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(awaitRequest(c, WaitList), cookie)
- return AwaitCookie{cookie}
+ c.NewRequest(destroyCounterRequest(c, Counter), cookie)
+ return DestroyCounterCookie{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 AwaitCookie) Check() error {
+func (cook DestroyCounterCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for Await
-// awaitRequest writes a Await request to a byte slice.
-func awaitRequest(c *xgb.Conn, WaitList []Waitcondition) []byte {
- size := xgb.Pad((4 + xgb.Pad((len(WaitList) * 28))))
+// Write request to wire for DestroyCounter
+// destroyCounterRequest writes a DestroyCounter request to a byte slice.
+func destroyCounterRequest(c *xgb.Conn, Counter Counter) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 7 // 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
- b += WaitconditionListBytes(buf[b:], WaitList)
+ xgb.Put32(buf[b:], uint32(Counter))
+ b += 4
return buf
}
-// ChangeCounterCookie is a cookie used only for ChangeCounter requests.
-type ChangeCounterCookie struct {
+// DestroyFenceCookie is a cookie used only for DestroyFence requests.
+type DestroyFenceCookie struct {
*xgb.Cookie
}
-// ChangeCounter sends an unchecked request.
+// DestroyFence sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ChangeCounter(c *xgb.Conn, Counter Counter, Amount Int64) ChangeCounterCookie {
+func DestroyFence(c *xgb.Conn, Fence Fence) DestroyFenceCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'ChangeCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DestroyFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(changeCounterRequest(c, Counter, Amount), cookie)
- return ChangeCounterCookie{cookie}
+ c.NewRequest(destroyFenceRequest(c, Fence), cookie)
+ return DestroyFenceCookie{cookie}
}
-// ChangeCounterChecked sends a checked request.
-// If an error occurs, it can be retrieved using ChangeCounterCookie.Check()
-func ChangeCounterChecked(c *xgb.Conn, Counter Counter, Amount Int64) ChangeCounterCookie {
+// DestroyFenceChecked sends a checked request.
+// If an error occurs, it can be retrieved using DestroyFenceCookie.Check()
+func DestroyFenceChecked(c *xgb.Conn, Fence Fence) DestroyFenceCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'ChangeCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'DestroyFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(changeCounterRequest(c, Counter, Amount), cookie)
- return ChangeCounterCookie{cookie}
+ c.NewRequest(destroyFenceRequest(c, Fence), cookie)
+ return DestroyFenceCookie{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 ChangeCounterCookie) Check() error {
+func (cook DestroyFenceCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for ChangeCounter
-// changeCounterRequest writes a ChangeCounter request to a byte slice.
-func changeCounterRequest(c *xgb.Conn, Counter Counter, Amount Int64) []byte {
- size := 16
+// Write request to wire for DestroyFence
+// destroyFenceRequest writes a DestroyFence request to a byte slice.
+func destroyFenceRequest(c *xgb.Conn, Fence Fence) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
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(Counter))
+ xgb.Put32(buf[b:], uint32(Fence))
b += 4
- {
- structBytes := Amount.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
-
return buf
}
-// SetCounterCookie is a cookie used only for SetCounter requests.
-type SetCounterCookie struct {
+// GetPriorityCookie is a cookie used only for GetPriority requests.
+type GetPriorityCookie struct {
*xgb.Cookie
}
-// SetCounter sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetCounter(c *xgb.Conn, Counter Counter, Value Int64) SetCounterCookie {
+// GetPriority sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetPriorityCookie.Reply()
+func GetPriority(c *xgb.Conn, Id uint32) GetPriorityCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'SetCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPriority' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(setCounterRequest(c, Counter, Value), cookie)
- return SetCounterCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(getPriorityRequest(c, Id), cookie)
+ return GetPriorityCookie{cookie}
}
-// SetCounterChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetCounterCookie.Check()
-func SetCounterChecked(c *xgb.Conn, Counter Counter, Value Int64) SetCounterCookie {
+// GetPriorityUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetPriorityUnchecked(c *xgb.Conn, Id uint32) GetPriorityCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'SetCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPriority' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(setCounterRequest(c, Counter, Value), cookie)
- return SetCounterCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(getPriorityRequest(c, Id), cookie)
+ return GetPriorityCookie{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 SetCounterCookie) Check() error {
- return cook.Cookie.Check()
+// GetPriorityReply represents the data returned from a GetPriority request.
+type GetPriorityReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ Priority int32
}
-// Write request to wire for SetCounter
-// setCounterRequest writes a SetCounter request to a byte slice.
-func setCounterRequest(c *xgb.Conn, Counter Counter, Value Int64) []byte {
- size := 16
+// Reply blocks and returns the reply data for a GetPriority request.
+func (cook GetPriorityCookie) Reply() (*GetPriorityReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return getPriorityReply(buf), nil
+}
+
+// getPriorityReply reads a byte slice into a GetPriorityReply value.
+func getPriorityReply(buf []byte) *GetPriorityReply {
+ v := new(GetPriorityReply)
+ 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.Priority = int32(xgb.Get32(buf[b:]))
+ b += 4
+
+ return v
+}
+
+// Write request to wire for GetPriority
+// getPriorityRequest writes a GetPriority request to a byte slice.
+func getPriorityRequest(c *xgb.Conn, Id uint32) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 3 // request opcode
+ buf[b] = 13 // 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(Counter))
+ xgb.Put32(buf[b:], Id)
b += 4
- {
- structBytes := Value.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
-
return buf
}
-// CreateAlarmCookie is a cookie used only for CreateAlarm requests.
-type CreateAlarmCookie struct {
+// InitializeCookie is a cookie used only for Initialize requests.
+type InitializeCookie struct {
*xgb.Cookie
}
-// CreateAlarm sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func CreateAlarm(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) CreateAlarmCookie {
+// Initialize sends a checked request.
+// If an error occurs, it will be returned with the reply by calling InitializeCookie.Reply()
+func Initialize(c *xgb.Conn, DesiredMajorVersion byte, DesiredMinorVersion byte) InitializeCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'CreateAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'Initialize' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(createAlarmRequest(c, Id, ValueMask, ValueList), cookie)
- return CreateAlarmCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(initializeRequest(c, DesiredMajorVersion, DesiredMinorVersion), cookie)
+ return InitializeCookie{cookie}
}
-// CreateAlarmChecked sends a checked request.
-// If an error occurs, it can be retrieved using CreateAlarmCookie.Check()
-func CreateAlarmChecked(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) CreateAlarmCookie {
+// InitializeUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func InitializeUnchecked(c *xgb.Conn, DesiredMajorVersion byte, DesiredMinorVersion byte) InitializeCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'CreateAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'Initialize' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(createAlarmRequest(c, Id, ValueMask, ValueList), cookie)
- return CreateAlarmCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(initializeRequest(c, DesiredMajorVersion, DesiredMinorVersion), cookie)
+ return InitializeCookie{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 CreateAlarmCookie) Check() error {
- return cook.Cookie.Check()
+// InitializeReply represents the data returned from a Initialize request.
+type InitializeReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ MajorVersion byte
+ MinorVersion byte
+ // padding: 22 bytes
}
-// Write request to wire for CreateAlarm
-// createAlarmRequest writes a CreateAlarm request to a byte slice.
-func createAlarmRequest(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) []byte {
- size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))))
+// Reply blocks and returns the reply data for a Initialize request.
+func (cook InitializeCookie) Reply() (*InitializeReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return initializeReply(buf), nil
+}
+
+// initializeReply reads a byte slice into a InitializeReply value.
+func initializeReply(buf []byte) *InitializeReply {
+ v := new(InitializeReply)
+ 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.MajorVersion = buf[b]
+ b += 1
+
+ v.MinorVersion = buf[b]
+ b += 1
+
+ b += 22 // padding
+
+ return v
+}
+
+// Write request to wire for Initialize
+// initializeRequest writes a Initialize request to a byte slice.
+func initializeRequest(c *xgb.Conn, DesiredMajorVersion byte, DesiredMinorVersion byte) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 8 // 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(Id))
- b += 4
+ buf[b] = DesiredMajorVersion
+ b += 1
- xgb.Put32(buf[b:], ValueMask)
- b += 4
- for i := 0; i < xgb.PopCount(int(ValueMask)); i++ {
- xgb.Put32(buf[b:], ValueList[i])
- b += 4
- }
- b = xgb.Pad(b)
+ buf[b] = DesiredMinorVersion
+ b += 1
return buf
}
-// ChangeAlarmCookie is a cookie used only for ChangeAlarm requests.
-type ChangeAlarmCookie struct {
+// ListSystemCountersCookie is a cookie used only for ListSystemCounters requests.
+type ListSystemCountersCookie struct {
*xgb.Cookie
}
-// ChangeAlarm sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ChangeAlarm(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) ChangeAlarmCookie {
+// ListSystemCounters sends a checked request.
+// If an error occurs, it will be returned with the reply by calling ListSystemCountersCookie.Reply()
+func ListSystemCounters(c *xgb.Conn) ListSystemCountersCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'ChangeAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ListSystemCounters' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(changeAlarmRequest(c, Id, ValueMask, ValueList), cookie)
- return ChangeAlarmCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(listSystemCountersRequest(c), cookie)
+ return ListSystemCountersCookie{cookie}
}
-// ChangeAlarmChecked sends a checked request.
-// If an error occurs, it can be retrieved using ChangeAlarmCookie.Check()
-func ChangeAlarmChecked(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) ChangeAlarmCookie {
+// ListSystemCountersUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func ListSystemCountersUnchecked(c *xgb.Conn) ListSystemCountersCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'ChangeAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ListSystemCounters' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(changeAlarmRequest(c, Id, ValueMask, ValueList), cookie)
- return ChangeAlarmCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(listSystemCountersRequest(c), cookie)
+ return ListSystemCountersCookie{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 ChangeAlarmCookie) Check() error {
- return cook.Cookie.Check()
+// ListSystemCountersReply represents the data returned from a ListSystemCounters request.
+type ListSystemCountersReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ CountersLen uint32
+ // padding: 20 bytes
+ Counters []Systemcounter // size: SystemcounterListSize(Counters)
}
-// Write request to wire for ChangeAlarm
-// changeAlarmRequest writes a ChangeAlarm request to a byte slice.
-func changeAlarmRequest(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) []byte {
- size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))))
- b := 0
- buf := make([]byte, size)
+// Reply blocks and returns the reply data for a ListSystemCounters request.
+func (cook ListSystemCountersCookie) Reply() (*ListSystemCountersReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return listSystemCountersReply(buf), nil
+}
- buf[b] = c.Extensions["SYNC"]
- b += 1
+// listSystemCountersReply reads a byte slice into a ListSystemCountersReply value.
+func listSystemCountersReply(buf []byte) *ListSystemCountersReply {
+ v := new(ListSystemCountersReply)
+ b := 1 // skip reply determinant
- buf[b] = 9 // 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(Id))
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- xgb.Put32(buf[b:], ValueMask)
+ v.CountersLen = xgb.Get32(buf[b:])
b += 4
- for i := 0; i < xgb.PopCount(int(ValueMask)); i++ {
- xgb.Put32(buf[b:], ValueList[i])
- b += 4
- }
- b = xgb.Pad(b)
- return buf
-}
-
-// DestroyAlarmCookie is a cookie used only for DestroyAlarm requests.
-type DestroyAlarmCookie struct {
- *xgb.Cookie
-}
-
-// DestroyAlarm sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func DestroyAlarm(c *xgb.Conn, Alarm Alarm) DestroyAlarmCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'DestroyAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(destroyAlarmRequest(c, Alarm), cookie)
- return DestroyAlarmCookie{cookie}
-}
+ b += 20 // padding
-// DestroyAlarmChecked sends a checked request.
-// If an error occurs, it can be retrieved using DestroyAlarmCookie.Check()
-func DestroyAlarmChecked(c *xgb.Conn, Alarm Alarm) DestroyAlarmCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'DestroyAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(destroyAlarmRequest(c, Alarm), cookie)
- return DestroyAlarmCookie{cookie}
-}
+ v.Counters = make([]Systemcounter, v.CountersLen)
+ b += SystemcounterReadList(buf[b:], v.Counters)
-// 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 DestroyAlarmCookie) Check() error {
- return cook.Cookie.Check()
+ return v
}
-// Write request to wire for DestroyAlarm
-// destroyAlarmRequest writes a DestroyAlarm request to a byte slice.
-func destroyAlarmRequest(c *xgb.Conn, Alarm Alarm) []byte {
- size := 8
+// Write request to wire for ListSystemCounters
+// listSystemCountersRequest writes a ListSystemCounters request to a byte slice.
+func listSystemCountersRequest(c *xgb.Conn) []byte {
+ size := 4
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 11 // request opcode
+ buf[b] = 1 // 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(Alarm))
- b += 4
-
return buf
}
@@ -1600,101 +1717,43 @@ func queryAlarmRequest(c *xgb.Conn, Alarm Alarm) []byte {
return buf
}
-// SetPriorityCookie is a cookie used only for SetPriority requests.
-type SetPriorityCookie struct {
- *xgb.Cookie
-}
-
-// SetPriority sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetPriority(c *xgb.Conn, Id uint32, Priority int32) SetPriorityCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'SetPriority' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(setPriorityRequest(c, Id, Priority), cookie)
- return SetPriorityCookie{cookie}
-}
-
-// SetPriorityChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetPriorityCookie.Check()
-func SetPriorityChecked(c *xgb.Conn, Id uint32, Priority int32) SetPriorityCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'SetPriority' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(setPriorityRequest(c, Id, Priority), cookie)
- return SetPriorityCookie{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 SetPriorityCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for SetPriority
-// setPriorityRequest writes a SetPriority request to a byte slice.
-func setPriorityRequest(c *xgb.Conn, Id uint32, Priority int32) []byte {
- size := 12
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["SYNC"]
- 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:], Id)
- b += 4
-
- xgb.Put32(buf[b:], uint32(Priority))
- b += 4
-
- return buf
-}
-
-// GetPriorityCookie is a cookie used only for GetPriority requests.
-type GetPriorityCookie struct {
+// QueryCounterCookie is a cookie used only for QueryCounter requests.
+type QueryCounterCookie struct {
*xgb.Cookie
}
-// GetPriority sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetPriorityCookie.Reply()
-func GetPriority(c *xgb.Conn, Id uint32) GetPriorityCookie {
+// QueryCounter sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryCounterCookie.Reply()
+func QueryCounter(c *xgb.Conn, Counter Counter) QueryCounterCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'GetPriority' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getPriorityRequest(c, Id), cookie)
- return GetPriorityCookie{cookie}
+ c.NewRequest(queryCounterRequest(c, Counter), cookie)
+ return QueryCounterCookie{cookie}
}
-// GetPriorityUnchecked sends an unchecked request.
+// QueryCounterUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetPriorityUnchecked(c *xgb.Conn, Id uint32) GetPriorityCookie {
+func QueryCounterUnchecked(c *xgb.Conn, Counter Counter) QueryCounterCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'GetPriority' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getPriorityRequest(c, Id), cookie)
- return GetPriorityCookie{cookie}
+ c.NewRequest(queryCounterRequest(c, Counter), cookie)
+ return QueryCounterCookie{cookie}
}
-// GetPriorityReply represents the data returned from a GetPriority request.
-type GetPriorityReply struct {
+// QueryCounterReply represents the data returned from a QueryCounter request.
+type QueryCounterReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Priority int32
+ CounterValue Int64
}
-// Reply blocks and returns the reply data for a GetPriority request.
-func (cook GetPriorityCookie) Reply() (*GetPriorityReply, error) {
+// Reply blocks and returns the reply data for a QueryCounter request.
+func (cook QueryCounterCookie) Reply() (*QueryCounterReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1702,12 +1761,12 @@ func (cook GetPriorityCookie) Reply() (*GetPriorityReply, error) {
if buf == nil {
return nil, nil
}
- return getPriorityReply(buf), nil
+ return queryCounterReply(buf), nil
}
-// getPriorityReply reads a byte slice into a GetPriorityReply value.
-func getPriorityReply(buf []byte) *GetPriorityReply {
- v := new(GetPriorityReply)
+// queryCounterReply reads a byte slice into a QueryCounterReply value.
+func queryCounterReply(buf []byte) *QueryCounterReply {
+ v := new(QueryCounterReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1718,15 +1777,15 @@ func getPriorityReply(buf []byte) *GetPriorityReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Priority = int32(xgb.Get32(buf[b:]))
- b += 4
+ v.CounterValue = Int64{}
+ b += Int64Read(buf[b:], &v.CounterValue)
return v
}
-// Write request to wire for GetPriority
-// getPriorityRequest writes a GetPriority request to a byte slice.
-func getPriorityRequest(c *xgb.Conn, Id uint32) []byte {
+// Write request to wire for QueryCounter
+// queryCounterRequest writes a QueryCounter request to a byte slice.
+func queryCounterRequest(c *xgb.Conn, Counter Counter) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1734,119 +1793,94 @@ func getPriorityRequest(c *xgb.Conn, Id uint32) []byte {
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 13 // 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:], Id)
+ xgb.Put32(buf[b:], uint32(Counter))
b += 4
return buf
}
-// CreateFenceCookie is a cookie used only for CreateFence requests.
-type CreateFenceCookie struct {
+// QueryFenceCookie is a cookie used only for QueryFence requests.
+type QueryFenceCookie struct {
*xgb.Cookie
}
-// CreateFence sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func CreateFence(c *xgb.Conn, Drawable xproto.Drawable, Fence Fence, InitiallyTriggered bool) CreateFenceCookie {
+// QueryFence sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryFenceCookie.Reply()
+func QueryFence(c *xgb.Conn, Fence Fence) QueryFenceCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'CreateFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(createFenceRequest(c, Drawable, Fence, InitiallyTriggered), cookie)
- return CreateFenceCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(queryFenceRequest(c, Fence), cookie)
+ return QueryFenceCookie{cookie}
}
-// CreateFenceChecked sends a checked request.
-// If an error occurs, it can be retrieved using CreateFenceCookie.Check()
-func CreateFenceChecked(c *xgb.Conn, Drawable xproto.Drawable, Fence Fence, InitiallyTriggered bool) CreateFenceCookie {
+// QueryFenceUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func QueryFenceUnchecked(c *xgb.Conn, Fence Fence) QueryFenceCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'CreateFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(createFenceRequest(c, Drawable, Fence, InitiallyTriggered), cookie)
- return CreateFenceCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(queryFenceRequest(c, Fence), cookie)
+ return QueryFenceCookie{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 CreateFenceCookie) Check() error {
- return cook.Cookie.Check()
+// QueryFenceReply represents the data returned from a QueryFence request.
+type QueryFenceReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ Triggered bool
+ // padding: 23 bytes
}
-// Write request to wire for CreateFence
-// createFenceRequest writes a CreateFence request to a byte slice.
-func createFenceRequest(c *xgb.Conn, Drawable xproto.Drawable, Fence Fence, InitiallyTriggered bool) []byte {
- size := 16
- b := 0
- buf := make([]byte, size)
+// Reply blocks and returns the reply data for a QueryFence request.
+func (cook QueryFenceCookie) Reply() (*QueryFenceReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return queryFenceReply(buf), nil
+}
- buf[b] = c.Extensions["SYNC"]
- b += 1
+// queryFenceReply reads a byte slice into a QueryFenceReply value.
+func queryFenceReply(buf []byte) *QueryFenceReply {
+ v := new(QueryFenceReply)
+ b := 1 // skip reply determinant
- buf[b] = 14 // 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(Drawable))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Fence))
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- if InitiallyTriggered {
- buf[b] = 1
+ if buf[b] == 1 {
+ v.Triggered = true
} else {
- buf[b] = 0
+ v.Triggered = false
}
b += 1
- return buf
-}
-
-// TriggerFenceCookie is a cookie used only for TriggerFence requests.
-type TriggerFenceCookie struct {
- *xgb.Cookie
-}
-
-// TriggerFence sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func TriggerFence(c *xgb.Conn, Fence Fence) TriggerFenceCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'TriggerFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(triggerFenceRequest(c, Fence), cookie)
- return TriggerFenceCookie{cookie}
-}
-
-// TriggerFenceChecked sends a checked request.
-// If an error occurs, it can be retrieved using TriggerFenceCookie.Check()
-func TriggerFenceChecked(c *xgb.Conn, Fence Fence) TriggerFenceCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'TriggerFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(triggerFenceRequest(c, Fence), cookie)
- return TriggerFenceCookie{cookie}
-}
+ b += 23 // padding
-// 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 TriggerFenceCookie) Check() error {
- return cook.Cookie.Check()
+ return v
}
-// Write request to wire for TriggerFence
-// triggerFenceRequest writes a TriggerFence request to a byte slice.
-func triggerFenceRequest(c *xgb.Conn, Fence Fence) []byte {
+// Write request to wire for QueryFence
+// queryFenceRequest writes a QueryFence request to a byte slice.
+func queryFenceRequest(c *xgb.Conn, Fence Fence) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -1854,7 +1888,7 @@ func triggerFenceRequest(c *xgb.Conn, Fence Fence) []byte {
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 15 // request opcode
+ buf[b] = 18 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -1921,210 +1955,176 @@ func resetFenceRequest(c *xgb.Conn, Fence Fence) []byte {
return buf
}
-// DestroyFenceCookie is a cookie used only for DestroyFence requests.
-type DestroyFenceCookie struct {
+// SetCounterCookie is a cookie used only for SetCounter requests.
+type SetCounterCookie struct {
*xgb.Cookie
}
-// DestroyFence sends an unchecked request.
+// SetCounter sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func DestroyFence(c *xgb.Conn, Fence Fence) DestroyFenceCookie {
+func SetCounter(c *xgb.Conn, Counter Counter, Value Int64) SetCounterCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'DestroyFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(destroyFenceRequest(c, Fence), cookie)
- return DestroyFenceCookie{cookie}
+ c.NewRequest(setCounterRequest(c, Counter, Value), cookie)
+ return SetCounterCookie{cookie}
}
-// DestroyFenceChecked sends a checked request.
-// If an error occurs, it can be retrieved using DestroyFenceCookie.Check()
-func DestroyFenceChecked(c *xgb.Conn, Fence Fence) DestroyFenceCookie {
+// SetCounterChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetCounterCookie.Check()
+func SetCounterChecked(c *xgb.Conn, Counter Counter, Value Int64) SetCounterCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'DestroyFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(destroyFenceRequest(c, Fence), cookie)
- return DestroyFenceCookie{cookie}
+ c.NewRequest(setCounterRequest(c, Counter, Value), cookie)
+ return SetCounterCookie{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 DestroyFenceCookie) Check() error {
+func (cook SetCounterCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for DestroyFence
-// destroyFenceRequest writes a DestroyFence request to a byte slice.
-func destroyFenceRequest(c *xgb.Conn, Fence Fence) []byte {
- size := 8
+// Write request to wire for SetCounter
+// setCounterRequest writes a SetCounter request to a byte slice.
+func setCounterRequest(c *xgb.Conn, Counter Counter, Value Int64) []byte {
+ size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 17 // request opcode
+ buf[b] = 3 // 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(Fence))
+ xgb.Put32(buf[b:], uint32(Counter))
b += 4
+ {
+ structBytes := Value.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+
return buf
}
-// QueryFenceCookie is a cookie used only for QueryFence requests.
-type QueryFenceCookie struct {
+// SetPriorityCookie is a cookie used only for SetPriority requests.
+type SetPriorityCookie struct {
*xgb.Cookie
}
-// QueryFence sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryFenceCookie.Reply()
-func QueryFence(c *xgb.Conn, Fence Fence) QueryFenceCookie {
- if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'QueryFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(queryFenceRequest(c, Fence), cookie)
- return QueryFenceCookie{cookie}
-}
-
-// QueryFenceUnchecked sends an unchecked request.
+// SetPriority sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryFenceUnchecked(c *xgb.Conn, Fence Fence) QueryFenceCookie {
+func SetPriority(c *xgb.Conn, Id uint32, Priority int32) SetPriorityCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'QueryFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SetPriority' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(queryFenceRequest(c, Fence), cookie)
- return QueryFenceCookie{cookie}
-}
-
-// QueryFenceReply represents the data returned from a QueryFence request.
-type QueryFenceReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- Triggered bool
- // padding: 23 bytes
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setPriorityRequest(c, Id, Priority), cookie)
+ return SetPriorityCookie{cookie}
}
-// Reply blocks and returns the reply data for a QueryFence request.
-func (cook QueryFenceCookie) Reply() (*QueryFenceReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
+// SetPriorityChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetPriorityCookie.Check()
+func SetPriorityChecked(c *xgb.Conn, Id uint32, Priority int32) SetPriorityCookie {
+ if _, ok := c.Extensions["SYNC"]; !ok {
+ panic("Cannot issue request 'SetPriority' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
- return queryFenceReply(buf), nil
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setPriorityRequest(c, Id, Priority), cookie)
+ return SetPriorityCookie{cookie}
}
-// queryFenceReply reads a byte slice into a QueryFenceReply value.
-func queryFenceReply(buf []byte) *QueryFenceReply {
- v := new(QueryFenceReply)
- 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
-
- if buf[b] == 1 {
- v.Triggered = true
- } else {
- v.Triggered = false
- }
- b += 1
-
- b += 23 // padding
-
- 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 SetPriorityCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Write request to wire for QueryFence
-// queryFenceRequest writes a QueryFence request to a byte slice.
-func queryFenceRequest(c *xgb.Conn, Fence Fence) []byte {
- size := 8
+// Write request to wire for SetPriority
+// setPriorityRequest writes a SetPriority request to a byte slice.
+func setPriorityRequest(c *xgb.Conn, Id uint32, Priority int32) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 18 // request opcode
+ 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(Fence))
+ xgb.Put32(buf[b:], Id)
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Priority))
b += 4
return buf
}
-// AwaitFenceCookie is a cookie used only for AwaitFence requests.
-type AwaitFenceCookie struct {
+// TriggerFenceCookie is a cookie used only for TriggerFence requests.
+type TriggerFenceCookie struct {
*xgb.Cookie
}
-// AwaitFence sends an unchecked request.
+// TriggerFence sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func AwaitFence(c *xgb.Conn, FenceList []Fence) AwaitFenceCookie {
+func TriggerFence(c *xgb.Conn, Fence Fence) TriggerFenceCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'AwaitFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'TriggerFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(awaitFenceRequest(c, FenceList), cookie)
- return AwaitFenceCookie{cookie}
+ c.NewRequest(triggerFenceRequest(c, Fence), cookie)
+ return TriggerFenceCookie{cookie}
}
-// AwaitFenceChecked sends a checked request.
-// If an error occurs, it can be retrieved using AwaitFenceCookie.Check()
-func AwaitFenceChecked(c *xgb.Conn, FenceList []Fence) AwaitFenceCookie {
+// TriggerFenceChecked sends a checked request.
+// If an error occurs, it can be retrieved using TriggerFenceCookie.Check()
+func TriggerFenceChecked(c *xgb.Conn, Fence Fence) TriggerFenceCookie {
if _, ok := c.Extensions["SYNC"]; !ok {
- panic("Cannot issue request 'AwaitFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
+ panic("Cannot issue request 'TriggerFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(awaitFenceRequest(c, FenceList), cookie)
- return AwaitFenceCookie{cookie}
+ c.NewRequest(triggerFenceRequest(c, Fence), cookie)
+ return TriggerFenceCookie{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 AwaitFenceCookie) Check() error {
+func (cook TriggerFenceCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for AwaitFence
-// awaitFenceRequest writes a AwaitFence request to a byte slice.
-func awaitFenceRequest(c *xgb.Conn, FenceList []Fence) []byte {
- size := xgb.Pad((4 + xgb.Pad((len(FenceList) * 4))))
+// Write request to wire for TriggerFence
+// triggerFenceRequest writes a TriggerFence request to a byte slice.
+func triggerFenceRequest(c *xgb.Conn, Fence Fence) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["SYNC"]
b += 1
- buf[b] = 19 // request opcode
+ buf[b] = 15 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- for i := 0; i < int(len(FenceList)); i++ {
- xgb.Put32(buf[b:], uint32(FenceList[i]))
- b += 4
- }
- b = xgb.Pad(b)
+ xgb.Put32(buf[b:], uint32(Fence))
+ b += 4
return buf
}