From 29942bf078c92fea681e42ca5029592526f00718 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 23:58:52 -0400 Subject: panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people. --- nexgb/sync/sync.go | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 3 deletions(-) (limited to 'nexgb/sync/sync.go') diff --git a/nexgb/sync/sync.go b/nexgb/sync/sync.go index 1904963..5aa019e 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 May 11 2012 1:58:36am EDT. + This file was generated by sync.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,6 +40,8 @@ func init() { xgb.NewExtErrorFuncs["SYNC"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Float' + // Skipping definition for base type 'Card8' // Skipping definition for base type 'Int16' @@ -62,8 +64,6 @@ func init() { // Skipping definition for base type 'Bool' -// Skipping definition for base type 'Float' - const ( AlarmstateActive = 0 AlarmstateInactive = 1 @@ -750,6 +750,9 @@ type InitializeCookie struct { // 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} @@ -758,6 +761,9 @@ func Initialize(c *xgb.Conn, DesiredMajorVersion byte, DesiredMinorVersion byte) // 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 'Initialize' 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} @@ -842,6 +848,9 @@ type ListSystemCountersCookie struct { // 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} @@ -850,6 +859,9 @@ func ListSystemCounters(c *xgb.Conn) ListSystemCountersCookie { // 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 'ListSystemCounters' 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} @@ -928,6 +940,9 @@ type CreateCounterCookie struct { // CreateCounter sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateCounter(c *xgb.Conn, Id Counter, InitialValue Int64) CreateCounterCookie { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'CreateCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createCounterRequest(c, Id, InitialValue), cookie) return CreateCounterCookie{cookie} @@ -936,6 +951,9 @@ func CreateCounter(c *xgb.Conn, Id Counter, InitialValue Int64) CreateCounterCoo // CreateCounterChecked sends a checked request. // If an error occurs, it can be retrieved using CreateCounterCookie.Check() func CreateCounterChecked(c *xgb.Conn, Id Counter, InitialValue Int64) CreateCounterCookie { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'CreateCounter' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createCounterRequest(c, Id, InitialValue), cookie) return CreateCounterCookie{cookie} @@ -983,6 +1001,9 @@ type DestroyCounterCookie struct { // DestroyCounter 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 { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'DestroyCounter' 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} @@ -991,6 +1012,9 @@ func DestroyCounter(c *xgb.Conn, Counter Counter) DestroyCounterCookie { // 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 'DestroyCounter' 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} @@ -1032,6 +1056,9 @@ type QueryCounterCookie struct { // 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} @@ -1040,6 +1067,9 @@ func QueryCounter(c *xgb.Conn, Counter Counter) QueryCounterCookie { // QueryCounterUnchecked 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 { + 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(false, true) c.NewRequest(queryCounterRequest(c, Counter), cookie) return QueryCounterCookie{cookie} @@ -1114,6 +1144,9 @@ type AwaitCookie struct { // 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.") + } cookie := c.NewCookie(false, false) c.NewRequest(awaitRequest(c, WaitList), cookie) return AwaitCookie{cookie} @@ -1122,6 +1155,9 @@ func Await(c *xgb.Conn, WaitList []Waitcondition) AwaitCookie { // 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} @@ -1162,6 +1198,9 @@ type ChangeCounterCookie struct { // ChangeCounter 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 { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'ChangeCounter' 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} @@ -1170,6 +1209,9 @@ func ChangeCounter(c *xgb.Conn, Counter Counter, Amount Int64) ChangeCounterCook // 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.") + } cookie := c.NewCookie(true, false) c.NewRequest(changeCounterRequest(c, Counter, Amount), cookie) return ChangeCounterCookie{cookie} @@ -1217,6 +1259,9 @@ type SetCounterCookie struct { // 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 { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'SetCounter' 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} @@ -1225,6 +1270,9 @@ func SetCounter(c *xgb.Conn, Counter Counter, Value Int64) SetCounterCookie { // 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 'SetCounter' 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} @@ -1272,6 +1320,9 @@ type CreateAlarmCookie struct { // 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 { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'CreateAlarm' 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} @@ -1280,6 +1331,9 @@ func CreateAlarm(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) Cr // 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.") + } cookie := c.NewCookie(true, false) c.NewRequest(createAlarmRequest(c, Id, ValueMask, ValueList), cookie) return CreateAlarmCookie{cookie} @@ -1329,6 +1383,9 @@ type ChangeAlarmCookie struct { // 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} @@ -1337,6 +1394,9 @@ func ChangeAlarm(c *xgb.Conn, Id Alarm, ValueMask uint32, ValueList []uint32) Ch // 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} @@ -1386,6 +1446,9 @@ type DestroyAlarmCookie struct { // 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} @@ -1394,6 +1457,9 @@ func DestroyAlarm(c *xgb.Conn, Alarm Alarm) DestroyAlarmCookie { // 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} @@ -1435,6 +1501,9 @@ type QueryAlarmCookie struct { // QueryAlarm sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryAlarmCookie.Reply() func QueryAlarm(c *xgb.Conn, Alarm Alarm) QueryAlarmCookie { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'QueryAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryAlarmRequest(c, Alarm), cookie) return QueryAlarmCookie{cookie} @@ -1443,6 +1512,9 @@ func QueryAlarm(c *xgb.Conn, Alarm Alarm) QueryAlarmCookie { // QueryAlarmUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryAlarmUnchecked(c *xgb.Conn, Alarm Alarm) QueryAlarmCookie { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'QueryAlarm' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryAlarmRequest(c, Alarm), cookie) return QueryAlarmCookie{cookie} @@ -1536,6 +1608,9 @@ type SetPriorityCookie struct { // 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} @@ -1544,6 +1619,9 @@ func SetPriority(c *xgb.Conn, Id uint32, Priority int32) SetPriorityCookie { // 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} @@ -1588,6 +1666,9 @@ type GetPriorityCookie struct { // 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 'GetPriority' 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} @@ -1596,6 +1677,9 @@ func GetPriority(c *xgb.Conn, Id uint32) GetPriorityCookie { // 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 'GetPriority' 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} @@ -1670,6 +1754,9 @@ type CreateFenceCookie struct { // 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 { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'CreateFence' 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} @@ -1678,6 +1765,9 @@ func CreateFence(c *xgb.Conn, Drawable xproto.Drawable, Fence Fence, InitiallyTr // 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 'CreateFence' 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} @@ -1729,6 +1819,9 @@ type TriggerFenceCookie struct { // 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} @@ -1737,6 +1830,9 @@ func TriggerFence(c *xgb.Conn, Fence Fence) TriggerFenceCookie { // 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} @@ -1778,6 +1874,9 @@ type ResetFenceCookie struct { // ResetFence sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ResetFence(c *xgb.Conn, Fence Fence) ResetFenceCookie { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'ResetFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(resetFenceRequest(c, Fence), cookie) return ResetFenceCookie{cookie} @@ -1786,6 +1885,9 @@ func ResetFence(c *xgb.Conn, Fence Fence) ResetFenceCookie { // ResetFenceChecked sends a checked request. // If an error occurs, it can be retrieved using ResetFenceCookie.Check() func ResetFenceChecked(c *xgb.Conn, Fence Fence) ResetFenceCookie { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'ResetFence' using the uninitialized extension 'SYNC'. sync.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(resetFenceRequest(c, Fence), cookie) return ResetFenceCookie{cookie} @@ -1827,6 +1929,9 @@ type DestroyFenceCookie struct { // DestroyFence 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 { + if _, ok := c.Extensions["SYNC"]; !ok { + panic("Cannot issue request 'DestroyFence' 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} @@ -1835,6 +1940,9 @@ func DestroyFence(c *xgb.Conn, Fence Fence) DestroyFenceCookie { // 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 'DestroyFence' 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} @@ -1876,6 +1984,9 @@ type QueryFenceCookie struct { // 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} @@ -1884,6 +1995,9 @@ func QueryFence(c *xgb.Conn, Fence Fence) QueryFenceCookie { // 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 'QueryFence' 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} @@ -1965,6 +2079,9 @@ type AwaitFenceCookie struct { // 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} @@ -1973,6 +2090,9 @@ func AwaitFence(c *xgb.Conn, FenceList []Fence) AwaitFenceCookie { // 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} -- cgit v1.2.3