func (v CirculateNotifyEvent) String() string {
	fieldVals := make([]string, 0, 6)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
	fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
	fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
	fieldVals = append(fieldVals, xgb.Sprintf("Place: %d", v.Place))
	return "CirculateNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
String is a rudimentary string representation of CirculateNotifyEvent.
package xproto
import (
	"github.com/BurntSushi/xgb"
)
func Setup(c *xgb.Conn) *SetupInfo {
	setup := new(SetupInfo)
	SetupInfoRead(c.SetupBytes, setup)
	return setup
}
func (s *SetupInfo) DefaultScreen(c *xgb.Conn) *ScreenInfo {
	return &s.Roots[c.DefaultScreen]
}
const BadAccess = 10
type AccessError RequestError
func AccessErrorNew(buf []byte) xgb.Error {
	v := AccessError(RequestErrorNew(buf).(RequestError))
	v.NiceName = "Access"
	return v
}
func (err AccessError) SequenceId() uint16 {
	return err.Sequence
}
func (err AccessError) BadId() uint32 {
	return err.BadValue
}
func (err AccessError) Error() string {
	fieldVals := make([]string, 0, 4)
	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
	fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
	fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
	fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
	return "BadAccess {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
	xgb.NewErrorFuncs[10] = AccessErrorNew
}
const (
	AccessControlDisable = 0
	AccessControlEnable  = 1
)
const BadAlloc = 11
type AllocError RequestError
func AllocErrorNew(buf []byte) xgb.Error {
	v := AllocError(RequestErrorNew(buf).(RequestError))
	v.NiceName = "Alloc"
	return v
}
func (err AllocError) SequenceId() uint16 {
	return err.Sequence
}
func (err AllocError) BadId() uint32 {
	return err.BadValue
}
func (err AllocError) Error() string {
	fieldVals := make([]string, 0, 4)
	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
	fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
	fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
	fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
	return "BadAlloc {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
	xgb.NewErrorFuncs[11] = AllocErrorNew
}
const (
	AllowAsyncPointer   = 0
	AllowSyncPointer    = 1
	AllowReplayPointer  = 2
	AllowAsyncKeyboard  = 3
	AllowSyncKeyboard   = 4
	AllowReplayKeyboard = 5
	AllowAsyncBoth      = 6
	AllowSyncBoth       = 7
)
type Arc struct {
	X      int16
	Y      int16
	Width  uint16
	Height uint16
	Angle1 int16
	Angle2 int16
}
func ArcRead(buf []byte, v *Arc) int {
	b := 0
	v.X = int16(xgb.Get16(buf[b:]))
	b += 2
	v.Y = int16(xgb.Get16(buf[b:]))
	b += 2
	v.Width = xgb.Get16(buf[b:])
	b += 2
	v.Height = xgb.Get16(buf[b:])
	b += 2
	v.Angle1 = int16(xgb.Get16(buf[b:]))
	b += 2
	v.Angle2 = int16(xgb.Get16(buf[b:]))
	b += 2
	return b
}
func ArcReadList(buf []byte, dest []Arc) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Arc{}
		b += ArcRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Arc) Bytes() []byte {
	buf := make([]byte, 12)
	b := 0
	xgb.Put16(buf[b:], uint16(v.X))
	b += 2
	xgb.Put16(buf[b:], uint16(v.Y))
	b += 2
	xgb.Put16(buf[b:], v.Width)
	b += 2
	xgb.Put16(buf[b:], v.Height)
	b += 2
	xgb.Put16(buf[b:], uint16(v.Angle1))
	b += 2
	xgb.Put16(buf[b:], uint16(v.Angle2))
	b += 2
	return buf[:b]
}
func ArcListBytes(buf []byte, list []Arc) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}
const (
	ArcModeChord    = 0
	ArcModePieSlice = 1
)
type Atom uint32
func NewAtomId(c *xgb.Conn) (Atom, error) {
	id, err := c.NewId()
	if err != nil {
		return 0, err
	}
	return Atom(id), nil
}
const (
	AtomNone               = 0
	AtomAny                = 0
	AtomPrimary            = 1
	AtomSecondary          = 2
	AtomArc                = 3
	AtomAtom               = 4
	AtomBitmap             = 5
	AtomCardinal           = 6
	AtomColormap           = 7
	AtomCursor             = 8
	AtomCutBuffer0         = 9
	AtomCutBuffer1         = 10
	AtomCutBuffer2         = 11
	AtomCutBuffer3         = 12
	AtomCutBuffer4         = 13
	AtomCutBuffer5         = 14
	AtomCutBuffer6         = 15
	AtomCutBuffer7         = 16
	AtomDrawable           = 17
	AtomFont               = 18
	AtomInteger            = 19
	AtomPixmap             = 20
	AtomPoint              = 21
	AtomRectangle          = 22
	AtomResourceManager    = 23
	AtomRgbColorMap        = 24
	AtomRgbBestMap         = 25
	AtomRgbBlueMap         = 26
	AtomRgbDefaultMap      = 27
	AtomRgbGrayMap         = 28
	AtomRgbGreenMap        = 29
	AtomRgbRedMap          = 30
	AtomString             = 31
	AtomVisualid           = 32
	AtomWindow             = 33
	AtomWmCommand          = 34
	AtomWmHints            = 35
	AtomWmClientMachine    = 36
	AtomWmIconName         = 37
	AtomWmIconSize         = 38
	AtomWmName             = 39
	AtomWmNormalHints      = 40
	AtomWmSizeHints        = 41
	AtomWmZoomHints        = 42
	AtomMinSpace           = 43
	AtomNormSpace          = 44
	AtomMaxSpace           = 45
	AtomEndSpace           = 46
	AtomSuperscriptX       = 47
	AtomSuperscriptY       = 48
	AtomSubscriptX         = 49
	AtomSubscriptY         = 50
	AtomUnderlinePosition  = 51
	AtomUnderlineThickness = 52
	AtomStrikeoutAscent    = 53
	AtomStrikeoutDescent   = 54
	AtomItalicAngle        = 55
	AtomXHeight            = 56
	AtomQuadWidth          = 57
	AtomWeight             = 58
	AtomPointSize          = 59
	AtomResolution         = 60
	AtomCopyright          = 61
	AtomNotice             = 62
	AtomFontName           = 63
	AtomFamilyName         = 64
	AtomFullName           = 65
	AtomCapHeight          = 66
	AtomWmClass            = 67
	AtomWmTransientFor     = 68
)
const BadAtom = 5
type AtomError ValueError
func AtomErrorNew(buf []byte) xgb.Error {
	v := AtomError(ValueErrorNew(buf).(ValueError))
	v.NiceName = "Atom"
	return v
}
func (err AtomError) SequenceId() uint16 {
	return err.Sequence
}
func (err AtomError) BadId() uint32 {
	return err.BadValue
}
func (err AtomError) Error() string {
	fieldVals := make([]string, 0, 4)
	fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
	fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
	fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
	fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
	return "BadAtom {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
	xgb.NewErrorFuncs[5] = AtomErrorNew
}
const (
	AutoRepeatModeOff     = 0
	AutoRepeatModeOn      = 1
	AutoRepeatModeDefault = 2
)
const (
	BackPixmapNone           = 0
	BackPixmapParentRelative = 1
)
const (
	BackingStoreNotUseful  = 0
	BackingStoreWhenMapped = 1
	BackingStoreAlways     = 2
)
const (
	BlankingNotPreferred = 0
	BlankingPreferred    = 1
	BlankingDefault      = 2
)
type Bool32 uint32
type Button byte
const (
	ButtonIndexAny = 0
	ButtonIndex1   = 1
	ButtonIndex2   = 2
	ButtonIndex3   = 3
	ButtonIndex4   = 4
	ButtonIndex5   = 5
)
const (
	ButtonMask1   = 256
	ButtonMask2   = 512
	ButtonMask3   = 1024
	ButtonMask4   = 2048
	ButtonMask5   = 4096
	ButtonMaskAny = 32768
)
const ButtonPress = 4
type ButtonPressEvent struct {
	Sequence   uint16
	Detail     Button
	Time       Timestamp
	Root       Window
	Event      Window
	Child      Window
	RootX      int16
	RootY      int16
	EventX     int16
	EventY     int16
	State      uint16
	SameScreen bool
}
func ButtonPressEventNew(buf []byte) xgb.Event {
	v := ButtonPressEvent{}
	b := 1  
	v.Detail = Button(buf[b])
	b += 1
	v.Sequence = xgb.Get16(buf[b:])
	b += 2
	v.Time = Timestamp(xgb.Get32(buf[b:]))
	b += 4
	v.Root = Window(xgb.Get32(buf[b:]))
	b += 4
	v.Event = Window(xgb.Get32(buf[b:]))
	b += 4
	v.Child = Window(xgb.Get32(buf[b:]))
	b += 4
	v.RootX = int16(xgb.Get16(buf[b:]))
	b += 2
	v.RootY = int16(xgb.Get16(buf[b:]))
	b += 2
	v.EventX = int16(xgb.Get16(buf[b:]))
	b += 2
	v.EventY = int16(xgb.Get16(buf[b:]))
	b += 2
	v.State = xgb.Get16(buf[b:])
	b += 2
	if buf[b] == 1 {
		v.SameScreen = true
	} else {
		v.SameScreen = false
	}
	b += 1
	b += 1  
	return v
}
func (v ButtonPressEvent) Bytes() []byte {
	buf := make([]byte, 32)
	b := 0
	buf[b] = 4
	b += 1
	buf[b] = byte(v.Detail)
	b += 1
	b += 2  
	xgb.Put32(buf[b:], uint32(v.Time))
	b += 4
	xgb.Put32(buf[b:], uint32(v.Root))
	b += 4
	xgb.Put32(buf[b:], uint32(v.Event))
	b += 4
	xgb.Put32(buf[b:], uint32(v.Child))
	b += 4
	xgb.Put16(buf[b:], uint16(v.RootX))
	b += 2
	xgb.Put16(buf[b:], uint16(v.RootY))
	b += 2
	xgb.Put16(buf[b:], uint16(v.EventX))
	b += 2
	xgb.Put16(buf[b:], uint16(v.EventY))
	b += 2
	xgb.Put16(buf[b:], v.State)
	b += 2
	if v.SameScreen {
		buf[b] = 1
	} else {
		buf[b] = 0
	}
	b += 1
	b += 1  
	return buf
}
func (v ButtonPressEvent) SequenceId() uint16 {
	return v.Sequence
}
func (v ButtonPressEvent) String() string {
	fieldVals := make([]string, 0, 12)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
	fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
	fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
	fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
	fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
	fieldVals = append(fieldVals, xgb.Sprintf("Child: %d", v.Child))
	fieldVals = append(fieldVals, xgb.Sprintf("RootX: %d", v.RootX))
	fieldVals = append(fieldVals, xgb.Sprintf("RootY: %d", v.RootY))
	fieldVals = append(fieldVals, xgb.Sprintf("EventX: %d", v.EventX))
	fieldVals = append(fieldVals, xgb.Sprintf("EventY: %d", v.EventY))
	fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
	fieldVals = append(fieldVals, xgb.Sprintf("SameScreen: %t", v.SameScreen))
	return "ButtonPress {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
	xgb.NewEventFuncs[4] = ButtonPressEventNew
}
const ButtonRelease = 5
type ButtonReleaseEvent ButtonPressEvent
func ButtonReleaseEventNew(buf []byte) xgb.Event {
	return ButtonReleaseEvent(ButtonPressEventNew(buf).(ButtonPressEvent))
}
func (v ButtonReleaseEvent) Bytes() []byte {
	return ButtonPressEvent(v).Bytes()
}
func (v ButtonReleaseEvent) SequenceId() uint16 {
	return v.Sequence
}
func (v ButtonReleaseEvent) String() string {
	fieldVals := make([]string, 0, 12)
	fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
	fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
	fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
	fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
	fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
	fieldVals = append(fieldVals, xgb.Sprintf("Child: %d", v.Child))
	fieldVals = append(fieldVals, xgb.Sprintf("RootX: %d", v.RootX))
	fieldVals = append(fieldVals, xgb.Sprintf("RootY: %d", v.RootY))
	fieldVals = append(fieldVals, xgb.Sprintf("EventX: %d", v.EventX))
	fieldVals = append(fieldVals, xgb.Sprintf("EventY: %d", v.EventY))
	fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
	fieldVals = append(fieldVals, xgb.Sprintf("SameScreen: %t", v.SameScreen))
	return "ButtonRelease {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
	xgb.NewEventFuncs[5] = ButtonReleaseEventNew
}
const (
	CapStyleNotLast    = 0
	CapStyleButt       = 1
	CapStyleRound      = 2
	CapStyleProjecting = 3
)
type Char2b struct {
	Byte1 byte
	Byte2 byte
}
func Char2bRead(buf []byte, v *Char2b) int {
	b := 0
	v.Byte1 = buf[b]
	b += 1
	v.Byte2 = buf[b]
	b += 1
	return b
}
func Char2bReadList(buf []byte, dest []Char2b) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Char2b{}
		b += Char2bRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Char2b) Bytes() []byte {
	buf := make([]byte, 2)
	b := 0
	buf[b] = v.Byte1
	b += 1
	buf[b] = v.Byte2
	b += 1
	return buf[:b]
}
func Char2bListBytes(buf []byte, list []Char2b) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}
type Charinfo struct {
	LeftSideBearing  int16
	RightSideBearing int16
	CharacterWidth   int16
	Ascent           int16
	Descent          int16
	Attributes       uint16
}
func CharinfoRead(buf []byte, v *Charinfo) int {
	b := 0
	v.LeftSideBearing = int16(xgb.Get16(buf[b:]))
	b += 2
	v.RightSideBearing = int16(xgb.Get16(buf[b:]))
	b += 2
	v.CharacterWidth = int16(xgb.Get16(buf[b:]))
	b += 2
	v.Ascent = int16(xgb.Get16(buf[b:]))
	b += 2
	v.Descent = int16(xgb.Get16(buf[b:]))
	b += 2
	v.Attributes = xgb.Get16(buf[b:])
	b += 2
	return b
}
func CharinfoReadList(buf []byte, dest []Charinfo) int {
	b := 0
	for i := 0; i < len(dest); i++ {
		dest[i] = Charinfo{}
		b += CharinfoRead(buf[b:], &dest[i])
	}
	return xgb.Pad(b)
}
func (v Charinfo) Bytes() []byte {
	buf := make([]byte, 12)
	b := 0
	xgb.Put16(buf[b:], uint16(v.LeftSideBearing))
	b += 2
	xgb.Put16(buf[b:], uint16(v.RightSideBearing))
	b += 2
	xgb.Put16(buf[b:], uint16(v.CharacterWidth))
	b += 2
	xgb.Put16(buf[b:], uint16(v.Ascent))
	b += 2
	xgb.Put16(buf[b:], uint16(v.Descent))
	b += 2
	xgb.Put16(buf[b:], v.Attributes)
	b += 2
	return buf[:b]
}
func CharinfoListBytes(buf []byte, list []Charinfo) int {
	b := 0
	var structBytes []byte
	for _, item := range list {
		structBytes = item.Bytes()
		copy(buf[b:], structBytes)
		b += len(structBytes)
	}
	return xgb.Pad(b)
}
const (
	CirculateRaiseLowest  = 0
	CirculateLowerHighest = 1
)
const CirculateNotify = 26
type CirculateNotifyEvent struct {
	Sequence uint16
	Event  Window
	Window Window
	Place byte
}
func CirculateNotifyEventNew(buf []byte) xgb.Event {
	v := CirculateNotifyEvent{}
	b := 1  
	b += 1  
	v.Sequence = xgb.Get16(buf[b:])
	b += 2
	v.Event = Window(xgb.Get32(buf[b:]))
	b += 4
	v.Window = Window(xgb.Get32(buf[b:]))
	b += 4
	b += 4  
	v.Place = buf[b]
	b += 1
	b += 3  
	return v
}
func (v CirculateNotifyEvent) Bytes() []byte {
	buf := make([]byte, 32)
	b := 0
	buf[b] = 26
	b += 1
	b += 1  
	b += 2  
	xgb.Put32(buf[b:], uint32(v.Event))
	b += 4
	xgb.Put32(buf[b:], uint32(v.Window))
	b += 4
	b += 4  
	buf[b] = v.Place
	b += 1
	b += 3  
	return buf
}
func (v CirculateNotifyEvent) SequenceId() uint16 {
	return v.Sequence
}