diff options
Diffstat (limited to 'xproto/xproto.go')
| -rw-r--r-- | xproto/xproto.go | 106 |
1 files changed, 60 insertions, 46 deletions
diff --git a/xproto/xproto.go b/xproto/xproto.go index e6b2c6b..ddd3ca9 100644 --- a/xproto/xproto.go +++ b/xproto/xproto.go @@ -343,6 +343,8 @@ const ( BlankingDefault = 2 ) +type Bool32 uint32 + type Button byte const ( @@ -921,9 +923,10 @@ func init() { // Note that to *create* a Union, you should *never* create // this struct directly (unless you know what you're doing). // Instead use one of the following constructors for 'ClientMessageDataUnion': -// ClientMessageDataUnionData8New(Data8 []byte) ClientMessageDataUnion -// ClientMessageDataUnionData16New(Data16 []uint16) ClientMessageDataUnion -// ClientMessageDataUnionData32New(Data32 []uint32) ClientMessageDataUnion +// +// ClientMessageDataUnionData8New(Data8 []byte) ClientMessageDataUnion +// ClientMessageDataUnionData16New(Data16 []uint16) ClientMessageDataUnion +// ClientMessageDataUnionData32New(Data32 []uint32) ClientMessageDataUnion type ClientMessageDataUnion struct { Data8 []byte // size: 20 Data16 []uint16 // size: 20 @@ -1208,6 +1211,10 @@ func NewColormapId(c *xgb.Conn) (Colormap, error) { return Colormap(id), nil } +const ( + ColormapNone = 0 +) + // BadColormap is the error number for a BadColormap. const BadColormap = 12 @@ -1247,10 +1254,6 @@ func init() { } const ( - ColormapNone = 0 -) - -const ( ColormapAllocNone = 0 ColormapAllocAll = 1 ) @@ -1787,6 +1790,10 @@ func NewCursorId(c *xgb.Conn) (Cursor, error) { return Cursor(id), nil } +const ( + CursorNone = 0 +) + // BadCursor is the error number for a BadCursor. const BadCursor = 6 @@ -1826,10 +1833,6 @@ func init() { } const ( - CursorNone = 0 -) - -const ( CwBackPixmap = 1 CwBackPixel = 2 CwBorderPixmap = 4 @@ -3052,6 +3055,7 @@ type Host struct { // padding: 1 bytes AddressLen uint16 Address []byte // size: xgb.Pad((int(AddressLen) * 1)) + // alignment gap to multiple of 4 } // HostRead reads a byte slice into a Host value. @@ -3070,6 +3074,8 @@ func HostRead(buf []byte, v *Host) int { copy(v.Address[:v.AddressLen], buf[b:]) b += int(v.AddressLen) + b = (b + 3) & ^3 // alignment gap + return b } @@ -3085,7 +3091,7 @@ func HostReadList(buf []byte, dest []Host) int { // Bytes writes a Host value to a byte slice. func (v Host) Bytes() []byte { - buf := make([]byte, (4 + xgb.Pad((int(v.AddressLen) * 1)))) + buf := make([]byte, ((4 + xgb.Pad((int(v.AddressLen) * 1))) + 4)) b := 0 buf[b] = v.Family @@ -3099,6 +3105,8 @@ func (v Host) Bytes() []byte { copy(buf[b:], v.Address[:v.AddressLen]) b += int(v.AddressLen) + b = (b + 3) & ^3 // alignment gap + return buf[:b] } @@ -3118,7 +3126,7 @@ func HostListBytes(buf []byte, list []Host) int { func HostListSize(list []Host) int { size := 0 for _, item := range list { - size += (4 + xgb.Pad((int(item.AddressLen) * 1))) + size += ((4 + xgb.Pad((int(item.AddressLen) * 1))) + 4) } return size } @@ -3453,6 +3461,8 @@ func init() { type Keycode byte +type Keycode32 uint32 + // KeymapNotify is the event number for a KeymapNotifyEvent. const KeymapNotify = 11 @@ -4237,10 +4247,6 @@ func NewPixmapId(c *xgb.Conn) (Pixmap, error) { return Pixmap(id), nil } -const ( - PixmapNone = 0 -) - // BadPixmap is the error number for a BadPixmap. const BadPixmap = 4 @@ -4280,6 +4286,10 @@ func init() { } const ( + PixmapNone = 0 +) + +const ( PlaceOnTop = 0 PlaceOnBottom = 1 ) @@ -5578,9 +5588,8 @@ type SetupInfo struct { // padding: 4 bytes Vendor string // size: xgb.Pad((int(VendorLen) * 1)) // alignment gap to multiple of 4 - PixmapFormats []Format // size: xgb.Pad((int(PixmapFormatsLen) * 8)) - // alignment gap to multiple of 4 - Roots []ScreenInfo // size: ScreenInfoListSize(Roots) + PixmapFormats []Format // size: xgb.Pad((int(PixmapFormatsLen) * 8)) + Roots []ScreenInfo // size: ScreenInfoListSize(Roots) } // SetupInfoRead reads a byte slice into a SetupInfo value. @@ -5657,8 +5666,6 @@ func SetupInfoRead(buf []byte, v *SetupInfo) int { v.PixmapFormats = make([]Format, v.PixmapFormatsLen) b += FormatReadList(buf[b:], v.PixmapFormats) - b = (b + 3) & ^3 // alignment gap - v.Roots = make([]ScreenInfo, v.RootsLen) b += ScreenInfoReadList(buf[b:], v.Roots) @@ -5677,7 +5684,7 @@ func SetupInfoReadList(buf []byte, dest []SetupInfo) int { // Bytes writes a SetupInfo value to a byte slice. func (v SetupInfo) Bytes() []byte { - buf := make([]byte, (((((40 + xgb.Pad((int(v.VendorLen) * 1))) + 4) + xgb.Pad((int(v.PixmapFormatsLen) * 8))) + 4) + ScreenInfoListSize(v.Roots))) + buf := make([]byte, ((((40 + xgb.Pad((int(v.VendorLen) * 1))) + 4) + xgb.Pad((int(v.PixmapFormatsLen) * 8))) + ScreenInfoListSize(v.Roots))) b := 0 buf[b] = v.Status @@ -5745,8 +5752,6 @@ func (v SetupInfo) Bytes() []byte { b += FormatListBytes(buf[b:], v.PixmapFormats) - b = (b + 3) & ^3 // alignment gap - b += ScreenInfoListBytes(buf[b:], v.Roots) return buf[:b] @@ -5768,7 +5773,7 @@ func SetupInfoListBytes(buf []byte, list []SetupInfo) int { func SetupInfoListSize(list []SetupInfo) int { size := 0 for _, item := range list { - size += (((((40 + xgb.Pad((int(item.VendorLen) * 1))) + 4) + xgb.Pad((int(item.PixmapFormatsLen) * 8))) + 4) + ScreenInfoListSize(item.Roots)) + size += ((((40 + xgb.Pad((int(item.VendorLen) * 1))) + 4) + xgb.Pad((int(item.PixmapFormatsLen) * 8))) + ScreenInfoListSize(item.Roots)) } return size } @@ -5782,7 +5787,9 @@ type SetupRequest struct { AuthorizationProtocolDataLen uint16 // padding: 2 bytes AuthorizationProtocolName string // size: xgb.Pad((int(AuthorizationProtocolNameLen) * 1)) + // alignment gap to multiple of 4 AuthorizationProtocolData string // size: xgb.Pad((int(AuthorizationProtocolDataLen) * 1)) + // alignment gap to multiple of 4 } // SetupRequestRead reads a byte slice into a SetupRequest value. @@ -5815,6 +5822,8 @@ func SetupRequestRead(buf []byte, v *SetupRequest) int { b += int(v.AuthorizationProtocolNameLen) } + b = (b + 3) & ^3 // alignment gap + { byteString := make([]byte, v.AuthorizationProtocolDataLen) copy(byteString[:v.AuthorizationProtocolDataLen], buf[b:]) @@ -5822,6 +5831,8 @@ func SetupRequestRead(buf []byte, v *SetupRequest) int { b += int(v.AuthorizationProtocolDataLen) } + b = (b + 3) & ^3 // alignment gap + return b } @@ -5837,7 +5848,7 @@ func SetupRequestReadList(buf []byte, dest []SetupRequest) int { // Bytes writes a SetupRequest value to a byte slice. func (v SetupRequest) Bytes() []byte { - buf := make([]byte, ((12 + xgb.Pad((int(v.AuthorizationProtocolNameLen) * 1))) + xgb.Pad((int(v.AuthorizationProtocolDataLen) * 1)))) + buf := make([]byte, ((((12 + xgb.Pad((int(v.AuthorizationProtocolNameLen) * 1))) + 4) + xgb.Pad((int(v.AuthorizationProtocolDataLen) * 1))) + 4)) b := 0 buf[b] = v.ByteOrder @@ -5862,9 +5873,13 @@ func (v SetupRequest) Bytes() []byte { copy(buf[b:], v.AuthorizationProtocolName[:v.AuthorizationProtocolNameLen]) b += int(v.AuthorizationProtocolNameLen) + b = (b + 3) & ^3 // alignment gap + copy(buf[b:], v.AuthorizationProtocolData[:v.AuthorizationProtocolDataLen]) b += int(v.AuthorizationProtocolDataLen) + b = (b + 3) & ^3 // alignment gap + return buf[:b] } @@ -5884,7 +5899,7 @@ func SetupRequestListBytes(buf []byte, list []SetupRequest) int { func SetupRequestListSize(list []SetupRequest) int { size := 0 for _, item := range list { - size += ((12 + xgb.Pad((int(item.AuthorizationProtocolNameLen) * 1))) + xgb.Pad((int(item.AuthorizationProtocolDataLen) * 1))) + size += ((((12 + xgb.Pad((int(item.AuthorizationProtocolNameLen) * 1))) + 4) + xgb.Pad((int(item.AuthorizationProtocolDataLen) * 1))) + 4) } return size } @@ -6389,6 +6404,10 @@ func NewWindowId(c *xgb.Conn) (Window, error) { return Window(id), nil } +const ( + WindowNone = 0 +) + // BadWindow is the error number for a BadWindow. const BadWindow = 3 @@ -6428,10 +6447,6 @@ func init() { } const ( - WindowNone = 0 -) - -const ( WindowClassCopyFromParent = 0 WindowClassInputOutput = 1 WindowClassInputOnly = 2 @@ -6598,8 +6613,7 @@ type AllocColorCellsReply struct { MasksLen uint16 // padding: 20 bytes Pixels []uint32 // size: xgb.Pad((int(PixelsLen) * 4)) - // alignment gap to multiple of 4 - Masks []uint32 // size: xgb.Pad((int(MasksLen) * 4)) + Masks []uint32 // size: xgb.Pad((int(MasksLen) * 4)) } // Reply blocks and returns the reply data for a AllocColorCells request. @@ -6641,8 +6655,6 @@ func allocColorCellsReply(buf []byte) *AllocColorCellsReply { b += 4 } - b = (b + 3) & ^3 // alignment gap - v.Masks = make([]uint32, v.MasksLen) for i := 0; i < int(v.MasksLen); i++ { v.Masks[i] = xgb.Get32(buf[b:]) @@ -7101,7 +7113,7 @@ func (cook ChangeGCCookie) Check() error { // Write request to wire for ChangeGC // changeGCRequest writes a ChangeGC request to a byte slice. func changeGCRequest(c *xgb.Conn, Gc Gcontext, ValueMask uint32, ValueList []uint32) []byte { - size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + size := xgb.Pad((12 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))) b := 0 buf := make([]byte, size) @@ -7118,6 +7130,7 @@ func changeGCRequest(c *xgb.Conn, Gc Gcontext, ValueMask uint32, ValueList []uin xgb.Put32(buf[b:], ValueMask) b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { xgb.Put32(buf[b:], ValueList[i]) b += 4 @@ -7214,7 +7227,7 @@ func (cook ChangeKeyboardControlCookie) Check() error { // Write request to wire for ChangeKeyboardControl // changeKeyboardControlRequest writes a ChangeKeyboardControl request to a byte slice. func changeKeyboardControlRequest(c *xgb.Conn, ValueMask uint32, ValueList []uint32) []byte { - size := xgb.Pad((4 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + size := xgb.Pad((8 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))) b := 0 buf := make([]byte, size) @@ -7228,6 +7241,7 @@ func changeKeyboardControlRequest(c *xgb.Conn, ValueMask uint32, ValueList []uin xgb.Put32(buf[b:], ValueMask) b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { xgb.Put32(buf[b:], ValueList[i]) b += 4 @@ -7509,7 +7523,7 @@ func (cook ChangeWindowAttributesCookie) Check() error { // Write request to wire for ChangeWindowAttributes // changeWindowAttributesRequest writes a ChangeWindowAttributes request to a byte slice. func changeWindowAttributesRequest(c *xgb.Conn, Window Window, ValueMask uint32, ValueList []uint32) []byte { - size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + size := xgb.Pad((12 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))) b := 0 buf := make([]byte, size) @@ -7526,6 +7540,7 @@ func changeWindowAttributesRequest(c *xgb.Conn, Window Window, ValueMask uint32, xgb.Put32(buf[b:], ValueMask) b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { xgb.Put32(buf[b:], ValueList[i]) b += 4 @@ -7727,7 +7742,7 @@ func (cook ConfigureWindowCookie) Check() error { // Write request to wire for ConfigureWindow // configureWindowRequest writes a ConfigureWindow request to a byte slice. func configureWindowRequest(c *xgb.Conn, Window Window, ValueMask uint16, ValueList []uint32) []byte { - size := xgb.Pad((10 + (2 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + size := xgb.Pad((12 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))) b := 0 buf := make([]byte, size) @@ -8231,7 +8246,7 @@ func (cook CreateGCCookie) Check() error { // Write request to wire for CreateGC // createGCRequest writes a CreateGC request to a byte slice. func createGCRequest(c *xgb.Conn, Cid Gcontext, Drawable Drawable, ValueMask uint32, ValueList []uint32) []byte { - size := xgb.Pad((12 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + size := xgb.Pad((16 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))) b := 0 buf := make([]byte, size) @@ -8251,6 +8266,7 @@ func createGCRequest(c *xgb.Conn, Cid Gcontext, Drawable Drawable, ValueMask uin xgb.Put32(buf[b:], ValueMask) b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { xgb.Put32(buf[b:], ValueList[i]) b += 4 @@ -8426,7 +8442,7 @@ func (cook CreateWindowCookie) Check() error { // Write request to wire for CreateWindow // createWindowRequest writes a CreateWindow request to a byte slice. func createWindowRequest(c *xgb.Conn, Depth byte, Wid Window, Parent Window, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class uint16, Visual Visualid, ValueMask uint32, ValueList []uint32) []byte { - size := xgb.Pad((28 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + size := xgb.Pad((32 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))) b := 0 buf := make([]byte, size) @@ -8468,6 +8484,7 @@ func createWindowRequest(c *xgb.Conn, Depth byte, Wid Window, Parent Window, X i xgb.Put32(buf[b:], ValueMask) b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { xgb.Put32(buf[b:], ValueList[i]) b += 4 @@ -12914,8 +12931,7 @@ type QueryFontReply struct { FontDescent int16 CharInfosLen uint32 Properties []Fontprop // size: xgb.Pad((int(PropertiesLen) * 8)) - // alignment gap to multiple of 4 - CharInfos []Charinfo // size: xgb.Pad((int(CharInfosLen) * 12)) + CharInfos []Charinfo // size: xgb.Pad((int(CharInfosLen) * 12)) } // Reply blocks and returns the reply data for a QueryFont request. @@ -12993,8 +13009,6 @@ func queryFontReply(buf []byte) *QueryFontReply { v.Properties = make([]Fontprop, v.PropertiesLen) b += FontpropReadList(buf[b:], v.Properties) - b = (b + 3) & ^3 // alignment gap - v.CharInfos = make([]Charinfo, v.CharInfosLen) b += CharinfoReadList(buf[b:], v.CharInfos) |
