From 0c50dc6241fa21712e041cfa2bfb9db4ccaef10a Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 17:01:42 -0400 Subject: a huge commit. splitting extensions into their own sub-packages. --- nexgb/xprint/xprint.go | 2164 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2164 insertions(+) create mode 100644 nexgb/xprint/xprint.go (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go new file mode 100644 index 0000000..2fcf49f --- /dev/null +++ b/nexgb/xprint/xprint.go @@ -0,0 +1,2164 @@ +package xprint + +/* + This file was generated by xprint.xml on May 10 2012 4:20:28pm EDT. + This file is automatically generated. Edit at your peril! +*/ + +import ( + "github.com/BurntSushi/xgb" + + "github.com/BurntSushi/xgb/xproto" +) + +// Init must be called before using the XpExtension extension. +func Init(c *xgb.Conn) error { + reply, err := xproto.QueryExtension(c, 11, "XpExtension").Reply() + switch { + case err != nil: + return err + case !reply.Present: + return xgb.Errorf("No extension named XpExtension could be found on on the server.") + } + + xgb.ExtLock.Lock() + c.Extensions["XpExtension"] = reply.MajorOpcode + 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 +} + +func init() { + xgb.NewExtEventFuncs["XpExtension"] = make(map[int]xgb.NewEventFun) + xgb.NewExtErrorFuncs["XpExtension"] = make(map[int]xgb.NewErrorFun) +} + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +const ( + GetDocFinished = 0 + GetDocSecondConsumer = 1 +) + +const ( + EvMaskNoEventMask = 0 + EvMaskPrintMask = 1 + EvMaskAttributeMask = 2 +) + +const ( + DetailStartJobNotify = 1 + DetailEndJobNotify = 2 + DetailStartDocNotify = 3 + DetailEndDocNotify = 4 + DetailStartPageNotify = 5 + DetailEndPageNotify = 6 +) + +const ( + AttrJobAttr = 1 + AttrDocAttr = 2 + AttrPageAttr = 3 + AttrPrinterAttr = 4 + AttrServerAttr = 5 + AttrMediumAttr = 6 + AttrSpoolerAttr = 7 +) + +type Pcontext uint32 + +func NewPcontextId(c *xgb.Conn) (Pcontext, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Pcontext(id), nil +} + +type String8 byte + +// 'Printer' struct definition +// Size: (((4 + xgb.Pad((int(NameLen) * 1))) + 4) + xgb.Pad((int(DescLen) * 1))) +type Printer struct { + NameLen uint32 + Name []String8 // size: xgb.Pad((int(NameLen) * 1)) + DescLen uint32 + Description []String8 // size: xgb.Pad((int(DescLen) * 1)) +} + +// Struct read Printer +func PrinterRead(buf []byte, v *Printer) int { + b := 0 + + v.NameLen = xgb.Get32(buf[b:]) + b += 4 + + v.Name = make([]String8, v.NameLen) + for i := 0; i < int(v.NameLen); i++ { + v.Name[i] = String8(buf[b]) + b += 1 + } + b = xgb.Pad(b) + + v.DescLen = xgb.Get32(buf[b:]) + b += 4 + + v.Description = make([]String8, v.DescLen) + for i := 0; i < int(v.DescLen); i++ { + v.Description[i] = String8(buf[b]) + b += 1 + } + b = xgb.Pad(b) + + return b +} + +// Struct list read Printer +func PrinterReadList(buf []byte, dest []Printer) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Printer{} + b += PrinterRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Printer +func (v Printer) Bytes() []byte { + buf := make([]byte, (((4 + xgb.Pad((int(v.NameLen) * 1))) + 4) + xgb.Pad((int(v.DescLen) * 1)))) + b := 0 + + xgb.Put32(buf[b:], v.NameLen) + b += 4 + + for i := 0; i < int(v.NameLen); i++ { + buf[b] = byte(v.Name[i]) + b += 1 + } + b = xgb.Pad(b) + + xgb.Put32(buf[b:], v.DescLen) + b += 4 + + for i := 0; i < int(v.DescLen); i++ { + buf[b] = byte(v.Description[i]) + b += 1 + } + b = xgb.Pad(b) + + return buf +} + +// Write struct list Printer +func PrinterListBytes(buf []byte, list []Printer) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// Struct list size Printer +func PrinterListSize(list []Printer) int { + size := 0 + for _, item := range list { + size += (((4 + xgb.Pad((int(item.NameLen) * 1))) + 4) + xgb.Pad((int(item.DescLen) * 1))) + } + return size +} + +// Event definition Notify (0) +// Size: 32 + +const Notify = 0 + +type NotifyEvent struct { + Sequence uint16 + Detail byte + Context Pcontext + Cancel bool +} + +// Event read Notify +func NotifyEventNew(buf []byte) xgb.Event { + v := NotifyEvent{} + b := 1 // don't read event number + + v.Detail = buf[b] + b += 1 + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Context = Pcontext(xgb.Get32(buf[b:])) + b += 4 + + if buf[b] == 1 { + v.Cancel = true + } else { + v.Cancel = false + } + b += 1 + + return v +} + +// Event write Notify +func (v NotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.Detail + b += 1 + + b += 2 // skip sequence number + + xgb.Put32(buf[b:], uint32(v.Context)) + b += 4 + + if v.Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +func (v NotifyEvent) ImplementsEvent() {} + +func (v NotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v NotifyEvent) String() string { + fieldVals := make([]string, 0, 3) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, xgb.Sprintf("Context: %d", v.Context)) + fieldVals = append(fieldVals, xgb.Sprintf("Cancel: %t", v.Cancel)) + return "Notify {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtEventFuncs["XpExtension"][0] = NotifyEventNew +} + +// Event definition AttributNotify (1) +// Size: 32 + +const AttributNotify = 1 + +type AttributNotifyEvent struct { + Sequence uint16 + Detail byte + Context Pcontext +} + +// Event read AttributNotify +func AttributNotifyEventNew(buf []byte) xgb.Event { + v := AttributNotifyEvent{} + b := 1 // don't read event number + + v.Detail = buf[b] + b += 1 + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Context = Pcontext(xgb.Get32(buf[b:])) + b += 4 + + return v +} + +// Event write AttributNotify +func (v AttributNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + buf[b] = v.Detail + b += 1 + + b += 2 // skip sequence number + + xgb.Put32(buf[b:], uint32(v.Context)) + b += 4 + + return buf +} + +func (v AttributNotifyEvent) ImplementsEvent() {} + +func (v AttributNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v AttributNotifyEvent) String() string { + fieldVals := make([]string, 0, 2) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, xgb.Sprintf("Context: %d", v.Context)) + return "AttributNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtEventFuncs["XpExtension"][1] = AttributNotifyEventNew +} + +// Error definition BadContext (0) +// Size: 32 + +const BadBadContext = 0 + +type BadContextError struct { + Sequence uint16 + NiceName string +} + +// Error read BadContext +func BadContextErrorNew(buf []byte) xgb.Error { + v := BadContextError{} + v.NiceName = "BadContext" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +func (err BadContextError) ImplementsError() {} + +func (err BadContextError) SequenceId() uint16 { + return err.Sequence +} + +func (err BadContextError) BadId() uint32 { + return 0 +} + +func (err BadContextError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadBadContext {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["XpExtension"][0] = BadContextErrorNew +} + +// Error definition BadSequence (1) +// Size: 32 + +const BadBadSequence = 1 + +type BadSequenceError struct { + Sequence uint16 + NiceName string +} + +// Error read BadSequence +func BadSequenceErrorNew(buf []byte) xgb.Error { + v := BadSequenceError{} + v.NiceName = "BadSequence" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +func (err BadSequenceError) ImplementsError() {} + +func (err BadSequenceError) SequenceId() uint16 { + return err.Sequence +} + +func (err BadSequenceError) BadId() uint32 { + return 0 +} + +func (err BadSequenceError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadBadSequence {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["XpExtension"][1] = BadSequenceErrorNew +} + +// Request PrintQueryVersion +// size: 4 +type PrintQueryVersionCookie struct { + *xgb.Cookie +} + +func PrintQueryVersion(c *xgb.Conn) PrintQueryVersionCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printQueryVersionRequest(c), cookie) + return PrintQueryVersionCookie{cookie} +} + +func PrintQueryVersionUnchecked(c *xgb.Conn) PrintQueryVersionCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printQueryVersionRequest(c), cookie) + return PrintQueryVersionCookie{cookie} +} + +// Request reply for PrintQueryVersion +// size: 12 +type PrintQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint16 + MinorVersion uint16 +} + +// Waits and reads reply data from request PrintQueryVersion +func (cook PrintQueryVersionCookie) Reply() (*PrintQueryVersionReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for PrintQueryVersion +func printQueryVersionReply(buf []byte) *PrintQueryVersionReply { + v := new(PrintQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = xgb.Get16(buf[b:]) + b += 2 + + v.MinorVersion = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +// Write request to wire for PrintQueryVersion +func printQueryVersionRequest(c *xgb.Conn) []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request PrintGetPrinterList +// size: xgb.Pad(((12 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) +type PrintGetPrinterListCookie struct { + *xgb.Cookie +} + +func PrintGetPrinterList(c *xgb.Conn, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) PrintGetPrinterListCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return PrintGetPrinterListCookie{cookie} +} + +func PrintGetPrinterListUnchecked(c *xgb.Conn, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) PrintGetPrinterListCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return PrintGetPrinterListCookie{cookie} +} + +// Request reply for PrintGetPrinterList +// size: (32 + PrinterListSize(Printers)) +type PrintGetPrinterListReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ListCount uint32 + // padding: 20 bytes + Printers []Printer // size: PrinterListSize(Printers) +} + +// Waits and reads reply data from request PrintGetPrinterList +func (cook PrintGetPrinterListCookie) Reply() (*PrintGetPrinterListReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetPrinterListReply(buf), nil +} + +// Read reply into structure from buffer for PrintGetPrinterList +func printGetPrinterListReply(buf []byte) *PrintGetPrinterListReply { + v := new(PrintGetPrinterListReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.ListCount = xgb.Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Printers = make([]Printer, v.ListCount) + b += PrinterReadList(buf[b:], v.Printers) + + return v +} + +// Write request to wire for PrintGetPrinterList +func printGetPrinterListRequest(c *xgb.Conn, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) []byte { + size := xgb.Pad(((12 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], PrinterNameLen) + b += 4 + + xgb.Put32(buf[b:], LocaleLen) + b += 4 + + for i := 0; i < int(PrinterNameLen); i++ { + buf[b] = byte(PrinterName[i]) + b += 1 + } + b = xgb.Pad(b) + + for i := 0; i < int(LocaleLen); i++ { + buf[b] = byte(Locale[i]) + b += 1 + } + b = xgb.Pad(b) + + return buf +} + +// Request PrintRehashPrinterList +// size: 4 +type PrintRehashPrinterListCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintRehashPrinterList +func PrintRehashPrinterList(c *xgb.Conn) PrintRehashPrinterListCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printRehashPrinterListRequest(c), cookie) + return PrintRehashPrinterListCookie{cookie} +} + +func PrintRehashPrinterListChecked(c *xgb.Conn) PrintRehashPrinterListCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printRehashPrinterListRequest(c), cookie) + return PrintRehashPrinterListCookie{cookie} +} + +func (cook PrintRehashPrinterListCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintRehashPrinterList +func printRehashPrinterListRequest(c *xgb.Conn) []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request CreateContext +// size: xgb.Pad(((16 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) +type CreateContextCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreateContext +func CreateContext(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) CreateContextCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return CreateContextCookie{cookie} +} + +func CreateContextChecked(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) CreateContextCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return CreateContextCookie{cookie} +} + +func (cook CreateContextCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateContext +func createContextRequest(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) []byte { + size := xgb.Pad(((16 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], ContextId) + b += 4 + + xgb.Put32(buf[b:], PrinterNameLen) + b += 4 + + xgb.Put32(buf[b:], LocaleLen) + b += 4 + + for i := 0; i < int(PrinterNameLen); i++ { + buf[b] = byte(PrinterName[i]) + b += 1 + } + b = xgb.Pad(b) + + for i := 0; i < int(LocaleLen); i++ { + buf[b] = byte(Locale[i]) + b += 1 + } + b = xgb.Pad(b) + + return buf +} + +// Request PrintSetContext +// size: 8 +type PrintSetContextCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintSetContext +func PrintSetContext(c *xgb.Conn, Context uint32) PrintSetContextCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printSetContextRequest(c, Context), cookie) + return PrintSetContextCookie{cookie} +} + +func PrintSetContextChecked(c *xgb.Conn, Context uint32) PrintSetContextCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printSetContextRequest(c, Context), cookie) + return PrintSetContextCookie{cookie} +} + +func (cook PrintSetContextCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintSetContext +func printSetContextRequest(c *xgb.Conn, Context uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], Context) + b += 4 + + return buf +} + +// Request PrintGetContext +// size: 4 +type PrintGetContextCookie struct { + *xgb.Cookie +} + +func PrintGetContext(c *xgb.Conn) PrintGetContextCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printGetContextRequest(c), cookie) + return PrintGetContextCookie{cookie} +} + +func PrintGetContextUnchecked(c *xgb.Conn) PrintGetContextCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printGetContextRequest(c), cookie) + return PrintGetContextCookie{cookie} +} + +// Request reply for PrintGetContext +// size: 12 +type PrintGetContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Context uint32 +} + +// Waits and reads reply data from request PrintGetContext +func (cook PrintGetContextCookie) Reply() (*PrintGetContextReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetContextReply(buf), nil +} + +// Read reply into structure from buffer for PrintGetContext +func printGetContextReply(buf []byte) *PrintGetContextReply { + v := new(PrintGetContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.Context = xgb.Get32(buf[b:]) + b += 4 + + return v +} + +// Write request to wire for PrintGetContext +func printGetContextRequest(c *xgb.Conn) []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request PrintDestroyContext +// size: 8 +type PrintDestroyContextCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintDestroyContext +func PrintDestroyContext(c *xgb.Conn, Context uint32) PrintDestroyContextCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printDestroyContextRequest(c, Context), cookie) + return PrintDestroyContextCookie{cookie} +} + +func PrintDestroyContextChecked(c *xgb.Conn, Context uint32) PrintDestroyContextCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printDestroyContextRequest(c, Context), cookie) + return PrintDestroyContextCookie{cookie} +} + +func (cook PrintDestroyContextCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintDestroyContext +func printDestroyContextRequest(c *xgb.Conn, Context uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], Context) + b += 4 + + return buf +} + +// Request PrintGetScreenOfContext +// size: 4 +type PrintGetScreenOfContextCookie struct { + *xgb.Cookie +} + +func PrintGetScreenOfContext(c *xgb.Conn) PrintGetScreenOfContextCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printGetScreenOfContextRequest(c), cookie) + return PrintGetScreenOfContextCookie{cookie} +} + +func PrintGetScreenOfContextUnchecked(c *xgb.Conn) PrintGetScreenOfContextCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printGetScreenOfContextRequest(c), cookie) + return PrintGetScreenOfContextCookie{cookie} +} + +// Request reply for PrintGetScreenOfContext +// size: 12 +type PrintGetScreenOfContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Root xproto.Window +} + +// Waits and reads reply data from request PrintGetScreenOfContext +func (cook PrintGetScreenOfContextCookie) Reply() (*PrintGetScreenOfContextReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetScreenOfContextReply(buf), nil +} + +// Read reply into structure from buffer for PrintGetScreenOfContext +func printGetScreenOfContextReply(buf []byte) *PrintGetScreenOfContextReply { + v := new(PrintGetScreenOfContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.Root = xproto.Window(xgb.Get32(buf[b:])) + b += 4 + + return v +} + +// Write request to wire for PrintGetScreenOfContext +func printGetScreenOfContextRequest(c *xgb.Conn) []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request PrintStartJob +// size: 8 +type PrintStartJobCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintStartJob +func PrintStartJob(c *xgb.Conn, OutputMode byte) PrintStartJobCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printStartJobRequest(c, OutputMode), cookie) + return PrintStartJobCookie{cookie} +} + +func PrintStartJobChecked(c *xgb.Conn, OutputMode byte) PrintStartJobCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printStartJobRequest(c, OutputMode), cookie) + return PrintStartJobCookie{cookie} +} + +func (cook PrintStartJobCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintStartJob +func printStartJobRequest(c *xgb.Conn, OutputMode byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = OutputMode + b += 1 + + return buf +} + +// Request PrintEndJob +// size: 8 +type PrintEndJobCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintEndJob +func PrintEndJob(c *xgb.Conn, Cancel bool) PrintEndJobCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printEndJobRequest(c, Cancel), cookie) + return PrintEndJobCookie{cookie} +} + +func PrintEndJobChecked(c *xgb.Conn, Cancel bool) PrintEndJobCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printEndJobRequest(c, Cancel), cookie) + return PrintEndJobCookie{cookie} +} + +func (cook PrintEndJobCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintEndJob +func printEndJobRequest(c *xgb.Conn, Cancel bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request PrintStartDoc +// size: 8 +type PrintStartDocCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintStartDoc +func PrintStartDoc(c *xgb.Conn, DriverMode byte) PrintStartDocCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printStartDocRequest(c, DriverMode), cookie) + return PrintStartDocCookie{cookie} +} + +func PrintStartDocChecked(c *xgb.Conn, DriverMode byte) PrintStartDocCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printStartDocRequest(c, DriverMode), cookie) + return PrintStartDocCookie{cookie} +} + +func (cook PrintStartDocCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintStartDoc +func printStartDocRequest(c *xgb.Conn, DriverMode byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DriverMode + b += 1 + + return buf +} + +// Request PrintEndDoc +// size: 8 +type PrintEndDocCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintEndDoc +func PrintEndDoc(c *xgb.Conn, Cancel bool) PrintEndDocCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printEndDocRequest(c, Cancel), cookie) + return PrintEndDocCookie{cookie} +} + +func PrintEndDocChecked(c *xgb.Conn, Cancel bool) PrintEndDocCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printEndDocRequest(c, Cancel), cookie) + return PrintEndDocCookie{cookie} +} + +func (cook PrintEndDocCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintEndDoc +func printEndDocRequest(c *xgb.Conn, Cancel bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request PrintPutDocumentData +// size: xgb.Pad((((16 + xgb.Pad((int(LenData) * 1))) + xgb.Pad((len(DocFormat) * 1))) + xgb.Pad((len(Options) * 1)))) +type PrintPutDocumentDataCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintPutDocumentData +func PrintPutDocumentData(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) PrintPutDocumentDataCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) + return PrintPutDocumentDataCookie{cookie} +} + +func PrintPutDocumentDataChecked(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) PrintPutDocumentDataCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) + return PrintPutDocumentDataCookie{cookie} +} + +func (cook PrintPutDocumentDataCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintPutDocumentData +func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) []byte { + size := xgb.Pad((((16 + xgb.Pad((int(LenData) * 1))) + xgb.Pad((len(DocFormat) * 1))) + xgb.Pad((len(Options) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Drawable)) + b += 4 + + xgb.Put32(buf[b:], LenData) + b += 4 + + xgb.Put16(buf[b:], LenFmt) + b += 2 + + xgb.Put16(buf[b:], LenOptions) + b += 2 + + copy(buf[b:], Data[:LenData]) + b += xgb.Pad(int(LenData)) + + for i := 0; i < int(len(DocFormat)); i++ { + buf[b] = byte(DocFormat[i]) + b += 1 + } + b = xgb.Pad(b) + + for i := 0; i < int(len(Options)); i++ { + buf[b] = byte(Options[i]) + b += 1 + } + b = xgb.Pad(b) + + return buf +} + +// Request PrintGetDocumentData +// size: 12 +type PrintGetDocumentDataCookie struct { + *xgb.Cookie +} + +func PrintGetDocumentData(c *xgb.Conn, Context Pcontext, MaxBytes uint32) PrintGetDocumentDataCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) + return PrintGetDocumentDataCookie{cookie} +} + +func PrintGetDocumentDataUnchecked(c *xgb.Conn, Context Pcontext, MaxBytes uint32) PrintGetDocumentDataCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) + return PrintGetDocumentDataCookie{cookie} +} + +// Request reply for PrintGetDocumentData +// size: (32 + xgb.Pad((int(DataLen) * 1))) +type PrintGetDocumentDataReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + StatusCode uint32 + FinishedFlag uint32 + DataLen uint32 + // padding: 12 bytes + Data []byte // size: xgb.Pad((int(DataLen) * 1)) +} + +// Waits and reads reply data from request PrintGetDocumentData +func (cook PrintGetDocumentDataCookie) Reply() (*PrintGetDocumentDataReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetDocumentDataReply(buf), nil +} + +// Read reply into structure from buffer for PrintGetDocumentData +func printGetDocumentDataReply(buf []byte) *PrintGetDocumentDataReply { + v := new(PrintGetDocumentDataReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.StatusCode = xgb.Get32(buf[b:]) + b += 4 + + v.FinishedFlag = xgb.Get32(buf[b:]) + b += 4 + + v.DataLen = xgb.Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Data = make([]byte, v.DataLen) + copy(v.Data[:v.DataLen], buf[b:]) + b += xgb.Pad(int(v.DataLen)) + + return v +} + +// Write request to wire for PrintGetDocumentData +func printGetDocumentDataRequest(c *xgb.Conn, Context Pcontext, MaxBytes uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + xgb.Put32(buf[b:], MaxBytes) + b += 4 + + return buf +} + +// Request PrintStartPage +// size: 8 +type PrintStartPageCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintStartPage +func PrintStartPage(c *xgb.Conn, Window xproto.Window) PrintStartPageCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printStartPageRequest(c, Window), cookie) + return PrintStartPageCookie{cookie} +} + +func PrintStartPageChecked(c *xgb.Conn, Window xproto.Window) PrintStartPageCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printStartPageRequest(c, Window), cookie) + return PrintStartPageCookie{cookie} +} + +func (cook PrintStartPageCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintStartPage +func printStartPageRequest(c *xgb.Conn, Window xproto.Window) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request PrintEndPage +// size: 8 +type PrintEndPageCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintEndPage +func PrintEndPage(c *xgb.Conn, Cancel bool) PrintEndPageCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printEndPageRequest(c, Cancel), cookie) + return PrintEndPageCookie{cookie} +} + +func PrintEndPageChecked(c *xgb.Conn, Cancel bool) PrintEndPageCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printEndPageRequest(c, Cancel), cookie) + return PrintEndPageCookie{cookie} +} + +func (cook PrintEndPageCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintEndPage +func printEndPageRequest(c *xgb.Conn, Cancel bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request PrintSelectInput +// size: xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(EventMask))))))) +type PrintSelectInputCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintSelectInput +func PrintSelectInput(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList []uint32) PrintSelectInputCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) + return PrintSelectInputCookie{cookie} +} + +func PrintSelectInputChecked(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList []uint32) PrintSelectInputCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) + return PrintSelectInputCookie{cookie} +} + +func (cook PrintSelectInputCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintSelectInput +func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList []uint32) []byte { + size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(EventMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + xgb.Put32(buf[b:], EventMask) + b += 4 + for i := 0; i < xgb.PopCount(int(EventMask)); i++ { + xgb.Put32(buf[b:], EventList[i]) + b += 4 + } + b = xgb.Pad(b) + + return buf +} + +// Request PrintInputSelected +// size: 8 +type PrintInputSelectedCookie struct { + *xgb.Cookie +} + +func PrintInputSelected(c *xgb.Conn, Context Pcontext) PrintInputSelectedCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printInputSelectedRequest(c, Context), cookie) + return PrintInputSelectedCookie{cookie} +} + +func PrintInputSelectedUnchecked(c *xgb.Conn, Context Pcontext) PrintInputSelectedCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printInputSelectedRequest(c, Context), cookie) + return PrintInputSelectedCookie{cookie} +} + +// Request reply for PrintInputSelected +// size: ((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(EventMask)))))) + (4 + xgb.Pad((4 * xgb.PopCount(int(AllEventsMask)))))) +type PrintInputSelectedReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + EventMask uint32 + EventList []uint32 + AllEventsMask uint32 + AllEventsList []uint32 +} + +// Waits and reads reply data from request PrintInputSelected +func (cook PrintInputSelectedCookie) Reply() (*PrintInputSelectedReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printInputSelectedReply(buf), nil +} + +// Read reply into structure from buffer for PrintInputSelected +func printInputSelectedReply(buf []byte) *PrintInputSelectedReply { + v := new(PrintInputSelectedReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.EventMask = xgb.Get32(buf[b:]) + b += 4 + + v.EventList = make([]uint32, xgb.PopCount(int(v.EventMask))) + for i := 0; i < xgb.PopCount(int(v.EventMask)); i++ { + v.EventList[i] = xgb.Get32(buf[b:]) + b += 4 + } + b = xgb.Pad(b) + + v.AllEventsMask = xgb.Get32(buf[b:]) + b += 4 + + v.AllEventsList = make([]uint32, xgb.PopCount(int(v.AllEventsMask))) + for i := 0; i < xgb.PopCount(int(v.AllEventsMask)); i++ { + v.AllEventsList[i] = xgb.Get32(buf[b:]) + b += 4 + } + b = xgb.Pad(b) + + return v +} + +// Write request to wire for PrintInputSelected +func printInputSelectedRequest(c *xgb.Conn, Context Pcontext) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request PrintGetAttributes +// size: 12 +type PrintGetAttributesCookie struct { + *xgb.Cookie +} + +func PrintGetAttributes(c *xgb.Conn, Context Pcontext, Pool byte) PrintGetAttributesCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) + return PrintGetAttributesCookie{cookie} +} + +func PrintGetAttributesUnchecked(c *xgb.Conn, Context Pcontext, Pool byte) PrintGetAttributesCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) + return PrintGetAttributesCookie{cookie} +} + +// Request reply for PrintGetAttributes +// size: 33 +type PrintGetAttributesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + StringLen uint32 + // padding: 20 bytes + Attributes String8 +} + +// Waits and reads reply data from request PrintGetAttributes +func (cook PrintGetAttributesCookie) Reply() (*PrintGetAttributesReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetAttributesReply(buf), nil +} + +// Read reply into structure from buffer for PrintGetAttributes +func printGetAttributesReply(buf []byte) *PrintGetAttributesReply { + v := new(PrintGetAttributesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.StringLen = xgb.Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Attributes = String8(buf[b]) + b += 1 + + return v +} + +// Write request to wire for PrintGetAttributes +func printGetAttributesRequest(c *xgb.Conn, Context Pcontext, Pool byte) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + buf[b] = Pool + b += 1 + + b += 3 // padding + + return buf +} + +// Request PrintGetOneAttributes +// size: xgb.Pad((16 + xgb.Pad((int(NameLen) * 1)))) +type PrintGetOneAttributesCookie struct { + *xgb.Cookie +} + +func PrintGetOneAttributes(c *xgb.Conn, Context Pcontext, NameLen uint32, Pool byte, Name []String8) PrintGetOneAttributesCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) + return PrintGetOneAttributesCookie{cookie} +} + +func PrintGetOneAttributesUnchecked(c *xgb.Conn, Context Pcontext, NameLen uint32, Pool byte, Name []String8) PrintGetOneAttributesCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) + return PrintGetOneAttributesCookie{cookie} +} + +// Request reply for PrintGetOneAttributes +// size: (32 + xgb.Pad((int(ValueLen) * 1))) +type PrintGetOneAttributesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ValueLen uint32 + // padding: 20 bytes + Value []String8 // size: xgb.Pad((int(ValueLen) * 1)) +} + +// Waits and reads reply data from request PrintGetOneAttributes +func (cook PrintGetOneAttributesCookie) Reply() (*PrintGetOneAttributesReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetOneAttributesReply(buf), nil +} + +// Read reply into structure from buffer for PrintGetOneAttributes +func printGetOneAttributesReply(buf []byte) *PrintGetOneAttributesReply { + v := new(PrintGetOneAttributesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.ValueLen = xgb.Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Value = make([]String8, v.ValueLen) + for i := 0; i < int(v.ValueLen); i++ { + v.Value[i] = String8(buf[b]) + b += 1 + } + b = xgb.Pad(b) + + return v +} + +// Write request to wire for PrintGetOneAttributes +func printGetOneAttributesRequest(c *xgb.Conn, Context Pcontext, NameLen uint32, Pool byte, Name []String8) []byte { + size := xgb.Pad((16 + xgb.Pad((int(NameLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + xgb.Put32(buf[b:], NameLen) + b += 4 + + buf[b] = Pool + b += 1 + + b += 3 // padding + + for i := 0; i < int(NameLen); i++ { + buf[b] = byte(Name[i]) + b += 1 + } + b = xgb.Pad(b) + + return buf +} + +// Request PrintSetAttributes +// size: xgb.Pad((16 + xgb.Pad((len(Attributes) * 1)))) +type PrintSetAttributesCookie struct { + *xgb.Cookie +} + +// Write request to wire for PrintSetAttributes +func PrintSetAttributes(c *xgb.Conn, Context Pcontext, StringLen uint32, Pool byte, Rule byte, Attributes []String8) PrintSetAttributesCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) + return PrintSetAttributesCookie{cookie} +} + +func PrintSetAttributesChecked(c *xgb.Conn, Context Pcontext, StringLen uint32, Pool byte, Rule byte, Attributes []String8) PrintSetAttributesCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) + return PrintSetAttributesCookie{cookie} +} + +func (cook PrintSetAttributesCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintSetAttributes +func printSetAttributesRequest(c *xgb.Conn, Context Pcontext, StringLen uint32, Pool byte, Rule byte, Attributes []String8) []byte { + size := xgb.Pad((16 + xgb.Pad((len(Attributes) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + xgb.Put32(buf[b:], StringLen) + b += 4 + + buf[b] = Pool + b += 1 + + buf[b] = Rule + b += 1 + + b += 2 // padding + + for i := 0; i < int(len(Attributes)); i++ { + buf[b] = byte(Attributes[i]) + b += 1 + } + b = xgb.Pad(b) + + return buf +} + +// Request PrintGetPageDimensions +// size: 8 +type PrintGetPageDimensionsCookie struct { + *xgb.Cookie +} + +func PrintGetPageDimensions(c *xgb.Conn, Context Pcontext) PrintGetPageDimensionsCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) + return PrintGetPageDimensionsCookie{cookie} +} + +func PrintGetPageDimensionsUnchecked(c *xgb.Conn, Context Pcontext) PrintGetPageDimensionsCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) + return PrintGetPageDimensionsCookie{cookie} +} + +// Request reply for PrintGetPageDimensions +// size: 20 +type PrintGetPageDimensionsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Width uint16 + Height uint16 + OffsetX uint16 + OffsetY uint16 + ReproducibleWidth uint16 + ReproducibleHeight uint16 +} + +// Waits and reads reply data from request PrintGetPageDimensions +func (cook PrintGetPageDimensionsCookie) Reply() (*PrintGetPageDimensionsReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetPageDimensionsReply(buf), nil +} + +// Read reply into structure from buffer for PrintGetPageDimensions +func printGetPageDimensionsReply(buf []byte) *PrintGetPageDimensionsReply { + v := new(PrintGetPageDimensionsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.Width = xgb.Get16(buf[b:]) + b += 2 + + v.Height = xgb.Get16(buf[b:]) + b += 2 + + v.OffsetX = xgb.Get16(buf[b:]) + b += 2 + + v.OffsetY = xgb.Get16(buf[b:]) + b += 2 + + v.ReproducibleWidth = xgb.Get16(buf[b:]) + b += 2 + + v.ReproducibleHeight = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +// Write request to wire for PrintGetPageDimensions +func printGetPageDimensionsRequest(c *xgb.Conn, Context Pcontext) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 21 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request PrintQueryScreens +// size: 4 +type PrintQueryScreensCookie struct { + *xgb.Cookie +} + +func PrintQueryScreens(c *xgb.Conn) PrintQueryScreensCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printQueryScreensRequest(c), cookie) + return PrintQueryScreensCookie{cookie} +} + +func PrintQueryScreensUnchecked(c *xgb.Conn) PrintQueryScreensCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printQueryScreensRequest(c), cookie) + return PrintQueryScreensCookie{cookie} +} + +// Request reply for PrintQueryScreens +// size: (32 + xgb.Pad((int(ListCount) * 4))) +type PrintQueryScreensReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ListCount uint32 + // padding: 20 bytes + Roots []xproto.Window // size: xgb.Pad((int(ListCount) * 4)) +} + +// Waits and reads reply data from request PrintQueryScreens +func (cook PrintQueryScreensCookie) Reply() (*PrintQueryScreensReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printQueryScreensReply(buf), nil +} + +// Read reply into structure from buffer for PrintQueryScreens +func printQueryScreensReply(buf []byte) *PrintQueryScreensReply { + v := new(PrintQueryScreensReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.ListCount = xgb.Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Roots = make([]xproto.Window, v.ListCount) + for i := 0; i < int(v.ListCount); i++ { + v.Roots[i] = xproto.Window(xgb.Get32(buf[b:])) + b += 4 + } + b = xgb.Pad(b) + + return v +} + +// Write request to wire for PrintQueryScreens +func printQueryScreensRequest(c *xgb.Conn) []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 22 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request PrintSetImageResolution +// size: 12 +type PrintSetImageResolutionCookie struct { + *xgb.Cookie +} + +func PrintSetImageResolution(c *xgb.Conn, Context Pcontext, ImageResolution uint16) PrintSetImageResolutionCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printSetImageResolutionRequest(c, Context, ImageResolution), cookie) + return PrintSetImageResolutionCookie{cookie} +} + +func PrintSetImageResolutionUnchecked(c *xgb.Conn, Context Pcontext, ImageResolution uint16) PrintSetImageResolutionCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printSetImageResolutionRequest(c, Context, ImageResolution), cookie) + return PrintSetImageResolutionCookie{cookie} +} + +// Request reply for PrintSetImageResolution +// size: 10 +type PrintSetImageResolutionReply struct { + Sequence uint16 + Length uint32 + Status bool + PreviousResolutions uint16 +} + +// Waits and reads reply data from request PrintSetImageResolution +func (cook PrintSetImageResolutionCookie) Reply() (*PrintSetImageResolutionReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printSetImageResolutionReply(buf), nil +} + +// Read reply into structure from buffer for PrintSetImageResolution +func printSetImageResolutionReply(buf []byte) *PrintSetImageResolutionReply { + v := new(PrintSetImageResolutionReply) + b := 1 // skip reply determinant + + if buf[b] == 1 { + v.Status = true + } else { + v.Status = false + } + b += 1 + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.PreviousResolutions = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +// Write request to wire for PrintSetImageResolution +func printSetImageResolutionRequest(c *xgb.Conn, Context Pcontext, ImageResolution uint16) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 23 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + xgb.Put16(buf[b:], ImageResolution) + b += 2 + + return buf +} + +// Request PrintGetImageResolution +// size: 8 +type PrintGetImageResolutionCookie struct { + *xgb.Cookie +} + +func PrintGetImageResolution(c *xgb.Conn, Context Pcontext) PrintGetImageResolutionCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) + return PrintGetImageResolutionCookie{cookie} +} + +func PrintGetImageResolutionUnchecked(c *xgb.Conn, Context Pcontext) PrintGetImageResolutionCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) + return PrintGetImageResolutionCookie{cookie} +} + +// Request reply for PrintGetImageResolution +// size: 10 +type PrintGetImageResolutionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ImageResolution uint16 +} + +// Waits and reads reply data from request PrintGetImageResolution +func (cook PrintGetImageResolutionCookie) Reply() (*PrintGetImageResolutionReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetImageResolutionReply(buf), nil +} + +// Read reply into structure from buffer for PrintGetImageResolution +func printGetImageResolutionReply(buf []byte) *PrintGetImageResolutionReply { + v := new(PrintGetImageResolutionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.ImageResolution = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +// Write request to wire for PrintGetImageResolution +func printGetImageResolutionRequest(c *xgb.Conn, Context Pcontext) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 24 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} -- cgit v1.2.3 From a3363755cdfdafdf02d5a772bd47a462e99af057 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 20:06:22 -0400 Subject: adding package header comments --- nexgb/xprint/xprint.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 2fcf49f..0037a22 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -1,7 +1,8 @@ +// Package xprint is the X client API for the XpExtension extension. package xprint /* - This file was generated by xprint.xml on May 10 2012 4:20:28pm EDT. + This file was generated by xprint.xml on May 10 2012 8:04:32pm EDT. This file is automatically generated. Edit at your peril! */ @@ -39,16 +40,6 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - -// Skipping definition for base type 'Int32' - -// Skipping definition for base type 'Void' - -// Skipping definition for base type 'Byte' - // Skipping definition for base type 'Int8' // Skipping definition for base type 'Card16' @@ -63,6 +54,16 @@ func init() { // Skipping definition for base type 'Float' +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + const ( GetDocFinished = 0 GetDocSecondConsumer = 1 -- cgit v1.2.3 From c00652934e4ec68016a152b9bea10273b0be8726 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 23:57:34 -0400 Subject: better docs --- nexgb/xprint/xprint.go | 437 ++++++++++++++++++++++++++++++------------------- 1 file changed, 266 insertions(+), 171 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 0037a22..237b6b5 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -2,7 +2,7 @@ package xprint /* - This file was generated by xprint.xml on May 10 2012 8:04:32pm EDT. + This file was generated by xprint.xml on May 10 2012 11:56:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,8 +40,6 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Int8' - // Skipping definition for base type 'Card16' // Skipping definition for base type 'Char' @@ -64,6 +62,8 @@ func init() { // Skipping definition for base type 'Byte' +// Skipping definition for base type 'Int8' + const ( GetDocFinished = 0 GetDocSecondConsumer = 1 @@ -106,8 +106,6 @@ func NewPcontextId(c *xgb.Conn) (Pcontext, error) { type String8 byte -// 'Printer' struct definition -// Size: (((4 + xgb.Pad((int(NameLen) * 1))) + 4) + xgb.Pad((int(DescLen) * 1))) type Printer struct { NameLen uint32 Name []String8 // size: xgb.Pad((int(NameLen) * 1)) @@ -115,7 +113,7 @@ type Printer struct { Description []String8 // size: xgb.Pad((int(DescLen) * 1)) } -// Struct read Printer +// PrinterRead reads a byte slice into a Printer value. func PrinterRead(buf []byte, v *Printer) int { b := 0 @@ -142,7 +140,7 @@ func PrinterRead(buf []byte, v *Printer) int { return b } -// Struct list read Printer +// PrinterReadList reads a byte slice into a list of Printer values. func PrinterReadList(buf []byte, dest []Printer) int { b := 0 for i := 0; i < len(dest); i++ { @@ -152,7 +150,7 @@ func PrinterReadList(buf []byte, dest []Printer) int { return xgb.Pad(b) } -// Struct write Printer +// Bytes writes a Printer value to a byte slice. func (v Printer) Bytes() []byte { buf := make([]byte, (((4 + xgb.Pad((int(v.NameLen) * 1))) + 4) + xgb.Pad((int(v.DescLen) * 1)))) b := 0 @@ -178,7 +176,7 @@ func (v Printer) Bytes() []byte { return buf } -// Write struct list Printer +// PrinterListBytes writes a list of %s(MISSING) values to a byte slice. func PrinterListBytes(buf []byte, list []Printer) int { b := 0 var structBytes []byte @@ -190,7 +188,7 @@ func PrinterListBytes(buf []byte, list []Printer) int { return b } -// Struct list size Printer +// PrinterListSize computes the size (bytes) of a list of Printer values. func PrinterListSize(list []Printer) int { size := 0 for _, item := range list { @@ -199,9 +197,7 @@ func PrinterListSize(list []Printer) int { return size } -// Event definition Notify (0) -// Size: 32 - +// Notify is the event number for a NotifyEvent. const Notify = 0 type NotifyEvent struct { @@ -211,7 +207,7 @@ type NotifyEvent struct { Cancel bool } -// Event read Notify +// NotifyEventNew constructs a NotifyEvent value that implements xgb.Event from a byte slice. func NotifyEventNew(buf []byte) xgb.Event { v := NotifyEvent{} b := 1 // don't read event number @@ -235,7 +231,7 @@ func NotifyEventNew(buf []byte) xgb.Event { return v } -// Event write Notify +// Bytes writes a NotifyEvent value to a byte slice. func (v NotifyEvent) Bytes() []byte { buf := make([]byte, 32) b := 0 @@ -262,12 +258,14 @@ func (v NotifyEvent) Bytes() []byte { return buf } -func (v NotifyEvent) ImplementsEvent() {} - +// SequenceId returns the sequence id attached to the Notify event. +// Events without a sequence number (KeymapNotify) return 0. +// This is mostly used internally. func (v NotifyEvent) SequenceId() uint16 { return v.Sequence } +// String is a rudimentary string representation of NotifyEvent. func (v NotifyEvent) String() string { fieldVals := make([]string, 0, 3) fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) @@ -281,9 +279,7 @@ func init() { xgb.NewExtEventFuncs["XpExtension"][0] = NotifyEventNew } -// Event definition AttributNotify (1) -// Size: 32 - +// AttributNotify is the event number for a AttributNotifyEvent. const AttributNotify = 1 type AttributNotifyEvent struct { @@ -292,7 +288,7 @@ type AttributNotifyEvent struct { Context Pcontext } -// Event read AttributNotify +// AttributNotifyEventNew constructs a AttributNotifyEvent value that implements xgb.Event from a byte slice. func AttributNotifyEventNew(buf []byte) xgb.Event { v := AttributNotifyEvent{} b := 1 // don't read event number @@ -309,7 +305,7 @@ func AttributNotifyEventNew(buf []byte) xgb.Event { return v } -// Event write AttributNotify +// Bytes writes a AttributNotifyEvent value to a byte slice. func (v AttributNotifyEvent) Bytes() []byte { buf := make([]byte, 32) b := 0 @@ -329,12 +325,14 @@ func (v AttributNotifyEvent) Bytes() []byte { return buf } -func (v AttributNotifyEvent) ImplementsEvent() {} - +// SequenceId returns the sequence id attached to the AttributNotify event. +// Events without a sequence number (KeymapNotify) return 0. +// This is mostly used internally. func (v AttributNotifyEvent) SequenceId() uint16 { return v.Sequence } +// String is a rudimentary string representation of AttributNotifyEvent. func (v AttributNotifyEvent) String() string { fieldVals := make([]string, 0, 2) fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) @@ -347,9 +345,7 @@ func init() { xgb.NewExtEventFuncs["XpExtension"][1] = AttributNotifyEventNew } -// Error definition BadContext (0) -// Size: 32 - +// BadBadContext is the error number for a BadBadContext. const BadBadContext = 0 type BadContextError struct { @@ -357,7 +353,7 @@ type BadContextError struct { NiceName string } -// Error read BadContext +// BadContextErrorNew constructs a BadContextError value that implements xgb.Error from a byte slice. func BadContextErrorNew(buf []byte) xgb.Error { v := BadContextError{} v.NiceName = "BadContext" @@ -371,8 +367,8 @@ func BadContextErrorNew(buf []byte) xgb.Error { return v } -func (err BadContextError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadBadContext error. +// This is mostly used internally. func (err BadContextError) SequenceId() uint16 { return err.Sequence } @@ -392,9 +388,7 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"][0] = BadContextErrorNew } -// Error definition BadSequence (1) -// Size: 32 - +// BadBadSequence is the error number for a BadBadSequence. const BadBadSequence = 1 type BadSequenceError struct { @@ -402,7 +396,7 @@ type BadSequenceError struct { NiceName string } -// Error read BadSequence +// BadSequenceErrorNew constructs a BadSequenceError value that implements xgb.Error from a byte slice. func BadSequenceErrorNew(buf []byte) xgb.Error { v := BadSequenceError{} v.NiceName = "BadSequence" @@ -416,8 +410,8 @@ func BadSequenceErrorNew(buf []byte) xgb.Error { return v } -func (err BadSequenceError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadBadSequence error. +// This is mostly used internally. func (err BadSequenceError) SequenceId() uint16 { return err.Sequence } @@ -437,35 +431,37 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"][1] = BadSequenceErrorNew } -// Request PrintQueryVersion -// size: 4 +// PrintQueryVersionCookie is a cookie used only for PrintQueryVersion requests. type PrintQueryVersionCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printQueryVersionRequest(c), cookie) return PrintQueryVersionCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printQueryVersionRequest(c), cookie) return PrintQueryVersionCookie{cookie} } -// Request reply for PrintQueryVersion -// size: 12 +// PrintQueryVersionReply represents the data returned from a PrintQueryVersion request. type PrintQueryVersionReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes MajorVersion uint16 MinorVersion uint16 } -// Waits and reads reply data from request PrintQueryVersion +// Reply blocks and returns the reply data for a PrintQueryVersion request. func (cook PrintQueryVersionCookie) Reply() (*PrintQueryVersionReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -477,7 +473,7 @@ func (cook PrintQueryVersionCookie) Reply() (*PrintQueryVersionReply, error) { return printQueryVersionReply(buf), nil } -// Read reply into structure from buffer for PrintQueryVersion +// printQueryVersionReply reads a byte slice into a PrintQueryVersionReply value. func printQueryVersionReply(buf []byte) *PrintQueryVersionReply { v := new(PrintQueryVersionReply) b := 1 // skip reply determinant @@ -500,6 +496,7 @@ func printQueryVersionReply(buf []byte) *PrintQueryVersionReply { } // Write request to wire for PrintQueryVersion +// printQueryVersionRequest writes a PrintQueryVersion request to a byte slice. func printQueryVersionRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -517,36 +514,38 @@ func printQueryVersionRequest(c *xgb.Conn) []byte { return buf } -// Request PrintGetPrinterList -// size: xgb.Pad(((12 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) +// PrintGetPrinterListCookie is a cookie used only for PrintGetPrinterList requests. type PrintGetPrinterListCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) return PrintGetPrinterListCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) return PrintGetPrinterListCookie{cookie} } -// Request reply for PrintGetPrinterList -// size: (32 + PrinterListSize(Printers)) +// PrintGetPrinterListReply represents the data returned from a PrintGetPrinterList request. type PrintGetPrinterListReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes ListCount uint32 // padding: 20 bytes Printers []Printer // size: PrinterListSize(Printers) } -// Waits and reads reply data from request PrintGetPrinterList +// Reply blocks and returns the reply data for a PrintGetPrinterList request. func (cook PrintGetPrinterListCookie) Reply() (*PrintGetPrinterListReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -558,7 +557,7 @@ func (cook PrintGetPrinterListCookie) Reply() (*PrintGetPrinterListReply, error) return printGetPrinterListReply(buf), nil } -// Read reply into structure from buffer for PrintGetPrinterList +// printGetPrinterListReply reads a byte slice into a PrintGetPrinterListReply value. func printGetPrinterListReply(buf []byte) *PrintGetPrinterListReply { v := new(PrintGetPrinterListReply) b := 1 // skip reply determinant @@ -583,6 +582,7 @@ func printGetPrinterListReply(buf []byte) *PrintGetPrinterListReply { } // Write request to wire for PrintGetPrinterList +// printGetPrinterListRequest writes a PrintGetPrinterList request to a byte slice. func printGetPrinterListRequest(c *xgb.Conn, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) []byte { size := xgb.Pad(((12 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) b := 0 @@ -618,30 +618,35 @@ func printGetPrinterListRequest(c *xgb.Conn, PrinterNameLen uint32, LocaleLen ui return buf } -// Request PrintRehashPrinterList -// size: 4 +// PrintRehashPrinterListCookie is a cookie used only for PrintRehashPrinterList requests. type PrintRehashPrinterListCookie struct { *xgb.Cookie } -// Write request to wire for PrintRehashPrinterList +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printRehashPrinterListRequest(c), cookie) return PrintRehashPrinterListCookie{cookie} } +// PrintRehashPrinterListChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintRehashPrinterListCookie.Check() func PrintRehashPrinterListChecked(c *xgb.Conn) PrintRehashPrinterListCookie { cookie := c.NewCookie(true, false) c.NewRequest(printRehashPrinterListRequest(c), cookie) return PrintRehashPrinterListCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintRehashPrinterListCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintRehashPrinterList +// printRehashPrinterListRequest writes a PrintRehashPrinterList request to a byte slice. func printRehashPrinterListRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -659,30 +664,35 @@ func printRehashPrinterListRequest(c *xgb.Conn) []byte { return buf } -// Request CreateContext -// size: xgb.Pad(((16 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) +// CreateContextCookie is a cookie used only for CreateContext requests. type CreateContextCookie struct { *xgb.Cookie } -// Write request to wire for CreateContext +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) return CreateContextCookie{cookie} } +// 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 { cookie := c.NewCookie(true, false) c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) return CreateContextCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook CreateContextCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateContext +// createContextRequest writes a CreateContext request to a byte slice. func createContextRequest(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) []byte { size := xgb.Pad(((16 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) b := 0 @@ -721,30 +731,35 @@ func createContextRequest(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, return buf } -// Request PrintSetContext -// size: 8 +// PrintSetContextCookie is a cookie used only for PrintSetContext requests. type PrintSetContextCookie struct { *xgb.Cookie } -// Write request to wire for PrintSetContext +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printSetContextRequest(c, Context), cookie) return PrintSetContextCookie{cookie} } +// PrintSetContextChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintSetContextCookie.Check() func PrintSetContextChecked(c *xgb.Conn, Context uint32) PrintSetContextCookie { cookie := c.NewCookie(true, false) c.NewRequest(printSetContextRequest(c, Context), cookie) return PrintSetContextCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintSetContextCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintSetContext +// printSetContextRequest writes a PrintSetContext request to a byte slice. func printSetContextRequest(c *xgb.Conn, Context uint32) []byte { size := 8 b := 0 @@ -765,34 +780,36 @@ func printSetContextRequest(c *xgb.Conn, Context uint32) []byte { return buf } -// Request PrintGetContext -// size: 4 +// PrintGetContextCookie is a cookie used only for PrintGetContext requests. type PrintGetContextCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printGetContextRequest(c), cookie) return PrintGetContextCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printGetContextRequest(c), cookie) return PrintGetContextCookie{cookie} } -// Request reply for PrintGetContext -// size: 12 +// PrintGetContextReply represents the data returned from a PrintGetContext request. type PrintGetContextReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Context uint32 } -// Waits and reads reply data from request PrintGetContext +// Reply blocks and returns the reply data for a PrintGetContext request. func (cook PrintGetContextCookie) Reply() (*PrintGetContextReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -804,7 +821,7 @@ func (cook PrintGetContextCookie) Reply() (*PrintGetContextReply, error) { return printGetContextReply(buf), nil } -// Read reply into structure from buffer for PrintGetContext +// printGetContextReply reads a byte slice into a PrintGetContextReply value. func printGetContextReply(buf []byte) *PrintGetContextReply { v := new(PrintGetContextReply) b := 1 // skip reply determinant @@ -824,6 +841,7 @@ func printGetContextReply(buf []byte) *PrintGetContextReply { } // Write request to wire for PrintGetContext +// printGetContextRequest writes a PrintGetContext request to a byte slice. func printGetContextRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -841,30 +859,35 @@ func printGetContextRequest(c *xgb.Conn) []byte { return buf } -// Request PrintDestroyContext -// size: 8 +// PrintDestroyContextCookie is a cookie used only for PrintDestroyContext requests. type PrintDestroyContextCookie struct { *xgb.Cookie } -// Write request to wire for PrintDestroyContext +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printDestroyContextRequest(c, Context), cookie) return PrintDestroyContextCookie{cookie} } +// PrintDestroyContextChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintDestroyContextCookie.Check() func PrintDestroyContextChecked(c *xgb.Conn, Context uint32) PrintDestroyContextCookie { cookie := c.NewCookie(true, false) c.NewRequest(printDestroyContextRequest(c, Context), cookie) return PrintDestroyContextCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintDestroyContextCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintDestroyContext +// printDestroyContextRequest writes a PrintDestroyContext request to a byte slice. func printDestroyContextRequest(c *xgb.Conn, Context uint32) []byte { size := 8 b := 0 @@ -885,34 +908,36 @@ func printDestroyContextRequest(c *xgb.Conn, Context uint32) []byte { return buf } -// Request PrintGetScreenOfContext -// size: 4 +// PrintGetScreenOfContextCookie is a cookie used only for PrintGetScreenOfContext requests. type PrintGetScreenOfContextCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printGetScreenOfContextRequest(c), cookie) return PrintGetScreenOfContextCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printGetScreenOfContextRequest(c), cookie) return PrintGetScreenOfContextCookie{cookie} } -// Request reply for PrintGetScreenOfContext -// size: 12 +// PrintGetScreenOfContextReply represents the data returned from a PrintGetScreenOfContext request. type PrintGetScreenOfContextReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Root xproto.Window } -// Waits and reads reply data from request PrintGetScreenOfContext +// Reply blocks and returns the reply data for a PrintGetScreenOfContext request. func (cook PrintGetScreenOfContextCookie) Reply() (*PrintGetScreenOfContextReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -924,7 +949,7 @@ func (cook PrintGetScreenOfContextCookie) Reply() (*PrintGetScreenOfContextReply return printGetScreenOfContextReply(buf), nil } -// Read reply into structure from buffer for PrintGetScreenOfContext +// printGetScreenOfContextReply reads a byte slice into a PrintGetScreenOfContextReply value. func printGetScreenOfContextReply(buf []byte) *PrintGetScreenOfContextReply { v := new(PrintGetScreenOfContextReply) b := 1 // skip reply determinant @@ -944,6 +969,7 @@ func printGetScreenOfContextReply(buf []byte) *PrintGetScreenOfContextReply { } // Write request to wire for PrintGetScreenOfContext +// printGetScreenOfContextRequest writes a PrintGetScreenOfContext request to a byte slice. func printGetScreenOfContextRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -961,30 +987,35 @@ func printGetScreenOfContextRequest(c *xgb.Conn) []byte { return buf } -// Request PrintStartJob -// size: 8 +// PrintStartJobCookie is a cookie used only for PrintStartJob requests. type PrintStartJobCookie struct { *xgb.Cookie } -// Write request to wire for PrintStartJob +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printStartJobRequest(c, OutputMode), cookie) return PrintStartJobCookie{cookie} } +// PrintStartJobChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintStartJobCookie.Check() func PrintStartJobChecked(c *xgb.Conn, OutputMode byte) PrintStartJobCookie { cookie := c.NewCookie(true, false) c.NewRequest(printStartJobRequest(c, OutputMode), cookie) return PrintStartJobCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintStartJobCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintStartJob +// printStartJobRequest writes a PrintStartJob request to a byte slice. func printStartJobRequest(c *xgb.Conn, OutputMode byte) []byte { size := 8 b := 0 @@ -1005,30 +1036,35 @@ func printStartJobRequest(c *xgb.Conn, OutputMode byte) []byte { return buf } -// Request PrintEndJob -// size: 8 +// PrintEndJobCookie is a cookie used only for PrintEndJob requests. type PrintEndJobCookie struct { *xgb.Cookie } -// Write request to wire for PrintEndJob +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printEndJobRequest(c, Cancel), cookie) return PrintEndJobCookie{cookie} } +// PrintEndJobChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintEndJobCookie.Check() func PrintEndJobChecked(c *xgb.Conn, Cancel bool) PrintEndJobCookie { cookie := c.NewCookie(true, false) c.NewRequest(printEndJobRequest(c, Cancel), cookie) return PrintEndJobCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintEndJobCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintEndJob +// printEndJobRequest writes a PrintEndJob request to a byte slice. func printEndJobRequest(c *xgb.Conn, Cancel bool) []byte { size := 8 b := 0 @@ -1053,30 +1089,35 @@ func printEndJobRequest(c *xgb.Conn, Cancel bool) []byte { return buf } -// Request PrintStartDoc -// size: 8 +// PrintStartDocCookie is a cookie used only for PrintStartDoc requests. type PrintStartDocCookie struct { *xgb.Cookie } -// Write request to wire for PrintStartDoc +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printStartDocRequest(c, DriverMode), cookie) return PrintStartDocCookie{cookie} } +// PrintStartDocChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintStartDocCookie.Check() func PrintStartDocChecked(c *xgb.Conn, DriverMode byte) PrintStartDocCookie { cookie := c.NewCookie(true, false) c.NewRequest(printStartDocRequest(c, DriverMode), cookie) return PrintStartDocCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintStartDocCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintStartDoc +// printStartDocRequest writes a PrintStartDoc request to a byte slice. func printStartDocRequest(c *xgb.Conn, DriverMode byte) []byte { size := 8 b := 0 @@ -1097,30 +1138,35 @@ func printStartDocRequest(c *xgb.Conn, DriverMode byte) []byte { return buf } -// Request PrintEndDoc -// size: 8 +// PrintEndDocCookie is a cookie used only for PrintEndDoc requests. type PrintEndDocCookie struct { *xgb.Cookie } -// Write request to wire for PrintEndDoc +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printEndDocRequest(c, Cancel), cookie) return PrintEndDocCookie{cookie} } +// PrintEndDocChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintEndDocCookie.Check() func PrintEndDocChecked(c *xgb.Conn, Cancel bool) PrintEndDocCookie { cookie := c.NewCookie(true, false) c.NewRequest(printEndDocRequest(c, Cancel), cookie) return PrintEndDocCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintEndDocCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintEndDoc +// printEndDocRequest writes a PrintEndDoc request to a byte slice. func printEndDocRequest(c *xgb.Conn, Cancel bool) []byte { size := 8 b := 0 @@ -1145,30 +1191,35 @@ func printEndDocRequest(c *xgb.Conn, Cancel bool) []byte { return buf } -// Request PrintPutDocumentData -// size: xgb.Pad((((16 + xgb.Pad((int(LenData) * 1))) + xgb.Pad((len(DocFormat) * 1))) + xgb.Pad((len(Options) * 1)))) +// PrintPutDocumentDataCookie is a cookie used only for PrintPutDocumentData requests. type PrintPutDocumentDataCookie struct { *xgb.Cookie } -// Write request to wire for PrintPutDocumentData +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) return PrintPutDocumentDataCookie{cookie} } +// 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 { cookie := c.NewCookie(true, false) c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) return PrintPutDocumentDataCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintPutDocumentDataCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintPutDocumentData +// printPutDocumentDataRequest writes a PrintPutDocumentData request to a byte slice. func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) []byte { size := xgb.Pad((((16 + xgb.Pad((int(LenData) * 1))) + xgb.Pad((len(DocFormat) * 1))) + xgb.Pad((len(Options) * 1)))) b := 0 @@ -1213,29 +1264,31 @@ func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData return buf } -// Request PrintGetDocumentData -// size: 12 +// PrintGetDocumentDataCookie is a cookie used only for PrintGetDocumentData requests. type PrintGetDocumentDataCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) return PrintGetDocumentDataCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) return PrintGetDocumentDataCookie{cookie} } -// Request reply for PrintGetDocumentData -// size: (32 + xgb.Pad((int(DataLen) * 1))) +// PrintGetDocumentDataReply represents the data returned from a PrintGetDocumentData request. type PrintGetDocumentDataReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes StatusCode uint32 FinishedFlag uint32 @@ -1244,7 +1297,7 @@ type PrintGetDocumentDataReply struct { Data []byte // size: xgb.Pad((int(DataLen) * 1)) } -// Waits and reads reply data from request PrintGetDocumentData +// Reply blocks and returns the reply data for a PrintGetDocumentData request. func (cook PrintGetDocumentDataCookie) Reply() (*PrintGetDocumentDataReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1256,7 +1309,7 @@ func (cook PrintGetDocumentDataCookie) Reply() (*PrintGetDocumentDataReply, erro return printGetDocumentDataReply(buf), nil } -// Read reply into structure from buffer for PrintGetDocumentData +// printGetDocumentDataReply reads a byte slice into a PrintGetDocumentDataReply value. func printGetDocumentDataReply(buf []byte) *PrintGetDocumentDataReply { v := new(PrintGetDocumentDataReply) b := 1 // skip reply determinant @@ -1288,6 +1341,7 @@ func printGetDocumentDataReply(buf []byte) *PrintGetDocumentDataReply { } // Write request to wire for PrintGetDocumentData +// printGetDocumentDataRequest writes a PrintGetDocumentData request to a byte slice. func printGetDocumentDataRequest(c *xgb.Conn, Context Pcontext, MaxBytes uint32) []byte { size := 12 b := 0 @@ -1311,30 +1365,35 @@ func printGetDocumentDataRequest(c *xgb.Conn, Context Pcontext, MaxBytes uint32) return buf } -// Request PrintStartPage -// size: 8 +// PrintStartPageCookie is a cookie used only for PrintStartPage requests. type PrintStartPageCookie struct { *xgb.Cookie } -// Write request to wire for PrintStartPage +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printStartPageRequest(c, Window), cookie) return PrintStartPageCookie{cookie} } +// 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 { cookie := c.NewCookie(true, false) c.NewRequest(printStartPageRequest(c, Window), cookie) return PrintStartPageCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintStartPageCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintStartPage +// printStartPageRequest writes a PrintStartPage request to a byte slice. func printStartPageRequest(c *xgb.Conn, Window xproto.Window) []byte { size := 8 b := 0 @@ -1355,30 +1414,35 @@ func printStartPageRequest(c *xgb.Conn, Window xproto.Window) []byte { return buf } -// Request PrintEndPage -// size: 8 +// PrintEndPageCookie is a cookie used only for PrintEndPage requests. type PrintEndPageCookie struct { *xgb.Cookie } -// Write request to wire for PrintEndPage +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printEndPageRequest(c, Cancel), cookie) return PrintEndPageCookie{cookie} } +// PrintEndPageChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintEndPageCookie.Check() func PrintEndPageChecked(c *xgb.Conn, Cancel bool) PrintEndPageCookie { cookie := c.NewCookie(true, false) c.NewRequest(printEndPageRequest(c, Cancel), cookie) return PrintEndPageCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintEndPageCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintEndPage +// printEndPageRequest writes a PrintEndPage request to a byte slice. func printEndPageRequest(c *xgb.Conn, Cancel bool) []byte { size := 8 b := 0 @@ -1405,30 +1469,35 @@ func printEndPageRequest(c *xgb.Conn, Cancel bool) []byte { return buf } -// Request PrintSelectInput -// size: xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(EventMask))))))) +// PrintSelectInputCookie is a cookie used only for PrintSelectInput requests. type PrintSelectInputCookie struct { *xgb.Cookie } -// Write request to wire for PrintSelectInput +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) return PrintSelectInputCookie{cookie} } +// 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 { cookie := c.NewCookie(true, false) c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) return PrintSelectInputCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintSelectInputCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintSelectInput +// printSelectInputRequest writes a PrintSelectInput request to a byte slice. func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList []uint32) []byte { size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(EventMask))))))) b := 0 @@ -1457,29 +1526,31 @@ func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32, Ev return buf } -// Request PrintInputSelected -// size: 8 +// PrintInputSelectedCookie is a cookie used only for PrintInputSelected requests. type PrintInputSelectedCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printInputSelectedRequest(c, Context), cookie) return PrintInputSelectedCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printInputSelectedRequest(c, Context), cookie) return PrintInputSelectedCookie{cookie} } -// Request reply for PrintInputSelected -// size: ((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(EventMask)))))) + (4 + xgb.Pad((4 * xgb.PopCount(int(AllEventsMask)))))) +// PrintInputSelectedReply represents the data returned from a PrintInputSelected request. type PrintInputSelectedReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes EventMask uint32 EventList []uint32 @@ -1487,7 +1558,7 @@ type PrintInputSelectedReply struct { AllEventsList []uint32 } -// Waits and reads reply data from request PrintInputSelected +// Reply blocks and returns the reply data for a PrintInputSelected request. func (cook PrintInputSelectedCookie) Reply() (*PrintInputSelectedReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1499,7 +1570,7 @@ func (cook PrintInputSelectedCookie) Reply() (*PrintInputSelectedReply, error) { return printInputSelectedReply(buf), nil } -// Read reply into structure from buffer for PrintInputSelected +// printInputSelectedReply reads a byte slice into a PrintInputSelectedReply value. func printInputSelectedReply(buf []byte) *PrintInputSelectedReply { v := new(PrintInputSelectedReply) b := 1 // skip reply determinant @@ -1536,6 +1607,7 @@ func printInputSelectedReply(buf []byte) *PrintInputSelectedReply { } // Write request to wire for PrintInputSelected +// printInputSelectedRequest writes a PrintInputSelected request to a byte slice. func printInputSelectedRequest(c *xgb.Conn, Context Pcontext) []byte { size := 8 b := 0 @@ -1556,36 +1628,38 @@ func printInputSelectedRequest(c *xgb.Conn, Context Pcontext) []byte { return buf } -// Request PrintGetAttributes -// size: 12 +// PrintGetAttributesCookie is a cookie used only for PrintGetAttributes requests. type PrintGetAttributesCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) return PrintGetAttributesCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) return PrintGetAttributesCookie{cookie} } -// Request reply for PrintGetAttributes -// size: 33 +// PrintGetAttributesReply represents the data returned from a PrintGetAttributes request. type PrintGetAttributesReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes StringLen uint32 // padding: 20 bytes Attributes String8 } -// Waits and reads reply data from request PrintGetAttributes +// Reply blocks and returns the reply data for a PrintGetAttributes request. func (cook PrintGetAttributesCookie) Reply() (*PrintGetAttributesReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1597,7 +1671,7 @@ func (cook PrintGetAttributesCookie) Reply() (*PrintGetAttributesReply, error) { return printGetAttributesReply(buf), nil } -// Read reply into structure from buffer for PrintGetAttributes +// printGetAttributesReply reads a byte slice into a PrintGetAttributesReply value. func printGetAttributesReply(buf []byte) *PrintGetAttributesReply { v := new(PrintGetAttributesReply) b := 1 // skip reply determinant @@ -1622,6 +1696,7 @@ func printGetAttributesReply(buf []byte) *PrintGetAttributesReply { } // Write request to wire for PrintGetAttributes +// printGetAttributesRequest writes a PrintGetAttributes request to a byte slice. func printGetAttributesRequest(c *xgb.Conn, Context Pcontext, Pool byte) []byte { size := 12 b := 0 @@ -1647,36 +1722,38 @@ func printGetAttributesRequest(c *xgb.Conn, Context Pcontext, Pool byte) []byte return buf } -// Request PrintGetOneAttributes -// size: xgb.Pad((16 + xgb.Pad((int(NameLen) * 1)))) +// PrintGetOneAttributesCookie is a cookie used only for PrintGetOneAttributes requests. type PrintGetOneAttributesCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) return PrintGetOneAttributesCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) return PrintGetOneAttributesCookie{cookie} } -// Request reply for PrintGetOneAttributes -// size: (32 + xgb.Pad((int(ValueLen) * 1))) +// PrintGetOneAttributesReply represents the data returned from a PrintGetOneAttributes request. type PrintGetOneAttributesReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes ValueLen uint32 // padding: 20 bytes Value []String8 // size: xgb.Pad((int(ValueLen) * 1)) } -// Waits and reads reply data from request PrintGetOneAttributes +// Reply blocks and returns the reply data for a PrintGetOneAttributes request. func (cook PrintGetOneAttributesCookie) Reply() (*PrintGetOneAttributesReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1688,7 +1765,7 @@ func (cook PrintGetOneAttributesCookie) Reply() (*PrintGetOneAttributesReply, er return printGetOneAttributesReply(buf), nil } -// Read reply into structure from buffer for PrintGetOneAttributes +// printGetOneAttributesReply reads a byte slice into a PrintGetOneAttributesReply value. func printGetOneAttributesReply(buf []byte) *PrintGetOneAttributesReply { v := new(PrintGetOneAttributesReply) b := 1 // skip reply determinant @@ -1717,6 +1794,7 @@ func printGetOneAttributesReply(buf []byte) *PrintGetOneAttributesReply { } // Write request to wire for PrintGetOneAttributes +// printGetOneAttributesRequest writes a PrintGetOneAttributes request to a byte slice. func printGetOneAttributesRequest(c *xgb.Conn, Context Pcontext, NameLen uint32, Pool byte, Name []String8) []byte { size := xgb.Pad((16 + xgb.Pad((int(NameLen) * 1)))) b := 0 @@ -1751,30 +1829,35 @@ func printGetOneAttributesRequest(c *xgb.Conn, Context Pcontext, NameLen uint32, return buf } -// Request PrintSetAttributes -// size: xgb.Pad((16 + xgb.Pad((len(Attributes) * 1)))) +// PrintSetAttributesCookie is a cookie used only for PrintSetAttributes requests. type PrintSetAttributesCookie struct { *xgb.Cookie } -// Write request to wire for PrintSetAttributes +// 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 { cookie := c.NewCookie(false, false) c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) return PrintSetAttributesCookie{cookie} } +// 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 { cookie := c.NewCookie(true, false) c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) return PrintSetAttributesCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook PrintSetAttributesCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PrintSetAttributes +// printSetAttributesRequest writes a PrintSetAttributes request to a byte slice. func printSetAttributesRequest(c *xgb.Conn, Context Pcontext, StringLen uint32, Pool byte, Rule byte, Attributes []String8) []byte { size := xgb.Pad((16 + xgb.Pad((len(Attributes) * 1)))) b := 0 @@ -1812,29 +1895,31 @@ func printSetAttributesRequest(c *xgb.Conn, Context Pcontext, StringLen uint32, return buf } -// Request PrintGetPageDimensions -// size: 8 +// PrintGetPageDimensionsCookie is a cookie used only for PrintGetPageDimensions requests. type PrintGetPageDimensionsCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) return PrintGetPageDimensionsCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) return PrintGetPageDimensionsCookie{cookie} } -// Request reply for PrintGetPageDimensions -// size: 20 +// PrintGetPageDimensionsReply represents the data returned from a PrintGetPageDimensions request. type PrintGetPageDimensionsReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Width uint16 Height uint16 @@ -1844,7 +1929,7 @@ type PrintGetPageDimensionsReply struct { ReproducibleHeight uint16 } -// Waits and reads reply data from request PrintGetPageDimensions +// Reply blocks and returns the reply data for a PrintGetPageDimensions request. func (cook PrintGetPageDimensionsCookie) Reply() (*PrintGetPageDimensionsReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1856,7 +1941,7 @@ func (cook PrintGetPageDimensionsCookie) Reply() (*PrintGetPageDimensionsReply, return printGetPageDimensionsReply(buf), nil } -// Read reply into structure from buffer for PrintGetPageDimensions +// printGetPageDimensionsReply reads a byte slice into a PrintGetPageDimensionsReply value. func printGetPageDimensionsReply(buf []byte) *PrintGetPageDimensionsReply { v := new(PrintGetPageDimensionsReply) b := 1 // skip reply determinant @@ -1891,6 +1976,7 @@ func printGetPageDimensionsReply(buf []byte) *PrintGetPageDimensionsReply { } // Write request to wire for PrintGetPageDimensions +// printGetPageDimensionsRequest writes a PrintGetPageDimensions request to a byte slice. func printGetPageDimensionsRequest(c *xgb.Conn, Context Pcontext) []byte { size := 8 b := 0 @@ -1911,36 +1997,38 @@ func printGetPageDimensionsRequest(c *xgb.Conn, Context Pcontext) []byte { return buf } -// Request PrintQueryScreens -// size: 4 +// PrintQueryScreensCookie is a cookie used only for PrintQueryScreens requests. type PrintQueryScreensCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printQueryScreensRequest(c), cookie) return PrintQueryScreensCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printQueryScreensRequest(c), cookie) return PrintQueryScreensCookie{cookie} } -// Request reply for PrintQueryScreens -// size: (32 + xgb.Pad((int(ListCount) * 4))) +// PrintQueryScreensReply represents the data returned from a PrintQueryScreens request. type PrintQueryScreensReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes ListCount uint32 // padding: 20 bytes Roots []xproto.Window // size: xgb.Pad((int(ListCount) * 4)) } -// Waits and reads reply data from request PrintQueryScreens +// Reply blocks and returns the reply data for a PrintQueryScreens request. func (cook PrintQueryScreensCookie) Reply() (*PrintQueryScreensReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1952,7 +2040,7 @@ func (cook PrintQueryScreensCookie) Reply() (*PrintQueryScreensReply, error) { return printQueryScreensReply(buf), nil } -// Read reply into structure from buffer for PrintQueryScreens +// printQueryScreensReply reads a byte slice into a PrintQueryScreensReply value. func printQueryScreensReply(buf []byte) *PrintQueryScreensReply { v := new(PrintQueryScreensReply) b := 1 // skip reply determinant @@ -1981,6 +2069,7 @@ func printQueryScreensReply(buf []byte) *PrintQueryScreensReply { } // Write request to wire for PrintQueryScreens +// printQueryScreensRequest writes a PrintQueryScreens request to a byte slice. func printQueryScreensRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -1998,34 +2087,36 @@ func printQueryScreensRequest(c *xgb.Conn) []byte { return buf } -// Request PrintSetImageResolution -// size: 12 +// PrintSetImageResolutionCookie is a cookie used only for PrintSetImageResolution requests. type PrintSetImageResolutionCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printSetImageResolutionRequest(c, Context, ImageResolution), cookie) return PrintSetImageResolutionCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printSetImageResolutionRequest(c, Context, ImageResolution), cookie) return PrintSetImageResolutionCookie{cookie} } -// Request reply for PrintSetImageResolution -// size: 10 +// PrintSetImageResolutionReply represents the data returned from a PrintSetImageResolution request. type PrintSetImageResolutionReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply Status bool PreviousResolutions uint16 } -// Waits and reads reply data from request PrintSetImageResolution +// Reply blocks and returns the reply data for a PrintSetImageResolution request. func (cook PrintSetImageResolutionCookie) Reply() (*PrintSetImageResolutionReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2037,7 +2128,7 @@ func (cook PrintSetImageResolutionCookie) Reply() (*PrintSetImageResolutionReply return printSetImageResolutionReply(buf), nil } -// Read reply into structure from buffer for PrintSetImageResolution +// printSetImageResolutionReply reads a byte slice into a PrintSetImageResolutionReply value. func printSetImageResolutionReply(buf []byte) *PrintSetImageResolutionReply { v := new(PrintSetImageResolutionReply) b := 1 // skip reply determinant @@ -2062,6 +2153,7 @@ func printSetImageResolutionReply(buf []byte) *PrintSetImageResolutionReply { } // Write request to wire for PrintSetImageResolution +// printSetImageResolutionRequest writes a PrintSetImageResolution request to a byte slice. func printSetImageResolutionRequest(c *xgb.Conn, Context Pcontext, ImageResolution uint16) []byte { size := 12 b := 0 @@ -2085,34 +2177,36 @@ func printSetImageResolutionRequest(c *xgb.Conn, Context Pcontext, ImageResoluti return buf } -// Request PrintGetImageResolution -// size: 8 +// PrintGetImageResolutionCookie is a cookie used only for PrintGetImageResolution requests. type PrintGetImageResolutionCookie struct { *xgb.Cookie } +// 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 { cookie := c.NewCookie(true, true) c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) return PrintGetImageResolutionCookie{cookie} } +// 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 { cookie := c.NewCookie(false, true) c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) return PrintGetImageResolutionCookie{cookie} } -// Request reply for PrintGetImageResolution -// size: 10 +// PrintGetImageResolutionReply represents the data returned from a PrintGetImageResolution request. type PrintGetImageResolutionReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes ImageResolution uint16 } -// Waits and reads reply data from request PrintGetImageResolution +// Reply blocks and returns the reply data for a PrintGetImageResolution request. func (cook PrintGetImageResolutionCookie) Reply() (*PrintGetImageResolutionReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2124,7 +2218,7 @@ func (cook PrintGetImageResolutionCookie) Reply() (*PrintGetImageResolutionReply return printGetImageResolutionReply(buf), nil } -// Read reply into structure from buffer for PrintGetImageResolution +// printGetImageResolutionReply reads a byte slice into a PrintGetImageResolutionReply value. func printGetImageResolutionReply(buf []byte) *PrintGetImageResolutionReply { v := new(PrintGetImageResolutionReply) b := 1 // skip reply determinant @@ -2144,6 +2238,7 @@ func printGetImageResolutionReply(buf []byte) *PrintGetImageResolutionReply { } // Write request to wire for PrintGetImageResolution +// printGetImageResolutionRequest writes a PrintGetImageResolution request to a byte slice. func printGetImageResolutionRequest(c *xgb.Conn, Context Pcontext) []byte { size := 8 b := 0 -- cgit v1.2.3 From 3e6b3544934cb71e3a3b0edf9bc184241ac1ad7f Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 01:58:52 -0400 Subject: add a little more docs for errors --- nexgb/xprint/xprint.go | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 237b6b5..9f4bd6b 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -2,7 +2,7 @@ package xprint /* - This file was generated by xprint.xml on May 10 2012 11:56:19pm EDT. + This file was generated by xprint.xml on May 11 2012 1:58:37am EDT. This file is automatically generated. Edit at your peril! */ @@ -40,18 +40,6 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Card16' - -// Skipping definition for base type 'Char' - -// Skipping definition for base type 'Card32' - -// Skipping definition for base type 'Double' - -// Skipping definition for base type 'Bool' - -// Skipping definition for base type 'Float' - // Skipping definition for base type 'Card8' // Skipping definition for base type 'Int16' @@ -64,6 +52,18 @@ func init() { // Skipping definition for base type 'Int8' +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + const ( GetDocFinished = 0 GetDocSecondConsumer = 1 @@ -373,10 +373,13 @@ func (err BadContextError) SequenceId() uint16 { return err.Sequence } +// BadId returns the 'BadValue' number if one exists for the BadBadContext error. If no bad value exists, 0 is returned. func (err BadContextError) BadId() uint32 { return 0 } +// Error returns a rudimentary string representation of the BadBadContext error. + func (err BadContextError) Error() string { fieldVals := make([]string, 0, 0) fieldVals = append(fieldVals, "NiceName: "+err.NiceName) @@ -416,10 +419,13 @@ func (err BadSequenceError) SequenceId() uint16 { return err.Sequence } +// BadId returns the 'BadValue' number if one exists for the BadBadSequence error. If no bad value exists, 0 is returned. func (err BadSequenceError) BadId() uint32 { return 0 } +// Error returns a rudimentary string representation of the BadBadSequence error. + func (err BadSequenceError) Error() string { fieldVals := make([]string, 0, 0) fieldVals = append(fieldVals, "NiceName: "+err.NiceName) -- cgit v1.2.3 From 29942bf078c92fea681e42ca5029592526f00718 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 23:58:52 -0400 Subject: panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people. --- nexgb/xprint/xprint.go | 172 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 161 insertions(+), 11 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 9f4bd6b..8e6f470 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -2,7 +2,7 @@ package xprint /* - This file was generated by xprint.xml on May 11 2012 1:58:37am EDT. + This file was generated by xprint.xml on May 11 2012 11:57:20pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,6 +40,16 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + // Skipping definition for base type 'Card8' // Skipping definition for base type 'Int16' @@ -54,16 +64,6 @@ func init() { // Skipping definition for base type 'Card16' -// Skipping definition for base type 'Char' - -// Skipping definition for base type 'Card32' - -// Skipping definition for base type 'Double' - -// Skipping definition for base type 'Bool' - -// Skipping definition for base type 'Float' - const ( GetDocFinished = 0 GetDocSecondConsumer = 1 @@ -445,6 +445,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printQueryVersionRequest(c), cookie) return PrintQueryVersionCookie{cookie} @@ -453,6 +456,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printQueryVersionRequest(c), cookie) return PrintQueryVersionCookie{cookie} @@ -528,6 +534,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) return PrintGetPrinterListCookie{cookie} @@ -536,6 +545,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) return PrintGetPrinterListCookie{cookie} @@ -632,6 +644,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printRehashPrinterListRequest(c), cookie) return PrintRehashPrinterListCookie{cookie} @@ -640,6 +655,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printRehashPrinterListRequest(c), cookie) return PrintRehashPrinterListCookie{cookie} @@ -678,6 +696,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) return CreateContextCookie{cookie} @@ -686,6 +707,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) return CreateContextCookie{cookie} @@ -745,6 +769,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printSetContextRequest(c, Context), cookie) return PrintSetContextCookie{cookie} @@ -753,6 +780,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printSetContextRequest(c, Context), cookie) return PrintSetContextCookie{cookie} @@ -794,6 +824,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printGetContextRequest(c), cookie) return PrintGetContextCookie{cookie} @@ -802,6 +835,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printGetContextRequest(c), cookie) return PrintGetContextCookie{cookie} @@ -873,6 +909,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printDestroyContextRequest(c, Context), cookie) return PrintDestroyContextCookie{cookie} @@ -881,6 +920,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printDestroyContextRequest(c, Context), cookie) return PrintDestroyContextCookie{cookie} @@ -922,6 +964,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printGetScreenOfContextRequest(c), cookie) return PrintGetScreenOfContextCookie{cookie} @@ -930,6 +975,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printGetScreenOfContextRequest(c), cookie) return PrintGetScreenOfContextCookie{cookie} @@ -1001,6 +1049,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printStartJobRequest(c, OutputMode), cookie) return PrintStartJobCookie{cookie} @@ -1009,6 +1060,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printStartJobRequest(c, OutputMode), cookie) return PrintStartJobCookie{cookie} @@ -1050,6 +1104,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printEndJobRequest(c, Cancel), cookie) return PrintEndJobCookie{cookie} @@ -1058,6 +1115,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printEndJobRequest(c, Cancel), cookie) return PrintEndJobCookie{cookie} @@ -1103,6 +1163,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printStartDocRequest(c, DriverMode), cookie) return PrintStartDocCookie{cookie} @@ -1111,6 +1174,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printStartDocRequest(c, DriverMode), cookie) return PrintStartDocCookie{cookie} @@ -1152,6 +1218,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printEndDocRequest(c, Cancel), cookie) return PrintEndDocCookie{cookie} @@ -1160,6 +1229,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printEndDocRequest(c, Cancel), cookie) return PrintEndDocCookie{cookie} @@ -1205,6 +1277,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) return PrintPutDocumentDataCookie{cookie} @@ -1213,6 +1288,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) return PrintPutDocumentDataCookie{cookie} @@ -1278,6 +1356,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) return PrintGetDocumentDataCookie{cookie} @@ -1286,6 +1367,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) return PrintGetDocumentDataCookie{cookie} @@ -1379,6 +1463,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printStartPageRequest(c, Window), cookie) return PrintStartPageCookie{cookie} @@ -1387,6 +1474,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printStartPageRequest(c, Window), cookie) return PrintStartPageCookie{cookie} @@ -1428,6 +1518,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printEndPageRequest(c, Cancel), cookie) return PrintEndPageCookie{cookie} @@ -1436,6 +1529,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printEndPageRequest(c, Cancel), cookie) return PrintEndPageCookie{cookie} @@ -1483,6 +1579,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) return PrintSelectInputCookie{cookie} @@ -1491,6 +1590,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) return PrintSelectInputCookie{cookie} @@ -1540,6 +1642,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintInputSelected' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printInputSelectedRequest(c, Context), cookie) return PrintInputSelectedCookie{cookie} @@ -1548,6 +1653,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintInputSelected' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printInputSelectedRequest(c, Context), cookie) return PrintInputSelectedCookie{cookie} @@ -1642,6 +1750,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) return PrintGetAttributesCookie{cookie} @@ -1650,6 +1761,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) return PrintGetAttributesCookie{cookie} @@ -1736,6 +1850,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) return PrintGetOneAttributesCookie{cookie} @@ -1744,6 +1861,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) return PrintGetOneAttributesCookie{cookie} @@ -1843,6 +1963,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) return PrintSetAttributesCookie{cookie} @@ -1851,6 +1974,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) return PrintSetAttributesCookie{cookie} @@ -1909,6 +2035,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) return PrintGetPageDimensionsCookie{cookie} @@ -1917,6 +2046,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) return PrintGetPageDimensionsCookie{cookie} @@ -2011,6 +2143,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printQueryScreensRequest(c), cookie) return PrintQueryScreensCookie{cookie} @@ -2019,6 +2154,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printQueryScreensRequest(c), cookie) return PrintQueryScreensCookie{cookie} @@ -2101,6 +2239,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printSetImageResolutionRequest(c, Context, ImageResolution), cookie) return PrintSetImageResolutionCookie{cookie} @@ -2109,6 +2250,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printSetImageResolutionRequest(c, Context, ImageResolution), cookie) return PrintSetImageResolutionCookie{cookie} @@ -2191,6 +2335,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) return PrintGetImageResolutionCookie{cookie} @@ -2199,6 +2346,9 @@ 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) return PrintGetImageResolutionCookie{cookie} -- cgit v1.2.3 From 4ea94ca0fef7786ce21722cbb02a9cf069bdedd9 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Sat, 26 May 2012 18:24:52 -0400 Subject: Bug fix in the generator that was outputting %(MISSING) crud. --- nexgb/xprint/xprint.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 8e6f470..a7a537a 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -2,7 +2,7 @@ package xprint /* - This file was generated by xprint.xml on May 11 2012 11:57:20pm EDT. + This file was generated by xprint.xml on May 26 2012 6:23:14pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,16 +40,6 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Char' - -// Skipping definition for base type 'Card32' - -// Skipping definition for base type 'Double' - -// Skipping definition for base type 'Bool' - -// Skipping definition for base type 'Float' - // Skipping definition for base type 'Card8' // Skipping definition for base type 'Int16' @@ -64,6 +54,16 @@ func init() { // Skipping definition for base type 'Card16' +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + const ( GetDocFinished = 0 GetDocSecondConsumer = 1 @@ -176,7 +176,7 @@ func (v Printer) Bytes() []byte { return buf } -// PrinterListBytes writes a list of %s(MISSING) values to a byte slice. +// PrinterListBytes writes a list of Printer values to a byte slice. func PrinterListBytes(buf []byte, list []Printer) int { b := 0 var structBytes []byte -- cgit v1.2.3 From a9eae45cb3977bce5983e817d00d4584d176b044 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Tue, 5 Jun 2012 00:14:34 -0400 Subject: Refresh build. Eh. --- nexgb/xprint/xprint.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index a7a537a..54fb065 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -2,7 +2,7 @@ package xprint /* - This file was generated by xprint.xml on May 26 2012 6:23:14pm EDT. + This file was generated by xprint.xml on Jun 5 2012 12:12:00am EDT. This file is automatically generated. Edit at your peril! */ @@ -40,6 +40,14 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + // Skipping definition for base type 'Card8' // Skipping definition for base type 'Int16' @@ -56,14 +64,6 @@ func init() { // Skipping definition for base type 'Char' -// Skipping definition for base type 'Card32' - -// Skipping definition for base type 'Double' - -// Skipping definition for base type 'Bool' - -// Skipping definition for base type 'Float' - const ( GetDocFinished = 0 GetDocSecondConsumer = 1 -- cgit v1.2.3 From 0685fb57e14104ee4ad9f70ec94f787a9a22c028 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:43:26 -0400 Subject: Update to latest xproto XML. --- nexgb/xprint/xprint.go | 2418 ++++++++++++++++++++++++------------------------ 1 file changed, 1209 insertions(+), 1209 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 54fb065..8dfc660 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -2,7 +2,7 @@ package xprint /* - This file was generated by xprint.xml on Jun 5 2012 12:12:00am EDT. + This file was generated by xprint.xml on Aug 11 2013 8:39:44pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,50 +40,6 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Card32' - -// Skipping definition for base type 'Double' - -// Skipping definition for base type 'Bool' - -// Skipping definition for base type 'Float' - -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - -// Skipping definition for base type 'Int32' - -// Skipping definition for base type 'Void' - -// Skipping definition for base type 'Byte' - -// Skipping definition for base type 'Int8' - -// Skipping definition for base type 'Card16' - -// Skipping definition for base type 'Char' - -const ( - GetDocFinished = 0 - GetDocSecondConsumer = 1 -) - -const ( - EvMaskNoEventMask = 0 - EvMaskPrintMask = 1 - EvMaskAttributeMask = 2 -) - -const ( - DetailStartJobNotify = 1 - DetailEndJobNotify = 2 - DetailStartDocNotify = 3 - DetailEndDocNotify = 4 - DetailStartPageNotify = 5 - DetailEndPageNotify = 6 -) - const ( AttrJobAttr = 1 AttrDocAttr = 2 @@ -94,191 +50,6 @@ const ( AttrSpoolerAttr = 7 ) -type Pcontext uint32 - -func NewPcontextId(c *xgb.Conn) (Pcontext, error) { - id, err := c.NewId() - if err != nil { - return 0, err - } - return Pcontext(id), nil -} - -type String8 byte - -type Printer struct { - NameLen uint32 - Name []String8 // size: xgb.Pad((int(NameLen) * 1)) - DescLen uint32 - Description []String8 // size: xgb.Pad((int(DescLen) * 1)) -} - -// PrinterRead reads a byte slice into a Printer value. -func PrinterRead(buf []byte, v *Printer) int { - b := 0 - - v.NameLen = xgb.Get32(buf[b:]) - b += 4 - - v.Name = make([]String8, v.NameLen) - for i := 0; i < int(v.NameLen); i++ { - v.Name[i] = String8(buf[b]) - b += 1 - } - b = xgb.Pad(b) - - v.DescLen = xgb.Get32(buf[b:]) - b += 4 - - v.Description = make([]String8, v.DescLen) - for i := 0; i < int(v.DescLen); i++ { - v.Description[i] = String8(buf[b]) - b += 1 - } - b = xgb.Pad(b) - - return b -} - -// PrinterReadList reads a byte slice into a list of Printer values. -func PrinterReadList(buf []byte, dest []Printer) int { - b := 0 - for i := 0; i < len(dest); i++ { - dest[i] = Printer{} - b += PrinterRead(buf[b:], &dest[i]) - } - return xgb.Pad(b) -} - -// Bytes writes a Printer value to a byte slice. -func (v Printer) Bytes() []byte { - buf := make([]byte, (((4 + xgb.Pad((int(v.NameLen) * 1))) + 4) + xgb.Pad((int(v.DescLen) * 1)))) - b := 0 - - xgb.Put32(buf[b:], v.NameLen) - b += 4 - - for i := 0; i < int(v.NameLen); i++ { - buf[b] = byte(v.Name[i]) - b += 1 - } - b = xgb.Pad(b) - - xgb.Put32(buf[b:], v.DescLen) - b += 4 - - for i := 0; i < int(v.DescLen); i++ { - buf[b] = byte(v.Description[i]) - b += 1 - } - b = xgb.Pad(b) - - return buf -} - -// PrinterListBytes writes a list of Printer values to a byte slice. -func PrinterListBytes(buf []byte, list []Printer) int { - b := 0 - var structBytes []byte - for _, item := range list { - structBytes = item.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } - return b -} - -// PrinterListSize computes the size (bytes) of a list of Printer values. -func PrinterListSize(list []Printer) int { - size := 0 - for _, item := range list { - size += (((4 + xgb.Pad((int(item.NameLen) * 1))) + 4) + xgb.Pad((int(item.DescLen) * 1))) - } - return size -} - -// Notify is the event number for a NotifyEvent. -const Notify = 0 - -type NotifyEvent struct { - Sequence uint16 - Detail byte - Context Pcontext - Cancel bool -} - -// NotifyEventNew constructs a NotifyEvent value that implements xgb.Event from a byte slice. -func NotifyEventNew(buf []byte) xgb.Event { - v := NotifyEvent{} - b := 1 // don't read event number - - v.Detail = buf[b] - b += 1 - - v.Sequence = xgb.Get16(buf[b:]) - b += 2 - - v.Context = Pcontext(xgb.Get32(buf[b:])) - b += 4 - - if buf[b] == 1 { - v.Cancel = true - } else { - v.Cancel = false - } - b += 1 - - return v -} - -// Bytes writes a NotifyEvent value to a byte slice. -func (v NotifyEvent) Bytes() []byte { - buf := make([]byte, 32) - b := 0 - - // write event number - buf[b] = 0 - b += 1 - - buf[b] = v.Detail - b += 1 - - b += 2 // skip sequence number - - xgb.Put32(buf[b:], uint32(v.Context)) - b += 4 - - if v.Cancel { - buf[b] = 1 - } else { - buf[b] = 0 - } - b += 1 - - return buf -} - -// SequenceId returns the sequence id attached to the Notify event. -// Events without a sequence number (KeymapNotify) return 0. -// This is mostly used internally. -func (v NotifyEvent) SequenceId() uint16 { - return v.Sequence -} - -// String is a rudimentary string representation of NotifyEvent. -func (v NotifyEvent) String() string { - fieldVals := make([]string, 0, 3) - fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) - fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail)) - fieldVals = append(fieldVals, xgb.Sprintf("Context: %d", v.Context)) - fieldVals = append(fieldVals, xgb.Sprintf("Cancel: %t", v.Cancel)) - return "Notify {" + xgb.StringsJoin(fieldVals, ", ") + "}" -} - -func init() { - xgb.NewExtEventFuncs["XpExtension"][0] = NotifyEventNew -} - // AttributNotify is the event number for a AttributNotifyEvent. const AttributNotify = 1 @@ -437,184 +208,287 @@ func init() { xgb.NewExtErrorFuncs["XpExtension"][1] = BadSequenceErrorNew } -// PrintQueryVersionCookie is a cookie used only for PrintQueryVersion requests. -type PrintQueryVersionCookie struct { - *xgb.Cookie -} +const ( + DetailStartJobNotify = 1 + DetailEndJobNotify = 2 + DetailStartDocNotify = 3 + DetailEndDocNotify = 4 + DetailStartPageNotify = 5 + DetailEndPageNotify = 6 +) -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, true) - c.NewRequest(printQueryVersionRequest(c), cookie) - return PrintQueryVersionCookie{cookie} -} +const ( + EvMaskNoEventMask = 0 + EvMaskPrintMask = 1 + EvMaskAttributeMask = 2 +) -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, true) - c.NewRequest(printQueryVersionRequest(c), cookie) - return PrintQueryVersionCookie{cookie} -} +const ( + GetDocFinished = 0 + GetDocSecondConsumer = 1 +) -// PrintQueryVersionReply represents the data returned from a PrintQueryVersion request. -type PrintQueryVersionReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - MajorVersion uint16 - MinorVersion uint16 -} +// Notify is the event number for a NotifyEvent. +const Notify = 0 -// Reply blocks and returns the reply data for a PrintQueryVersion request. -func (cook PrintQueryVersionCookie) Reply() (*PrintQueryVersionReply, error) { - buf, err := cook.Cookie.Reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil - } - return printQueryVersionReply(buf), nil +type NotifyEvent struct { + Sequence uint16 + Detail byte + Context Pcontext + Cancel bool } -// printQueryVersionReply reads a byte slice into a PrintQueryVersionReply value. -func printQueryVersionReply(buf []byte) *PrintQueryVersionReply { - v := new(PrintQueryVersionReply) - b := 1 // skip reply determinant +// NotifyEventNew constructs a NotifyEvent value that implements xgb.Event from a byte slice. +func NotifyEventNew(buf []byte) xgb.Event { + v := NotifyEvent{} + b := 1 // don't read event number - b += 1 // padding + v.Detail = buf[b] + b += 1 v.Sequence = xgb.Get16(buf[b:]) b += 2 - v.Length = xgb.Get32(buf[b:]) // 4-byte units + v.Context = Pcontext(xgb.Get32(buf[b:])) b += 4 - v.MajorVersion = xgb.Get16(buf[b:]) - b += 2 - - v.MinorVersion = xgb.Get16(buf[b:]) - b += 2 + if buf[b] == 1 { + v.Cancel = true + } else { + v.Cancel = false + } + b += 1 return v } -// Write request to wire for PrintQueryVersion -// printQueryVersionRequest writes a PrintQueryVersion request to a byte slice. -func printQueryVersionRequest(c *xgb.Conn) []byte { - size := 4 +// Bytes writes a NotifyEvent value to a byte slice. +func (v NotifyEvent) Bytes() []byte { + buf := make([]byte, 32) b := 0 - buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + // write event number + buf[b] = 0 b += 1 - buf[b] = 0 // request opcode + buf[b] = v.Detail b += 1 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 + b += 2 // skip sequence number + + xgb.Put32(buf[b:], uint32(v.Context)) + b += 4 + + if v.Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 return buf } -// PrintGetPrinterListCookie is a cookie used only for PrintGetPrinterList requests. -type PrintGetPrinterListCookie struct { - *xgb.Cookie +// SequenceId returns the sequence id attached to the Notify event. +// Events without a sequence number (KeymapNotify) return 0. +// This is mostly used internally. +func (v NotifyEvent) SequenceId() uint16 { + return v.Sequence } -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, true) - c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) - return PrintGetPrinterListCookie{cookie} +// String is a rudimentary string representation of NotifyEvent. +func (v NotifyEvent) String() string { + fieldVals := make([]string, 0, 3) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, xgb.Sprintf("Context: %d", v.Context)) + fieldVals = append(fieldVals, xgb.Sprintf("Cancel: %t", v.Cancel)) + return "Notify {" + xgb.StringsJoin(fieldVals, ", ") + "}" } -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") +func init() { + xgb.NewExtEventFuncs["XpExtension"][0] = NotifyEventNew +} + +type Pcontext uint32 + +func NewPcontextId(c *xgb.Conn) (Pcontext, error) { + id, err := c.NewId() + if err != nil { + return 0, err } - cookie := c.NewCookie(false, true) - c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) - return PrintGetPrinterListCookie{cookie} + return Pcontext(id), nil } -// PrintGetPrinterListReply represents the data returned from a PrintGetPrinterList request. -type PrintGetPrinterListReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - ListCount uint32 - // padding: 20 bytes - Printers []Printer // size: PrinterListSize(Printers) +type Printer struct { + NameLen uint32 + Name []String8 // size: xgb.Pad((int(NameLen) * 1)) + DescLen uint32 + Description []String8 // size: xgb.Pad((int(DescLen) * 1)) } -// Reply blocks and returns the reply data for a PrintGetPrinterList request. -func (cook PrintGetPrinterListCookie) Reply() (*PrintGetPrinterListReply, error) { - buf, err := cook.Cookie.Reply() - if err != nil { - return nil, err +// PrinterRead reads a byte slice into a Printer value. +func PrinterRead(buf []byte, v *Printer) int { + b := 0 + + v.NameLen = xgb.Get32(buf[b:]) + b += 4 + + v.Name = make([]String8, v.NameLen) + for i := 0; i < int(v.NameLen); i++ { + v.Name[i] = String8(buf[b]) + b += 1 } - if buf == nil { - return nil, nil + b = xgb.Pad(b) + + v.DescLen = xgb.Get32(buf[b:]) + b += 4 + + v.Description = make([]String8, v.DescLen) + for i := 0; i < int(v.DescLen); i++ { + v.Description[i] = String8(buf[b]) + b += 1 } - return printGetPrinterListReply(buf), nil -} + b = xgb.Pad(b) -// printGetPrinterListReply reads a byte slice into a PrintGetPrinterListReply value. -func printGetPrinterListReply(buf []byte) *PrintGetPrinterListReply { - v := new(PrintGetPrinterListReply) - b := 1 // skip reply determinant + return b +} - b += 1 // padding +// PrinterReadList reads a byte slice into a list of Printer values. +func PrinterReadList(buf []byte, dest []Printer) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Printer{} + b += PrinterRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} - v.Sequence = xgb.Get16(buf[b:]) - b += 2 +// Bytes writes a Printer value to a byte slice. +func (v Printer) Bytes() []byte { + buf := make([]byte, (((4 + xgb.Pad((int(v.NameLen) * 1))) + 4) + xgb.Pad((int(v.DescLen) * 1)))) + b := 0 - v.Length = xgb.Get32(buf[b:]) // 4-byte units + xgb.Put32(buf[b:], v.NameLen) b += 4 - v.ListCount = xgb.Get32(buf[b:]) + for i := 0; i < int(v.NameLen); i++ { + buf[b] = byte(v.Name[i]) + b += 1 + } + b = xgb.Pad(b) + + xgb.Put32(buf[b:], v.DescLen) b += 4 - b += 20 // padding + for i := 0; i < int(v.DescLen); i++ { + buf[b] = byte(v.Description[i]) + b += 1 + } + b = xgb.Pad(b) - v.Printers = make([]Printer, v.ListCount) - b += PrinterReadList(buf[b:], v.Printers) + return buf +} - return v +// PrinterListBytes writes a list of Printer values to a byte slice. +func PrinterListBytes(buf []byte, list []Printer) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b } -// Write request to wire for PrintGetPrinterList -// printGetPrinterListRequest writes a PrintGetPrinterList request to a byte slice. -func printGetPrinterListRequest(c *xgb.Conn, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) []byte { - size := xgb.Pad(((12 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) +// PrinterListSize computes the size (bytes) of a list of Printer values. +func PrinterListSize(list []Printer) int { + size := 0 + for _, item := range list { + size += (((4 + xgb.Pad((int(item.NameLen) * 1))) + 4) + xgb.Pad((int(item.DescLen) * 1))) + } + return size +} + +type String8 byte + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Card32' + +// CreateContextCookie is a cookie used only for CreateContext requests. +type CreateContextCookie struct { + *xgb.Cookie +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, false) + c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return CreateContextCookie{cookie} +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, false) + c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return CreateContextCookie{cookie} +} + +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook CreateContextCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateContext +// createContextRequest writes a CreateContext request to a byte slice. +func createContextRequest(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) []byte { + size := xgb.Pad(((16 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 1 // request opcode + buf[b] = 2 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 + xgb.Put32(buf[b:], ContextId) + b += 4 + xgb.Put32(buf[b:], PrinterNameLen) b += 4 @@ -636,167 +510,215 @@ func printGetPrinterListRequest(c *xgb.Conn, PrinterNameLen uint32, LocaleLen ui return buf } -// PrintRehashPrinterListCookie is a cookie used only for PrintRehashPrinterList requests. -type PrintRehashPrinterListCookie struct { +// PrintDestroyContextCookie is a cookie used only for PrintDestroyContext requests. +type PrintDestroyContextCookie struct { + *xgb.Cookie +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, false) + c.NewRequest(printDestroyContextRequest(c, Context), cookie) + return PrintDestroyContextCookie{cookie} +} + +// PrintDestroyContextChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintDestroyContextCookie.Check() +func PrintDestroyContextChecked(c *xgb.Conn, Context uint32) PrintDestroyContextCookie { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, false) + c.NewRequest(printDestroyContextRequest(c, Context), cookie) + return PrintDestroyContextCookie{cookie} +} + +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook PrintDestroyContextCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintDestroyContext +// printDestroyContextRequest writes a PrintDestroyContext request to a byte slice. +func printDestroyContextRequest(c *xgb.Conn, Context uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], Context) + b += 4 + + return buf +} + +// PrintEndDocCookie is a cookie used only for PrintEndDoc requests. +type PrintEndDocCookie struct { *xgb.Cookie } -// PrintRehashPrinterList sends an unchecked request. +// PrintEndDoc 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 { +func PrintEndDoc(c *xgb.Conn, Cancel bool) PrintEndDocCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(printRehashPrinterListRequest(c), cookie) - return PrintRehashPrinterListCookie{cookie} + c.NewRequest(printEndDocRequest(c, Cancel), cookie) + return PrintEndDocCookie{cookie} } -// PrintRehashPrinterListChecked sends a checked request. -// If an error occurs, it can be retrieved using PrintRehashPrinterListCookie.Check() -func PrintRehashPrinterListChecked(c *xgb.Conn) PrintRehashPrinterListCookie { +// PrintEndDocChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintEndDocCookie.Check() +func PrintEndDocChecked(c *xgb.Conn, Cancel bool) PrintEndDocCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(printRehashPrinterListRequest(c), cookie) - return PrintRehashPrinterListCookie{cookie} + c.NewRequest(printEndDocRequest(c, Cancel), cookie) + return PrintEndDocCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintRehashPrinterListCookie) Check() error { +func (cook PrintEndDocCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for PrintRehashPrinterList -// printRehashPrinterListRequest writes a PrintRehashPrinterList request to a byte slice. -func printRehashPrinterListRequest(c *xgb.Conn) []byte { - size := 4 +// Write request to wire for PrintEndDoc +// printEndDocRequest writes a PrintEndDoc request to a byte slice. +func printEndDocRequest(c *xgb.Conn, Cancel bool) []byte { + size := 8 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 20 // request opcode + buf[b] = 10 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + return buf } -// CreateContextCookie is a cookie used only for CreateContext requests. -type CreateContextCookie struct { +// PrintEndJobCookie is a cookie used only for PrintEndJob requests. +type PrintEndJobCookie struct { *xgb.Cookie } -// CreateContext sends an unchecked request. +// PrintEndJob 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 { +func PrintEndJob(c *xgb.Conn, Cancel bool) PrintEndJobCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) - return CreateContextCookie{cookie} + c.NewRequest(printEndJobRequest(c, Cancel), cookie) + return PrintEndJobCookie{cookie} } -// 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 { +// PrintEndJobChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintEndJobCookie.Check() +func PrintEndJobChecked(c *xgb.Conn, Cancel bool) PrintEndJobCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(createContextRequest(c, ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) - return CreateContextCookie{cookie} + c.NewRequest(printEndJobRequest(c, Cancel), cookie) + return PrintEndJobCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook CreateContextCookie) Check() error { +func (cook PrintEndJobCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CreateContext -// createContextRequest writes a CreateContext request to a byte slice. -func createContextRequest(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) []byte { - size := xgb.Pad(((16 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) +// Write request to wire for PrintEndJob +// printEndJobRequest writes a PrintEndJob request to a byte slice. +func printEndJobRequest(c *xgb.Conn, Cancel bool) []byte { + size := 8 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 2 // request opcode + buf[b] = 8 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], ContextId) - b += 4 - - xgb.Put32(buf[b:], PrinterNameLen) - b += 4 - - xgb.Put32(buf[b:], LocaleLen) - b += 4 - - for i := 0; i < int(PrinterNameLen); i++ { - buf[b] = byte(PrinterName[i]) - b += 1 - } - b = xgb.Pad(b) - - for i := 0; i < int(LocaleLen); i++ { - buf[b] = byte(Locale[i]) - b += 1 + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 } - b = xgb.Pad(b) + b += 1 return buf } -// PrintSetContextCookie is a cookie used only for PrintSetContext requests. -type PrintSetContextCookie struct { +// PrintEndPageCookie is a cookie used only for PrintEndPage requests. +type PrintEndPageCookie struct { *xgb.Cookie } -// PrintSetContext sends an unchecked request. +// PrintEndPage 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 { +func PrintEndPage(c *xgb.Conn, Cancel bool) PrintEndPageCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(printSetContextRequest(c, Context), cookie) - return PrintSetContextCookie{cookie} + c.NewRequest(printEndPageRequest(c, Cancel), cookie) + return PrintEndPageCookie{cookie} } -// PrintSetContextChecked sends a checked request. -// If an error occurs, it can be retrieved using PrintSetContextCookie.Check() -func PrintSetContextChecked(c *xgb.Conn, Context uint32) PrintSetContextCookie { +// PrintEndPageChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintEndPageCookie.Check() +func PrintEndPageChecked(c *xgb.Conn, Cancel bool) PrintEndPageCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(printSetContextRequest(c, Context), cookie) - return PrintSetContextCookie{cookie} + c.NewRequest(printEndPageRequest(c, Cancel), cookie) + return PrintEndPageCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintSetContextCookie) Check() error { +func (cook PrintEndPageCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for PrintSetContext -// printSetContextRequest writes a PrintSetContext request to a byte slice. -func printSetContextRequest(c *xgb.Conn, Context uint32) []byte { +// Write request to wire for PrintEndPage +// printEndPageRequest writes a PrintEndPage request to a byte slice. +func printEndPageRequest(c *xgb.Conn, Cancel bool) []byte { size := 8 b := 0 buf := make([]byte, size) @@ -804,55 +726,63 @@ func printSetContextRequest(c *xgb.Conn, Context uint32) []byte { buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 3 // request opcode + buf[b] = 14 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], Context) - b += 4 + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding return buf } -// PrintGetContextCookie is a cookie used only for PrintGetContext requests. -type PrintGetContextCookie struct { +// PrintGetAttributesCookie is a cookie used only for PrintGetAttributes requests. +type PrintGetAttributesCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) - c.NewRequest(printGetContextRequest(c), cookie) - return PrintGetContextCookie{cookie} + c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) + return PrintGetAttributesCookie{cookie} } -// PrintGetContextUnchecked sends an unchecked request. +// PrintGetAttributesUnchecked 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 { +func PrintGetAttributesUnchecked(c *xgb.Conn, Context Pcontext, Pool byte) PrintGetAttributesCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) - c.NewRequest(printGetContextRequest(c), cookie) - return PrintGetContextCookie{cookie} + c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) + return PrintGetAttributesCookie{cookie} } -// PrintGetContextReply represents the data returned from a PrintGetContext request. -type PrintGetContextReply struct { +// PrintGetAttributesReply represents the data returned from a PrintGetAttributes request. +type PrintGetAttributesReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - Context uint32 + StringLen uint32 + // padding: 20 bytes + Attributes String8 } -// Reply blocks and returns the reply data for a PrintGetContext request. -func (cook PrintGetContextCookie) Reply() (*PrintGetContextReply, error) { +// Reply blocks and returns the reply data for a PrintGetAttributes request. +func (cook PrintGetAttributesCookie) Reply() (*PrintGetAttributesReply, error) { buf, err := cook.Cookie.Reply() if err != nil { return nil, err @@ -860,12 +790,12 @@ func (cook PrintGetContextCookie) Reply() (*PrintGetContextReply, error) { if buf == nil { return nil, nil } - return printGetContextReply(buf), nil + return printGetAttributesReply(buf), nil } -// printGetContextReply reads a byte slice into a PrintGetContextReply value. -func printGetContextReply(buf []byte) *PrintGetContextReply { - v := new(PrintGetContextReply) +// printGetAttributesReply reads a byte slice into a PrintGetAttributesReply value. +func printGetAttributesReply(buf []byte) *PrintGetAttributesReply { + v := new(PrintGetAttributesReply) b := 1 // skip reply determinant b += 1 // padding @@ -876,123 +806,81 @@ func printGetContextReply(buf []byte) *PrintGetContextReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.Context = xgb.Get32(buf[b:]) + v.StringLen = xgb.Get32(buf[b:]) b += 4 - return v -} - -// Write request to wire for PrintGetContext -// printGetContextRequest writes a PrintGetContext request to a byte slice. -func printGetContextRequest(c *xgb.Conn) []byte { - size := 4 - b := 0 - buf := make([]byte, size) - - buf[b] = c.Extensions["XPEXTENSION"] - b += 1 + b += 20 // padding - buf[b] = 4 // request opcode + v.Attributes = String8(buf[b]) b += 1 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - return buf -} - -// PrintDestroyContextCookie is a cookie used only for PrintDestroyContext requests. -type PrintDestroyContextCookie struct { - *xgb.Cookie -} - -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(printDestroyContextRequest(c, Context), cookie) - return PrintDestroyContextCookie{cookie} -} - -// PrintDestroyContextChecked sends a checked request. -// If an error occurs, it can be retrieved using PrintDestroyContextCookie.Check() -func PrintDestroyContextChecked(c *xgb.Conn, Context uint32) PrintDestroyContextCookie { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, false) - c.NewRequest(printDestroyContextRequest(c, Context), cookie) - return PrintDestroyContextCookie{cookie} -} - -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintDestroyContextCookie) Check() error { - return cook.Cookie.Check() + return v } - -// Write request to wire for PrintDestroyContext -// printDestroyContextRequest writes a PrintDestroyContext request to a byte slice. -func printDestroyContextRequest(c *xgb.Conn, Context uint32) []byte { - size := 8 + +// Write request to wire for PrintGetAttributes +// printGetAttributesRequest writes a PrintGetAttributes request to a byte slice. +func printGetAttributesRequest(c *xgb.Conn, Context Pcontext, Pool byte) []byte { + size := 12 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 5 // request opcode + buf[b] = 17 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], Context) + xgb.Put32(buf[b:], uint32(Context)) b += 4 + buf[b] = Pool + b += 1 + + b += 3 // padding + return buf } -// PrintGetScreenOfContextCookie is a cookie used only for PrintGetScreenOfContext requests. -type PrintGetScreenOfContextCookie struct { +// PrintGetContextCookie is a cookie used only for PrintGetContext requests. +type PrintGetContextCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) - c.NewRequest(printGetScreenOfContextRequest(c), cookie) - return PrintGetScreenOfContextCookie{cookie} + c.NewRequest(printGetContextRequest(c), cookie) + return PrintGetContextCookie{cookie} } -// PrintGetScreenOfContextUnchecked sends an unchecked request. +// PrintGetContextUnchecked 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 { +func PrintGetContextUnchecked(c *xgb.Conn) PrintGetContextCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) - c.NewRequest(printGetScreenOfContextRequest(c), cookie) - return PrintGetScreenOfContextCookie{cookie} + c.NewRequest(printGetContextRequest(c), cookie) + return PrintGetContextCookie{cookie} } -// PrintGetScreenOfContextReply represents the data returned from a PrintGetScreenOfContext request. -type PrintGetScreenOfContextReply struct { +// PrintGetContextReply represents the data returned from a PrintGetContext request. +type PrintGetContextReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - Root xproto.Window + Context uint32 } -// Reply blocks and returns the reply data for a PrintGetScreenOfContext request. -func (cook PrintGetScreenOfContextCookie) Reply() (*PrintGetScreenOfContextReply, error) { +// Reply blocks and returns the reply data for a PrintGetContext request. +func (cook PrintGetContextCookie) Reply() (*PrintGetContextReply, error) { buf, err := cook.Cookie.Reply() if err != nil { return nil, err @@ -1000,12 +888,12 @@ func (cook PrintGetScreenOfContextCookie) Reply() (*PrintGetScreenOfContextReply if buf == nil { return nil, nil } - return printGetScreenOfContextReply(buf), nil + return printGetContextReply(buf), nil } -// printGetScreenOfContextReply reads a byte slice into a PrintGetScreenOfContextReply value. -func printGetScreenOfContextReply(buf []byte) *PrintGetScreenOfContextReply { - v := new(PrintGetScreenOfContextReply) +// printGetContextReply reads a byte slice into a PrintGetContextReply value. +func printGetContextReply(buf []byte) *PrintGetContextReply { + v := new(PrintGetContextReply) b := 1 // skip reply determinant b += 1 // padding @@ -1016,15 +904,15 @@ func printGetScreenOfContextReply(buf []byte) *PrintGetScreenOfContextReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.Root = xproto.Window(xgb.Get32(buf[b:])) + v.Context = xgb.Get32(buf[b:]) b += 4 return v } -// Write request to wire for PrintGetScreenOfContext -// printGetScreenOfContextRequest writes a PrintGetScreenOfContext request to a byte slice. -func printGetScreenOfContextRequest(c *xgb.Conn) []byte { +// Write request to wire for PrintGetContext +// printGetContextRequest writes a PrintGetContext request to a byte slice. +func printGetContextRequest(c *xgb.Conn) []byte { size := 4 b := 0 buf := make([]byte, size) @@ -1032,7 +920,7 @@ func printGetScreenOfContextRequest(c *xgb.Conn) []byte { buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 6 // request opcode + buf[b] = 4 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -1041,156 +929,182 @@ func printGetScreenOfContextRequest(c *xgb.Conn) []byte { return buf } -// PrintStartJobCookie is a cookie used only for PrintStartJob requests. -type PrintStartJobCookie struct { +// PrintGetDocumentDataCookie is a cookie used only for PrintGetDocumentData requests. +type PrintGetDocumentDataCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, false) - c.NewRequest(printStartJobRequest(c, OutputMode), cookie) - return PrintStartJobCookie{cookie} + cookie := c.NewCookie(true, true) + c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) + return PrintGetDocumentDataCookie{cookie} } -// PrintStartJobChecked sends a checked request. -// If an error occurs, it can be retrieved using PrintStartJobCookie.Check() -func PrintStartJobChecked(c *xgb.Conn, OutputMode byte) PrintStartJobCookie { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, false) - c.NewRequest(printStartJobRequest(c, OutputMode), cookie) - return PrintStartJobCookie{cookie} + cookie := c.NewCookie(false, true) + c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) + return PrintGetDocumentDataCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintStartJobCookie) Check() error { - return cook.Cookie.Check() +// PrintGetDocumentDataReply represents the data returned from a PrintGetDocumentData request. +type PrintGetDocumentDataReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + StatusCode uint32 + FinishedFlag uint32 + DataLen uint32 + // padding: 12 bytes + Data []byte // size: xgb.Pad((int(DataLen) * 1)) } -// Write request to wire for PrintStartJob -// printStartJobRequest writes a PrintStartJob request to a byte slice. -func printStartJobRequest(c *xgb.Conn, OutputMode byte) []byte { - size := 8 - b := 0 - buf := make([]byte, size) +// Reply blocks and returns the reply data for a PrintGetDocumentData request. +func (cook PrintGetDocumentDataCookie) Reply() (*PrintGetDocumentDataReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetDocumentDataReply(buf), nil +} - buf[b] = c.Extensions["XPEXTENSION"] - b += 1 +// printGetDocumentDataReply reads a byte slice into a PrintGetDocumentDataReply value. +func printGetDocumentDataReply(buf []byte) *PrintGetDocumentDataReply { + v := new(PrintGetDocumentDataReply) + b := 1 // skip reply determinant - buf[b] = 7 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - buf[b] = OutputMode - b += 1 + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 - return buf -} + v.StatusCode = xgb.Get32(buf[b:]) + b += 4 -// PrintEndJobCookie is a cookie used only for PrintEndJob requests. -type PrintEndJobCookie struct { - *xgb.Cookie -} + v.FinishedFlag = xgb.Get32(buf[b:]) + b += 4 -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(printEndJobRequest(c, Cancel), cookie) - return PrintEndJobCookie{cookie} -} + v.DataLen = xgb.Get32(buf[b:]) + b += 4 -// PrintEndJobChecked sends a checked request. -// If an error occurs, it can be retrieved using PrintEndJobCookie.Check() -func PrintEndJobChecked(c *xgb.Conn, Cancel bool) PrintEndJobCookie { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, false) - c.NewRequest(printEndJobRequest(c, Cancel), cookie) - return PrintEndJobCookie{cookie} -} + b += 12 // padding -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintEndJobCookie) Check() error { - return cook.Cookie.Check() + v.Data = make([]byte, v.DataLen) + copy(v.Data[:v.DataLen], buf[b:]) + b += xgb.Pad(int(v.DataLen)) + + return v } -// Write request to wire for PrintEndJob -// printEndJobRequest writes a PrintEndJob request to a byte slice. -func printEndJobRequest(c *xgb.Conn, Cancel bool) []byte { - size := 8 +// Write request to wire for PrintGetDocumentData +// printGetDocumentDataRequest writes a PrintGetDocumentData request to a byte slice. +func printGetDocumentDataRequest(c *xgb.Conn, Context Pcontext, MaxBytes uint32) []byte { + size := 12 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 8 // request opcode + buf[b] = 12 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - if Cancel { - buf[b] = 1 - } else { - buf[b] = 0 - } - b += 1 + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + xgb.Put32(buf[b:], MaxBytes) + b += 4 return buf } -// PrintStartDocCookie is a cookie used only for PrintStartDoc requests. -type PrintStartDocCookie struct { +// PrintGetImageResolutionCookie is a cookie used only for PrintGetImageResolution requests. +type PrintGetImageResolutionCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, false) - c.NewRequest(printStartDocRequest(c, DriverMode), cookie) - return PrintStartDocCookie{cookie} + cookie := c.NewCookie(true, true) + c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) + return PrintGetImageResolutionCookie{cookie} } -// PrintStartDocChecked sends a checked request. -// If an error occurs, it can be retrieved using PrintStartDocCookie.Check() -func PrintStartDocChecked(c *xgb.Conn, DriverMode byte) PrintStartDocCookie { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, true) + c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) + return PrintGetImageResolutionCookie{cookie} +} + +// PrintGetImageResolutionReply represents the data returned from a PrintGetImageResolution request. +type PrintGetImageResolutionReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + ImageResolution uint16 +} + +// Reply blocks and returns the reply data for a PrintGetImageResolution request. +func (cook PrintGetImageResolutionCookie) Reply() (*PrintGetImageResolutionReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil } - cookie := c.NewCookie(true, false) - c.NewRequest(printStartDocRequest(c, DriverMode), cookie) - return PrintStartDocCookie{cookie} + return printGetImageResolutionReply(buf), nil } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintStartDocCookie) Check() error { - return cook.Cookie.Check() +// printGetImageResolutionReply reads a byte slice into a PrintGetImageResolutionReply value. +func printGetImageResolutionReply(buf []byte) *PrintGetImageResolutionReply { + v := new(PrintGetImageResolutionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.ImageResolution = xgb.Get16(buf[b:]) + b += 2 + + return v } -// Write request to wire for PrintStartDoc -// printStartDocRequest writes a PrintStartDoc request to a byte slice. -func printStartDocRequest(c *xgb.Conn, DriverMode byte) []byte { +// Write request to wire for PrintGetImageResolution +// printGetImageResolutionRequest writes a PrintGetImageResolution request to a byte slice. +func printGetImageResolutionRequest(c *xgb.Conn, Context Pcontext) []byte { size := 8 b := 0 buf := make([]byte, size) @@ -1198,149 +1112,124 @@ func printStartDocRequest(c *xgb.Conn, DriverMode byte) []byte { buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 9 // request opcode + buf[b] = 24 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - buf[b] = DriverMode - b += 1 + xgb.Put32(buf[b:], uint32(Context)) + b += 4 return buf } -// PrintEndDocCookie is a cookie used only for PrintEndDoc requests. -type PrintEndDocCookie struct { +// PrintGetOneAttributesCookie is a cookie used only for PrintGetOneAttributes requests. +type PrintGetOneAttributesCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, false) - c.NewRequest(printEndDocRequest(c, Cancel), cookie) - return PrintEndDocCookie{cookie} + cookie := c.NewCookie(true, true) + c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) + return PrintGetOneAttributesCookie{cookie} } -// PrintEndDocChecked sends a checked request. -// If an error occurs, it can be retrieved using PrintEndDocCookie.Check() -func PrintEndDocChecked(c *xgb.Conn, Cancel bool) PrintEndDocCookie { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, false) - c.NewRequest(printEndDocRequest(c, Cancel), cookie) - return PrintEndDocCookie{cookie} + cookie := c.NewCookie(false, true) + c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) + return PrintGetOneAttributesCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintEndDocCookie) Check() error { - return cook.Cookie.Check() +// PrintGetOneAttributesReply represents the data returned from a PrintGetOneAttributes request. +type PrintGetOneAttributesReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + ValueLen uint32 + // padding: 20 bytes + Value []String8 // size: xgb.Pad((int(ValueLen) * 1)) } -// Write request to wire for PrintEndDoc -// printEndDocRequest writes a PrintEndDoc request to a byte slice. -func printEndDocRequest(c *xgb.Conn, Cancel bool) []byte { - size := 8 - b := 0 - buf := make([]byte, size) +// Reply blocks and returns the reply data for a PrintGetOneAttributes request. +func (cook PrintGetOneAttributesCookie) Reply() (*PrintGetOneAttributesReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetOneAttributesReply(buf), nil +} - buf[b] = c.Extensions["XPEXTENSION"] - b += 1 +// printGetOneAttributesReply reads a byte slice into a PrintGetOneAttributesReply value. +func printGetOneAttributesReply(buf []byte) *PrintGetOneAttributesReply { + v := new(PrintGetOneAttributesReply) + b := 1 // skip reply determinant - buf[b] = 10 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - if Cancel { - buf[b] = 1 - } else { - buf[b] = 0 - } - b += 1 - - return buf -} + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 -// PrintPutDocumentDataCookie is a cookie used only for PrintPutDocumentData requests. -type PrintPutDocumentDataCookie struct { - *xgb.Cookie -} + v.ValueLen = xgb.Get32(buf[b:]) + b += 4 -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) - return PrintPutDocumentDataCookie{cookie} -} + b += 20 // padding -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + v.Value = make([]String8, v.ValueLen) + for i := 0; i < int(v.ValueLen); i++ { + v.Value[i] = String8(buf[b]) + b += 1 } - cookie := c.NewCookie(true, false) - c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) - return PrintPutDocumentDataCookie{cookie} -} + b = xgb.Pad(b) -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintPutDocumentDataCookie) Check() error { - return cook.Cookie.Check() + return v } -// Write request to wire for PrintPutDocumentData -// printPutDocumentDataRequest writes a PrintPutDocumentData request to a byte slice. -func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) []byte { - size := xgb.Pad((((16 + xgb.Pad((int(LenData) * 1))) + xgb.Pad((len(DocFormat) * 1))) + xgb.Pad((len(Options) * 1)))) +// Write request to wire for PrintGetOneAttributes +// printGetOneAttributesRequest writes a PrintGetOneAttributes request to a byte slice. +func printGetOneAttributesRequest(c *xgb.Conn, Context Pcontext, NameLen uint32, Pool byte, Name []String8) []byte { + size := xgb.Pad((16 + xgb.Pad((int(NameLen) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 11 // request opcode + buf[b] = 19 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Drawable)) + xgb.Put32(buf[b:], uint32(Context)) b += 4 - xgb.Put32(buf[b:], LenData) + xgb.Put32(buf[b:], NameLen) b += 4 - xgb.Put16(buf[b:], LenFmt) - b += 2 - - xgb.Put16(buf[b:], LenOptions) - b += 2 - - copy(buf[b:], Data[:LenData]) - b += xgb.Pad(int(LenData)) + buf[b] = Pool + b += 1 - for i := 0; i < int(len(DocFormat)); i++ { - buf[b] = byte(DocFormat[i]) - b += 1 - } - b = xgb.Pad(b) + b += 3 // padding - for i := 0; i < int(len(Options)); i++ { - buf[b] = byte(Options[i]) + for i := 0; i < int(NameLen); i++ { + buf[b] = byte(Name[i]) b += 1 } b = xgb.Pad(b) @@ -1348,47 +1237,48 @@ func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData return buf } -// PrintGetDocumentDataCookie is a cookie used only for PrintGetDocumentData requests. -type PrintGetDocumentDataCookie struct { +// PrintGetPageDimensionsCookie is a cookie used only for PrintGetPageDimensions requests. +type PrintGetPageDimensionsCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) - c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) - return PrintGetDocumentDataCookie{cookie} + c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) + return PrintGetPageDimensionsCookie{cookie} } -// PrintGetDocumentDataUnchecked sends an unchecked request. +// PrintGetPageDimensionsUnchecked 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 { +func PrintGetPageDimensionsUnchecked(c *xgb.Conn, Context Pcontext) PrintGetPageDimensionsCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) - c.NewRequest(printGetDocumentDataRequest(c, Context, MaxBytes), cookie) - return PrintGetDocumentDataCookie{cookie} + c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) + return PrintGetPageDimensionsCookie{cookie} } -// PrintGetDocumentDataReply represents the data returned from a PrintGetDocumentData request. -type PrintGetDocumentDataReply struct { +// PrintGetPageDimensionsReply represents the data returned from a PrintGetPageDimensions request. +type PrintGetPageDimensionsReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - StatusCode uint32 - FinishedFlag uint32 - DataLen uint32 - // padding: 12 bytes - Data []byte // size: xgb.Pad((int(DataLen) * 1)) + Width uint16 + Height uint16 + OffsetX uint16 + OffsetY uint16 + ReproducibleWidth uint16 + ReproducibleHeight uint16 } -// Reply blocks and returns the reply data for a PrintGetDocumentData request. -func (cook PrintGetDocumentDataCookie) Reply() (*PrintGetDocumentDataReply, error) { +// Reply blocks and returns the reply data for a PrintGetPageDimensions request. +func (cook PrintGetPageDimensionsCookie) Reply() (*PrintGetPageDimensionsReply, error) { buf, err := cook.Cookie.Reply() if err != nil { return nil, err @@ -1396,12 +1286,12 @@ func (cook PrintGetDocumentDataCookie) Reply() (*PrintGetDocumentDataReply, erro if buf == nil { return nil, nil } - return printGetDocumentDataReply(buf), nil + return printGetPageDimensionsReply(buf), nil } -// printGetDocumentDataReply reads a byte slice into a PrintGetDocumentDataReply value. -func printGetDocumentDataReply(buf []byte) *PrintGetDocumentDataReply { - v := new(PrintGetDocumentDataReply) +// printGetPageDimensionsReply reads a byte slice into a PrintGetPageDimensionsReply value. +func printGetPageDimensionsReply(buf []byte) *PrintGetPageDimensionsReply { + v := new(PrintGetPageDimensionsReply) b := 1 // skip reply determinant b += 1 // padding @@ -1412,35 +1302,38 @@ func printGetDocumentDataReply(buf []byte) *PrintGetDocumentDataReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.StatusCode = xgb.Get32(buf[b:]) - b += 4 + v.Width = xgb.Get16(buf[b:]) + b += 2 - v.FinishedFlag = xgb.Get32(buf[b:]) - b += 4 + v.Height = xgb.Get16(buf[b:]) + b += 2 - v.DataLen = xgb.Get32(buf[b:]) - b += 4 + v.OffsetX = xgb.Get16(buf[b:]) + b += 2 - b += 12 // padding + v.OffsetY = xgb.Get16(buf[b:]) + b += 2 - v.Data = make([]byte, v.DataLen) - copy(v.Data[:v.DataLen], buf[b:]) - b += xgb.Pad(int(v.DataLen)) + v.ReproducibleWidth = xgb.Get16(buf[b:]) + b += 2 + + v.ReproducibleHeight = xgb.Get16(buf[b:]) + b += 2 return v } -// Write request to wire for PrintGetDocumentData -// printGetDocumentDataRequest writes a PrintGetDocumentData request to a byte slice. -func printGetDocumentDataRequest(c *xgb.Conn, Context Pcontext, MaxBytes uint32) []byte { - size := 12 +// Write request to wire for PrintGetPageDimensions +// printGetPageDimensionsRequest writes a PrintGetPageDimensions request to a byte slice. +func printGetPageDimensionsRequest(c *xgb.Conn, Context Pcontext) []byte { + size := 8 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 12 // request opcode + buf[b] = 21 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -1449,187 +1342,200 @@ func printGetDocumentDataRequest(c *xgb.Conn, Context Pcontext, MaxBytes uint32) xgb.Put32(buf[b:], uint32(Context)) b += 4 - xgb.Put32(buf[b:], MaxBytes) - b += 4 - return buf } -// PrintStartPageCookie is a cookie used only for PrintStartPage requests. -type PrintStartPageCookie struct { +// PrintGetPrinterListCookie is a cookie used only for PrintGetPrinterList requests. +type PrintGetPrinterListCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, false) - c.NewRequest(printStartPageRequest(c, Window), cookie) - return PrintStartPageCookie{cookie} + cookie := c.NewCookie(true, true) + c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return PrintGetPrinterListCookie{cookie} } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, false) - c.NewRequest(printStartPageRequest(c, Window), cookie) - return PrintStartPageCookie{cookie} + cookie := c.NewCookie(false, true) + c.NewRequest(printGetPrinterListRequest(c, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return PrintGetPrinterListCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintStartPageCookie) Check() error { - return cook.Cookie.Check() +// PrintGetPrinterListReply represents the data returned from a PrintGetPrinterList request. +type PrintGetPrinterListReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + ListCount uint32 + // padding: 20 bytes + Printers []Printer // size: PrinterListSize(Printers) } -// Write request to wire for PrintStartPage -// printStartPageRequest writes a PrintStartPage request to a byte slice. -func printStartPageRequest(c *xgb.Conn, Window xproto.Window) []byte { - size := 8 - b := 0 - buf := make([]byte, size) +// Reply blocks and returns the reply data for a PrintGetPrinterList request. +func (cook PrintGetPrinterListCookie) Reply() (*PrintGetPrinterListReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetPrinterListReply(buf), nil +} - buf[b] = c.Extensions["XPEXTENSION"] - b += 1 +// printGetPrinterListReply reads a byte slice into a PrintGetPrinterListReply value. +func printGetPrinterListReply(buf []byte) *PrintGetPrinterListReply { + v := new(PrintGetPrinterListReply) + b := 1 // skip reply determinant - buf[b] = 13 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], uint32(Window)) + v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - return buf -} - -// PrintEndPageCookie is a cookie used only for PrintEndPage requests. -type PrintEndPageCookie struct { - *xgb.Cookie -} + v.ListCount = xgb.Get32(buf[b:]) + b += 4 -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(printEndPageRequest(c, Cancel), cookie) - return PrintEndPageCookie{cookie} -} + b += 20 // padding -// PrintEndPageChecked sends a checked request. -// If an error occurs, it can be retrieved using PrintEndPageCookie.Check() -func PrintEndPageChecked(c *xgb.Conn, Cancel bool) PrintEndPageCookie { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, false) - c.NewRequest(printEndPageRequest(c, Cancel), cookie) - return PrintEndPageCookie{cookie} -} + v.Printers = make([]Printer, v.ListCount) + b += PrinterReadList(buf[b:], v.Printers) -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintEndPageCookie) Check() error { - return cook.Cookie.Check() + return v } -// Write request to wire for PrintEndPage -// printEndPageRequest writes a PrintEndPage request to a byte slice. -func printEndPageRequest(c *xgb.Conn, Cancel bool) []byte { - size := 8 +// Write request to wire for PrintGetPrinterList +// printGetPrinterListRequest writes a PrintGetPrinterList request to a byte slice. +func printGetPrinterListRequest(c *xgb.Conn, PrinterNameLen uint32, LocaleLen uint32, PrinterName []String8, Locale []String8) []byte { + size := xgb.Pad(((12 + xgb.Pad((int(PrinterNameLen) * 1))) + xgb.Pad((int(LocaleLen) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 14 // request opcode + buf[b] = 1 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - if Cancel { - buf[b] = 1 - } else { - buf[b] = 0 + xgb.Put32(buf[b:], PrinterNameLen) + b += 4 + + xgb.Put32(buf[b:], LocaleLen) + b += 4 + + for i := 0; i < int(PrinterNameLen); i++ { + buf[b] = byte(PrinterName[i]) + b += 1 } - b += 1 + b = xgb.Pad(b) - b += 3 // padding + for i := 0; i < int(LocaleLen); i++ { + buf[b] = byte(Locale[i]) + b += 1 + } + b = xgb.Pad(b) return buf } -// PrintSelectInputCookie is a cookie used only for PrintSelectInput requests. -type PrintSelectInputCookie struct { +// PrintGetScreenOfContextCookie is a cookie used only for PrintGetScreenOfContext requests. +type PrintGetScreenOfContextCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, false) - c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) - return PrintSelectInputCookie{cookie} + cookie := c.NewCookie(true, true) + c.NewRequest(printGetScreenOfContextRequest(c), cookie) + return PrintGetScreenOfContextCookie{cookie} } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, false) - c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) - return PrintSelectInputCookie{cookie} + cookie := c.NewCookie(false, true) + c.NewRequest(printGetScreenOfContextRequest(c), cookie) + return PrintGetScreenOfContextCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintSelectInputCookie) Check() error { - return cook.Cookie.Check() +// PrintGetScreenOfContextReply represents the data returned from a PrintGetScreenOfContext request. +type PrintGetScreenOfContextReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + Root xproto.Window } -// Write request to wire for PrintSelectInput -// printSelectInputRequest writes a PrintSelectInput request to a byte slice. -func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList []uint32) []byte { - size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(EventMask))))))) - b := 0 - buf := make([]byte, size) +// Reply blocks and returns the reply data for a PrintGetScreenOfContext request. +func (cook PrintGetScreenOfContextCookie) Reply() (*PrintGetScreenOfContextReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return printGetScreenOfContextReply(buf), nil +} - buf[b] = c.Extensions["XPEXTENSION"] - b += 1 +// printGetScreenOfContextReply reads a byte slice into a PrintGetScreenOfContextReply value. +func printGetScreenOfContextReply(buf []byte) *PrintGetScreenOfContextReply { + v := new(PrintGetScreenOfContextReply) + b := 1 // skip reply determinant - buf[b] = 15 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], uint32(Context)) + v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - xgb.Put32(buf[b:], EventMask) + v.Root = xproto.Window(xgb.Get32(buf[b:])) b += 4 - for i := 0; i < xgb.PopCount(int(EventMask)); i++ { - xgb.Put32(buf[b:], EventList[i]) - b += 4 - } - b = xgb.Pad(b) + + return v +} + +// Write request to wire for PrintGetScreenOfContext +// printGetScreenOfContextRequest writes a PrintGetScreenOfContext request to a byte slice. +func printGetScreenOfContextRequest(c *xgb.Conn) []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 return buf } @@ -1742,145 +1648,124 @@ func printInputSelectedRequest(c *xgb.Conn, Context Pcontext) []byte { return buf } -// PrintGetAttributesCookie is a cookie used only for PrintGetAttributes requests. -type PrintGetAttributesCookie struct { +// PrintPutDocumentDataCookie is a cookie used only for PrintPutDocumentData requests. +type PrintPutDocumentDataCookie struct { *xgb.Cookie } -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, true) - c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) - return PrintGetAttributesCookie{cookie} -} - -// PrintGetAttributesUnchecked sends an unchecked request. +// PrintPutDocumentData 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 { +func PrintPutDocumentData(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) PrintPutDocumentDataCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(printGetAttributesRequest(c, Context, Pool), cookie) - return PrintGetAttributesCookie{cookie} -} - -// PrintGetAttributesReply represents the data returned from a PrintGetAttributes request. -type PrintGetAttributesReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - StringLen uint32 - // padding: 20 bytes - Attributes String8 + cookie := c.NewCookie(false, false) + c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) + return PrintPutDocumentDataCookie{cookie} } -// Reply blocks and returns the reply data for a PrintGetAttributes request. -func (cook PrintGetAttributesCookie) Reply() (*PrintGetAttributesReply, error) { - buf, err := cook.Cookie.Reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - return printGetAttributesReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(printPutDocumentDataRequest(c, Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) + return PrintPutDocumentDataCookie{cookie} } -// printGetAttributesReply reads a byte slice into a PrintGetAttributesReply value. -func printGetAttributesReply(buf []byte) *PrintGetAttributesReply { - v := new(PrintGetAttributesReply) - b := 1 // skip reply determinant - - b += 1 // padding - - v.Sequence = xgb.Get16(buf[b:]) - b += 2 - - v.Length = xgb.Get32(buf[b:]) // 4-byte units - b += 4 - - v.StringLen = xgb.Get32(buf[b:]) - b += 4 - - b += 20 // padding - - v.Attributes = String8(buf[b]) - b += 1 - - return v +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook PrintPutDocumentDataCookie) Check() error { + return cook.Cookie.Check() } -// Write request to wire for PrintGetAttributes -// printGetAttributesRequest writes a PrintGetAttributes request to a byte slice. -func printGetAttributesRequest(c *xgb.Conn, Context Pcontext, Pool byte) []byte { - size := 12 +// Write request to wire for PrintPutDocumentData +// printPutDocumentDataRequest writes a PrintPutDocumentData request to a byte slice. +func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) []byte { + size := xgb.Pad((((16 + xgb.Pad((int(LenData) * 1))) + xgb.Pad((len(DocFormat) * 1))) + xgb.Pad((len(Options) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 17 // request opcode + buf[b] = 11 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Context)) + xgb.Put32(buf[b:], uint32(Drawable)) b += 4 - buf[b] = Pool - b += 1 + xgb.Put32(buf[b:], LenData) + b += 4 - b += 3 // padding + xgb.Put16(buf[b:], LenFmt) + b += 2 + + xgb.Put16(buf[b:], LenOptions) + b += 2 + + copy(buf[b:], Data[:LenData]) + b += xgb.Pad(int(LenData)) + + for i := 0; i < int(len(DocFormat)); i++ { + buf[b] = byte(DocFormat[i]) + b += 1 + } + b = xgb.Pad(b) + + for i := 0; i < int(len(Options)); i++ { + buf[b] = byte(Options[i]) + b += 1 + } + b = xgb.Pad(b) return buf } -// PrintGetOneAttributesCookie is a cookie used only for PrintGetOneAttributes requests. -type PrintGetOneAttributesCookie struct { +// PrintQueryScreensCookie is a cookie used only for PrintQueryScreens requests. +type PrintQueryScreensCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) - c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) - return PrintGetOneAttributesCookie{cookie} + c.NewRequest(printQueryScreensRequest(c), cookie) + return PrintQueryScreensCookie{cookie} } -// PrintGetOneAttributesUnchecked sends an unchecked request. +// PrintQueryScreensUnchecked 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 { +func PrintQueryScreensUnchecked(c *xgb.Conn) PrintQueryScreensCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) - c.NewRequest(printGetOneAttributesRequest(c, Context, NameLen, Pool, Name), cookie) - return PrintGetOneAttributesCookie{cookie} + c.NewRequest(printQueryScreensRequest(c), cookie) + return PrintQueryScreensCookie{cookie} } -// PrintGetOneAttributesReply represents the data returned from a PrintGetOneAttributes request. -type PrintGetOneAttributesReply struct { +// PrintQueryScreensReply represents the data returned from a PrintQueryScreens request. +type PrintQueryScreensReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - ValueLen uint32 + ListCount uint32 // padding: 20 bytes - Value []String8 // size: xgb.Pad((int(ValueLen) * 1)) + Roots []xproto.Window // size: xgb.Pad((int(ListCount) * 4)) } -// Reply blocks and returns the reply data for a PrintGetOneAttributes request. -func (cook PrintGetOneAttributesCookie) Reply() (*PrintGetOneAttributesReply, error) { +// Reply blocks and returns the reply data for a PrintQueryScreens request. +func (cook PrintQueryScreensCookie) Reply() (*PrintQueryScreensReply, error) { buf, err := cook.Cookie.Reply() if err != nil { return nil, err @@ -1888,12 +1773,12 @@ func (cook PrintGetOneAttributesCookie) Reply() (*PrintGetOneAttributesReply, er if buf == nil { return nil, nil } - return printGetOneAttributesReply(buf), nil + return printQueryScreensReply(buf), nil } -// printGetOneAttributesReply reads a byte slice into a PrintGetOneAttributesReply value. -func printGetOneAttributesReply(buf []byte) *PrintGetOneAttributesReply { - v := new(PrintGetOneAttributesReply) +// printQueryScreensReply reads a byte slice into a PrintQueryScreensReply value. +func printQueryScreensReply(buf []byte) *PrintQueryScreensReply { + v := new(PrintQueryScreensReply) b := 1 // skip reply determinant b += 1 // padding @@ -1904,171 +1789,78 @@ func printGetOneAttributesReply(buf []byte) *PrintGetOneAttributesReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.ValueLen = xgb.Get32(buf[b:]) + v.ListCount = xgb.Get32(buf[b:]) b += 4 b += 20 // padding - v.Value = make([]String8, v.ValueLen) - for i := 0; i < int(v.ValueLen); i++ { - v.Value[i] = String8(buf[b]) - b += 1 + v.Roots = make([]xproto.Window, v.ListCount) + for i := 0; i < int(v.ListCount); i++ { + v.Roots[i] = xproto.Window(xgb.Get32(buf[b:])) + b += 4 } b = xgb.Pad(b) return v } -// Write request to wire for PrintGetOneAttributes -// printGetOneAttributesRequest writes a PrintGetOneAttributes request to a byte slice. -func printGetOneAttributesRequest(c *xgb.Conn, Context Pcontext, NameLen uint32, Pool byte, Name []String8) []byte { - size := xgb.Pad((16 + xgb.Pad((int(NameLen) * 1)))) - b := 0 - buf := make([]byte, size) - - buf[b] = c.Extensions["XPEXTENSION"] - b += 1 - - buf[b] = 19 // request opcode - b += 1 - - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - xgb.Put32(buf[b:], uint32(Context)) - b += 4 - - xgb.Put32(buf[b:], NameLen) - b += 4 - - buf[b] = Pool - b += 1 - - b += 3 // padding - - for i := 0; i < int(NameLen); i++ { - buf[b] = byte(Name[i]) - b += 1 - } - b = xgb.Pad(b) - - return buf -} - -// PrintSetAttributesCookie is a cookie used only for PrintSetAttributes requests. -type PrintSetAttributesCookie struct { - *xgb.Cookie -} - -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) - return PrintSetAttributesCookie{cookie} -} - -// 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, false) - c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) - return PrintSetAttributesCookie{cookie} -} - -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PrintSetAttributesCookie) Check() error { - return cook.Cookie.Check() -} - -// Write request to wire for PrintSetAttributes -// printSetAttributesRequest writes a PrintSetAttributes request to a byte slice. -func printSetAttributesRequest(c *xgb.Conn, Context Pcontext, StringLen uint32, Pool byte, Rule byte, Attributes []String8) []byte { - size := xgb.Pad((16 + xgb.Pad((len(Attributes) * 1)))) +// Write request to wire for PrintQueryScreens +// printQueryScreensRequest writes a PrintQueryScreens request to a byte slice. +func printQueryScreensRequest(c *xgb.Conn) []byte { + size := 4 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 18 // request opcode + buf[b] = 22 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Context)) - b += 4 - - xgb.Put32(buf[b:], StringLen) - b += 4 - - buf[b] = Pool - b += 1 - - buf[b] = Rule - b += 1 - - b += 2 // padding - - for i := 0; i < int(len(Attributes)); i++ { - buf[b] = byte(Attributes[i]) - b += 1 - } - b = xgb.Pad(b) - return buf } -// PrintGetPageDimensionsCookie is a cookie used only for PrintGetPageDimensions requests. -type PrintGetPageDimensionsCookie struct { +// PrintQueryVersionCookie is a cookie used only for PrintQueryVersion requests. +type PrintQueryVersionCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) - c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) - return PrintGetPageDimensionsCookie{cookie} + c.NewRequest(printQueryVersionRequest(c), cookie) + return PrintQueryVersionCookie{cookie} } -// PrintGetPageDimensionsUnchecked sends an unchecked request. +// PrintQueryVersionUnchecked 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 { +func PrintQueryVersionUnchecked(c *xgb.Conn) PrintQueryVersionCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) - c.NewRequest(printGetPageDimensionsRequest(c, Context), cookie) - return PrintGetPageDimensionsCookie{cookie} + c.NewRequest(printQueryVersionRequest(c), cookie) + return PrintQueryVersionCookie{cookie} } -// PrintGetPageDimensionsReply represents the data returned from a PrintGetPageDimensions request. -type PrintGetPageDimensionsReply struct { +// PrintQueryVersionReply represents the data returned from a PrintQueryVersion request. +type PrintQueryVersionReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - Width uint16 - Height uint16 - OffsetX uint16 - OffsetY uint16 - ReproducibleWidth uint16 - ReproducibleHeight uint16 + MajorVersion uint16 + MinorVersion uint16 } -// Reply blocks and returns the reply data for a PrintGetPageDimensions request. -func (cook PrintGetPageDimensionsCookie) Reply() (*PrintGetPageDimensionsReply, error) { +// Reply blocks and returns the reply data for a PrintQueryVersion request. +func (cook PrintQueryVersionCookie) Reply() (*PrintQueryVersionReply, error) { buf, err := cook.Cookie.Reply() if err != nil { return nil, err @@ -2076,12 +1868,12 @@ func (cook PrintGetPageDimensionsCookie) Reply() (*PrintGetPageDimensionsReply, if buf == nil { return nil, nil } - return printGetPageDimensionsReply(buf), nil + return printQueryVersionReply(buf), nil } -// printGetPageDimensionsReply reads a byte slice into a PrintGetPageDimensionsReply value. -func printGetPageDimensionsReply(buf []byte) *PrintGetPageDimensionsReply { - v := new(PrintGetPageDimensionsReply) +// printQueryVersionReply reads a byte slice into a PrintQueryVersionReply value. +func printQueryVersionReply(buf []byte) *PrintQueryVersionReply { + v := new(PrintQueryVersionReply) b := 1 // skip reply determinant b += 1 // padding @@ -2092,142 +1884,273 @@ func printGetPageDimensionsReply(buf []byte) *PrintGetPageDimensionsReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.Width = xgb.Get16(buf[b:]) + v.MajorVersion = xgb.Get16(buf[b:]) b += 2 - v.Height = xgb.Get16(buf[b:]) + v.MinorVersion = xgb.Get16(buf[b:]) b += 2 - v.OffsetX = xgb.Get16(buf[b:]) - b += 2 + return v +} - v.OffsetY = xgb.Get16(buf[b:]) - b += 2 +// Write request to wire for PrintQueryVersion +// printQueryVersionRequest writes a PrintQueryVersion request to a byte slice. +func printQueryVersionRequest(c *xgb.Conn) []byte { + size := 4 + b := 0 + buf := make([]byte, size) - v.ReproducibleWidth = xgb.Get16(buf[b:]) - b += 2 + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 - v.ReproducibleHeight = xgb.Get16(buf[b:]) + buf[b] = 0 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - return v + return buf } -// Write request to wire for PrintGetPageDimensions -// printGetPageDimensionsRequest writes a PrintGetPageDimensions request to a byte slice. -func printGetPageDimensionsRequest(c *xgb.Conn, Context Pcontext) []byte { - size := 8 +// PrintRehashPrinterListCookie is a cookie used only for PrintRehashPrinterList requests. +type PrintRehashPrinterListCookie struct { + *xgb.Cookie +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, false) + c.NewRequest(printRehashPrinterListRequest(c), cookie) + return PrintRehashPrinterListCookie{cookie} +} + +// PrintRehashPrinterListChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintRehashPrinterListCookie.Check() +func PrintRehashPrinterListChecked(c *xgb.Conn) PrintRehashPrinterListCookie { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, false) + c.NewRequest(printRehashPrinterListRequest(c), cookie) + return PrintRehashPrinterListCookie{cookie} +} + +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook PrintRehashPrinterListCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintRehashPrinterList +// printRehashPrinterListRequest writes a PrintRehashPrinterList request to a byte slice. +func printRehashPrinterListRequest(c *xgb.Conn) []byte { + size := 4 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 21 // request opcode + buf[b] = 20 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Context)) - b += 4 - return buf } -// PrintQueryScreensCookie is a cookie used only for PrintQueryScreens requests. -type PrintQueryScreensCookie struct { +// PrintSelectInputCookie is a cookie used only for PrintSelectInput requests. +type PrintSelectInputCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, true) - c.NewRequest(printQueryScreensRequest(c), cookie) - return PrintQueryScreensCookie{cookie} + cookie := c.NewCookie(false, false) + c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) + return PrintSelectInputCookie{cookie} } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(printQueryScreensRequest(c), cookie) - return PrintQueryScreensCookie{cookie} + cookie := c.NewCookie(true, false) + c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) + return PrintSelectInputCookie{cookie} } -// PrintQueryScreensReply represents the data returned from a PrintQueryScreens request. -type PrintQueryScreensReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - ListCount uint32 - // padding: 20 bytes - Roots []xproto.Window // size: xgb.Pad((int(ListCount) * 4)) +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook PrintSelectInputCookie) Check() error { + return cook.Cookie.Check() } -// Reply blocks and returns the reply data for a PrintQueryScreens request. -func (cook PrintQueryScreensCookie) Reply() (*PrintQueryScreensReply, error) { - buf, err := cook.Cookie.Reply() - if err != nil { - return nil, err +// Write request to wire for PrintSelectInput +// printSelectInputRequest writes a PrintSelectInput request to a byte slice. +func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList []uint32) []byte { + size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(EventMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + xgb.Put32(buf[b:], EventMask) + b += 4 + for i := 0; i < xgb.PopCount(int(EventMask)); i++ { + xgb.Put32(buf[b:], EventList[i]) + b += 4 } - if buf == nil { - return nil, nil + b = xgb.Pad(b) + + return buf +} + +// PrintSetAttributesCookie is a cookie used only for PrintSetAttributes requests. +type PrintSetAttributesCookie struct { + *xgb.Cookie +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - return printQueryScreensReply(buf), nil + cookie := c.NewCookie(false, false) + c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) + return PrintSetAttributesCookie{cookie} +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, false) + c.NewRequest(printSetAttributesRequest(c, Context, StringLen, Pool, Rule, Attributes), cookie) + return PrintSetAttributesCookie{cookie} +} + +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook PrintSetAttributesCookie) Check() error { + return cook.Cookie.Check() } -// printQueryScreensReply reads a byte slice into a PrintQueryScreensReply value. -func printQueryScreensReply(buf []byte) *PrintQueryScreensReply { - v := new(PrintQueryScreensReply) - b := 1 // skip reply determinant +// Write request to wire for PrintSetAttributes +// printSetAttributesRequest writes a PrintSetAttributes request to a byte slice. +func printSetAttributesRequest(c *xgb.Conn, Context Pcontext, StringLen uint32, Pool byte, Rule byte, Attributes []String8) []byte { + size := xgb.Pad((16 + xgb.Pad((len(Attributes) * 1)))) + b := 0 + buf := make([]byte, size) - b += 1 // padding + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 - v.Sequence = xgb.Get16(buf[b:]) + buf[b] = 18 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - v.Length = xgb.Get32(buf[b:]) // 4-byte units + xgb.Put32(buf[b:], uint32(Context)) b += 4 - v.ListCount = xgb.Get32(buf[b:]) + xgb.Put32(buf[b:], StringLen) b += 4 - b += 20 // padding + buf[b] = Pool + b += 1 - v.Roots = make([]xproto.Window, v.ListCount) - for i := 0; i < int(v.ListCount); i++ { - v.Roots[i] = xproto.Window(xgb.Get32(buf[b:])) - b += 4 + buf[b] = Rule + b += 1 + + b += 2 // padding + + for i := 0; i < int(len(Attributes)); i++ { + buf[b] = byte(Attributes[i]) + b += 1 } b = xgb.Pad(b) - return v + return buf } -// Write request to wire for PrintQueryScreens -// printQueryScreensRequest writes a PrintQueryScreens request to a byte slice. -func printQueryScreensRequest(c *xgb.Conn) []byte { - size := 4 +// PrintSetContextCookie is a cookie used only for PrintSetContext requests. +type PrintSetContextCookie struct { + *xgb.Cookie +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, false) + c.NewRequest(printSetContextRequest(c, Context), cookie) + return PrintSetContextCookie{cookie} +} + +// PrintSetContextChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintSetContextCookie.Check() +func PrintSetContextChecked(c *xgb.Conn, Context uint32) PrintSetContextCookie { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, false) + c.NewRequest(printSetContextRequest(c, Context), cookie) + return PrintSetContextCookie{cookie} +} + +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook PrintSetContextCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintSetContext +// printSetContextRequest writes a PrintSetContext request to a byte slice. +func printSetContextRequest(c *xgb.Conn, Context uint32) []byte { + size := 8 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 22 // request opcode + buf[b] = 3 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 + xgb.Put32(buf[b:], Context) + b += 4 + return buf } @@ -2327,75 +2250,152 @@ func printSetImageResolutionRequest(c *xgb.Conn, Context Pcontext, ImageResoluti return buf } -// PrintGetImageResolutionCookie is a cookie used only for PrintGetImageResolution requests. -type PrintGetImageResolutionCookie struct { +// PrintStartDocCookie is a cookie used only for PrintStartDoc requests. +type PrintStartDocCookie struct { *xgb.Cookie } -// 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 { +// 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 { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, true) - c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) - return PrintGetImageResolutionCookie{cookie} + cookie := c.NewCookie(false, false) + c.NewRequest(printStartDocRequest(c, DriverMode), cookie) + return PrintStartDocCookie{cookie} } -// 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 { +// PrintStartDocChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintStartDocCookie.Check() +func PrintStartDocChecked(c *xgb.Conn, DriverMode byte) PrintStartDocCookie { if _, ok := c.Extensions["XPEXTENSION"]; !ok { - panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(printGetImageResolutionRequest(c, Context), cookie) - return PrintGetImageResolutionCookie{cookie} + cookie := c.NewCookie(true, false) + c.NewRequest(printStartDocRequest(c, DriverMode), cookie) + return PrintStartDocCookie{cookie} } -// PrintGetImageResolutionReply represents the data returned from a PrintGetImageResolution request. -type PrintGetImageResolutionReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - ImageResolution uint16 +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook PrintStartDocCookie) Check() error { + return cook.Cookie.Check() } -// Reply blocks and returns the reply data for a PrintGetImageResolution request. -func (cook PrintGetImageResolutionCookie) Reply() (*PrintGetImageResolutionReply, error) { - buf, err := cook.Cookie.Reply() - if err != nil { - return nil, err +// Write request to wire for PrintStartDoc +// printStartDocRequest writes a PrintStartDoc request to a byte slice. +func printStartDocRequest(c *xgb.Conn, DriverMode byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DriverMode + b += 1 + + return buf +} + +// PrintStartJobCookie is a cookie used only for PrintStartJob requests. +type PrintStartJobCookie struct { + *xgb.Cookie +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - if buf == nil { - return nil, nil + cookie := c.NewCookie(false, false) + c.NewRequest(printStartJobRequest(c, OutputMode), cookie) + return PrintStartJobCookie{cookie} +} + +// PrintStartJobChecked sends a checked request. +// If an error occurs, it can be retrieved using PrintStartJobCookie.Check() +func PrintStartJobChecked(c *xgb.Conn, OutputMode byte) PrintStartJobCookie { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } - return printGetImageResolutionReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(printStartJobRequest(c, OutputMode), cookie) + return PrintStartJobCookie{cookie} } -// printGetImageResolutionReply reads a byte slice into a PrintGetImageResolutionReply value. -func printGetImageResolutionReply(buf []byte) *PrintGetImageResolutionReply { - v := new(PrintGetImageResolutionReply) - b := 1 // skip reply determinant +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook PrintStartJobCookie) Check() error { + return cook.Cookie.Check() +} - b += 1 // padding +// Write request to wire for PrintStartJob +// printStartJobRequest writes a PrintStartJob request to a byte slice. +func printStartJobRequest(c *xgb.Conn, OutputMode byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) - v.Sequence = xgb.Get16(buf[b:]) - b += 2 + buf[b] = c.Extensions["XPEXTENSION"] + b += 1 - v.Length = xgb.Get32(buf[b:]) // 4-byte units - b += 4 + buf[b] = 7 // request opcode + b += 1 - v.ImageResolution = xgb.Get16(buf[b:]) + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - return v + buf[b] = OutputMode + b += 1 + + return buf } -// Write request to wire for PrintGetImageResolution -// printGetImageResolutionRequest writes a PrintGetImageResolution request to a byte slice. -func printGetImageResolutionRequest(c *xgb.Conn, Context Pcontext) []byte { +// PrintStartPageCookie is a cookie used only for PrintStartPage requests. +type PrintStartPageCookie struct { + *xgb.Cookie +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, false) + c.NewRequest(printStartPageRequest(c, Window), cookie) + return PrintStartPageCookie{cookie} +} + +// 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 { + if _, ok := c.Extensions["XPEXTENSION"]; !ok { + panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, false) + c.NewRequest(printStartPageRequest(c, Window), cookie) + return PrintStartPageCookie{cookie} +} + +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. +func (cook PrintStartPageCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for PrintStartPage +// printStartPageRequest writes a PrintStartPage request to a byte slice. +func printStartPageRequest(c *xgb.Conn, Window xproto.Window) []byte { size := 8 b := 0 buf := make([]byte, size) @@ -2403,13 +2403,13 @@ func printGetImageResolutionRequest(c *xgb.Conn, Context Pcontext) []byte { buf[b] = c.Extensions["XPEXTENSION"] b += 1 - buf[b] = 24 // request opcode + buf[b] = 13 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Context)) + xgb.Put32(buf[b:], uint32(Window)) b += 4 return buf -- cgit v1.2.3 From b06a8ca97625c1134449c3af65d9ac3fb251a613 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:45:36 -0400 Subject: Don't needlessly change source files every time. --- nexgb/xprint/xprint.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 8dfc660..48557fe 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -1,10 +1,7 @@ // Package xprint is the X client API for the XpExtension extension. package xprint -/* - This file was generated by xprint.xml on Aug 11 2013 8:39:44pm EDT. - This file is automatically generated. Edit at your peril! -*/ +// This file is automatically generated from xprint.xml. Edit at your peril! import ( "github.com/BurntSushi/xgb" -- cgit v1.2.3 From 38b293e74db6631873d5dfd74cf731eb7b76737d Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:54:15 -0400 Subject: Padding on a list is on the length of the list. There was a bug where padding was being computed on each element of the list. Close #5. --- nexgb/xprint/xprint.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 48557fe..be9f2e8 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -394,9 +394,9 @@ func PrinterListBytes(buf []byte, list []Printer) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } // PrinterListSize computes the size (bytes) of a list of Printer values. -- cgit v1.2.3 From 76f9adb5991081e27ebc6eec82db6bdba36c910f Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sat, 28 Dec 2013 10:13:20 -0500 Subject: Use consistent extension names. Close #6. --- nexgb/xprint/xprint.go | 150 ++++++++++++++++++++++++------------------------- 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index be9f2e8..7a7279f 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -442,7 +442,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -453,7 +453,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -474,7 +474,7 @@ func createContextRequest(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 2 // request opcode @@ -515,7 +515,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -526,7 +526,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintDestroyContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -547,7 +547,7 @@ func printDestroyContextRequest(c *xgb.Conn, Context uint32) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 5 // request opcode @@ -570,7 +570,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -581,7 +581,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -602,7 +602,7 @@ func printEndDocRequest(c *xgb.Conn, Cancel bool) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 10 // request opcode @@ -629,7 +629,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -640,7 +640,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -661,7 +661,7 @@ func printEndJobRequest(c *xgb.Conn, Cancel bool) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 8 // request opcode @@ -688,7 +688,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -699,7 +699,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintEndPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -720,7 +720,7 @@ func printEndPageRequest(c *xgb.Conn, Cancel bool) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 14 // request opcode @@ -749,7 +749,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -760,7 +760,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -821,7 +821,7 @@ func printGetAttributesRequest(c *xgb.Conn, Context Pcontext, Pool byte) []byte b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 17 // request opcode @@ -849,7 +849,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -860,7 +860,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -914,7 +914,7 @@ func printGetContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 4 // request opcode @@ -934,7 +934,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -945,7 +945,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -1015,7 +1015,7 @@ func printGetDocumentDataRequest(c *xgb.Conn, Context Pcontext, MaxBytes uint32) b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 12 // request opcode @@ -1041,7 +1041,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -1052,7 +1052,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -1106,7 +1106,7 @@ func printGetImageResolutionRequest(c *xgb.Conn, Context Pcontext) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 24 // request opcode @@ -1129,7 +1129,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -1140,7 +1140,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetOneAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -1205,7 +1205,7 @@ func printGetOneAttributesRequest(c *xgb.Conn, Context Pcontext, NameLen uint32, b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 19 // request opcode @@ -1242,7 +1242,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -1253,7 +1253,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetPageDimensions' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -1327,7 +1327,7 @@ func printGetPageDimensionsRequest(c *xgb.Conn, Context Pcontext) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 21 // request opcode @@ -1350,7 +1350,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -1361,7 +1361,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -1422,7 +1422,7 @@ func printGetPrinterListRequest(c *xgb.Conn, PrinterNameLen uint32, LocaleLen ui b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 1 // request opcode @@ -1460,7 +1460,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -1471,7 +1471,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintGetScreenOfContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -1525,7 +1525,7 @@ func printGetScreenOfContextRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 6 // request opcode @@ -1545,7 +1545,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintInputSelected' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -1556,7 +1556,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintInputSelected' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -1630,7 +1630,7 @@ func printInputSelectedRequest(c *xgb.Conn, Context Pcontext) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 16 // request opcode @@ -1653,7 +1653,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -1664,7 +1664,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintPutDocumentData' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -1685,7 +1685,7 @@ func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 11 // request opcode @@ -1732,7 +1732,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -1743,7 +1743,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintQueryScreens' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -1808,7 +1808,7 @@ func printQueryScreensRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 22 // request opcode @@ -1828,7 +1828,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -1839,7 +1839,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintQueryVersion' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -1897,7 +1897,7 @@ func printQueryVersionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 0 // request opcode @@ -1917,7 +1917,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -1928,7 +1928,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintRehashPrinterList' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -1949,7 +1949,7 @@ func printRehashPrinterListRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 20 // request opcode @@ -1969,7 +1969,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -1980,7 +1980,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSelectInput' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -2001,7 +2001,7 @@ func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32, Ev b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 15 // request opcode @@ -2032,7 +2032,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -2043,7 +2043,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetAttributes' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -2064,7 +2064,7 @@ func printSetAttributesRequest(c *xgb.Conn, Context Pcontext, StringLen uint32, b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 18 // request opcode @@ -2104,7 +2104,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -2115,7 +2115,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetContext' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -2136,7 +2136,7 @@ func printSetContextRequest(c *xgb.Conn, Context uint32) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 3 // request opcode @@ -2159,7 +2159,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -2170,7 +2170,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintSetImageResolution' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -2229,7 +2229,7 @@ func printSetImageResolutionRequest(c *xgb.Conn, Context Pcontext, ImageResoluti b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 23 // request opcode @@ -2255,7 +2255,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -2266,7 +2266,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartDoc' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -2287,7 +2287,7 @@ func printStartDocRequest(c *xgb.Conn, DriverMode byte) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 9 // request opcode @@ -2310,7 +2310,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -2321,7 +2321,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartJob' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -2342,7 +2342,7 @@ func printStartJobRequest(c *xgb.Conn, OutputMode byte) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 7 // request opcode @@ -2365,7 +2365,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -2376,7 +2376,7 @@ 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 { - if _, ok := c.Extensions["XPEXTENSION"]; !ok { + if _, ok := c.Extensions["XpExtension"]; !ok { panic("Cannot issue request 'PrintStartPage' using the uninitialized extension 'XpExtension'. xprint.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -2397,7 +2397,7 @@ func printStartPageRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XPEXTENSION"] + buf[b] = c.Extensions["XpExtension"] b += 1 buf[b] = 13 // request opcode -- cgit v1.2.3 From a548d9d0f7b889627c43b18811357fad88760b2d Mon Sep 17 00:00:00 2001 From: aarzilli Date: Fri, 2 May 2014 15:09:23 +0200 Subject: Fix Issue #21: automatic calculation of alignment padding after lists --- nexgb/xprint/xprint.go | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index 7a7279f..5ed49a0 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -336,7 +336,6 @@ func PrinterRead(buf []byte, v *Printer) int { v.Name[i] = String8(buf[b]) b += 1 } - b = xgb.Pad(b) v.DescLen = xgb.Get32(buf[b:]) b += 4 @@ -346,7 +345,6 @@ func PrinterRead(buf []byte, v *Printer) int { v.Description[i] = String8(buf[b]) b += 1 } - b = xgb.Pad(b) return b } @@ -373,7 +371,6 @@ func (v Printer) Bytes() []byte { buf[b] = byte(v.Name[i]) b += 1 } - b = xgb.Pad(b) xgb.Put32(buf[b:], v.DescLen) b += 4 @@ -382,9 +379,8 @@ func (v Printer) Bytes() []byte { buf[b] = byte(v.Description[i]) b += 1 } - b = xgb.Pad(b) - return buf + return buf[:b] } // PrinterListBytes writes a list of Printer values to a byte slice. @@ -496,13 +492,11 @@ func createContextRequest(c *xgb.Conn, ContextId uint32, PrinterNameLen uint32, buf[b] = byte(PrinterName[i]) b += 1 } - b = xgb.Pad(b) for i := 0; i < int(LocaleLen); i++ { buf[b] = byte(Locale[i]) b += 1 } - b = xgb.Pad(b) return buf } @@ -1003,7 +997,7 @@ func printGetDocumentDataReply(buf []byte) *PrintGetDocumentDataReply { v.Data = make([]byte, v.DataLen) copy(v.Data[:v.DataLen], buf[b:]) - b += xgb.Pad(int(v.DataLen)) + b += int(v.DataLen) return v } @@ -1193,7 +1187,6 @@ func printGetOneAttributesReply(buf []byte) *PrintGetOneAttributesReply { v.Value[i] = String8(buf[b]) b += 1 } - b = xgb.Pad(b) return v } @@ -1229,7 +1222,6 @@ func printGetOneAttributesRequest(c *xgb.Conn, Context Pcontext, NameLen uint32, buf[b] = byte(Name[i]) b += 1 } - b = xgb.Pad(b) return buf } @@ -1441,13 +1433,11 @@ func printGetPrinterListRequest(c *xgb.Conn, PrinterNameLen uint32, LocaleLen ui buf[b] = byte(PrinterName[i]) b += 1 } - b = xgb.Pad(b) for i := 0; i < int(LocaleLen); i++ { buf[b] = byte(Locale[i]) b += 1 } - b = xgb.Pad(b) return buf } @@ -1707,19 +1697,17 @@ func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData b += 2 copy(buf[b:], Data[:LenData]) - b += xgb.Pad(int(LenData)) + b += int(LenData) for i := 0; i < int(len(DocFormat)); i++ { buf[b] = byte(DocFormat[i]) b += 1 } - b = xgb.Pad(b) for i := 0; i < int(len(Options)); i++ { buf[b] = byte(Options[i]) b += 1 } - b = xgb.Pad(b) return buf } @@ -1796,7 +1784,6 @@ func printQueryScreensReply(buf []byte) *PrintQueryScreensReply { v.Roots[i] = xproto.Window(xgb.Get32(buf[b:])) b += 4 } - b = xgb.Pad(b) return v } @@ -2091,7 +2078,6 @@ func printSetAttributesRequest(c *xgb.Conn, Context Pcontext, StringLen uint32, buf[b] = byte(Attributes[i]) b += 1 } - b = xgb.Pad(b) return buf } -- cgit v1.2.3 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/xprint/xprint.go | 164 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 158 insertions(+), 6 deletions(-) (limited to 'nexgb/xprint') 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 -- cgit v1.2.3 From 3906399e7c2a40fbaf355de572cf50a314083f64 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Wed, 18 Jan 2017 10:52:16 +0100 Subject: Regenerated from xcb-proto 1.12 --- nexgb/xprint/xprint.go | 57 ++++++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 34 deletions(-) (limited to 'nexgb/xprint') diff --git a/nexgb/xprint/xprint.go b/nexgb/xprint/xprint.go index d692aed..330003d 100644 --- a/nexgb/xprint/xprint.go +++ b/nexgb/xprint/xprint.go @@ -317,10 +317,12 @@ func NewPcontextId(c *xgb.Conn) (Pcontext, error) { } type Printer struct { - NameLen uint32 - Name []String8 // size: xgb.Pad((int(NameLen) * 1)) + NameLen uint32 + Name []String8 // size: xgb.Pad((int(NameLen) * 1)) + // alignment gap to multiple of 4 DescLen uint32 Description []String8 // size: xgb.Pad((int(DescLen) * 1)) + // alignment gap to multiple of 4 } // PrinterRead reads a byte slice into a Printer value. @@ -336,6 +338,8 @@ func PrinterRead(buf []byte, v *Printer) int { b += 1 } + b = (b + 3) & ^3 // alignment gap + v.DescLen = xgb.Get32(buf[b:]) b += 4 @@ -345,6 +349,8 @@ func PrinterRead(buf []byte, v *Printer) int { b += 1 } + b = (b + 3) & ^3 // alignment gap + return b } @@ -360,7 +366,7 @@ func PrinterReadList(buf []byte, dest []Printer) int { // Bytes writes a Printer value to a byte slice. func (v Printer) Bytes() []byte { - buf := make([]byte, (((4 + xgb.Pad((int(v.NameLen) * 1))) + 4) + xgb.Pad((int(v.DescLen) * 1)))) + buf := make([]byte, (((((4 + xgb.Pad((int(v.NameLen) * 1))) + 4) + 4) + xgb.Pad((int(v.DescLen) * 1))) + 4)) b := 0 xgb.Put32(buf[b:], v.NameLen) @@ -371,6 +377,8 @@ func (v Printer) Bytes() []byte { b += 1 } + b = (b + 3) & ^3 // alignment gap + xgb.Put32(buf[b:], v.DescLen) b += 4 @@ -379,6 +387,8 @@ func (v Printer) Bytes() []byte { b += 1 } + b = (b + 3) & ^3 // alignment gap + return buf[:b] } @@ -398,7 +408,7 @@ func PrinterListBytes(buf []byte, list []Printer) int { func PrinterListSize(list []Printer) int { size := 0 for _, item := range list { - size += (((4 + xgb.Pad((int(item.NameLen) * 1))) + 4) + xgb.Pad((int(item.DescLen) * 1))) + size += (((((4 + xgb.Pad((int(item.NameLen) * 1))) + 4) + 4) + xgb.Pad((int(item.DescLen) * 1))) + 4) } return size } @@ -1644,9 +1654,7 @@ type PrintInputSelectedReply struct { Length uint32 // number of bytes in this reply // padding: 1 bytes EventMask uint32 - EventList []uint32 AllEventsMask uint32 - AllEventsList []uint32 } // Reply blocks and returns the reply data for a PrintInputSelected request. @@ -1677,23 +1685,9 @@ func printInputSelectedReply(buf []byte) *PrintInputSelectedReply { v.EventMask = xgb.Get32(buf[b:]) b += 4 - v.EventList = make([]uint32, xgb.PopCount(int(v.EventMask))) - for i := 0; i < xgb.PopCount(int(v.EventMask)); i++ { - v.EventList[i] = xgb.Get32(buf[b:]) - b += 4 - } - b = xgb.Pad(b) - v.AllEventsMask = xgb.Get32(buf[b:]) b += 4 - v.AllEventsList = make([]uint32, xgb.PopCount(int(v.AllEventsMask))) - for i := 0; i < xgb.PopCount(int(v.AllEventsMask)); i++ { - v.AllEventsList[i] = xgb.Get32(buf[b:]) - b += 4 - } - b = xgb.Pad(b) - return v } @@ -1761,7 +1755,7 @@ func (cook PrintPutDocumentDataCookie) Check() error { // Write request to wire for PrintPutDocumentData // printPutDocumentDataRequest writes a PrintPutDocumentData request to a byte slice. func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []String8, Options []String8) []byte { - size := xgb.Pad((((16 + xgb.Pad((int(LenData) * 1))) + xgb.Pad((len(DocFormat) * 1))) + xgb.Pad((len(Options) * 1)))) + size := xgb.Pad((((16 + xgb.Pad((int(LenData) * 1))) + xgb.Pad((int(LenFmt) * 1))) + xgb.Pad((int(LenOptions) * 1)))) b := 0 buf := make([]byte, size) @@ -1791,12 +1785,12 @@ func printPutDocumentDataRequest(c *xgb.Conn, Drawable xproto.Drawable, LenData copy(buf[b:], Data[:LenData]) b += int(LenData) - for i := 0; i < int(len(DocFormat)); i++ { + for i := 0; i < int(LenFmt); i++ { buf[b] = byte(DocFormat[i]) b += 1 } - for i := 0; i < int(len(Options)); i++ { + for i := 0; i < int(LenOptions); i++ { buf[b] = byte(Options[i]) b += 1 } @@ -2065,27 +2059,27 @@ 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 { +func PrintSelectInput(c *xgb.Conn, Context Pcontext, EventMask 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.") } cookie := c.NewCookie(false, false) - c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) + c.NewRequest(printSelectInputRequest(c, Context, EventMask), cookie) return PrintSelectInputCookie{cookie} } // 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 { +func PrintSelectInputChecked(c *xgb.Conn, Context Pcontext, EventMask 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.") } cookie := c.NewCookie(true, false) - c.NewRequest(printSelectInputRequest(c, Context, EventMask, EventList), cookie) + c.NewRequest(printSelectInputRequest(c, Context, EventMask), cookie) return PrintSelectInputCookie{cookie} } @@ -2097,8 +2091,8 @@ func (cook PrintSelectInputCookie) Check() error { // Write request to wire for PrintSelectInput // printSelectInputRequest writes a PrintSelectInput request to a byte slice. -func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32, EventList []uint32) []byte { - size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(EventMask))))))) +func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32) []byte { + size := 12 b := 0 buf := make([]byte, size) @@ -2118,11 +2112,6 @@ func printSelectInputRequest(c *xgb.Conn, Context Pcontext, EventMask uint32, Ev xgb.Put32(buf[b:], EventMask) b += 4 - for i := 0; i < xgb.PopCount(int(EventMask)); i++ { - xgb.Put32(buf[b:], EventList[i]) - b += 4 - } - b = xgb.Pad(b) return buf } -- cgit v1.2.3