package xgb /* This file was generated by xfixes.xml on May 10 2012 12:39:34pm EDT. This file is automatically generated. Edit at your peril! */ // Imports are not necessary for XGB because everything is // in one package. They are still listed here for reference. // import "xproto" // import "render" // import "shape" // XfixesInit must be called before using the XFIXES extension. func (c *Conn) XfixesInit() error { reply, err := c.QueryExtension(6, "XFIXES").Reply() switch { case err != nil: return err case !reply.Present: return errorf("No extension named XFIXES could be found on on the server.") } c.extLock.Lock() c.extensions["XFIXES"] = reply.MajorOpcode for evNum, fun := range newExtEventFuncs["XFIXES"] { newEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range newExtErrorFuncs["XFIXES"] { newErrorFuncs[int(reply.FirstError)+errNum] = fun } c.extLock.Unlock() return nil } func init() { newExtEventFuncs["XFIXES"] = make(map[int]newEventFun) newExtErrorFuncs["XFIXES"] = make(map[int]newErrorFun) } // 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' // Skipping definition for base type 'Card8' // Skipping definition for base type 'Int16' // Skipping definition for base type 'Int32' const ( XfixesSaveSetModeInsert = 0 XfixesSaveSetModeDelete = 1 ) const ( XfixesSaveSetTargetNearest = 0 XfixesSaveSetTargetRoot = 1 ) const ( XfixesSaveSetMappingMap = 0 XfixesSaveSetMappingUnmap = 1 ) const ( XfixesSelectionEventSetSelectionOwner = 0 XfixesSelectionEventSelectionWindowDestroy = 1 XfixesSelectionEventSelectionClientClose = 2 ) const ( XfixesSelectionEventMaskSetSelectionOwner = 1 XfixesSelectionEventMaskSelectionWindowDestroy = 2 XfixesSelectionEventMaskSelectionClientClose = 4 ) const ( XfixesCursorNotifyDisplayCursor = 0 ) const ( XfixesCursorNotifyMaskDisplayCursor = 1 ) const ( XfixesRegionNone = 0 ) type XfixesRegion uint32 func (c *Conn) NewXfixesRegionId() (XfixesRegion, error) { id, err := c.NewId() if err != nil { return 0, err } return XfixesRegion(id), nil } // Event definition XfixesSelectionNotify (0) // Size: 32 const XfixesSelectionNotify = 0 type XfixesSelectionNotifyEvent struct { Sequence uint16 Subtype byte Window Window Owner Window Selection Atom Timestamp Timestamp SelectionTimestamp Timestamp // padding: 8 bytes } // Event read XfixesSelectionNotify func NewXfixesSelectionNotifyEvent(buf []byte) Event { v := XfixesSelectionNotifyEvent{} b := 1 // don't read event number v.Subtype = buf[b] b += 1 v.Sequence = Get16(buf[b:]) b += 2 v.Window = Window(Get32(buf[b:])) b += 4 v.Owner = Window(Get32(buf[b:])) b += 4 v.Selection = Atom(Get32(buf[b:])) b += 4 v.Timestamp = Timestamp(Get32(buf[b:])) b += 4 v.SelectionTimestamp = Timestamp(Get32(buf[b:])) b += 4 b += 8 // padding return v } // Event write XfixesSelectionNotify func (v XfixesSelectionNotifyEvent) Bytes() []byte { buf := make([]byte, 32) b := 0 // write event number buf[b] = 0 b += 1 buf[b] = v.Subtype b += 1 b += 2 // skip sequence number Put32(buf[b:], uint32(v.Window)) b += 4 Put32(buf[b:], uint32(v.Owner)) b += 4 Put32(buf[b:], uint32(v.Selection)) b += 4 Put32(buf[b:], uint32(v.Timestamp)) b += 4 Put32(buf[b:], uint32(v.SelectionTimestamp)) b += 4 b += 8 // padding return buf } func (v XfixesSelectionNotifyEvent) ImplementsEvent() {} func (v XfixesSelectionNotifyEvent) SequenceId() uint16 { return v.Sequence } func (v XfixesSelectionNotifyEvent) String() string { fieldVals := make([]string, 0, 7) fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) fieldVals = append(fieldVals, sprintf("Subtype: %d", v.Subtype)) fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) fieldVals = append(fieldVals, sprintf("Owner: %d", v.Owner)) fieldVals = append(fieldVals, sprintf("Selection: %d", v.Selection)) fieldVals = append(fieldVals, sprintf("Timestamp: %d", v.Timestamp)) fieldVals = append(fieldVals, sprintf("SelectionTimestamp: %d", v.SelectionTimestamp)) return "XfixesSelectionNotify {" + stringsJoin(fieldVals, ", ") + "}" } func init() { newExtEventFuncs["XFIXES"][0] = NewXfixesSelectionNotifyEvent } // Event definition XfixesCursorNotify (1) // Size: 32 const XfixesCursorNotify = 1 type XfixesCursorNotifyEvent struct { Sequence uint16 Subtype byte Window Window CursorSerial uint32 Timestamp Timestamp Name Atom // padding: 12 bytes } // Event read XfixesCursorNotify func NewXfixesCursorNotifyEvent(buf []byte) Event { v := XfixesCursorNotifyEvent{} b := 1 // don't read event number v.Subtype = buf[b] b += 1 v.Sequence = Get16(buf[b:]) b += 2 v.Window = Window(Get32(buf[b:])) b += 4 v.CursorSerial = Get32(buf[b:]) b += 4 v.Timestamp = Timestamp(Get32(buf[b:])) b += 4 v.Name = Atom(Get32(buf[b:])) b += 4 b += 12 // padding return v } // Event write XfixesCursorNotify func (v XfixesCursorNotifyEvent) Bytes() []byte { buf := make([]byte, 32) b := 0 // write event number buf[b] = 1 b += 1 buf[b] = v.Subtype b += 1 b += 2 // skip sequence number Put32(buf[b:], uint32(v.Window)) b += 4 Put32(buf[b:], v.CursorSerial) b += 4 Put32(buf[b:], uint32(v.Timestamp)) b += 4 Put32(buf[b:], uint32(v.Name)) b += 4 b += 12 // padding return buf } func (v XfixesCursorNotifyEvent) ImplementsEvent() {} func (v XfixesCursorNotifyEvent) SequenceId() uint16 { return v.Sequence } func (v XfixesCursorNotifyEvent) String() string { fieldVals := make([]string, 0, 6) fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) fieldVals = append(fieldVals, sprintf("Subtype: %d", v.Subtype)) fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) fieldVals = append(fieldVals, sprintf("CursorSerial: %d", v.CursorSerial)) fieldVals = append(fieldVals, sprintf("Timestamp: %d", v.Timestamp)) fieldVals = append(fieldVals, sprintf("Name: %d", v.Name)) return "XfixesCursorNotify {" + stringsJoin(fieldVals, ", ") + "}" } func init() { newExtEventFuncs["XFIXES"][1] = NewXfixesCursorNotifyEvent } // Error definition XfixesBadRegion (0) // Size: 32 const BadXfixesBadRegion = 0 type XfixesBadRegionError struct { Sequence uint16 NiceName string } // Error read XfixesBadRegion func NewXfixesBadRegionError(buf []byte) Error { v := XfixesBadRegionError{} v.NiceName = "XfixesBadRegion" b := 1 // skip error determinant b += 1 // don't read error number v.Sequence = Get16(buf[b:]) b += 2 return v } func (err XfixesBadRegionError) ImplementsError() {} func (err XfixesBadRegionError) SequenceId() uint16 { return err.Sequence } func (err XfixesBadRegionError) BadId() uint32 { return 0 } func (err XfixesBadRegionError) Error() string { fieldVals := make([]string, 0, 0) fieldVals = append(fieldVals, "NiceName: "+err.NiceName) fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) return "BadXfixesBadRegion {" + stringsJoin(fieldVals, ", ") + "}" } func init() { newExtErrorFuncs["XFIXES"][0] = NewXfixesBadRegionError } // Request XfixesQueryVersion // size: 12 type XfixesQueryVersionCookie struct { *cookie } func (c *Conn) XfixesQueryVersion(ClientMajorVersion uint32, ClientMinorVersion uint32) XfixesQueryVersionCookie { cookie := c.newCookie(true, true) c.newRequest(c.xfixesQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) return XfixesQueryVersionCookie{cookie} } func (c *Conn) XfixesQueryVersionUnchecked(ClientMajorVersion uint32, ClientMinorVersion uint32) XfixesQueryVersionCookie { cookie := c.newCookie(false, true) c.newRequest(c.xfixesQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) return XfixesQueryVersionCookie{cookie} } // Request reply for XfixesQueryVersion // size: 32 type XfixesQueryVersionReply struct { Sequence uint16 Length uint32 // padding: 1 bytes MajorVersion uint32 MinorVersion uint32 // padding: 16 bytes } // Waits and reads reply data from request XfixesQueryVersion func (cook XfixesQueryVersionCookie) Reply() (*XfixesQueryVersionReply, error) { buf, err := cook.reply() if err != nil { return nil, err } if buf == nil { return nil, nil } return xfixesQueryVersionReply(buf), nil } // Read reply into structure from buffer for XfixesQueryVersion func xfixesQueryVersionReply(buf []byte) *XfixesQueryVersionReply { v := new(XfixesQueryVersionReply) b := 1 // skip reply determinant b += 1 // padding v.Sequence = Get16(buf[b:]) b += 2 v.Length = Get32(buf[b:]) // 4-byte units b += 4 v.MajorVersion = Get32(buf[b:]) b += 4 v.MinorVersion = Get32(buf[b:]) b += 4 b += 16 // padding return v } func (cook XfixesQueryVersionCookie) Check() error { return cook.check() } // Write request to wire for XfixesQueryVersion func (c *Conn) xfixesQueryVersionRequest(ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 0 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], ClientMajorVersion) b += 4 Put32(buf[b:], ClientMinorVersion) b += 4 return buf } // Request XfixesChangeSaveSet // size: 12 type XfixesChangeSaveSetCookie struct { *cookie } // Write request to wire for XfixesChangeSaveSet func (c *Conn) XfixesChangeSaveSet(Mode byte, Target byte, Map byte, Window Window) XfixesChangeSaveSetCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesChangeSaveSetRequest(Mode, Target, Map, Window), cookie) return XfixesChangeSaveSetCookie{cookie} } func (c *Conn) XfixesChangeSaveSetChecked(Mode byte, Target byte, Map byte, Window Window) XfixesChangeSaveSetCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesChangeSaveSetRequest(Mode, Target, Map, Window), cookie) return XfixesChangeSaveSetCookie{cookie} } func (cook XfixesChangeSaveSetCookie) Check() error { return cook.check() } // Write request to wire for XfixesChangeSaveSet func (c *Conn) xfixesChangeSaveSetRequest(Mode byte, Target byte, Map byte, Window Window) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 1 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 buf[b] = Mode b += 1 buf[b] = Target b += 1 buf[b] = Map b += 1 b += 1 // padding Put32(buf[b:], uint32(Window)) b += 4 return buf } // Request XfixesSelectSelectionInput // size: 16 type XfixesSelectSelectionInputCookie struct { *cookie } // Write request to wire for XfixesSelectSelectionInput func (c *Conn) XfixesSelectSelectionInput(Window Window, Selection Atom, EventMask uint32) XfixesSelectSelectionInputCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesSelectSelectionInputRequest(Window, Selection, EventMask), cookie) return XfixesSelectSelectionInputCookie{cookie} } func (c *Conn) XfixesSelectSelectionInputChecked(Window Window, Selection Atom, EventMask uint32) XfixesSelectSelectionInputCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesSelectSelectionInputRequest(Window, Selection, EventMask), cookie) return XfixesSelectSelectionInputCookie{cookie} } func (cook XfixesSelectSelectionInputCookie) Check() error { return cook.check() } // Write request to wire for XfixesSelectSelectionInput func (c *Conn) xfixesSelectSelectionInputRequest(Window Window, Selection Atom, EventMask uint32) []byte { size := 16 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 2 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Window)) b += 4 Put32(buf[b:], uint32(Selection)) b += 4 Put32(buf[b:], EventMask) b += 4 return buf } // Request XfixesSelectCursorInput // size: 12 type XfixesSelectCursorInputCookie struct { *cookie } // Write request to wire for XfixesSelectCursorInput func (c *Conn) XfixesSelectCursorInput(Window Window, EventMask uint32) XfixesSelectCursorInputCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesSelectCursorInputRequest(Window, EventMask), cookie) return XfixesSelectCursorInputCookie{cookie} } func (c *Conn) XfixesSelectCursorInputChecked(Window Window, EventMask uint32) XfixesSelectCursorInputCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesSelectCursorInputRequest(Window, EventMask), cookie) return XfixesSelectCursorInputCookie{cookie} } func (cook XfixesSelectCursorInputCookie) Check() error { return cook.check() } // Write request to wire for XfixesSelectCursorInput func (c *Conn) xfixesSelectCursorInputRequest(Window Window, EventMask uint32) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 3 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Window)) b += 4 Put32(buf[b:], EventMask) b += 4 return buf } // Request XfixesGetCursorImage // size: 4 type XfixesGetCursorImageCookie struct { *cookie } func (c *Conn) XfixesGetCursorImage() XfixesGetCursorImageCookie { cookie := c.newCookie(true, true) c.newRequest(c.xfixesGetCursorImageRequest(), cookie) return XfixesGetCursorImageCookie{cookie} } func (c *Conn) XfixesGetCursorImageUnchecked() XfixesGetCursorImageCookie { cookie := c.newCookie(false, true) c.newRequest(c.xfixesGetCursorImageRequest(), cookie) return XfixesGetCursorImageCookie{cookie} } // Request reply for XfixesGetCursorImage // size: (32 + pad(((int(Width) * int(Height)) * 4))) type XfixesGetCursorImageReply struct { Sequence uint16 Length uint32 // padding: 1 bytes X int16 Y int16 Width uint16 Height uint16 Xhot uint16 Yhot uint16 CursorSerial uint32 // padding: 8 bytes CursorImage []uint32 // size: pad(((int(Width) * int(Height)) * 4)) } // Waits and reads reply data from request XfixesGetCursorImage func (cook XfixesGetCursorImageCookie) Reply() (*XfixesGetCursorImageReply, error) { buf, err := cook.reply() if err != nil { return nil, err } if buf == nil { return nil, nil } return xfixesGetCursorImageReply(buf), nil } // Read reply into structure from buffer for XfixesGetCursorImage func xfixesGetCursorImageReply(buf []byte) *XfixesGetCursorImageReply { v := new(XfixesGetCursorImageReply) b := 1 // skip reply determinant b += 1 // padding v.Sequence = Get16(buf[b:]) b += 2 v.Length = Get32(buf[b:]) // 4-byte units b += 4 v.X = int16(Get16(buf[b:])) b += 2 v.Y = int16(Get16(buf[b:])) b += 2 v.Width = Get16(buf[b:]) b += 2 v.Height = Get16(buf[b:]) b += 2 v.Xhot = Get16(buf[b:]) b += 2 v.Yhot = Get16(buf[b:]) b += 2 v.CursorSerial = Get32(buf[b:]) b += 4 b += 8 // padding v.CursorImage = make([]uint32, (int(v.Width) * int(v.Height))) for i := 0; i < int((int(v.Width) * int(v.Height))); i++ { v.CursorImage[i] = Get32(buf[b:]) b += 4 } b = pad(b) return v } func (cook XfixesGetCursorImageCookie) Check() error { return cook.check() } // Write request to wire for XfixesGetCursorImage func (c *Conn) xfixesGetCursorImageRequest() []byte { size := 4 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 4 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 return buf } // Request XfixesCreateRegion // size: pad((8 + pad((len(Rectangles) * 8)))) type XfixesCreateRegionCookie struct { *cookie } // Write request to wire for XfixesCreateRegion func (c *Conn) XfixesCreateRegion(Region XfixesRegion, Rectangles []Rectangle) XfixesCreateRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesCreateRegionRequest(Region, Rectangles), cookie) return XfixesCreateRegionCookie{cookie} } func (c *Conn) XfixesCreateRegionChecked(Region XfixesRegion, Rectangles []Rectangle) XfixesCreateRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesCreateRegionRequest(Region, Rectangles), cookie) return XfixesCreateRegionCookie{cookie} } func (cook XfixesCreateRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesCreateRegion func (c *Conn) xfixesCreateRegionRequest(Region XfixesRegion, Rectangles []Rectangle) []byte { size := pad((8 + pad((len(Rectangles) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 5 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Region)) b += 4 b += RectangleListBytes(buf[b:], Rectangles) return buf } // Request XfixesCreateRegionFromBitmap // size: 12 type XfixesCreateRegionFromBitmapCookie struct { *cookie } // Write request to wire for XfixesCreateRegionFromBitmap func (c *Conn) XfixesCreateRegionFromBitmap(Region XfixesRegion, Bitmap Pixmap) XfixesCreateRegionFromBitmapCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesCreateRegionFromBitmapRequest(Region, Bitmap), cookie) return XfixesCreateRegionFromBitmapCookie{cookie} } func (c *Conn) XfixesCreateRegionFromBitmapChecked(Region XfixesRegion, Bitmap Pixmap) XfixesCreateRegionFromBitmapCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesCreateRegionFromBitmapRequest(Region, Bitmap), cookie) return XfixesCreateRegionFromBitmapCookie{cookie} } func (cook XfixesCreateRegionFromBitmapCookie) Check() error { return cook.check() } // Write request to wire for XfixesCreateRegionFromBitmap func (c *Conn) xfixesCreateRegionFromBitmapRequest(Region XfixesRegion, Bitmap Pixmap) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 6 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Region)) b += 4 Put32(buf[b:], uint32(Bitmap)) b += 4 return buf } // Request XfixesCreateRegionFromWindow // size: 16 type XfixesCreateRegionFromWindowCookie struct { *cookie } // Write request to wire for XfixesCreateRegionFromWindow func (c *Conn) XfixesCreateRegionFromWindow(Region XfixesRegion, Window Window, Kind ShapeKind) XfixesCreateRegionFromWindowCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesCreateRegionFromWindowRequest(Region, Window, Kind), cookie) return XfixesCreateRegionFromWindowCookie{cookie} } func (c *Conn) XfixesCreateRegionFromWindowChecked(Region XfixesRegion, Window Window, Kind ShapeKind) XfixesCreateRegionFromWindowCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesCreateRegionFromWindowRequest(Region, Window, Kind), cookie) return XfixesCreateRegionFromWindowCookie{cookie} } func (cook XfixesCreateRegionFromWindowCookie) Check() error { return cook.check() } // Write request to wire for XfixesCreateRegionFromWindow func (c *Conn) xfixesCreateRegionFromWindowRequest(Region XfixesRegion, Window Window, Kind ShapeKind) []byte { size := 16 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 7 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Region)) b += 4 Put32(buf[b:], uint32(Window)) b += 4 buf[b] = byte(Kind) b += 1 b += 3 // padding return buf } // Request XfixesCreateRegionFromGC // size: 12 type XfixesCreateRegionFromGCCookie struct { *cookie } // Write request to wire for XfixesCreateRegionFromGC func (c *Conn) XfixesCreateRegionFromGC(Region XfixesRegion, Gc Gcontext) XfixesCreateRegionFromGCCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesCreateRegionFromGCRequest(Region, Gc), cookie) return XfixesCreateRegionFromGCCookie{cookie} } func (c *Conn) XfixesCreateRegionFromGCChecked(Region XfixesRegion, Gc Gcontext) XfixesCreateRegionFromGCCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesCreateRegionFromGCRequest(Region, Gc), cookie) return XfixesCreateRegionFromGCCookie{cookie} } func (cook XfixesCreateRegionFromGCCookie) Check() error { return cook.check() } // Write request to wire for XfixesCreateRegionFromGC func (c *Conn) xfixesCreateRegionFromGCRequest(Region XfixesRegion, Gc Gcontext) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 8 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Region)) b += 4 Put32(buf[b:], uint32(Gc)) b += 4 return buf } // Request XfixesCreateRegionFromPicture // size: 12 type XfixesCreateRegionFromPictureCookie struct { *cookie } // Write request to wire for XfixesCreateRegionFromPicture func (c *Conn) XfixesCreateRegionFromPicture(Region XfixesRegion, Picture RenderPicture) XfixesCreateRegionFromPictureCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesCreateRegionFromPictureRequest(Region, Picture), cookie) return XfixesCreateRegionFromPictureCookie{cookie} } func (c *Conn) XfixesCreateRegionFromPictureChecked(Region XfixesRegion, Picture RenderPicture) XfixesCreateRegionFromPictureCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesCreateRegionFromPictureRequest(Region, Picture), cookie) return XfixesCreateRegionFromPictureCookie{cookie} } func (cook XfixesCreateRegionFromPictureCookie) Check() error { return cook.check() } // Write request to wire for XfixesCreateRegionFromPicture func (c *Conn) xfixesCreateRegionFromPictureRequest(Region XfixesRegion, Picture RenderPicture) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 9 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Region)) b += 4 Put32(buf[b:], uint32(Picture)) b += 4 return buf } // Request XfixesDestroyRegion // size: 8 type XfixesDestroyRegionCookie struct { *cookie } // Write request to wire for XfixesDestroyRegion func (c *Conn) XfixesDestroyRegion(Region XfixesRegion) XfixesDestroyRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesDestroyRegionRequest(Region), cookie) return XfixesDestroyRegionCookie{cookie} } func (c *Conn) XfixesDestroyRegionChecked(Region XfixesRegion) XfixesDestroyRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesDestroyRegionRequest(Region), cookie) return XfixesDestroyRegionCookie{cookie} } func (cook XfixesDestroyRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesDestroyRegion func (c *Conn) xfixesDestroyRegionRequest(Region XfixesRegion) []byte { size := 8 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 10 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Region)) b += 4 return buf } // Request XfixesSetRegion // size: pad((8 + pad((len(Rectangles) * 8)))) type XfixesSetRegionCookie struct { *cookie } // Write request to wire for XfixesSetRegion func (c *Conn) XfixesSetRegion(Region XfixesRegion, Rectangles []Rectangle) XfixesSetRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesSetRegionRequest(Region, Rectangles), cookie) return XfixesSetRegionCookie{cookie} } func (c *Conn) XfixesSetRegionChecked(Region XfixesRegion, Rectangles []Rectangle) XfixesSetRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesSetRegionRequest(Region, Rectangles), cookie) return XfixesSetRegionCookie{cookie} } func (cook XfixesSetRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesSetRegion func (c *Conn) xfixesSetRegionRequest(Region XfixesRegion, Rectangles []Rectangle) []byte { size := pad((8 + pad((len(Rectangles) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 11 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Region)) b += 4 b += RectangleListBytes(buf[b:], Rectangles) return buf } // Request XfixesCopyRegion // size: 12 type XfixesCopyRegionCookie struct { *cookie } // Write request to wire for XfixesCopyRegion func (c *Conn) XfixesCopyRegion(Source XfixesRegion, Destination XfixesRegion) XfixesCopyRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesCopyRegionRequest(Source, Destination), cookie) return XfixesCopyRegionCookie{cookie} } func (c *Conn) XfixesCopyRegionChecked(Source XfixesRegion, Destination XfixesRegion) XfixesCopyRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesCopyRegionRequest(Source, Destination), cookie) return XfixesCopyRegionCookie{cookie} } func (cook XfixesCopyRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesCopyRegion func (c *Conn) xfixesCopyRegionRequest(Source XfixesRegion, Destination XfixesRegion) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 12 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Source)) b += 4 Put32(buf[b:], uint32(Destination)) b += 4 return buf } // Request XfixesUnionRegion // size: 16 type XfixesUnionRegionCookie struct { *cookie } // Write request to wire for XfixesUnionRegion func (c *Conn) XfixesUnionRegion(Source1 XfixesRegion, Source2 XfixesRegion, Destination XfixesRegion) XfixesUnionRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesUnionRegionRequest(Source1, Source2, Destination), cookie) return XfixesUnionRegionCookie{cookie} } func (c *Conn) XfixesUnionRegionChecked(Source1 XfixesRegion, Source2 XfixesRegion, Destination XfixesRegion) XfixesUnionRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesUnionRegionRequest(Source1, Source2, Destination), cookie) return XfixesUnionRegionCookie{cookie} } func (cook XfixesUnionRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesUnionRegion func (c *Conn) xfixesUnionRegionRequest(Source1 XfixesRegion, Source2 XfixesRegion, Destination XfixesRegion) []byte { size := 16 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 13 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Source1)) b += 4 Put32(buf[b:], uint32(Source2)) b += 4 Put32(buf[b:], uint32(Destination)) b += 4 return buf } // Request XfixesIntersectRegion // size: 16 type XfixesIntersectRegionCookie struct { *cookie } // Write request to wire for XfixesIntersectRegion func (c *Conn) XfixesIntersectRegion(Source1 XfixesRegion, Source2 XfixesRegion, Destination XfixesRegion) XfixesIntersectRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesIntersectRegionRequest(Source1, Source2, Destination), cookie) return XfixesIntersectRegionCookie{cookie} } func (c *Conn) XfixesIntersectRegionChecked(Source1 XfixesRegion, Source2 XfixesRegion, Destination XfixesRegion) XfixesIntersectRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesIntersectRegionRequest(Source1, Source2, Destination), cookie) return XfixesIntersectRegionCookie{cookie} } func (cook XfixesIntersectRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesIntersectRegion func (c *Conn) xfixesIntersectRegionRequest(Source1 XfixesRegion, Source2 XfixesRegion, Destination XfixesRegion) []byte { size := 16 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 14 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Source1)) b += 4 Put32(buf[b:], uint32(Source2)) b += 4 Put32(buf[b:], uint32(Destination)) b += 4 return buf } // Request XfixesSubtractRegion // size: 16 type XfixesSubtractRegionCookie struct { *cookie } // Write request to wire for XfixesSubtractRegion func (c *Conn) XfixesSubtractRegion(Source1 XfixesRegion, Source2 XfixesRegion, Destination XfixesRegion) XfixesSubtractRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesSubtractRegionRequest(Source1, Source2, Destination), cookie) return XfixesSubtractRegionCookie{cookie} } func (c *Conn) XfixesSubtractRegionChecked(Source1 XfixesRegion, Source2 XfixesRegion, Destination XfixesRegion) XfixesSubtractRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesSubtractRegionRequest(Source1, Source2, Destination), cookie) return XfixesSubtractRegionCookie{cookie} } func (cook XfixesSubtractRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesSubtractRegion func (c *Conn) xfixesSubtractRegionRequest(Source1 XfixesRegion, Source2 XfixesRegion, Destination XfixesRegion) []byte { size := 16 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 15 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Source1)) b += 4 Put32(buf[b:], uint32(Source2)) b += 4 Put32(buf[b:], uint32(Destination)) b += 4 return buf } // Request XfixesInvertRegion // size: 20 type XfixesInvertRegionCookie struct { *cookie } // Write request to wire for XfixesInvertRegion func (c *Conn) XfixesInvertRegion(Source XfixesRegion, Bounds Rectangle, Destination XfixesRegion) XfixesInvertRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesInvertRegionRequest(Source, Bounds, Destination), cookie) return XfixesInvertRegionCookie{cookie} } func (c *Conn) XfixesInvertRegionChecked(Source XfixesRegion, Bounds Rectangle, Destination XfixesRegion) XfixesInvertRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesInvertRegionRequest(Source, Bounds, Destination), cookie) return XfixesInvertRegionCookie{cookie} } func (cook XfixesInvertRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesInvertRegion func (c *Conn) xfixesInvertRegionRequest(Source XfixesRegion, Bounds Rectangle, Destination XfixesRegion) []byte { size := 20 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 16 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Source)) b += 4 { structBytes := Bounds.Bytes() copy(buf[b:], structBytes) b += pad(len(structBytes)) } Put32(buf[b:], uint32(Destination)) b += 4 return buf } // Request XfixesTranslateRegion // size: 12 type XfixesTranslateRegionCookie struct { *cookie } // Write request to wire for XfixesTranslateRegion func (c *Conn) XfixesTranslateRegion(Region XfixesRegion, Dx int16, Dy int16) XfixesTranslateRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesTranslateRegionRequest(Region, Dx, Dy), cookie) return XfixesTranslateRegionCookie{cookie} } func (c *Conn) XfixesTranslateRegionChecked(Region XfixesRegion, Dx int16, Dy int16) XfixesTranslateRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesTranslateRegionRequest(Region, Dx, Dy), cookie) return XfixesTranslateRegionCookie{cookie} } func (cook XfixesTranslateRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesTranslateRegion func (c *Conn) xfixesTranslateRegionRequest(Region XfixesRegion, Dx int16, Dy int16) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 17 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Region)) b += 4 Put16(buf[b:], uint16(Dx)) b += 2 Put16(buf[b:], uint16(Dy)) b += 2 return buf } // Request XfixesRegionExtents // size: 12 type XfixesRegionExtentsCookie struct { *cookie } // Write request to wire for XfixesRegionExtents func (c *Conn) XfixesRegionExtents(Source XfixesRegion, Destination XfixesRegion) XfixesRegionExtentsCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesRegionExtentsRequest(Source, Destination), cookie) return XfixesRegionExtentsCookie{cookie} } func (c *Conn) XfixesRegionExtentsChecked(Source XfixesRegion, Destination XfixesRegion) XfixesRegionExtentsCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesRegionExtentsRequest(Source, Destination), cookie) return XfixesRegionExtentsCookie{cookie} } func (cook XfixesRegionExtentsCookie) Check() error { return cook.check() } // Write request to wire for XfixesRegionExtents func (c *Conn) xfixesRegionExtentsRequest(Source XfixesRegion, Destination XfixesRegion) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 18 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Source)) b += 4 Put32(buf[b:], uint32(Destination)) b += 4 return buf } // Request XfixesFetchRegion // size: 8 type XfixesFetchRegionCookie struct { *cookie } func (c *Conn) XfixesFetchRegion(Region XfixesRegion) XfixesFetchRegionCookie { cookie := c.newCookie(true, true) c.newRequest(c.xfixesFetchRegionRequest(Region), cookie) return XfixesFetchRegionCookie{cookie} } func (c *Conn) XfixesFetchRegionUnchecked(Region XfixesRegion) XfixesFetchRegionCookie { cookie := c.newCookie(false, true) c.newRequest(c.xfixesFetchRegionRequest(Region), cookie) return XfixesFetchRegionCookie{cookie} } // Request reply for XfixesFetchRegion // size: (32 + pad(((int(Length) / 2) * 8))) type XfixesFetchRegionReply struct { Sequence uint16 Length uint32 // padding: 1 bytes Extents Rectangle // padding: 16 bytes Rectangles []Rectangle // size: pad(((int(Length) / 2) * 8)) } // Waits and reads reply data from request XfixesFetchRegion func (cook XfixesFetchRegionCookie) Reply() (*XfixesFetchRegionReply, error) { buf, err := cook.reply() if err != nil { return nil, err } if buf == nil { return nil, nil } return xfixesFetchRegionReply(buf), nil } // Read reply into structure from buffer for XfixesFetchRegion func xfixesFetchRegionReply(buf []byte) *XfixesFetchRegionReply { v := new(XfixesFetchRegionReply) b := 1 // skip reply determinant b += 1 // padding v.Sequence = Get16(buf[b:]) b += 2 v.Length = Get32(buf[b:]) // 4-byte units b += 4 v.Extents = Rectangle{} b += ReadRectangle(buf[b:], &v.Extents) b += 16 // padding v.Rectangles = make([]Rectangle, (int(v.Length) / 2)) b += ReadRectangleList(buf[b:], v.Rectangles) return v } func (cook XfixesFetchRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesFetchRegion func (c *Conn) xfixesFetchRegionRequest(Region XfixesRegion) []byte { size := 8 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 19 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Region)) b += 4 return buf } // Request XfixesSetGCClipRegion // size: 16 type XfixesSetGCClipRegionCookie struct { *cookie } // Write request to wire for XfixesSetGCClipRegion func (c *Conn) XfixesSetGCClipRegion(Gc Gcontext, Region XfixesRegion, XOrigin int16, YOrigin int16) XfixesSetGCClipRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesSetGCClipRegionRequest(Gc, Region, XOrigin, YOrigin), cookie) return XfixesSetGCClipRegionCookie{cookie} } func (c *Conn) XfixesSetGCClipRegionChecked(Gc Gcontext, Region XfixesRegion, XOrigin int16, YOrigin int16) XfixesSetGCClipRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesSetGCClipRegionRequest(Gc, Region, XOrigin, YOrigin), cookie) return XfixesSetGCClipRegionCookie{cookie} } func (cook XfixesSetGCClipRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesSetGCClipRegion func (c *Conn) xfixesSetGCClipRegionRequest(Gc Gcontext, Region XfixesRegion, XOrigin int16, YOrigin int16) []byte { size := 16 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 20 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Gc)) b += 4 Put32(buf[b:], uint32(Region)) b += 4 Put16(buf[b:], uint16(XOrigin)) b += 2 Put16(buf[b:], uint16(YOrigin)) b += 2 return buf } // Request XfixesSetWindowShapeRegion // size: 20 type XfixesSetWindowShapeRegionCookie struct { *cookie } // Write request to wire for XfixesSetWindowShapeRegion func (c *Conn) XfixesSetWindowShapeRegion(Dest Window, DestKind ShapeKind, XOffset int16, YOffset int16, Region XfixesRegion) XfixesSetWindowShapeRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesSetWindowShapeRegionRequest(Dest, DestKind, XOffset, YOffset, Region), cookie) return XfixesSetWindowShapeRegionCookie{cookie} } func (c *Conn) XfixesSetWindowShapeRegionChecked(Dest Window, DestKind ShapeKind, XOffset int16, YOffset int16, Region XfixesRegion) XfixesSetWindowShapeRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesSetWindowShapeRegionRequest(Dest, DestKind, XOffset, YOffset, Region), cookie) return XfixesSetWindowShapeRegionCookie{cookie} } func (cook XfixesSetWindowShapeRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesSetWindowShapeRegion func (c *Conn) xfixesSetWindowShapeRegionRequest(Dest Window, DestKind ShapeKind, XOffset int16, YOffset int16, Region XfixesRegion) []byte { size := 20 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 21 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Dest)) b += 4 buf[b] = byte(DestKind) b += 1 b += 3 // padding Put16(buf[b:], uint16(XOffset)) b += 2 Put16(buf[b:], uint16(YOffset)) b += 2 Put32(buf[b:], uint32(Region)) b += 4 return buf } // Request XfixesSetPictureClipRegion // size: 16 type XfixesSetPictureClipRegionCookie struct { *cookie } // Write request to wire for XfixesSetPictureClipRegion func (c *Conn) XfixesSetPictureClipRegion(Picture RenderPicture, Region XfixesRegion, XOrigin int16, YOrigin int16) XfixesSetPictureClipRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesSetPictureClipRegionRequest(Picture, Region, XOrigin, YOrigin), cookie) return XfixesSetPictureClipRegionCookie{cookie} } func (c *Conn) XfixesSetPictureClipRegionChecked(Picture RenderPicture, Region XfixesRegion, XOrigin int16, YOrigin int16) XfixesSetPictureClipRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesSetPictureClipRegionRequest(Picture, Region, XOrigin, YOrigin), cookie) return XfixesSetPictureClipRegionCookie{cookie} } func (cook XfixesSetPictureClipRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesSetPictureClipRegion func (c *Conn) xfixesSetPictureClipRegionRequest(Picture RenderPicture, Region XfixesRegion, XOrigin int16, YOrigin int16) []byte { size := 16 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 22 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Picture)) b += 4 Put32(buf[b:], uint32(Region)) b += 4 Put16(buf[b:], uint16(XOrigin)) b += 2 Put16(buf[b:], uint16(YOrigin)) b += 2 return buf } // Request XfixesSetCursorName // size: pad((12 + pad((int(Nbytes) * 1)))) type XfixesSetCursorNameCookie struct { *cookie } // Write request to wire for XfixesSetCursorName func (c *Conn) XfixesSetCursorName(Cursor Cursor, Nbytes uint16, Name string) XfixesSetCursorNameCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesSetCursorNameRequest(Cursor, Nbytes, Name), cookie) return XfixesSetCursorNameCookie{cookie} } func (c *Conn) XfixesSetCursorNameChecked(Cursor Cursor, Nbytes uint16, Name string) XfixesSetCursorNameCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesSetCursorNameRequest(Cursor, Nbytes, Name), cookie) return XfixesSetCursorNameCookie{cookie} } func (cook XfixesSetCursorNameCookie) Check() error { return cook.check() } // Write request to wire for XfixesSetCursorName func (c *Conn) xfixesSetCursorNameRequest(Cursor Cursor, Nbytes uint16, Name string) []byte { size := pad((12 + pad((int(Nbytes) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 23 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Cursor)) b += 4 Put16(buf[b:], Nbytes) b += 2 b += 2 // padding copy(buf[b:], Name[:Nbytes]) b += pad(int(Nbytes)) return buf } // Request XfixesGetCursorName // size: 8 type XfixesGetCursorNameCookie struct { *cookie } func (c *Conn) XfixesGetCursorName(Cursor Cursor) XfixesGetCursorNameCookie { cookie := c.newCookie(true, true) c.newRequest(c.xfixesGetCursorNameRequest(Cursor), cookie) return XfixesGetCursorNameCookie{cookie} } func (c *Conn) XfixesGetCursorNameUnchecked(Cursor Cursor) XfixesGetCursorNameCookie { cookie := c.newCookie(false, true) c.newRequest(c.xfixesGetCursorNameRequest(Cursor), cookie) return XfixesGetCursorNameCookie{cookie} } // Request reply for XfixesGetCursorName // size: (32 + pad((int(Nbytes) * 1))) type XfixesGetCursorNameReply struct { Sequence uint16 Length uint32 // padding: 1 bytes Atom Atom Nbytes uint16 // padding: 18 bytes Name string // size: pad((int(Nbytes) * 1)) } // Waits and reads reply data from request XfixesGetCursorName func (cook XfixesGetCursorNameCookie) Reply() (*XfixesGetCursorNameReply, error) { buf, err := cook.reply() if err != nil { return nil, err } if buf == nil { return nil, nil } return xfixesGetCursorNameReply(buf), nil } // Read reply into structure from buffer for XfixesGetCursorName func xfixesGetCursorNameReply(buf []byte) *XfixesGetCursorNameReply { v := new(XfixesGetCursorNameReply) b := 1 // skip reply determinant b += 1 // padding v.Sequence = Get16(buf[b:]) b += 2 v.Length = Get32(buf[b:]) // 4-byte units b += 4 v.Atom = Atom(Get32(buf[b:])) b += 4 v.Nbytes = Get16(buf[b:]) b += 2 b += 18 // padding { byteString := make([]byte, v.Nbytes) copy(byteString[:v.Nbytes], buf[b:]) v.Name = string(byteString) b += pad(int(v.Nbytes)) } return v } func (cook XfixesGetCursorNameCookie) Check() error { return cook.check() } // Write request to wire for XfixesGetCursorName func (c *Conn) xfixesGetCursorNameRequest(Cursor Cursor) []byte { size := 8 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 24 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Cursor)) b += 4 return buf } // Request XfixesGetCursorImageAndName // size: 4 type XfixesGetCursorImageAndNameCookie struct { *cookie } func (c *Conn) XfixesGetCursorImageAndName() XfixesGetCursorImageAndNameCookie { cookie := c.newCookie(true, true) c.newRequest(c.xfixesGetCursorImageAndNameRequest(), cookie) return XfixesGetCursorImageAndNameCookie{cookie} } func (c *Conn) XfixesGetCursorImageAndNameUnchecked() XfixesGetCursorImageAndNameCookie { cookie := c.newCookie(false, true) c.newRequest(c.xfixesGetCursorImageAndNameRequest(), cookie) return XfixesGetCursorImageAndNameCookie{cookie} } // Request reply for XfixesGetCursorImageAndName // size: ((32 + pad((int(Nbytes) * 1))) + pad(((int(Width) * int(Height)) * 4))) type XfixesGetCursorImageAndNameReply struct { Sequence uint16 Length uint32 // padding: 1 bytes X int16 Y int16 Width uint16 Height uint16 Xhot uint16 Yhot uint16 CursorSerial uint32 CursorAtom Atom Nbytes uint16 // padding: 2 bytes Name string // size: pad((int(Nbytes) * 1)) CursorImage []uint32 // size: pad(((int(Width) * int(Height)) * 4)) } // Waits and reads reply data from request XfixesGetCursorImageAndName func (cook XfixesGetCursorImageAndNameCookie) Reply() (*XfixesGetCursorImageAndNameReply, error) { buf, err := cook.reply() if err != nil { return nil, err } if buf == nil { return nil, nil } return xfixesGetCursorImageAndNameReply(buf), nil } // Read reply into structure from buffer for XfixesGetCursorImageAndName func xfixesGetCursorImageAndNameReply(buf []byte) *XfixesGetCursorImageAndNameReply { v := new(XfixesGetCursorImageAndNameReply) b := 1 // skip reply determinant b += 1 // padding v.Sequence = Get16(buf[b:]) b += 2 v.Length = Get32(buf[b:]) // 4-byte units b += 4 v.X = int16(Get16(buf[b:])) b += 2 v.Y = int16(Get16(buf[b:])) b += 2 v.Width = Get16(buf[b:]) b += 2 v.Height = Get16(buf[b:]) b += 2 v.Xhot = Get16(buf[b:]) b += 2 v.Yhot = Get16(buf[b:]) b += 2 v.CursorSerial = Get32(buf[b:]) b += 4 v.CursorAtom = Atom(Get32(buf[b:])) b += 4 v.Nbytes = Get16(buf[b:]) b += 2 b += 2 // padding { byteString := make([]byte, v.Nbytes) copy(byteString[:v.Nbytes], buf[b:]) v.Name = string(byteString) b += pad(int(v.Nbytes)) } v.CursorImage = make([]uint32, (int(v.Width) * int(v.Height))) for i := 0; i < int((int(v.Width) * int(v.Height))); i++ { v.CursorImage[i] = Get32(buf[b:]) b += 4 } b = pad(b) return v } func (cook XfixesGetCursorImageAndNameCookie) Check() error { return cook.check() } // Write request to wire for XfixesGetCursorImageAndName func (c *Conn) xfixesGetCursorImageAndNameRequest() []byte { size := 4 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 25 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 return buf } // Request XfixesChangeCursor // size: 12 type XfixesChangeCursorCookie struct { *cookie } // Write request to wire for XfixesChangeCursor func (c *Conn) XfixesChangeCursor(Source Cursor, Destination Cursor) XfixesChangeCursorCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesChangeCursorRequest(Source, Destination), cookie) return XfixesChangeCursorCookie{cookie} } func (c *Conn) XfixesChangeCursorChecked(Source Cursor, Destination Cursor) XfixesChangeCursorCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesChangeCursorRequest(Source, Destination), cookie) return XfixesChangeCursorCookie{cookie} } func (cook XfixesChangeCursorCookie) Check() error { return cook.check() } // Write request to wire for XfixesChangeCursor func (c *Conn) xfixesChangeCursorRequest(Source Cursor, Destination Cursor) []byte { size := 12 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 26 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Source)) b += 4 Put32(buf[b:], uint32(Destination)) b += 4 return buf } // Request XfixesChangeCursorByName // size: pad((12 + pad((int(Nbytes) * 1)))) type XfixesChangeCursorByNameCookie struct { *cookie } // Write request to wire for XfixesChangeCursorByName func (c *Conn) XfixesChangeCursorByName(Src Cursor, Nbytes uint16, Name string) XfixesChangeCursorByNameCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesChangeCursorByNameRequest(Src, Nbytes, Name), cookie) return XfixesChangeCursorByNameCookie{cookie} } func (c *Conn) XfixesChangeCursorByNameChecked(Src Cursor, Nbytes uint16, Name string) XfixesChangeCursorByNameCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesChangeCursorByNameRequest(Src, Nbytes, Name), cookie) return XfixesChangeCursorByNameCookie{cookie} } func (cook XfixesChangeCursorByNameCookie) Check() error { return cook.check() } // Write request to wire for XfixesChangeCursorByName func (c *Conn) xfixesChangeCursorByNameRequest(Src Cursor, Nbytes uint16, Name string) []byte { size := pad((12 + pad((int(Nbytes) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 27 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Src)) b += 4 Put16(buf[b:], Nbytes) b += 2 b += 2 // padding copy(buf[b:], Name[:Nbytes]) b += pad(int(Nbytes)) return buf } // Request XfixesExpandRegion // size: 20 type XfixesExpandRegionCookie struct { *cookie } // Write request to wire for XfixesExpandRegion func (c *Conn) XfixesExpandRegion(Source XfixesRegion, Destination XfixesRegion, Left uint16, Right uint16, Top uint16, Bottom uint16) XfixesExpandRegionCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesExpandRegionRequest(Source, Destination, Left, Right, Top, Bottom), cookie) return XfixesExpandRegionCookie{cookie} } func (c *Conn) XfixesExpandRegionChecked(Source XfixesRegion, Destination XfixesRegion, Left uint16, Right uint16, Top uint16, Bottom uint16) XfixesExpandRegionCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesExpandRegionRequest(Source, Destination, Left, Right, Top, Bottom), cookie) return XfixesExpandRegionCookie{cookie} } func (cook XfixesExpandRegionCookie) Check() error { return cook.check() } // Write request to wire for XfixesExpandRegion func (c *Conn) xfixesExpandRegionRequest(Source XfixesRegion, Destination XfixesRegion, Left uint16, Right uint16, Top uint16, Bottom uint16) []byte { size := 20 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 28 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Source)) b += 4 Put32(buf[b:], uint32(Destination)) b += 4 Put16(buf[b:], Left) b += 2 Put16(buf[b:], Right) b += 2 Put16(buf[b:], Top) b += 2 Put16(buf[b:], Bottom) b += 2 return buf } // Request XfixesHideCursor // size: 8 type XfixesHideCursorCookie struct { *cookie } // Write request to wire for XfixesHideCursor func (c *Conn) XfixesHideCursor(Window Window) XfixesHideCursorCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesHideCursorRequest(Window), cookie) return XfixesHideCursorCookie{cookie} } func (c *Conn) XfixesHideCursorChecked(Window Window) XfixesHideCursorCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesHideCursorRequest(Window), cookie) return XfixesHideCursorCookie{cookie} } func (cook XfixesHideCursorCookie) Check() error { return cook.check() } // Write request to wire for XfixesHideCursor func (c *Conn) xfixesHideCursorRequest(Window Window) []byte { size := 8 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 29 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Window)) b += 4 return buf } // Request XfixesShowCursor // size: 8 type XfixesShowCursorCookie struct { *cookie } // Write request to wire for XfixesShowCursor func (c *Conn) XfixesShowCursor(Window Window) XfixesShowCursorCookie { cookie := c.newCookie(false, false) c.newRequest(c.xfixesShowCursorRequest(Window), cookie) return XfixesShowCursorCookie{cookie} } func (c *Conn) XfixesShowCursorChecked(Window Window) XfixesShowCursorCookie { cookie := c.newCookie(true, false) c.newRequest(c.xfixesShowCursorRequest(Window), cookie) return XfixesShowCursorCookie{cookie} } func (cook XfixesShowCursorCookie) Check() error { return cook.check() } // Write request to wire for XfixesShowCursor func (c *Conn) xfixesShowCursorRequest(Window Window) []byte { size := 8 b := 0 buf := make([]byte, size) buf[b] = c.extensions["XFIXES"] b += 1 buf[b] = 30 // request opcode b += 1 Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 Put32(buf[b:], uint32(Window)) b += 4 return buf }