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/xfixes/xfixes.go | 441 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 292 insertions(+), 149 deletions(-) (limited to 'nexgb/xfixes') diff --git a/nexgb/xfixes/xfixes.go b/nexgb/xfixes/xfixes.go index 3b6bbea..b5d9c14 100644 --- a/nexgb/xfixes/xfixes.go +++ b/nexgb/xfixes/xfixes.go @@ -2,7 +2,7 @@ package xfixes /* - This file was generated by xfixes.xml on May 10 2012 8:04:32pm EDT. + This file was generated by xfixes.xml on May 10 2012 11:56:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -42,16 +42,6 @@ func init() { xgb.NewExtErrorFuncs["XFIXES"] = 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' @@ -66,6 +56,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 ( SaveSetModeInsert = 0 SaveSetModeDelete = 1 @@ -115,9 +115,7 @@ func NewRegionId(c *xgb.Conn) (Region, error) { return Region(id), nil } -// Event definition SelectionNotify (0) -// Size: 32 - +// SelectionNotify is the event number for a SelectionNotifyEvent. const SelectionNotify = 0 type SelectionNotifyEvent struct { @@ -131,7 +129,7 @@ type SelectionNotifyEvent struct { // padding: 8 bytes } -// Event read SelectionNotify +// SelectionNotifyEventNew constructs a SelectionNotifyEvent value that implements xgb.Event from a byte slice. func SelectionNotifyEventNew(buf []byte) xgb.Event { v := SelectionNotifyEvent{} b := 1 // don't read event number @@ -162,7 +160,7 @@ func SelectionNotifyEventNew(buf []byte) xgb.Event { return v } -// Event write SelectionNotify +// Bytes writes a SelectionNotifyEvent value to a byte slice. func (v SelectionNotifyEvent) Bytes() []byte { buf := make([]byte, 32) b := 0 @@ -196,12 +194,14 @@ func (v SelectionNotifyEvent) Bytes() []byte { return buf } -func (v SelectionNotifyEvent) ImplementsEvent() {} - +// SequenceId returns the sequence id attached to the SelectionNotify event. +// Events without a sequence number (KeymapNotify) return 0. +// This is mostly used internally. func (v SelectionNotifyEvent) SequenceId() uint16 { return v.Sequence } +// String is a rudimentary string representation of SelectionNotifyEvent. func (v SelectionNotifyEvent) String() string { fieldVals := make([]string, 0, 7) fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) @@ -218,9 +218,7 @@ func init() { xgb.NewExtEventFuncs["XFIXES"][0] = SelectionNotifyEventNew } -// Event definition CursorNotify (1) -// Size: 32 - +// CursorNotify is the event number for a CursorNotifyEvent. const CursorNotify = 1 type CursorNotifyEvent struct { @@ -233,7 +231,7 @@ type CursorNotifyEvent struct { // padding: 12 bytes } -// Event read CursorNotify +// CursorNotifyEventNew constructs a CursorNotifyEvent value that implements xgb.Event from a byte slice. func CursorNotifyEventNew(buf []byte) xgb.Event { v := CursorNotifyEvent{} b := 1 // don't read event number @@ -261,7 +259,7 @@ func CursorNotifyEventNew(buf []byte) xgb.Event { return v } -// Event write CursorNotify +// Bytes writes a CursorNotifyEvent value to a byte slice. func (v CursorNotifyEvent) Bytes() []byte { buf := make([]byte, 32) b := 0 @@ -292,12 +290,14 @@ func (v CursorNotifyEvent) Bytes() []byte { return buf } -func (v CursorNotifyEvent) ImplementsEvent() {} - +// SequenceId returns the sequence id attached to the CursorNotify event. +// Events without a sequence number (KeymapNotify) return 0. +// This is mostly used internally. func (v CursorNotifyEvent) SequenceId() uint16 { return v.Sequence } +// String is a rudimentary string representation of CursorNotifyEvent. func (v CursorNotifyEvent) String() string { fieldVals := make([]string, 0, 6) fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) @@ -313,9 +313,7 @@ func init() { xgb.NewExtEventFuncs["XFIXES"][1] = CursorNotifyEventNew } -// Error definition BadRegion (0) -// Size: 32 - +// BadBadRegion is the error number for a BadBadRegion. const BadBadRegion = 0 type BadRegionError struct { @@ -323,7 +321,7 @@ type BadRegionError struct { NiceName string } -// Error read BadRegion +// BadRegionErrorNew constructs a BadRegionError value that implements xgb.Error from a byte slice. func BadRegionErrorNew(buf []byte) xgb.Error { v := BadRegionError{} v.NiceName = "BadRegion" @@ -337,8 +335,8 @@ func BadRegionErrorNew(buf []byte) xgb.Error { return v } -func (err BadRegionError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadBadRegion error. +// This is mostly used internally. func (err BadRegionError) SequenceId() uint16 { return err.Sequence } @@ -358,36 +356,38 @@ func init() { xgb.NewExtErrorFuncs["XFIXES"][0] = BadRegionErrorNew } -// Request QueryVersion -// size: 12 +// QueryVersionCookie is a cookie used only for QueryVersion requests. type QueryVersionCookie struct { *xgb.Cookie } +// QueryVersion sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} } +// QueryVersionUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} } -// Request reply for QueryVersion -// size: 32 +// QueryVersionReply represents the data returned from a QueryVersion request. type QueryVersionReply 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 uint32 MinorVersion uint32 // padding: 16 bytes } -// Waits and reads reply data from request QueryVersion +// Reply blocks and returns the reply data for a QueryVersion request. func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -399,7 +399,7 @@ func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { return queryVersionReply(buf), nil } -// Read reply into structure from buffer for QueryVersion +// queryVersionReply reads a byte slice into a QueryVersionReply value. func queryVersionReply(buf []byte) *QueryVersionReply { v := new(QueryVersionReply) b := 1 // skip reply determinant @@ -424,6 +424,7 @@ func queryVersionReply(buf []byte) *QueryVersionReply { } // Write request to wire for QueryVersion +// queryVersionRequest writes a QueryVersion request to a byte slice. func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { size := 12 b := 0 @@ -447,30 +448,35 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers return buf } -// Request ChangeSaveSet -// size: 12 +// ChangeSaveSetCookie is a cookie used only for ChangeSaveSet requests. type ChangeSaveSetCookie struct { *xgb.Cookie } -// Write request to wire for ChangeSaveSet +// ChangeSaveSet sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangeSaveSet(c *xgb.Conn, Mode byte, Target byte, Map byte, Window xproto.Window) ChangeSaveSetCookie { cookie := c.NewCookie(false, false) c.NewRequest(changeSaveSetRequest(c, Mode, Target, Map, Window), cookie) return ChangeSaveSetCookie{cookie} } +// ChangeSaveSetChecked sends a checked request. +// If an error occurs, it can be retrieved using ChangeSaveSetCookie.Check() func ChangeSaveSetChecked(c *xgb.Conn, Mode byte, Target byte, Map byte, Window xproto.Window) ChangeSaveSetCookie { cookie := c.NewCookie(true, false) c.NewRequest(changeSaveSetRequest(c, Mode, Target, Map, Window), cookie) return ChangeSaveSetCookie{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 ChangeSaveSetCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for ChangeSaveSet +// changeSaveSetRequest writes a ChangeSaveSet request to a byte slice. func changeSaveSetRequest(c *xgb.Conn, Mode byte, Target byte, Map byte, Window xproto.Window) []byte { size := 12 b := 0 @@ -502,30 +508,35 @@ func changeSaveSetRequest(c *xgb.Conn, Mode byte, Target byte, Map byte, Window return buf } -// Request SelectSelectionInput -// size: 16 +// SelectSelectionInputCookie is a cookie used only for SelectSelectionInput requests. type SelectSelectionInputCookie struct { *xgb.Cookie } -// Write request to wire for SelectSelectionInput +// SelectSelectionInput sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectSelectionInput(c *xgb.Conn, Window xproto.Window, Selection xproto.Atom, EventMask uint32) SelectSelectionInputCookie { cookie := c.NewCookie(false, false) c.NewRequest(selectSelectionInputRequest(c, Window, Selection, EventMask), cookie) return SelectSelectionInputCookie{cookie} } +// SelectSelectionInputChecked sends a checked request. +// If an error occurs, it can be retrieved using SelectSelectionInputCookie.Check() func SelectSelectionInputChecked(c *xgb.Conn, Window xproto.Window, Selection xproto.Atom, EventMask uint32) SelectSelectionInputCookie { cookie := c.NewCookie(true, false) c.NewRequest(selectSelectionInputRequest(c, Window, Selection, EventMask), cookie) return SelectSelectionInputCookie{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 SelectSelectionInputCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SelectSelectionInput +// selectSelectionInputRequest writes a SelectSelectionInput request to a byte slice. func selectSelectionInputRequest(c *xgb.Conn, Window xproto.Window, Selection xproto.Atom, EventMask uint32) []byte { size := 16 b := 0 @@ -552,30 +563,35 @@ func selectSelectionInputRequest(c *xgb.Conn, Window xproto.Window, Selection xp return buf } -// Request SelectCursorInput -// size: 12 +// SelectCursorInputCookie is a cookie used only for SelectCursorInput requests. type SelectCursorInputCookie struct { *xgb.Cookie } -// Write request to wire for SelectCursorInput +// SelectCursorInput sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectCursorInput(c *xgb.Conn, Window xproto.Window, EventMask uint32) SelectCursorInputCookie { cookie := c.NewCookie(false, false) c.NewRequest(selectCursorInputRequest(c, Window, EventMask), cookie) return SelectCursorInputCookie{cookie} } +// SelectCursorInputChecked sends a checked request. +// If an error occurs, it can be retrieved using SelectCursorInputCookie.Check() func SelectCursorInputChecked(c *xgb.Conn, Window xproto.Window, EventMask uint32) SelectCursorInputCookie { cookie := c.NewCookie(true, false) c.NewRequest(selectCursorInputRequest(c, Window, EventMask), cookie) return SelectCursorInputCookie{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 SelectCursorInputCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SelectCursorInput +// selectCursorInputRequest writes a SelectCursorInput request to a byte slice. func selectCursorInputRequest(c *xgb.Conn, Window xproto.Window, EventMask uint32) []byte { size := 12 b := 0 @@ -599,29 +615,31 @@ func selectCursorInputRequest(c *xgb.Conn, Window xproto.Window, EventMask uint3 return buf } -// Request GetCursorImage -// size: 4 +// GetCursorImageCookie is a cookie used only for GetCursorImage requests. type GetCursorImageCookie struct { *xgb.Cookie } +// GetCursorImage sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetCursorImageCookie.Reply() func GetCursorImage(c *xgb.Conn) GetCursorImageCookie { cookie := c.NewCookie(true, true) c.NewRequest(getCursorImageRequest(c), cookie) return GetCursorImageCookie{cookie} } +// GetCursorImageUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCursorImageUnchecked(c *xgb.Conn) GetCursorImageCookie { cookie := c.NewCookie(false, true) c.NewRequest(getCursorImageRequest(c), cookie) return GetCursorImageCookie{cookie} } -// Request reply for GetCursorImage -// size: (32 + xgb.Pad(((int(Width) * int(Height)) * 4))) +// GetCursorImageReply represents the data returned from a GetCursorImage request. type GetCursorImageReply 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 X int16 Y int16 @@ -634,7 +652,7 @@ type GetCursorImageReply struct { CursorImage []uint32 // size: xgb.Pad(((int(Width) * int(Height)) * 4)) } -// Waits and reads reply data from request GetCursorImage +// Reply blocks and returns the reply data for a GetCursorImage request. func (cook GetCursorImageCookie) Reply() (*GetCursorImageReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -646,7 +664,7 @@ func (cook GetCursorImageCookie) Reply() (*GetCursorImageReply, error) { return getCursorImageReply(buf), nil } -// Read reply into structure from buffer for GetCursorImage +// getCursorImageReply reads a byte slice into a GetCursorImageReply value. func getCursorImageReply(buf []byte) *GetCursorImageReply { v := new(GetCursorImageReply) b := 1 // skip reply determinant @@ -693,6 +711,7 @@ func getCursorImageReply(buf []byte) *GetCursorImageReply { } // Write request to wire for GetCursorImage +// getCursorImageRequest writes a GetCursorImage request to a byte slice. func getCursorImageRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -710,30 +729,35 @@ func getCursorImageRequest(c *xgb.Conn) []byte { return buf } -// Request CreateRegion -// size: xgb.Pad((8 + xgb.Pad((len(Rectangles) * 8)))) +// CreateRegionCookie is a cookie used only for CreateRegion requests. type CreateRegionCookie struct { *xgb.Cookie } -// Write request to wire for CreateRegion +// CreateRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegion(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) CreateRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(createRegionRequest(c, Region, Rectangles), cookie) return CreateRegionCookie{cookie} } +// CreateRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateRegionCookie.Check() func CreateRegionChecked(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) CreateRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(createRegionRequest(c, Region, Rectangles), cookie) return CreateRegionCookie{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 CreateRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateRegion +// createRegionRequest writes a CreateRegion request to a byte slice. func createRegionRequest(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) []byte { size := xgb.Pad((8 + xgb.Pad((len(Rectangles) * 8)))) b := 0 @@ -756,30 +780,35 @@ func createRegionRequest(c *xgb.Conn, Region Region, Rectangles []xproto.Rectang return buf } -// Request CreateRegionFromBitmap -// size: 12 +// CreateRegionFromBitmapCookie is a cookie used only for CreateRegionFromBitmap requests. type CreateRegionFromBitmapCookie struct { *xgb.Cookie } -// Write request to wire for CreateRegionFromBitmap +// CreateRegionFromBitmap sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegionFromBitmap(c *xgb.Conn, Region Region, Bitmap xproto.Pixmap) CreateRegionFromBitmapCookie { cookie := c.NewCookie(false, false) c.NewRequest(createRegionFromBitmapRequest(c, Region, Bitmap), cookie) return CreateRegionFromBitmapCookie{cookie} } +// CreateRegionFromBitmapChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateRegionFromBitmapCookie.Check() func CreateRegionFromBitmapChecked(c *xgb.Conn, Region Region, Bitmap xproto.Pixmap) CreateRegionFromBitmapCookie { cookie := c.NewCookie(true, false) c.NewRequest(createRegionFromBitmapRequest(c, Region, Bitmap), cookie) return CreateRegionFromBitmapCookie{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 CreateRegionFromBitmapCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateRegionFromBitmap +// createRegionFromBitmapRequest writes a CreateRegionFromBitmap request to a byte slice. func createRegionFromBitmapRequest(c *xgb.Conn, Region Region, Bitmap xproto.Pixmap) []byte { size := 12 b := 0 @@ -803,30 +832,35 @@ func createRegionFromBitmapRequest(c *xgb.Conn, Region Region, Bitmap xproto.Pix return buf } -// Request CreateRegionFromWindow -// size: 16 +// CreateRegionFromWindowCookie is a cookie used only for CreateRegionFromWindow requests. type CreateRegionFromWindowCookie struct { *xgb.Cookie } -// Write request to wire for CreateRegionFromWindow +// CreateRegionFromWindow sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegionFromWindow(c *xgb.Conn, Region Region, Window xproto.Window, Kind shape.Kind) CreateRegionFromWindowCookie { cookie := c.NewCookie(false, false) c.NewRequest(createRegionFromWindowRequest(c, Region, Window, Kind), cookie) return CreateRegionFromWindowCookie{cookie} } +// CreateRegionFromWindowChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateRegionFromWindowCookie.Check() func CreateRegionFromWindowChecked(c *xgb.Conn, Region Region, Window xproto.Window, Kind shape.Kind) CreateRegionFromWindowCookie { cookie := c.NewCookie(true, false) c.NewRequest(createRegionFromWindowRequest(c, Region, Window, Kind), cookie) return CreateRegionFromWindowCookie{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 CreateRegionFromWindowCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateRegionFromWindow +// createRegionFromWindowRequest writes a CreateRegionFromWindow request to a byte slice. func createRegionFromWindowRequest(c *xgb.Conn, Region Region, Window xproto.Window, Kind shape.Kind) []byte { size := 16 b := 0 @@ -855,30 +889,35 @@ func createRegionFromWindowRequest(c *xgb.Conn, Region Region, Window xproto.Win return buf } -// Request CreateRegionFromGC -// size: 12 +// CreateRegionFromGCCookie is a cookie used only for CreateRegionFromGC requests. type CreateRegionFromGCCookie struct { *xgb.Cookie } -// Write request to wire for CreateRegionFromGC +// CreateRegionFromGC sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegionFromGC(c *xgb.Conn, Region Region, Gc xproto.Gcontext) CreateRegionFromGCCookie { cookie := c.NewCookie(false, false) c.NewRequest(createRegionFromGCRequest(c, Region, Gc), cookie) return CreateRegionFromGCCookie{cookie} } +// CreateRegionFromGCChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateRegionFromGCCookie.Check() func CreateRegionFromGCChecked(c *xgb.Conn, Region Region, Gc xproto.Gcontext) CreateRegionFromGCCookie { cookie := c.NewCookie(true, false) c.NewRequest(createRegionFromGCRequest(c, Region, Gc), cookie) return CreateRegionFromGCCookie{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 CreateRegionFromGCCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateRegionFromGC +// createRegionFromGCRequest writes a CreateRegionFromGC request to a byte slice. func createRegionFromGCRequest(c *xgb.Conn, Region Region, Gc xproto.Gcontext) []byte { size := 12 b := 0 @@ -902,30 +941,35 @@ func createRegionFromGCRequest(c *xgb.Conn, Region Region, Gc xproto.Gcontext) [ return buf } -// Request CreateRegionFromPicture -// size: 12 +// CreateRegionFromPictureCookie is a cookie used only for CreateRegionFromPicture requests. type CreateRegionFromPictureCookie struct { *xgb.Cookie } -// Write request to wire for CreateRegionFromPicture +// CreateRegionFromPicture sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRegionFromPicture(c *xgb.Conn, Region Region, Picture render.Picture) CreateRegionFromPictureCookie { cookie := c.NewCookie(false, false) c.NewRequest(createRegionFromPictureRequest(c, Region, Picture), cookie) return CreateRegionFromPictureCookie{cookie} } +// CreateRegionFromPictureChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateRegionFromPictureCookie.Check() func CreateRegionFromPictureChecked(c *xgb.Conn, Region Region, Picture render.Picture) CreateRegionFromPictureCookie { cookie := c.NewCookie(true, false) c.NewRequest(createRegionFromPictureRequest(c, Region, Picture), cookie) return CreateRegionFromPictureCookie{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 CreateRegionFromPictureCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateRegionFromPicture +// createRegionFromPictureRequest writes a CreateRegionFromPicture request to a byte slice. func createRegionFromPictureRequest(c *xgb.Conn, Region Region, Picture render.Picture) []byte { size := 12 b := 0 @@ -949,30 +993,35 @@ func createRegionFromPictureRequest(c *xgb.Conn, Region Region, Picture render.P return buf } -// Request DestroyRegion -// size: 8 +// DestroyRegionCookie is a cookie used only for DestroyRegion requests. type DestroyRegionCookie struct { *xgb.Cookie } -// Write request to wire for DestroyRegion +// DestroyRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyRegion(c *xgb.Conn, Region Region) DestroyRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(destroyRegionRequest(c, Region), cookie) return DestroyRegionCookie{cookie} } +// DestroyRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using DestroyRegionCookie.Check() func DestroyRegionChecked(c *xgb.Conn, Region Region) DestroyRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(destroyRegionRequest(c, Region), cookie) return DestroyRegionCookie{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 DestroyRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for DestroyRegion +// destroyRegionRequest writes a DestroyRegion request to a byte slice. func destroyRegionRequest(c *xgb.Conn, Region Region) []byte { size := 8 b := 0 @@ -993,30 +1042,35 @@ func destroyRegionRequest(c *xgb.Conn, Region Region) []byte { return buf } -// Request SetRegion -// size: xgb.Pad((8 + xgb.Pad((len(Rectangles) * 8)))) +// SetRegionCookie is a cookie used only for SetRegion requests. type SetRegionCookie struct { *xgb.Cookie } -// Write request to wire for SetRegion +// SetRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetRegion(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) SetRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(setRegionRequest(c, Region, Rectangles), cookie) return SetRegionCookie{cookie} } +// SetRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using SetRegionCookie.Check() func SetRegionChecked(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) SetRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(setRegionRequest(c, Region, Rectangles), cookie) return SetRegionCookie{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 SetRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetRegion +// setRegionRequest writes a SetRegion request to a byte slice. func setRegionRequest(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) []byte { size := xgb.Pad((8 + xgb.Pad((len(Rectangles) * 8)))) b := 0 @@ -1039,30 +1093,35 @@ func setRegionRequest(c *xgb.Conn, Region Region, Rectangles []xproto.Rectangle) return buf } -// Request CopyRegion -// size: 12 +// CopyRegionCookie is a cookie used only for CopyRegion requests. type CopyRegionCookie struct { *xgb.Cookie } -// Write request to wire for CopyRegion +// CopyRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CopyRegion(c *xgb.Conn, Source Region, Destination Region) CopyRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(copyRegionRequest(c, Source, Destination), cookie) return CopyRegionCookie{cookie} } +// CopyRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using CopyRegionCookie.Check() func CopyRegionChecked(c *xgb.Conn, Source Region, Destination Region) CopyRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(copyRegionRequest(c, Source, Destination), cookie) return CopyRegionCookie{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 CopyRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CopyRegion +// copyRegionRequest writes a CopyRegion request to a byte slice. func copyRegionRequest(c *xgb.Conn, Source Region, Destination Region) []byte { size := 12 b := 0 @@ -1086,30 +1145,35 @@ func copyRegionRequest(c *xgb.Conn, Source Region, Destination Region) []byte { return buf } -// Request UnionRegion -// size: 16 +// UnionRegionCookie is a cookie used only for UnionRegion requests. type UnionRegionCookie struct { *xgb.Cookie } -// Write request to wire for UnionRegion +// UnionRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnionRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) UnionRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(unionRegionRequest(c, Source1, Source2, Destination), cookie) return UnionRegionCookie{cookie} } +// UnionRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using UnionRegionCookie.Check() func UnionRegionChecked(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) UnionRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(unionRegionRequest(c, Source1, Source2, Destination), cookie) return UnionRegionCookie{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 UnionRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for UnionRegion +// unionRegionRequest writes a UnionRegion request to a byte slice. func unionRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) []byte { size := 16 b := 0 @@ -1136,30 +1200,35 @@ func unionRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destination return buf } -// Request IntersectRegion -// size: 16 +// IntersectRegionCookie is a cookie used only for IntersectRegion requests. type IntersectRegionCookie struct { *xgb.Cookie } -// Write request to wire for IntersectRegion +// IntersectRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func IntersectRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) IntersectRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(intersectRegionRequest(c, Source1, Source2, Destination), cookie) return IntersectRegionCookie{cookie} } +// IntersectRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using IntersectRegionCookie.Check() func IntersectRegionChecked(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) IntersectRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(intersectRegionRequest(c, Source1, Source2, Destination), cookie) return IntersectRegionCookie{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 IntersectRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for IntersectRegion +// intersectRegionRequest writes a IntersectRegion request to a byte slice. func intersectRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) []byte { size := 16 b := 0 @@ -1186,30 +1255,35 @@ func intersectRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destina return buf } -// Request SubtractRegion -// size: 16 +// SubtractRegionCookie is a cookie used only for SubtractRegion requests. type SubtractRegionCookie struct { *xgb.Cookie } -// Write request to wire for SubtractRegion +// SubtractRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SubtractRegion(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) SubtractRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(subtractRegionRequest(c, Source1, Source2, Destination), cookie) return SubtractRegionCookie{cookie} } +// SubtractRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using SubtractRegionCookie.Check() func SubtractRegionChecked(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) SubtractRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(subtractRegionRequest(c, Source1, Source2, Destination), cookie) return SubtractRegionCookie{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 SubtractRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SubtractRegion +// subtractRegionRequest writes a SubtractRegion request to a byte slice. func subtractRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destination Region) []byte { size := 16 b := 0 @@ -1236,30 +1310,35 @@ func subtractRegionRequest(c *xgb.Conn, Source1 Region, Source2 Region, Destinat return buf } -// Request InvertRegion -// size: 20 +// InvertRegionCookie is a cookie used only for InvertRegion requests. type InvertRegionCookie struct { *xgb.Cookie } -// Write request to wire for InvertRegion +// InvertRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func InvertRegion(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, Destination Region) InvertRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(invertRegionRequest(c, Source, Bounds, Destination), cookie) return InvertRegionCookie{cookie} } +// InvertRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using InvertRegionCookie.Check() func InvertRegionChecked(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, Destination Region) InvertRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(invertRegionRequest(c, Source, Bounds, Destination), cookie) return InvertRegionCookie{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 InvertRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for InvertRegion +// invertRegionRequest writes a InvertRegion request to a byte slice. func invertRegionRequest(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, Destination Region) []byte { size := 20 b := 0 @@ -1289,30 +1368,35 @@ func invertRegionRequest(c *xgb.Conn, Source Region, Bounds xproto.Rectangle, De return buf } -// Request TranslateRegion -// size: 12 +// TranslateRegionCookie is a cookie used only for TranslateRegion requests. type TranslateRegionCookie struct { *xgb.Cookie } -// Write request to wire for TranslateRegion +// TranslateRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TranslateRegion(c *xgb.Conn, Region Region, Dx int16, Dy int16) TranslateRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(translateRegionRequest(c, Region, Dx, Dy), cookie) return TranslateRegionCookie{cookie} } +// TranslateRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using TranslateRegionCookie.Check() func TranslateRegionChecked(c *xgb.Conn, Region Region, Dx int16, Dy int16) TranslateRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(translateRegionRequest(c, Region, Dx, Dy), cookie) return TranslateRegionCookie{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 TranslateRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for TranslateRegion +// translateRegionRequest writes a TranslateRegion request to a byte slice. func translateRegionRequest(c *xgb.Conn, Region Region, Dx int16, Dy int16) []byte { size := 12 b := 0 @@ -1339,30 +1423,35 @@ func translateRegionRequest(c *xgb.Conn, Region Region, Dx int16, Dy int16) []by return buf } -// Request RegionExtents -// size: 12 +// RegionExtentsCookie is a cookie used only for RegionExtents requests. type RegionExtentsCookie struct { *xgb.Cookie } -// Write request to wire for RegionExtents +// RegionExtents sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RegionExtents(c *xgb.Conn, Source Region, Destination Region) RegionExtentsCookie { cookie := c.NewCookie(false, false) c.NewRequest(regionExtentsRequest(c, Source, Destination), cookie) return RegionExtentsCookie{cookie} } +// RegionExtentsChecked sends a checked request. +// If an error occurs, it can be retrieved using RegionExtentsCookie.Check() func RegionExtentsChecked(c *xgb.Conn, Source Region, Destination Region) RegionExtentsCookie { cookie := c.NewCookie(true, false) c.NewRequest(regionExtentsRequest(c, Source, Destination), cookie) return RegionExtentsCookie{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 RegionExtentsCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for RegionExtents +// regionExtentsRequest writes a RegionExtents request to a byte slice. func regionExtentsRequest(c *xgb.Conn, Source Region, Destination Region) []byte { size := 12 b := 0 @@ -1386,36 +1475,38 @@ func regionExtentsRequest(c *xgb.Conn, Source Region, Destination Region) []byte return buf } -// Request FetchRegion -// size: 8 +// FetchRegionCookie is a cookie used only for FetchRegion requests. type FetchRegionCookie struct { *xgb.Cookie } +// FetchRegion sends a checked request. +// If an error occurs, it will be returned with the reply by calling FetchRegionCookie.Reply() func FetchRegion(c *xgb.Conn, Region Region) FetchRegionCookie { cookie := c.NewCookie(true, true) c.NewRequest(fetchRegionRequest(c, Region), cookie) return FetchRegionCookie{cookie} } +// FetchRegionUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FetchRegionUnchecked(c *xgb.Conn, Region Region) FetchRegionCookie { cookie := c.NewCookie(false, true) c.NewRequest(fetchRegionRequest(c, Region), cookie) return FetchRegionCookie{cookie} } -// Request reply for FetchRegion -// size: (32 + xgb.Pad(((int(Length) / 2) * 8))) +// FetchRegionReply represents the data returned from a FetchRegion request. type FetchRegionReply 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 Extents xproto.Rectangle // padding: 16 bytes Rectangles []xproto.Rectangle // size: xgb.Pad(((int(Length) / 2) * 8)) } -// Waits and reads reply data from request FetchRegion +// Reply blocks and returns the reply data for a FetchRegion request. func (cook FetchRegionCookie) Reply() (*FetchRegionReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1427,7 +1518,7 @@ func (cook FetchRegionCookie) Reply() (*FetchRegionReply, error) { return fetchRegionReply(buf), nil } -// Read reply into structure from buffer for FetchRegion +// fetchRegionReply reads a byte slice into a FetchRegionReply value. func fetchRegionReply(buf []byte) *FetchRegionReply { v := new(FetchRegionReply) b := 1 // skip reply determinant @@ -1452,6 +1543,7 @@ func fetchRegionReply(buf []byte) *FetchRegionReply { } // Write request to wire for FetchRegion +// fetchRegionRequest writes a FetchRegion request to a byte slice. func fetchRegionRequest(c *xgb.Conn, Region Region) []byte { size := 8 b := 0 @@ -1472,30 +1564,35 @@ func fetchRegionRequest(c *xgb.Conn, Region Region) []byte { return buf } -// Request SetGCClipRegion -// size: 16 +// SetGCClipRegionCookie is a cookie used only for SetGCClipRegion requests. type SetGCClipRegionCookie struct { *xgb.Cookie } -// Write request to wire for SetGCClipRegion +// SetGCClipRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetGCClipRegion(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOrigin int16, YOrigin int16) SetGCClipRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(setGCClipRegionRequest(c, Gc, Region, XOrigin, YOrigin), cookie) return SetGCClipRegionCookie{cookie} } +// SetGCClipRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using SetGCClipRegionCookie.Check() func SetGCClipRegionChecked(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOrigin int16, YOrigin int16) SetGCClipRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(setGCClipRegionRequest(c, Gc, Region, XOrigin, YOrigin), cookie) return SetGCClipRegionCookie{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 SetGCClipRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetGCClipRegion +// setGCClipRegionRequest writes a SetGCClipRegion request to a byte slice. func setGCClipRegionRequest(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOrigin int16, YOrigin int16) []byte { size := 16 b := 0 @@ -1525,30 +1622,35 @@ func setGCClipRegionRequest(c *xgb.Conn, Gc xproto.Gcontext, Region Region, XOri return buf } -// Request SetWindowShapeRegion -// size: 20 +// SetWindowShapeRegionCookie is a cookie used only for SetWindowShapeRegion requests. type SetWindowShapeRegionCookie struct { *xgb.Cookie } -// Write request to wire for SetWindowShapeRegion +// SetWindowShapeRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetWindowShapeRegion(c *xgb.Conn, Dest xproto.Window, DestKind shape.Kind, XOffset int16, YOffset int16, Region Region) SetWindowShapeRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(setWindowShapeRegionRequest(c, Dest, DestKind, XOffset, YOffset, Region), cookie) return SetWindowShapeRegionCookie{cookie} } +// SetWindowShapeRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using SetWindowShapeRegionCookie.Check() func SetWindowShapeRegionChecked(c *xgb.Conn, Dest xproto.Window, DestKind shape.Kind, XOffset int16, YOffset int16, Region Region) SetWindowShapeRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(setWindowShapeRegionRequest(c, Dest, DestKind, XOffset, YOffset, Region), cookie) return SetWindowShapeRegionCookie{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 SetWindowShapeRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetWindowShapeRegion +// setWindowShapeRegionRequest writes a SetWindowShapeRegion request to a byte slice. func setWindowShapeRegionRequest(c *xgb.Conn, Dest xproto.Window, DestKind shape.Kind, XOffset int16, YOffset int16, Region Region) []byte { size := 20 b := 0 @@ -1583,30 +1685,35 @@ func setWindowShapeRegionRequest(c *xgb.Conn, Dest xproto.Window, DestKind shape return buf } -// Request SetPictureClipRegion -// size: 16 +// SetPictureClipRegionCookie is a cookie used only for SetPictureClipRegion requests. type SetPictureClipRegionCookie struct { *xgb.Cookie } -// Write request to wire for SetPictureClipRegion +// SetPictureClipRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureClipRegion(c *xgb.Conn, Picture render.Picture, Region Region, XOrigin int16, YOrigin int16) SetPictureClipRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(setPictureClipRegionRequest(c, Picture, Region, XOrigin, YOrigin), cookie) return SetPictureClipRegionCookie{cookie} } +// SetPictureClipRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using SetPictureClipRegionCookie.Check() func SetPictureClipRegionChecked(c *xgb.Conn, Picture render.Picture, Region Region, XOrigin int16, YOrigin int16) SetPictureClipRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(setPictureClipRegionRequest(c, Picture, Region, XOrigin, YOrigin), cookie) return SetPictureClipRegionCookie{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 SetPictureClipRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetPictureClipRegion +// setPictureClipRegionRequest writes a SetPictureClipRegion request to a byte slice. func setPictureClipRegionRequest(c *xgb.Conn, Picture render.Picture, Region Region, XOrigin int16, YOrigin int16) []byte { size := 16 b := 0 @@ -1636,30 +1743,35 @@ func setPictureClipRegionRequest(c *xgb.Conn, Picture render.Picture, Region Reg return buf } -// Request SetCursorName -// size: xgb.Pad((12 + xgb.Pad((int(Nbytes) * 1)))) +// SetCursorNameCookie is a cookie used only for SetCursorName requests. type SetCursorNameCookie struct { *xgb.Cookie } -// Write request to wire for SetCursorName +// SetCursorName sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetCursorName(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name string) SetCursorNameCookie { cookie := c.NewCookie(false, false) c.NewRequest(setCursorNameRequest(c, Cursor, Nbytes, Name), cookie) return SetCursorNameCookie{cookie} } +// SetCursorNameChecked sends a checked request. +// If an error occurs, it can be retrieved using SetCursorNameCookie.Check() func SetCursorNameChecked(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name string) SetCursorNameCookie { cookie := c.NewCookie(true, false) c.NewRequest(setCursorNameRequest(c, Cursor, Nbytes, Name), cookie) return SetCursorNameCookie{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 SetCursorNameCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetCursorName +// setCursorNameRequest writes a SetCursorName request to a byte slice. func setCursorNameRequest(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name string) []byte { size := xgb.Pad((12 + xgb.Pad((int(Nbytes) * 1)))) b := 0 @@ -1688,29 +1800,31 @@ func setCursorNameRequest(c *xgb.Conn, Cursor xproto.Cursor, Nbytes uint16, Name return buf } -// Request GetCursorName -// size: 8 +// GetCursorNameCookie is a cookie used only for GetCursorName requests. type GetCursorNameCookie struct { *xgb.Cookie } +// GetCursorName sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetCursorNameCookie.Reply() func GetCursorName(c *xgb.Conn, Cursor xproto.Cursor) GetCursorNameCookie { cookie := c.NewCookie(true, true) c.NewRequest(getCursorNameRequest(c, Cursor), cookie) return GetCursorNameCookie{cookie} } +// GetCursorNameUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCursorNameUnchecked(c *xgb.Conn, Cursor xproto.Cursor) GetCursorNameCookie { cookie := c.NewCookie(false, true) c.NewRequest(getCursorNameRequest(c, Cursor), cookie) return GetCursorNameCookie{cookie} } -// Request reply for GetCursorName -// size: (32 + xgb.Pad((int(Nbytes) * 1))) +// GetCursorNameReply represents the data returned from a GetCursorName request. type GetCursorNameReply 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 Atom xproto.Atom Nbytes uint16 @@ -1718,7 +1832,7 @@ type GetCursorNameReply struct { Name string // size: xgb.Pad((int(Nbytes) * 1)) } -// Waits and reads reply data from request GetCursorName +// Reply blocks and returns the reply data for a GetCursorName request. func (cook GetCursorNameCookie) Reply() (*GetCursorNameReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1730,7 +1844,7 @@ func (cook GetCursorNameCookie) Reply() (*GetCursorNameReply, error) { return getCursorNameReply(buf), nil } -// Read reply into structure from buffer for GetCursorName +// getCursorNameReply reads a byte slice into a GetCursorNameReply value. func getCursorNameReply(buf []byte) *GetCursorNameReply { v := new(GetCursorNameReply) b := 1 // skip reply determinant @@ -1762,6 +1876,7 @@ func getCursorNameReply(buf []byte) *GetCursorNameReply { } // Write request to wire for GetCursorName +// getCursorNameRequest writes a GetCursorName request to a byte slice. func getCursorNameRequest(c *xgb.Conn, Cursor xproto.Cursor) []byte { size := 8 b := 0 @@ -1782,29 +1897,31 @@ func getCursorNameRequest(c *xgb.Conn, Cursor xproto.Cursor) []byte { return buf } -// Request GetCursorImageAndName -// size: 4 +// GetCursorImageAndNameCookie is a cookie used only for GetCursorImageAndName requests. type GetCursorImageAndNameCookie struct { *xgb.Cookie } +// GetCursorImageAndName sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetCursorImageAndNameCookie.Reply() func GetCursorImageAndName(c *xgb.Conn) GetCursorImageAndNameCookie { cookie := c.NewCookie(true, true) c.NewRequest(getCursorImageAndNameRequest(c), cookie) return GetCursorImageAndNameCookie{cookie} } +// GetCursorImageAndNameUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetCursorImageAndNameUnchecked(c *xgb.Conn) GetCursorImageAndNameCookie { cookie := c.NewCookie(false, true) c.NewRequest(getCursorImageAndNameRequest(c), cookie) return GetCursorImageAndNameCookie{cookie} } -// Request reply for GetCursorImageAndName -// size: ((32 + xgb.Pad((int(Nbytes) * 1))) + xgb.Pad(((int(Width) * int(Height)) * 4))) +// GetCursorImageAndNameReply represents the data returned from a GetCursorImageAndName request. type GetCursorImageAndNameReply 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 X int16 Y int16 @@ -1820,7 +1937,7 @@ type GetCursorImageAndNameReply struct { CursorImage []uint32 // size: xgb.Pad(((int(Width) * int(Height)) * 4)) } -// Waits and reads reply data from request GetCursorImageAndName +// Reply blocks and returns the reply data for a GetCursorImageAndName request. func (cook GetCursorImageAndNameCookie) Reply() (*GetCursorImageAndNameReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1832,7 +1949,7 @@ func (cook GetCursorImageAndNameCookie) Reply() (*GetCursorImageAndNameReply, er return getCursorImageAndNameReply(buf), nil } -// Read reply into structure from buffer for GetCursorImageAndName +// getCursorImageAndNameReply reads a byte slice into a GetCursorImageAndNameReply value. func getCursorImageAndNameReply(buf []byte) *GetCursorImageAndNameReply { v := new(GetCursorImageAndNameReply) b := 1 // skip reply determinant @@ -1892,6 +2009,7 @@ func getCursorImageAndNameReply(buf []byte) *GetCursorImageAndNameReply { } // Write request to wire for GetCursorImageAndName +// getCursorImageAndNameRequest writes a GetCursorImageAndName request to a byte slice. func getCursorImageAndNameRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -1909,30 +2027,35 @@ func getCursorImageAndNameRequest(c *xgb.Conn) []byte { return buf } -// Request ChangeCursor -// size: 12 +// ChangeCursorCookie is a cookie used only for ChangeCursor requests. type ChangeCursorCookie struct { *xgb.Cookie } -// Write request to wire for ChangeCursor +// ChangeCursor sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangeCursor(c *xgb.Conn, Source xproto.Cursor, Destination xproto.Cursor) ChangeCursorCookie { cookie := c.NewCookie(false, false) c.NewRequest(changeCursorRequest(c, Source, Destination), cookie) return ChangeCursorCookie{cookie} } +// ChangeCursorChecked sends a checked request. +// If an error occurs, it can be retrieved using ChangeCursorCookie.Check() func ChangeCursorChecked(c *xgb.Conn, Source xproto.Cursor, Destination xproto.Cursor) ChangeCursorCookie { cookie := c.NewCookie(true, false) c.NewRequest(changeCursorRequest(c, Source, Destination), cookie) return ChangeCursorCookie{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 ChangeCursorCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for ChangeCursor +// changeCursorRequest writes a ChangeCursor request to a byte slice. func changeCursorRequest(c *xgb.Conn, Source xproto.Cursor, Destination xproto.Cursor) []byte { size := 12 b := 0 @@ -1956,30 +2079,35 @@ func changeCursorRequest(c *xgb.Conn, Source xproto.Cursor, Destination xproto.C return buf } -// Request ChangeCursorByName -// size: xgb.Pad((12 + xgb.Pad((int(Nbytes) * 1)))) +// ChangeCursorByNameCookie is a cookie used only for ChangeCursorByName requests. type ChangeCursorByNameCookie struct { *xgb.Cookie } -// Write request to wire for ChangeCursorByName +// ChangeCursorByName sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangeCursorByName(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Name string) ChangeCursorByNameCookie { cookie := c.NewCookie(false, false) c.NewRequest(changeCursorByNameRequest(c, Src, Nbytes, Name), cookie) return ChangeCursorByNameCookie{cookie} } +// ChangeCursorByNameChecked sends a checked request. +// If an error occurs, it can be retrieved using ChangeCursorByNameCookie.Check() func ChangeCursorByNameChecked(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Name string) ChangeCursorByNameCookie { cookie := c.NewCookie(true, false) c.NewRequest(changeCursorByNameRequest(c, Src, Nbytes, Name), cookie) return ChangeCursorByNameCookie{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 ChangeCursorByNameCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for ChangeCursorByName +// changeCursorByNameRequest writes a ChangeCursorByName request to a byte slice. func changeCursorByNameRequest(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Name string) []byte { size := xgb.Pad((12 + xgb.Pad((int(Nbytes) * 1)))) b := 0 @@ -2008,30 +2136,35 @@ func changeCursorByNameRequest(c *xgb.Conn, Src xproto.Cursor, Nbytes uint16, Na return buf } -// Request ExpandRegion -// size: 20 +// ExpandRegionCookie is a cookie used only for ExpandRegion requests. type ExpandRegionCookie struct { *xgb.Cookie } -// Write request to wire for ExpandRegion +// ExpandRegion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ExpandRegion(c *xgb.Conn, Source Region, Destination Region, Left uint16, Right uint16, Top uint16, Bottom uint16) ExpandRegionCookie { cookie := c.NewCookie(false, false) c.NewRequest(expandRegionRequest(c, Source, Destination, Left, Right, Top, Bottom), cookie) return ExpandRegionCookie{cookie} } +// ExpandRegionChecked sends a checked request. +// If an error occurs, it can be retrieved using ExpandRegionCookie.Check() func ExpandRegionChecked(c *xgb.Conn, Source Region, Destination Region, Left uint16, Right uint16, Top uint16, Bottom uint16) ExpandRegionCookie { cookie := c.NewCookie(true, false) c.NewRequest(expandRegionRequest(c, Source, Destination, Left, Right, Top, Bottom), cookie) return ExpandRegionCookie{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 ExpandRegionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for ExpandRegion +// expandRegionRequest writes a ExpandRegion request to a byte slice. func expandRegionRequest(c *xgb.Conn, Source Region, Destination Region, Left uint16, Right uint16, Top uint16, Bottom uint16) []byte { size := 20 b := 0 @@ -2067,30 +2200,35 @@ func expandRegionRequest(c *xgb.Conn, Source Region, Destination Region, Left ui return buf } -// Request HideCursor -// size: 8 +// HideCursorCookie is a cookie used only for HideCursor requests. type HideCursorCookie struct { *xgb.Cookie } -// Write request to wire for HideCursor +// HideCursor sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func HideCursor(c *xgb.Conn, Window xproto.Window) HideCursorCookie { cookie := c.NewCookie(false, false) c.NewRequest(hideCursorRequest(c, Window), cookie) return HideCursorCookie{cookie} } +// HideCursorChecked sends a checked request. +// If an error occurs, it can be retrieved using HideCursorCookie.Check() func HideCursorChecked(c *xgb.Conn, Window xproto.Window) HideCursorCookie { cookie := c.NewCookie(true, false) c.NewRequest(hideCursorRequest(c, Window), cookie) return HideCursorCookie{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 HideCursorCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for HideCursor +// hideCursorRequest writes a HideCursor request to a byte slice. func hideCursorRequest(c *xgb.Conn, Window xproto.Window) []byte { size := 8 b := 0 @@ -2111,30 +2249,35 @@ func hideCursorRequest(c *xgb.Conn, Window xproto.Window) []byte { return buf } -// Request ShowCursor -// size: 8 +// ShowCursorCookie is a cookie used only for ShowCursor requests. type ShowCursorCookie struct { *xgb.Cookie } -// Write request to wire for ShowCursor +// ShowCursor sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ShowCursor(c *xgb.Conn, Window xproto.Window) ShowCursorCookie { cookie := c.NewCookie(false, false) c.NewRequest(showCursorRequest(c, Window), cookie) return ShowCursorCookie{cookie} } +// ShowCursorChecked sends a checked request. +// If an error occurs, it can be retrieved using ShowCursorCookie.Check() func ShowCursorChecked(c *xgb.Conn, Window xproto.Window) ShowCursorCookie { cookie := c.NewCookie(true, false) c.NewRequest(showCursorRequest(c, Window), cookie) return ShowCursorCookie{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 ShowCursorCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for ShowCursor +// showCursorRequest writes a ShowCursor request to a byte slice. func showCursorRequest(c *xgb.Conn, Window xproto.Window) []byte { size := 8 b := 0 -- cgit v1.2.3