diff options
Diffstat (limited to 'nexgb/xprint/xprint.go')
-rw-r--r-- | nexgb/xprint/xprint.go | 164 |
1 files changed, 158 insertions, 6 deletions
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 |