From becaf43dcb3e9832c3eb951ff9908ed697868152 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Tue, 1 Mar 2016 15:41:38 +0100 Subject: Read/Write mutex for Extensions map --- nexgb/bigreq/bigreq.go | 11 +- nexgb/composite/composite.go | 59 +++- nexgb/damage/damage.go | 35 ++- nexgb/dpms/dpms.go | 53 +++- nexgb/dri2/dri2.go | 89 +++++- nexgb/ge/ge.go | 11 +- nexgb/glx/glx.go | 605 ++++++++++++++++++++++++++++++++++++++- nexgb/randr/randr.go | 245 +++++++++++++++- nexgb/record/record.go | 53 +++- nexgb/render/render.go | 191 +++++++++++- nexgb/res/res.go | 41 ++- nexgb/screensaver/screensaver.go | 41 ++- nexgb/shape/shape.go | 59 +++- nexgb/shm/shm.go | 53 +++- nexgb/xcmisc/xcmisc.go | 23 +- nexgb/xevie/xevie.go | 35 ++- nexgb/xf86dri/xf86dri.go | 77 ++++- nexgb/xf86vidmode/xf86vidmode.go | 131 ++++++++- nexgb/xfixes/xfixes.go | 211 +++++++++++++- nexgb/xgb.go | 10 +- nexgb/xgbgen/context.go | 5 +- nexgb/xgbgen/go_request_reply.go | 4 + nexgb/xinerama/xinerama.go | 41 ++- nexgb/xprint/xprint.go | 164 ++++++++++- nexgb/xproto/xproto.go | 16 +- nexgb/xselinux/xselinux.go | 143 ++++++++- nexgb/xtest/xtest.go | 29 +- nexgb/xv/xv.go | 135 ++++++++- nexgb/xvmc/xvmc.go | 59 +++- 29 files changed, 2526 insertions(+), 103 deletions(-) diff --git a/nexgb/bigreq/bigreq.go b/nexgb/bigreq/bigreq.go index d2adcc7..6590376 100644 --- a/nexgb/bigreq/bigreq.go +++ b/nexgb/bigreq/bigreq.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named BIG-REQUESTS could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["BIG-REQUESTS"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["BIG-REQUESTS"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["BIG-REQUESTS"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -69,6 +68,8 @@ type EnableCookie struct { // Enable sends a checked request. // If an error occurs, it will be returned with the reply by calling EnableCookie.Reply() func Enable(c *xgb.Conn) EnableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["BIG-REQUESTS"]; !ok { panic("Cannot issue request 'Enable' using the uninitialized extension 'BIG-REQUESTS'. bigreq.Init(connObj) must be called first.") } @@ -80,6 +81,8 @@ func Enable(c *xgb.Conn) EnableCookie { // EnableUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func EnableUnchecked(c *xgb.Conn) EnableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["BIG-REQUESTS"]; !ok { panic("Cannot issue request 'Enable' using the uninitialized extension 'BIG-REQUESTS'. bigreq.Init(connObj) must be called first.") } @@ -134,7 +137,9 @@ func enableRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["BIG-REQUESTS"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index b7ce2ad..1373f8b 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -20,16 +20,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named Composite could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["Composite"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["Composite"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["Composite"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -75,6 +74,8 @@ type CreateRegionFromBorderClipCookie struct { // CreateRegionFromBorderClip sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegionFromBorderClip(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) CreateRegionFromBorderClipCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -86,6 +87,8 @@ func CreateRegionFromBorderClip(c *xgb.Conn, Region xfixes.Region, Window xproto // CreateRegionFromBorderClipChecked sends a checked request. // If an error occurs, it can be retrieved using CreateRegionFromBorderClipCookie.Check() func CreateRegionFromBorderClipChecked(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) CreateRegionFromBorderClipCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -107,7 +110,9 @@ func createRegionFromBorderClipRequest(c *xgb.Conn, Region xfixes.Region, Window b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -133,6 +138,8 @@ type GetOverlayWindowCookie struct { // GetOverlayWindow sends a checked request. // If an error occurs, it will be returned with the reply by calling GetOverlayWindowCookie.Reply() func GetOverlayWindow(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -144,6 +151,8 @@ func GetOverlayWindow(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie // GetOverlayWindowUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetOverlayWindowUnchecked(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -201,7 +210,9 @@ func getOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -224,6 +235,8 @@ type NameWindowPixmapCookie struct { // NameWindowPixmap sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func NameWindowPixmap(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) NameWindowPixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -235,6 +248,8 @@ func NameWindowPixmap(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) N // NameWindowPixmapChecked sends a checked request. // If an error occurs, it can be retrieved using NameWindowPixmapCookie.Check() func NameWindowPixmapChecked(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) NameWindowPixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -256,7 +271,9 @@ func nameWindowPixmapRequest(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pi b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -282,6 +299,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -293,6 +312,8 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uin // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -354,7 +375,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -380,6 +403,8 @@ type RedirectSubwindowsCookie struct { // RedirectSubwindows sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RedirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) RedirectSubwindowsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -391,6 +416,8 @@ func RedirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) Redirect // RedirectSubwindowsChecked sends a checked request. // If an error occurs, it can be retrieved using RedirectSubwindowsCookie.Check() func RedirectSubwindowsChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectSubwindowsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -412,7 +439,9 @@ func redirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) [ b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -440,6 +469,8 @@ type RedirectWindowCookie struct { // RedirectWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -451,6 +482,8 @@ func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWind // RedirectWindowChecked sends a checked request. // If an error occurs, it can be retrieved using RedirectWindowCookie.Check() func RedirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -472,7 +505,9 @@ func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byt b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -500,6 +535,8 @@ type ReleaseOverlayWindowCookie struct { // ReleaseOverlayWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ReleaseOverlayWindow(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -511,6 +548,8 @@ func ReleaseOverlayWindow(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindo // ReleaseOverlayWindowChecked sends a checked request. // If an error occurs, it can be retrieved using ReleaseOverlayWindowCookie.Check() func ReleaseOverlayWindowChecked(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -532,7 +571,9 @@ func releaseOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -555,6 +596,8 @@ type UnredirectSubwindowsCookie struct { // UnredirectSubwindows sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnredirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectSubwindowsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -566,6 +609,8 @@ func UnredirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) Unredi // UnredirectSubwindowsChecked sends a checked request. // If an error occurs, it can be retrieved using UnredirectSubwindowsCookie.Check() func UnredirectSubwindowsChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectSubwindowsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -587,7 +632,9 @@ func unredirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -615,6 +662,8 @@ type UnredirectWindowCookie struct { // UnredirectWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -626,6 +675,8 @@ func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) Unredirect // UnredirectWindowChecked sends a checked request. // If an error occurs, it can be retrieved using UnredirectWindowCookie.Check() func UnredirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -647,7 +698,9 @@ func unredirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []b b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode diff --git a/nexgb/damage/damage.go b/nexgb/damage/damage.go index e94936d..26eca04 100644 --- a/nexgb/damage/damage.go +++ b/nexgb/damage/damage.go @@ -20,16 +20,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named DAMAGE could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["DAMAGE"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["DAMAGE"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["DAMAGE"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -235,6 +234,8 @@ type AddCookie struct { // Add sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Add(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) AddCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'Add' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -246,6 +247,8 @@ func Add(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) AddCookie // AddChecked sends a checked request. // If an error occurs, it can be retrieved using AddCookie.Check() func AddChecked(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) AddCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'Add' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -267,7 +270,9 @@ func addRequest(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) []b b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DAMAGE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -293,6 +298,8 @@ type CreateCookie struct { // Create sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Create(c *xgb.Conn, Damage Damage, Drawable xproto.Drawable, Level byte) CreateCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'Create' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -304,6 +311,8 @@ func Create(c *xgb.Conn, Damage Damage, Drawable xproto.Drawable, Level byte) Cr // CreateChecked sends a checked request. // If an error occurs, it can be retrieved using CreateCookie.Check() func CreateChecked(c *xgb.Conn, Damage Damage, Drawable xproto.Drawable, Level byte) CreateCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'Create' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -325,7 +334,9 @@ func createRequest(c *xgb.Conn, Damage Damage, Drawable xproto.Drawable, Level b b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DAMAGE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -356,6 +367,8 @@ type DestroyCookie struct { // Destroy sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Destroy(c *xgb.Conn, Damage Damage) DestroyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'Destroy' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -367,6 +380,8 @@ func Destroy(c *xgb.Conn, Damage Damage) DestroyCookie { // DestroyChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyCookie.Check() func DestroyChecked(c *xgb.Conn, Damage Damage) DestroyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'Destroy' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -388,7 +403,9 @@ func destroyRequest(c *xgb.Conn, Damage Damage) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DAMAGE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -411,6 +428,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -422,6 +441,8 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uin // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -483,7 +504,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DAMAGE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -509,6 +532,8 @@ type SubtractCookie struct { // Subtract sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Subtract(c *xgb.Conn, Damage Damage, Repair xfixes.Region, Parts xfixes.Region) SubtractCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'Subtract' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -520,6 +545,8 @@ func Subtract(c *xgb.Conn, Damage Damage, Repair xfixes.Region, Parts xfixes.Reg // SubtractChecked sends a checked request. // If an error occurs, it can be retrieved using SubtractCookie.Check() func SubtractChecked(c *xgb.Conn, Damage Damage, Repair xfixes.Region, Parts xfixes.Region) SubtractCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DAMAGE"]; !ok { panic("Cannot issue request 'Subtract' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.") } @@ -541,7 +568,9 @@ func subtractRequest(c *xgb.Conn, Damage Damage, Repair xfixes.Region, Parts xfi b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DAMAGE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode diff --git a/nexgb/dpms/dpms.go b/nexgb/dpms/dpms.go index 75ec85d..4bf5883 100644 --- a/nexgb/dpms/dpms.go +++ b/nexgb/dpms/dpms.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named DPMS could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["DPMS"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["DPMS"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["DPMS"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -76,6 +75,8 @@ type CapableCookie struct { // Capable sends a checked request. // If an error occurs, it will be returned with the reply by calling CapableCookie.Reply() func Capable(c *xgb.Conn) CapableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'Capable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -87,6 +88,8 @@ func Capable(c *xgb.Conn) CapableCookie { // CapableUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CapableUnchecked(c *xgb.Conn) CapableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'Capable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -148,7 +151,9 @@ func capableRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DPMS"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -168,6 +173,8 @@ type DisableCookie struct { // Disable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Disable(c *xgb.Conn) DisableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'Disable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -179,6 +186,8 @@ func Disable(c *xgb.Conn) DisableCookie { // DisableChecked sends a checked request. // If an error occurs, it can be retrieved using DisableCookie.Check() func DisableChecked(c *xgb.Conn) DisableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'Disable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -200,7 +209,9 @@ func disableRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DPMS"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -220,6 +231,8 @@ type EnableCookie struct { // Enable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Enable(c *xgb.Conn) EnableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'Enable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -231,6 +244,8 @@ func Enable(c *xgb.Conn) EnableCookie { // EnableChecked sends a checked request. // If an error occurs, it can be retrieved using EnableCookie.Check() func EnableChecked(c *xgb.Conn) EnableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'Enable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -252,7 +267,9 @@ func enableRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DPMS"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -272,6 +289,8 @@ type ForceLevelCookie struct { // ForceLevel sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ForceLevel(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'ForceLevel' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -283,6 +302,8 @@ func ForceLevel(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie { // ForceLevelChecked sends a checked request. // If an error occurs, it can be retrieved using ForceLevelCookie.Check() func ForceLevelChecked(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'ForceLevel' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -304,7 +325,9 @@ func forceLevelRequest(c *xgb.Conn, PowerLevel uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DPMS"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -327,6 +350,8 @@ type GetTimeoutsCookie struct { // GetTimeouts sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTimeoutsCookie.Reply() func GetTimeouts(c *xgb.Conn) GetTimeoutsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'GetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -338,6 +363,8 @@ func GetTimeouts(c *xgb.Conn) GetTimeoutsCookie { // GetTimeoutsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTimeoutsUnchecked(c *xgb.Conn) GetTimeoutsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'GetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -403,7 +430,9 @@ func getTimeoutsRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DPMS"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -423,6 +452,8 @@ type GetVersionCookie struct { // GetVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling GetVersionCookie.Reply() func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'GetVersion' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -434,6 +465,8 @@ func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint1 // GetVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'GetVersion' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -492,7 +525,9 @@ func getVersionRequest(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersio b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DPMS"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -518,6 +553,8 @@ type InfoCookie struct { // Info sends a checked request. // If an error occurs, it will be returned with the reply by calling InfoCookie.Reply() func Info(c *xgb.Conn) InfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'Info' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -529,6 +566,8 @@ func Info(c *xgb.Conn) InfoCookie { // InfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func InfoUnchecked(c *xgb.Conn) InfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'Info' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -594,7 +633,9 @@ func infoRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DPMS"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -614,6 +655,8 @@ type SetTimeoutsCookie struct { // SetTimeouts sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetTimeouts(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) SetTimeoutsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'SetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -625,6 +668,8 @@ func SetTimeouts(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffT // SetTimeoutsChecked sends a checked request. // If an error occurs, it can be retrieved using SetTimeoutsCookie.Check() func SetTimeoutsChecked(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) SetTimeoutsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DPMS"]; !ok { panic("Cannot issue request 'SetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") } @@ -646,7 +691,9 @@ func setTimeoutsRequest(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint1 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DPMS"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode diff --git a/nexgb/dri2/dri2.go b/nexgb/dri2/dri2.go index 5ad0306..820cf2b 100644 --- a/nexgb/dri2/dri2.go +++ b/nexgb/dri2/dri2.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named DRI2 could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["DRI2"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["DRI2"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["DRI2"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -402,6 +401,8 @@ type AuthenticateCookie struct { // Authenticate sends a checked request. // If an error occurs, it will be returned with the reply by calling AuthenticateCookie.Reply() func Authenticate(c *xgb.Conn, Window xproto.Window, Magic uint32) AuthenticateCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'Authenticate' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -413,6 +414,8 @@ func Authenticate(c *xgb.Conn, Window xproto.Window, Magic uint32) AuthenticateC // AuthenticateUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AuthenticateUnchecked(c *xgb.Conn, Window xproto.Window, Magic uint32) AuthenticateCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'Authenticate' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -467,7 +470,9 @@ func authenticateRequest(c *xgb.Conn, Window xproto.Window, Magic uint32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -493,6 +498,8 @@ type ConnectCookie struct { // Connect sends a checked request. // If an error occurs, it will be returned with the reply by calling ConnectCookie.Reply() func Connect(c *xgb.Conn, Window xproto.Window, DriverType uint32) ConnectCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'Connect' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -504,6 +511,8 @@ func Connect(c *xgb.Conn, Window xproto.Window, DriverType uint32) ConnectCookie // ConnectUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ConnectUnchecked(c *xgb.Conn, Window xproto.Window, DriverType uint32) ConnectCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'Connect' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -586,7 +595,9 @@ func connectRequest(c *xgb.Conn, Window xproto.Window, DriverType uint32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -612,6 +623,8 @@ type CopyRegionCookie struct { // CopyRegion sends a checked request. // If an error occurs, it will be returned with the reply by calling CopyRegionCookie.Reply() func CopyRegion(c *xgb.Conn, Drawable xproto.Drawable, Region uint32, Dest uint32, Src uint32) CopyRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'CopyRegion' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -623,6 +636,8 @@ func CopyRegion(c *xgb.Conn, Drawable xproto.Drawable, Region uint32, Dest uint3 // CopyRegionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CopyRegionUnchecked(c *xgb.Conn, Drawable xproto.Drawable, Region uint32, Dest uint32, Src uint32) CopyRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'CopyRegion' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -673,7 +688,9 @@ func copyRegionRequest(c *xgb.Conn, Drawable xproto.Drawable, Region uint32, Des b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -705,6 +722,8 @@ type CreateDrawableCookie struct { // CreateDrawable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateDrawable(c *xgb.Conn, Drawable xproto.Drawable) CreateDrawableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'CreateDrawable' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -716,6 +735,8 @@ func CreateDrawable(c *xgb.Conn, Drawable xproto.Drawable) CreateDrawableCookie // CreateDrawableChecked sends a checked request. // If an error occurs, it can be retrieved using CreateDrawableCookie.Check() func CreateDrawableChecked(c *xgb.Conn, Drawable xproto.Drawable) CreateDrawableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'CreateDrawable' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -737,7 +758,9 @@ func createDrawableRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -760,6 +783,8 @@ type DestroyDrawableCookie struct { // DestroyDrawable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyDrawable(c *xgb.Conn, Drawable xproto.Drawable) DestroyDrawableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'DestroyDrawable' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -771,6 +796,8 @@ func DestroyDrawable(c *xgb.Conn, Drawable xproto.Drawable) DestroyDrawableCooki // DestroyDrawableChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyDrawableCookie.Check() func DestroyDrawableChecked(c *xgb.Conn, Drawable xproto.Drawable) DestroyDrawableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'DestroyDrawable' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -792,7 +819,9 @@ func destroyDrawableRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -815,6 +844,8 @@ type GetBuffersCookie struct { // GetBuffers sends a checked request. // If an error occurs, it will be returned with the reply by calling GetBuffersCookie.Reply() func GetBuffers(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []uint32) GetBuffersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'GetBuffers' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -826,6 +857,8 @@ func GetBuffers(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments // GetBuffersUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetBuffersUnchecked(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []uint32) GetBuffersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'GetBuffers' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -895,7 +928,9 @@ func getBuffersRequest(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Atta b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -926,6 +961,8 @@ type GetBuffersWithFormatCookie struct { // GetBuffersWithFormat sends a checked request. // If an error occurs, it will be returned with the reply by calling GetBuffersWithFormatCookie.Reply() func GetBuffersWithFormat(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []AttachFormat) GetBuffersWithFormatCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'GetBuffersWithFormat' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -937,6 +974,8 @@ func GetBuffersWithFormat(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, A // GetBuffersWithFormatUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetBuffersWithFormatUnchecked(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []AttachFormat) GetBuffersWithFormatCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'GetBuffersWithFormat' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1006,7 +1045,9 @@ func getBuffersWithFormatRequest(c *xgb.Conn, Drawable xproto.Drawable, Count ui b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -1034,6 +1075,8 @@ type GetMSCCookie struct { // GetMSC sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMSCCookie.Reply() func GetMSC(c *xgb.Conn, Drawable xproto.Drawable) GetMSCCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'GetMSC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1045,6 +1088,8 @@ func GetMSC(c *xgb.Conn, Drawable xproto.Drawable) GetMSCCookie { // GetMSCUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMSCUnchecked(c *xgb.Conn, Drawable xproto.Drawable) GetMSCCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'GetMSC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1119,7 +1164,9 @@ func getMSCRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 9 // request opcode @@ -1142,6 +1189,8 @@ type GetParamCookie struct { // GetParam sends a checked request. // If an error occurs, it will be returned with the reply by calling GetParamCookie.Reply() func GetParam(c *xgb.Conn, Drawable xproto.Drawable, Param uint32) GetParamCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'GetParam' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1153,6 +1202,8 @@ func GetParam(c *xgb.Conn, Drawable xproto.Drawable, Param uint32) GetParamCooki // GetParamUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetParamUnchecked(c *xgb.Conn, Drawable xproto.Drawable, Param uint32) GetParamCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'GetParam' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1216,7 +1267,9 @@ func getParamRequest(c *xgb.Conn, Drawable xproto.Drawable, Param uint32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode @@ -1242,6 +1295,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1253,6 +1308,8 @@ func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVe // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1311,7 +1368,9 @@ func queryVersionRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -1337,6 +1396,8 @@ type SwapBuffersCookie struct { // SwapBuffers sends a checked request. // If an error occurs, it will be returned with the reply by calling SwapBuffersCookie.Reply() func SwapBuffers(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) SwapBuffersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1348,6 +1409,8 @@ func SwapBuffers(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, Targ // SwapBuffersUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SwapBuffersUnchecked(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) SwapBuffersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1406,7 +1469,9 @@ func swapBuffersRequest(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint3 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -1447,6 +1512,8 @@ type SwapIntervalCookie struct { // SwapInterval sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SwapInterval(c *xgb.Conn, Drawable xproto.Drawable, Interval uint32) SwapIntervalCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'SwapInterval' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1458,6 +1525,8 @@ func SwapInterval(c *xgb.Conn, Drawable xproto.Drawable, Interval uint32) SwapIn // SwapIntervalChecked sends a checked request. // If an error occurs, it can be retrieved using SwapIntervalCookie.Check() func SwapIntervalChecked(c *xgb.Conn, Drawable xproto.Drawable, Interval uint32) SwapIntervalCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'SwapInterval' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1479,7 +1548,9 @@ func swapIntervalRequest(c *xgb.Conn, Drawable xproto.Drawable, Interval uint32) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -1505,6 +1576,8 @@ type WaitMSCCookie struct { // WaitMSC sends a checked request. // If an error occurs, it will be returned with the reply by calling WaitMSCCookie.Reply() func WaitMSC(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) WaitMSCCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'WaitMSC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1516,6 +1589,8 @@ func WaitMSC(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMs // WaitMSCUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func WaitMSCUnchecked(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) WaitMSCCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'WaitMSC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1590,7 +1665,9 @@ func waitMSCRequest(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, T b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -1631,6 +1708,8 @@ type WaitSBCCookie struct { // WaitSBC sends a checked request. // If an error occurs, it will be returned with the reply by calling WaitSBCCookie.Reply() func WaitSBC(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSbcLo uint32) WaitSBCCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'WaitSBC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1642,6 +1721,8 @@ func WaitSBC(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSb // WaitSBCUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func WaitSBCUnchecked(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSbcLo uint32) WaitSBCCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["DRI2"]; !ok { panic("Cannot issue request 'WaitSBC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") } @@ -1716,7 +1797,9 @@ func waitSBCRequest(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, T b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["DRI2"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode diff --git a/nexgb/ge/ge.go b/nexgb/ge/ge.go index 68213bc..f7e1ce4 100644 --- a/nexgb/ge/ge.go +++ b/nexgb/ge/ge.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named Generic Event Extension could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["Generic Event Extension"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["Generic Event Extension"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["Generic Event Extension"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -69,6 +68,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Generic Event Extension"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Generic Event Extension'. ge.Init(connObj) must be called first.") } @@ -80,6 +81,8 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uin // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Generic Event Extension"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Generic Event Extension'. ge.Init(connObj) must be called first.") } @@ -141,7 +144,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVers b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Generic Event Extension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode diff --git a/nexgb/glx/glx.go b/nexgb/glx/glx.go index 0951765..cf72d9a 100644 --- a/nexgb/glx/glx.go +++ b/nexgb/glx/glx.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named GLX could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["GLX"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["GLX"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["GLX"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -1029,6 +1028,8 @@ type AreTexturesResidentCookie struct { // AreTexturesResident sends a checked request. // If an error occurs, it will be returned with the reply by calling AreTexturesResidentCookie.Reply() func AreTexturesResident(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) AreTexturesResidentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1040,6 +1041,8 @@ func AreTexturesResident(c *xgb.Conn, ContextTag ContextTag, N int32, Textures [ // AreTexturesResidentUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AreTexturesResidentUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) AreTexturesResidentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1108,7 +1111,9 @@ func areTexturesResidentRequest(c *xgb.Conn, ContextTag ContextTag, N int32, Tex b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 143 // request opcode @@ -1139,6 +1144,8 @@ type ChangeDrawableAttributesCookie struct { // ChangeDrawableAttributes sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangeDrawableAttributes(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) ChangeDrawableAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1150,6 +1157,8 @@ func ChangeDrawableAttributes(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, // ChangeDrawableAttributesChecked sends a checked request. // If an error occurs, it can be retrieved using ChangeDrawableAttributesCookie.Check() func ChangeDrawableAttributesChecked(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) ChangeDrawableAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1171,7 +1180,9 @@ func changeDrawableAttributesRequest(c *xgb.Conn, Drawable Drawable, NumAttribs b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 30 // request opcode @@ -1202,6 +1213,8 @@ type ClientInfoCookie struct { // ClientInfo sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ClientInfo(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) ClientInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'ClientInfo' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1213,6 +1226,8 @@ func ClientInfo(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen ui // ClientInfoChecked sends a checked request. // If an error occurs, it can be retrieved using ClientInfoCookie.Check() func ClientInfoChecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) ClientInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'ClientInfo' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1234,7 +1249,9 @@ func clientInfoRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, St b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 20 // request opcode @@ -1266,6 +1283,8 @@ type CopyContextCookie struct { // CopyContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CopyContext(c *xgb.Conn, Src Context, Dest Context, Mask uint32, SrcContextTag ContextTag) CopyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CopyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1277,6 +1296,8 @@ func CopyContext(c *xgb.Conn, Src Context, Dest Context, Mask uint32, SrcContext // CopyContextChecked sends a checked request. // If an error occurs, it can be retrieved using CopyContextCookie.Check() func CopyContextChecked(c *xgb.Conn, Src Context, Dest Context, Mask uint32, SrcContextTag ContextTag) CopyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CopyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1298,7 +1319,9 @@ func copyContextRequest(c *xgb.Conn, Src Context, Dest Context, Mask uint32, Src b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -1330,6 +1353,8 @@ type CreateContextCookie struct { // CreateContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContext(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen uint32, ShareList Context, IsDirect bool) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1341,6 +1366,8 @@ func CreateContext(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen // CreateContextChecked sends a checked request. // If an error occurs, it can be retrieved using CreateContextCookie.Check() func CreateContextChecked(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen uint32, ShareList Context, IsDirect bool) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1362,7 +1389,9 @@ func createContextRequest(c *xgb.Conn, Context Context, Visual xproto.Visualid, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -1403,6 +1432,8 @@ type CreateContextAttribsARBCookie struct { // CreateContextAttribsARB sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContextAttribsARB(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) CreateContextAttribsARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1414,6 +1445,8 @@ func CreateContextAttribsARB(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Sc // CreateContextAttribsARBChecked sends a checked request. // If an error occurs, it can be retrieved using CreateContextAttribsARBCookie.Check() func CreateContextAttribsARBChecked(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) CreateContextAttribsARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1435,7 +1468,9 @@ func createContextAttribsARBRequest(c *xgb.Conn, Context Context, Fbconfig Fbcon b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 34 // request opcode @@ -1484,6 +1519,8 @@ type CreateGLXPixmapCookie struct { // CreateGLXPixmap sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateGLXPixmap(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) CreateGLXPixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1495,6 +1532,8 @@ func CreateGLXPixmap(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap // CreateGLXPixmapChecked sends a checked request. // If an error occurs, it can be retrieved using CreateGLXPixmapCookie.Check() func CreateGLXPixmapChecked(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) CreateGLXPixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1516,7 +1555,9 @@ func createGLXPixmapRequest(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode @@ -1548,6 +1589,8 @@ type CreateNewContextCookie struct { // CreateNewContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateNewContext(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, RenderType uint32, ShareList Context, IsDirect bool) CreateNewContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1559,6 +1602,8 @@ func CreateNewContext(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen ui // CreateNewContextChecked sends a checked request. // If an error occurs, it can be retrieved using CreateNewContextCookie.Check() func CreateNewContextChecked(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, RenderType uint32, ShareList Context, IsDirect bool) CreateNewContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1580,7 +1625,9 @@ func createNewContextRequest(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Sc b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 24 // request opcode @@ -1624,6 +1671,8 @@ type CreatePbufferCookie struct { // CreatePbuffer sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreatePbuffer(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer Pbuffer, NumAttribs uint32, Attribs []uint32) CreatePbufferCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1635,6 +1684,8 @@ func CreatePbuffer(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer Pbuffe // CreatePbufferChecked sends a checked request. // If an error occurs, it can be retrieved using CreatePbufferCookie.Check() func CreatePbufferChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer Pbuffer, NumAttribs uint32, Attribs []uint32) CreatePbufferCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1656,7 +1707,9 @@ func createPbufferRequest(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 27 // request opcode @@ -1693,6 +1746,8 @@ type CreatePixmapCookie struct { // CreatePixmap sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreatePixmap(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) CreatePixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1704,6 +1759,8 @@ func CreatePixmap(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.P // CreatePixmapChecked sends a checked request. // If an error occurs, it can be retrieved using CreatePixmapCookie.Check() func CreatePixmapChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) CreatePixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1725,7 +1782,9 @@ func createPixmapRequest(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap x b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 22 // request opcode @@ -1765,6 +1824,8 @@ type CreateWindowCookie struct { // CreateWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateWindow(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window xproto.Window, GlxWindow Window, NumAttribs uint32, Attribs []uint32) CreateWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1776,6 +1837,8 @@ func CreateWindow(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window xproto.W // CreateWindowChecked sends a checked request. // If an error occurs, it can be retrieved using CreateWindowCookie.Check() func CreateWindowChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window xproto.Window, GlxWindow Window, NumAttribs uint32, Attribs []uint32) CreateWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'CreateWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1797,7 +1860,9 @@ func createWindowRequest(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window x b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 31 // request opcode @@ -1837,6 +1902,8 @@ type DeleteListsCookie struct { // DeleteLists sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeleteLists(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) DeleteListsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DeleteLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1848,6 +1915,8 @@ func DeleteLists(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) D // DeleteListsChecked sends a checked request. // If an error occurs, it can be retrieved using DeleteListsCookie.Check() func DeleteListsChecked(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) DeleteListsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DeleteLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1869,7 +1938,9 @@ func deleteListsRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Range i b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 103 // request opcode @@ -1898,6 +1969,8 @@ type DeleteQueriesARBCookie struct { // DeleteQueriesARB sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeleteQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) DeleteQueriesARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1909,6 +1982,8 @@ func DeleteQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) // DeleteQueriesARBChecked sends a checked request. // If an error occurs, it can be retrieved using DeleteQueriesARBCookie.Check() func DeleteQueriesARBChecked(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) DeleteQueriesARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1930,7 +2005,9 @@ func deleteQueriesARBRequest(c *xgb.Conn, ContextTag ContextTag, N int32, Ids [] b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 161 // request opcode @@ -1961,6 +2038,8 @@ type DeleteTexturesCookie struct { // DeleteTextures sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeleteTextures(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DeleteTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1972,6 +2051,8 @@ func DeleteTextures(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint // DeleteTexturesChecked sends a checked request. // If an error occurs, it can be retrieved using DeleteTexturesCookie.Check() func DeleteTexturesChecked(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DeleteTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -1993,7 +2074,9 @@ func deleteTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32, Textures b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 144 // request opcode @@ -2024,6 +2107,8 @@ type DeleteWindowCookie struct { // DeleteWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeleteWindow(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DeleteWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2035,6 +2120,8 @@ func DeleteWindow(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie { // DeleteWindowChecked sends a checked request. // If an error occurs, it can be retrieved using DeleteWindowCookie.Check() func DeleteWindowChecked(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DeleteWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2056,7 +2143,9 @@ func deleteWindowRequest(c *xgb.Conn, Glxwindow Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 32 // request opcode @@ -2079,6 +2168,8 @@ type DestroyContextCookie struct { // DestroyContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyContext(c *xgb.Conn, Context Context) DestroyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2090,6 +2181,8 @@ func DestroyContext(c *xgb.Conn, Context Context) DestroyContextCookie { // DestroyContextChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyContextCookie.Check() func DestroyContextChecked(c *xgb.Conn, Context Context) DestroyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2111,7 +2204,9 @@ func destroyContextRequest(c *xgb.Conn, Context Context) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -2134,6 +2229,8 @@ type DestroyGLXPixmapCookie struct { // DestroyGLXPixmap sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyGLXPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2145,6 +2242,8 @@ func DestroyGLXPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie { // DestroyGLXPixmapChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyGLXPixmapCookie.Check() func DestroyGLXPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2166,7 +2265,9 @@ func destroyGLXPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 15 // request opcode @@ -2189,6 +2290,8 @@ type DestroyPbufferCookie struct { // DestroyPbuffer sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyPbuffer(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DestroyPbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2200,6 +2303,8 @@ func DestroyPbuffer(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie { // DestroyPbufferChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyPbufferCookie.Check() func DestroyPbufferChecked(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DestroyPbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2221,7 +2326,9 @@ func destroyPbufferRequest(c *xgb.Conn, Pbuffer Pbuffer) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 28 // request opcode @@ -2244,6 +2351,8 @@ type DestroyPixmapCookie struct { // DestroyPixmap sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DestroyPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2255,6 +2364,8 @@ func DestroyPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie { // DestroyPixmapChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyPixmapCookie.Check() func DestroyPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'DestroyPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2276,7 +2387,9 @@ func destroyPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 23 // request opcode @@ -2299,6 +2412,8 @@ type EndListCookie struct { // EndList sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func EndList(c *xgb.Conn, ContextTag ContextTag) EndListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2310,6 +2425,8 @@ func EndList(c *xgb.Conn, ContextTag ContextTag) EndListCookie { // EndListChecked sends a checked request. // If an error occurs, it can be retrieved using EndListCookie.Check() func EndListChecked(c *xgb.Conn, ContextTag ContextTag) EndListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2331,7 +2448,9 @@ func endListRequest(c *xgb.Conn, ContextTag ContextTag) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 102 // request opcode @@ -2354,6 +2473,8 @@ type FeedbackBufferCookie struct { // FeedbackBuffer sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FeedbackBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32, Type int32) FeedbackBufferCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2365,6 +2486,8 @@ func FeedbackBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32, Type int32) // FeedbackBufferChecked sends a checked request. // If an error occurs, it can be retrieved using FeedbackBufferCookie.Check() func FeedbackBufferChecked(c *xgb.Conn, ContextTag ContextTag, Size int32, Type int32) FeedbackBufferCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2386,7 +2509,9 @@ func feedbackBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size int32, Type b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 105 // request opcode @@ -2415,6 +2540,8 @@ type FinishCookie struct { // Finish sends a checked request. // If an error occurs, it will be returned with the reply by calling FinishCookie.Reply() func Finish(c *xgb.Conn, ContextTag ContextTag) FinishCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2426,6 +2553,8 @@ func Finish(c *xgb.Conn, ContextTag ContextTag) FinishCookie { // FinishUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FinishUnchecked(c *xgb.Conn, ContextTag ContextTag) FinishCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2476,7 +2605,9 @@ func finishRequest(c *xgb.Conn, ContextTag ContextTag) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 108 // request opcode @@ -2499,6 +2630,8 @@ type FlushCookie struct { // Flush sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Flush(c *xgb.Conn, ContextTag ContextTag) FlushCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'Flush' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2510,6 +2643,8 @@ func Flush(c *xgb.Conn, ContextTag ContextTag) FlushCookie { // FlushChecked sends a checked request. // If an error occurs, it can be retrieved using FlushCookie.Check() func FlushChecked(c *xgb.Conn, ContextTag ContextTag) FlushCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'Flush' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2531,7 +2666,9 @@ func flushRequest(c *xgb.Conn, ContextTag ContextTag) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 142 // request opcode @@ -2554,6 +2691,8 @@ type GenListsCookie struct { // GenLists sends a checked request. // If an error occurs, it will be returned with the reply by calling GenListsCookie.Reply() func GenLists(c *xgb.Conn, ContextTag ContextTag, Range int32) GenListsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2565,6 +2704,8 @@ func GenLists(c *xgb.Conn, ContextTag ContextTag, Range int32) GenListsCookie { // GenListsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GenListsUnchecked(c *xgb.Conn, ContextTag ContextTag, Range int32) GenListsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2619,7 +2760,9 @@ func genListsRequest(c *xgb.Conn, ContextTag ContextTag, Range int32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 104 // request opcode @@ -2645,6 +2788,8 @@ type GenQueriesARBCookie struct { // GenQueriesARB sends a checked request. // If an error occurs, it will be returned with the reply by calling GenQueriesARBCookie.Reply() func GenQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32) GenQueriesARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GenQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2656,6 +2801,8 @@ func GenQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32) GenQueriesARBCoo // GenQueriesARBUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GenQueriesARBUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32) GenQueriesARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GenQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2716,7 +2863,9 @@ func genQueriesARBRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 162 // request opcode @@ -2742,6 +2891,8 @@ type GenTexturesCookie struct { // GenTextures sends a checked request. // If an error occurs, it will be returned with the reply by calling GenTexturesCookie.Reply() func GenTextures(c *xgb.Conn, ContextTag ContextTag, N int32) GenTexturesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2753,6 +2904,8 @@ func GenTextures(c *xgb.Conn, ContextTag ContextTag, N int32) GenTexturesCookie // GenTexturesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GenTexturesUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32) GenTexturesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2813,7 +2966,9 @@ func genTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 145 // request opcode @@ -2839,6 +2994,8 @@ type GetBooleanvCookie struct { // GetBooleanv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetBooleanvCookie.Reply() func GetBooleanv(c *xgb.Conn, ContextTag ContextTag, Pname int32) GetBooleanvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2850,6 +3007,8 @@ func GetBooleanv(c *xgb.Conn, ContextTag ContextTag, Pname int32) GetBooleanvCoo // GetBooleanvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetBooleanvUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname int32) GetBooleanvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2929,7 +3088,9 @@ func getBooleanvRequest(c *xgb.Conn, ContextTag ContextTag, Pname int32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 112 // request opcode @@ -2955,6 +3116,8 @@ type GetClipPlaneCookie struct { // GetClipPlane sends a checked request. // If an error occurs, it will be returned with the reply by calling GetClipPlaneCookie.Reply() func GetClipPlane(c *xgb.Conn, ContextTag ContextTag, Plane int32) GetClipPlaneCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -2966,6 +3129,8 @@ func GetClipPlane(c *xgb.Conn, ContextTag ContextTag, Plane int32) GetClipPlaneC // GetClipPlaneUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetClipPlaneUnchecked(c *xgb.Conn, ContextTag ContextTag, Plane int32) GetClipPlaneCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3026,7 +3191,9 @@ func getClipPlaneRequest(c *xgb.Conn, ContextTag ContextTag, Plane int32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 113 // request opcode @@ -3052,6 +3219,8 @@ type GetColorTableCookie struct { // GetColorTable sends a checked request. // If an error occurs, it will be returned with the reply by calling GetColorTableCookie.Reply() func GetColorTable(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetColorTableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3063,6 +3232,8 @@ func GetColorTable(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uin // GetColorTableUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetColorTableUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetColorTableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3128,7 +3299,9 @@ func getColorTableRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, For b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 147 // request opcode @@ -3167,6 +3340,8 @@ type GetColorTableParameterfvCookie struct { // GetColorTableParameterfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetColorTableParameterfvCookie.Reply() func GetColorTableParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3178,6 +3353,8 @@ func GetColorTableParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, // GetColorTableParameterfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetColorTableParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3249,7 +3426,9 @@ func getColorTableParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 148 // request opcode @@ -3278,6 +3457,8 @@ type GetColorTableParameterivCookie struct { // GetColorTableParameteriv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetColorTableParameterivCookie.Reply() func GetColorTableParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3289,6 +3470,8 @@ func GetColorTableParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, // GetColorTableParameterivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetColorTableParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3360,7 +3543,9 @@ func getColorTableParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 149 // request opcode @@ -3389,6 +3574,8 @@ type GetCompressedTexImageARBCookie struct { // GetCompressedTexImageARB sends a checked request. // If an error occurs, it will be returned with the reply by calling GetCompressedTexImageARBCookie.Reply() func GetCompressedTexImageARB(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) GetCompressedTexImageARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetCompressedTexImageARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3400,6 +3587,8 @@ func GetCompressedTexImageARB(c *xgb.Conn, ContextTag ContextTag, Target uint32, // GetCompressedTexImageARBUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCompressedTexImageARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) GetCompressedTexImageARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetCompressedTexImageARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3465,7 +3654,9 @@ func getCompressedTexImageARBRequest(c *xgb.Conn, ContextTag ContextTag, Target b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 160 // request opcode @@ -3494,6 +3685,8 @@ type GetConvolutionFilterCookie struct { // GetConvolutionFilter sends a checked request. // If an error occurs, it will be returned with the reply by calling GetConvolutionFilterCookie.Reply() func GetConvolutionFilter(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetConvolutionFilterCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetConvolutionFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3505,6 +3698,8 @@ func GetConvolutionFilter(c *xgb.Conn, ContextTag ContextTag, Target uint32, For // GetConvolutionFilterUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetConvolutionFilterUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetConvolutionFilterCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetConvolutionFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3574,7 +3769,9 @@ func getConvolutionFilterRequest(c *xgb.Conn, ContextTag ContextTag, Target uint b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 150 // request opcode @@ -3613,6 +3810,8 @@ type GetConvolutionParameterfvCookie struct { // GetConvolutionParameterfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetConvolutionParameterfvCookie.Reply() func GetConvolutionParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetConvolutionParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3624,6 +3823,8 @@ func GetConvolutionParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32 // GetConvolutionParameterfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetConvolutionParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetConvolutionParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3695,7 +3896,9 @@ func getConvolutionParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 151 // request opcode @@ -3724,6 +3927,8 @@ type GetConvolutionParameterivCookie struct { // GetConvolutionParameteriv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetConvolutionParameterivCookie.Reply() func GetConvolutionParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetConvolutionParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3735,6 +3940,8 @@ func GetConvolutionParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32 // GetConvolutionParameterivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetConvolutionParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetConvolutionParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3806,7 +4013,9 @@ func getConvolutionParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 152 // request opcode @@ -3835,6 +4044,8 @@ type GetDoublevCookie struct { // GetDoublev sends a checked request. // If an error occurs, it will be returned with the reply by calling GetDoublevCookie.Reply() func GetDoublev(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetDoublevCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetDoublev' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3846,6 +4057,8 @@ func GetDoublev(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetDoublevCook // GetDoublevUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDoublevUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetDoublevCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetDoublev' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3917,7 +4130,9 @@ func getDoublevRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 114 // request opcode @@ -3943,6 +4158,8 @@ type GetDrawableAttributesCookie struct { // GetDrawableAttributes sends a checked request. // If an error occurs, it will be returned with the reply by calling GetDrawableAttributesCookie.Reply() func GetDrawableAttributes(c *xgb.Conn, Drawable Drawable) GetDrawableAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -3954,6 +4171,8 @@ func GetDrawableAttributes(c *xgb.Conn, Drawable Drawable) GetDrawableAttributes // GetDrawableAttributesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDrawableAttributesUnchecked(c *xgb.Conn, Drawable Drawable) GetDrawableAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4018,7 +4237,9 @@ func getDrawableAttributesRequest(c *xgb.Conn, Drawable Drawable) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 29 // request opcode @@ -4041,6 +4262,8 @@ type GetErrorCookie struct { // GetError sends a checked request. // If an error occurs, it will be returned with the reply by calling GetErrorCookie.Reply() func GetError(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4052,6 +4275,8 @@ func GetError(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie { // GetErrorUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetErrorUnchecked(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4106,7 +4331,9 @@ func getErrorRequest(c *xgb.Conn, ContextTag ContextTag) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 115 // request opcode @@ -4129,6 +4356,8 @@ type GetFBConfigsCookie struct { // GetFBConfigs sends a checked request. // If an error occurs, it will be returned with the reply by calling GetFBConfigsCookie.Reply() func GetFBConfigs(c *xgb.Conn, Screen uint32) GetFBConfigsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4140,6 +4369,8 @@ func GetFBConfigs(c *xgb.Conn, Screen uint32) GetFBConfigsCookie { // GetFBConfigsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetFBConfigsUnchecked(c *xgb.Conn, Screen uint32) GetFBConfigsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4208,7 +4439,9 @@ func getFBConfigsRequest(c *xgb.Conn, Screen uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 21 // request opcode @@ -4231,6 +4464,8 @@ type GetFloatvCookie struct { // GetFloatv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetFloatvCookie.Reply() func GetFloatv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4242,6 +4477,8 @@ func GetFloatv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie // GetFloatvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetFloatvUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4313,7 +4550,9 @@ func getFloatvRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 116 // request opcode @@ -4339,6 +4578,8 @@ type GetHistogramCookie struct { // GetHistogram sends a checked request. // If an error occurs, it will be returned with the reply by calling GetHistogramCookie.Reply() func GetHistogram(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetHistogramCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4350,6 +4591,8 @@ func GetHistogram(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint // GetHistogramUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetHistogramUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetHistogramCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4415,7 +4658,9 @@ func getHistogramRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Form b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 154 // request opcode @@ -4461,6 +4706,8 @@ type GetHistogramParameterfvCookie struct { // GetHistogramParameterfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetHistogramParameterfvCookie.Reply() func GetHistogramParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4472,6 +4719,8 @@ func GetHistogramParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, // GetHistogramParameterfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetHistogramParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4543,7 +4792,9 @@ func getHistogramParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target u b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 155 // request opcode @@ -4572,6 +4823,8 @@ type GetHistogramParameterivCookie struct { // GetHistogramParameteriv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetHistogramParameterivCookie.Reply() func GetHistogramParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4583,6 +4836,8 @@ func GetHistogramParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, // GetHistogramParameterivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetHistogramParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4654,7 +4909,9 @@ func getHistogramParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target u b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 156 // request opcode @@ -4683,6 +4940,8 @@ type GetIntegervCookie struct { // GetIntegerv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetIntegervCookie.Reply() func GetIntegerv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetIntegervCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetIntegerv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4694,6 +4953,8 @@ func GetIntegerv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetIntegervCo // GetIntegervUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetIntegervUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetIntegervCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetIntegerv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4765,7 +5026,9 @@ func getIntegervRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 117 // request opcode @@ -4791,6 +5054,8 @@ type GetLightfvCookie struct { // GetLightfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetLightfvCookie.Reply() func GetLightfv(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetLightfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4802,6 +5067,8 @@ func GetLightfv(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) // GetLightfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetLightfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetLightfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4873,7 +5140,9 @@ func getLightfvRequest(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname u b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 118 // request opcode @@ -4902,6 +5171,8 @@ type GetLightivCookie struct { // GetLightiv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetLightivCookie.Reply() func GetLightiv(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetLightiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4913,6 +5184,8 @@ func GetLightiv(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) // GetLightivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetLightivUnchecked(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetLightiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -4984,7 +5257,9 @@ func getLightivRequest(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname u b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 119 // request opcode @@ -5013,6 +5288,8 @@ type GetMapdvCookie struct { // GetMapdv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMapdvCookie.Reply() func GetMapdv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapdvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMapdv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5024,6 +5301,8 @@ func GetMapdv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) G // GetMapdvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMapdvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapdvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMapdv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5095,7 +5374,9 @@ func getMapdvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query ui b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 120 // request opcode @@ -5124,6 +5405,8 @@ type GetMapfvCookie struct { // GetMapfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMapfvCookie.Reply() func GetMapfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5135,6 +5418,8 @@ func GetMapfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) G // GetMapfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMapfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5206,7 +5491,9 @@ func getMapfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query ui b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 121 // request opcode @@ -5235,6 +5522,8 @@ type GetMapivCookie struct { // GetMapiv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMapivCookie.Reply() func GetMapiv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMapiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5246,6 +5535,8 @@ func GetMapiv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) G // GetMapivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMapivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMapiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5317,7 +5608,9 @@ func getMapivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query ui b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 122 // request opcode @@ -5346,6 +5639,8 @@ type GetMaterialfvCookie struct { // GetMaterialfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMaterialfvCookie.Reply() func GetMaterialfv(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMaterialfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5357,6 +5652,8 @@ func GetMaterialfv(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32 // GetMaterialfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMaterialfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMaterialfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5428,7 +5725,9 @@ func getMaterialfvRequest(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 123 // request opcode @@ -5457,6 +5756,8 @@ type GetMaterialivCookie struct { // GetMaterialiv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMaterialivCookie.Reply() func GetMaterialiv(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMaterialiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5468,6 +5769,8 @@ func GetMaterialiv(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32 // GetMaterialivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMaterialivUnchecked(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMaterialiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5539,7 +5842,9 @@ func getMaterialivRequest(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 124 // request opcode @@ -5568,6 +5873,8 @@ type GetMinmaxCookie struct { // GetMinmax sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMinmaxCookie.Reply() func GetMinmax(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetMinmaxCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5579,6 +5886,8 @@ func GetMinmax(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, // GetMinmaxUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMinmaxUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetMinmaxCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5637,7 +5946,9 @@ func getMinmaxRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 157 // request opcode @@ -5683,6 +5994,8 @@ type GetMinmaxParameterfvCookie struct { // GetMinmaxParameterfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMinmaxParameterfvCookie.Reply() func GetMinmaxParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5694,6 +6007,8 @@ func GetMinmaxParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pna // GetMinmaxParameterfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMinmaxParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5765,7 +6080,9 @@ func getMinmaxParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 158 // request opcode @@ -5794,6 +6111,8 @@ type GetMinmaxParameterivCookie struct { // GetMinmaxParameteriv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMinmaxParameterivCookie.Reply() func GetMinmaxParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5805,6 +6124,8 @@ func GetMinmaxParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pna // GetMinmaxParameterivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMinmaxParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5876,7 +6197,9 @@ func getMinmaxParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 159 // request opcode @@ -5905,6 +6228,8 @@ type GetPixelMapfvCookie struct { // GetPixelMapfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPixelMapfvCookie.Reply() func GetPixelMapfv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetPixelMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5916,6 +6241,8 @@ func GetPixelMapfv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapfv // GetPixelMapfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPixelMapfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetPixelMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -5987,7 +6314,9 @@ func getPixelMapfvRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 125 // request opcode @@ -6013,6 +6342,8 @@ type GetPixelMapuivCookie struct { // GetPixelMapuiv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPixelMapuivCookie.Reply() func GetPixelMapuiv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapuivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetPixelMapuiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6024,6 +6355,8 @@ func GetPixelMapuiv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapu // GetPixelMapuivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPixelMapuivUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapuivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetPixelMapuiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6095,7 +6428,9 @@ func getPixelMapuivRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byt b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 126 // request opcode @@ -6121,6 +6456,8 @@ type GetPixelMapusvCookie struct { // GetPixelMapusv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPixelMapusvCookie.Reply() func GetPixelMapusv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapusvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetPixelMapusv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6132,6 +6469,8 @@ func GetPixelMapusv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapu // GetPixelMapusvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPixelMapusvUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapusvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetPixelMapusv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6203,7 +6542,9 @@ func getPixelMapusvRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byt b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 127 // request opcode @@ -6229,6 +6570,8 @@ type GetPolygonStippleCookie struct { // GetPolygonStipple sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPolygonStippleCookie.Reply() func GetPolygonStipple(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) GetPolygonStippleCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetPolygonStipple' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6240,6 +6583,8 @@ func GetPolygonStipple(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) GetPol // GetPolygonStippleUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPolygonStippleUnchecked(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) GetPolygonStippleCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetPolygonStipple' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6298,7 +6643,9 @@ func getPolygonStippleRequest(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 128 // request opcode @@ -6328,6 +6675,8 @@ type GetQueryObjectivARBCookie struct { // GetQueryObjectivARB sends a checked request. // If an error occurs, it will be returned with the reply by calling GetQueryObjectivARBCookie.Reply() func GetQueryObjectivARB(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectivARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6339,6 +6688,8 @@ func GetQueryObjectivARB(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname ui // GetQueryObjectivARBUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetQueryObjectivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectivARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6410,7 +6761,9 @@ func getQueryObjectivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32, P b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 165 // request opcode @@ -6439,6 +6792,8 @@ type GetQueryObjectuivARBCookie struct { // GetQueryObjectuivARB sends a checked request. // If an error occurs, it will be returned with the reply by calling GetQueryObjectuivARBCookie.Reply() func GetQueryObjectuivARB(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectuivARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6450,6 +6805,8 @@ func GetQueryObjectuivARB(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname u // GetQueryObjectuivARBUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetQueryObjectuivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectuivARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6521,7 +6878,9 @@ func getQueryObjectuivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 166 // request opcode @@ -6550,6 +6909,8 @@ type GetQueryivARBCookie struct { // GetQueryivARB sends a checked request. // If an error occurs, it will be returned with the reply by calling GetQueryivARBCookie.Reply() func GetQueryivARB(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetQueryivARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6561,6 +6922,8 @@ func GetQueryivARB(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint // GetQueryivARBUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetQueryivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetQueryivARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6632,7 +6995,9 @@ func getQueryivARBRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pna b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 164 // request opcode @@ -6661,6 +7026,8 @@ type GetSeparableFilterCookie struct { // GetSeparableFilter sends a checked request. // If an error occurs, it will be returned with the reply by calling GetSeparableFilterCookie.Reply() func GetSeparableFilter(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetSeparableFilterCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6672,6 +7039,8 @@ func GetSeparableFilter(c *xgb.Conn, ContextTag ContextTag, Target uint32, Forma // GetSeparableFilterUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetSeparableFilterUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetSeparableFilterCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6741,7 +7110,9 @@ func getSeparableFilterRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 153 // request opcode @@ -6780,6 +7151,8 @@ type GetStringCookie struct { // GetString sends a checked request. // If an error occurs, it will be returned with the reply by calling GetStringCookie.Reply() func GetString(c *xgb.Conn, ContextTag ContextTag, Name uint32) GetStringCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6791,6 +7164,8 @@ func GetString(c *xgb.Conn, ContextTag ContextTag, Name uint32) GetStringCookie // GetStringUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetStringUnchecked(c *xgb.Conn, ContextTag ContextTag, Name uint32) GetStringCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6859,7 +7234,9 @@ func getStringRequest(c *xgb.Conn, ContextTag ContextTag, Name uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 129 // request opcode @@ -6885,6 +7262,8 @@ type GetTexEnvfvCookie struct { // GetTexEnvfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexEnvfvCookie.Reply() func GetTexEnvfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexEnvfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6896,6 +7275,8 @@ func GetTexEnvfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32 // GetTexEnvfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexEnvfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexEnvfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -6967,7 +7348,9 @@ func getTexEnvfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 130 // request opcode @@ -6996,6 +7379,8 @@ type GetTexEnvivCookie struct { // GetTexEnviv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexEnvivCookie.Reply() func GetTexEnviv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexEnviv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7007,6 +7392,8 @@ func GetTexEnviv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32 // GetTexEnvivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexEnvivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexEnviv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7078,7 +7465,9 @@ func getTexEnvivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 131 // request opcode @@ -7107,6 +7496,8 @@ type GetTexGendvCookie struct { // GetTexGendv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexGendvCookie.Reply() func GetTexGendv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGendvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexGendv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7118,6 +7509,8 @@ func GetTexGendv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) // GetTexGendvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexGendvUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGendvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexGendv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7189,7 +7582,9 @@ func getTexGendvRequest(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 132 // request opcode @@ -7218,6 +7613,8 @@ type GetTexGenfvCookie struct { // GetTexGenfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexGenfvCookie.Reply() func GetTexGenfv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexGenfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7229,6 +7626,8 @@ func GetTexGenfv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) // GetTexGenfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexGenfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexGenfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7300,7 +7699,9 @@ func getTexGenfvRequest(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 133 // request opcode @@ -7329,6 +7730,8 @@ type GetTexGenivCookie struct { // GetTexGeniv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexGenivCookie.Reply() func GetTexGeniv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexGeniv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7340,6 +7743,8 @@ func GetTexGeniv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) // GetTexGenivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexGenivUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexGeniv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7411,7 +7816,9 @@ func getTexGenivRequest(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 134 // request opcode @@ -7440,6 +7847,8 @@ type GetTexImageCookie struct { // GetTexImage sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexImageCookie.Reply() func GetTexImage(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) GetTexImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexImage' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7451,6 +7860,8 @@ func GetTexImage(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, // GetTexImageUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexImageUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) GetTexImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexImage' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7524,7 +7935,9 @@ func getTexImageRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 135 // request opcode @@ -7566,6 +7979,8 @@ type GetTexLevelParameterfvCookie struct { // GetTexLevelParameterfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexLevelParameterfvCookie.Reply() func GetTexLevelParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7577,6 +7992,8 @@ func GetTexLevelParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, L // GetTexLevelParameterfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexLevelParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7648,7 +8065,9 @@ func getTexLevelParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target ui b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 138 // request opcode @@ -7680,6 +8099,8 @@ type GetTexLevelParameterivCookie struct { // GetTexLevelParameteriv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexLevelParameterivCookie.Reply() func GetTexLevelParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7691,6 +8112,8 @@ func GetTexLevelParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, L // GetTexLevelParameterivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexLevelParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7762,7 +8185,9 @@ func getTexLevelParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target ui b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 139 // request opcode @@ -7794,6 +8219,8 @@ type GetTexParameterfvCookie struct { // GetTexParameterfv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexParameterfvCookie.Reply() func GetTexParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7805,6 +8232,8 @@ func GetTexParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname // GetTexParameterfvUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterfvCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7876,7 +8305,9 @@ func getTexParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 136 // request opcode @@ -7905,6 +8336,8 @@ type GetTexParameterivCookie struct { // GetTexParameteriv sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTexParameterivCookie.Reply() func GetTexParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7916,6 +8349,8 @@ func GetTexParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname // GetTexParameterivUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTexParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterivCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -7987,7 +8422,9 @@ func getTexParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 137 // request opcode @@ -8016,6 +8453,8 @@ type GetVisualConfigsCookie struct { // GetVisualConfigs sends a checked request. // If an error occurs, it will be returned with the reply by calling GetVisualConfigsCookie.Reply() func GetVisualConfigs(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8027,6 +8466,8 @@ func GetVisualConfigs(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie { // GetVisualConfigsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetVisualConfigsUnchecked(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8095,7 +8536,9 @@ func getVisualConfigsRequest(c *xgb.Conn, Screen uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 14 // request opcode @@ -8118,6 +8561,8 @@ type IsDirectCookie struct { // IsDirect sends a checked request. // If an error occurs, it will be returned with the reply by calling IsDirectCookie.Reply() func IsDirect(c *xgb.Conn, Context Context) IsDirectCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'IsDirect' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8129,6 +8574,8 @@ func IsDirect(c *xgb.Conn, Context Context) IsDirectCookie { // IsDirectUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func IsDirectUnchecked(c *xgb.Conn, Context Context) IsDirectCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'IsDirect' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8190,7 +8637,9 @@ func isDirectRequest(c *xgb.Conn, Context Context) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -8213,6 +8662,8 @@ type IsListCookie struct { // IsList sends a checked request. // If an error occurs, it will be returned with the reply by calling IsListCookie.Reply() func IsList(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8224,6 +8675,8 @@ func IsList(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie { // IsListUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func IsListUnchecked(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8278,7 +8731,9 @@ func isListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 141 // request opcode @@ -8304,6 +8759,8 @@ type IsQueryARBCookie struct { // IsQueryARB sends a checked request. // If an error occurs, it will be returned with the reply by calling IsQueryARBCookie.Reply() func IsQueryARB(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'IsQueryARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8315,6 +8772,8 @@ func IsQueryARB(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie // IsQueryARBUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func IsQueryARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'IsQueryARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8369,7 +8828,9 @@ func isQueryARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 163 // request opcode @@ -8395,6 +8856,8 @@ type IsTextureCookie struct { // IsTexture sends a checked request. // If an error occurs, it will be returned with the reply by calling IsTextureCookie.Reply() func IsTexture(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8406,6 +8869,8 @@ func IsTexture(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCook // IsTextureUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func IsTextureUnchecked(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8460,7 +8925,9 @@ func isTextureRequest(c *xgb.Conn, ContextTag ContextTag, Texture uint32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 146 // request opcode @@ -8486,6 +8953,8 @@ type MakeContextCurrentCookie struct { // MakeContextCurrent sends a checked request. // If an error occurs, it will be returned with the reply by calling MakeContextCurrentCookie.Reply() func MakeContextCurrent(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable, ReadDrawable Drawable, Context Context) MakeContextCurrentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8497,6 +8966,8 @@ func MakeContextCurrent(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable // MakeContextCurrentUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func MakeContextCurrentUnchecked(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable, ReadDrawable Drawable, Context Context) MakeContextCurrentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8554,7 +9025,9 @@ func makeContextCurrentRequest(c *xgb.Conn, OldContextTag ContextTag, Drawable D b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 26 // request opcode @@ -8586,6 +9059,8 @@ type MakeCurrentCookie struct { // MakeCurrent sends a checked request. // If an error occurs, it will be returned with the reply by calling MakeCurrentCookie.Reply() func MakeCurrent(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) MakeCurrentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'MakeCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8597,6 +9072,8 @@ func MakeCurrent(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag // MakeCurrentUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func MakeCurrentUnchecked(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) MakeCurrentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'MakeCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8654,7 +9131,9 @@ func makeCurrentRequest(c *xgb.Conn, Drawable Drawable, Context Context, OldCont b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -8683,6 +9162,8 @@ type NewListCookie struct { // NewList sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func NewList(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) NewListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'NewList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8694,6 +9175,8 @@ func NewList(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) NewLi // NewListChecked sends a checked request. // If an error occurs, it can be retrieved using NewListCookie.Check() func NewListChecked(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) NewListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'NewList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8715,7 +9198,9 @@ func newListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 101 // request opcode @@ -8744,6 +9229,8 @@ type PixelStorefCookie struct { // PixelStoref sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PixelStoref(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) PixelStorefCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8755,6 +9242,8 @@ func PixelStoref(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32 // PixelStorefChecked sends a checked request. // If an error occurs, it can be retrieved using PixelStorefCookie.Check() func PixelStorefChecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) PixelStorefCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8776,7 +9265,9 @@ func pixelStorefRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 109 // request opcode @@ -8805,6 +9296,8 @@ type PixelStoreiCookie struct { // PixelStorei sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PixelStorei(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8816,6 +9309,8 @@ func PixelStorei(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) // PixelStoreiChecked sends a checked request. // If an error occurs, it can be retrieved using PixelStoreiCookie.Check() func PixelStoreiChecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8837,7 +9332,9 @@ func pixelStoreiRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 110 // request opcode @@ -8866,6 +9363,8 @@ type QueryContextCookie struct { // QueryContext sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryContextCookie.Reply() func QueryContext(c *xgb.Conn, Context Context) QueryContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8877,6 +9376,8 @@ func QueryContext(c *xgb.Conn, Context Context) QueryContextCookie { // QueryContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryContextUnchecked(c *xgb.Conn, Context Context) QueryContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8941,7 +9442,9 @@ func queryContextRequest(c *xgb.Conn, Context Context) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 25 // request opcode @@ -8964,6 +9467,8 @@ type QueryExtensionsStringCookie struct { // QueryExtensionsString sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryExtensionsStringCookie.Reply() func QueryExtensionsString(c *xgb.Conn, Screen uint32) QueryExtensionsStringCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'QueryExtensionsString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -8975,6 +9480,8 @@ func QueryExtensionsString(c *xgb.Conn, Screen uint32) QueryExtensionsStringCook // QueryExtensionsStringUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryExtensionsStringUnchecked(c *xgb.Conn, Screen uint32) QueryExtensionsStringCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'QueryExtensionsString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9035,7 +9542,9 @@ func queryExtensionsStringRequest(c *xgb.Conn, Screen uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 18 // request opcode @@ -9058,6 +9567,8 @@ type QueryServerStringCookie struct { // QueryServerString sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryServerStringCookie.Reply() func QueryServerString(c *xgb.Conn, Screen uint32, Name uint32) QueryServerStringCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'QueryServerString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9069,6 +9580,8 @@ func QueryServerString(c *xgb.Conn, Screen uint32, Name uint32) QueryServerStrin // QueryServerStringUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryServerStringUnchecked(c *xgb.Conn, Screen uint32, Name uint32) QueryServerStringCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'QueryServerString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9137,7 +9650,9 @@ func queryServerStringRequest(c *xgb.Conn, Screen uint32, Name uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 19 // request opcode @@ -9163,6 +9678,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9174,6 +9691,8 @@ func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVe // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9235,7 +9754,9 @@ func queryVersionRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -9261,6 +9782,8 @@ type ReadPixelsCookie struct { // ReadPixels sends a checked request. // If an error occurs, it will be returned with the reply by calling ReadPixelsCookie.Reply() func ReadPixels(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) ReadPixelsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9272,6 +9795,8 @@ func ReadPixels(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Width int3 // ReadPixelsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ReadPixelsUnchecked(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) ReadPixelsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9330,7 +9855,9 @@ func readPixelsRequest(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Wid b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 111 // request opcode @@ -9385,6 +9912,8 @@ type RenderCookie struct { // Render sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Render(c *xgb.Conn, ContextTag ContextTag, Data []byte) RenderCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'Render' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9396,6 +9925,8 @@ func Render(c *xgb.Conn, ContextTag ContextTag, Data []byte) RenderCookie { // RenderChecked sends a checked request. // If an error occurs, it can be retrieved using RenderCookie.Check() func RenderChecked(c *xgb.Conn, ContextTag ContextTag, Data []byte) RenderCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'Render' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9417,7 +9948,9 @@ func renderRequest(c *xgb.Conn, ContextTag ContextTag, Data []byte) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -9443,6 +9976,8 @@ type RenderLargeCookie struct { // RenderLarge sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RenderLarge(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) RenderLargeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'RenderLarge' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9454,6 +9989,8 @@ func RenderLarge(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, RequestT // RenderLargeChecked sends a checked request. // If an error occurs, it can be retrieved using RenderLargeCookie.Check() func RenderLargeChecked(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) RenderLargeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'RenderLarge' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9475,7 +10012,9 @@ func renderLargeRequest(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, R b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -9510,6 +10049,8 @@ type RenderModeCookie struct { // RenderMode sends a checked request. // If an error occurs, it will be returned with the reply by calling RenderModeCookie.Reply() func RenderMode(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9521,6 +10062,8 @@ func RenderMode(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCooki // RenderModeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RenderModeUnchecked(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9593,7 +10136,9 @@ func renderModeRequest(c *xgb.Conn, ContextTag ContextTag, Mode uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 107 // request opcode @@ -9619,6 +10164,8 @@ type SelectBufferCookie struct { // SelectBuffer sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'SelectBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9630,6 +10177,8 @@ func SelectBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCo // SelectBufferChecked sends a checked request. // If an error occurs, it can be retrieved using SelectBufferCookie.Check() func SelectBufferChecked(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'SelectBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9651,7 +10200,9 @@ func selectBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size int32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 106 // request opcode @@ -9677,6 +10228,8 @@ type SetClientInfo2ARBCookie struct { // SetClientInfo2ARB sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetClientInfo2ARB(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfo2ARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9688,6 +10241,8 @@ func SetClientInfo2ARB(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, Nu // SetClientInfo2ARBChecked sends a checked request. // If an error occurs, it can be retrieved using SetClientInfo2ARBCookie.Check() func SetClientInfo2ARBChecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfo2ARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9709,7 +10264,9 @@ func setClientInfo2ARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uin b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 35 // request opcode @@ -9755,6 +10312,8 @@ type SetClientInfoARBCookie struct { // SetClientInfoARB sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetClientInfoARB(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfoARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'SetClientInfoARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9766,6 +10325,8 @@ func SetClientInfoARB(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, Num // SetClientInfoARBChecked sends a checked request. // If an error occurs, it can be retrieved using SetClientInfoARBCookie.Check() func SetClientInfoARBChecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfoARBCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'SetClientInfoARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9787,7 +10348,9 @@ func setClientInfoARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 33 // request opcode @@ -9833,6 +10396,8 @@ type SwapBuffersCookie struct { // SwapBuffers sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SwapBuffers(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuffersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9844,6 +10409,8 @@ func SwapBuffers(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuff // SwapBuffersChecked sends a checked request. // If an error occurs, it can be retrieved using SwapBuffersCookie.Check() func SwapBuffersChecked(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuffersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9865,7 +10432,9 @@ func swapBuffersRequest(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) [ b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode @@ -9891,6 +10460,8 @@ type UseXFontCookie struct { // UseXFont sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UseXFont(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First uint32, Count uint32, ListBase uint32) UseXFontCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9902,6 +10473,8 @@ func UseXFont(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First uint32 // UseXFontChecked sends a checked request. // If an error occurs, it can be retrieved using UseXFontCookie.Check() func UseXFontChecked(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First uint32, Count uint32, ListBase uint32) UseXFontCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9923,7 +10496,9 @@ func useXFontRequest(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -9958,6 +10533,8 @@ type VendorPrivateCookie struct { // VendorPrivate sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func VendorPrivate(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9969,6 +10546,8 @@ func VendorPrivate(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data [ // VendorPrivateChecked sends a checked request. // If an error occurs, it can be retrieved using VendorPrivateCookie.Check() func VendorPrivateChecked(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -9990,7 +10569,9 @@ func vendorPrivateRequest(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 16 // request opcode @@ -10019,6 +10600,8 @@ type VendorPrivateWithReplyCookie struct { // VendorPrivateWithReply sends a checked request. // If an error occurs, it will be returned with the reply by calling VendorPrivateWithReplyCookie.Reply() func VendorPrivateWithReply(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateWithReplyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'VendorPrivateWithReply' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -10030,6 +10613,8 @@ func VendorPrivateWithReply(c *xgb.Conn, VendorCode uint32, ContextTag ContextTa // VendorPrivateWithReplyUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func VendorPrivateWithReplyUnchecked(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateWithReplyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'VendorPrivateWithReply' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -10094,7 +10679,9 @@ func vendorPrivateWithReplyRequest(c *xgb.Conn, VendorCode uint32, ContextTag Co b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 17 // request opcode @@ -10123,6 +10710,8 @@ type WaitGLCookie struct { // WaitGL sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func WaitGL(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -10134,6 +10723,8 @@ func WaitGL(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie { // WaitGLChecked sends a checked request. // If an error occurs, it can be retrieved using WaitGLCookie.Check() func WaitGLChecked(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -10155,7 +10746,9 @@ func waitGLRequest(c *xgb.Conn, ContextTag ContextTag) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -10178,6 +10771,8 @@ type WaitXCookie struct { // WaitX sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func WaitX(c *xgb.Conn, ContextTag ContextTag) WaitXCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -10189,6 +10784,8 @@ func WaitX(c *xgb.Conn, ContextTag ContextTag) WaitXCookie { // WaitXChecked sends a checked request. // If an error occurs, it can be retrieved using WaitXCookie.Check() func WaitXChecked(c *xgb.Conn, ContextTag ContextTag) WaitXCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["GLX"]; !ok { panic("Cannot issue request 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } @@ -10210,7 +10807,9 @@ func waitXRequest(c *xgb.Conn, ContextTag ContextTag) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["GLX"] + c.ExtLock.RUnlock() b += 1 buf[b] = 9 // request opcode diff --git a/nexgb/randr/randr.go b/nexgb/randr/randr.go index 20dc62a..021c011 100644 --- a/nexgb/randr/randr.go +++ b/nexgb/randr/randr.go @@ -20,16 +20,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named RANDR could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["RANDR"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["RANDR"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["RANDR"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -1680,6 +1679,8 @@ type AddOutputModeCookie struct { // AddOutputMode sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddOutputMode(c *xgb.Conn, Output Output, Mode Mode) AddOutputModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'AddOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1691,6 +1692,8 @@ func AddOutputMode(c *xgb.Conn, Output Output, Mode Mode) AddOutputModeCookie { // AddOutputModeChecked sends a checked request. // If an error occurs, it can be retrieved using AddOutputModeCookie.Check() func AddOutputModeChecked(c *xgb.Conn, Output Output, Mode Mode) AddOutputModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'AddOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1712,7 +1715,9 @@ func addOutputModeRequest(c *xgb.Conn, Output Output, Mode Mode) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 18 // request opcode @@ -1738,6 +1743,8 @@ type ChangeOutputPropertyCookie struct { // ChangeOutputProperty sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangeOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) ChangeOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ChangeOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1749,6 +1756,8 @@ func ChangeOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type // ChangeOutputPropertyChecked sends a checked request. // If an error occurs, it can be retrieved using ChangeOutputPropertyCookie.Check() func ChangeOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumUnits uint32, Data []byte) ChangeOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ChangeOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1770,7 +1779,9 @@ func changeOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Ato b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode @@ -1813,6 +1824,8 @@ type ChangeProviderPropertyCookie struct { // ChangeProviderProperty sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangeProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumItems uint32, Data []byte) ChangeProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ChangeProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1824,6 +1837,8 @@ func ChangeProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom // ChangeProviderPropertyChecked sends a checked request. // If an error occurs, it can be retrieved using ChangeProviderPropertyCookie.Check() func ChangeProviderPropertyChecked(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, Format byte, Mode byte, NumItems uint32, Data []byte) ChangeProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ChangeProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1845,7 +1860,9 @@ func changeProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property xpro b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 39 // request opcode @@ -1888,6 +1905,8 @@ type ConfigureOutputPropertyCookie struct { // ConfigureOutputProperty sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ConfigureOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ConfigureOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1899,6 +1918,8 @@ func ConfigureOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, P // ConfigureOutputPropertyChecked sends a checked request. // If an error occurs, it can be retrieved using ConfigureOutputPropertyCookie.Check() func ConfigureOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ConfigureOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1920,7 +1941,9 @@ func configureOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto. b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -1967,6 +1990,8 @@ type ConfigureProviderPropertyCookie struct { // ConfigureProviderProperty sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ConfigureProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ConfigureProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1978,6 +2003,8 @@ func ConfigureProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.A // ConfigureProviderPropertyChecked sends a checked request. // If an error occurs, it can be retrieved using ConfigureProviderPropertyCookie.Check() func ConfigureProviderPropertyChecked(c *xgb.Conn, Provider Provider, Property xproto.Atom, Pending bool, Range bool, Values []int32) ConfigureProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ConfigureProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -1999,7 +2026,9 @@ func configureProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property x b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 38 // request opcode @@ -2046,6 +2075,8 @@ type CreateModeCookie struct { // CreateMode sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateModeCookie.Reply() func CreateMode(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) CreateModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'CreateMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2057,6 +2088,8 @@ func CreateMode(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name strin // CreateModeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateModeUnchecked(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Name string) CreateModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'CreateMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2114,7 +2147,9 @@ func createModeRequest(c *xgb.Conn, Window xproto.Window, ModeInfo ModeInfo, Nam b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 16 // request opcode @@ -2146,6 +2181,8 @@ type DeleteOutputModeCookie struct { // DeleteOutputMode sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeleteOutputMode(c *xgb.Conn, Output Output, Mode Mode) DeleteOutputModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'DeleteOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2157,6 +2194,8 @@ func DeleteOutputMode(c *xgb.Conn, Output Output, Mode Mode) DeleteOutputModeCoo // DeleteOutputModeChecked sends a checked request. // If an error occurs, it can be retrieved using DeleteOutputModeCookie.Check() func DeleteOutputModeChecked(c *xgb.Conn, Output Output, Mode Mode) DeleteOutputModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'DeleteOutputMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2178,7 +2217,9 @@ func deleteOutputModeRequest(c *xgb.Conn, Output Output, Mode Mode) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 19 // request opcode @@ -2204,6 +2245,8 @@ type DeleteOutputPropertyCookie struct { // DeleteOutputProperty sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeleteOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) DeleteOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'DeleteOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2215,6 +2258,8 @@ func DeleteOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) Dele // DeleteOutputPropertyChecked sends a checked request. // If an error occurs, it can be retrieved using DeleteOutputPropertyCookie.Check() func DeleteOutputPropertyChecked(c *xgb.Conn, Output Output, Property xproto.Atom) DeleteOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'DeleteOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2236,7 +2281,9 @@ func deleteOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Ato b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 14 // request opcode @@ -2262,6 +2309,8 @@ type DeleteProviderPropertyCookie struct { // DeleteProviderProperty sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeleteProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom) DeleteProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'DeleteProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2273,6 +2322,8 @@ func DeleteProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom // DeleteProviderPropertyChecked sends a checked request. // If an error occurs, it can be retrieved using DeleteProviderPropertyCookie.Check() func DeleteProviderPropertyChecked(c *xgb.Conn, Provider Provider, Property xproto.Atom) DeleteProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'DeleteProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2294,7 +2345,9 @@ func deleteProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property xpro b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 40 // request opcode @@ -2320,6 +2373,8 @@ type DestroyModeCookie struct { // DestroyMode sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyMode(c *xgb.Conn, Mode Mode) DestroyModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'DestroyMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2331,6 +2386,8 @@ func DestroyMode(c *xgb.Conn, Mode Mode) DestroyModeCookie { // DestroyModeChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyModeCookie.Check() func DestroyModeChecked(c *xgb.Conn, Mode Mode) DestroyModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'DestroyMode' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2352,7 +2409,9 @@ func destroyModeRequest(c *xgb.Conn, Mode Mode) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 17 // request opcode @@ -2375,6 +2434,8 @@ type GetCrtcGammaCookie struct { // GetCrtcGamma sends a checked request. // If an error occurs, it will be returned with the reply by calling GetCrtcGammaCookie.Reply() func GetCrtcGamma(c *xgb.Conn, Crtc Crtc) GetCrtcGammaCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2386,6 +2447,8 @@ func GetCrtcGamma(c *xgb.Conn, Crtc Crtc) GetCrtcGammaCookie { // GetCrtcGammaUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCrtcGammaUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcGammaCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2470,7 +2533,9 @@ func getCrtcGammaRequest(c *xgb.Conn, Crtc Crtc) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 23 // request opcode @@ -2493,6 +2558,8 @@ type GetCrtcGammaSizeCookie struct { // GetCrtcGammaSize sends a checked request. // If an error occurs, it will be returned with the reply by calling GetCrtcGammaSizeCookie.Reply() func GetCrtcGammaSize(c *xgb.Conn, Crtc Crtc) GetCrtcGammaSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetCrtcGammaSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2504,6 +2571,8 @@ func GetCrtcGammaSize(c *xgb.Conn, Crtc Crtc) GetCrtcGammaSizeCookie { // GetCrtcGammaSizeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCrtcGammaSizeUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcGammaSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetCrtcGammaSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2561,7 +2630,9 @@ func getCrtcGammaSizeRequest(c *xgb.Conn, Crtc Crtc) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 22 // request opcode @@ -2584,6 +2655,8 @@ type GetCrtcInfoCookie struct { // GetCrtcInfo sends a checked request. // If an error occurs, it will be returned with the reply by calling GetCrtcInfoCookie.Reply() func GetCrtcInfo(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) GetCrtcInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetCrtcInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2595,6 +2668,8 @@ func GetCrtcInfo(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) GetCr // GetCrtcInfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCrtcInfoUnchecked(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp) GetCrtcInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetCrtcInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2703,7 +2778,9 @@ func getCrtcInfoRequest(c *xgb.Conn, Crtc Crtc, ConfigTimestamp xproto.Timestamp b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 20 // request opcode @@ -2729,6 +2806,8 @@ type GetCrtcTransformCookie struct { // GetCrtcTransform sends a checked request. // If an error occurs, it will be returned with the reply by calling GetCrtcTransformCookie.Reply() func GetCrtcTransform(c *xgb.Conn, Crtc Crtc) GetCrtcTransformCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2740,6 +2819,8 @@ func GetCrtcTransform(c *xgb.Conn, Crtc Crtc) GetCrtcTransformCookie { // GetCrtcTransformUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCrtcTransformUnchecked(c *xgb.Conn, Crtc Crtc) GetCrtcTransformCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2864,7 +2945,9 @@ func getCrtcTransformRequest(c *xgb.Conn, Crtc Crtc) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 27 // request opcode @@ -2887,6 +2970,8 @@ type GetOutputInfoCookie struct { // GetOutputInfo sends a checked request. // If an error occurs, it will be returned with the reply by calling GetOutputInfoCookie.Reply() func GetOutputInfo(c *xgb.Conn, Output Output, ConfigTimestamp xproto.Timestamp) GetOutputInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetOutputInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -2898,6 +2983,8 @@ func GetOutputInfo(c *xgb.Conn, Output Output, ConfigTimestamp xproto.Timestamp) // GetOutputInfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetOutputInfoUnchecked(c *xgb.Conn, Output Output, ConfigTimestamp xproto.Timestamp) GetOutputInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetOutputInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3025,7 +3112,9 @@ func getOutputInfoRequest(c *xgb.Conn, Output Output, ConfigTimestamp xproto.Tim b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 9 // request opcode @@ -3051,6 +3140,8 @@ type GetOutputPrimaryCookie struct { // GetOutputPrimary sends a checked request. // If an error occurs, it will be returned with the reply by calling GetOutputPrimaryCookie.Reply() func GetOutputPrimary(c *xgb.Conn, Window xproto.Window) GetOutputPrimaryCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3062,6 +3153,8 @@ func GetOutputPrimary(c *xgb.Conn, Window xproto.Window) GetOutputPrimaryCookie // GetOutputPrimaryUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetOutputPrimaryUnchecked(c *xgb.Conn, Window xproto.Window) GetOutputPrimaryCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3116,7 +3209,9 @@ func getOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 31 // request opcode @@ -3139,6 +3234,8 @@ type GetOutputPropertyCookie struct { // GetOutputProperty sends a checked request. // If an error occurs, it will be returned with the reply by calling GetOutputPropertyCookie.Reply() func GetOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3150,6 +3247,8 @@ func GetOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom, Type xp // GetOutputPropertyUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetOutputPropertyUnchecked(c *xgb.Conn, Output Output, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3221,7 +3320,9 @@ func getOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 15 // request opcode @@ -3272,6 +3373,8 @@ type GetPanningCookie struct { // GetPanning sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPanningCookie.Reply() func GetPanning(c *xgb.Conn, Crtc Crtc) GetPanningCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3283,6 +3386,8 @@ func GetPanning(c *xgb.Conn, Crtc Crtc) GetPanningCookie { // GetPanningUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPanningUnchecked(c *xgb.Conn, Crtc Crtc) GetPanningCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3386,7 +3491,9 @@ func getPanningRequest(c *xgb.Conn, Crtc Crtc) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 28 // request opcode @@ -3409,6 +3516,8 @@ type GetProviderInfoCookie struct { // GetProviderInfo sends a checked request. // If an error occurs, it will be returned with the reply by calling GetProviderInfoCookie.Reply() func GetProviderInfo(c *xgb.Conn, Provider Provider, ConfigTimestamp xproto.Timestamp) GetProviderInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetProviderInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3420,6 +3529,8 @@ func GetProviderInfo(c *xgb.Conn, Provider Provider, ConfigTimestamp xproto.Time // GetProviderInfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetProviderInfoUnchecked(c *xgb.Conn, Provider Provider, ConfigTimestamp xproto.Timestamp) GetProviderInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetProviderInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3543,7 +3654,9 @@ func getProviderInfoRequest(c *xgb.Conn, Provider Provider, ConfigTimestamp xpro b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 33 // request opcode @@ -3569,6 +3682,8 @@ type GetProviderPropertyCookie struct { // GetProviderProperty sends a checked request. // If an error occurs, it will be returned with the reply by calling GetProviderPropertyCookie.Reply() func GetProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3580,6 +3695,8 @@ func GetProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom, T // GetProviderPropertyUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetProviderPropertyUnchecked(c *xgb.Conn, Provider Provider, Property xproto.Atom, Type xproto.Atom, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) GetProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3651,7 +3768,9 @@ func getProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property xproto. b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 41 // request opcode @@ -3702,6 +3821,8 @@ type GetProvidersCookie struct { // GetProviders sends a checked request. // If an error occurs, it will be returned with the reply by calling GetProvidersCookie.Reply() func GetProviders(c *xgb.Conn, Window xproto.Window) GetProvidersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetProviders' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3713,6 +3834,8 @@ func GetProviders(c *xgb.Conn, Window xproto.Window) GetProvidersCookie { // GetProvidersUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetProvidersUnchecked(c *xgb.Conn, Window xproto.Window) GetProvidersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetProviders' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3781,7 +3904,9 @@ func getProvidersRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 32 // request opcode @@ -3804,6 +3929,8 @@ type GetScreenInfoCookie struct { // GetScreenInfo sends a checked request. // If an error occurs, it will be returned with the reply by calling GetScreenInfoCookie.Reply() func GetScreenInfo(c *xgb.Conn, Window xproto.Window) GetScreenInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetScreenInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3815,6 +3942,8 @@ func GetScreenInfo(c *xgb.Conn, Window xproto.Window) GetScreenInfoCookie { // GetScreenInfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetScreenInfoUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetScreenInfo' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3912,7 +4041,9 @@ func getScreenInfoRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -3935,6 +4066,8 @@ type GetScreenResourcesCookie struct { // GetScreenResources sends a checked request. // If an error occurs, it will be returned with the reply by calling GetScreenResourcesCookie.Reply() func GetScreenResources(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetScreenResources' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -3946,6 +4079,8 @@ func GetScreenResources(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCoo // GetScreenResourcesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetScreenResourcesUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetScreenResources' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4052,7 +4187,9 @@ func getScreenResourcesRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -4075,6 +4212,8 @@ type GetScreenResourcesCurrentCookie struct { // GetScreenResourcesCurrent sends a checked request. // If an error occurs, it will be returned with the reply by calling GetScreenResourcesCurrentCookie.Reply() func GetScreenResourcesCurrent(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCurrentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetScreenResourcesCurrent' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4086,6 +4225,8 @@ func GetScreenResourcesCurrent(c *xgb.Conn, Window xproto.Window) GetScreenResou // GetScreenResourcesCurrentUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetScreenResourcesCurrentUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenResourcesCurrentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetScreenResourcesCurrent' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4192,7 +4333,9 @@ func getScreenResourcesCurrentRequest(c *xgb.Conn, Window xproto.Window) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 25 // request opcode @@ -4215,6 +4358,8 @@ type GetScreenSizeRangeCookie struct { // GetScreenSizeRange sends a checked request. // If an error occurs, it will be returned with the reply by calling GetScreenSizeRangeCookie.Reply() func GetScreenSizeRange(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4226,6 +4371,8 @@ func GetScreenSizeRange(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCoo // GetScreenSizeRangeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetScreenSizeRangeUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4295,7 +4442,9 @@ func getScreenSizeRangeRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -4318,6 +4467,8 @@ type ListOutputPropertiesCookie struct { // ListOutputProperties sends a checked request. // If an error occurs, it will be returned with the reply by calling ListOutputPropertiesCookie.Reply() func ListOutputProperties(c *xgb.Conn, Output Output) ListOutputPropertiesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ListOutputProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4329,6 +4480,8 @@ func ListOutputProperties(c *xgb.Conn, Output Output) ListOutputPropertiesCookie // ListOutputPropertiesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListOutputPropertiesUnchecked(c *xgb.Conn, Output Output) ListOutputPropertiesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ListOutputProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4393,7 +4546,9 @@ func listOutputPropertiesRequest(c *xgb.Conn, Output Output) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -4416,6 +4571,8 @@ type ListProviderPropertiesCookie struct { // ListProviderProperties sends a checked request. // If an error occurs, it will be returned with the reply by calling ListProviderPropertiesCookie.Reply() func ListProviderProperties(c *xgb.Conn, Provider Provider) ListProviderPropertiesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ListProviderProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4427,6 +4584,8 @@ func ListProviderProperties(c *xgb.Conn, Provider Provider) ListProviderProperti // ListProviderPropertiesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListProviderPropertiesUnchecked(c *xgb.Conn, Provider Provider) ListProviderPropertiesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'ListProviderProperties' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4491,7 +4650,9 @@ func listProviderPropertiesRequest(c *xgb.Conn, Provider Provider) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 36 // request opcode @@ -4514,6 +4675,8 @@ type QueryOutputPropertyCookie struct { // QueryOutputProperty sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryOutputPropertyCookie.Reply() func QueryOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) QueryOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'QueryOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4525,6 +4688,8 @@ func QueryOutputProperty(c *xgb.Conn, Output Output, Property xproto.Atom) Query // QueryOutputPropertyUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryOutputPropertyUnchecked(c *xgb.Conn, Output Output, Property xproto.Atom) QueryOutputPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'QueryOutputProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4609,7 +4774,9 @@ func queryOutputPropertyRequest(c *xgb.Conn, Output Output, Property xproto.Atom b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode @@ -4635,6 +4802,8 @@ type QueryProviderPropertyCookie struct { // QueryProviderProperty sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryProviderPropertyCookie.Reply() func QueryProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom) QueryProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'QueryProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4646,6 +4815,8 @@ func QueryProviderProperty(c *xgb.Conn, Provider Provider, Property xproto.Atom) // QueryProviderPropertyUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryProviderPropertyUnchecked(c *xgb.Conn, Provider Provider, Property xproto.Atom) QueryProviderPropertyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'QueryProviderProperty' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4730,7 +4901,9 @@ func queryProviderPropertyRequest(c *xgb.Conn, Provider Provider, Property xprot b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 37 // request opcode @@ -4756,6 +4929,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4767,6 +4942,8 @@ func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVe // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4828,7 +5005,9 @@ func queryVersionRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -4854,6 +5033,8 @@ type SelectInputCookie struct { // SelectInput sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectInput(c *xgb.Conn, Window xproto.Window, Enable uint16) SelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SelectInput' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4865,6 +5046,8 @@ func SelectInput(c *xgb.Conn, Window xproto.Window, Enable uint16) SelectInputCo // SelectInputChecked sends a checked request. // If an error occurs, it can be retrieved using SelectInputCookie.Check() func SelectInputChecked(c *xgb.Conn, Window xproto.Window, Enable uint16) SelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SelectInput' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4886,7 +5069,9 @@ func selectInputRequest(c *xgb.Conn, Window xproto.Window, Enable uint16) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -4914,6 +5099,8 @@ type SetCrtcConfigCookie struct { // SetCrtcConfig sends a checked request. // If an error occurs, it will be returned with the reply by calling SetCrtcConfigCookie.Reply() func SetCrtcConfig(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) SetCrtcConfigCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetCrtcConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4925,6 +5112,8 @@ func SetCrtcConfig(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTim // SetCrtcConfigUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetCrtcConfigUnchecked(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, X int16, Y int16, Mode Mode, Rotation uint16, Outputs []Output) SetCrtcConfigCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetCrtcConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -4983,7 +5172,9 @@ func setCrtcConfigRequest(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, Co b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 21 // request opcode @@ -5031,6 +5222,8 @@ type SetCrtcGammaCookie struct { // SetCrtcGamma sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetCrtcGamma(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetCrtcGammaCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5042,6 +5235,8 @@ func SetCrtcGamma(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uin // SetCrtcGammaChecked sends a checked request. // If an error occurs, it can be retrieved using SetCrtcGammaCookie.Check() func SetCrtcGammaChecked(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetCrtcGammaCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetCrtcGamma' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5063,7 +5258,9 @@ func setCrtcGammaRequest(c *xgb.Conn, Crtc Crtc, Size uint16, Red []uint16, Gree b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 24 // request opcode @@ -5112,6 +5309,8 @@ type SetCrtcTransformCookie struct { // SetCrtcTransform sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetCrtcTransform(c *xgb.Conn, Crtc Crtc, Transform render.Transform, FilterLen uint16, FilterName string, FilterParams []render.Fixed) SetCrtcTransformCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5123,6 +5322,8 @@ func SetCrtcTransform(c *xgb.Conn, Crtc Crtc, Transform render.Transform, Filter // SetCrtcTransformChecked sends a checked request. // If an error occurs, it can be retrieved using SetCrtcTransformCookie.Check() func SetCrtcTransformChecked(c *xgb.Conn, Crtc Crtc, Transform render.Transform, FilterLen uint16, FilterName string, FilterParams []render.Fixed) SetCrtcTransformCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5144,7 +5345,9 @@ func setCrtcTransformRequest(c *xgb.Conn, Crtc Crtc, Transform render.Transform, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 26 // request opcode @@ -5190,6 +5393,8 @@ type SetOutputPrimaryCookie struct { // SetOutputPrimary sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetOutputPrimary(c *xgb.Conn, Window xproto.Window, Output Output) SetOutputPrimaryCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5201,6 +5406,8 @@ func SetOutputPrimary(c *xgb.Conn, Window xproto.Window, Output Output) SetOutpu // SetOutputPrimaryChecked sends a checked request. // If an error occurs, it can be retrieved using SetOutputPrimaryCookie.Check() func SetOutputPrimaryChecked(c *xgb.Conn, Window xproto.Window, Output Output) SetOutputPrimaryCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetOutputPrimary' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5222,7 +5429,9 @@ func setOutputPrimaryRequest(c *xgb.Conn, Window xproto.Window, Output Output) [ b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 30 // request opcode @@ -5248,6 +5457,8 @@ type SetPanningCookie struct { // SetPanning sends a checked request. // If an error occurs, it will be returned with the reply by calling SetPanningCookie.Reply() func SetPanning(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) SetPanningCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5259,6 +5470,8 @@ func SetPanning(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, Left uint16, // SetPanningUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPanningUnchecked(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) SetPanningCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetPanning' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5314,7 +5527,9 @@ func setPanningRequest(c *xgb.Conn, Crtc Crtc, Timestamp xproto.Timestamp, Left b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 29 // request opcode @@ -5376,6 +5591,8 @@ type SetProviderOffloadSinkCookie struct { // SetProviderOffloadSink sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetProviderOffloadSink(c *xgb.Conn, Provider Provider, SinkProvider Provider, ConfigTimestamp xproto.Timestamp) SetProviderOffloadSinkCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetProviderOffloadSink' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5387,6 +5604,8 @@ func SetProviderOffloadSink(c *xgb.Conn, Provider Provider, SinkProvider Provide // SetProviderOffloadSinkChecked sends a checked request. // If an error occurs, it can be retrieved using SetProviderOffloadSinkCookie.Check() func SetProviderOffloadSinkChecked(c *xgb.Conn, Provider Provider, SinkProvider Provider, ConfigTimestamp xproto.Timestamp) SetProviderOffloadSinkCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetProviderOffloadSink' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5408,7 +5627,9 @@ func setProviderOffloadSinkRequest(c *xgb.Conn, Provider Provider, SinkProvider b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 34 // request opcode @@ -5437,6 +5658,8 @@ type SetProviderOutputSourceCookie struct { // SetProviderOutputSource sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetProviderOutputSource(c *xgb.Conn, Provider Provider, SourceProvider Provider, ConfigTimestamp xproto.Timestamp) SetProviderOutputSourceCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetProviderOutputSource' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5448,6 +5671,8 @@ func SetProviderOutputSource(c *xgb.Conn, Provider Provider, SourceProvider Prov // SetProviderOutputSourceChecked sends a checked request. // If an error occurs, it can be retrieved using SetProviderOutputSourceCookie.Check() func SetProviderOutputSourceChecked(c *xgb.Conn, Provider Provider, SourceProvider Provider, ConfigTimestamp xproto.Timestamp) SetProviderOutputSourceCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetProviderOutputSource' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5469,7 +5694,9 @@ func setProviderOutputSourceRequest(c *xgb.Conn, Provider Provider, SourceProvid b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 35 // request opcode @@ -5498,6 +5725,8 @@ type SetScreenConfigCookie struct { // SetScreenConfig sends a checked request. // If an error occurs, it will be returned with the reply by calling SetScreenConfigCookie.Reply() func SetScreenConfig(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) SetScreenConfigCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetScreenConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5509,6 +5738,8 @@ func SetScreenConfig(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timesta // SetScreenConfigUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetScreenConfigUnchecked(c *xgb.Conn, Window xproto.Window, Timestamp xproto.Timestamp, ConfigTimestamp xproto.Timestamp, SizeID uint16, Rotation uint16, Rate uint16) SetScreenConfigCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetScreenConfig' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5579,7 +5810,9 @@ func setScreenConfigRequest(c *xgb.Conn, Window xproto.Window, Timestamp xproto. b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -5619,6 +5852,8 @@ type SetScreenSizeCookie struct { // SetScreenSize sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetScreenSize(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) SetScreenSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetScreenSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5630,6 +5865,8 @@ func SetScreenSize(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint1 // SetScreenSizeChecked sends a checked request. // If an error occurs, it can be retrieved using SetScreenSizeCookie.Check() func SetScreenSizeChecked(c *xgb.Conn, Window xproto.Window, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) SetScreenSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RANDR"]; !ok { panic("Cannot issue request 'SetScreenSize' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.") } @@ -5651,7 +5888,9 @@ func setScreenSizeRequest(c *xgb.Conn, Window xproto.Window, Width uint16, Heigh b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RANDR"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode diff --git a/nexgb/record/record.go b/nexgb/record/record.go index 30be090..5469170 100644 --- a/nexgb/record/record.go +++ b/nexgb/record/record.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named RECORD could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["RECORD"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["RECORD"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["RECORD"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -523,6 +522,8 @@ type CreateContextCookie struct { // CreateContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContext(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -534,6 +535,8 @@ func CreateContext(c *xgb.Conn, Context Context, ElementHeader ElementHeader, Nu // CreateContextChecked sends a checked request. // If an error occurs, it can be retrieved using CreateContextCookie.Check() func CreateContextChecked(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -555,7 +558,9 @@ func createContextRequest(c *xgb.Conn, Context Context, ElementHeader ElementHea b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RECORD"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -600,6 +605,8 @@ type DisableContextCookie struct { // DisableContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DisableContext(c *xgb.Conn, Context Context) DisableContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'DisableContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -611,6 +618,8 @@ func DisableContext(c *xgb.Conn, Context Context) DisableContextCookie { // DisableContextChecked sends a checked request. // If an error occurs, it can be retrieved using DisableContextCookie.Check() func DisableContextChecked(c *xgb.Conn, Context Context) DisableContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'DisableContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -632,7 +641,9 @@ func disableContextRequest(c *xgb.Conn, Context Context) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RECORD"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -655,6 +666,8 @@ type EnableContextCookie struct { // EnableContext sends a checked request. // If an error occurs, it will be returned with the reply by calling EnableContextCookie.Reply() func EnableContext(c *xgb.Conn, Context Context) EnableContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'EnableContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -666,6 +679,8 @@ func EnableContext(c *xgb.Conn, Context Context) EnableContextCookie { // EnableContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func EnableContextUnchecked(c *xgb.Conn, Context Context) EnableContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'EnableContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -752,7 +767,9 @@ func enableContextRequest(c *xgb.Conn, Context Context) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RECORD"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -775,6 +792,8 @@ type FreeContextCookie struct { // FreeContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeContext(c *xgb.Conn, Context Context) FreeContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'FreeContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -786,6 +805,8 @@ func FreeContext(c *xgb.Conn, Context Context) FreeContextCookie { // FreeContextChecked sends a checked request. // If an error occurs, it can be retrieved using FreeContextCookie.Check() func FreeContextChecked(c *xgb.Conn, Context Context) FreeContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'FreeContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -807,7 +828,9 @@ func freeContextRequest(c *xgb.Conn, Context Context) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RECORD"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -830,6 +853,8 @@ type GetContextCookie struct { // GetContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetContextCookie.Reply() func GetContext(c *xgb.Conn, Context Context) GetContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'GetContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -841,6 +866,8 @@ func GetContext(c *xgb.Conn, Context Context) GetContextCookie { // GetContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetContextUnchecked(c *xgb.Conn, Context Context) GetContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'GetContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -914,7 +941,9 @@ func getContextRequest(c *xgb.Conn, Context Context) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RECORD"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -937,6 +966,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, MajorVersion uint16, MinorVersion uint16) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -948,6 +979,8 @@ func QueryVersion(c *xgb.Conn, MajorVersion uint16, MinorVersion uint16) QueryVe // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint16, MinorVersion uint16) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -1006,7 +1039,9 @@ func queryVersionRequest(c *xgb.Conn, MajorVersion uint16, MinorVersion uint16) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RECORD"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -1032,6 +1067,8 @@ type RegisterClientsCookie struct { // RegisterClients sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RegisterClients(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) RegisterClientsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'RegisterClients' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -1043,6 +1080,8 @@ func RegisterClients(c *xgb.Conn, Context Context, ElementHeader ElementHeader, // RegisterClientsChecked sends a checked request. // If an error occurs, it can be retrieved using RegisterClientsCookie.Check() func RegisterClientsChecked(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) RegisterClientsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'RegisterClients' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -1064,7 +1103,9 @@ func registerClientsRequest(c *xgb.Conn, Context Context, ElementHeader ElementH b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RECORD"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -1109,6 +1150,8 @@ type UnregisterClientsCookie struct { // UnregisterClients sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnregisterClients(c *xgb.Conn, Context Context, NumClientSpecs uint32, ClientSpecs []ClientSpec) UnregisterClientsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'UnregisterClients' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -1120,6 +1163,8 @@ func UnregisterClients(c *xgb.Conn, Context Context, NumClientSpecs uint32, Clie // UnregisterClientsChecked sends a checked request. // If an error occurs, it can be retrieved using UnregisterClientsCookie.Check() func UnregisterClientsChecked(c *xgb.Conn, Context Context, NumClientSpecs uint32, ClientSpecs []ClientSpec) UnregisterClientsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RECORD"]; !ok { panic("Cannot issue request 'UnregisterClients' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") } @@ -1141,7 +1186,9 @@ func unregisterClientsRequest(c *xgb.Conn, Context Context, NumClientSpecs uint3 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RECORD"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode diff --git a/nexgb/render/render.go b/nexgb/render/render.go index f90065b..e15bd67 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named RENDER could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["RENDER"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["RENDER"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["RENDER"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -1582,6 +1581,8 @@ type AddGlyphsCookie struct { // AddGlyphs sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1593,6 +1594,8 @@ func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint // AddGlyphsChecked sends a checked request. // If an error occurs, it can be retrieved using AddGlyphsCookie.Check() func AddGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1614,7 +1617,9 @@ func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 20 // request opcode @@ -1654,6 +1659,8 @@ type AddTrapsCookie struct { // AddTraps sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1665,6 +1672,8 @@ func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap // AddTrapsChecked sends a checked request. // If an error occurs, it can be retrieved using AddTrapsCookie.Check() func AddTrapsChecked(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1686,7 +1695,9 @@ func addTrapsRequest(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 32 // request opcode @@ -1717,6 +1728,8 @@ type ChangePictureCookie struct { // ChangePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1728,6 +1741,8 @@ func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []u // ChangePictureChecked sends a checked request. // If an error occurs, it can be retrieved using ChangePictureCookie.Check() func ChangePictureChecked(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1749,7 +1764,9 @@ func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueL b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -1780,6 +1797,8 @@ type CompositeCookie struct { // Composite sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1791,6 +1810,8 @@ func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, Src // CompositeChecked sends a checked request. // If an error occurs, it can be retrieved using CompositeCookie.Check() func CompositeChecked(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1812,7 +1833,9 @@ func compositeRequest(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Pictu b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -1870,6 +1893,8 @@ type CompositeGlyphs16Cookie struct { // CompositeGlyphs16 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1881,6 +1906,8 @@ func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskForma // CompositeGlyphs16Checked sends a checked request. // If an error occurs, it can be retrieved using CompositeGlyphs16Cookie.Check() func CompositeGlyphs16Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1902,7 +1929,9 @@ func compositeGlyphs16Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Ma b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 24 // request opcode @@ -1948,6 +1977,8 @@ type CompositeGlyphs32Cookie struct { // CompositeGlyphs32 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1959,6 +1990,8 @@ func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskForma // CompositeGlyphs32Checked sends a checked request. // If an error occurs, it can be retrieved using CompositeGlyphs32Cookie.Check() func CompositeGlyphs32Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1980,7 +2013,9 @@ func compositeGlyphs32Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Ma b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 25 // request opcode @@ -2026,6 +2061,8 @@ type CompositeGlyphs8Cookie struct { // CompositeGlyphs8 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2037,6 +2074,8 @@ func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat // CompositeGlyphs8Checked sends a checked request. // If an error occurs, it can be retrieved using CompositeGlyphs8Cookie.Check() func CompositeGlyphs8Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2058,7 +2097,9 @@ func compositeGlyphs8Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Mas b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 23 // request opcode @@ -2104,6 +2145,8 @@ type CreateAnimCursorCookie struct { // CreateAnimCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2115,6 +2158,8 @@ func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) C // CreateAnimCursorChecked sends a checked request. // If an error occurs, it can be retrieved using CreateAnimCursorCookie.Check() func CreateAnimCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2136,7 +2181,9 @@ func createAnimCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcurso b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 31 // request opcode @@ -2161,6 +2208,8 @@ type CreateConicalGradientCookie struct { // CreateConicalGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2172,6 +2221,8 @@ func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle // CreateConicalGradientChecked sends a checked request. // If an error occurs, it can be retrieved using CreateConicalGradientCookie.Check() func CreateConicalGradientChecked(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2193,7 +2244,9 @@ func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 36 // request opcode @@ -2239,6 +2292,8 @@ type CreateCursorCookie struct { // CreateCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2250,6 +2305,8 @@ func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y ui // CreateCursorChecked sends a checked request. // If an error occurs, it can be retrieved using CreateCursorCookie.Check() func CreateCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2271,7 +2328,9 @@ func createCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint1 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 27 // request opcode @@ -2303,6 +2362,8 @@ type CreateGlyphSetCookie struct { // CreateGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2314,6 +2375,8 @@ func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSe // CreateGlyphSetChecked sends a checked request. // If an error occurs, it can be retrieved using CreateGlyphSetCookie.Check() func CreateGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2335,7 +2398,9 @@ func createGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Format Pictformat) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 17 // request opcode @@ -2361,6 +2426,8 @@ type CreateLinearGradientCookie struct { // CreateLinearGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2372,6 +2439,8 @@ func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix // CreateLinearGradientChecked sends a checked request. // If an error occurs, it can be retrieved using CreateLinearGradientCookie.Check() func CreateLinearGradientChecked(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2393,7 +2462,9 @@ func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 P b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 34 // request opcode @@ -2442,6 +2513,8 @@ type CreatePictureCookie struct { // CreatePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2453,6 +2526,8 @@ func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pi // CreatePictureChecked sends a checked request. // If an error occurs, it can be retrieved using CreatePictureCookie.Check() func CreatePictureChecked(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2474,7 +2549,9 @@ func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Fo b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -2511,6 +2588,8 @@ type CreateRadialGradientCookie struct { // CreateRadialGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2522,6 +2601,8 @@ func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Po // CreateRadialGradientChecked sends a checked request. // If an error occurs, it can be retrieved using CreateRadialGradientCookie.Check() func CreateRadialGradientChecked(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2543,7 +2624,9 @@ func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, O b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 35 // request opcode @@ -2598,6 +2681,8 @@ type CreateSolidFillCookie struct { // CreateSolidFill sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2609,6 +2694,8 @@ func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillC // CreateSolidFillChecked sends a checked request. // If an error occurs, it can be retrieved using CreateSolidFillCookie.Check() func CreateSolidFillChecked(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2630,7 +2717,9 @@ func createSolidFillRequest(c *xgb.Conn, Picture Picture, Color Color) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 33 // request opcode @@ -2659,6 +2748,8 @@ type FillRectanglesCookie struct { // FillRectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2670,6 +2761,8 @@ func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xpro // FillRectanglesChecked sends a checked request. // If an error occurs, it can be retrieved using FillRectanglesCookie.Check() func FillRectanglesChecked(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2691,7 +2784,9 @@ func fillRectanglesRequest(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 26 // request opcode @@ -2727,6 +2822,8 @@ type FreeGlyphSetCookie struct { // FreeGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeGlyphSet(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreeGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2738,6 +2835,8 @@ func FreeGlyphSet(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { // FreeGlyphSetChecked sends a checked request. // If an error occurs, it can be retrieved using FreeGlyphSetCookie.Check() func FreeGlyphSetChecked(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreeGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2759,7 +2858,9 @@ func freeGlyphSetRequest(c *xgb.Conn, Glyphset Glyphset) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 19 // request opcode @@ -2782,6 +2883,8 @@ type FreeGlyphsCookie struct { // FreeGlyphs sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeGlyphs(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreeGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2793,6 +2896,8 @@ func FreeGlyphs(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie // FreeGlyphsChecked sends a checked request. // If an error occurs, it can be retrieved using FreeGlyphsCookie.Check() func FreeGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreeGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2814,7 +2919,9 @@ func freeGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 22 // request opcode @@ -2842,6 +2949,8 @@ type FreePictureCookie struct { // FreePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2853,6 +2962,8 @@ func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { // FreePictureChecked sends a checked request. // If an error occurs, it can be retrieved using FreePictureCookie.Check() func FreePictureChecked(c *xgb.Conn, Picture Picture) FreePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2874,7 +2985,9 @@ func freePictureRequest(c *xgb.Conn, Picture Picture) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -2897,6 +3010,8 @@ type QueryFiltersCookie struct { // QueryFilters sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryFiltersCookie.Reply() func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2908,6 +3023,8 @@ func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { // QueryFiltersUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryFiltersUnchecked(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2980,7 +3097,9 @@ func queryFiltersRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 29 // request opcode @@ -3003,6 +3122,8 @@ type QueryPictFormatsCookie struct { // QueryPictFormats sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryPictFormatsCookie.Reply() func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3014,6 +3135,8 @@ func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { // QueryPictFormatsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPictFormatsUnchecked(c *xgb.Conn) QueryPictFormatsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3108,7 +3231,9 @@ func queryPictFormatsRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -3128,6 +3253,8 @@ type QueryPictIndexValuesCookie struct { // QueryPictIndexValues sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryPictIndexValuesCookie.Reply() func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3139,6 +3266,8 @@ func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCo // QueryPictIndexValuesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPictIndexValuesUnchecked(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3200,7 +3329,9 @@ func queryPictIndexValuesRequest(c *xgb.Conn, Format Pictformat) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -3223,6 +3354,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3234,6 +3367,8 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uin // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3295,7 +3430,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -3321,6 +3458,8 @@ type ReferenceGlyphSetCookie struct { // ReferenceGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3332,6 +3471,8 @@ func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceG // ReferenceGlyphSetChecked sends a checked request. // If an error occurs, it can be retrieved using ReferenceGlyphSetCookie.Check() func ReferenceGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3353,7 +3494,9 @@ func referenceGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) []b b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 18 // request opcode @@ -3379,6 +3522,8 @@ type SetPictureClipRectanglesCookie struct { // SetPictureClipRectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3390,6 +3535,8 @@ func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, C // SetPictureClipRectanglesChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureClipRectanglesCookie.Check() func SetPictureClipRectanglesChecked(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3411,7 +3558,9 @@ func setPictureClipRectanglesRequest(c *xgb.Conn, Picture Picture, ClipXOrigin i b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -3442,6 +3591,8 @@ type SetPictureFilterCookie struct { // SetPictureFilter sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureFilter(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureFilter' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3453,6 +3604,8 @@ func SetPictureFilter(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter str // SetPictureFilterChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureFilterCookie.Check() func SetPictureFilterChecked(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureFilter' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3474,7 +3627,9 @@ func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Fil b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 30 // request opcode @@ -3514,6 +3669,8 @@ type SetPictureTransformCookie struct { // SetPictureTransform sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3525,6 +3682,8 @@ func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetP // SetPictureTransformChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureTransformCookie.Check() func SetPictureTransformChecked(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3546,7 +3705,9 @@ func setPictureTransformRequest(c *xgb.Conn, Picture Picture, Transform Transfor b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 28 // request opcode @@ -3575,6 +3736,8 @@ type TrapezoidsCookie struct { // Trapezoids sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3586,6 +3749,8 @@ func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictf // TrapezoidsChecked sends a checked request. // If an error occurs, it can be retrieved using TrapezoidsCookie.Check() func TrapezoidsChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3607,7 +3772,9 @@ func trapezoidsRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskForma b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -3649,6 +3816,8 @@ type TriFanCookie struct { // TriFan sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3660,6 +3829,8 @@ func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictforma // TriFanChecked sends a checked request. // If an error occurs, it can be retrieved using TriFanCookie.Check() func TriFanChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3681,7 +3852,9 @@ func triFanRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pi b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode @@ -3723,6 +3896,8 @@ type TriStripCookie struct { // TriStrip sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3734,6 +3909,8 @@ func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictfor // TriStripChecked sends a checked request. // If an error occurs, it can be retrieved using TriStripCookie.Check() func TriStripChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3755,7 +3932,9 @@ func triStripRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -3797,6 +3976,8 @@ type TrianglesCookie struct { // Triangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3808,6 +3989,8 @@ func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictfo // TrianglesChecked sends a checked request. // If an error occurs, it can be retrieved using TrianglesCookie.Check() func TrianglesChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3829,7 +4012,9 @@ func trianglesRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode diff --git a/nexgb/res/res.go b/nexgb/res/res.go index dd53857..e3d7b02 100644 --- a/nexgb/res/res.go +++ b/nexgb/res/res.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named X-Resource could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["X-Resource"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["X-Resource"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["X-Resource"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -511,6 +510,8 @@ type QueryClientIdsCookie struct { // QueryClientIds sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryClientIdsCookie.Reply() func QueryClientIds(c *xgb.Conn, NumSpecs uint32, Specs []ClientIdSpec) QueryClientIdsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryClientIds' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -522,6 +523,8 @@ func QueryClientIds(c *xgb.Conn, NumSpecs uint32, Specs []ClientIdSpec) QueryCli // QueryClientIdsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryClientIdsUnchecked(c *xgb.Conn, NumSpecs uint32, Specs []ClientIdSpec) QueryClientIdsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryClientIds' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -583,7 +586,9 @@ func queryClientIdsRequest(c *xgb.Conn, NumSpecs uint32, Specs []ClientIdSpec) [ b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["X-Resource"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -608,6 +613,8 @@ type QueryClientPixmapBytesCookie struct { // QueryClientPixmapBytes sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryClientPixmapBytesCookie.Reply() func QueryClientPixmapBytes(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryClientPixmapBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -619,6 +626,8 @@ func QueryClientPixmapBytes(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCooki // QueryClientPixmapBytesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryClientPixmapBytesUnchecked(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryClientPixmapBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -677,7 +686,9 @@ func queryClientPixmapBytesRequest(c *xgb.Conn, Xid uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["X-Resource"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -700,6 +711,8 @@ type QueryClientResourcesCookie struct { // QueryClientResources sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryClientResourcesCookie.Reply() func QueryClientResources(c *xgb.Conn, Xid uint32) QueryClientResourcesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryClientResources' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -711,6 +724,8 @@ func QueryClientResources(c *xgb.Conn, Xid uint32) QueryClientResourcesCookie { // QueryClientResourcesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryClientResourcesUnchecked(c *xgb.Conn, Xid uint32) QueryClientResourcesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryClientResources' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -772,7 +787,9 @@ func queryClientResourcesRequest(c *xgb.Conn, Xid uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["X-Resource"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -795,6 +812,8 @@ type QueryClientsCookie struct { // QueryClients sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryClientsCookie.Reply() func QueryClients(c *xgb.Conn) QueryClientsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryClients' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -806,6 +825,8 @@ func QueryClients(c *xgb.Conn) QueryClientsCookie { // QueryClientsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryClientsUnchecked(c *xgb.Conn) QueryClientsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryClients' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -867,7 +888,9 @@ func queryClientsRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["X-Resource"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -887,6 +910,8 @@ type QueryResourceBytesCookie struct { // QueryResourceBytes sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryResourceBytesCookie.Reply() func QueryResourceBytes(c *xgb.Conn, Client uint32, NumSpecs uint32, Specs []ResourceIdSpec) QueryResourceBytesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryResourceBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -898,6 +923,8 @@ func QueryResourceBytes(c *xgb.Conn, Client uint32, NumSpecs uint32, Specs []Res // QueryResourceBytesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryResourceBytesUnchecked(c *xgb.Conn, Client uint32, NumSpecs uint32, Specs []ResourceIdSpec) QueryResourceBytesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryResourceBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -959,7 +986,9 @@ func queryResourceBytesRequest(c *xgb.Conn, Client uint32, NumSpecs uint32, Spec b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["X-Resource"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -987,6 +1016,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -998,6 +1029,8 @@ func QueryVersion(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionC // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["X-Resource"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") } @@ -1056,7 +1089,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajor byte, ClientMinor byte) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["X-Resource"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode diff --git a/nexgb/screensaver/screensaver.go b/nexgb/screensaver/screensaver.go index ea60367..418576c 100644 --- a/nexgb/screensaver/screensaver.go +++ b/nexgb/screensaver/screensaver.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named MIT-SCREEN-SAVER could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["MIT-SCREEN-SAVER"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["MIT-SCREEN-SAVER"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["MIT-SCREEN-SAVER"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -198,6 +197,8 @@ type QueryInfoCookie struct { // QueryInfo sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryInfoCookie.Reply() func QueryInfo(c *xgb.Conn, Drawable xproto.Drawable) QueryInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'QueryInfo' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -209,6 +210,8 @@ func QueryInfo(c *xgb.Conn, Drawable xproto.Drawable) QueryInfoCookie { // QueryInfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryInfoUnchecked(c *xgb.Conn, Drawable xproto.Drawable) QueryInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'QueryInfo' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -283,7 +286,9 @@ func queryInfoRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SCREEN-SAVER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -306,6 +311,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajorVersion byte, ClientMinorVersion byte) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -317,6 +324,8 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion byte, ClientMinorVersion byte) // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion byte, ClientMinorVersion byte) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -378,7 +387,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion byte, ClientMinorVersio b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SCREEN-SAVER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -406,6 +417,8 @@ type SelectInputCookie struct { // SelectInput sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectInput(c *xgb.Conn, Drawable xproto.Drawable, EventMask uint32) SelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'SelectInput' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -417,6 +430,8 @@ func SelectInput(c *xgb.Conn, Drawable xproto.Drawable, EventMask uint32) Select // SelectInputChecked sends a checked request. // If an error occurs, it can be retrieved using SelectInputCookie.Check() func SelectInputChecked(c *xgb.Conn, Drawable xproto.Drawable, EventMask uint32) SelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'SelectInput' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -438,7 +453,9 @@ func selectInputRequest(c *xgb.Conn, Drawable xproto.Drawable, EventMask uint32) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SCREEN-SAVER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -464,6 +481,8 @@ type SetAttributesCookie struct { // SetAttributes sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetAttributes(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class byte, Depth byte, Visual xproto.Visualid, ValueMask uint32, ValueList []uint32) SetAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'SetAttributes' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -475,6 +494,8 @@ func SetAttributes(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int16, Widt // SetAttributesChecked sends a checked request. // If an error occurs, it can be retrieved using SetAttributesCookie.Check() func SetAttributesChecked(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class byte, Depth byte, Visual xproto.Visualid, ValueMask uint32, ValueList []uint32) SetAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'SetAttributes' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -496,7 +517,9 @@ func setAttributesRequest(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int1 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SCREEN-SAVER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -551,6 +574,8 @@ type SuspendCookie struct { // Suspend sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Suspend(c *xgb.Conn, Suspend bool) SuspendCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'Suspend' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -562,6 +587,8 @@ func Suspend(c *xgb.Conn, Suspend bool) SuspendCookie { // SuspendChecked sends a checked request. // If an error occurs, it can be retrieved using SuspendCookie.Check() func SuspendChecked(c *xgb.Conn, Suspend bool) SuspendCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'Suspend' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -583,7 +610,9 @@ func suspendRequest(c *xgb.Conn, Suspend bool) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SCREEN-SAVER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -612,6 +641,8 @@ type UnsetAttributesCookie struct { // UnsetAttributes sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnsetAttributes(c *xgb.Conn, Drawable xproto.Drawable) UnsetAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'UnsetAttributes' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -623,6 +654,8 @@ func UnsetAttributes(c *xgb.Conn, Drawable xproto.Drawable) UnsetAttributesCooki // UnsetAttributesChecked sends a checked request. // If an error occurs, it can be retrieved using UnsetAttributesCookie.Check() func UnsetAttributesChecked(c *xgb.Conn, Drawable xproto.Drawable) UnsetAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok { panic("Cannot issue request 'UnsetAttributes' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.") } @@ -644,7 +677,9 @@ func unsetAttributesRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SCREEN-SAVER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode diff --git a/nexgb/shape/shape.go b/nexgb/shape/shape.go index 93ff9d0..7069f7e 100644 --- a/nexgb/shape/shape.go +++ b/nexgb/shape/shape.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named SHAPE could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["SHAPE"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["SHAPE"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["SHAPE"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -214,6 +213,8 @@ type CombineCookie struct { // Combine sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Combine(c *xgb.Conn, Operation Op, DestinationKind Kind, SourceKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceWindow xproto.Window) CombineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'Combine' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -225,6 +226,8 @@ func Combine(c *xgb.Conn, Operation Op, DestinationKind Kind, SourceKind Kind, D // CombineChecked sends a checked request. // If an error occurs, it can be retrieved using CombineCookie.Check() func CombineChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, SourceKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceWindow xproto.Window) CombineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'Combine' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -246,7 +249,9 @@ func combineRequest(c *xgb.Conn, Operation Op, DestinationKind Kind, SourceKind b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SHAPE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -289,6 +294,8 @@ type GetRectanglesCookie struct { // GetRectangles sends a checked request. // If an error occurs, it will be returned with the reply by calling GetRectanglesCookie.Reply() func GetRectangles(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'GetRectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -300,6 +307,8 @@ func GetRectangles(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectan // GetRectanglesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetRectanglesUnchecked(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'GetRectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -362,7 +371,9 @@ func getRectanglesRequest(c *xgb.Conn, Window xproto.Window, SourceKind Kind) [] b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SHAPE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -390,6 +401,8 @@ type InputSelectedCookie struct { // InputSelected sends a checked request. // If an error occurs, it will be returned with the reply by calling InputSelectedCookie.Reply() func InputSelected(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'InputSelected' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -401,6 +414,8 @@ func InputSelected(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCo // InputSelectedUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func InputSelectedUnchecked(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'InputSelected' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -456,7 +471,9 @@ func inputSelectedRequest(c *xgb.Conn, DestinationWindow xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SHAPE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -479,6 +496,8 @@ type MaskCookie struct { // Mask sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Mask(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) MaskCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'Mask' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -490,6 +509,8 @@ func Mask(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xpr // MaskChecked sends a checked request. // If an error occurs, it can be retrieved using MaskCookie.Check() func MaskChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) MaskCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'Mask' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -511,7 +532,9 @@ func maskRequest(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWin b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SHAPE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -551,6 +574,8 @@ type OffsetCookie struct { // Offset sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Offset(c *xgb.Conn, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16) OffsetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'Offset' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -562,6 +587,8 @@ func Offset(c *xgb.Conn, DestinationKind Kind, DestinationWindow xproto.Window, // OffsetChecked sends a checked request. // If an error occurs, it can be retrieved using OffsetCookie.Check() func OffsetChecked(c *xgb.Conn, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16) OffsetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'Offset' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -583,7 +610,9 @@ func offsetRequest(c *xgb.Conn, DestinationKind Kind, DestinationWindow xproto.W b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SHAPE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -617,6 +646,8 @@ type QueryExtentsCookie struct { // QueryExtents sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryExtentsCookie.Reply() func QueryExtents(c *xgb.Conn, DestinationWindow xproto.Window) QueryExtentsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'QueryExtents' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -628,6 +659,8 @@ func QueryExtents(c *xgb.Conn, DestinationWindow xproto.Window) QueryExtentsCook // QueryExtentsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryExtentsUnchecked(c *xgb.Conn, DestinationWindow xproto.Window) QueryExtentsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'QueryExtents' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -729,7 +762,9 @@ func queryExtentsRequest(c *xgb.Conn, DestinationWindow xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SHAPE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -752,6 +787,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -763,6 +800,8 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -821,7 +860,9 @@ func queryVersionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SHAPE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -841,6 +882,8 @@ type RectanglesCookie struct { // Rectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Rectangles(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) RectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'Rectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -852,6 +895,8 @@ func Rectangles(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, // RectanglesChecked sends a checked request. // If an error occurs, it can be retrieved using RectanglesCookie.Check() func RectanglesChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) RectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'Rectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -873,7 +918,9 @@ func rectanglesRequest(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SHAPE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -915,6 +962,8 @@ type SelectInputCookie struct { // SelectInput sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectInput(c *xgb.Conn, DestinationWindow xproto.Window, Enable bool) SelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'SelectInput' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -926,6 +975,8 @@ func SelectInput(c *xgb.Conn, DestinationWindow xproto.Window, Enable bool) Sele // SelectInputChecked sends a checked request. // If an error occurs, it can be retrieved using SelectInputCookie.Check() func SelectInputChecked(c *xgb.Conn, DestinationWindow xproto.Window, Enable bool) SelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SHAPE"]; !ok { panic("Cannot issue request 'SelectInput' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") } @@ -947,7 +998,9 @@ func selectInputRequest(c *xgb.Conn, DestinationWindow xproto.Window, Enable boo b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SHAPE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode diff --git a/nexgb/shm/shm.go b/nexgb/shm/shm.go index e5841ca..b310c34 100644 --- a/nexgb/shm/shm.go +++ b/nexgb/shm/shm.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named MIT-SHM could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["MIT-SHM"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["MIT-SHM"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["MIT-SHM"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -217,6 +216,8 @@ type AttachCookie struct { // Attach sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Attach(c *xgb.Conn, Shmseg Seg, Shmid uint32, ReadOnly bool) AttachCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'Attach' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -228,6 +229,8 @@ func Attach(c *xgb.Conn, Shmseg Seg, Shmid uint32, ReadOnly bool) AttachCookie { // AttachChecked sends a checked request. // If an error occurs, it can be retrieved using AttachCookie.Check() func AttachChecked(c *xgb.Conn, Shmseg Seg, Shmid uint32, ReadOnly bool) AttachCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'Attach' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -249,7 +252,9 @@ func attachRequest(c *xgb.Conn, Shmseg Seg, Shmid uint32, ReadOnly bool) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SHM"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -284,6 +289,8 @@ type AttachFdCookie struct { // AttachFd sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AttachFd(c *xgb.Conn, Shmseg Seg, ReadOnly bool) AttachFdCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'AttachFd' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -295,6 +302,8 @@ func AttachFd(c *xgb.Conn, Shmseg Seg, ReadOnly bool) AttachFdCookie { // AttachFdChecked sends a checked request. // If an error occurs, it can be retrieved using AttachFdCookie.Check() func AttachFdChecked(c *xgb.Conn, Shmseg Seg, ReadOnly bool) AttachFdCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'AttachFd' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -316,7 +325,9 @@ func attachFdRequest(c *xgb.Conn, Shmseg Seg, ReadOnly bool) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SHM"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -348,6 +359,8 @@ type CreatePixmapCookie struct { // CreatePixmap sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreatePixmap(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawable, Width uint16, Height uint16, Depth byte, Shmseg Seg, Offset uint32) CreatePixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -359,6 +372,8 @@ func CreatePixmap(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawable, Widt // CreatePixmapChecked sends a checked request. // If an error occurs, it can be retrieved using CreatePixmapCookie.Check() func CreatePixmapChecked(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawable, Width uint16, Height uint16, Depth byte, Shmseg Seg, Offset uint32) CreatePixmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -380,7 +395,9 @@ func createPixmapRequest(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawabl b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SHM"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -423,6 +440,8 @@ type CreateSegmentCookie struct { // CreateSegment sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateSegmentCookie.Reply() func CreateSegment(c *xgb.Conn, Shmseg Seg, Size uint32, ReadOnly bool) CreateSegmentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'CreateSegment' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -434,6 +453,8 @@ func CreateSegment(c *xgb.Conn, Shmseg Seg, Size uint32, ReadOnly bool) CreateSe // CreateSegmentUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSegmentUnchecked(c *xgb.Conn, Shmseg Seg, Size uint32, ReadOnly bool) CreateSegmentCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'CreateSegment' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -488,7 +509,9 @@ func createSegmentRequest(c *xgb.Conn, Shmseg Seg, Size uint32, ReadOnly bool) [ b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SHM"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -523,6 +546,8 @@ type DetachCookie struct { // Detach sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Detach(c *xgb.Conn, Shmseg Seg) DetachCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'Detach' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -534,6 +559,8 @@ func Detach(c *xgb.Conn, Shmseg Seg) DetachCookie { // DetachChecked sends a checked request. // If an error occurs, it can be retrieved using DetachCookie.Check() func DetachChecked(c *xgb.Conn, Shmseg Seg) DetachCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'Detach' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -555,7 +582,9 @@ func detachRequest(c *xgb.Conn, Shmseg Seg) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SHM"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -578,6 +607,8 @@ type GetImageCookie struct { // GetImage sends a checked request. // If an error occurs, it will be returned with the reply by calling GetImageCookie.Reply() func GetImage(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32, Format byte, Shmseg Seg, Offset uint32) GetImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'GetImage' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -589,6 +620,8 @@ func GetImage(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int16, Width uin // GetImageUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetImageUnchecked(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32, Format byte, Shmseg Seg, Offset uint32) GetImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'GetImage' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -648,7 +681,9 @@ func getImageRequest(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int16, Wi b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SHM"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -697,6 +732,8 @@ type PutImageCookie struct { // PutImage sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PutImage(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Seg, Offset uint32) PutImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'PutImage' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -708,6 +745,8 @@ func PutImage(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, TotalWi // PutImageChecked sends a checked request. // If an error occurs, it can be retrieved using PutImageCookie.Check() func PutImageChecked(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Seg, Offset uint32) PutImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'PutImage' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -729,7 +768,9 @@ func putImageRequest(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SHM"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -796,6 +837,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -807,6 +850,8 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["MIT-SHM"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.") } @@ -885,7 +930,9 @@ func queryVersionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["MIT-SHM"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode diff --git a/nexgb/xcmisc/xcmisc.go b/nexgb/xcmisc/xcmisc.go index 2240ee1..1778057 100644 --- a/nexgb/xcmisc/xcmisc.go +++ b/nexgb/xcmisc/xcmisc.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XC-MISC could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XC-MISC"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XC-MISC"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XC-MISC"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -69,6 +68,8 @@ type GetVersionCookie struct { // GetVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling GetVersionCookie.Reply() func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XC-MISC"]; !ok { panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") } @@ -80,6 +81,8 @@ func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint1 // GetVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XC-MISC"]; !ok { panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") } @@ -138,7 +141,9 @@ func getVersionRequest(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersio b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XC-MISC"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -164,6 +169,8 @@ type GetXIDListCookie struct { // GetXIDList sends a checked request. // If an error occurs, it will be returned with the reply by calling GetXIDListCookie.Reply() func GetXIDList(c *xgb.Conn, Count uint32) GetXIDListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XC-MISC"]; !ok { panic("Cannot issue request 'GetXIDList' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") } @@ -175,6 +182,8 @@ func GetXIDList(c *xgb.Conn, Count uint32) GetXIDListCookie { // GetXIDListUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetXIDListUnchecked(c *xgb.Conn, Count uint32) GetXIDListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XC-MISC"]; !ok { panic("Cannot issue request 'GetXIDList' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") } @@ -239,7 +248,9 @@ func getXIDListRequest(c *xgb.Conn, Count uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XC-MISC"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -262,6 +273,8 @@ type GetXIDRangeCookie struct { // GetXIDRange sends a checked request. // If an error occurs, it will be returned with the reply by calling GetXIDRangeCookie.Reply() func GetXIDRange(c *xgb.Conn) GetXIDRangeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XC-MISC"]; !ok { panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") } @@ -273,6 +286,8 @@ func GetXIDRange(c *xgb.Conn) GetXIDRangeCookie { // GetXIDRangeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetXIDRangeUnchecked(c *xgb.Conn) GetXIDRangeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XC-MISC"]; !ok { panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") } @@ -331,7 +346,9 @@ func getXIDRangeRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XC-MISC"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode diff --git a/nexgb/xevie/xevie.go b/nexgb/xevie/xevie.go index 7e18f8d..180312b 100644 --- a/nexgb/xevie/xevie.go +++ b/nexgb/xevie/xevie.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XEVIE could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XEVIE"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XEVIE"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XEVIE"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -119,6 +118,8 @@ type EndCookie struct { // End sends a checked request. // If an error occurs, it will be returned with the reply by calling EndCookie.Reply() func End(c *xgb.Conn, Cmap uint32) EndCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'End' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -130,6 +131,8 @@ func End(c *xgb.Conn, Cmap uint32) EndCookie { // EndUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func EndUnchecked(c *xgb.Conn, Cmap uint32) EndCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'End' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -183,7 +186,9 @@ func endRequest(c *xgb.Conn, Cmap uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XEVIE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -206,6 +211,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -217,6 +224,8 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uin // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -278,7 +287,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVers b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XEVIE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -304,6 +315,8 @@ type SelectInputCookie struct { // SelectInput sends a checked request. // If an error occurs, it will be returned with the reply by calling SelectInputCookie.Reply() func SelectInput(c *xgb.Conn, EventMask uint32) SelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'SelectInput' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -315,6 +328,8 @@ func SelectInput(c *xgb.Conn, EventMask uint32) SelectInputCookie { // SelectInputUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectInputUnchecked(c *xgb.Conn, EventMask uint32) SelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'SelectInput' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -368,7 +383,9 @@ func selectInputRequest(c *xgb.Conn, EventMask uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XEVIE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -391,6 +408,8 @@ type SendCookie struct { // Send sends a checked request. // If an error occurs, it will be returned with the reply by calling SendCookie.Reply() func Send(c *xgb.Conn, Event Event, DataType uint32) SendCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'Send' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -402,6 +421,8 @@ func Send(c *xgb.Conn, Event Event, DataType uint32) SendCookie { // SendUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SendUnchecked(c *xgb.Conn, Event Event, DataType uint32) SendCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'Send' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -455,7 +476,9 @@ func sendRequest(c *xgb.Conn, Event Event, DataType uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XEVIE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -486,6 +509,8 @@ type StartCookie struct { // Start sends a checked request. // If an error occurs, it will be returned with the reply by calling StartCookie.Reply() func Start(c *xgb.Conn, Screen uint32) StartCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'Start' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -497,6 +522,8 @@ func Start(c *xgb.Conn, Screen uint32) StartCookie { // StartUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func StartUnchecked(c *xgb.Conn, Screen uint32) StartCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XEVIE"]; !ok { panic("Cannot issue request 'Start' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") } @@ -550,7 +577,9 @@ func startRequest(c *xgb.Conn, Screen uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XEVIE"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode diff --git a/nexgb/xf86dri/xf86dri.go b/nexgb/xf86dri/xf86dri.go index 6a07e41..51c9322 100644 --- a/nexgb/xf86dri/xf86dri.go +++ b/nexgb/xf86dri/xf86dri.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XFree86-DRI could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XFree86-DRI"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XFree86-DRI"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XFree86-DRI"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -137,6 +136,8 @@ type AuthConnectionCookie struct { // AuthConnection sends a checked request. // If an error occurs, it will be returned with the reply by calling AuthConnectionCookie.Reply() func AuthConnection(c *xgb.Conn, Screen uint32, Magic uint32) AuthConnectionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'AuthConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -148,6 +149,8 @@ func AuthConnection(c *xgb.Conn, Screen uint32, Magic uint32) AuthConnectionCook // AuthConnectionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AuthConnectionUnchecked(c *xgb.Conn, Screen uint32, Magic uint32) AuthConnectionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'AuthConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -202,7 +205,9 @@ func authConnectionRequest(c *xgb.Conn, Screen uint32, Magic uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode @@ -228,6 +233,8 @@ type CloseConnectionCookie struct { // CloseConnection sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CloseConnection(c *xgb.Conn, Screen uint32) CloseConnectionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'CloseConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -239,6 +246,8 @@ func CloseConnection(c *xgb.Conn, Screen uint32) CloseConnectionCookie { // CloseConnectionChecked sends a checked request. // If an error occurs, it can be retrieved using CloseConnectionCookie.Check() func CloseConnectionChecked(c *xgb.Conn, Screen uint32) CloseConnectionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'CloseConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -260,7 +269,9 @@ func closeConnectionRequest(c *xgb.Conn, Screen uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -283,6 +294,8 @@ type CreateContextCookie struct { // CreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateContextCookie.Reply() func CreateContext(c *xgb.Conn, Screen uint32, Visual uint32, Context uint32) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -294,6 +307,8 @@ func CreateContext(c *xgb.Conn, Screen uint32, Visual uint32, Context uint32) Cr // CreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContextUnchecked(c *xgb.Conn, Screen uint32, Visual uint32, Context uint32) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -348,7 +363,9 @@ func createContextRequest(c *xgb.Conn, Screen uint32, Visual uint32, Context uin b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -377,6 +394,8 @@ type CreateDrawableCookie struct { // CreateDrawable sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateDrawableCookie.Reply() func CreateDrawable(c *xgb.Conn, Screen uint32, Drawable uint32) CreateDrawableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'CreateDrawable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -388,6 +407,8 @@ func CreateDrawable(c *xgb.Conn, Screen uint32, Drawable uint32) CreateDrawableC // CreateDrawableUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateDrawableUnchecked(c *xgb.Conn, Screen uint32, Drawable uint32) CreateDrawableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'CreateDrawable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -442,7 +463,9 @@ func createDrawableRequest(c *xgb.Conn, Screen uint32, Drawable uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -468,6 +491,8 @@ type DestroyContextCookie struct { // DestroyContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyContext(c *xgb.Conn, Screen uint32, Context uint32) DestroyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -479,6 +504,8 @@ func DestroyContext(c *xgb.Conn, Screen uint32, Context uint32) DestroyContextCo // DestroyContextChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyContextCookie.Check() func DestroyContextChecked(c *xgb.Conn, Screen uint32, Context uint32) DestroyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -500,7 +527,9 @@ func destroyContextRequest(c *xgb.Conn, Screen uint32, Context uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -526,6 +555,8 @@ type DestroyDrawableCookie struct { // DestroyDrawable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyDrawable(c *xgb.Conn, Screen uint32, Drawable uint32) DestroyDrawableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'DestroyDrawable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -537,6 +568,8 @@ func DestroyDrawable(c *xgb.Conn, Screen uint32, Drawable uint32) DestroyDrawabl // DestroyDrawableChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyDrawableCookie.Check() func DestroyDrawableChecked(c *xgb.Conn, Screen uint32, Drawable uint32) DestroyDrawableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'DestroyDrawable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -558,7 +591,9 @@ func destroyDrawableRequest(c *xgb.Conn, Screen uint32, Drawable uint32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -584,6 +619,8 @@ type GetClientDriverNameCookie struct { // GetClientDriverName sends a checked request. // If an error occurs, it will be returned with the reply by calling GetClientDriverNameCookie.Reply() func GetClientDriverName(c *xgb.Conn, Screen uint32) GetClientDriverNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'GetClientDriverName' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -595,6 +632,8 @@ func GetClientDriverName(c *xgb.Conn, Screen uint32) GetClientDriverNameCookie { // GetClientDriverNameUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetClientDriverNameUnchecked(c *xgb.Conn, Screen uint32) GetClientDriverNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'GetClientDriverName' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -672,7 +711,9 @@ func getClientDriverNameRequest(c *xgb.Conn, Screen uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -695,6 +736,8 @@ type GetDeviceInfoCookie struct { // GetDeviceInfo sends a checked request. // If an error occurs, it will be returned with the reply by calling GetDeviceInfoCookie.Reply() func GetDeviceInfo(c *xgb.Conn, Screen uint32) GetDeviceInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'GetDeviceInfo' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -706,6 +749,8 @@ func GetDeviceInfo(c *xgb.Conn, Screen uint32) GetDeviceInfoCookie { // GetDeviceInfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDeviceInfoUnchecked(c *xgb.Conn, Screen uint32) GetDeviceInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'GetDeviceInfo' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -787,7 +832,9 @@ func getDeviceInfoRequest(c *xgb.Conn, Screen uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -810,6 +857,8 @@ type GetDrawableInfoCookie struct { // GetDrawableInfo sends a checked request. // If an error occurs, it will be returned with the reply by calling GetDrawableInfoCookie.Reply() func GetDrawableInfo(c *xgb.Conn, Screen uint32, Drawable uint32) GetDrawableInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'GetDrawableInfo' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -821,6 +870,8 @@ func GetDrawableInfo(c *xgb.Conn, Screen uint32, Drawable uint32) GetDrawableInf // GetDrawableInfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDrawableInfoUnchecked(c *xgb.Conn, Screen uint32, Drawable uint32) GetDrawableInfoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'GetDrawableInfo' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -922,7 +973,9 @@ func getDrawableInfoRequest(c *xgb.Conn, Screen uint32, Drawable uint32) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 9 // request opcode @@ -948,6 +1001,8 @@ type OpenConnectionCookie struct { // OpenConnection sends a checked request. // If an error occurs, it will be returned with the reply by calling OpenConnectionCookie.Reply() func OpenConnection(c *xgb.Conn, Screen uint32) OpenConnectionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'OpenConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -959,6 +1014,8 @@ func OpenConnection(c *xgb.Conn, Screen uint32) OpenConnectionCookie { // OpenConnectionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func OpenConnectionUnchecked(c *xgb.Conn, Screen uint32) OpenConnectionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'OpenConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -1032,7 +1089,9 @@ func openConnectionRequest(c *xgb.Conn, Screen uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -1055,6 +1114,8 @@ type QueryDirectRenderingCapableCookie struct { // QueryDirectRenderingCapable sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryDirectRenderingCapableCookie.Reply() func QueryDirectRenderingCapable(c *xgb.Conn, Screen uint32) QueryDirectRenderingCapableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'QueryDirectRenderingCapable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -1066,6 +1127,8 @@ func QueryDirectRenderingCapable(c *xgb.Conn, Screen uint32) QueryDirectRenderin // QueryDirectRenderingCapableUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryDirectRenderingCapableUnchecked(c *xgb.Conn, Screen uint32) QueryDirectRenderingCapableCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'QueryDirectRenderingCapable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -1124,7 +1187,9 @@ func queryDirectRenderingCapableRequest(c *xgb.Conn, Screen uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -1147,6 +1212,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -1158,6 +1225,8 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-DRI"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") } @@ -1220,7 +1289,9 @@ func queryVersionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-DRI"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode diff --git a/nexgb/xf86vidmode/xf86vidmode.go b/nexgb/xf86vidmode/xf86vidmode.go index 5b0f1f8..2829fd6 100644 --- a/nexgb/xf86vidmode/xf86vidmode.go +++ b/nexgb/xf86vidmode/xf86vidmode.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XFree86-VidModeExtension could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XFree86-VidModeExtension"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XFree86-VidModeExtension"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XFree86-VidModeExtension"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -554,6 +553,8 @@ type AddModeLineCookie struct { // AddModeLine sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) AddModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'AddModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -565,6 +566,8 @@ func AddModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, // AddModeLineChecked sends a checked request. // If an error occurs, it can be retrieved using AddModeLineCookie.Check() func AddModeLineChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) AddModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'AddModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -586,7 +589,9 @@ func addModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -689,6 +694,8 @@ type DeleteModeLineCookie struct { // DeleteModeLine sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeleteModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) DeleteModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'DeleteModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -700,6 +707,8 @@ func DeleteModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint // DeleteModeLineChecked sends a checked request. // If an error occurs, it can be retrieved using DeleteModeLineCookie.Check() func DeleteModeLineChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) DeleteModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'DeleteModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -721,7 +730,9 @@ func deleteModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdispl b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -787,6 +798,8 @@ type GetAllModeLinesCookie struct { // GetAllModeLines sends a checked request. // If an error occurs, it will be returned with the reply by calling GetAllModeLinesCookie.Reply() func GetAllModeLines(c *xgb.Conn, Screen uint16) GetAllModeLinesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetAllModeLines' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -798,6 +811,8 @@ func GetAllModeLines(c *xgb.Conn, Screen uint16) GetAllModeLinesCookie { // GetAllModeLinesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetAllModeLinesUnchecked(c *xgb.Conn, Screen uint16) GetAllModeLinesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetAllModeLines' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -859,7 +874,9 @@ func getAllModeLinesRequest(c *xgb.Conn, Screen uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -884,6 +901,8 @@ type GetDotClocksCookie struct { // GetDotClocks sends a checked request. // If an error occurs, it will be returned with the reply by calling GetDotClocksCookie.Reply() func GetDotClocks(c *xgb.Conn, Screen uint16) GetDotClocksCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetDotClocks' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -895,6 +914,8 @@ func GetDotClocks(c *xgb.Conn, Screen uint16) GetDotClocksCookie { // GetDotClocksUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDotClocksUnchecked(c *xgb.Conn, Screen uint16) GetDotClocksCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetDotClocks' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -967,7 +988,9 @@ func getDotClocksRequest(c *xgb.Conn, Screen uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode @@ -992,6 +1015,8 @@ type GetGammaCookie struct { // GetGamma sends a checked request. // If an error occurs, it will be returned with the reply by calling GetGammaCookie.Reply() func GetGamma(c *xgb.Conn, Screen uint16) GetGammaCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetGamma' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1003,6 +1028,8 @@ func GetGamma(c *xgb.Conn, Screen uint16) GetGammaCookie { // GetGammaUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetGammaUnchecked(c *xgb.Conn, Screen uint16) GetGammaCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetGamma' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1068,7 +1095,9 @@ func getGammaRequest(c *xgb.Conn, Screen uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 16 // request opcode @@ -1093,6 +1122,8 @@ type GetGammaRampCookie struct { // GetGammaRamp sends a checked request. // If an error occurs, it will be returned with the reply by calling GetGammaRampCookie.Reply() func GetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16) GetGammaRampCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1104,6 +1135,8 @@ func GetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16) GetGammaRampCookie { // GetGammaRampUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetGammaRampUnchecked(c *xgb.Conn, Screen uint16, Size uint16) GetGammaRampCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1188,7 +1221,9 @@ func getGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 17 // request opcode @@ -1214,6 +1249,8 @@ type GetGammaRampSizeCookie struct { // GetGammaRampSize sends a checked request. // If an error occurs, it will be returned with the reply by calling GetGammaRampSizeCookie.Reply() func GetGammaRampSize(c *xgb.Conn, Screen uint16) GetGammaRampSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetGammaRampSize' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1225,6 +1262,8 @@ func GetGammaRampSize(c *xgb.Conn, Screen uint16) GetGammaRampSizeCookie { // GetGammaRampSizeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetGammaRampSizeUnchecked(c *xgb.Conn, Screen uint16) GetGammaRampSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetGammaRampSize' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1282,7 +1321,9 @@ func getGammaRampSizeRequest(c *xgb.Conn, Screen uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 19 // request opcode @@ -1307,6 +1348,8 @@ type GetModeLineCookie struct { // GetModeLine sends a checked request. // If an error occurs, it will be returned with the reply by calling GetModeLineCookie.Reply() func GetModeLine(c *xgb.Conn, Screen uint16) GetModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1318,6 +1361,8 @@ func GetModeLine(c *xgb.Conn, Screen uint16) GetModeLineCookie { // GetModeLineUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetModeLineUnchecked(c *xgb.Conn, Screen uint16) GetModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1427,7 +1472,9 @@ func getModeLineRequest(c *xgb.Conn, Screen uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -1452,6 +1499,8 @@ type GetMonitorCookie struct { // GetMonitor sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMonitorCookie.Reply() func GetMonitor(c *xgb.Conn, Screen uint16) GetMonitorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetMonitor' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1463,6 +1512,8 @@ func GetMonitor(c *xgb.Conn, Screen uint16) GetMonitorCookie { // GetMonitorUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMonitorUnchecked(c *xgb.Conn, Screen uint16) GetMonitorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetMonitor' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1570,7 +1621,9 @@ func getMonitorRequest(c *xgb.Conn, Screen uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -1595,6 +1648,8 @@ type GetPermissionsCookie struct { // GetPermissions sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPermissionsCookie.Reply() func GetPermissions(c *xgb.Conn, Screen uint16) GetPermissionsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetPermissions' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1606,6 +1661,8 @@ func GetPermissions(c *xgb.Conn, Screen uint16) GetPermissionsCookie { // GetPermissionsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPermissionsUnchecked(c *xgb.Conn, Screen uint16) GetPermissionsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetPermissions' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1663,7 +1720,9 @@ func getPermissionsRequest(c *xgb.Conn, Screen uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 20 // request opcode @@ -1688,6 +1747,8 @@ type GetViewPortCookie struct { // GetViewPort sends a checked request. // If an error occurs, it will be returned with the reply by calling GetViewPortCookie.Reply() func GetViewPort(c *xgb.Conn, Screen uint16) GetViewPortCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetViewPort' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1699,6 +1760,8 @@ func GetViewPort(c *xgb.Conn, Screen uint16) GetViewPortCookie { // GetViewPortUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetViewPortUnchecked(c *xgb.Conn, Screen uint16) GetViewPortCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'GetViewPort' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1760,7 +1823,9 @@ func getViewPortRequest(c *xgb.Conn, Screen uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode @@ -1785,6 +1850,8 @@ type LockModeSwitchCookie struct { // LockModeSwitch sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func LockModeSwitch(c *xgb.Conn, Screen uint16, Lock uint16) LockModeSwitchCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'LockModeSwitch' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1796,6 +1863,8 @@ func LockModeSwitch(c *xgb.Conn, Screen uint16, Lock uint16) LockModeSwitchCooki // LockModeSwitchChecked sends a checked request. // If an error occurs, it can be retrieved using LockModeSwitchCookie.Check() func LockModeSwitchChecked(c *xgb.Conn, Screen uint16, Lock uint16) LockModeSwitchCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'LockModeSwitch' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1817,7 +1886,9 @@ func lockModeSwitchRequest(c *xgb.Conn, Screen uint16, Lock uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -1843,6 +1914,8 @@ type ModModeLineCookie struct { // ModModeLine sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ModModeLine(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ModModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'ModModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1854,6 +1927,8 @@ func ModModeLine(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart uint16, // ModModeLineChecked sends a checked request. // If an error occurs, it can be retrieved using ModModeLineCookie.Check() func ModModeLineChecked(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ModModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'ModModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1875,7 +1950,9 @@ func modModeLineRequest(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -1938,6 +2015,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -1949,6 +2028,8 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2007,7 +2088,9 @@ func queryVersionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -2027,6 +2110,8 @@ type SetClientVersionCookie struct { // SetClientVersion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetClientVersion(c *xgb.Conn, Major uint16, Minor uint16) SetClientVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SetClientVersion' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2038,6 +2123,8 @@ func SetClientVersion(c *xgb.Conn, Major uint16, Minor uint16) SetClientVersionC // SetClientVersionChecked sends a checked request. // If an error occurs, it can be retrieved using SetClientVersionCookie.Check() func SetClientVersionChecked(c *xgb.Conn, Major uint16, Minor uint16) SetClientVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SetClientVersion' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2059,7 +2146,9 @@ func setClientVersionRequest(c *xgb.Conn, Major uint16, Minor uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 14 // request opcode @@ -2085,6 +2174,8 @@ type SetGammaCookie struct { // SetGamma sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetGamma(c *xgb.Conn, Screen uint16, Red uint32, Green uint32, Blue uint32) SetGammaCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SetGamma' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2096,6 +2187,8 @@ func SetGamma(c *xgb.Conn, Screen uint16, Red uint32, Green uint32, Blue uint32) // SetGammaChecked sends a checked request. // If an error occurs, it can be retrieved using SetGammaCookie.Check() func SetGammaChecked(c *xgb.Conn, Screen uint16, Red uint32, Green uint32, Blue uint32) SetGammaCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SetGamma' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2117,7 +2210,9 @@ func setGammaRequest(c *xgb.Conn, Screen uint16, Red uint32, Green uint32, Blue b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 15 // request opcode @@ -2153,6 +2248,8 @@ type SetGammaRampCookie struct { // SetGammaRamp sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetGammaRampCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2164,6 +2261,8 @@ func SetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green [ // SetGammaRampChecked sends a checked request. // If an error occurs, it can be retrieved using SetGammaRampCookie.Check() func SetGammaRampChecked(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetGammaRampCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SetGammaRamp' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2185,7 +2284,9 @@ func setGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 18 // request opcode @@ -2232,6 +2333,8 @@ type SetViewPortCookie struct { // SetViewPort sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetViewPort(c *xgb.Conn, Screen uint16, X uint32, Y uint32) SetViewPortCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SetViewPort' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2243,6 +2346,8 @@ func SetViewPort(c *xgb.Conn, Screen uint16, X uint32, Y uint32) SetViewPortCook // SetViewPortChecked sends a checked request. // If an error occurs, it can be retrieved using SetViewPortCookie.Check() func SetViewPortChecked(c *xgb.Conn, Screen uint16, X uint32, Y uint32) SetViewPortCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SetViewPort' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2264,7 +2369,9 @@ func setViewPortRequest(c *xgb.Conn, Screen uint16, X uint32, Y uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -2295,6 +2402,8 @@ type SwitchModeCookie struct { // SwitchMode sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SwitchMode(c *xgb.Conn, Screen uint16, Zoom uint16) SwitchModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SwitchMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2306,6 +2415,8 @@ func SwitchMode(c *xgb.Conn, Screen uint16, Zoom uint16) SwitchModeCookie { // SwitchModeChecked sends a checked request. // If an error occurs, it can be retrieved using SwitchModeCookie.Check() func SwitchModeChecked(c *xgb.Conn, Screen uint16, Zoom uint16) SwitchModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SwitchMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2327,7 +2438,9 @@ func switchModeRequest(c *xgb.Conn, Screen uint16, Zoom uint16) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -2353,6 +2466,8 @@ type SwitchToModeCookie struct { // SwitchToMode sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SwitchToMode(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) SwitchToModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SwitchToMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2364,6 +2479,8 @@ func SwitchToMode(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16 // SwitchToModeChecked sends a checked request. // If an error occurs, it can be retrieved using SwitchToModeCookie.Check() func SwitchToModeChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) SwitchToModeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'SwitchToMode' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2385,7 +2502,9 @@ func switchToModeRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -2451,6 +2570,8 @@ type ValidateModeLineCookie struct { // ValidateModeLine sends a checked request. // If an error occurs, it will be returned with the reply by calling ValidateModeLineCookie.Reply() func ValidateModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ValidateModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'ValidateModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2462,6 +2583,8 @@ func ValidateModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay ui // ValidateModeLineUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ValidateModeLineUnchecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ValidateModeLineCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFree86-VidModeExtension"]; !ok { panic("Cannot issue request 'ValidateModeLine' using the uninitialized extension 'XFree86-VidModeExtension'. xf86vidmode.Init(connObj) must be called first.") } @@ -2519,7 +2642,9 @@ func validateModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdis b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFree86-VidModeExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 9 // request opcode diff --git a/nexgb/xfixes/xfixes.go b/nexgb/xfixes/xfixes.go index ef08c9a..0f9e4b0 100644 --- a/nexgb/xfixes/xfixes.go +++ b/nexgb/xfixes/xfixes.go @@ -21,16 +21,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XFIXES could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XFIXES"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XFIXES"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XFIXES"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -102,10 +101,6 @@ const ( BarrierDirectionsNegativeY = 8 ) -const ( - CursorNotifyDisplayCursor = 0 -) - // CursorNotify is the event number for a CursorNotifyEvent. const CursorNotify = 1 @@ -201,6 +196,10 @@ func init() { xgb.NewExtEventFuncs["XFIXES"][1] = CursorNotifyEventNew } +const ( + CursorNotifyDisplayCursor = 0 +) + const ( CursorNotifyMaskDisplayCursor = 1 ) @@ -381,6 +380,8 @@ type ChangeCursorCookie struct { // ChangeCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangeCursor(c *xgb.Conn, Source xproto.Cursor, Destination xproto.Cursor) ChangeCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ChangeCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -392,6 +393,8 @@ func ChangeCursor(c *xgb.Conn, Source xproto.Cursor, Destination xproto.Cursor) // ChangeCursorChecked sends a checked request. // If an error occurs, it can be retrieved using ChangeCursorCookie.Check() func ChangeCursorChecked(c *xgb.Conn, Source xproto.Cursor, Destination xproto.Cursor) ChangeCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ChangeCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -413,7 +416,9 @@ func changeCursorRequest(c *xgb.Conn, Source xproto.Cursor, Destination xproto.C b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 26 // request opcode @@ -439,6 +444,8 @@ type ChangeCursorByNameCookie struct { // ChangeCursorByName sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangeCursorByName(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Name string) ChangeCursorByNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ChangeCursorByName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -450,6 +457,8 @@ func ChangeCursorByName(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Name stri // ChangeCursorByNameChecked sends a checked request. // If an error occurs, it can be retrieved using ChangeCursorByNameCookie.Check() func ChangeCursorByNameChecked(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Name string) ChangeCursorByNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ChangeCursorByName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -471,7 +480,9 @@ func changeCursorByNameRequest(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Na b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 27 // request opcode @@ -502,6 +513,8 @@ type ChangeSaveSetCookie struct { // ChangeSaveSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangeSaveSet(c *xgb.Conn, Mode byte, Target byte, Map byte, Window xproto.Window) ChangeSaveSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ChangeSaveSet' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -513,6 +526,8 @@ func ChangeSaveSet(c *xgb.Conn, Mode byte, Target byte, Map byte, Window xproto. // ChangeSaveSetChecked sends a checked request. // If an error occurs, it can be retrieved using ChangeSaveSetCookie.Check() func ChangeSaveSetChecked(c *xgb.Conn, Mode byte, Target byte, Map byte, Window xproto.Window) ChangeSaveSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ChangeSaveSet' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -534,7 +549,9 @@ func changeSaveSetRequest(c *xgb.Conn, Mode byte, Target byte, Map byte, Window b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -568,6 +585,8 @@ type CopyRegionCookie struct { // CopyRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CopyRegion(c *xgb.Conn, Source Region, Destination Region) CopyRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CopyRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -579,6 +598,8 @@ func CopyRegion(c *xgb.Conn, Source Region, Destination Region) CopyRegionCookie // CopyRegionChecked sends a checked request. // If an error occurs, it can be retrieved using CopyRegionCookie.Check() func CopyRegionChecked(c *xgb.Conn, Source Region, Destination Region) CopyRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CopyRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -600,7 +621,9 @@ func copyRegionRequest(c *xgb.Conn, Source Region, Destination Region) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -626,6 +649,8 @@ type CreatePointerBarrierCookie struct { // CreatePointerBarrier sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreatePointerBarrier(c *xgb.Conn, Barrier Barrier, Window xproto.Window, X1 uint16, Y1 uint16, X2 uint16, Y2 uint16, Directions uint32, NumDevices uint16, Devices []uint16) CreatePointerBarrierCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreatePointerBarrier' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -637,6 +662,8 @@ func CreatePointerBarrier(c *xgb.Conn, Barrier Barrier, Window xproto.Window, X1 // CreatePointerBarrierChecked sends a checked request. // If an error occurs, it can be retrieved using CreatePointerBarrierCookie.Check() func CreatePointerBarrierChecked(c *xgb.Conn, Barrier Barrier, Window xproto.Window, X1 uint16, Y1 uint16, X2 uint16, Y2 uint16, Directions uint32, NumDevices uint16, Devices []uint16) CreatePointerBarrierCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreatePointerBarrier' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -658,7 +685,9 @@ func createPointerBarrierRequest(c *xgb.Conn, Barrier Barrier, Window xproto.Win b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 31 // request opcode @@ -709,6 +738,8 @@ type CreateRegionCookie struct { // CreateRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegion(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) CreateRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -720,6 +751,8 @@ func CreateRegion(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) Cre // CreateRegionChecked sends a checked request. // If an error occurs, it can be retrieved using CreateRegionCookie.Check() func CreateRegionChecked(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) CreateRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -741,7 +774,9 @@ func createRegionRequest(c *xgb.Conn, Region Region, Rectangles []xproto.Rectang b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -766,6 +801,8 @@ type CreateRegionFromBitmapCookie struct { // CreateRegionFromBitmap sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegionFromBitmap(c *xgb.Conn, Region Region, Bitmap xproto.Pixmap) CreateRegionFromBitmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegionFromBitmap' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -777,6 +814,8 @@ func CreateRegionFromBitmap(c *xgb.Conn, Region Region, Bitmap xproto.Pixmap) Cr // CreateRegionFromBitmapChecked sends a checked request. // If an error occurs, it can be retrieved using CreateRegionFromBitmapCookie.Check() func CreateRegionFromBitmapChecked(c *xgb.Conn, Region Region, Bitmap xproto.Pixmap) CreateRegionFromBitmapCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegionFromBitmap' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -798,7 +837,9 @@ func createRegionFromBitmapRequest(c *xgb.Conn, Region Region, Bitmap xproto.Pix b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -824,6 +865,8 @@ type CreateRegionFromGCCookie struct { // CreateRegionFromGC sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegionFromGC(c *xgb.Conn, Region Region, Gc xproto.Gcontext) CreateRegionFromGCCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegionFromGC' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -835,6 +878,8 @@ func CreateRegionFromGC(c *xgb.Conn, Region Region, Gc xproto.Gcontext) CreateRe // CreateRegionFromGCChecked sends a checked request. // If an error occurs, it can be retrieved using CreateRegionFromGCCookie.Check() func CreateRegionFromGCChecked(c *xgb.Conn, Region Region, Gc xproto.Gcontext) CreateRegionFromGCCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegionFromGC' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -856,7 +901,9 @@ func createRegionFromGCRequest(c *xgb.Conn, Region Region, Gc xproto.Gcontext) [ b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -882,6 +929,8 @@ type CreateRegionFromPictureCookie struct { // CreateRegionFromPicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegionFromPicture(c *xgb.Conn, Region Region, Picture render.Picture) CreateRegionFromPictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegionFromPicture' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -893,6 +942,8 @@ func CreateRegionFromPicture(c *xgb.Conn, Region Region, Picture render.Picture) // CreateRegionFromPictureChecked sends a checked request. // If an error occurs, it can be retrieved using CreateRegionFromPictureCookie.Check() func CreateRegionFromPictureChecked(c *xgb.Conn, Region Region, Picture render.Picture) CreateRegionFromPictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegionFromPicture' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -914,7 +965,9 @@ func createRegionFromPictureRequest(c *xgb.Conn, Region Region, Picture render.P b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 9 // request opcode @@ -940,6 +993,8 @@ type CreateRegionFromWindowCookie struct { // CreateRegionFromWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegionFromWindow(c *xgb.Conn, Region Region, Window xproto.Window, Kind shape.Kind) CreateRegionFromWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegionFromWindow' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -951,6 +1006,8 @@ func CreateRegionFromWindow(c *xgb.Conn, Region Region, Window xproto.Window, Ki // CreateRegionFromWindowChecked sends a checked request. // If an error occurs, it can be retrieved using CreateRegionFromWindowCookie.Check() func CreateRegionFromWindowChecked(c *xgb.Conn, Region Region, Window xproto.Window, Kind shape.Kind) CreateRegionFromWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'CreateRegionFromWindow' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -972,7 +1029,9 @@ func createRegionFromWindowRequest(c *xgb.Conn, Region Region, Window xproto.Win b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -1003,6 +1062,8 @@ type DeletePointerBarrierCookie struct { // DeletePointerBarrier sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeletePointerBarrier(c *xgb.Conn, Barrier Barrier) DeletePointerBarrierCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'DeletePointerBarrier' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1014,6 +1075,8 @@ func DeletePointerBarrier(c *xgb.Conn, Barrier Barrier) DeletePointerBarrierCook // DeletePointerBarrierChecked sends a checked request. // If an error occurs, it can be retrieved using DeletePointerBarrierCookie.Check() func DeletePointerBarrierChecked(c *xgb.Conn, Barrier Barrier) DeletePointerBarrierCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'DeletePointerBarrier' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1035,7 +1098,9 @@ func deletePointerBarrierRequest(c *xgb.Conn, Barrier Barrier) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 32 // request opcode @@ -1058,6 +1123,8 @@ type DestroyRegionCookie struct { // DestroyRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyRegion(c *xgb.Conn, Region Region) DestroyRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'DestroyRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1069,6 +1136,8 @@ func DestroyRegion(c *xgb.Conn, Region Region) DestroyRegionCookie { // DestroyRegionChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyRegionCookie.Check() func DestroyRegionChecked(c *xgb.Conn, Region Region) DestroyRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'DestroyRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1090,7 +1159,9 @@ func destroyRegionRequest(c *xgb.Conn, Region Region) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -1113,6 +1184,8 @@ type ExpandRegionCookie struct { // ExpandRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ExpandRegion(c *xgb.Conn, Source Region, Destination Region, Left uint16, Right uint16, Top uint16, Bottom uint16) ExpandRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ExpandRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1124,6 +1197,8 @@ func ExpandRegion(c *xgb.Conn, Source Region, Destination Region, Left uint16, R // ExpandRegionChecked sends a checked request. // If an error occurs, it can be retrieved using ExpandRegionCookie.Check() func ExpandRegionChecked(c *xgb.Conn, Source Region, Destination Region, Left uint16, Right uint16, Top uint16, Bottom uint16) ExpandRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ExpandRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1145,7 +1220,9 @@ func expandRegionRequest(c *xgb.Conn, Source Region, Destination Region, Left ui b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 28 // request opcode @@ -1183,6 +1260,8 @@ type FetchRegionCookie struct { // FetchRegion sends a checked request. // If an error occurs, it will be returned with the reply by calling FetchRegionCookie.Reply() func FetchRegion(c *xgb.Conn, Region Region) FetchRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'FetchRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1194,6 +1273,8 @@ func FetchRegion(c *xgb.Conn, Region Region) FetchRegionCookie { // FetchRegionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FetchRegionUnchecked(c *xgb.Conn, Region Region) FetchRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'FetchRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1255,7 +1336,9 @@ func fetchRegionRequest(c *xgb.Conn, Region Region) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 19 // request opcode @@ -1278,6 +1361,8 @@ type GetCursorImageCookie struct { // GetCursorImage sends a checked request. // If an error occurs, it will be returned with the reply by calling GetCursorImageCookie.Reply() func GetCursorImage(c *xgb.Conn) GetCursorImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'GetCursorImage' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1289,6 +1374,8 @@ func GetCursorImage(c *xgb.Conn) GetCursorImageCookie { // GetCursorImageUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCursorImageUnchecked(c *xgb.Conn) GetCursorImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'GetCursorImage' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1377,7 +1464,9 @@ func getCursorImageRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -1397,6 +1486,8 @@ type GetCursorImageAndNameCookie struct { // GetCursorImageAndName sends a checked request. // If an error occurs, it will be returned with the reply by calling GetCursorImageAndNameCookie.Reply() func GetCursorImageAndName(c *xgb.Conn) GetCursorImageAndNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'GetCursorImageAndName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1408,6 +1499,8 @@ func GetCursorImageAndName(c *xgb.Conn) GetCursorImageAndNameCookie { // GetCursorImageAndNameUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCursorImageAndNameUnchecked(c *xgb.Conn) GetCursorImageAndNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'GetCursorImageAndName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1515,7 +1608,9 @@ func getCursorImageAndNameRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 25 // request opcode @@ -1535,6 +1630,8 @@ type GetCursorNameCookie struct { // GetCursorName sends a checked request. // If an error occurs, it will be returned with the reply by calling GetCursorNameCookie.Reply() func GetCursorName(c *xgb.Conn, Cursor xproto.Cursor) GetCursorNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'GetCursorName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1546,6 +1643,8 @@ func GetCursorName(c *xgb.Conn, Cursor xproto.Cursor) GetCursorNameCookie { // GetCursorNameUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCursorNameUnchecked(c *xgb.Conn, Cursor xproto.Cursor) GetCursorNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'GetCursorName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1615,7 +1714,9 @@ func getCursorNameRequest(c *xgb.Conn, Cursor xproto.Cursor) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 24 // request opcode @@ -1638,6 +1739,8 @@ type HideCursorCookie struct { // HideCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func HideCursor(c *xgb.Conn, Window xproto.Window) HideCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'HideCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1649,6 +1752,8 @@ func HideCursor(c *xgb.Conn, Window xproto.Window) HideCursorCookie { // HideCursorChecked sends a checked request. // If an error occurs, it can be retrieved using HideCursorCookie.Check() func HideCursorChecked(c *xgb.Conn, Window xproto.Window) HideCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'HideCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1670,7 +1775,9 @@ func hideCursorRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 29 // request opcode @@ -1693,6 +1800,8 @@ type IntersectRegionCookie struct { // IntersectRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func IntersectRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) IntersectRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'IntersectRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1704,6 +1813,8 @@ func IntersectRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Re // IntersectRegionChecked sends a checked request. // If an error occurs, it can be retrieved using IntersectRegionCookie.Check() func IntersectRegionChecked(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) IntersectRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'IntersectRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1725,7 +1836,9 @@ func intersectRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destina b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 14 // request opcode @@ -1754,6 +1867,8 @@ type InvertRegionCookie struct { // InvertRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func InvertRegion(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, Destination Region) InvertRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'InvertRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1765,6 +1880,8 @@ func InvertRegion(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, Destinati // InvertRegionChecked sends a checked request. // If an error occurs, it can be retrieved using InvertRegionCookie.Check() func InvertRegionChecked(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, Destination Region) InvertRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'InvertRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1786,7 +1903,9 @@ func invertRegionRequest(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, De b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 16 // request opcode @@ -1818,6 +1937,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1829,6 +1950,8 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uin // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1890,7 +2013,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -1916,6 +2041,8 @@ type RegionExtentsCookie struct { // RegionExtents sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RegionExtents(c *xgb.Conn, Source Region, Destination Region) RegionExtentsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'RegionExtents' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1927,6 +2054,8 @@ func RegionExtents(c *xgb.Conn, Source Region, Destination Region) RegionExtents // RegionExtentsChecked sends a checked request. // If an error occurs, it can be retrieved using RegionExtentsCookie.Check() func RegionExtentsChecked(c *xgb.Conn, Source Region, Destination Region) RegionExtentsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'RegionExtents' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1948,7 +2077,9 @@ func regionExtentsRequest(c *xgb.Conn, Source Region, Destination Region) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 18 // request opcode @@ -1974,6 +2105,8 @@ type SelectCursorInputCookie struct { // SelectCursorInput sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectCursorInput(c *xgb.Conn, Window xproto.Window, EventMask uint32) SelectCursorInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SelectCursorInput' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -1985,6 +2118,8 @@ func SelectCursorInput(c *xgb.Conn, Window xproto.Window, EventMask uint32) Sele // SelectCursorInputChecked sends a checked request. // If an error occurs, it can be retrieved using SelectCursorInputCookie.Check() func SelectCursorInputChecked(c *xgb.Conn, Window xproto.Window, EventMask uint32) SelectCursorInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SelectCursorInput' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2006,7 +2141,9 @@ func selectCursorInputRequest(c *xgb.Conn, Window xproto.Window, EventMask uint3 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -2032,6 +2169,8 @@ type SelectSelectionInputCookie struct { // SelectSelectionInput sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectSelectionInput(c *xgb.Conn, Window xproto.Window, Selection xproto.Atom, EventMask uint32) SelectSelectionInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SelectSelectionInput' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2043,6 +2182,8 @@ func SelectSelectionInput(c *xgb.Conn, Window xproto.Window, Selection xproto.At // SelectSelectionInputChecked sends a checked request. // If an error occurs, it can be retrieved using SelectSelectionInputCookie.Check() func SelectSelectionInputChecked(c *xgb.Conn, Window xproto.Window, Selection xproto.Atom, EventMask uint32) SelectSelectionInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SelectSelectionInput' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2064,7 +2205,9 @@ func selectSelectionInputRequest(c *xgb.Conn, Window xproto.Window, Selection xp b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -2093,6 +2236,8 @@ type SetCursorNameCookie struct { // SetCursorName sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetCursorName(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name string) SetCursorNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetCursorName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2104,6 +2249,8 @@ func SetCursorName(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name string // SetCursorNameChecked sends a checked request. // If an error occurs, it can be retrieved using SetCursorNameCookie.Check() func SetCursorNameChecked(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name string) SetCursorNameCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetCursorName' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2125,7 +2272,9 @@ func setCursorNameRequest(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 23 // request opcode @@ -2156,6 +2305,8 @@ type SetGCClipRegionCookie struct { // SetGCClipRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetGCClipRegion(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOrigin int16, YOrigin int16) SetGCClipRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetGCClipRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2167,6 +2318,8 @@ func SetGCClipRegion(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOrigin int // SetGCClipRegionChecked sends a checked request. // If an error occurs, it can be retrieved using SetGCClipRegionCookie.Check() func SetGCClipRegionChecked(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOrigin int16, YOrigin int16) SetGCClipRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetGCClipRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2188,7 +2341,9 @@ func setGCClipRegionRequest(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOri b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 20 // request opcode @@ -2220,6 +2375,8 @@ type SetPictureClipRegionCookie struct { // SetPictureClipRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureClipRegion(c *xgb.Conn, Picture render.Picture, Region Region, XOrigin int16, YOrigin int16) SetPictureClipRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetPictureClipRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2231,6 +2388,8 @@ func SetPictureClipRegion(c *xgb.Conn, Picture render.Picture, Region Region, XO // SetPictureClipRegionChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureClipRegionCookie.Check() func SetPictureClipRegionChecked(c *xgb.Conn, Picture render.Picture, Region Region, XOrigin int16, YOrigin int16) SetPictureClipRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetPictureClipRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2252,7 +2411,9 @@ func setPictureClipRegionRequest(c *xgb.Conn, Picture render.Picture, Region Reg b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 22 // request opcode @@ -2284,6 +2445,8 @@ type SetRegionCookie struct { // SetRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetRegion(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) SetRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2295,6 +2458,8 @@ func SetRegion(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) SetReg // SetRegionChecked sends a checked request. // If an error occurs, it can be retrieved using SetRegionCookie.Check() func SetRegionChecked(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) SetRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2316,7 +2481,9 @@ func setRegionRequest(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode @@ -2341,6 +2508,8 @@ type SetWindowShapeRegionCookie struct { // SetWindowShapeRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetWindowShapeRegion(c *xgb.Conn, Dest xproto.Window, DestKind shape.Kind, XOffset int16, YOffset int16, Region Region) SetWindowShapeRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetWindowShapeRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2352,6 +2521,8 @@ func SetWindowShapeRegion(c *xgb.Conn, Dest xproto.Window, DestKind shape.Kind, // SetWindowShapeRegionChecked sends a checked request. // If an error occurs, it can be retrieved using SetWindowShapeRegionCookie.Check() func SetWindowShapeRegionChecked(c *xgb.Conn, Dest xproto.Window, DestKind shape.Kind, XOffset int16, YOffset int16, Region Region) SetWindowShapeRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SetWindowShapeRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2373,7 +2544,9 @@ func setWindowShapeRegionRequest(c *xgb.Conn, Dest xproto.Window, DestKind shape b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 21 // request opcode @@ -2410,6 +2583,8 @@ type ShowCursorCookie struct { // ShowCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ShowCursor(c *xgb.Conn, Window xproto.Window) ShowCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ShowCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2421,6 +2596,8 @@ func ShowCursor(c *xgb.Conn, Window xproto.Window) ShowCursorCookie { // ShowCursorChecked sends a checked request. // If an error occurs, it can be retrieved using ShowCursorCookie.Check() func ShowCursorChecked(c *xgb.Conn, Window xproto.Window) ShowCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'ShowCursor' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2442,7 +2619,9 @@ func showCursorRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 30 // request opcode @@ -2465,6 +2644,8 @@ type SubtractRegionCookie struct { // SubtractRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SubtractRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) SubtractRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SubtractRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2476,6 +2657,8 @@ func SubtractRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Reg // SubtractRegionChecked sends a checked request. // If an error occurs, it can be retrieved using SubtractRegionCookie.Check() func SubtractRegionChecked(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) SubtractRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'SubtractRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2497,7 +2680,9 @@ func subtractRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destinat b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 15 // request opcode @@ -2526,6 +2711,8 @@ type TranslateRegionCookie struct { // TranslateRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TranslateRegion(c *xgb.Conn, Region Region, Dx int16, Dy int16) TranslateRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'TranslateRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2537,6 +2724,8 @@ func TranslateRegion(c *xgb.Conn, Region Region, Dx int16, Dy int16) TranslateRe // TranslateRegionChecked sends a checked request. // If an error occurs, it can be retrieved using TranslateRegionCookie.Check() func TranslateRegionChecked(c *xgb.Conn, Region Region, Dx int16, Dy int16) TranslateRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'TranslateRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2558,7 +2747,9 @@ func translateRegionRequest(c *xgb.Conn, Region Region, Dx int16, Dy int16) []by b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 17 // request opcode @@ -2587,6 +2778,8 @@ type UnionRegionCookie struct { // UnionRegion sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnionRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) UnionRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'UnionRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2598,6 +2791,8 @@ func UnionRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region // UnionRegionChecked sends a checked request. // If an error occurs, it can be retrieved using UnionRegionCookie.Check() func UnionRegionChecked(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) UnionRegionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XFIXES"]; !ok { panic("Cannot issue request 'UnionRegion' using the uninitialized extension 'XFIXES'. xfixes.Init(connObj) must be called first.") } @@ -2619,7 +2814,9 @@ func unionRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destination b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XFIXES"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode diff --git a/nexgb/xgb.go b/nexgb/xgb.go index 44634fe..f49d19b 100644 --- a/nexgb/xgb.go +++ b/nexgb/xgb.go @@ -13,11 +13,6 @@ var ( // Where to log error-messages. Defaults to stderr. // To disable logging, just set this to log.New(ioutil.Discard, "", 0) Logger = log.New(os.Stderr, "XGB: ", log.Lshortfile) - - // ExtLock is a lock used whenever new extensions are initialized. - // It should not be used. It is exported for use in the extension - // sub-packages. - ExtLock sync.Mutex ) const ( @@ -66,6 +61,11 @@ type Conn struct { seqChan chan uint16 reqChan chan *request closing chan chan struct{} + + // ExtLock is a lock used whenever new extensions are initialized. + // It should not be used. It is exported for use in the extension + // sub-packages. + ExtLock sync.RWMutex // Extensions is a map from extension name to major opcode. It should // not be used. It is exported for use in the extension sub-packages. diff --git a/nexgb/xgbgen/context.go b/nexgb/xgbgen/context.go index f64f339..f18fd67 100644 --- a/nexgb/xgbgen/context.go +++ b/nexgb/xgbgen/context.go @@ -99,8 +99,9 @@ func (c *Context) Morph(xmlBytes []byte) { "on the server.\")", xname) c.Putln("}") c.Putln("") - c.Putln("xgb.ExtLock.Lock()") + c.Putln("c.ExtLock.Lock()") c.Putln("c.Extensions[\"%s\"] = reply.MajorOpcode", xname) + c.Putln("c.ExtLock.Unlock()") c.Putln("for evNum, fun := range xgb.NewExtEventFuncs[\"%s\"] {", xname) c.Putln("xgb.NewEventFuncs[int(reply.FirstEvent) + evNum] = fun") @@ -109,8 +110,6 @@ func (c *Context) Morph(xmlBytes []byte) { xname) c.Putln("xgb.NewErrorFuncs[int(reply.FirstError) + errNum] = fun") c.Putln("}") - c.Putln("xgb.ExtLock.Unlock()") - c.Putln("") c.Putln("return nil") c.Putln("}") c.Putln("") diff --git a/nexgb/xgbgen/go_request_reply.go b/nexgb/xgbgen/go_request_reply.go index c1b9ee9..396305e 100644 --- a/nexgb/xgbgen/go_request_reply.go +++ b/nexgb/xgbgen/go_request_reply.go @@ -79,6 +79,8 @@ func (r *Request) CheckExt(c *Context) { if !c.protocol.isExt() { return } + c.Putln("c.ExtLock.RLock()") + c.Putln("defer c.ExtLock.RUnlock()") c.Putln("if _, ok := c.Extensions[\"%s\"]; !ok {", c.protocol.ExtXName) c.Putln("panic(\"Cannot issue request '%s' using the uninitialized "+ "extension '%s'. %s.Init(connObj) must be called first.\")", @@ -169,7 +171,9 @@ func (r *Request) WriteRequest(c *Context) { c.Putln("buf := make([]byte, size)") c.Putln("") if c.protocol.isExt() { + c.Putln("c.ExtLock.RLock()") c.Putln("buf[b] = c.Extensions[\"%s\"]", c.protocol.ExtXName) + c.Putln("c.ExtLock.RUnlock()") c.Putln("b += 1") c.Putln("") } diff --git a/nexgb/xinerama/xinerama.go b/nexgb/xinerama/xinerama.go index 75c773c..ec97406 100644 --- a/nexgb/xinerama/xinerama.go +++ b/nexgb/xinerama/xinerama.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XINERAMA could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XINERAMA"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XINERAMA"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XINERAMA"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -137,6 +136,8 @@ type GetScreenCountCookie struct { // GetScreenCount sends a checked request. // If an error occurs, it will be returned with the reply by calling GetScreenCountCookie.Reply() func GetScreenCount(c *xgb.Conn, Window xproto.Window) GetScreenCountCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'GetScreenCount' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -148,6 +149,8 @@ func GetScreenCount(c *xgb.Conn, Window xproto.Window) GetScreenCountCookie { // GetScreenCountUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetScreenCountUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenCountCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'GetScreenCount' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -203,7 +206,9 @@ func getScreenCountRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XINERAMA"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -226,6 +231,8 @@ type GetScreenSizeCookie struct { // GetScreenSize sends a checked request. // If an error occurs, it will be returned with the reply by calling GetScreenSizeCookie.Reply() func GetScreenSize(c *xgb.Conn, Window xproto.Window, Screen uint32) GetScreenSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'GetScreenSize' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -237,6 +244,8 @@ func GetScreenSize(c *xgb.Conn, Window xproto.Window, Screen uint32) GetScreenSi // GetScreenSizeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetScreenSizeUnchecked(c *xgb.Conn, Window xproto.Window, Screen uint32) GetScreenSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'GetScreenSize' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -303,7 +312,9 @@ func getScreenSizeRequest(c *xgb.Conn, Window xproto.Window, Screen uint32) []by b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XINERAMA"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -329,6 +340,8 @@ type GetStateCookie struct { // GetState sends a checked request. // If an error occurs, it will be returned with the reply by calling GetStateCookie.Reply() func GetState(c *xgb.Conn, Window xproto.Window) GetStateCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'GetState' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -340,6 +353,8 @@ func GetState(c *xgb.Conn, Window xproto.Window) GetStateCookie { // GetStateUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetStateUnchecked(c *xgb.Conn, Window xproto.Window) GetStateCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'GetState' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -395,7 +410,9 @@ func getStateRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XINERAMA"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -418,6 +435,8 @@ type IsActiveCookie struct { // IsActive sends a checked request. // If an error occurs, it will be returned with the reply by calling IsActiveCookie.Reply() func IsActive(c *xgb.Conn) IsActiveCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'IsActive' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -429,6 +448,8 @@ func IsActive(c *xgb.Conn) IsActiveCookie { // IsActiveUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func IsActiveUnchecked(c *xgb.Conn) IsActiveCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'IsActive' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -483,7 +504,9 @@ func isActiveRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XINERAMA"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -503,6 +526,8 @@ type QueryScreensCookie struct { // QueryScreens sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryScreensCookie.Reply() func QueryScreens(c *xgb.Conn) QueryScreensCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'QueryScreens' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -514,6 +539,8 @@ func QueryScreens(c *xgb.Conn) QueryScreensCookie { // QueryScreensUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryScreensUnchecked(c *xgb.Conn) QueryScreensCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'QueryScreens' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -575,7 +602,9 @@ func queryScreensRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XINERAMA"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -595,6 +624,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, Major byte, Minor byte) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -606,6 +637,8 @@ func QueryVersion(c *xgb.Conn, Major byte, Minor byte) QueryVersionCookie { // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, Major byte, Minor byte) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XINERAMA"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") } @@ -664,7 +697,9 @@ func queryVersionRequest(c *xgb.Conn, Major byte, Minor byte) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XINERAMA"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 5ed49a0..d692aed 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XpExtension could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XpExtension"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XpExtension"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XpExtension"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -438,6 +437,8 @@ type CreateContextCookie struct { // CreateContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContext(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -449,6 +450,8 @@ func CreateContext(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, LocaleL // CreateContextChecked sends a checked request. // If an error occurs, it can be retrieved using CreateContextCookie.Check() func CreateContextChecked(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -470,7 +473,9 @@ func createContextRequest(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -509,6 +514,8 @@ type PrintDestroyContextCookie struct { // PrintDestroyContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintDestroyContext(c *xgb.Conn, Context uint32) PrintDestroyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -520,6 +527,8 @@ func PrintDestroyContext(c *xgb.Conn, Context uint32) PrintDestroyContextCookie // PrintDestroyContextChecked sends a checked request. // If an error occurs, it can be retrieved using PrintDestroyContextCookie.Check() func PrintDestroyContextChecked(c *xgb.Conn, Context uint32) PrintDestroyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -541,7 +550,9 @@ func printDestroyContextRequest(c *xgb.Conn, Context uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -564,6 +575,8 @@ type PrintEndDocCookie struct { // PrintEndDoc sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintEndDoc(c *xgb.Conn, Cancel bool) PrintEndDocCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -575,6 +588,8 @@ func PrintEndDoc(c *xgb.Conn, Cancel bool) PrintEndDocCookie { // PrintEndDocChecked sends a checked request. // If an error occurs, it can be retrieved using PrintEndDocCookie.Check() func PrintEndDocChecked(c *xgb.Conn, Cancel bool) PrintEndDocCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -596,7 +611,9 @@ func printEndDocRequest(c *xgb.Conn, Cancel bool) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -623,6 +640,8 @@ type PrintEndJobCookie struct { // PrintEndJob sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintEndJob(c *xgb.Conn, Cancel bool) PrintEndJobCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -634,6 +653,8 @@ func PrintEndJob(c *xgb.Conn, Cancel bool) PrintEndJobCookie { // PrintEndJobChecked sends a checked request. // If an error occurs, it can be retrieved using PrintEndJobCookie.Check() func PrintEndJobChecked(c *xgb.Conn, Cancel bool) PrintEndJobCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -655,7 +676,9 @@ func printEndJobRequest(c *xgb.Conn, Cancel bool) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -682,6 +705,8 @@ type PrintEndPageCookie struct { // PrintEndPage sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintEndPage(c *xgb.Conn, Cancel bool) PrintEndPageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -693,6 +718,8 @@ func PrintEndPage(c *xgb.Conn, Cancel bool) PrintEndPageCookie { // PrintEndPageChecked sends a checked request. // If an error occurs, it can be retrieved using PrintEndPageCookie.Check() func PrintEndPageChecked(c *xgb.Conn, Cancel bool) PrintEndPageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -714,7 +741,9 @@ func printEndPageRequest(c *xgb.Conn, Cancel bool) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 14 // request opcode @@ -743,6 +772,8 @@ type PrintGetAttributesCookie struct { // PrintGetAttributes sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintGetAttributesCookie.Reply() func PrintGetAttributes(c *xgb.Conn, Context Pcontext, Pool byte) PrintGetAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -754,6 +785,8 @@ func PrintGetAttributes(c *xgb.Conn, Context Pcontext, Pool byte) PrintGetAttrib // PrintGetAttributesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintGetAttributesUnchecked(c *xgb.Conn, Context Pcontext, Pool byte) PrintGetAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -769,7 +802,7 @@ type PrintGetAttributesReply struct { // padding: 1 bytes StringLen uint32 // padding: 20 bytes - Attributes String8 + Attributes []String8 // size: xgb.Pad((int(StringLen) * 1)) } // Reply blocks and returns the reply data for a PrintGetAttributes request. @@ -802,8 +835,11 @@ func printGetAttributesReply(buf []byte) *PrintGetAttributesReply { b += 20 // padding - v.Attributes = String8(buf[b]) - b += 1 + v.Attributes = make([]String8, v.StringLen) + for i := 0; i < int(v.StringLen); i++ { + v.Attributes[i] = String8(buf[b]) + b += 1 + } return v } @@ -815,7 +851,9 @@ func printGetAttributesRequest(c *xgb.Conn, Context Pcontext, Pool byte) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 17 // request opcode @@ -843,6 +881,8 @@ type PrintGetContextCookie struct { // PrintGetContext sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintGetContextCookie.Reply() func PrintGetContext(c *xgb.Conn) PrintGetContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -854,6 +894,8 @@ func PrintGetContext(c *xgb.Conn) PrintGetContextCookie { // PrintGetContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintGetContextUnchecked(c *xgb.Conn) PrintGetContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -908,7 +950,9 @@ func printGetContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -928,6 +972,8 @@ type PrintGetDocumentDataCookie struct { // PrintGetDocumentData sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintGetDocumentDataCookie.Reply() func PrintGetDocumentData(c *xgb.Conn, Context Pcontext, MaxBytes uint32) PrintGetDocumentDataCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -939,6 +985,8 @@ func PrintGetDocumentData(c *xgb.Conn, Context Pcontext, MaxBytes uint32) PrintG // PrintGetDocumentDataUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintGetDocumentDataUnchecked(c *xgb.Conn, Context Pcontext, MaxBytes uint32) PrintGetDocumentDataCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1009,7 +1057,9 @@ func printGetDocumentDataRequest(c *xgb.Conn, Context Pcontext, MaxBytes uint32) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -1035,6 +1085,8 @@ type PrintGetImageResolutionCookie struct { // PrintGetImageResolution sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintGetImageResolutionCookie.Reply() func PrintGetImageResolution(c *xgb.Conn, Context Pcontext) PrintGetImageResolutionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1046,6 +1098,8 @@ func PrintGetImageResolution(c *xgb.Conn, Context Pcontext) PrintGetImageResolut // PrintGetImageResolutionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintGetImageResolutionUnchecked(c *xgb.Conn, Context Pcontext) PrintGetImageResolutionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1100,7 +1154,9 @@ func printGetImageResolutionRequest(c *xgb.Conn, Context Pcontext) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 24 // request opcode @@ -1123,6 +1179,8 @@ type PrintGetOneAttributesCookie struct { // PrintGetOneAttributes sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintGetOneAttributesCookie.Reply() func PrintGetOneAttributes(c *xgb.Conn, Context Pcontext, NameLen uint32, Pool byte, Name []String8) PrintGetOneAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1134,6 +1192,8 @@ func PrintGetOneAttributes(c *xgb.Conn, Context Pcontext, NameLen uint32, Pool b // PrintGetOneAttributesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintGetOneAttributesUnchecked(c *xgb.Conn, Context Pcontext, NameLen uint32, Pool byte, Name []String8) PrintGetOneAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1198,7 +1258,9 @@ func printGetOneAttributesRequest(c *xgb.Conn, Context Pcontext, NameLen uint32, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 19 // request opcode @@ -1234,6 +1296,8 @@ type PrintGetPageDimensionsCookie struct { // PrintGetPageDimensions sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintGetPageDimensionsCookie.Reply() func PrintGetPageDimensions(c *xgb.Conn, Context Pcontext) PrintGetPageDimensionsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1245,6 +1309,8 @@ func PrintGetPageDimensions(c *xgb.Conn, Context Pcontext) PrintGetPageDimension // PrintGetPageDimensionsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintGetPageDimensionsUnchecked(c *xgb.Conn, Context Pcontext) PrintGetPageDimensionsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1319,7 +1385,9 @@ func printGetPageDimensionsRequest(c *xgb.Conn, Context Pcontext) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 21 // request opcode @@ -1342,6 +1410,8 @@ type PrintGetPrinterListCookie struct { // PrintGetPrinterList sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintGetPrinterListCookie.Reply() func PrintGetPrinterList(c *xgb.Conn, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) PrintGetPrinterListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1353,6 +1423,8 @@ func PrintGetPrinterList(c *xgb.Conn, PrinterNameLen uint32, LocaleLen uint32, P // PrintGetPrinterListUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintGetPrinterListUnchecked(c *xgb.Conn, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) PrintGetPrinterListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1414,7 +1486,9 @@ func printGetPrinterListRequest(c *xgb.Conn, PrinterNameLen uint32, LocaleLen ui b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -1450,6 +1524,8 @@ type PrintGetScreenOfContextCookie struct { // PrintGetScreenOfContext sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintGetScreenOfContextCookie.Reply() func PrintGetScreenOfContext(c *xgb.Conn) PrintGetScreenOfContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1461,6 +1537,8 @@ func PrintGetScreenOfContext(c *xgb.Conn) PrintGetScreenOfContextCookie { // PrintGetScreenOfContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintGetScreenOfContextUnchecked(c *xgb.Conn) PrintGetScreenOfContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1515,7 +1593,9 @@ func printGetScreenOfContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -1535,6 +1615,8 @@ type PrintInputSelectedCookie struct { // PrintInputSelected sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintInputSelectedCookie.Reply() func PrintInputSelected(c *xgb.Conn, Context Pcontext) PrintInputSelectedCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintInputSelected' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1546,6 +1628,8 @@ func PrintInputSelected(c *xgb.Conn, Context Pcontext) PrintInputSelectedCookie // PrintInputSelectedUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintInputSelectedUnchecked(c *xgb.Conn, Context Pcontext) PrintInputSelectedCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintInputSelected' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1620,7 +1704,9 @@ func printInputSelectedRequest(c *xgb.Conn, Context Pcontext) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 16 // request opcode @@ -1643,6 +1729,8 @@ type PrintPutDocumentDataCookie struct { // PrintPutDocumentData sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintPutDocumentData(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) PrintPutDocumentDataCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1654,6 +1742,8 @@ func PrintPutDocumentData(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, // PrintPutDocumentDataChecked sends a checked request. // If an error occurs, it can be retrieved using PrintPutDocumentDataCookie.Check() func PrintPutDocumentDataChecked(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) PrintPutDocumentDataCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1675,7 +1765,9 @@ func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode @@ -1720,6 +1812,8 @@ type PrintQueryScreensCookie struct { // PrintQueryScreens sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintQueryScreensCookie.Reply() func PrintQueryScreens(c *xgb.Conn) PrintQueryScreensCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1731,6 +1825,8 @@ func PrintQueryScreens(c *xgb.Conn) PrintQueryScreensCookie { // PrintQueryScreensUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintQueryScreensUnchecked(c *xgb.Conn) PrintQueryScreensCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1795,7 +1891,9 @@ func printQueryScreensRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 22 // request opcode @@ -1815,6 +1913,8 @@ type PrintQueryVersionCookie struct { // PrintQueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintQueryVersionCookie.Reply() func PrintQueryVersion(c *xgb.Conn) PrintQueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1826,6 +1926,8 @@ func PrintQueryVersion(c *xgb.Conn) PrintQueryVersionCookie { // PrintQueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintQueryVersionUnchecked(c *xgb.Conn) PrintQueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1884,7 +1986,9 @@ func printQueryVersionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -1904,6 +2008,8 @@ type PrintRehashPrinterListCookie struct { // PrintRehashPrinterList sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintRehashPrinterList(c *xgb.Conn) PrintRehashPrinterListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1915,6 +2021,8 @@ func PrintRehashPrinterList(c *xgb.Conn) PrintRehashPrinterListCookie { // PrintRehashPrinterListChecked sends a checked request. // If an error occurs, it can be retrieved using PrintRehashPrinterListCookie.Check() func PrintRehashPrinterListChecked(c *xgb.Conn) PrintRehashPrinterListCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1936,7 +2044,9 @@ func printRehashPrinterListRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 20 // request opcode @@ -1956,6 +2066,8 @@ type PrintSelectInputCookie struct { // PrintSelectInput sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintSelectInput(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList []uint32) PrintSelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1967,6 +2079,8 @@ func PrintSelectInput(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList // PrintSelectInputChecked sends a checked request. // If an error occurs, it can be retrieved using PrintSelectInputCookie.Check() func PrintSelectInputChecked(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList []uint32) PrintSelectInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -1988,7 +2102,9 @@ func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32, Ev b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 15 // request opcode @@ -2019,6 +2135,8 @@ type PrintSetAttributesCookie struct { // PrintSetAttributes sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintSetAttributes(c *xgb.Conn, Context Pcontext, StringLen uint32, Pool byte, Rule byte, Attributes []String8) PrintSetAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2030,6 +2148,8 @@ func PrintSetAttributes(c *xgb.Conn, Context Pcontext, StringLen uint32, Pool by // PrintSetAttributesChecked sends a checked request. // If an error occurs, it can be retrieved using PrintSetAttributesCookie.Check() func PrintSetAttributesChecked(c *xgb.Conn, Context Pcontext, StringLen uint32, Pool byte, Rule byte, Attributes []String8) PrintSetAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2051,7 +2171,9 @@ func printSetAttributesRequest(c *xgb.Conn, Context Pcontext, StringLen uint32, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 18 // request opcode @@ -2090,6 +2212,8 @@ type PrintSetContextCookie struct { // PrintSetContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintSetContext(c *xgb.Conn, Context uint32) PrintSetContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2101,6 +2225,8 @@ func PrintSetContext(c *xgb.Conn, Context uint32) PrintSetContextCookie { // PrintSetContextChecked sends a checked request. // If an error occurs, it can be retrieved using PrintSetContextCookie.Check() func PrintSetContextChecked(c *xgb.Conn, Context uint32) PrintSetContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2122,7 +2248,9 @@ func printSetContextRequest(c *xgb.Conn, Context uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -2145,6 +2273,8 @@ type PrintSetImageResolutionCookie struct { // PrintSetImageResolution sends a checked request. // If an error occurs, it will be returned with the reply by calling PrintSetImageResolutionCookie.Reply() func PrintSetImageResolution(c *xgb.Conn, Context Pcontext, ImageResolution uint16) PrintSetImageResolutionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2156,6 +2286,8 @@ func PrintSetImageResolution(c *xgb.Conn, Context Pcontext, ImageResolution uint // PrintSetImageResolutionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintSetImageResolutionUnchecked(c *xgb.Conn, Context Pcontext, ImageResolution uint16) PrintSetImageResolutionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2215,7 +2347,9 @@ func printSetImageResolutionRequest(c *xgb.Conn, Context Pcontext, ImageResoluti b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 23 // request opcode @@ -2241,6 +2375,8 @@ type PrintStartDocCookie struct { // PrintStartDoc sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintStartDoc(c *xgb.Conn, DriverMode byte) PrintStartDocCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2252,6 +2388,8 @@ func PrintStartDoc(c *xgb.Conn, DriverMode byte) PrintStartDocCookie { // PrintStartDocChecked sends a checked request. // If an error occurs, it can be retrieved using PrintStartDocCookie.Check() func PrintStartDocChecked(c *xgb.Conn, DriverMode byte) PrintStartDocCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2273,7 +2411,9 @@ func printStartDocRequest(c *xgb.Conn, DriverMode byte) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 9 // request opcode @@ -2296,6 +2436,8 @@ type PrintStartJobCookie struct { // PrintStartJob sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintStartJob(c *xgb.Conn, OutputMode byte) PrintStartJobCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2307,6 +2449,8 @@ func PrintStartJob(c *xgb.Conn, OutputMode byte) PrintStartJobCookie { // PrintStartJobChecked sends a checked request. // If an error occurs, it can be retrieved using PrintStartJobCookie.Check() func PrintStartJobChecked(c *xgb.Conn, OutputMode byte) PrintStartJobCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2328,7 +2472,9 @@ func printStartJobRequest(c *xgb.Conn, OutputMode byte) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -2351,6 +2497,8 @@ type PrintStartPageCookie struct { // PrintStartPage sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PrintStartPage(c *xgb.Conn, Window xproto.Window) PrintStartPageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2362,6 +2510,8 @@ func PrintStartPage(c *xgb.Conn, Window xproto.Window) PrintStartPageCookie { // PrintStartPageChecked sends a checked request. // If an error occurs, it can be retrieved using PrintStartPageCookie.Check() func PrintStartPageChecked(c *xgb.Conn, Window xproto.Window) PrintStartPageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } @@ -2383,7 +2533,9 @@ func printStartPageRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XpExtension"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode diff --git a/nexgb/xproto/xproto.go b/nexgb/xproto/xproto.go index 728f85f..716c49b 100644 --- a/nexgb/xproto/xproto.go +++ b/nexgb/xproto/xproto.go @@ -4227,6 +4227,10 @@ func NewPixmapId(c *xgb.Conn) (Pixmap, error) { return Pixmap(id), nil } +const ( + PixmapNone = 0 +) + // BadPixmap is the error number for a BadPixmap. const BadPixmap = 4 @@ -4265,10 +4269,6 @@ func init() { xgb.NewErrorFuncs[4] = PixmapErrorNew } -const ( - PixmapNone = 0 -) - const ( PlaceOnTop = 0 PlaceOnBottom = 1 @@ -6379,10 +6379,6 @@ func NewWindowId(c *xgb.Conn) (Window, error) { return Window(id), nil } -const ( - WindowNone = 0 -) - // BadWindow is the error number for a BadWindow. const BadWindow = 3 @@ -6421,6 +6417,10 @@ func init() { xgb.NewErrorFuncs[3] = WindowErrorNew } +const ( + WindowNone = 0 +) + const ( WindowClassCopyFromParent = 0 WindowClassInputOutput = 1 diff --git a/nexgb/xselinux/xselinux.go b/nexgb/xselinux/xselinux.go index 87d8f98..1afcc10 100644 --- a/nexgb/xselinux/xselinux.go +++ b/nexgb/xselinux/xselinux.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named SELinux could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["SELinux"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["SELinux"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["SELinux"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -161,6 +160,8 @@ type GetClientContextCookie struct { // GetClientContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetClientContextCookie.Reply() func GetClientContext(c *xgb.Conn, Resource uint32) GetClientContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetClientContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -172,6 +173,8 @@ func GetClientContext(c *xgb.Conn, Resource uint32) GetClientContextCookie { // GetClientContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetClientContextUnchecked(c *xgb.Conn, Resource uint32) GetClientContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetClientContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -237,7 +240,9 @@ func getClientContextRequest(c *xgb.Conn, Resource uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 22 // request opcode @@ -260,6 +265,8 @@ type GetDeviceContextCookie struct { // GetDeviceContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetDeviceContextCookie.Reply() func GetDeviceContext(c *xgb.Conn, Device uint32) GetDeviceContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -271,6 +278,8 @@ func GetDeviceContext(c *xgb.Conn, Device uint32) GetDeviceContextCookie { // GetDeviceContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDeviceContextUnchecked(c *xgb.Conn, Device uint32) GetDeviceContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -336,7 +345,9 @@ func getDeviceContextRequest(c *xgb.Conn, Device uint32) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -359,6 +370,8 @@ type GetDeviceCreateContextCookie struct { // GetDeviceCreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetDeviceCreateContextCookie.Reply() func GetDeviceCreateContext(c *xgb.Conn) GetDeviceCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -370,6 +383,8 @@ func GetDeviceCreateContext(c *xgb.Conn) GetDeviceCreateContextCookie { // GetDeviceCreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDeviceCreateContextUnchecked(c *xgb.Conn) GetDeviceCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -435,7 +450,9 @@ func getDeviceCreateContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -455,6 +472,8 @@ type GetPropertyContextCookie struct { // GetPropertyContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPropertyContextCookie.Reply() func GetPropertyContext(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetPropertyContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -466,6 +485,8 @@ func GetPropertyContext(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) // GetPropertyContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPropertyContextUnchecked(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetPropertyContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -531,7 +552,9 @@ func getPropertyContextRequest(c *xgb.Conn, Window xproto.Window, Property xprot b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -557,6 +580,8 @@ type GetPropertyCreateContextCookie struct { // GetPropertyCreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPropertyCreateContextCookie.Reply() func GetPropertyCreateContext(c *xgb.Conn) GetPropertyCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -568,6 +593,8 @@ func GetPropertyCreateContext(c *xgb.Conn) GetPropertyCreateContextCookie { // GetPropertyCreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPropertyCreateContextUnchecked(c *xgb.Conn) GetPropertyCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -633,7 +660,9 @@ func getPropertyCreateContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 9 // request opcode @@ -653,6 +682,8 @@ type GetPropertyDataContextCookie struct { // GetPropertyDataContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPropertyDataContextCookie.Reply() func GetPropertyDataContext(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyDataContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetPropertyDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -664,6 +695,8 @@ func GetPropertyDataContext(c *xgb.Conn, Window xproto.Window, Property xproto.A // GetPropertyDataContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPropertyDataContextUnchecked(c *xgb.Conn, Window xproto.Window, Property xproto.Atom) GetPropertyDataContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetPropertyDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -729,7 +762,9 @@ func getPropertyDataContextRequest(c *xgb.Conn, Window xproto.Window, Property x b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode @@ -755,6 +790,8 @@ type GetPropertyUseContextCookie struct { // GetPropertyUseContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPropertyUseContextCookie.Reply() func GetPropertyUseContext(c *xgb.Conn) GetPropertyUseContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -766,6 +803,8 @@ func GetPropertyUseContext(c *xgb.Conn) GetPropertyUseContextCookie { // GetPropertyUseContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPropertyUseContextUnchecked(c *xgb.Conn) GetPropertyUseContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -831,7 +870,9 @@ func getPropertyUseContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode @@ -851,6 +892,8 @@ type GetSelectionContextCookie struct { // GetSelectionContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetSelectionContextCookie.Reply() func GetSelectionContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetSelectionContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -862,6 +905,8 @@ func GetSelectionContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionContext // GetSelectionContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetSelectionContextUnchecked(c *xgb.Conn, Selection xproto.Atom) GetSelectionContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetSelectionContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -927,7 +972,9 @@ func getSelectionContextRequest(c *xgb.Conn, Selection xproto.Atom) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 19 // request opcode @@ -950,6 +997,8 @@ type GetSelectionCreateContextCookie struct { // GetSelectionCreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetSelectionCreateContextCookie.Reply() func GetSelectionCreateContext(c *xgb.Conn) GetSelectionCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -961,6 +1010,8 @@ func GetSelectionCreateContext(c *xgb.Conn) GetSelectionCreateContextCookie { // GetSelectionCreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetSelectionCreateContextUnchecked(c *xgb.Conn) GetSelectionCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1026,7 +1077,9 @@ func getSelectionCreateContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 16 // request opcode @@ -1046,6 +1099,8 @@ type GetSelectionDataContextCookie struct { // GetSelectionDataContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetSelectionDataContextCookie.Reply() func GetSelectionDataContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionDataContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetSelectionDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1057,6 +1112,8 @@ func GetSelectionDataContext(c *xgb.Conn, Selection xproto.Atom) GetSelectionDat // GetSelectionDataContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetSelectionDataContextUnchecked(c *xgb.Conn, Selection xproto.Atom) GetSelectionDataContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetSelectionDataContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1122,7 +1179,9 @@ func getSelectionDataContextRequest(c *xgb.Conn, Selection xproto.Atom) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 20 // request opcode @@ -1145,6 +1204,8 @@ type GetSelectionUseContextCookie struct { // GetSelectionUseContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetSelectionUseContextCookie.Reply() func GetSelectionUseContext(c *xgb.Conn) GetSelectionUseContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1156,6 +1217,8 @@ func GetSelectionUseContext(c *xgb.Conn) GetSelectionUseContextCookie { // GetSelectionUseContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetSelectionUseContextUnchecked(c *xgb.Conn) GetSelectionUseContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1221,7 +1284,9 @@ func getSelectionUseContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 18 // request opcode @@ -1241,6 +1306,8 @@ type GetWindowContextCookie struct { // GetWindowContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetWindowContextCookie.Reply() func GetWindowContext(c *xgb.Conn, Window xproto.Window) GetWindowContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetWindowContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1252,6 +1319,8 @@ func GetWindowContext(c *xgb.Conn, Window xproto.Window) GetWindowContextCookie // GetWindowContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetWindowContextUnchecked(c *xgb.Conn, Window xproto.Window) GetWindowContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetWindowContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1317,7 +1386,9 @@ func getWindowContextRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -1340,6 +1411,8 @@ type GetWindowCreateContextCookie struct { // GetWindowCreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetWindowCreateContextCookie.Reply() func GetWindowCreateContext(c *xgb.Conn) GetWindowCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1351,6 +1424,8 @@ func GetWindowCreateContext(c *xgb.Conn) GetWindowCreateContextCookie { // GetWindowCreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetWindowCreateContextUnchecked(c *xgb.Conn) GetWindowCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'GetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1416,7 +1491,9 @@ func getWindowCreateContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -1436,6 +1513,8 @@ type ListPropertiesCookie struct { // ListProperties sends a checked request. // If an error occurs, it will be returned with the reply by calling ListPropertiesCookie.Reply() func ListProperties(c *xgb.Conn, Window xproto.Window) ListPropertiesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'ListProperties' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1447,6 +1526,8 @@ func ListProperties(c *xgb.Conn, Window xproto.Window) ListPropertiesCookie { // ListPropertiesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListPropertiesUnchecked(c *xgb.Conn, Window xproto.Window) ListPropertiesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'ListProperties' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1508,7 +1589,9 @@ func listPropertiesRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 14 // request opcode @@ -1531,6 +1614,8 @@ type ListSelectionsCookie struct { // ListSelections sends a checked request. // If an error occurs, it will be returned with the reply by calling ListSelectionsCookie.Reply() func ListSelections(c *xgb.Conn) ListSelectionsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'ListSelections' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1542,6 +1627,8 @@ func ListSelections(c *xgb.Conn) ListSelectionsCookie { // ListSelectionsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListSelectionsUnchecked(c *xgb.Conn) ListSelectionsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'ListSelections' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1603,7 +1690,9 @@ func listSelectionsRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 21 // request opcode @@ -1623,6 +1712,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1634,6 +1725,8 @@ func QueryVersion(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionC // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1692,7 +1785,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajor byte, ClientMinor byte) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -1718,6 +1813,8 @@ type SetDeviceContextCookie struct { // SetDeviceContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetDeviceContext(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) SetDeviceContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1729,6 +1826,8 @@ func SetDeviceContext(c *xgb.Conn, Device uint32, ContextLen uint32, Context str // SetDeviceContextChecked sends a checked request. // If an error occurs, it can be retrieved using SetDeviceContextCookie.Check() func SetDeviceContextChecked(c *xgb.Conn, Device uint32, ContextLen uint32, Context string) SetDeviceContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetDeviceContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1750,7 +1849,9 @@ func setDeviceContextRequest(c *xgb.Conn, Device uint32, ContextLen uint32, Cont b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -1779,6 +1880,8 @@ type SetDeviceCreateContextCookie struct { // SetDeviceCreateContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetDeviceCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetDeviceCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1790,6 +1893,8 @@ func SetDeviceCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetD // SetDeviceCreateContextChecked sends a checked request. // If an error occurs, it can be retrieved using SetDeviceCreateContextCookie.Check() func SetDeviceCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetDeviceCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetDeviceCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1811,7 +1916,9 @@ func setDeviceCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context strin b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -1837,6 +1944,8 @@ type SetPropertyCreateContextCookie struct { // SetPropertyCreateContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPropertyCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1848,6 +1957,8 @@ func SetPropertyCreateContext(c *xgb.Conn, ContextLen uint32, Context string) Se // SetPropertyCreateContextChecked sends a checked request. // If an error occurs, it can be retrieved using SetPropertyCreateContextCookie.Check() func SetPropertyCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetPropertyCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1869,7 +1980,9 @@ func setPropertyCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context str b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -1895,6 +2008,8 @@ type SetPropertyUseContextCookie struct { // SetPropertyUseContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPropertyUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyUseContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1906,6 +2021,8 @@ func SetPropertyUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetPr // SetPropertyUseContextChecked sends a checked request. // If an error occurs, it can be retrieved using SetPropertyUseContextCookie.Check() func SetPropertyUseContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetPropertyUseContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetPropertyUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1927,7 +2044,9 @@ func setPropertyUseContextRequest(c *xgb.Conn, ContextLen uint32, Context string b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -1953,6 +2072,8 @@ type SetSelectionCreateContextCookie struct { // SetSelectionCreateContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetSelectionCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1964,6 +2085,8 @@ func SetSelectionCreateContext(c *xgb.Conn, ContextLen uint32, Context string) S // SetSelectionCreateContextChecked sends a checked request. // If an error occurs, it can be retrieved using SetSelectionCreateContextCookie.Check() func SetSelectionCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetSelectionCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -1985,7 +2108,9 @@ func setSelectionCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context st b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 15 // request opcode @@ -2011,6 +2136,8 @@ type SetSelectionUseContextCookie struct { // SetSelectionUseContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetSelectionUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionUseContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -2022,6 +2149,8 @@ func SetSelectionUseContext(c *xgb.Conn, ContextLen uint32, Context string) SetS // SetSelectionUseContextChecked sends a checked request. // If an error occurs, it can be retrieved using SetSelectionUseContextCookie.Check() func SetSelectionUseContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetSelectionUseContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetSelectionUseContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -2043,7 +2172,9 @@ func setSelectionUseContextRequest(c *xgb.Conn, ContextLen uint32, Context strin b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 17 // request opcode @@ -2069,6 +2200,8 @@ type SetWindowCreateContextCookie struct { // SetWindowCreateContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetWindowCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetWindowCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -2080,6 +2213,8 @@ func SetWindowCreateContext(c *xgb.Conn, ContextLen uint32, Context string) SetW // SetWindowCreateContextChecked sends a checked request. // If an error occurs, it can be retrieved using SetWindowCreateContextCookie.Check() func SetWindowCreateContextChecked(c *xgb.Conn, ContextLen uint32, Context string) SetWindowCreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["SELinux"]; !ok { panic("Cannot issue request 'SetWindowCreateContext' using the uninitialized extension 'SELinux'. xselinux.Init(connObj) must be called first.") } @@ -2101,7 +2236,9 @@ func setWindowCreateContextRequest(c *xgb.Conn, ContextLen uint32, Context strin b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["SELinux"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode diff --git a/nexgb/xtest/xtest.go b/nexgb/xtest/xtest.go index 982e9f9..182760e 100644 --- a/nexgb/xtest/xtest.go +++ b/nexgb/xtest/xtest.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XTEST could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XTEST"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XTEST"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XTEST"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -74,6 +73,8 @@ type CompareCursorCookie struct { // CompareCursor sends a checked request. // If an error occurs, it will be returned with the reply by calling CompareCursorCookie.Reply() func CompareCursor(c *xgb.Conn, Window xproto.Window, Cursor xproto.Cursor) CompareCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XTEST"]; !ok { panic("Cannot issue request 'CompareCursor' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.") } @@ -85,6 +86,8 @@ func CompareCursor(c *xgb.Conn, Window xproto.Window, Cursor xproto.Cursor) Comp // CompareCursorUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompareCursorUnchecked(c *xgb.Conn, Window xproto.Window, Cursor xproto.Cursor) CompareCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XTEST"]; !ok { panic("Cannot issue request 'CompareCursor' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.") } @@ -140,7 +143,9 @@ func compareCursorRequest(c *xgb.Conn, Window xproto.Window, Cursor xproto.Curso b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XTEST"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -166,6 +171,8 @@ type FakeInputCookie struct { // FakeInput sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FakeInput(c *xgb.Conn, Type byte, Detail byte, Time uint32, Root xproto.Window, RootX int16, RootY int16, Deviceid byte) FakeInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XTEST"]; !ok { panic("Cannot issue request 'FakeInput' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.") } @@ -177,6 +184,8 @@ func FakeInput(c *xgb.Conn, Type byte, Detail byte, Time uint32, Root xproto.Win // FakeInputChecked sends a checked request. // If an error occurs, it can be retrieved using FakeInputCookie.Check() func FakeInputChecked(c *xgb.Conn, Type byte, Detail byte, Time uint32, Root xproto.Window, RootX int16, RootY int16, Deviceid byte) FakeInputCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XTEST"]; !ok { panic("Cannot issue request 'FakeInput' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.") } @@ -198,7 +207,9 @@ func fakeInputRequest(c *xgb.Conn, Type byte, Detail byte, Time uint32, Root xpr b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XTEST"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -245,6 +256,8 @@ type GetVersionCookie struct { // GetVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling GetVersionCookie.Reply() func GetVersion(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) GetVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XTEST"]; !ok { panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.") } @@ -256,6 +269,8 @@ func GetVersion(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) GetVersionC // GetVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetVersionUnchecked(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) GetVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XTEST"]; !ok { panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.") } @@ -311,7 +326,9 @@ func getVersionRequest(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) []by b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XTEST"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -339,6 +356,8 @@ type GrabControlCookie struct { // GrabControl sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GrabControl(c *xgb.Conn, Impervious bool) GrabControlCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XTEST"]; !ok { panic("Cannot issue request 'GrabControl' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.") } @@ -350,6 +369,8 @@ func GrabControl(c *xgb.Conn, Impervious bool) GrabControlCookie { // GrabControlChecked sends a checked request. // If an error occurs, it can be retrieved using GrabControlCookie.Check() func GrabControlChecked(c *xgb.Conn, Impervious bool) GrabControlCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XTEST"]; !ok { panic("Cannot issue request 'GrabControl' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.") } @@ -371,7 +392,9 @@ func grabControlRequest(c *xgb.Conn, Impervious bool) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XTEST"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode diff --git a/nexgb/xv/xv.go b/nexgb/xv/xv.go index 1c406b0..f0d3f3a 100644 --- a/nexgb/xv/xv.go +++ b/nexgb/xv/xv.go @@ -20,16 +20,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XVideo could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XVideo"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XVideo"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XVideo"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -46,7 +45,7 @@ type AdaptorInfo struct { Type byte // padding: 1 bytes Name string // size: xgb.Pad((int(NameSize) * 1)) - // alignment gap to multiple of 4 + // padding: 0 bytes Formats []Format // size: xgb.Pad((int(NumFormats) * 8)) } @@ -78,7 +77,7 @@ func AdaptorInfoRead(buf []byte, v *AdaptorInfo) int { b += int(v.NameSize) } - b = (b + 3) & ^3 // alignment gap + b += 0 // padding v.Formats = make([]Format, v.NumFormats) b += FormatReadList(buf[b:], v.Formats) @@ -98,7 +97,7 @@ func AdaptorInfoReadList(buf []byte, dest []AdaptorInfo) int { // Bytes writes a AdaptorInfo value to a byte slice. func (v AdaptorInfo) Bytes() []byte { - buf := make([]byte, (((12 + xgb.Pad((int(v.NameSize) * 1))) + 4) + xgb.Pad((int(v.NumFormats) * 8)))) + buf := make([]byte, (((12 + xgb.Pad((int(v.NameSize) * 1))) + 0) + xgb.Pad((int(v.NumFormats) * 8)))) b := 0 xgb.Put32(buf[b:], uint32(v.BaseId)) @@ -121,7 +120,7 @@ func (v AdaptorInfo) Bytes() []byte { copy(buf[b:], v.Name[:v.NameSize]) b += int(v.NameSize) - b = (b + 3) & ^3 // alignment gap + b += 0 // padding b += FormatListBytes(buf[b:], v.Formats) @@ -144,7 +143,7 @@ func AdaptorInfoListBytes(buf []byte, list []AdaptorInfo) int { func AdaptorInfoListSize(list []AdaptorInfo) int { size := 0 for _, item := range list { - size += (((12 + xgb.Pad((int(item.NameSize) * 1))) + 4) + xgb.Pad((int(item.NumFormats) * 8))) + size += (((12 + xgb.Pad((int(item.NameSize) * 1))) + 0) + xgb.Pad((int(item.NumFormats) * 8))) } return size } @@ -1208,6 +1207,8 @@ type GetPortAttributeCookie struct { // GetPortAttribute sends a checked request. // If an error occurs, it will be returned with the reply by calling GetPortAttributeCookie.Reply() func GetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom) GetPortAttributeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'GetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1219,6 +1220,8 @@ func GetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom) GetPortAttr // GetPortAttributeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPortAttributeUnchecked(c *xgb.Conn, Port Port, Attribute xproto.Atom) GetPortAttributeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'GetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1273,7 +1276,9 @@ func getPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom) []by b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 14 // request opcode @@ -1299,6 +1304,8 @@ type GetStillCookie struct { // GetStill sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetStill(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetStillCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'GetStill' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1310,6 +1317,8 @@ func GetStill(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gconte // GetStillChecked sends a checked request. // If an error occurs, it can be retrieved using GetStillCookie.Check() func GetStillChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetStillCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'GetStill' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1331,7 +1340,9 @@ func getStillRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -1384,6 +1395,8 @@ type GetVideoCookie struct { // GetVideo sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetVideoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'GetVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1395,6 +1408,8 @@ func GetVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gconte // GetVideoChecked sends a checked request. // If an error occurs, it can be retrieved using GetVideoCookie.Check() func GetVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetVideoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'GetVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1416,7 +1431,9 @@ func getVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -1469,6 +1486,8 @@ type GrabPortCookie struct { // GrabPort sends a checked request. // If an error occurs, it will be returned with the reply by calling GrabPortCookie.Reply() func GrabPort(c *xgb.Conn, Port Port, Time xproto.Timestamp) GrabPortCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'GrabPort' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1480,6 +1499,8 @@ func GrabPort(c *xgb.Conn, Port Port, Time xproto.Timestamp) GrabPortCookie { // GrabPortUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GrabPortUnchecked(c *xgb.Conn, Port Port, Time xproto.Timestamp) GrabPortCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'GrabPort' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1531,7 +1552,9 @@ func grabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -1557,6 +1580,8 @@ type ListImageFormatsCookie struct { // ListImageFormats sends a checked request. // If an error occurs, it will be returned with the reply by calling ListImageFormatsCookie.Reply() func ListImageFormats(c *xgb.Conn, Port Port) ListImageFormatsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'ListImageFormats' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1568,6 +1593,8 @@ func ListImageFormats(c *xgb.Conn, Port Port) ListImageFormatsCookie { // ListImageFormatsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListImageFormatsUnchecked(c *xgb.Conn, Port Port) ListImageFormatsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'ListImageFormats' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1629,7 +1656,9 @@ func listImageFormatsRequest(c *xgb.Conn, Port Port) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 16 // request opcode @@ -1652,6 +1681,8 @@ type PutImageCookie struct { // PutImage sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PutImage(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) PutImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'PutImage' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1663,6 +1694,8 @@ func PutImage(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gconte // PutImageChecked sends a checked request. // If an error occurs, it can be retrieved using PutImageCookie.Check() func PutImageChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) PutImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'PutImage' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1684,7 +1717,9 @@ func putImageRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 18 // request opcode @@ -1749,6 +1784,8 @@ type PutStillCookie struct { // PutStill sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PutStill(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutStillCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'PutStill' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1760,6 +1797,8 @@ func PutStill(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gconte // PutStillChecked sends a checked request. // If an error occurs, it can be retrieved using PutStillCookie.Check() func PutStillChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutStillCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'PutStill' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1781,7 +1820,9 @@ func putStillRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -1834,6 +1875,8 @@ type PutVideoCookie struct { // PutVideo sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PutVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutVideoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'PutVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1845,6 +1888,8 @@ func PutVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gconte // PutVideoChecked sends a checked request. // If an error occurs, it can be retrieved using PutVideoCookie.Check() func PutVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutVideoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'PutVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1866,7 +1911,9 @@ func putVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -1919,6 +1966,8 @@ type QueryAdaptorsCookie struct { // QueryAdaptors sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryAdaptorsCookie.Reply() func QueryAdaptors(c *xgb.Conn, Window xproto.Window) QueryAdaptorsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryAdaptors' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1930,6 +1979,8 @@ func QueryAdaptors(c *xgb.Conn, Window xproto.Window) QueryAdaptorsCookie { // QueryAdaptorsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryAdaptorsUnchecked(c *xgb.Conn, Window xproto.Window) QueryAdaptorsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryAdaptors' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -1991,7 +2042,9 @@ func queryAdaptorsRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -2014,6 +2067,8 @@ type QueryBestSizeCookie struct { // QueryBestSize sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryBestSizeCookie.Reply() func QueryBestSize(c *xgb.Conn, Port Port, VidW uint16, VidH uint16, DrwW uint16, DrwH uint16, Motion bool) QueryBestSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryBestSize' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2025,6 +2080,8 @@ func QueryBestSize(c *xgb.Conn, Port Port, VidW uint16, VidH uint16, DrwW uint16 // QueryBestSizeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryBestSizeUnchecked(c *xgb.Conn, Port Port, VidW uint16, VidH uint16, DrwW uint16, DrwH uint16, Motion bool) QueryBestSizeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryBestSize' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2083,7 +2140,9 @@ func queryBestSizeRequest(c *xgb.Conn, Port Port, VidW uint16, VidH uint16, DrwW b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -2127,6 +2186,8 @@ type QueryEncodingsCookie struct { // QueryEncodings sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryEncodingsCookie.Reply() func QueryEncodings(c *xgb.Conn, Port Port) QueryEncodingsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryEncodings' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2138,6 +2199,8 @@ func QueryEncodings(c *xgb.Conn, Port Port) QueryEncodingsCookie { // QueryEncodingsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryEncodingsUnchecked(c *xgb.Conn, Port Port) QueryEncodingsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryEncodings' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2199,7 +2262,9 @@ func queryEncodingsRequest(c *xgb.Conn, Port Port) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -2222,6 +2287,8 @@ type QueryExtensionCookie struct { // QueryExtension sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryExtensionCookie.Reply() func QueryExtension(c *xgb.Conn) QueryExtensionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryExtension' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2233,6 +2300,8 @@ func QueryExtension(c *xgb.Conn) QueryExtensionCookie { // QueryExtensionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryExtensionUnchecked(c *xgb.Conn) QueryExtensionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryExtension' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2291,7 +2360,9 @@ func queryExtensionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -2311,6 +2382,8 @@ type QueryImageAttributesCookie struct { // QueryImageAttributes sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryImageAttributesCookie.Reply() func QueryImageAttributes(c *xgb.Conn, Port Port, Id uint32, Width uint16, Height uint16) QueryImageAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryImageAttributes' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2322,6 +2395,8 @@ func QueryImageAttributes(c *xgb.Conn, Port Port, Id uint32, Width uint16, Heigh // QueryImageAttributesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryImageAttributesUnchecked(c *xgb.Conn, Port Port, Id uint32, Width uint16, Height uint16) QueryImageAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryImageAttributes' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2408,7 +2483,9 @@ func queryImageAttributesRequest(c *xgb.Conn, Port Port, Id uint32, Width uint16 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 17 // request opcode @@ -2440,6 +2517,8 @@ type QueryPortAttributesCookie struct { // QueryPortAttributes sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryPortAttributesCookie.Reply() func QueryPortAttributes(c *xgb.Conn, Port Port) QueryPortAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryPortAttributes' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2451,6 +2530,8 @@ func QueryPortAttributes(c *xgb.Conn, Port Port) QueryPortAttributesCookie { // QueryPortAttributesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPortAttributesUnchecked(c *xgb.Conn, Port Port) QueryPortAttributesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'QueryPortAttributes' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2516,7 +2597,9 @@ func queryPortAttributesRequest(c *xgb.Conn, Port Port) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 15 // request opcode @@ -2539,6 +2622,8 @@ type SelectPortNotifyCookie struct { // SelectPortNotify sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectPortNotify(c *xgb.Conn, Port Port, Onoff bool) SelectPortNotifyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'SelectPortNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2550,6 +2635,8 @@ func SelectPortNotify(c *xgb.Conn, Port Port, Onoff bool) SelectPortNotifyCookie // SelectPortNotifyChecked sends a checked request. // If an error occurs, it can be retrieved using SelectPortNotifyCookie.Check() func SelectPortNotifyChecked(c *xgb.Conn, Port Port, Onoff bool) SelectPortNotifyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'SelectPortNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2571,7 +2658,9 @@ func selectPortNotifyRequest(c *xgb.Conn, Port Port, Onoff bool) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode @@ -2603,6 +2692,8 @@ type SelectVideoNotifyCookie struct { // SelectVideoNotify sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectVideoNotify(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) SelectVideoNotifyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'SelectVideoNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2614,6 +2705,8 @@ func SelectVideoNotify(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) Select // SelectVideoNotifyChecked sends a checked request. // If an error occurs, it can be retrieved using SelectVideoNotifyCookie.Check() func SelectVideoNotifyChecked(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) SelectVideoNotifyCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'SelectVideoNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2635,7 +2728,9 @@ func selectVideoNotifyRequest(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -2667,6 +2762,8 @@ type SetPortAttributeCookie struct { // SetPortAttribute sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) SetPortAttributeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'SetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2678,6 +2775,8 @@ func SetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32 // SetPortAttributeChecked sends a checked request. // If an error occurs, it can be retrieved using SetPortAttributeCookie.Check() func SetPortAttributeChecked(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) SetPortAttributeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'SetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2699,7 +2798,9 @@ func setPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom, Valu b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode @@ -2728,6 +2829,8 @@ type ShmPutImageCookie struct { // ShmPutImage sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ShmPutImage(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Shmseg shm.Seg, Id uint32, Offset uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, SendEvent byte) ShmPutImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'ShmPutImage' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2739,6 +2842,8 @@ func ShmPutImage(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gco // ShmPutImageChecked sends a checked request. // If an error occurs, it can be retrieved using ShmPutImageCookie.Check() func ShmPutImageChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Shmseg shm.Seg, Id uint32, Offset uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, SendEvent byte) ShmPutImageCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'ShmPutImage' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2760,7 +2865,9 @@ func shmPutImageRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xpr b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 19 // request opcode @@ -2833,6 +2940,8 @@ type StopVideoCookie struct { // StopVideo sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func StopVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable) StopVideoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'StopVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2844,6 +2953,8 @@ func StopVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable) StopVideoCookie // StopVideoChecked sends a checked request. // If an error occurs, it can be retrieved using StopVideoCookie.Check() func StopVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable) StopVideoCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'StopVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2865,7 +2976,9 @@ func stopVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 9 // request opcode @@ -2891,6 +3004,8 @@ type UngrabPortCookie struct { // UngrabPort sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UngrabPort(c *xgb.Conn, Port Port, Time xproto.Timestamp) UngrabPortCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'UngrabPort' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2902,6 +3017,8 @@ func UngrabPort(c *xgb.Conn, Port Port, Time xproto.Timestamp) UngrabPortCookie // UngrabPortChecked sends a checked request. // If an error occurs, it can be retrieved using UngrabPortCookie.Check() func UngrabPortChecked(c *xgb.Conn, Port Port, Time xproto.Timestamp) UngrabPortCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo"]; !ok { panic("Cannot issue request 'UngrabPort' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.") } @@ -2923,7 +3040,9 @@ func ungrabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index a574a21..b943fa0 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -20,16 +20,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XVideo-MotionCompensation could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XVideo-MotionCompensation"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XVideo-MotionCompensation"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -203,6 +202,8 @@ type CreateContextCookie struct { // CreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateContextCookie.Reply() func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -214,6 +215,8 @@ func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Sur // CreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContextUnchecked(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -286,7 +289,9 @@ func createContextRequest(c *xgb.Conn, ContextId Context, PortId xv.Port, Surfac b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -324,6 +329,8 @@ type CreateSubpictureCookie struct { // CreateSubpicture sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateSubpictureCookie.Reply() func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -335,6 +342,8 @@ func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, Xvi // CreateSubpictureUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSubpictureUnchecked(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -416,7 +425,9 @@ func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Conte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -451,6 +462,8 @@ type CreateSurfaceCookie struct { // CreateSurface sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateSurfaceCookie.Reply() func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -462,6 +475,8 @@ func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurf // CreateSurfaceUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSurfaceUnchecked(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -522,7 +537,9 @@ func createSurfaceRequest(c *xgb.Conn, SurfaceId Surface, ContextId Context) []b b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -548,6 +565,8 @@ type DestroyContextCookie struct { // DestroyContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -559,6 +578,8 @@ func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie { // DestroyContextChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyContextCookie.Check() func DestroyContextChecked(c *xgb.Conn, ContextId Context) DestroyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -580,7 +601,9 @@ func destroyContextRequest(c *xgb.Conn, ContextId Context) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -603,6 +626,8 @@ type DestroySubpictureCookie struct { // DestroySubpicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -614,6 +639,8 @@ func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCo // DestroySubpictureChecked sends a checked request. // If an error occurs, it can be retrieved using DestroySubpictureCookie.Check() func DestroySubpictureChecked(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -635,7 +662,9 @@ func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -658,6 +687,8 @@ type DestroySurfaceCookie struct { // DestroySurface sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -669,6 +700,8 @@ func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { // DestroySurfaceChecked sends a checked request. // If an error occurs, it can be retrieved using DestroySurfaceCookie.Check() func DestroySurfaceChecked(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -690,7 +723,9 @@ func destroySurfaceRequest(c *xgb.Conn, SurfaceId Surface) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -713,6 +748,8 @@ type ListSubpictureTypesCookie struct { // ListSubpictureTypes sends a checked request. // If an error occurs, it will be returned with the reply by calling ListSubpictureTypesCookie.Reply() func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -724,6 +761,8 @@ func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSub // ListSubpictureTypesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListSubpictureTypesUnchecked(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -785,7 +824,9 @@ func listSubpictureTypesRequest(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -811,6 +852,8 @@ type ListSurfaceTypesCookie struct { // ListSurfaceTypes sends a checked request. // If an error occurs, it will be returned with the reply by calling ListSurfaceTypesCookie.Reply() func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -822,6 +865,8 @@ func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { // ListSurfaceTypesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListSurfaceTypesUnchecked(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -883,7 +928,9 @@ func listSurfaceTypesRequest(c *xgb.Conn, PortId xv.Port) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -906,6 +953,8 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -917,6 +966,8 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -975,7 +1026,9 @@ func queryVersionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode -- cgit v1.2.3-70-g09d2