haven/nexgb/xproto.go

11216 lines
199 KiB
Go

package xgb
/*
This file was generated by xproto.xml on May 3 2012 12:48:47am EDT.
This file is automatically generated. Edit at your peril!
*/
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Id'
// Skipping definition for base type 'Card8'
// Skipping definition for base type 'Int16'
// Skipping definition for base type 'Int32'
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
// Skipping definition for base type 'Card32'
// Skipping definition for base type 'Double'
// Skipping definition for base type 'Bool'
const (
VisualClassStaticGray = 0
VisualClassGrayScale = 1
VisualClassStaticColor = 2
VisualClassPseudoColor = 3
VisualClassTrueColor = 4
VisualClassDirectColor = 5
)
const (
EventMaskNoEvent = 0
EventMaskKeyPress = 1
EventMaskKeyRelease = 2
EventMaskButtonPress = 4
EventMaskButtonRelease = 8
EventMaskEnterWindow = 16
EventMaskLeaveWindow = 32
EventMaskPointerMotion = 64
EventMaskPointerMotionHint = 128
EventMaskButton1Motion = 256
EventMaskButton2Motion = 512
EventMaskButton3Motion = 1024
EventMaskButton4Motion = 2048
EventMaskButton5Motion = 4096
EventMaskButtonMotion = 8192
EventMaskKeymapState = 16384
EventMaskExposure = 32768
EventMaskVisibilityChange = 65536
EventMaskStructureNotify = 131072
EventMaskResizeRedirect = 262144
EventMaskSubstructureNotify = 524288
EventMaskSubstructureRedirect = 1048576
EventMaskFocusChange = 2097152
EventMaskPropertyChange = 4194304
EventMaskColorMapChange = 8388608
EventMaskOwnerGrabButton = 16777216
)
const (
BackingStoreNotUseful = 0
BackingStoreWhenMapped = 1
BackingStoreAlways = 2
)
const (
ImageOrderLSBFirst = 0
ImageOrderMSBFirst = 1
)
const (
ModMaskShift = 1
ModMaskLock = 2
ModMaskControl = 4
ModMask1 = 8
ModMask2 = 16
ModMask3 = 32
ModMask4 = 64
ModMask5 = 128
ModMaskAny = 32768
)
const (
KeyButMaskShift = 1
KeyButMaskLock = 2
KeyButMaskControl = 4
KeyButMaskMod1 = 8
KeyButMaskMod2 = 16
KeyButMaskMod3 = 32
KeyButMaskMod4 = 64
KeyButMaskMod5 = 128
KeyButMaskButton1 = 256
KeyButMaskButton2 = 512
KeyButMaskButton3 = 1024
KeyButMaskButton4 = 2048
KeyButMaskButton5 = 4096
)
const (
WindowNone = 0
)
const (
ButtonMask1 = 256
ButtonMask2 = 512
ButtonMask3 = 1024
ButtonMask4 = 2048
ButtonMask5 = 4096
ButtonMaskAny = 32768
)
const (
MotionNormal = 0
MotionHint = 1
)
const (
NotifyDetailAncestor = 0
NotifyDetailVirtual = 1
NotifyDetailInferior = 2
NotifyDetailNonlinear = 3
NotifyDetailNonlinearVirtual = 4
NotifyDetailPointer = 5
NotifyDetailPointerRoot = 6
NotifyDetailNone = 7
)
const (
NotifyModeNormal = 0
NotifyModeGrab = 1
NotifyModeUngrab = 2
NotifyModeWhileGrabbed = 3
)
const (
VisibilityUnobscured = 0
VisibilityPartiallyObscured = 1
VisibilityFullyObscured = 2
)
const (
PlaceOnTop = 0
PlaceOnBottom = 1
)
const (
PropertyNewValue = 0
PropertyDelete = 1
)
const (
TimeCurrentTime = 0
)
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 (
ColormapStateUninstalled = 0
ColormapStateInstalled = 1
)
const (
ColormapNone = 0
)
const (
MappingModifier = 0
MappingKeyboard = 1
MappingPointer = 2
)
const (
WindowClassCopyFromParent = 0
WindowClassInputOutput = 1
WindowClassInputOnly = 2
)
const (
CwBackPixmap = 1
CwBackPixel = 2
CwBorderPixmap = 4
CwBorderPixel = 8
CwBitGravity = 16
CwWinGravity = 32
CwBackingStore = 64
CwBackingPlanes = 128
CwBackingPixel = 256
CwOverrideRedirect = 512
CwSaveUnder = 1024
CwEventMask = 2048
CwDontPropagate = 4096
CwColormap = 8192
CwCursor = 16384
)
const (
BackPixmapNone = 0
BackPixmapParentRelative = 1
)
const (
GravityBitForget = 0
GravityWinUnmap = 0
GravityNorthWest = 1
GravityNorth = 2
GravityNorthEast = 3
GravityWest = 4
GravityCenter = 5
GravityEast = 6
GravitySouthWest = 7
GravitySouth = 8
GravitySouthEast = 9
GravityStatic = 10
)
const (
MapStateUnmapped = 0
MapStateUnviewable = 1
MapStateViewable = 2
)
const (
SetModeInsert = 0
SetModeDelete = 1
)
const (
ConfigWindowX = 1
ConfigWindowY = 2
ConfigWindowWidth = 4
ConfigWindowHeight = 8
ConfigWindowBorderWidth = 16
ConfigWindowSibling = 32
ConfigWindowStackMode = 64
)
const (
StackModeAbove = 0
StackModeBelow = 1
StackModeTopIf = 2
StackModeBottomIf = 3
StackModeOpposite = 4
)
const (
CirculateRaiseLowest = 0
CirculateLowerHighest = 1
)
const (
PropModeReplace = 0
PropModePrepend = 1
PropModeAppend = 2
)
const (
GetPropertyTypeAny = 0
)
const (
SendEventDestPointerWindow = 0
SendEventDestItemFocus = 1
)
const (
GrabModeSync = 0
GrabModeAsync = 1
)
const (
GrabStatusSuccess = 0
GrabStatusAlreadyGrabbed = 1
GrabStatusInvalidTime = 2
GrabStatusNotViewable = 3
GrabStatusFrozen = 4
)
const (
CursorNone = 0
)
const (
ButtonIndexAny = 0
ButtonIndex1 = 1
ButtonIndex2 = 2
ButtonIndex3 = 3
ButtonIndex4 = 4
ButtonIndex5 = 5
)
const (
GrabAny = 0
)
const (
AllowAsyncPointer = 0
AllowSyncPointer = 1
AllowReplayPointer = 2
AllowAsyncKeyboard = 3
AllowSyncKeyboard = 4
AllowReplayKeyboard = 5
AllowAsyncBoth = 6
AllowSyncBoth = 7
)
const (
InputFocusNone = 0
InputFocusPointerRoot = 1
InputFocusParent = 2
InputFocusFollowKeyboard = 3
)
const (
FontDrawLeftToRight = 0
FontDrawRightToLeft = 1
)
const (
GcFunction = 1
GcPlaneMask = 2
GcForeground = 4
GcBackground = 8
GcLineWidth = 16
GcLineStyle = 32
GcCapStyle = 64
GcJoinStyle = 128
GcFillStyle = 256
GcFillRule = 512
GcTile = 1024
GcStipple = 2048
GcTileStippleOriginX = 4096
GcTileStippleOriginY = 8192
GcFont = 16384
GcSubwindowMode = 32768
GcGraphicsExposures = 65536
GcClipOriginX = 131072
GcClipOriginY = 262144
GcClipMask = 524288
GcDashOffset = 1048576
GcDashList = 2097152
GcArcMode = 4194304
)
const (
GxClear = 0
GxAnd = 1
GxAndReverse = 2
GxCopy = 3
GxAndInverted = 4
GxNoop = 5
GxXor = 6
GxOr = 7
GxNor = 8
GxEquiv = 9
GxInvert = 10
GxOrReverse = 11
GxCopyInverted = 12
GxOrInverted = 13
GxNand = 14
GxSet = 15
)
const (
LineStyleSolid = 0
LineStyleOnOffDash = 1
LineStyleDoubleDash = 2
)
const (
CapStyleNotLast = 0
CapStyleButt = 1
CapStyleRound = 2
CapStyleProjecting = 3
)
const (
JoinStyleMiter = 0
JoinStyleRound = 1
JoinStyleBevel = 2
)
const (
FillStyleSolid = 0
FillStyleTiled = 1
FillStyleStippled = 2
FillStyleOpaqueStippled = 3
)
const (
FillRuleEvenOdd = 0
FillRuleWinding = 1
)
const (
SubwindowModeClipByChildren = 0
SubwindowModeIncludeInferiors = 1
)
const (
ArcModeChord = 0
ArcModePieSlice = 1
)
const (
ClipOrderingUnsorted = 0
ClipOrderingYSorted = 1
ClipOrderingYXSorted = 2
ClipOrderingYXBanded = 3
)
const (
CoordModeOrigin = 0
CoordModePrevious = 1
)
const (
PolyShapeComplex = 0
PolyShapeNonconvex = 1
PolyShapeConvex = 2
)
const (
ImageFormatXYBitmap = 0
ImageFormatXYPixmap = 1
ImageFormatZPixmap = 2
)
const (
ColormapAllocNone = 0
ColormapAllocAll = 1
)
const (
ColorFlagRed = 1
ColorFlagGreen = 2
ColorFlagBlue = 4
)
const (
PixmapNone = 0
)
const (
FontNone = 0
)
const (
QueryShapeOfLargestCursor = 0
QueryShapeOfFastestTile = 1
QueryShapeOfFastestStipple = 2
)
const (
KbKeyClickPercent = 1
KbBellPercent = 2
KbBellPitch = 4
KbBellDuration = 8
KbLed = 16
KbLedMode = 32
KbKey = 64
KbAutoRepeatMode = 128
)
const (
LedModeOff = 0
LedModeOn = 1
)
const (
AutoRepeatModeOff = 0
AutoRepeatModeOn = 1
AutoRepeatModeDefault = 2
)
const (
BlankingNotPreferred = 0
BlankingPreferred = 1
BlankingDefault = 2
)
const (
ExposuresNotAllowed = 0
ExposuresAllowed = 1
ExposuresDefault = 2
)
const (
HostModeInsert = 0
HostModeDelete = 1
)
const (
FamilyInternet = 0
FamilyDECnet = 1
FamilyChaos = 2
FamilyServerInterpreted = 5
FamilyInternet6 = 6
)
const (
AccessControlDisable = 0
AccessControlEnable = 1
)
const (
CloseDownDestroyAll = 0
CloseDownRetainPermanent = 1
CloseDownRetainTemporary = 2
)
const (
KillAllTemporary = 0
)
const (
ScreenSaverReset = 0
ScreenSaverActive = 1
)
const (
MappingStatusSuccess = 0
MappingStatusBusy = 1
MappingStatusFailure = 2
)
const (
MapIndexShift = 0
MapIndexLock = 1
MapIndexControl = 2
MapIndex1 = 3
MapIndex2 = 4
MapIndex3 = 5
MapIndex4 = 6
MapIndex5 = 7
)
// Skipping resource definition of 'Window'
// Skipping resource definition of 'Pixmap'
// Skipping resource definition of 'Cursor'
// Skipping resource definition of 'Font'
// Skipping resource definition of 'Gcontext'
// Skipping resource definition of 'Colormap'
// Skipping resource definition of 'Atom'
// Skipping resource definition of 'Drawable'
// Skipping resource definition of 'Fontable'
type Visualid uint32
type Timestamp uint32
type Keysym uint32
type Keycode byte
type Button byte
// 'Char2b' struct definition
// Size: 2
type Char2b struct {
Byte1 byte
Byte2 byte
}
// Struct read Char2b
func ReadChar2b(buf []byte, v *Char2b) int {
b := 0
v.Byte1 = buf[b]
b += 1
v.Byte2 = buf[b]
b += 1
return b
}
// Struct list read Char2b
func ReadChar2bList(buf []byte, dest []Char2b) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Char2b{}
b += ReadChar2b(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Char2b
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
}
// Write struct list Char2b
func Char2bListBytes(buf []byte, list []Char2b) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Point' struct definition
// Size: 4
type Point struct {
X int16
Y int16
}
// Struct read Point
func ReadPoint(buf []byte, v *Point) int {
b := 0
v.X = int16(Get16(buf[b:]))
b += 2
v.Y = int16(Get16(buf[b:]))
b += 2
return b
}
// Struct list read Point
func ReadPointList(buf []byte, dest []Point) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Point{}
b += ReadPoint(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Point
func (v Point) Bytes() []byte {
buf := make([]byte, 4)
b := 0
Put16(buf[b:], uint16(v.X))
b += 2
Put16(buf[b:], uint16(v.Y))
b += 2
return buf
}
// Write struct list Point
func PointListBytes(buf []byte, list []Point) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Rectangle' struct definition
// Size: 8
type Rectangle struct {
X int16
Y int16
Width uint16
Height uint16
}
// Struct read Rectangle
func ReadRectangle(buf []byte, v *Rectangle) int {
b := 0
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
return b
}
// Struct list read Rectangle
func ReadRectangleList(buf []byte, dest []Rectangle) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Rectangle{}
b += ReadRectangle(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Rectangle
func (v Rectangle) Bytes() []byte {
buf := make([]byte, 8)
b := 0
Put16(buf[b:], uint16(v.X))
b += 2
Put16(buf[b:], uint16(v.Y))
b += 2
Put16(buf[b:], v.Width)
b += 2
Put16(buf[b:], v.Height)
b += 2
return buf
}
// Write struct list Rectangle
func RectangleListBytes(buf []byte, list []Rectangle) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Arc' struct definition
// Size: 12
type Arc struct {
X int16
Y int16
Width uint16
Height uint16
Angle1 int16
Angle2 int16
}
// Struct read Arc
func ReadArc(buf []byte, v *Arc) int {
b := 0
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.Angle1 = int16(Get16(buf[b:]))
b += 2
v.Angle2 = int16(Get16(buf[b:]))
b += 2
return b
}
// Struct list read Arc
func ReadArcList(buf []byte, dest []Arc) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Arc{}
b += ReadArc(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Arc
func (v Arc) Bytes() []byte {
buf := make([]byte, 12)
b := 0
Put16(buf[b:], uint16(v.X))
b += 2
Put16(buf[b:], uint16(v.Y))
b += 2
Put16(buf[b:], v.Width)
b += 2
Put16(buf[b:], v.Height)
b += 2
Put16(buf[b:], uint16(v.Angle1))
b += 2
Put16(buf[b:], uint16(v.Angle2))
b += 2
return buf
}
// Write struct list Arc
func ArcListBytes(buf []byte, list []Arc) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Format' struct definition
// Size: 8
type Format struct {
Depth byte
BitsPerPixel byte
ScanlinePad byte
// padding: 5 bytes
}
// Struct read Format
func ReadFormat(buf []byte, v *Format) int {
b := 0
v.Depth = buf[b]
b += 1
v.BitsPerPixel = buf[b]
b += 1
v.ScanlinePad = buf[b]
b += 1
b += 5 // padding
return b
}
// Struct list read Format
func ReadFormatList(buf []byte, dest []Format) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Format{}
b += ReadFormat(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Format
func (v Format) Bytes() []byte {
buf := make([]byte, 8)
b := 0
buf[b] = v.Depth
b += 1
buf[b] = v.BitsPerPixel
b += 1
buf[b] = v.ScanlinePad
b += 1
b += 5 // padding
return buf
}
// Write struct list Format
func FormatListBytes(buf []byte, list []Format) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'VisualInfo' struct definition
// Size: 24
type VisualInfo struct {
VisualId Visualid
Class byte
BitsPerRgbValue byte
ColormapEntries uint16
RedMask uint32
GreenMask uint32
BlueMask uint32
// padding: 4 bytes
}
// Struct read VisualInfo
func ReadVisualInfo(buf []byte, v *VisualInfo) int {
b := 0
v.VisualId = Visualid(Get32(buf[b:]))
b += 4
v.Class = buf[b]
b += 1
v.BitsPerRgbValue = buf[b]
b += 1
v.ColormapEntries = Get16(buf[b:])
b += 2
v.RedMask = Get32(buf[b:])
b += 4
v.GreenMask = Get32(buf[b:])
b += 4
v.BlueMask = Get32(buf[b:])
b += 4
b += 4 // padding
return b
}
// Struct list read VisualInfo
func ReadVisualInfoList(buf []byte, dest []VisualInfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = VisualInfo{}
b += ReadVisualInfo(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write VisualInfo
func (v VisualInfo) Bytes() []byte {
buf := make([]byte, 24)
b := 0
Put32(buf[b:], uint32(v.VisualId))
b += 4
buf[b] = v.Class
b += 1
buf[b] = v.BitsPerRgbValue
b += 1
Put16(buf[b:], v.ColormapEntries)
b += 2
Put32(buf[b:], v.RedMask)
b += 4
Put32(buf[b:], v.GreenMask)
b += 4
Put32(buf[b:], v.BlueMask)
b += 4
b += 4 // padding
return buf
}
// Write struct list VisualInfo
func VisualInfoListBytes(buf []byte, list []VisualInfo) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'DepthInfo' struct definition
// Size: (8 + pad((int(VisualsLen) * 24)))
type DepthInfo struct {
Depth byte
// padding: 1 bytes
VisualsLen uint16
// padding: 4 bytes
Visuals []VisualInfo // size: pad((int(VisualsLen) * 24))
}
// Struct read DepthInfo
func ReadDepthInfo(buf []byte, v *DepthInfo) int {
b := 0
v.Depth = buf[b]
b += 1
b += 1 // padding
v.VisualsLen = Get16(buf[b:])
b += 2
b += 4 // padding
v.Visuals = make([]VisualInfo, v.VisualsLen)
b += ReadVisualInfoList(buf[b:], v.Visuals)
return b
}
// Struct list read DepthInfo
func ReadDepthInfoList(buf []byte, dest []DepthInfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = DepthInfo{}
b += ReadDepthInfo(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write DepthInfo
func (v DepthInfo) Bytes() []byte {
buf := make([]byte, (8 + pad((int(v.VisualsLen) * 24))))
b := 0
buf[b] = v.Depth
b += 1
b += 1 // padding
Put16(buf[b:], v.VisualsLen)
b += 2
b += 4 // padding
b += VisualInfoListBytes(buf[b:], v.Visuals)
return buf
}
// Write struct list DepthInfo
func DepthInfoListBytes(buf []byte, list []DepthInfo) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// Struct list size DepthInfo
func DepthInfoListSize(list []DepthInfo) int {
size := 0
for _, item := range list {
size += (8 + pad((int(item.VisualsLen) * 24)))
}
return size
}
// 'ScreenInfo' struct definition
// Size: (40 + DepthInfoListSize(AllowedDepths))
type ScreenInfo struct {
Root Id
DefaultColormap Id
WhitePixel uint32
BlackPixel uint32
CurrentInputMasks uint32
WidthInPixels uint16
HeightInPixels uint16
WidthInMillimeters uint16
HeightInMillimeters uint16
MinInstalledMaps uint16
MaxInstalledMaps uint16
RootVisual Visualid
BackingStores byte
SaveUnders bool
RootDepth byte
AllowedDepthsLen byte
AllowedDepths []DepthInfo // size: DepthInfoListSize(AllowedDepths)
}
// Struct read ScreenInfo
func ReadScreenInfo(buf []byte, v *ScreenInfo) int {
b := 0
v.Root = Id(Get32(buf[b:]))
b += 4
v.DefaultColormap = Id(Get32(buf[b:]))
b += 4
v.WhitePixel = Get32(buf[b:])
b += 4
v.BlackPixel = Get32(buf[b:])
b += 4
v.CurrentInputMasks = Get32(buf[b:])
b += 4
v.WidthInPixels = Get16(buf[b:])
b += 2
v.HeightInPixels = Get16(buf[b:])
b += 2
v.WidthInMillimeters = Get16(buf[b:])
b += 2
v.HeightInMillimeters = Get16(buf[b:])
b += 2
v.MinInstalledMaps = Get16(buf[b:])
b += 2
v.MaxInstalledMaps = Get16(buf[b:])
b += 2
v.RootVisual = Visualid(Get32(buf[b:]))
b += 4
v.BackingStores = buf[b]
b += 1
if buf[b] == 1 {
v.SaveUnders = true
} else {
v.SaveUnders = false
}
b += 1
v.RootDepth = buf[b]
b += 1
v.AllowedDepthsLen = buf[b]
b += 1
v.AllowedDepths = make([]DepthInfo, v.AllowedDepthsLen)
b += ReadDepthInfoList(buf[b:], v.AllowedDepths)
return b
}
// Struct list read ScreenInfo
func ReadScreenInfoList(buf []byte, dest []ScreenInfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = ScreenInfo{}
b += ReadScreenInfo(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write ScreenInfo
func (v ScreenInfo) Bytes() []byte {
buf := make([]byte, (40 + DepthInfoListSize(v.AllowedDepths)))
b := 0
Put32(buf[b:], uint32(v.Root))
b += 4
Put32(buf[b:], uint32(v.DefaultColormap))
b += 4
Put32(buf[b:], v.WhitePixel)
b += 4
Put32(buf[b:], v.BlackPixel)
b += 4
Put32(buf[b:], v.CurrentInputMasks)
b += 4
Put16(buf[b:], v.WidthInPixels)
b += 2
Put16(buf[b:], v.HeightInPixels)
b += 2
Put16(buf[b:], v.WidthInMillimeters)
b += 2
Put16(buf[b:], v.HeightInMillimeters)
b += 2
Put16(buf[b:], v.MinInstalledMaps)
b += 2
Put16(buf[b:], v.MaxInstalledMaps)
b += 2
Put32(buf[b:], uint32(v.RootVisual))
b += 4
buf[b] = v.BackingStores
b += 1
if v.SaveUnders {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
buf[b] = v.RootDepth
b += 1
buf[b] = v.AllowedDepthsLen
b += 1
b += DepthInfoListBytes(buf[b:], v.AllowedDepths)
return buf
}
// Write struct list ScreenInfo
func ScreenInfoListBytes(buf []byte, list []ScreenInfo) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// Struct list size ScreenInfo
func ScreenInfoListSize(list []ScreenInfo) int {
size := 0
for _, item := range list {
size += (40 + DepthInfoListSize(item.AllowedDepths))
}
return size
}
// 'SetupRequest' struct definition
// Size: ((12 + pad((int(AuthorizationProtocolNameLen) * 1))) + pad((int(AuthorizationProtocolDataLen) * 1)))
type SetupRequest struct {
ByteOrder byte
// padding: 1 bytes
ProtocolMajorVersion uint16
ProtocolMinorVersion uint16
AuthorizationProtocolNameLen uint16
AuthorizationProtocolDataLen uint16
// padding: 2 bytes
AuthorizationProtocolName string // size: pad((int(AuthorizationProtocolNameLen) * 1))
AuthorizationProtocolData string // size: pad((int(AuthorizationProtocolDataLen) * 1))
}
// Struct read SetupRequest
func ReadSetupRequest(buf []byte, v *SetupRequest) int {
b := 0
v.ByteOrder = buf[b]
b += 1
b += 1 // padding
v.ProtocolMajorVersion = Get16(buf[b:])
b += 2
v.ProtocolMinorVersion = Get16(buf[b:])
b += 2
v.AuthorizationProtocolNameLen = Get16(buf[b:])
b += 2
v.AuthorizationProtocolDataLen = Get16(buf[b:])
b += 2
b += 2 // padding
{
byteString := make([]byte, v.AuthorizationProtocolNameLen)
copy(byteString[:v.AuthorizationProtocolNameLen], buf[b:])
v.AuthorizationProtocolName = string(byteString)
b += pad(int(v.AuthorizationProtocolNameLen))
}
{
byteString := make([]byte, v.AuthorizationProtocolDataLen)
copy(byteString[:v.AuthorizationProtocolDataLen], buf[b:])
v.AuthorizationProtocolData = string(byteString)
b += pad(int(v.AuthorizationProtocolDataLen))
}
return b
}
// Struct list read SetupRequest
func ReadSetupRequestList(buf []byte, dest []SetupRequest) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = SetupRequest{}
b += ReadSetupRequest(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write SetupRequest
func (v SetupRequest) Bytes() []byte {
buf := make([]byte, ((12 + pad((int(v.AuthorizationProtocolNameLen) * 1))) + pad((int(v.AuthorizationProtocolDataLen) * 1))))
b := 0
buf[b] = v.ByteOrder
b += 1
b += 1 // padding
Put16(buf[b:], v.ProtocolMajorVersion)
b += 2
Put16(buf[b:], v.ProtocolMinorVersion)
b += 2
Put16(buf[b:], v.AuthorizationProtocolNameLen)
b += 2
Put16(buf[b:], v.AuthorizationProtocolDataLen)
b += 2
b += 2 // padding
copy(buf[b:], v.AuthorizationProtocolName[:v.AuthorizationProtocolNameLen])
b += pad(int(v.AuthorizationProtocolNameLen))
copy(buf[b:], v.AuthorizationProtocolData[:v.AuthorizationProtocolDataLen])
b += pad(int(v.AuthorizationProtocolDataLen))
return buf
}
// Write struct list SetupRequest
func SetupRequestListBytes(buf []byte, list []SetupRequest) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// Struct list size SetupRequest
func SetupRequestListSize(list []SetupRequest) int {
size := 0
for _, item := range list {
size += ((12 + pad((int(item.AuthorizationProtocolNameLen) * 1))) + pad((int(item.AuthorizationProtocolDataLen) * 1)))
}
return size
}
// 'SetupFailed' struct definition
// Size: (8 + pad((int(ReasonLen) * 1)))
type SetupFailed struct {
Status byte
ReasonLen byte
ProtocolMajorVersion uint16
ProtocolMinorVersion uint16
Length uint16
Reason string // size: pad((int(ReasonLen) * 1))
}
// Struct read SetupFailed
func ReadSetupFailed(buf []byte, v *SetupFailed) int {
b := 0
v.Status = buf[b]
b += 1
v.ReasonLen = buf[b]
b += 1
v.ProtocolMajorVersion = Get16(buf[b:])
b += 2
v.ProtocolMinorVersion = Get16(buf[b:])
b += 2
v.Length = Get16(buf[b:])
b += 2
{
byteString := make([]byte, v.ReasonLen)
copy(byteString[:v.ReasonLen], buf[b:])
v.Reason = string(byteString)
b += pad(int(v.ReasonLen))
}
return b
}
// Struct list read SetupFailed
func ReadSetupFailedList(buf []byte, dest []SetupFailed) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = SetupFailed{}
b += ReadSetupFailed(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write SetupFailed
func (v SetupFailed) Bytes() []byte {
buf := make([]byte, (8 + pad((int(v.ReasonLen) * 1))))
b := 0
buf[b] = v.Status
b += 1
buf[b] = v.ReasonLen
b += 1
Put16(buf[b:], v.ProtocolMajorVersion)
b += 2
Put16(buf[b:], v.ProtocolMinorVersion)
b += 2
Put16(buf[b:], v.Length)
b += 2
copy(buf[b:], v.Reason[:v.ReasonLen])
b += pad(int(v.ReasonLen))
return buf
}
// Write struct list SetupFailed
func SetupFailedListBytes(buf []byte, list []SetupFailed) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// Struct list size SetupFailed
func SetupFailedListSize(list []SetupFailed) int {
size := 0
for _, item := range list {
size += (8 + pad((int(item.ReasonLen) * 1)))
}
return size
}
// 'SetupAuthenticate' struct definition
// Size: (8 + pad(((int(Length) * 4) * 1)))
type SetupAuthenticate struct {
Status byte
// padding: 5 bytes
Length uint16
Reason string // size: pad(((int(Length) * 4) * 1))
}
// Struct read SetupAuthenticate
func ReadSetupAuthenticate(buf []byte, v *SetupAuthenticate) int {
b := 0
v.Status = buf[b]
b += 1
b += 5 // padding
v.Length = Get16(buf[b:])
b += 2
{
byteString := make([]byte, (int(v.Length) * 4))
copy(byteString[:(int(v.Length)*4)], buf[b:])
v.Reason = string(byteString)
b += pad(int((int(v.Length) * 4)))
}
return b
}
// Struct list read SetupAuthenticate
func ReadSetupAuthenticateList(buf []byte, dest []SetupAuthenticate) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = SetupAuthenticate{}
b += ReadSetupAuthenticate(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write SetupAuthenticate
func (v SetupAuthenticate) Bytes() []byte {
buf := make([]byte, (8 + pad(((int(v.Length) * 4) * 1))))
b := 0
buf[b] = v.Status
b += 1
b += 5 // padding
Put16(buf[b:], v.Length)
b += 2
copy(buf[b:], v.Reason[:(int(v.Length)*4)])
b += pad(int((int(v.Length) * 4)))
return buf
}
// Write struct list SetupAuthenticate
func SetupAuthenticateListBytes(buf []byte, list []SetupAuthenticate) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// Struct list size SetupAuthenticate
func SetupAuthenticateListSize(list []SetupAuthenticate) int {
size := 0
for _, item := range list {
size += (8 + pad(((int(item.Length) * 4) * 1)))
}
return size
}
// 'SetupInfo' struct definition
// Size: (((40 + pad((int(VendorLen) * 1))) + pad((int(PixmapFormatsLen) * 8))) + ScreenInfoListSize(Roots))
type SetupInfo struct {
Status byte
// padding: 1 bytes
ProtocolMajorVersion uint16
ProtocolMinorVersion uint16
Length uint16
ReleaseNumber uint32
ResourceIdBase uint32
ResourceIdMask uint32
MotionBufferSize uint32
VendorLen uint16
MaximumRequestLength uint16
RootsLen byte
PixmapFormatsLen byte
ImageByteOrder byte
BitmapFormatBitOrder byte
BitmapFormatScanlineUnit byte
BitmapFormatScanlinePad byte
MinKeycode Keycode
MaxKeycode Keycode
// padding: 4 bytes
Vendor string // size: pad((int(VendorLen) * 1))
PixmapFormats []Format // size: pad((int(PixmapFormatsLen) * 8))
Roots []ScreenInfo // size: ScreenInfoListSize(Roots)
}
// Struct read SetupInfo
func ReadSetupInfo(buf []byte, v *SetupInfo) int {
b := 0
v.Status = buf[b]
b += 1
b += 1 // padding
v.ProtocolMajorVersion = Get16(buf[b:])
b += 2
v.ProtocolMinorVersion = Get16(buf[b:])
b += 2
v.Length = Get16(buf[b:])
b += 2
v.ReleaseNumber = Get32(buf[b:])
b += 4
v.ResourceIdBase = Get32(buf[b:])
b += 4
v.ResourceIdMask = Get32(buf[b:])
b += 4
v.MotionBufferSize = Get32(buf[b:])
b += 4
v.VendorLen = Get16(buf[b:])
b += 2
v.MaximumRequestLength = Get16(buf[b:])
b += 2
v.RootsLen = buf[b]
b += 1
v.PixmapFormatsLen = buf[b]
b += 1
v.ImageByteOrder = buf[b]
b += 1
v.BitmapFormatBitOrder = buf[b]
b += 1
v.BitmapFormatScanlineUnit = buf[b]
b += 1
v.BitmapFormatScanlinePad = buf[b]
b += 1
v.MinKeycode = Keycode(buf[b])
b += 1
v.MaxKeycode = Keycode(buf[b])
b += 1
b += 4 // padding
{
byteString := make([]byte, v.VendorLen)
copy(byteString[:v.VendorLen], buf[b:])
v.Vendor = string(byteString)
b += pad(int(v.VendorLen))
}
v.PixmapFormats = make([]Format, v.PixmapFormatsLen)
b += ReadFormatList(buf[b:], v.PixmapFormats)
v.Roots = make([]ScreenInfo, v.RootsLen)
b += ReadScreenInfoList(buf[b:], v.Roots)
return b
}
// Struct list read SetupInfo
func ReadSetupInfoList(buf []byte, dest []SetupInfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = SetupInfo{}
b += ReadSetupInfo(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write SetupInfo
func (v SetupInfo) Bytes() []byte {
buf := make([]byte, (((40 + pad((int(v.VendorLen) * 1))) + pad((int(v.PixmapFormatsLen) * 8))) + ScreenInfoListSize(v.Roots)))
b := 0
buf[b] = v.Status
b += 1
b += 1 // padding
Put16(buf[b:], v.ProtocolMajorVersion)
b += 2
Put16(buf[b:], v.ProtocolMinorVersion)
b += 2
Put16(buf[b:], v.Length)
b += 2
Put32(buf[b:], v.ReleaseNumber)
b += 4
Put32(buf[b:], v.ResourceIdBase)
b += 4
Put32(buf[b:], v.ResourceIdMask)
b += 4
Put32(buf[b:], v.MotionBufferSize)
b += 4
Put16(buf[b:], v.VendorLen)
b += 2
Put16(buf[b:], v.MaximumRequestLength)
b += 2
buf[b] = v.RootsLen
b += 1
buf[b] = v.PixmapFormatsLen
b += 1
buf[b] = v.ImageByteOrder
b += 1
buf[b] = v.BitmapFormatBitOrder
b += 1
buf[b] = v.BitmapFormatScanlineUnit
b += 1
buf[b] = v.BitmapFormatScanlinePad
b += 1
buf[b] = byte(v.MinKeycode)
b += 1
buf[b] = byte(v.MaxKeycode)
b += 1
b += 4 // padding
copy(buf[b:], v.Vendor[:v.VendorLen])
b += pad(int(v.VendorLen))
b += FormatListBytes(buf[b:], v.PixmapFormats)
b += ScreenInfoListBytes(buf[b:], v.Roots)
return buf
}
// Write struct list SetupInfo
func SetupInfoListBytes(buf []byte, list []SetupInfo) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// Struct list size SetupInfo
func SetupInfoListSize(list []SetupInfo) int {
size := 0
for _, item := range list {
size += (((40 + pad((int(item.VendorLen) * 1))) + pad((int(item.PixmapFormatsLen) * 8))) + ScreenInfoListSize(item.Roots))
}
return size
}
// 'Timecoord' struct definition
// Size: 8
type Timecoord struct {
Time Timestamp
X int16
Y int16
}
// Struct read Timecoord
func ReadTimecoord(buf []byte, v *Timecoord) int {
b := 0
v.Time = Timestamp(Get32(buf[b:]))
b += 4
v.X = int16(Get16(buf[b:]))
b += 2
v.Y = int16(Get16(buf[b:]))
b += 2
return b
}
// Struct list read Timecoord
func ReadTimecoordList(buf []byte, dest []Timecoord) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Timecoord{}
b += ReadTimecoord(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Timecoord
func (v Timecoord) Bytes() []byte {
buf := make([]byte, 8)
b := 0
Put32(buf[b:], uint32(v.Time))
b += 4
Put16(buf[b:], uint16(v.X))
b += 2
Put16(buf[b:], uint16(v.Y))
b += 2
return buf
}
// Write struct list Timecoord
func TimecoordListBytes(buf []byte, list []Timecoord) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Fontprop' struct definition
// Size: 8
type Fontprop struct {
Name Id
Value uint32
}
// Struct read Fontprop
func ReadFontprop(buf []byte, v *Fontprop) int {
b := 0
v.Name = Id(Get32(buf[b:]))
b += 4
v.Value = Get32(buf[b:])
b += 4
return b
}
// Struct list read Fontprop
func ReadFontpropList(buf []byte, dest []Fontprop) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Fontprop{}
b += ReadFontprop(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Fontprop
func (v Fontprop) Bytes() []byte {
buf := make([]byte, 8)
b := 0
Put32(buf[b:], uint32(v.Name))
b += 4
Put32(buf[b:], v.Value)
b += 4
return buf
}
// Write struct list Fontprop
func FontpropListBytes(buf []byte, list []Fontprop) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Charinfo' struct definition
// Size: 12
type Charinfo struct {
LeftSideBearing int16
RightSideBearing int16
CharacterWidth int16
Ascent int16
Descent int16
Attributes uint16
}
// Struct read Charinfo
func ReadCharinfo(buf []byte, v *Charinfo) int {
b := 0
v.LeftSideBearing = int16(Get16(buf[b:]))
b += 2
v.RightSideBearing = int16(Get16(buf[b:]))
b += 2
v.CharacterWidth = int16(Get16(buf[b:]))
b += 2
v.Ascent = int16(Get16(buf[b:]))
b += 2
v.Descent = int16(Get16(buf[b:]))
b += 2
v.Attributes = Get16(buf[b:])
b += 2
return b
}
// Struct list read Charinfo
func ReadCharinfoList(buf []byte, dest []Charinfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Charinfo{}
b += ReadCharinfo(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Charinfo
func (v Charinfo) Bytes() []byte {
buf := make([]byte, 12)
b := 0
Put16(buf[b:], uint16(v.LeftSideBearing))
b += 2
Put16(buf[b:], uint16(v.RightSideBearing))
b += 2
Put16(buf[b:], uint16(v.CharacterWidth))
b += 2
Put16(buf[b:], uint16(v.Ascent))
b += 2
Put16(buf[b:], uint16(v.Descent))
b += 2
Put16(buf[b:], v.Attributes)
b += 2
return buf
}
// Write struct list Charinfo
func CharinfoListBytes(buf []byte, list []Charinfo) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Str' struct definition
// Size: (1 + pad((int(NameLen) * 1)))
type Str struct {
NameLen byte
Name string // size: pad((int(NameLen) * 1))
}
// Struct read Str
func ReadStr(buf []byte, v *Str) int {
b := 0
v.NameLen = buf[b]
b += 1
{
byteString := make([]byte, v.NameLen)
copy(byteString[:v.NameLen], buf[b:])
v.Name = string(byteString)
b += pad(int(v.NameLen))
}
return b
}
// Struct list read Str
func ReadStrList(buf []byte, dest []Str) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Str{}
b += ReadStr(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Str
func (v Str) Bytes() []byte {
buf := make([]byte, (1 + pad((int(v.NameLen) * 1))))
b := 0
buf[b] = v.NameLen
b += 1
copy(buf[b:], v.Name[:v.NameLen])
b += pad(int(v.NameLen))
return buf
}
// Write struct list Str
func StrListBytes(buf []byte, list []Str) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// Struct list size Str
func StrListSize(list []Str) int {
size := 0
for _, item := range list {
size += (1 + pad((int(item.NameLen) * 1)))
}
return size
}
// 'Segment' struct definition
// Size: 8
type Segment struct {
X1 int16
Y1 int16
X2 int16
Y2 int16
}
// Struct read Segment
func ReadSegment(buf []byte, v *Segment) int {
b := 0
v.X1 = int16(Get16(buf[b:]))
b += 2
v.Y1 = int16(Get16(buf[b:]))
b += 2
v.X2 = int16(Get16(buf[b:]))
b += 2
v.Y2 = int16(Get16(buf[b:]))
b += 2
return b
}
// Struct list read Segment
func ReadSegmentList(buf []byte, dest []Segment) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Segment{}
b += ReadSegment(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Segment
func (v Segment) Bytes() []byte {
buf := make([]byte, 8)
b := 0
Put16(buf[b:], uint16(v.X1))
b += 2
Put16(buf[b:], uint16(v.Y1))
b += 2
Put16(buf[b:], uint16(v.X2))
b += 2
Put16(buf[b:], uint16(v.Y2))
b += 2
return buf
}
// Write struct list Segment
func SegmentListBytes(buf []byte, list []Segment) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Coloritem' struct definition
// Size: 12
type Coloritem struct {
Pixel uint32
Red uint16
Green uint16
Blue uint16
Flags byte
// padding: 1 bytes
}
// Struct read Coloritem
func ReadColoritem(buf []byte, v *Coloritem) int {
b := 0
v.Pixel = Get32(buf[b:])
b += 4
v.Red = Get16(buf[b:])
b += 2
v.Green = Get16(buf[b:])
b += 2
v.Blue = Get16(buf[b:])
b += 2
v.Flags = buf[b]
b += 1
b += 1 // padding
return b
}
// Struct list read Coloritem
func ReadColoritemList(buf []byte, dest []Coloritem) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Coloritem{}
b += ReadColoritem(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Coloritem
func (v Coloritem) Bytes() []byte {
buf := make([]byte, 12)
b := 0
Put32(buf[b:], v.Pixel)
b += 4
Put16(buf[b:], v.Red)
b += 2
Put16(buf[b:], v.Green)
b += 2
Put16(buf[b:], v.Blue)
b += 2
buf[b] = v.Flags
b += 1
b += 1 // padding
return buf
}
// Write struct list Coloritem
func ColoritemListBytes(buf []byte, list []Coloritem) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Rgb' struct definition
// Size: 8
type Rgb struct {
Red uint16
Green uint16
Blue uint16
// padding: 2 bytes
}
// Struct read Rgb
func ReadRgb(buf []byte, v *Rgb) int {
b := 0
v.Red = Get16(buf[b:])
b += 2
v.Green = Get16(buf[b:])
b += 2
v.Blue = Get16(buf[b:])
b += 2
b += 2 // padding
return b
}
// Struct list read Rgb
func ReadRgbList(buf []byte, dest []Rgb) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Rgb{}
b += ReadRgb(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Rgb
func (v Rgb) Bytes() []byte {
buf := make([]byte, 8)
b := 0
Put16(buf[b:], v.Red)
b += 2
Put16(buf[b:], v.Green)
b += 2
Put16(buf[b:], v.Blue)
b += 2
b += 2 // padding
return buf
}
// Write struct list Rgb
func RgbListBytes(buf []byte, list []Rgb) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// 'Host' struct definition
// Size: (4 + pad((int(AddressLen) * 1)))
type Host struct {
Family byte
// padding: 1 bytes
AddressLen uint16
Address []byte // size: pad((int(AddressLen) * 1))
}
// Struct read Host
func ReadHost(buf []byte, v *Host) int {
b := 0
v.Family = buf[b]
b += 1
b += 1 // padding
v.AddressLen = Get16(buf[b:])
b += 2
v.Address = make([]byte, v.AddressLen)
copy(v.Address[:v.AddressLen], buf[b:])
b += pad(int(v.AddressLen))
return b
}
// Struct list read Host
func ReadHostList(buf []byte, dest []Host) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Host{}
b += ReadHost(buf[b:], &dest[i])
}
return pad(b)
}
// Struct write Host
func (v Host) Bytes() []byte {
buf := make([]byte, (4 + pad((int(v.AddressLen) * 1))))
b := 0
buf[b] = v.Family
b += 1
b += 1 // padding
Put16(buf[b:], v.AddressLen)
b += 2
copy(buf[b:], v.Address[:v.AddressLen])
b += pad(int(v.AddressLen))
return buf
}
// Write struct list Host
func HostListBytes(buf []byte, list []Host) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += pad(len(structBytes))
}
return b
}
// Struct list size Host
func HostListSize(list []Host) int {
size := 0
for _, item := range list {
size += (4 + pad((int(item.AddressLen) * 1)))
}
return size
}
// Union definition ClientMessageDataUnion
// 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':
// NewClientMessageDataUnionData8(Data8 []byte) ClientMessageDataUnion
// NewClientMessageDataUnionData16(Data16 []uint16) ClientMessageDataUnion
// NewClientMessageDataUnionData32(Data32 []uint32) ClientMessageDataUnion
type ClientMessageDataUnion struct {
Data8 []byte // size: pad(20)
Data16 []uint16 // size: pad(20)
Data32 []uint32 // size: pad(20)
}
// Union constructor for ClientMessageDataUnion for field Data8.
func NewClientMessageDataUnionData8(Data8 []byte) ClientMessageDataUnion {
var b int
buf := make([]byte, pad(20))
copy(buf[b:], Data8[:20])
b += pad(int(20))
// Create the Union type
v := ClientMessageDataUnion{}
// Now copy buf into all fields
b = 0 // always read the same bytes
v.Data8 = make([]byte, 20)
copy(v.Data8[:20], buf[b:])
b += pad(int(20))
b = 0 // always read the same bytes
v.Data16 = make([]uint16, 10)
for i := 0; i < int(10); i++ {
v.Data16[i] = Get16(buf[b:])
b += 2
}
b = pad(b)
b = 0 // always read the same bytes
v.Data32 = make([]uint32, 5)
for i := 0; i < int(5); i++ {
v.Data32[i] = Get32(buf[b:])
b += 4
}
b = pad(b)
return v
}
// Union constructor for ClientMessageDataUnion for field Data16.
func NewClientMessageDataUnionData16(Data16 []uint16) ClientMessageDataUnion {
var b int
buf := make([]byte, pad(20))
for i := 0; i < int(10); i++ {
Put16(buf[b:], Data16[i])
b += 2
}
b = pad(b)
// Create the Union type
v := ClientMessageDataUnion{}
// Now copy buf into all fields
b = 0 // always read the same bytes
v.Data8 = make([]byte, 20)
copy(v.Data8[:20], buf[b:])
b += pad(int(20))
b = 0 // always read the same bytes
v.Data16 = make([]uint16, 10)
for i := 0; i < int(10); i++ {
v.Data16[i] = Get16(buf[b:])
b += 2
}
b = pad(b)
b = 0 // always read the same bytes
v.Data32 = make([]uint32, 5)
for i := 0; i < int(5); i++ {
v.Data32[i] = Get32(buf[b:])
b += 4
}
b = pad(b)
return v
}
// Union constructor for ClientMessageDataUnion for field Data32.
func NewClientMessageDataUnionData32(Data32 []uint32) ClientMessageDataUnion {
var b int
buf := make([]byte, pad(20))
for i := 0; i < int(5); i++ {
Put32(buf[b:], Data32[i])
b += 4
}
b = pad(b)
// Create the Union type
v := ClientMessageDataUnion{}
// Now copy buf into all fields
b = 0 // always read the same bytes
v.Data8 = make([]byte, 20)
copy(v.Data8[:20], buf[b:])
b += pad(int(20))
b = 0 // always read the same bytes
v.Data16 = make([]uint16, 10)
for i := 0; i < int(10); i++ {
v.Data16[i] = Get16(buf[b:])
b += 2
}
b = pad(b)
b = 0 // always read the same bytes
v.Data32 = make([]uint32, 5)
for i := 0; i < int(5); i++ {
v.Data32[i] = Get32(buf[b:])
b += 4
}
b = pad(b)
return v
}
// Union read ClientMessageDataUnion
func ReadClientMessageDataUnion(buf []byte, v *ClientMessageDataUnion) int {
var b int
b = 0 // re-read the same bytes
v.Data8 = make([]byte, 20)
copy(v.Data8[:20], buf[b:])
b += pad(int(20))
b = 0 // re-read the same bytes
v.Data16 = make([]uint16, 10)
for i := 0; i < int(10); i++ {
v.Data16[i] = Get16(buf[b:])
b += 2
}
b = pad(b)
b = 0 // re-read the same bytes
v.Data32 = make([]uint32, 5)
for i := 0; i < int(5); i++ {
v.Data32[i] = Get32(buf[b:])
b += 4
}
b = pad(b)
return pad(20)
}
// Union list read ClientMessageDataUnion
func ReadClientMessageDataUnionList(buf []byte, dest []ClientMessageDataUnion) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = ClientMessageDataUnion{}
b += ReadClientMessageDataUnion(buf[b:], &dest[i])
}
return pad(b)
}
// Union write ClientMessageDataUnion
// Each field in a union must contain the same data.
// So simply pick the first field and write that to the wire.
func (v ClientMessageDataUnion) Bytes() []byte {
buf := make([]byte, pad(20))
b := 0
copy(buf[b:], v.Data8[:20])
b += pad(int(20))
return buf
}
// Union list write ClientMessageDataUnion
func ClientMessageDataUnionListBytes(buf []byte, list []ClientMessageDataUnion) int {
b := 0
var unionBytes []byte
for _, item := range list {
unionBytes = item.Bytes()
copy(buf[b:], unionBytes)
b += pad(len(unionBytes))
}
return b
}
// Event definition KeyPress (2)
// Size: 32
const KeyPress = 2
type KeyPressEvent struct {
Sequence uint16
Detail Keycode
Time Timestamp
Root Id
Event Id
Child Id
RootX int16
RootY int16
EventX int16
EventY int16
State uint16
SameScreen bool
// padding: 1 bytes
}
// Event read KeyPress
func NewKeyPressEvent(buf []byte) Event {
v := KeyPressEvent{}
b := 1 // don't read event number
v.Detail = Keycode(buf[b])
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Time = Timestamp(Get32(buf[b:]))
b += 4
v.Root = Id(Get32(buf[b:]))
b += 4
v.Event = Id(Get32(buf[b:]))
b += 4
v.Child = Id(Get32(buf[b:]))
b += 4
v.RootX = int16(Get16(buf[b:]))
b += 2
v.RootY = int16(Get16(buf[b:]))
b += 2
v.EventX = int16(Get16(buf[b:]))
b += 2
v.EventY = int16(Get16(buf[b:]))
b += 2
v.State = Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.SameScreen = true
} else {
v.SameScreen = false
}
b += 1
b += 1 // padding
return v
}
// Event write KeyPress
func (v KeyPressEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 2
b += 1
buf[b] = byte(v.Detail)
b += 1
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Time))
b += 4
Put32(buf[b:], uint32(v.Root))
b += 4
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Child))
b += 4
Put16(buf[b:], uint16(v.RootX))
b += 2
Put16(buf[b:], uint16(v.RootY))
b += 2
Put16(buf[b:], uint16(v.EventX))
b += 2
Put16(buf[b:], uint16(v.EventY))
b += 2
Put16(buf[b:], v.State)
b += 2
if v.SameScreen {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
func (v KeyPressEvent) ImplementsEvent() {}
func init() {
newEventFuncs[2] = NewKeyPressEvent
}
// Event definition ButtonPress (4)
// Size: 32
const ButtonPress = 4
type ButtonPressEvent struct {
Sequence uint16
Detail Button
Time Timestamp
Root Id
Event Id
Child Id
RootX int16
RootY int16
EventX int16
EventY int16
State uint16
SameScreen bool
// padding: 1 bytes
}
// Event read ButtonPress
func NewButtonPressEvent(buf []byte) Event {
v := ButtonPressEvent{}
b := 1 // don't read event number
v.Detail = Button(buf[b])
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Time = Timestamp(Get32(buf[b:]))
b += 4
v.Root = Id(Get32(buf[b:]))
b += 4
v.Event = Id(Get32(buf[b:]))
b += 4
v.Child = Id(Get32(buf[b:]))
b += 4
v.RootX = int16(Get16(buf[b:]))
b += 2
v.RootY = int16(Get16(buf[b:]))
b += 2
v.EventX = int16(Get16(buf[b:]))
b += 2
v.EventY = int16(Get16(buf[b:]))
b += 2
v.State = Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.SameScreen = true
} else {
v.SameScreen = false
}
b += 1
b += 1 // padding
return v
}
// Event write ButtonPress
func (v ButtonPressEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 4
b += 1
buf[b] = byte(v.Detail)
b += 1
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Time))
b += 4
Put32(buf[b:], uint32(v.Root))
b += 4
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Child))
b += 4
Put16(buf[b:], uint16(v.RootX))
b += 2
Put16(buf[b:], uint16(v.RootY))
b += 2
Put16(buf[b:], uint16(v.EventX))
b += 2
Put16(buf[b:], uint16(v.EventY))
b += 2
Put16(buf[b:], v.State)
b += 2
if v.SameScreen {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
func (v ButtonPressEvent) ImplementsEvent() {}
func init() {
newEventFuncs[4] = NewButtonPressEvent
}
// Event definition MotionNotify (6)
// Size: 32
const MotionNotify = 6
type MotionNotifyEvent struct {
Sequence uint16
Detail byte
Time Timestamp
Root Id
Event Id
Child Id
RootX int16
RootY int16
EventX int16
EventY int16
State uint16
SameScreen bool
// padding: 1 bytes
}
// Event read MotionNotify
func NewMotionNotifyEvent(buf []byte) Event {
v := MotionNotifyEvent{}
b := 1 // don't read event number
v.Detail = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Time = Timestamp(Get32(buf[b:]))
b += 4
v.Root = Id(Get32(buf[b:]))
b += 4
v.Event = Id(Get32(buf[b:]))
b += 4
v.Child = Id(Get32(buf[b:]))
b += 4
v.RootX = int16(Get16(buf[b:]))
b += 2
v.RootY = int16(Get16(buf[b:]))
b += 2
v.EventX = int16(Get16(buf[b:]))
b += 2
v.EventY = int16(Get16(buf[b:]))
b += 2
v.State = Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.SameScreen = true
} else {
v.SameScreen = false
}
b += 1
b += 1 // padding
return v
}
// Event write MotionNotify
func (v MotionNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 6
b += 1
buf[b] = v.Detail
b += 1
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Time))
b += 4
Put32(buf[b:], uint32(v.Root))
b += 4
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Child))
b += 4
Put16(buf[b:], uint16(v.RootX))
b += 2
Put16(buf[b:], uint16(v.RootY))
b += 2
Put16(buf[b:], uint16(v.EventX))
b += 2
Put16(buf[b:], uint16(v.EventY))
b += 2
Put16(buf[b:], v.State)
b += 2
if v.SameScreen {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
func (v MotionNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[6] = NewMotionNotifyEvent
}
// Event definition EnterNotify (7)
// Size: 32
const EnterNotify = 7
type EnterNotifyEvent struct {
Sequence uint16
Detail byte
Time Timestamp
Root Id
Event Id
Child Id
RootX int16
RootY int16
EventX int16
EventY int16
State uint16
Mode byte
SameScreenFocus byte
}
// Event read EnterNotify
func NewEnterNotifyEvent(buf []byte) Event {
v := EnterNotifyEvent{}
b := 1 // don't read event number
v.Detail = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Time = Timestamp(Get32(buf[b:]))
b += 4
v.Root = Id(Get32(buf[b:]))
b += 4
v.Event = Id(Get32(buf[b:]))
b += 4
v.Child = Id(Get32(buf[b:]))
b += 4
v.RootX = int16(Get16(buf[b:]))
b += 2
v.RootY = int16(Get16(buf[b:]))
b += 2
v.EventX = int16(Get16(buf[b:]))
b += 2
v.EventY = int16(Get16(buf[b:]))
b += 2
v.State = Get16(buf[b:])
b += 2
v.Mode = buf[b]
b += 1
v.SameScreenFocus = buf[b]
b += 1
return v
}
// Event write EnterNotify
func (v EnterNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 7
b += 1
buf[b] = v.Detail
b += 1
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Time))
b += 4
Put32(buf[b:], uint32(v.Root))
b += 4
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Child))
b += 4
Put16(buf[b:], uint16(v.RootX))
b += 2
Put16(buf[b:], uint16(v.RootY))
b += 2
Put16(buf[b:], uint16(v.EventX))
b += 2
Put16(buf[b:], uint16(v.EventY))
b += 2
Put16(buf[b:], v.State)
b += 2
buf[b] = v.Mode
b += 1
buf[b] = v.SameScreenFocus
b += 1
return buf
}
func (v EnterNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[7] = NewEnterNotifyEvent
}
// Event definition FocusIn (9)
// Size: 32
const FocusIn = 9
type FocusInEvent struct {
Sequence uint16
Detail byte
Event Id
Mode byte
// padding: 3 bytes
}
// Event read FocusIn
func NewFocusInEvent(buf []byte) Event {
v := FocusInEvent{}
b := 1 // don't read event number
v.Detail = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Event = Id(Get32(buf[b:]))
b += 4
v.Mode = buf[b]
b += 1
b += 3 // padding
return v
}
// Event write FocusIn
func (v FocusInEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 9
b += 1
buf[b] = v.Detail
b += 1
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Event))
b += 4
buf[b] = v.Mode
b += 1
b += 3 // padding
return buf
}
func (v FocusInEvent) ImplementsEvent() {}
func init() {
newEventFuncs[9] = NewFocusInEvent
}
// Event definition KeymapNotify (11)
// Size: 32
const KeymapNotify = 11
type KeymapNotifyEvent struct {
Keys []byte // size: pad(31)
}
// Event read KeymapNotify
func NewKeymapNotifyEvent(buf []byte) Event {
v := KeymapNotifyEvent{}
b := 1 // don't read event number
v.Keys = make([]byte, 31)
copy(v.Keys[:31], buf[b:])
b += pad(int(31))
return v
}
// Event write KeymapNotify
func (v KeymapNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 11
b += 1
copy(buf[b:], v.Keys[:31])
b += pad(int(31))
return buf
}
func (v KeymapNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[11] = NewKeymapNotifyEvent
}
// Event definition Expose (12)
// Size: 32
const Expose = 12
type ExposeEvent struct {
Sequence uint16
// padding: 1 bytes
Window Id
X uint16
Y uint16
Width uint16
Height uint16
Count uint16
// padding: 2 bytes
}
// Event read Expose
func NewExposeEvent(buf []byte) Event {
v := ExposeEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Window = Id(Get32(buf[b:]))
b += 4
v.X = Get16(buf[b:])
b += 2
v.Y = Get16(buf[b:])
b += 2
v.Width = Get16(buf[b:])
b += 2
v.Height = Get16(buf[b:])
b += 2
v.Count = Get16(buf[b:])
b += 2
b += 2 // padding
return v
}
// Event write Expose
func (v ExposeEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 12
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Window))
b += 4
Put16(buf[b:], v.X)
b += 2
Put16(buf[b:], v.Y)
b += 2
Put16(buf[b:], v.Width)
b += 2
Put16(buf[b:], v.Height)
b += 2
Put16(buf[b:], v.Count)
b += 2
b += 2 // padding
return buf
}
func (v ExposeEvent) ImplementsEvent() {}
func init() {
newEventFuncs[12] = NewExposeEvent
}
// Event definition GraphicsExposure (13)
// Size: 32
const GraphicsExposure = 13
type GraphicsExposureEvent struct {
Sequence uint16
// padding: 1 bytes
Drawable Id
X uint16
Y uint16
Width uint16
Height uint16
MinorOpcode uint16
Count uint16
MajorOpcode byte
// padding: 3 bytes
}
// Event read GraphicsExposure
func NewGraphicsExposureEvent(buf []byte) Event {
v := GraphicsExposureEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Drawable = Id(Get32(buf[b:]))
b += 4
v.X = Get16(buf[b:])
b += 2
v.Y = Get16(buf[b:])
b += 2
v.Width = Get16(buf[b:])
b += 2
v.Height = Get16(buf[b:])
b += 2
v.MinorOpcode = Get16(buf[b:])
b += 2
v.Count = Get16(buf[b:])
b += 2
v.MajorOpcode = buf[b]
b += 1
b += 3 // padding
return v
}
// Event write GraphicsExposure
func (v GraphicsExposureEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 13
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Drawable))
b += 4
Put16(buf[b:], v.X)
b += 2
Put16(buf[b:], v.Y)
b += 2
Put16(buf[b:], v.Width)
b += 2
Put16(buf[b:], v.Height)
b += 2
Put16(buf[b:], v.MinorOpcode)
b += 2
Put16(buf[b:], v.Count)
b += 2
buf[b] = v.MajorOpcode
b += 1
b += 3 // padding
return buf
}
func (v GraphicsExposureEvent) ImplementsEvent() {}
func init() {
newEventFuncs[13] = NewGraphicsExposureEvent
}
// Event definition NoExposure (14)
// Size: 32
const NoExposure = 14
type NoExposureEvent struct {
Sequence uint16
// padding: 1 bytes
Drawable Id
MinorOpcode uint16
MajorOpcode byte
// padding: 1 bytes
}
// Event read NoExposure
func NewNoExposureEvent(buf []byte) Event {
v := NoExposureEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Drawable = Id(Get32(buf[b:]))
b += 4
v.MinorOpcode = Get16(buf[b:])
b += 2
v.MajorOpcode = buf[b]
b += 1
b += 1 // padding
return v
}
// Event write NoExposure
func (v NoExposureEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 14
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Drawable))
b += 4
Put16(buf[b:], v.MinorOpcode)
b += 2
buf[b] = v.MajorOpcode
b += 1
b += 1 // padding
return buf
}
func (v NoExposureEvent) ImplementsEvent() {}
func init() {
newEventFuncs[14] = NewNoExposureEvent
}
// Event definition VisibilityNotify (15)
// Size: 32
const VisibilityNotify = 15
type VisibilityNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Window Id
State byte
// padding: 3 bytes
}
// Event read VisibilityNotify
func NewVisibilityNotifyEvent(buf []byte) Event {
v := VisibilityNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Window = Id(Get32(buf[b:]))
b += 4
v.State = buf[b]
b += 1
b += 3 // padding
return v
}
// Event write VisibilityNotify
func (v VisibilityNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 15
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Window))
b += 4
buf[b] = v.State
b += 1
b += 3 // padding
return buf
}
func (v VisibilityNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[15] = NewVisibilityNotifyEvent
}
// Event definition CreateNotify (16)
// Size: 32
const CreateNotify = 16
type CreateNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Parent Id
Window Id
X int16
Y int16
Width uint16
Height uint16
BorderWidth uint16
OverrideRedirect bool
// padding: 1 bytes
}
// Event read CreateNotify
func NewCreateNotifyEvent(buf []byte) Event {
v := CreateNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Parent = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
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.BorderWidth = Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.OverrideRedirect = true
} else {
v.OverrideRedirect = false
}
b += 1
b += 1 // padding
return v
}
// Event write CreateNotify
func (v CreateNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 16
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Parent))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
Put16(buf[b:], uint16(v.X))
b += 2
Put16(buf[b:], uint16(v.Y))
b += 2
Put16(buf[b:], v.Width)
b += 2
Put16(buf[b:], v.Height)
b += 2
Put16(buf[b:], v.BorderWidth)
b += 2
if v.OverrideRedirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
func (v CreateNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[16] = NewCreateNotifyEvent
}
// Event definition DestroyNotify (17)
// Size: 32
const DestroyNotify = 17
type DestroyNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Id
Window Id
}
// Event read DestroyNotify
func NewDestroyNotifyEvent(buf []byte) Event {
v := DestroyNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Event = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
b += 4
return v
}
// Event write DestroyNotify
func (v DestroyNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 17
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
return buf
}
func (v DestroyNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[17] = NewDestroyNotifyEvent
}
// Event definition UnmapNotify (18)
// Size: 32
const UnmapNotify = 18
type UnmapNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Id
Window Id
FromConfigure bool
// padding: 3 bytes
}
// Event read UnmapNotify
func NewUnmapNotifyEvent(buf []byte) Event {
v := UnmapNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Event = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
b += 4
if buf[b] == 1 {
v.FromConfigure = true
} else {
v.FromConfigure = false
}
b += 1
b += 3 // padding
return v
}
// Event write UnmapNotify
func (v UnmapNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 18
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
if v.FromConfigure {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 3 // padding
return buf
}
func (v UnmapNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[18] = NewUnmapNotifyEvent
}
// Event definition MapNotify (19)
// Size: 32
const MapNotify = 19
type MapNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Id
Window Id
OverrideRedirect bool
// padding: 3 bytes
}
// Event read MapNotify
func NewMapNotifyEvent(buf []byte) Event {
v := MapNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Event = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
b += 4
if buf[b] == 1 {
v.OverrideRedirect = true
} else {
v.OverrideRedirect = false
}
b += 1
b += 3 // padding
return v
}
// Event write MapNotify
func (v MapNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 19
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
if v.OverrideRedirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 3 // padding
return buf
}
func (v MapNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[19] = NewMapNotifyEvent
}
// Event definition MapRequest (20)
// Size: 32
const MapRequest = 20
type MapRequestEvent struct {
Sequence uint16
// padding: 1 bytes
Parent Id
Window Id
}
// Event read MapRequest
func NewMapRequestEvent(buf []byte) Event {
v := MapRequestEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Parent = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
b += 4
return v
}
// Event write MapRequest
func (v MapRequestEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 20
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Parent))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
return buf
}
func (v MapRequestEvent) ImplementsEvent() {}
func init() {
newEventFuncs[20] = NewMapRequestEvent
}
// Event definition ReparentNotify (21)
// Size: 32
const ReparentNotify = 21
type ReparentNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Id
Window Id
Parent Id
X int16
Y int16
OverrideRedirect bool
// padding: 3 bytes
}
// Event read ReparentNotify
func NewReparentNotifyEvent(buf []byte) Event {
v := ReparentNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Event = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
b += 4
v.Parent = Id(Get32(buf[b:]))
b += 4
v.X = int16(Get16(buf[b:]))
b += 2
v.Y = int16(Get16(buf[b:]))
b += 2
if buf[b] == 1 {
v.OverrideRedirect = true
} else {
v.OverrideRedirect = false
}
b += 1
b += 3 // padding
return v
}
// Event write ReparentNotify
func (v ReparentNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 21
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
Put32(buf[b:], uint32(v.Parent))
b += 4
Put16(buf[b:], uint16(v.X))
b += 2
Put16(buf[b:], uint16(v.Y))
b += 2
if v.OverrideRedirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 3 // padding
return buf
}
func (v ReparentNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[21] = NewReparentNotifyEvent
}
// Event definition ConfigureNotify (22)
// Size: 32
const ConfigureNotify = 22
type ConfigureNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Id
Window Id
AboveSibling Id
X int16
Y int16
Width uint16
Height uint16
BorderWidth uint16
OverrideRedirect bool
// padding: 1 bytes
}
// Event read ConfigureNotify
func NewConfigureNotifyEvent(buf []byte) Event {
v := ConfigureNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Event = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
b += 4
v.AboveSibling = Id(Get32(buf[b:]))
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.BorderWidth = Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.OverrideRedirect = true
} else {
v.OverrideRedirect = false
}
b += 1
b += 1 // padding
return v
}
// Event write ConfigureNotify
func (v ConfigureNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 22
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
Put32(buf[b:], uint32(v.AboveSibling))
b += 4
Put16(buf[b:], uint16(v.X))
b += 2
Put16(buf[b:], uint16(v.Y))
b += 2
Put16(buf[b:], v.Width)
b += 2
Put16(buf[b:], v.Height)
b += 2
Put16(buf[b:], v.BorderWidth)
b += 2
if v.OverrideRedirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
func (v ConfigureNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[22] = NewConfigureNotifyEvent
}
// Event definition ConfigureRequest (23)
// Size: 32
const ConfigureRequest = 23
type ConfigureRequestEvent struct {
Sequence uint16
StackMode byte
Parent Id
Window Id
Sibling Id
X int16
Y int16
Width uint16
Height uint16
BorderWidth uint16
ValueMask uint16
}
// Event read ConfigureRequest
func NewConfigureRequestEvent(buf []byte) Event {
v := ConfigureRequestEvent{}
b := 1 // don't read event number
v.StackMode = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Parent = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
b += 4
v.Sibling = Id(Get32(buf[b:]))
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.BorderWidth = Get16(buf[b:])
b += 2
v.ValueMask = Get16(buf[b:])
b += 2
return v
}
// Event write ConfigureRequest
func (v ConfigureRequestEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 23
b += 1
buf[b] = v.StackMode
b += 1
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Parent))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
Put32(buf[b:], uint32(v.Sibling))
b += 4
Put16(buf[b:], uint16(v.X))
b += 2
Put16(buf[b:], uint16(v.Y))
b += 2
Put16(buf[b:], v.Width)
b += 2
Put16(buf[b:], v.Height)
b += 2
Put16(buf[b:], v.BorderWidth)
b += 2
Put16(buf[b:], v.ValueMask)
b += 2
return buf
}
func (v ConfigureRequestEvent) ImplementsEvent() {}
func init() {
newEventFuncs[23] = NewConfigureRequestEvent
}
// Event definition GravityNotify (24)
// Size: 32
const GravityNotify = 24
type GravityNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Id
Window Id
X int16
Y int16
}
// Event read GravityNotify
func NewGravityNotifyEvent(buf []byte) Event {
v := GravityNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Event = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
b += 4
v.X = int16(Get16(buf[b:]))
b += 2
v.Y = int16(Get16(buf[b:]))
b += 2
return v
}
// Event write GravityNotify
func (v GravityNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 24
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
Put16(buf[b:], uint16(v.X))
b += 2
Put16(buf[b:], uint16(v.Y))
b += 2
return buf
}
func (v GravityNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[24] = NewGravityNotifyEvent
}
// Event definition ResizeRequest (25)
// Size: 32
const ResizeRequest = 25
type ResizeRequestEvent struct {
Sequence uint16
// padding: 1 bytes
Window Id
Width uint16
Height uint16
}
// Event read ResizeRequest
func NewResizeRequestEvent(buf []byte) Event {
v := ResizeRequestEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Window = Id(Get32(buf[b:]))
b += 4
v.Width = Get16(buf[b:])
b += 2
v.Height = Get16(buf[b:])
b += 2
return v
}
// Event write ResizeRequest
func (v ResizeRequestEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 25
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Window))
b += 4
Put16(buf[b:], v.Width)
b += 2
Put16(buf[b:], v.Height)
b += 2
return buf
}
func (v ResizeRequestEvent) ImplementsEvent() {}
func init() {
newEventFuncs[25] = NewResizeRequestEvent
}
// Event definition CirculateNotify (26)
// Size: 32
const CirculateNotify = 26
type CirculateNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Id
Window Id
// padding: 4 bytes
Place byte
// padding: 3 bytes
}
// Event read CirculateNotify
func NewCirculateNotifyEvent(buf []byte) Event {
v := CirculateNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Event = Id(Get32(buf[b:]))
b += 4
v.Window = Id(Get32(buf[b:]))
b += 4
b += 4 // padding
v.Place = buf[b]
b += 1
b += 3 // padding
return v
}
// Event write CirculateNotify
func (v CirculateNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 26
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Event))
b += 4
Put32(buf[b:], uint32(v.Window))
b += 4
b += 4 // padding
buf[b] = v.Place
b += 1
b += 3 // padding
return buf
}
func (v CirculateNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[26] = NewCirculateNotifyEvent
}
// Event definition PropertyNotify (28)
// Size: 32
const PropertyNotify = 28
type PropertyNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Window Id
Atom Id
Time Timestamp
State byte
// padding: 3 bytes
}
// Event read PropertyNotify
func NewPropertyNotifyEvent(buf []byte) Event {
v := PropertyNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Window = Id(Get32(buf[b:]))
b += 4
v.Atom = Id(Get32(buf[b:]))
b += 4
v.Time = Timestamp(Get32(buf[b:]))
b += 4
v.State = buf[b]
b += 1
b += 3 // padding
return v
}
// Event write PropertyNotify
func (v PropertyNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 28
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Window))
b += 4
Put32(buf[b:], uint32(v.Atom))
b += 4
Put32(buf[b:], uint32(v.Time))
b += 4
buf[b] = v.State
b += 1
b += 3 // padding
return buf
}
func (v PropertyNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[28] = NewPropertyNotifyEvent
}
// Event definition SelectionClear (29)
// Size: 32
const SelectionClear = 29
type SelectionClearEvent struct {
Sequence uint16
// padding: 1 bytes
Time Timestamp
Owner Id
Selection Id
}
// Event read SelectionClear
func NewSelectionClearEvent(buf []byte) Event {
v := SelectionClearEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Time = Timestamp(Get32(buf[b:]))
b += 4
v.Owner = Id(Get32(buf[b:]))
b += 4
v.Selection = Id(Get32(buf[b:]))
b += 4
return v
}
// Event write SelectionClear
func (v SelectionClearEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 29
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Time))
b += 4
Put32(buf[b:], uint32(v.Owner))
b += 4
Put32(buf[b:], uint32(v.Selection))
b += 4
return buf
}
func (v SelectionClearEvent) ImplementsEvent() {}
func init() {
newEventFuncs[29] = NewSelectionClearEvent
}
// Event definition SelectionRequest (30)
// Size: 32
const SelectionRequest = 30
type SelectionRequestEvent struct {
Sequence uint16
// padding: 1 bytes
Time Timestamp
Owner Id
Requestor Id
Selection Id
Target Id
Property Id
}
// Event read SelectionRequest
func NewSelectionRequestEvent(buf []byte) Event {
v := SelectionRequestEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Time = Timestamp(Get32(buf[b:]))
b += 4
v.Owner = Id(Get32(buf[b:]))
b += 4
v.Requestor = Id(Get32(buf[b:]))
b += 4
v.Selection = Id(Get32(buf[b:]))
b += 4
v.Target = Id(Get32(buf[b:]))
b += 4
v.Property = Id(Get32(buf[b:]))
b += 4
return v
}
// Event write SelectionRequest
func (v SelectionRequestEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 30
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Time))
b += 4
Put32(buf[b:], uint32(v.Owner))
b += 4
Put32(buf[b:], uint32(v.Requestor))
b += 4
Put32(buf[b:], uint32(v.Selection))
b += 4
Put32(buf[b:], uint32(v.Target))
b += 4
Put32(buf[b:], uint32(v.Property))
b += 4
return buf
}
func (v SelectionRequestEvent) ImplementsEvent() {}
func init() {
newEventFuncs[30] = NewSelectionRequestEvent
}
// Event definition SelectionNotify (31)
// Size: 32
const SelectionNotify = 31
type SelectionNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Time Timestamp
Requestor Id
Selection Id
Target Id
Property Id
}
// Event read SelectionNotify
func NewSelectionNotifyEvent(buf []byte) Event {
v := SelectionNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Time = Timestamp(Get32(buf[b:]))
b += 4
v.Requestor = Id(Get32(buf[b:]))
b += 4
v.Selection = Id(Get32(buf[b:]))
b += 4
v.Target = Id(Get32(buf[b:]))
b += 4
v.Property = Id(Get32(buf[b:]))
b += 4
return v
}
// Event write SelectionNotify
func (v SelectionNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 31
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Time))
b += 4
Put32(buf[b:], uint32(v.Requestor))
b += 4
Put32(buf[b:], uint32(v.Selection))
b += 4
Put32(buf[b:], uint32(v.Target))
b += 4
Put32(buf[b:], uint32(v.Property))
b += 4
return buf
}
func (v SelectionNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[31] = NewSelectionNotifyEvent
}
// Event definition ColormapNotify (32)
// Size: 32
const ColormapNotify = 32
type ColormapNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Window Id
Colormap Id
New bool
State byte
// padding: 2 bytes
}
// Event read ColormapNotify
func NewColormapNotifyEvent(buf []byte) Event {
v := ColormapNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Window = Id(Get32(buf[b:]))
b += 4
v.Colormap = Id(Get32(buf[b:]))
b += 4
if buf[b] == 1 {
v.New = true
} else {
v.New = false
}
b += 1
v.State = buf[b]
b += 1
b += 2 // padding
return v
}
// Event write ColormapNotify
func (v ColormapNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 32
b += 1
b += 1 // padding
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Window))
b += 4
Put32(buf[b:], uint32(v.Colormap))
b += 4
if v.New {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
buf[b] = v.State
b += 1
b += 2 // padding
return buf
}
func (v ColormapNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[32] = NewColormapNotifyEvent
}
// Event definition ClientMessage (33)
// Size: 32
const ClientMessage = 33
type ClientMessageEvent struct {
Sequence uint16
Format byte
Window Id
Type Id
Data ClientMessageDataUnion
}
// Event read ClientMessage
func NewClientMessageEvent(buf []byte) Event {
v := ClientMessageEvent{}
b := 1 // don't read event number
v.Format = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Window = Id(Get32(buf[b:]))
b += 4
v.Type = Id(Get32(buf[b:]))
b += 4
v.Data = ClientMessageDataUnion{}
b += ReadClientMessageDataUnion(buf[b:], &v.Data)
return v
}
// Event write ClientMessage
func (v ClientMessageEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 33
b += 1
buf[b] = v.Format
b += 1
b += 2 // skip sequence number
Put32(buf[b:], uint32(v.Window))
b += 4
Put32(buf[b:], uint32(v.Type))
b += 4
{
unionBytes := v.Data.Bytes()
copy(buf[b:], unionBytes)
b += pad(len(unionBytes))
}
return buf
}
func (v ClientMessageEvent) ImplementsEvent() {}
func init() {
newEventFuncs[33] = NewClientMessageEvent
}
// Event definition MappingNotify (34)
// Size: 32
const MappingNotify = 34
type MappingNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Request byte
FirstKeycode Keycode
Count byte
// padding: 1 bytes
}
// Event read MappingNotify
func NewMappingNotifyEvent(buf []byte) Event {
v := MappingNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Request = buf[b]
b += 1
v.FirstKeycode = Keycode(buf[b])
b += 1
v.Count = buf[b]
b += 1
b += 1 // padding
return v
}
// Event write MappingNotify
func (v MappingNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 34
b += 1
b += 1 // padding
b += 2 // skip sequence number
buf[b] = v.Request
b += 1
buf[b] = byte(v.FirstKeycode)
b += 1
buf[b] = v.Count
b += 1
b += 1 // padding
return buf
}
func (v MappingNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[34] = NewMappingNotifyEvent
}
// EventCopy definition KeyRelease (3)
const KeyRelease = 3
type KeyReleaseEvent KeyPressEvent
func NewKeyReleaseEvent(buf []byte) Event {
return KeyReleaseEvent(NewKeyPressEvent(buf).(KeyPressEvent))
}
func (v KeyReleaseEvent) Bytes() []byte {
return KeyPressEvent(v).Bytes()
}
func (v KeyReleaseEvent) ImplementsEvent() {}
func init() {
newEventFuncs[3] = NewKeyReleaseEvent
}
// EventCopy definition ButtonRelease (5)
const ButtonRelease = 5
type ButtonReleaseEvent ButtonPressEvent
func NewButtonReleaseEvent(buf []byte) Event {
return ButtonReleaseEvent(NewButtonPressEvent(buf).(ButtonPressEvent))
}
func (v ButtonReleaseEvent) Bytes() []byte {
return ButtonPressEvent(v).Bytes()
}
func (v ButtonReleaseEvent) ImplementsEvent() {}
func init() {
newEventFuncs[5] = NewButtonReleaseEvent
}
// EventCopy definition LeaveNotify (8)
const LeaveNotify = 8
type LeaveNotifyEvent EnterNotifyEvent
func NewLeaveNotifyEvent(buf []byte) Event {
return LeaveNotifyEvent(NewEnterNotifyEvent(buf).(EnterNotifyEvent))
}
func (v LeaveNotifyEvent) Bytes() []byte {
return EnterNotifyEvent(v).Bytes()
}
func (v LeaveNotifyEvent) ImplementsEvent() {}
func init() {
newEventFuncs[8] = NewLeaveNotifyEvent
}
// EventCopy definition FocusOut (10)
const FocusOut = 10
type FocusOutEvent FocusInEvent
func NewFocusOutEvent(buf []byte) Event {
return FocusOutEvent(NewFocusInEvent(buf).(FocusInEvent))
}
func (v FocusOutEvent) Bytes() []byte {
return FocusInEvent(v).Bytes()
}
func (v FocusOutEvent) ImplementsEvent() {}
func init() {
newEventFuncs[10] = NewFocusOutEvent
}
// EventCopy definition CirculateRequest (27)
const CirculateRequest = 27
type CirculateRequestEvent CirculateNotifyEvent
func NewCirculateRequestEvent(buf []byte) Event {
return CirculateRequestEvent(NewCirculateNotifyEvent(buf).(CirculateNotifyEvent))
}
func (v CirculateRequestEvent) Bytes() []byte {
return CirculateNotifyEvent(v).Bytes()
}
func (v CirculateRequestEvent) ImplementsEvent() {}
func init() {
newEventFuncs[27] = NewCirculateRequestEvent
}
// Error definition Request (1)
// Size: 32
const BadRequest = 1
type RequestError struct {
Sequence uint16
NiceName string
BadValue uint32
MinorOpcode uint16
MajorOpcode byte
// padding: 1 bytes
}
// Error read Request
func NewRequestError(buf []byte) Error {
v := RequestError{}
v.NiceName = "Request"
b := 1 // skip error determinant
b += 1 // don't read error number
v.Sequence = Get16(buf[b:])
b += 2
v.BadValue = Get32(buf[b:])
b += 4
v.MinorOpcode = Get16(buf[b:])
b += 2
v.MajorOpcode = buf[b]
b += 1
b += 1 // padding
return v
}
func (err RequestError) ImplementsError() {}
func (err RequestError) SequenceId() uint16 {
return err.Sequence
}
func (err RequestError) BadId() Id {
return Id(err.BadValue)
}
func (err RequestError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadRequest {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[1] = NewRequestError
}
// Error definition Value (2)
// Size: 32
const BadValue = 2
type ValueError struct {
Sequence uint16
NiceName string
BadValue uint32
MinorOpcode uint16
MajorOpcode byte
// padding: 1 bytes
}
// Error read Value
func NewValueError(buf []byte) Error {
v := ValueError{}
v.NiceName = "Value"
b := 1 // skip error determinant
b += 1 // don't read error number
v.Sequence = Get16(buf[b:])
b += 2
v.BadValue = Get32(buf[b:])
b += 4
v.MinorOpcode = Get16(buf[b:])
b += 2
v.MajorOpcode = buf[b]
b += 1
b += 1 // padding
return v
}
func (err ValueError) ImplementsError() {}
func (err ValueError) SequenceId() uint16 {
return err.Sequence
}
func (err ValueError) BadId() Id {
return Id(err.BadValue)
}
func (err ValueError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadValue {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[2] = NewValueError
}
// ErrorCopy definition Window (3)
const BadWindow = 3
type WindowError ValueError
func NewWindowError(buf []byte) Error {
v := WindowError(NewValueError(buf).(ValueError))
v.NiceName = "Window"
return v
}
func (err WindowError) ImplementsError() {}
func (err WindowError) SequenceId() uint16 {
return err.Sequence
}
func (err WindowError) BadId() Id {
return Id(err.BadValue)
}
func (err WindowError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadWindow {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[3] = NewWindowError
}
// ErrorCopy definition Pixmap (4)
const BadPixmap = 4
type PixmapError ValueError
func NewPixmapError(buf []byte) Error {
v := PixmapError(NewValueError(buf).(ValueError))
v.NiceName = "Pixmap"
return v
}
func (err PixmapError) ImplementsError() {}
func (err PixmapError) SequenceId() uint16 {
return err.Sequence
}
func (err PixmapError) BadId() Id {
return Id(err.BadValue)
}
func (err PixmapError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadPixmap {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[4] = NewPixmapError
}
// ErrorCopy definition Atom (5)
const BadAtom = 5
type AtomError ValueError
func NewAtomError(buf []byte) Error {
v := AtomError(NewValueError(buf).(ValueError))
v.NiceName = "Atom"
return v
}
func (err AtomError) ImplementsError() {}
func (err AtomError) SequenceId() uint16 {
return err.Sequence
}
func (err AtomError) BadId() Id {
return Id(err.BadValue)
}
func (err AtomError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadAtom {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[5] = NewAtomError
}
// ErrorCopy definition Cursor (6)
const BadCursor = 6
type CursorError ValueError
func NewCursorError(buf []byte) Error {
v := CursorError(NewValueError(buf).(ValueError))
v.NiceName = "Cursor"
return v
}
func (err CursorError) ImplementsError() {}
func (err CursorError) SequenceId() uint16 {
return err.Sequence
}
func (err CursorError) BadId() Id {
return Id(err.BadValue)
}
func (err CursorError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadCursor {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[6] = NewCursorError
}
// ErrorCopy definition Font (7)
const BadFont = 7
type FontError ValueError
func NewFontError(buf []byte) Error {
v := FontError(NewValueError(buf).(ValueError))
v.NiceName = "Font"
return v
}
func (err FontError) ImplementsError() {}
func (err FontError) SequenceId() uint16 {
return err.Sequence
}
func (err FontError) BadId() Id {
return Id(err.BadValue)
}
func (err FontError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadFont {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[7] = NewFontError
}
// ErrorCopy definition Match (8)
const BadMatch = 8
type MatchError RequestError
func NewMatchError(buf []byte) Error {
v := MatchError(NewRequestError(buf).(RequestError))
v.NiceName = "Match"
return v
}
func (err MatchError) ImplementsError() {}
func (err MatchError) SequenceId() uint16 {
return err.Sequence
}
func (err MatchError) BadId() Id {
return Id(err.BadValue)
}
func (err MatchError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadMatch {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[8] = NewMatchError
}
// ErrorCopy definition Drawable (9)
const BadDrawable = 9
type DrawableError ValueError
func NewDrawableError(buf []byte) Error {
v := DrawableError(NewValueError(buf).(ValueError))
v.NiceName = "Drawable"
return v
}
func (err DrawableError) ImplementsError() {}
func (err DrawableError) SequenceId() uint16 {
return err.Sequence
}
func (err DrawableError) BadId() Id {
return Id(err.BadValue)
}
func (err DrawableError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadDrawable {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[9] = NewDrawableError
}
// ErrorCopy definition Access (10)
const BadAccess = 10
type AccessError RequestError
func NewAccessError(buf []byte) Error {
v := AccessError(NewRequestError(buf).(RequestError))
v.NiceName = "Access"
return v
}
func (err AccessError) ImplementsError() {}
func (err AccessError) SequenceId() uint16 {
return err.Sequence
}
func (err AccessError) BadId() Id {
return Id(err.BadValue)
}
func (err AccessError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadAccess {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[10] = NewAccessError
}
// ErrorCopy definition Alloc (11)
const BadAlloc = 11
type AllocError RequestError
func NewAllocError(buf []byte) Error {
v := AllocError(NewRequestError(buf).(RequestError))
v.NiceName = "Alloc"
return v
}
func (err AllocError) ImplementsError() {}
func (err AllocError) SequenceId() uint16 {
return err.Sequence
}
func (err AllocError) BadId() Id {
return Id(err.BadValue)
}
func (err AllocError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadAlloc {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[11] = NewAllocError
}
// ErrorCopy definition Colormap (12)
const BadColormap = 12
type ColormapError ValueError
func NewColormapError(buf []byte) Error {
v := ColormapError(NewValueError(buf).(ValueError))
v.NiceName = "Colormap"
return v
}
func (err ColormapError) ImplementsError() {}
func (err ColormapError) SequenceId() uint16 {
return err.Sequence
}
func (err ColormapError) BadId() Id {
return Id(err.BadValue)
}
func (err ColormapError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadColormap {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[12] = NewColormapError
}
// ErrorCopy definition GContext (13)
const BadGContext = 13
type GContextError ValueError
func NewGContextError(buf []byte) Error {
v := GContextError(NewValueError(buf).(ValueError))
v.NiceName = "GContext"
return v
}
func (err GContextError) ImplementsError() {}
func (err GContextError) SequenceId() uint16 {
return err.Sequence
}
func (err GContextError) BadId() Id {
return Id(err.BadValue)
}
func (err GContextError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadGContext {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[13] = NewGContextError
}
// ErrorCopy definition IDChoice (14)
const BadIDChoice = 14
type IDChoiceError ValueError
func NewIDChoiceError(buf []byte) Error {
v := IDChoiceError(NewValueError(buf).(ValueError))
v.NiceName = "IDChoice"
return v
}
func (err IDChoiceError) ImplementsError() {}
func (err IDChoiceError) SequenceId() uint16 {
return err.Sequence
}
func (err IDChoiceError) BadId() Id {
return Id(err.BadValue)
}
func (err IDChoiceError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadIDChoice {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[14] = NewIDChoiceError
}
// ErrorCopy definition Name (15)
const BadName = 15
type NameError RequestError
func NewNameError(buf []byte) Error {
v := NameError(NewRequestError(buf).(RequestError))
v.NiceName = "Name"
return v
}
func (err NameError) ImplementsError() {}
func (err NameError) SequenceId() uint16 {
return err.Sequence
}
func (err NameError) BadId() Id {
return Id(err.BadValue)
}
func (err NameError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadName {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[15] = NewNameError
}
// ErrorCopy definition Length (16)
const BadLength = 16
type LengthError RequestError
func NewLengthError(buf []byte) Error {
v := LengthError(NewRequestError(buf).(RequestError))
v.NiceName = "Length"
return v
}
func (err LengthError) ImplementsError() {}
func (err LengthError) SequenceId() uint16 {
return err.Sequence
}
func (err LengthError) BadId() Id {
return Id(err.BadValue)
}
func (err LengthError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadLength {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[16] = NewLengthError
}
// ErrorCopy definition Implementation (17)
const BadImplementation = 17
type ImplementationError RequestError
func NewImplementationError(buf []byte) Error {
v := ImplementationError(NewRequestError(buf).(RequestError))
v.NiceName = "Implementation"
return v
}
func (err ImplementationError) ImplementsError() {}
func (err ImplementationError) SequenceId() uint16 {
return err.Sequence
}
func (err ImplementationError) BadId() Id {
return Id(err.BadValue)
}
func (err ImplementationError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadImplementation {" + stringsJoin(fieldVals, ", ") + "}"
}
func init() {
newErrorFuncs[17] = NewImplementationError
}
// Request CreateWindow
// size: (28 + (4 + pad((4 * popCount(int(ValueMask))))))
// Write request to wire for CreateWindow
func (c *Conn) CreateWindow(Depth byte, Wid Id, Parent Id, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class uint16, Visual Visualid, ValueMask uint32, ValueList []uint32) {
size := (28 + (4 + pad((4 * popCount(int(ValueMask))))))
b := 0
buf := make([]byte, size)
buf[b] = 1 // request opcode
b += 1
buf[b] = Depth
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Wid))
b += 4
Put32(buf[b:], uint32(Parent))
b += 4
Put16(buf[b:], uint16(X))
b += 2
Put16(buf[b:], uint16(Y))
b += 2
Put16(buf[b:], Width)
b += 2
Put16(buf[b:], Height)
b += 2
Put16(buf[b:], BorderWidth)
b += 2
Put16(buf[b:], Class)
b += 2
Put32(buf[b:], uint32(Visual))
b += 4
Put32(buf[b:], ValueMask)
b += 4
for i := 0; i < popCount(int(ValueMask)); i++ {
Put32(buf[b:], ValueList[i])
b += 4
}
b = pad(b)
c.sendRequest(false, buf)
}
// Request ChangeWindowAttributes
// size: (8 + (4 + pad((4 * popCount(int(ValueMask))))))
// Write request to wire for ChangeWindowAttributes
func (c *Conn) ChangeWindowAttributes(Window Id, ValueMask uint32, ValueList []uint32) {
size := (8 + (4 + pad((4 * popCount(int(ValueMask))))))
b := 0
buf := make([]byte, size)
buf[b] = 2 // request opcode
b += 1
b += 1 // padding
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:], ValueMask)
b += 4
for i := 0; i < popCount(int(ValueMask)); i++ {
Put32(buf[b:], ValueList[i])
b += 4
}
b = pad(b)
c.sendRequest(false, buf)
}
// Request GetWindowAttributes
// size: 8
func (c *Conn) GetWindowAttributes(Window Id) (*GetWindowAttributesReply, error) {
return c.GetWindowAttributesReply(c.GetWindowAttributesRequest(Window))
}
// Write request to wire for GetWindowAttributes
func (c *Conn) GetWindowAttributesRequest(Window Id) *Cookie {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 3 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for GetWindowAttributes
// size: 44
type GetWindowAttributesReply struct {
Sequence uint16
Length uint32
BackingStore byte
Visual Visualid
Class uint16
BitGravity byte
WinGravity byte
BackingPlanes uint32
BackingPixel uint32
SaveUnder bool
MapIsInstalled bool
MapState byte
OverrideRedirect bool
Colormap Id
AllEventMasks uint32
YourEventMask uint32
DoNotPropagateMask uint16
// padding: 2 bytes
}
// Read reply GetWindowAttributes
func (c *Conn) GetWindowAttributesReply(cook *Cookie) (*GetWindowAttributesReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetWindowAttributesReply)
b := 1 // skip reply determinant
v.BackingStore = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.Visual = Visualid(Get32(buf[b:]))
b += 4
v.Class = Get16(buf[b:])
b += 2
v.BitGravity = buf[b]
b += 1
v.WinGravity = buf[b]
b += 1
v.BackingPlanes = Get32(buf[b:])
b += 4
v.BackingPixel = Get32(buf[b:])
b += 4
if buf[b] == 1 {
v.SaveUnder = true
} else {
v.SaveUnder = false
}
b += 1
if buf[b] == 1 {
v.MapIsInstalled = true
} else {
v.MapIsInstalled = false
}
b += 1
v.MapState = buf[b]
b += 1
if buf[b] == 1 {
v.OverrideRedirect = true
} else {
v.OverrideRedirect = false
}
b += 1
v.Colormap = Id(Get32(buf[b:]))
b += 4
v.AllEventMasks = Get32(buf[b:])
b += 4
v.YourEventMask = Get32(buf[b:])
b += 4
v.DoNotPropagateMask = Get16(buf[b:])
b += 2
b += 2 // padding
return v, nil
}
// Request DestroyWindow
// size: 8
// Write request to wire for DestroyWindow
func (c *Conn) DestroyWindow(Window Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 4 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
c.sendRequest(false, buf)
}
// Request DestroySubwindows
// size: 8
// Write request to wire for DestroySubwindows
func (c *Conn) DestroySubwindows(Window Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 5 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
c.sendRequest(false, buf)
}
// Request ChangeSaveSet
// size: 8
// Write request to wire for ChangeSaveSet
func (c *Conn) ChangeSaveSet(Mode byte, Window Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 6 // request opcode
b += 1
buf[b] = Mode
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
c.sendRequest(false, buf)
}
// Request ReparentWindow
// size: 16
// Write request to wire for ReparentWindow
func (c *Conn) ReparentWindow(Window Id, Parent Id, X int16, Y int16) {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 7 // request opcode
b += 1
b += 1 // padding
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(Parent))
b += 4
Put16(buf[b:], uint16(X))
b += 2
Put16(buf[b:], uint16(Y))
b += 2
c.sendRequest(false, buf)
}
// Request MapWindow
// size: 8
// Write request to wire for MapWindow
func (c *Conn) MapWindow(Window Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 8 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
c.sendRequest(false, buf)
}
// Request MapSubwindows
// size: 8
// Write request to wire for MapSubwindows
func (c *Conn) MapSubwindows(Window Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 9 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
c.sendRequest(false, buf)
}
// Request UnmapWindow
// size: 8
// Write request to wire for UnmapWindow
func (c *Conn) UnmapWindow(Window Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 10 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
c.sendRequest(false, buf)
}
// Request UnmapSubwindows
// size: 8
// Write request to wire for UnmapSubwindows
func (c *Conn) UnmapSubwindows(Window Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 11 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
c.sendRequest(false, buf)
}
// Request ConfigureWindow
// size: (10 + (2 + pad((4 * popCount(int(ValueMask))))))
// Write request to wire for ConfigureWindow
func (c *Conn) ConfigureWindow(Window Id, ValueMask uint16, ValueList []uint32) {
size := (10 + (2 + pad((4 * popCount(int(ValueMask))))))
b := 0
buf := make([]byte, size)
buf[b] = 12 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
Put16(buf[b:], ValueMask)
b += 2
b += 2 // padding
for i := 0; i < popCount(int(ValueMask)); i++ {
Put32(buf[b:], ValueList[i])
b += 4
}
b = pad(b)
c.sendRequest(false, buf)
}
// Request CirculateWindow
// size: 8
// Write request to wire for CirculateWindow
func (c *Conn) CirculateWindow(Direction byte, Window Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 13 // request opcode
b += 1
buf[b] = Direction
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
c.sendRequest(false, buf)
}
// Request GetGeometry
// size: 8
func (c *Conn) GetGeometry(Drawable Id) (*GetGeometryReply, error) {
return c.GetGeometryReply(c.GetGeometryRequest(Drawable))
}
// Write request to wire for GetGeometry
func (c *Conn) GetGeometryRequest(Drawable Id) *Cookie {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 14 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for GetGeometry
// size: 24
type GetGeometryReply struct {
Sequence uint16
Length uint32
Depth byte
Root Id
X int16
Y int16
Width uint16
Height uint16
BorderWidth uint16
// padding: 2 bytes
}
// Read reply GetGeometry
func (c *Conn) GetGeometryReply(cook *Cookie) (*GetGeometryReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetGeometryReply)
b := 1 // skip reply determinant
v.Depth = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.Root = Id(Get32(buf[b:]))
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.BorderWidth = Get16(buf[b:])
b += 2
b += 2 // padding
return v, nil
}
// Request QueryTree
// size: 8
func (c *Conn) QueryTree(Window Id) (*QueryTreeReply, error) {
return c.QueryTreeReply(c.QueryTreeRequest(Window))
}
// Write request to wire for QueryTree
func (c *Conn) QueryTreeRequest(Window Id) *Cookie {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 15 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for QueryTree
// size: (32 + pad((int(ChildrenLen) * 4)))
type QueryTreeReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
Root Id
Parent Id
ChildrenLen uint16
// padding: 14 bytes
Children []Id // size: pad((int(ChildrenLen) * 4))
}
// Read reply QueryTree
func (c *Conn) QueryTreeReply(cook *Cookie) (*QueryTreeReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(QueryTreeReply)
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.Root = Id(Get32(buf[b:]))
b += 4
v.Parent = Id(Get32(buf[b:]))
b += 4
v.ChildrenLen = Get16(buf[b:])
b += 2
b += 14 // padding
v.Children = make([]Id, v.ChildrenLen)
for i := 0; i < int(v.ChildrenLen); i++ {
v.Children[i] = Id(Get32(buf[b:]))
b += 4
}
b = pad(b)
return v, nil
}
// Request InternAtom
// size: (8 + pad((int(NameLen) * 1)))
func (c *Conn) InternAtom(OnlyIfExists bool, NameLen uint16, Name string) (*InternAtomReply, error) {
return c.InternAtomReply(c.InternAtomRequest(OnlyIfExists, NameLen, Name))
}
// Write request to wire for InternAtom
func (c *Conn) InternAtomRequest(OnlyIfExists bool, NameLen uint16, Name string) *Cookie {
size := (8 + pad((int(NameLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 16 // request opcode
b += 1
if OnlyIfExists {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put16(buf[b:], NameLen)
b += 2
b += 2 // padding
copy(buf[b:], Name[:NameLen])
b += pad(int(NameLen))
return c.sendRequest(true, buf)
}
// Request reply for InternAtom
// size: 12
type InternAtomReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
Atom Id
}
// Read reply InternAtom
func (c *Conn) InternAtomReply(cook *Cookie) (*InternAtomReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(InternAtomReply)
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 = Id(Get32(buf[b:]))
b += 4
return v, nil
}
// Request GetAtomName
// size: 8
func (c *Conn) GetAtomName(Atom Id) (*GetAtomNameReply, error) {
return c.GetAtomNameReply(c.GetAtomNameRequest(Atom))
}
// Write request to wire for GetAtomName
func (c *Conn) GetAtomNameRequest(Atom Id) *Cookie {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 17 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Atom))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for GetAtomName
// size: (32 + pad((int(NameLen) * 1)))
type GetAtomNameReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
NameLen uint16
// padding: 22 bytes
Name string // size: pad((int(NameLen) * 1))
}
// Read reply GetAtomName
func (c *Conn) GetAtomNameReply(cook *Cookie) (*GetAtomNameReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetAtomNameReply)
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.NameLen = Get16(buf[b:])
b += 2
b += 22 // padding
{
byteString := make([]byte, v.NameLen)
copy(byteString[:v.NameLen], buf[b:])
v.Name = string(byteString)
b += pad(int(v.NameLen))
}
return v, nil
}
// Request ChangeProperty
// size: (24 + pad((((int(DataLen) * int(Format)) / 8) * 1)))
// Write request to wire for ChangeProperty
func (c *Conn) ChangeProperty(Mode byte, Window Id, Property Id, Type Id, Format byte, DataLen uint32, Data []byte) {
size := (24 + pad((((int(DataLen) * int(Format)) / 8) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 18 // request opcode
b += 1
buf[b] = Mode
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(Property))
b += 4
Put32(buf[b:], uint32(Type))
b += 4
buf[b] = Format
b += 1
b += 3 // padding
Put32(buf[b:], DataLen)
b += 4
copy(buf[b:], Data[:((int(DataLen)*int(Format))/8)])
b += pad(int(((int(DataLen) * int(Format)) / 8)))
c.sendRequest(false, buf)
}
// Request DeleteProperty
// size: 12
// Write request to wire for DeleteProperty
func (c *Conn) DeleteProperty(Window Id, Property Id) {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = 19 // request opcode
b += 1
b += 1 // padding
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(Property))
b += 4
c.sendRequest(false, buf)
}
// Request GetProperty
// size: 24
func (c *Conn) GetProperty(Delete bool, Window Id, Property Id, Type Id, LongOffset uint32, LongLength uint32) (*GetPropertyReply, error) {
return c.GetPropertyReply(c.GetPropertyRequest(Delete, Window, Property, Type, LongOffset, LongLength))
}
// Write request to wire for GetProperty
func (c *Conn) GetPropertyRequest(Delete bool, Window Id, Property Id, Type Id, LongOffset uint32, LongLength uint32) *Cookie {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = 20 // request opcode
b += 1
if Delete {
buf[b] = 1
} else {
buf[b] = 0
}
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(Property))
b += 4
Put32(buf[b:], uint32(Type))
b += 4
Put32(buf[b:], LongOffset)
b += 4
Put32(buf[b:], LongLength)
b += 4
return c.sendRequest(true, buf)
}
// Request reply for GetProperty
// size: (32 + pad(((int(ValueLen) * (int(Format) / 8)) * 1)))
type GetPropertyReply struct {
Sequence uint16
Length uint32
Format byte
Type Id
BytesAfter uint32
ValueLen uint32
// padding: 12 bytes
Value []byte // size: pad(((int(ValueLen) * (int(Format) / 8)) * 1))
}
// Read reply GetProperty
func (c *Conn) GetPropertyReply(cook *Cookie) (*GetPropertyReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetPropertyReply)
b := 1 // skip reply determinant
v.Format = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.Type = Id(Get32(buf[b:]))
b += 4
v.BytesAfter = Get32(buf[b:])
b += 4
v.ValueLen = Get32(buf[b:])
b += 4
b += 12 // padding
v.Value = make([]byte, (int(v.ValueLen) * (int(v.Format) / 8)))
copy(v.Value[:(int(v.ValueLen)*(int(v.Format)/8))], buf[b:])
b += pad(int((int(v.ValueLen) * (int(v.Format) / 8))))
return v, nil
}
// Request ListProperties
// size: 8
func (c *Conn) ListProperties(Window Id) (*ListPropertiesReply, error) {
return c.ListPropertiesReply(c.ListPropertiesRequest(Window))
}
// Write request to wire for ListProperties
func (c *Conn) ListPropertiesRequest(Window Id) *Cookie {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 21 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for ListProperties
// size: (32 + pad((int(AtomsLen) * 4)))
type ListPropertiesReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
AtomsLen uint16
// padding: 22 bytes
Atoms []Id // size: pad((int(AtomsLen) * 4))
}
// Read reply ListProperties
func (c *Conn) ListPropertiesReply(cook *Cookie) (*ListPropertiesReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(ListPropertiesReply)
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.AtomsLen = Get16(buf[b:])
b += 2
b += 22 // padding
v.Atoms = make([]Id, v.AtomsLen)
for i := 0; i < int(v.AtomsLen); i++ {
v.Atoms[i] = Id(Get32(buf[b:]))
b += 4
}
b = pad(b)
return v, nil
}
// Request SetSelectionOwner
// size: 16
// Write request to wire for SetSelectionOwner
func (c *Conn) SetSelectionOwner(Owner Id, Selection Id, Time Timestamp) {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 22 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Owner))
b += 4
Put32(buf[b:], uint32(Selection))
b += 4
Put32(buf[b:], uint32(Time))
b += 4
c.sendRequest(false, buf)
}
// Request GetSelectionOwner
// size: 8
func (c *Conn) GetSelectionOwner(Selection Id) (*GetSelectionOwnerReply, error) {
return c.GetSelectionOwnerReply(c.GetSelectionOwnerRequest(Selection))
}
// Write request to wire for GetSelectionOwner
func (c *Conn) GetSelectionOwnerRequest(Selection Id) *Cookie {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 23 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Selection))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for GetSelectionOwner
// size: 12
type GetSelectionOwnerReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
Owner Id
}
// Read reply GetSelectionOwner
func (c *Conn) GetSelectionOwnerReply(cook *Cookie) (*GetSelectionOwnerReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetSelectionOwnerReply)
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.Owner = Id(Get32(buf[b:]))
b += 4
return v, nil
}
// Request ConvertSelection
// size: 24
// Write request to wire for ConvertSelection
func (c *Conn) ConvertSelection(Requestor Id, Selection Id, Target Id, Property Id, Time Timestamp) {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = 24 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Requestor))
b += 4
Put32(buf[b:], uint32(Selection))
b += 4
Put32(buf[b:], uint32(Target))
b += 4
Put32(buf[b:], uint32(Property))
b += 4
Put32(buf[b:], uint32(Time))
b += 4
c.sendRequest(false, buf)
}
// Request SendEvent
// size: (12 + pad(32))
// Write request to wire for SendEvent
func (c *Conn) SendEvent(Propagate bool, Destination Id, EventMask uint32, Event string) {
size := (12 + pad(32))
b := 0
buf := make([]byte, size)
buf[b] = 25 // request opcode
b += 1
if Propagate {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Destination))
b += 4
Put32(buf[b:], EventMask)
b += 4
copy(buf[b:], Event[:32])
b += pad(int(32))
c.sendRequest(false, buf)
}
// Request GrabPointer
// size: 24
func (c *Conn) GrabPointer(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Time Timestamp) (*GrabPointerReply, error) {
return c.GrabPointerReply(c.GrabPointerRequest(OwnerEvents, GrabWindow, EventMask, PointerMode, KeyboardMode, ConfineTo, Cursor, Time))
}
// Write request to wire for GrabPointer
func (c *Conn) GrabPointerRequest(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Time Timestamp) *Cookie {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = 26 // request opcode
b += 1
if OwnerEvents {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(GrabWindow))
b += 4
Put16(buf[b:], EventMask)
b += 2
buf[b] = PointerMode
b += 1
buf[b] = KeyboardMode
b += 1
Put32(buf[b:], uint32(ConfineTo))
b += 4
Put32(buf[b:], uint32(Cursor))
b += 4
Put32(buf[b:], uint32(Time))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for GrabPointer
// size: 8
type GrabPointerReply struct {
Sequence uint16
Length uint32
Status byte
}
// Read reply GrabPointer
func (c *Conn) GrabPointerReply(cook *Cookie) (*GrabPointerReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GrabPointerReply)
b := 1 // skip reply determinant
v.Status = buf[b]
b += 1
return v, nil
}
// Request UngrabPointer
// size: 8
// Write request to wire for UngrabPointer
func (c *Conn) UngrabPointer(Time Timestamp) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 27 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Time))
b += 4
c.sendRequest(false, buf)
}
// Request GrabButton
// size: 24
// Write request to wire for GrabButton
func (c *Conn) GrabButton(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Button byte, Modifiers uint16) {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = 28 // request opcode
b += 1
if OwnerEvents {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(GrabWindow))
b += 4
Put16(buf[b:], EventMask)
b += 2
buf[b] = PointerMode
b += 1
buf[b] = KeyboardMode
b += 1
Put32(buf[b:], uint32(ConfineTo))
b += 4
Put32(buf[b:], uint32(Cursor))
b += 4
buf[b] = Button
b += 1
b += 1 // padding
Put16(buf[b:], Modifiers)
b += 2
c.sendRequest(false, buf)
}
// Request UngrabButton
// size: 12
// Write request to wire for UngrabButton
func (c *Conn) UngrabButton(Button byte, GrabWindow Id, Modifiers uint16) {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = 29 // request opcode
b += 1
buf[b] = Button
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(GrabWindow))
b += 4
Put16(buf[b:], Modifiers)
b += 2
b += 2 // padding
c.sendRequest(false, buf)
}
// Request ChangeActivePointerGrab
// size: 16
// Write request to wire for ChangeActivePointerGrab
func (c *Conn) ChangeActivePointerGrab(Cursor Id, Time Timestamp, EventMask uint16) {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 30 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cursor))
b += 4
Put32(buf[b:], uint32(Time))
b += 4
Put16(buf[b:], EventMask)
b += 2
b += 2 // padding
c.sendRequest(false, buf)
}
// Request GrabKeyboard
// size: 16
func (c *Conn) GrabKeyboard(OwnerEvents bool, GrabWindow Id, Time Timestamp, PointerMode byte, KeyboardMode byte) (*GrabKeyboardReply, error) {
return c.GrabKeyboardReply(c.GrabKeyboardRequest(OwnerEvents, GrabWindow, Time, PointerMode, KeyboardMode))
}
// Write request to wire for GrabKeyboard
func (c *Conn) GrabKeyboardRequest(OwnerEvents bool, GrabWindow Id, Time Timestamp, PointerMode byte, KeyboardMode byte) *Cookie {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 31 // request opcode
b += 1
if OwnerEvents {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(GrabWindow))
b += 4
Put32(buf[b:], uint32(Time))
b += 4
buf[b] = PointerMode
b += 1
buf[b] = KeyboardMode
b += 1
b += 2 // padding
return c.sendRequest(true, buf)
}
// Request reply for GrabKeyboard
// size: 8
type GrabKeyboardReply struct {
Sequence uint16
Length uint32
Status byte
}
// Read reply GrabKeyboard
func (c *Conn) GrabKeyboardReply(cook *Cookie) (*GrabKeyboardReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GrabKeyboardReply)
b := 1 // skip reply determinant
v.Status = buf[b]
b += 1
return v, nil
}
// Request UngrabKeyboard
// size: 8
// Write request to wire for UngrabKeyboard
func (c *Conn) UngrabKeyboard(Time Timestamp) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 32 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Time))
b += 4
c.sendRequest(false, buf)
}
// Request GrabKey
// size: 16
// Write request to wire for GrabKey
func (c *Conn) GrabKey(OwnerEvents bool, GrabWindow Id, Modifiers uint16, Key Keycode, PointerMode byte, KeyboardMode byte) {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 33 // request opcode
b += 1
if OwnerEvents {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(GrabWindow))
b += 4
Put16(buf[b:], Modifiers)
b += 2
buf[b] = byte(Key)
b += 1
buf[b] = PointerMode
b += 1
buf[b] = KeyboardMode
b += 1
b += 3 // padding
c.sendRequest(false, buf)
}
// Request UngrabKey
// size: 12
// Write request to wire for UngrabKey
func (c *Conn) UngrabKey(Key Keycode, GrabWindow Id, Modifiers uint16) {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = 34 // request opcode
b += 1
buf[b] = byte(Key)
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(GrabWindow))
b += 4
Put16(buf[b:], Modifiers)
b += 2
b += 2 // padding
c.sendRequest(false, buf)
}
// Request AllowEvents
// size: 8
// Write request to wire for AllowEvents
func (c *Conn) AllowEvents(Mode byte, Time Timestamp) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 35 // request opcode
b += 1
buf[b] = Mode
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Time))
b += 4
c.sendRequest(false, buf)
}
// Request GrabServer
// size: 3
// Write request to wire for GrabServer
func (c *Conn) GrabServer() {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 36 // request opcode
b += 1
c.sendRequest(false, buf)
}
// Request UngrabServer
// size: 3
// Write request to wire for UngrabServer
func (c *Conn) UngrabServer() {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 37 // request opcode
b += 1
c.sendRequest(false, buf)
}
// Request QueryPointer
// size: 8
func (c *Conn) QueryPointer(Window Id) (*QueryPointerReply, error) {
return c.QueryPointerReply(c.QueryPointerRequest(Window))
}
// Write request to wire for QueryPointer
func (c *Conn) QueryPointerRequest(Window Id) *Cookie {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 38 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for QueryPointer
// size: 28
type QueryPointerReply struct {
Sequence uint16
Length uint32
SameScreen bool
Root Id
Child Id
RootX int16
RootY int16
WinX int16
WinY int16
Mask uint16
// padding: 2 bytes
}
// Read reply QueryPointer
func (c *Conn) QueryPointerReply(cook *Cookie) (*QueryPointerReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(QueryPointerReply)
b := 1 // skip reply determinant
if buf[b] == 1 {
v.SameScreen = true
} else {
v.SameScreen = false
}
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.Root = Id(Get32(buf[b:]))
b += 4
v.Child = Id(Get32(buf[b:]))
b += 4
v.RootX = int16(Get16(buf[b:]))
b += 2
v.RootY = int16(Get16(buf[b:]))
b += 2
v.WinX = int16(Get16(buf[b:]))
b += 2
v.WinY = int16(Get16(buf[b:]))
b += 2
v.Mask = Get16(buf[b:])
b += 2
b += 2 // padding
return v, nil
}
// Request GetMotionEvents
// size: 16
func (c *Conn) GetMotionEvents(Window Id, Start Timestamp, Stop Timestamp) (*GetMotionEventsReply, error) {
return c.GetMotionEventsReply(c.GetMotionEventsRequest(Window, Start, Stop))
}
// Write request to wire for GetMotionEvents
func (c *Conn) GetMotionEventsRequest(Window Id, Start Timestamp, Stop Timestamp) *Cookie {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 39 // request opcode
b += 1
b += 1 // padding
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(Start))
b += 4
Put32(buf[b:], uint32(Stop))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for GetMotionEvents
// size: (32 + pad((int(EventsLen) * 8)))
type GetMotionEventsReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
EventsLen uint32
// padding: 20 bytes
Events []Timecoord // size: pad((int(EventsLen) * 8))
}
// Read reply GetMotionEvents
func (c *Conn) GetMotionEventsReply(cook *Cookie) (*GetMotionEventsReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetMotionEventsReply)
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.EventsLen = Get32(buf[b:])
b += 4
b += 20 // padding
v.Events = make([]Timecoord, v.EventsLen)
b += ReadTimecoordList(buf[b:], v.Events)
return v, nil
}
// Request TranslateCoordinates
// size: 16
func (c *Conn) TranslateCoordinates(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16) (*TranslateCoordinatesReply, error) {
return c.TranslateCoordinatesReply(c.TranslateCoordinatesRequest(SrcWindow, DstWindow, SrcX, SrcY))
}
// Write request to wire for TranslateCoordinates
func (c *Conn) TranslateCoordinatesRequest(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16) *Cookie {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 40 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(SrcWindow))
b += 4
Put32(buf[b:], uint32(DstWindow))
b += 4
Put16(buf[b:], uint16(SrcX))
b += 2
Put16(buf[b:], uint16(SrcY))
b += 2
return c.sendRequest(true, buf)
}
// Request reply for TranslateCoordinates
// size: 16
type TranslateCoordinatesReply struct {
Sequence uint16
Length uint32
SameScreen bool
Child Id
DstX int16
DstY int16
}
// Read reply TranslateCoordinates
func (c *Conn) TranslateCoordinatesReply(cook *Cookie) (*TranslateCoordinatesReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(TranslateCoordinatesReply)
b := 1 // skip reply determinant
if buf[b] == 1 {
v.SameScreen = true
} else {
v.SameScreen = false
}
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.Child = Id(Get32(buf[b:]))
b += 4
v.DstX = int16(Get16(buf[b:]))
b += 2
v.DstY = int16(Get16(buf[b:]))
b += 2
return v, nil
}
// Request WarpPointer
// size: 24
// Write request to wire for WarpPointer
func (c *Conn) WarpPointer(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16) {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = 41 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(SrcWindow))
b += 4
Put32(buf[b:], uint32(DstWindow))
b += 4
Put16(buf[b:], uint16(SrcX))
b += 2
Put16(buf[b:], uint16(SrcY))
b += 2
Put16(buf[b:], SrcWidth)
b += 2
Put16(buf[b:], SrcHeight)
b += 2
Put16(buf[b:], uint16(DstX))
b += 2
Put16(buf[b:], uint16(DstY))
b += 2
c.sendRequest(false, buf)
}
// Request SetInputFocus
// size: 12
// Write request to wire for SetInputFocus
func (c *Conn) SetInputFocus(RevertTo byte, Focus Id, Time Timestamp) {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = 42 // request opcode
b += 1
buf[b] = RevertTo
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Focus))
b += 4
Put32(buf[b:], uint32(Time))
b += 4
c.sendRequest(false, buf)
}
// Request GetInputFocus
// size: 3
func (c *Conn) GetInputFocus() (*GetInputFocusReply, error) {
return c.GetInputFocusReply(c.GetInputFocusRequest())
}
// Write request to wire for GetInputFocus
func (c *Conn) GetInputFocusRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 43 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for GetInputFocus
// size: 12
type GetInputFocusReply struct {
Sequence uint16
Length uint32
RevertTo byte
Focus Id
}
// Read reply GetInputFocus
func (c *Conn) GetInputFocusReply(cook *Cookie) (*GetInputFocusReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetInputFocusReply)
b := 1 // skip reply determinant
v.RevertTo = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.Focus = Id(Get32(buf[b:]))
b += 4
return v, nil
}
// Request QueryKeymap
// size: 3
func (c *Conn) QueryKeymap() (*QueryKeymapReply, error) {
return c.QueryKeymapReply(c.QueryKeymapRequest())
}
// Write request to wire for QueryKeymap
func (c *Conn) QueryKeymapRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 44 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for QueryKeymap
// size: (8 + pad(32))
type QueryKeymapReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
Keys []byte // size: pad(32)
}
// Read reply QueryKeymap
func (c *Conn) QueryKeymapReply(cook *Cookie) (*QueryKeymapReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(QueryKeymapReply)
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.Keys = make([]byte, 32)
copy(v.Keys[:32], buf[b:])
b += pad(int(32))
return v, nil
}
// Request OpenFont
// size: (12 + pad((int(NameLen) * 1)))
// Write request to wire for OpenFont
func (c *Conn) OpenFont(Fid Id, NameLen uint16, Name string) {
size := (12 + pad((int(NameLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 45 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Fid))
b += 4
Put16(buf[b:], NameLen)
b += 2
b += 2 // padding
copy(buf[b:], Name[:NameLen])
b += pad(int(NameLen))
c.sendRequest(false, buf)
}
// Request CloseFont
// size: 8
// Write request to wire for CloseFont
func (c *Conn) CloseFont(Font Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 46 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Font))
b += 4
c.sendRequest(false, buf)
}
// Request QueryFont
// size: 8
func (c *Conn) QueryFont(Font Id) (*QueryFontReply, error) {
return c.QueryFontReply(c.QueryFontRequest(Font))
}
// Write request to wire for QueryFont
func (c *Conn) QueryFontRequest(Font Id) *Cookie {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 47 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Font))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for QueryFont
// size: ((60 + pad((int(PropertiesLen) * 8))) + pad((int(CharInfosLen) * 12)))
type QueryFontReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
MinBounds Charinfo
// padding: 4 bytes
MaxBounds Charinfo
// padding: 4 bytes
MinCharOrByte2 uint16
MaxCharOrByte2 uint16
DefaultChar uint16
PropertiesLen uint16
DrawDirection byte
MinByte1 byte
MaxByte1 byte
AllCharsExist bool
FontAscent int16
FontDescent int16
CharInfosLen uint32
Properties []Fontprop // size: pad((int(PropertiesLen) * 8))
CharInfos []Charinfo // size: pad((int(CharInfosLen) * 12))
}
// Read reply QueryFont
func (c *Conn) QueryFontReply(cook *Cookie) (*QueryFontReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(QueryFontReply)
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.MinBounds = Charinfo{}
b += ReadCharinfo(buf[b:], &v.MinBounds)
b += 4 // padding
v.MaxBounds = Charinfo{}
b += ReadCharinfo(buf[b:], &v.MaxBounds)
b += 4 // padding
v.MinCharOrByte2 = Get16(buf[b:])
b += 2
v.MaxCharOrByte2 = Get16(buf[b:])
b += 2
v.DefaultChar = Get16(buf[b:])
b += 2
v.PropertiesLen = Get16(buf[b:])
b += 2
v.DrawDirection = buf[b]
b += 1
v.MinByte1 = buf[b]
b += 1
v.MaxByte1 = buf[b]
b += 1
if buf[b] == 1 {
v.AllCharsExist = true
} else {
v.AllCharsExist = false
}
b += 1
v.FontAscent = int16(Get16(buf[b:]))
b += 2
v.FontDescent = int16(Get16(buf[b:]))
b += 2
v.CharInfosLen = Get32(buf[b:])
b += 4
v.Properties = make([]Fontprop, v.PropertiesLen)
b += ReadFontpropList(buf[b:], v.Properties)
v.CharInfos = make([]Charinfo, v.CharInfosLen)
b += ReadCharinfoList(buf[b:], v.CharInfos)
return v, nil
}
// Request QueryTextExtents
// size: (8 + pad((len(String) * 2)))
func (c *Conn) QueryTextExtents(Font Id, String []Char2b, StringLen uint16) (*QueryTextExtentsReply, error) {
return c.QueryTextExtentsReply(c.QueryTextExtentsRequest(Font, String, StringLen))
}
// Write request to wire for QueryTextExtents
func (c *Conn) QueryTextExtentsRequest(Font Id, String []Char2b, StringLen uint16) *Cookie {
size := (8 + pad((len(String) * 2)))
b := 0
buf := make([]byte, size)
buf[b] = 48 // request opcode
b += 1
buf[b] = byte((int(StringLen) & 1))
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Font))
b += 4
b += Char2bListBytes(buf[b:], String)
// skip writing local field: StringLen (2) :: uint16
return c.sendRequest(true, buf)
}
// Request reply for QueryTextExtents
// size: 28
type QueryTextExtentsReply struct {
Sequence uint16
Length uint32
DrawDirection byte
FontAscent int16
FontDescent int16
OverallAscent int16
OverallDescent int16
OverallWidth int32
OverallLeft int32
OverallRight int32
}
// Read reply QueryTextExtents
func (c *Conn) QueryTextExtentsReply(cook *Cookie) (*QueryTextExtentsReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(QueryTextExtentsReply)
b := 1 // skip reply determinant
v.DrawDirection = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.FontAscent = int16(Get16(buf[b:]))
b += 2
v.FontDescent = int16(Get16(buf[b:]))
b += 2
v.OverallAscent = int16(Get16(buf[b:]))
b += 2
v.OverallDescent = int16(Get16(buf[b:]))
b += 2
v.OverallWidth = int32(Get32(buf[b:]))
b += 4
v.OverallLeft = int32(Get32(buf[b:]))
b += 4
v.OverallRight = int32(Get32(buf[b:]))
b += 4
return v, nil
}
// Request ListFonts
// size: (8 + pad((int(PatternLen) * 1)))
func (c *Conn) ListFonts(MaxNames uint16, PatternLen uint16, Pattern string) (*ListFontsReply, error) {
return c.ListFontsReply(c.ListFontsRequest(MaxNames, PatternLen, Pattern))
}
// Write request to wire for ListFonts
func (c *Conn) ListFontsRequest(MaxNames uint16, PatternLen uint16, Pattern string) *Cookie {
size := (8 + pad((int(PatternLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 49 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put16(buf[b:], MaxNames)
b += 2
Put16(buf[b:], PatternLen)
b += 2
copy(buf[b:], Pattern[:PatternLen])
b += pad(int(PatternLen))
return c.sendRequest(true, buf)
}
// Request reply for ListFonts
// size: (32 + StrListSize(Names))
type ListFontsReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
NamesLen uint16
// padding: 22 bytes
Names []Str // size: StrListSize(Names)
}
// Read reply ListFonts
func (c *Conn) ListFontsReply(cook *Cookie) (*ListFontsReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(ListFontsReply)
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.NamesLen = Get16(buf[b:])
b += 2
b += 22 // padding
v.Names = make([]Str, v.NamesLen)
b += ReadStrList(buf[b:], v.Names)
return v, nil
}
// Request ListFontsWithInfo
// size: (8 + pad((int(PatternLen) * 1)))
func (c *Conn) ListFontsWithInfo(MaxNames uint16, PatternLen uint16, Pattern string) (*ListFontsWithInfoReply, error) {
return c.ListFontsWithInfoReply(c.ListFontsWithInfoRequest(MaxNames, PatternLen, Pattern))
}
// Write request to wire for ListFontsWithInfo
func (c *Conn) ListFontsWithInfoRequest(MaxNames uint16, PatternLen uint16, Pattern string) *Cookie {
size := (8 + pad((int(PatternLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 50 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put16(buf[b:], MaxNames)
b += 2
Put16(buf[b:], PatternLen)
b += 2
copy(buf[b:], Pattern[:PatternLen])
b += pad(int(PatternLen))
return c.sendRequest(true, buf)
}
// Request reply for ListFontsWithInfo
// size: ((60 + pad((int(PropertiesLen) * 8))) + pad((int(NameLen) * 1)))
type ListFontsWithInfoReply struct {
Sequence uint16
Length uint32
NameLen byte
MinBounds Charinfo
// padding: 4 bytes
MaxBounds Charinfo
// padding: 4 bytes
MinCharOrByte2 uint16
MaxCharOrByte2 uint16
DefaultChar uint16
PropertiesLen uint16
DrawDirection byte
MinByte1 byte
MaxByte1 byte
AllCharsExist bool
FontAscent int16
FontDescent int16
RepliesHint uint32
Properties []Fontprop // size: pad((int(PropertiesLen) * 8))
Name string // size: pad((int(NameLen) * 1))
}
// Read reply ListFontsWithInfo
func (c *Conn) ListFontsWithInfoReply(cook *Cookie) (*ListFontsWithInfoReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(ListFontsWithInfoReply)
b := 1 // skip reply determinant
v.NameLen = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.MinBounds = Charinfo{}
b += ReadCharinfo(buf[b:], &v.MinBounds)
b += 4 // padding
v.MaxBounds = Charinfo{}
b += ReadCharinfo(buf[b:], &v.MaxBounds)
b += 4 // padding
v.MinCharOrByte2 = Get16(buf[b:])
b += 2
v.MaxCharOrByte2 = Get16(buf[b:])
b += 2
v.DefaultChar = Get16(buf[b:])
b += 2
v.PropertiesLen = Get16(buf[b:])
b += 2
v.DrawDirection = buf[b]
b += 1
v.MinByte1 = buf[b]
b += 1
v.MaxByte1 = buf[b]
b += 1
if buf[b] == 1 {
v.AllCharsExist = true
} else {
v.AllCharsExist = false
}
b += 1
v.FontAscent = int16(Get16(buf[b:]))
b += 2
v.FontDescent = int16(Get16(buf[b:]))
b += 2
v.RepliesHint = Get32(buf[b:])
b += 4
v.Properties = make([]Fontprop, v.PropertiesLen)
b += ReadFontpropList(buf[b:], v.Properties)
{
byteString := make([]byte, v.NameLen)
copy(byteString[:v.NameLen], buf[b:])
v.Name = string(byteString)
b += pad(int(v.NameLen))
}
return v, nil
}
// Request SetFontPath
// size: (8 + StrListSize(Font))
// Write request to wire for SetFontPath
func (c *Conn) SetFontPath(FontQty uint16, Font []Str) {
size := (8 + StrListSize(Font))
b := 0
buf := make([]byte, size)
buf[b] = 51 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put16(buf[b:], FontQty)
b += 2
b += 2 // padding
b += StrListBytes(buf[b:], Font)
c.sendRequest(false, buf)
}
// Request GetFontPath
// size: 3
func (c *Conn) GetFontPath() (*GetFontPathReply, error) {
return c.GetFontPathReply(c.GetFontPathRequest())
}
// Write request to wire for GetFontPath
func (c *Conn) GetFontPathRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 52 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for GetFontPath
// size: (32 + StrListSize(Path))
type GetFontPathReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
PathLen uint16
// padding: 22 bytes
Path []Str // size: StrListSize(Path)
}
// Read reply GetFontPath
func (c *Conn) GetFontPathReply(cook *Cookie) (*GetFontPathReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetFontPathReply)
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.PathLen = Get16(buf[b:])
b += 2
b += 22 // padding
v.Path = make([]Str, v.PathLen)
b += ReadStrList(buf[b:], v.Path)
return v, nil
}
// Request CreatePixmap
// size: 16
// Write request to wire for CreatePixmap
func (c *Conn) CreatePixmap(Depth byte, Pid Id, Drawable Id, Width uint16, Height uint16) {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 53 // request opcode
b += 1
buf[b] = Depth
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Pid))
b += 4
Put32(buf[b:], uint32(Drawable))
b += 4
Put16(buf[b:], Width)
b += 2
Put16(buf[b:], Height)
b += 2
c.sendRequest(false, buf)
}
// Request FreePixmap
// size: 8
// Write request to wire for FreePixmap
func (c *Conn) FreePixmap(Pixmap Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 54 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Pixmap))
b += 4
c.sendRequest(false, buf)
}
// Request CreateGC
// size: (12 + (4 + pad((4 * popCount(int(ValueMask))))))
// Write request to wire for CreateGC
func (c *Conn) CreateGC(Cid Id, Drawable Id, ValueMask uint32, ValueList []uint32) {
size := (12 + (4 + pad((4 * popCount(int(ValueMask))))))
b := 0
buf := make([]byte, size)
buf[b] = 55 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cid))
b += 4
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], ValueMask)
b += 4
for i := 0; i < popCount(int(ValueMask)); i++ {
Put32(buf[b:], ValueList[i])
b += 4
}
b = pad(b)
c.sendRequest(false, buf)
}
// Request ChangeGC
// size: (8 + (4 + pad((4 * popCount(int(ValueMask))))))
// Write request to wire for ChangeGC
func (c *Conn) ChangeGC(Gc Id, ValueMask uint32, ValueList []uint32) {
size := (8 + (4 + pad((4 * popCount(int(ValueMask))))))
b := 0
buf := make([]byte, size)
buf[b] = 56 // request opcode
b += 1
b += 1 // padding
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:], ValueMask)
b += 4
for i := 0; i < popCount(int(ValueMask)); i++ {
Put32(buf[b:], ValueList[i])
b += 4
}
b = pad(b)
c.sendRequest(false, buf)
}
// Request CopyGC
// size: 16
// Write request to wire for CopyGC
func (c *Conn) CopyGC(SrcGc Id, DstGc Id, ValueMask uint32) {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 57 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(SrcGc))
b += 4
Put32(buf[b:], uint32(DstGc))
b += 4
Put32(buf[b:], ValueMask)
b += 4
c.sendRequest(false, buf)
}
// Request SetDashes
// size: (12 + pad((int(DashesLen) * 1)))
// Write request to wire for SetDashes
func (c *Conn) SetDashes(Gc Id, DashOffset uint16, DashesLen uint16, Dashes []byte) {
size := (12 + pad((int(DashesLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 58 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Gc))
b += 4
Put16(buf[b:], DashOffset)
b += 2
Put16(buf[b:], DashesLen)
b += 2
copy(buf[b:], Dashes[:DashesLen])
b += pad(int(DashesLen))
c.sendRequest(false, buf)
}
// Request SetClipRectangles
// size: (12 + pad((len(Rectangles) * 8)))
// Write request to wire for SetClipRectangles
func (c *Conn) SetClipRectangles(Ordering byte, Gc Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) {
size := (12 + pad((len(Rectangles) * 8)))
b := 0
buf := make([]byte, size)
buf[b] = 59 // request opcode
b += 1
buf[b] = Ordering
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Gc))
b += 4
Put16(buf[b:], uint16(ClipXOrigin))
b += 2
Put16(buf[b:], uint16(ClipYOrigin))
b += 2
b += RectangleListBytes(buf[b:], Rectangles)
c.sendRequest(false, buf)
}
// Request FreeGC
// size: 8
// Write request to wire for FreeGC
func (c *Conn) FreeGC(Gc Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 60 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Gc))
b += 4
c.sendRequest(false, buf)
}
// Request ClearArea
// size: 16
// Write request to wire for ClearArea
func (c *Conn) ClearArea(Exposures bool, Window Id, X int16, Y int16, Width uint16, Height uint16) {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 61 // request opcode
b += 1
if Exposures {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
Put16(buf[b:], uint16(X))
b += 2
Put16(buf[b:], uint16(Y))
b += 2
Put16(buf[b:], Width)
b += 2
Put16(buf[b:], Height)
b += 2
c.sendRequest(false, buf)
}
// Request CopyArea
// size: 28
// Write request to wire for CopyArea
func (c *Conn) CopyArea(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16) {
size := 28
b := 0
buf := make([]byte, size)
buf[b] = 62 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(SrcDrawable))
b += 4
Put32(buf[b:], uint32(DstDrawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
Put16(buf[b:], uint16(SrcX))
b += 2
Put16(buf[b:], uint16(SrcY))
b += 2
Put16(buf[b:], uint16(DstX))
b += 2
Put16(buf[b:], uint16(DstY))
b += 2
Put16(buf[b:], Width)
b += 2
Put16(buf[b:], Height)
b += 2
c.sendRequest(false, buf)
}
// Request CopyPlane
// size: 32
// Write request to wire for CopyPlane
func (c *Conn) CopyPlane(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16, BitPlane uint32) {
size := 32
b := 0
buf := make([]byte, size)
buf[b] = 63 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(SrcDrawable))
b += 4
Put32(buf[b:], uint32(DstDrawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
Put16(buf[b:], uint16(SrcX))
b += 2
Put16(buf[b:], uint16(SrcY))
b += 2
Put16(buf[b:], uint16(DstX))
b += 2
Put16(buf[b:], uint16(DstY))
b += 2
Put16(buf[b:], Width)
b += 2
Put16(buf[b:], Height)
b += 2
Put32(buf[b:], BitPlane)
b += 4
c.sendRequest(false, buf)
}
// Request PolyPoint
// size: (12 + pad((len(Points) * 4)))
// Write request to wire for PolyPoint
func (c *Conn) PolyPoint(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) {
size := (12 + pad((len(Points) * 4)))
b := 0
buf := make([]byte, size)
buf[b] = 64 // request opcode
b += 1
buf[b] = CoordinateMode
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
b += PointListBytes(buf[b:], Points)
c.sendRequest(false, buf)
}
// Request PolyLine
// size: (12 + pad((len(Points) * 4)))
// Write request to wire for PolyLine
func (c *Conn) PolyLine(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) {
size := (12 + pad((len(Points) * 4)))
b := 0
buf := make([]byte, size)
buf[b] = 65 // request opcode
b += 1
buf[b] = CoordinateMode
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
b += PointListBytes(buf[b:], Points)
c.sendRequest(false, buf)
}
// Request PolySegment
// size: (12 + pad((len(Segments) * 8)))
// Write request to wire for PolySegment
func (c *Conn) PolySegment(Drawable Id, Gc Id, Segments []Segment) {
size := (12 + pad((len(Segments) * 8)))
b := 0
buf := make([]byte, size)
buf[b] = 66 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
b += SegmentListBytes(buf[b:], Segments)
c.sendRequest(false, buf)
}
// Request PolyRectangle
// size: (12 + pad((len(Rectangles) * 8)))
// Write request to wire for PolyRectangle
func (c *Conn) PolyRectangle(Drawable Id, Gc Id, Rectangles []Rectangle) {
size := (12 + pad((len(Rectangles) * 8)))
b := 0
buf := make([]byte, size)
buf[b] = 67 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
b += RectangleListBytes(buf[b:], Rectangles)
c.sendRequest(false, buf)
}
// Request PolyArc
// size: (12 + pad((len(Arcs) * 12)))
// Write request to wire for PolyArc
func (c *Conn) PolyArc(Drawable Id, Gc Id, Arcs []Arc) {
size := (12 + pad((len(Arcs) * 12)))
b := 0
buf := make([]byte, size)
buf[b] = 68 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
b += ArcListBytes(buf[b:], Arcs)
c.sendRequest(false, buf)
}
// Request FillPoly
// size: (16 + pad((len(Points) * 4)))
// Write request to wire for FillPoly
func (c *Conn) FillPoly(Drawable Id, Gc Id, Shape byte, CoordinateMode byte, Points []Point) {
size := (16 + pad((len(Points) * 4)))
b := 0
buf := make([]byte, size)
buf[b] = 69 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
buf[b] = Shape
b += 1
buf[b] = CoordinateMode
b += 1
b += 2 // padding
b += PointListBytes(buf[b:], Points)
c.sendRequest(false, buf)
}
// Request PolyFillRectangle
// size: (12 + pad((len(Rectangles) * 8)))
// Write request to wire for PolyFillRectangle
func (c *Conn) PolyFillRectangle(Drawable Id, Gc Id, Rectangles []Rectangle) {
size := (12 + pad((len(Rectangles) * 8)))
b := 0
buf := make([]byte, size)
buf[b] = 70 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
b += RectangleListBytes(buf[b:], Rectangles)
c.sendRequest(false, buf)
}
// Request PolyFillArc
// size: (12 + pad((len(Arcs) * 12)))
// Write request to wire for PolyFillArc
func (c *Conn) PolyFillArc(Drawable Id, Gc Id, Arcs []Arc) {
size := (12 + pad((len(Arcs) * 12)))
b := 0
buf := make([]byte, size)
buf[b] = 71 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
b += ArcListBytes(buf[b:], Arcs)
c.sendRequest(false, buf)
}
// Request PutImage
// size: (24 + pad((len(Data) * 1)))
// Write request to wire for PutImage
func (c *Conn) PutImage(Format byte, Drawable Id, Gc Id, Width uint16, Height uint16, DstX int16, DstY int16, LeftPad byte, Depth byte, Data []byte) {
size := (24 + pad((len(Data) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 72 // request opcode
b += 1
buf[b] = Format
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
Put16(buf[b:], Width)
b += 2
Put16(buf[b:], Height)
b += 2
Put16(buf[b:], uint16(DstX))
b += 2
Put16(buf[b:], uint16(DstY))
b += 2
buf[b] = LeftPad
b += 1
buf[b] = Depth
b += 1
b += 2 // padding
copy(buf[b:], Data[:len(Data)])
b += pad(int(len(Data)))
c.sendRequest(false, buf)
}
// Request GetImage
// size: 20
func (c *Conn) GetImage(Format byte, Drawable Id, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32) (*GetImageReply, error) {
return c.GetImageReply(c.GetImageRequest(Format, Drawable, X, Y, Width, Height, PlaneMask))
}
// Write request to wire for GetImage
func (c *Conn) GetImageRequest(Format byte, Drawable Id, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32) *Cookie {
size := 20
b := 0
buf := make([]byte, size)
buf[b] = 73 // request opcode
b += 1
buf[b] = Format
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put16(buf[b:], uint16(X))
b += 2
Put16(buf[b:], uint16(Y))
b += 2
Put16(buf[b:], Width)
b += 2
Put16(buf[b:], Height)
b += 2
Put32(buf[b:], PlaneMask)
b += 4
return c.sendRequest(true, buf)
}
// Request reply for GetImage
// size: (32 + pad(((int(Length) * 4) * 1)))
type GetImageReply struct {
Sequence uint16
Length uint32
Depth byte
Visual Visualid
// padding: 20 bytes
Data []byte // size: pad(((int(Length) * 4) * 1))
}
// Read reply GetImage
func (c *Conn) GetImageReply(cook *Cookie) (*GetImageReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetImageReply)
b := 1 // skip reply determinant
v.Depth = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.Visual = Visualid(Get32(buf[b:]))
b += 4
b += 20 // padding
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += pad(int((int(v.Length) * 4)))
return v, nil
}
// Request PolyText8
// size: (16 + pad((len(Items) * 1)))
// Write request to wire for PolyText8
func (c *Conn) PolyText8(Drawable Id, Gc Id, X int16, Y int16, Items []byte) {
size := (16 + pad((len(Items) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 74 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
Put16(buf[b:], uint16(X))
b += 2
Put16(buf[b:], uint16(Y))
b += 2
copy(buf[b:], Items[:len(Items)])
b += pad(int(len(Items)))
c.sendRequest(false, buf)
}
// Request PolyText16
// size: (16 + pad((len(Items) * 1)))
// Write request to wire for PolyText16
func (c *Conn) PolyText16(Drawable Id, Gc Id, X int16, Y int16, Items []byte) {
size := (16 + pad((len(Items) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 75 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
Put16(buf[b:], uint16(X))
b += 2
Put16(buf[b:], uint16(Y))
b += 2
copy(buf[b:], Items[:len(Items)])
b += pad(int(len(Items)))
c.sendRequest(false, buf)
}
// Request ImageText8
// size: (16 + pad((int(StringLen) * 1)))
// Write request to wire for ImageText8
func (c *Conn) ImageText8(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String string) {
size := (16 + pad((int(StringLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 76 // request opcode
b += 1
buf[b] = StringLen
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
Put16(buf[b:], uint16(X))
b += 2
Put16(buf[b:], uint16(Y))
b += 2
copy(buf[b:], String[:StringLen])
b += pad(int(StringLen))
c.sendRequest(false, buf)
}
// Request ImageText16
// size: (16 + pad((int(StringLen) * 2)))
// Write request to wire for ImageText16
func (c *Conn) ImageText16(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String []Char2b) {
size := (16 + pad((int(StringLen) * 2)))
b := 0
buf := make([]byte, size)
buf[b] = 77 // request opcode
b += 1
buf[b] = StringLen
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put32(buf[b:], uint32(Gc))
b += 4
Put16(buf[b:], uint16(X))
b += 2
Put16(buf[b:], uint16(Y))
b += 2
b += Char2bListBytes(buf[b:], String)
c.sendRequest(false, buf)
}
// Request CreateColormap
// size: 16
// Write request to wire for CreateColormap
func (c *Conn) CreateColormap(Alloc byte, Mid Id, Window Id, Visual Visualid) {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 78 // request opcode
b += 1
buf[b] = Alloc
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Mid))
b += 4
Put32(buf[b:], uint32(Window))
b += 4
Put32(buf[b:], uint32(Visual))
b += 4
c.sendRequest(false, buf)
}
// Request FreeColormap
// size: 8
// Write request to wire for FreeColormap
func (c *Conn) FreeColormap(Cmap Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 79 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
c.sendRequest(false, buf)
}
// Request CopyColormapAndFree
// size: 12
// Write request to wire for CopyColormapAndFree
func (c *Conn) CopyColormapAndFree(Mid Id, SrcCmap Id) {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = 80 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Mid))
b += 4
Put32(buf[b:], uint32(SrcCmap))
b += 4
c.sendRequest(false, buf)
}
// Request InstallColormap
// size: 8
// Write request to wire for InstallColormap
func (c *Conn) InstallColormap(Cmap Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 81 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
c.sendRequest(false, buf)
}
// Request UninstallColormap
// size: 8
// Write request to wire for UninstallColormap
func (c *Conn) UninstallColormap(Cmap Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 82 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
c.sendRequest(false, buf)
}
// Request ListInstalledColormaps
// size: 8
func (c *Conn) ListInstalledColormaps(Window Id) (*ListInstalledColormapsReply, error) {
return c.ListInstalledColormapsReply(c.ListInstalledColormapsRequest(Window))
}
// Write request to wire for ListInstalledColormaps
func (c *Conn) ListInstalledColormapsRequest(Window Id) *Cookie {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 83 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
return c.sendRequest(true, buf)
}
// Request reply for ListInstalledColormaps
// size: (32 + pad((int(CmapsLen) * 4)))
type ListInstalledColormapsReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
CmapsLen uint16
// padding: 22 bytes
Cmaps []Id // size: pad((int(CmapsLen) * 4))
}
// Read reply ListInstalledColormaps
func (c *Conn) ListInstalledColormapsReply(cook *Cookie) (*ListInstalledColormapsReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(ListInstalledColormapsReply)
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.CmapsLen = Get16(buf[b:])
b += 2
b += 22 // padding
v.Cmaps = make([]Id, v.CmapsLen)
for i := 0; i < int(v.CmapsLen); i++ {
v.Cmaps[i] = Id(Get32(buf[b:]))
b += 4
}
b = pad(b)
return v, nil
}
// Request AllocColor
// size: 16
func (c *Conn) AllocColor(Cmap Id, Red uint16, Green uint16, Blue uint16) (*AllocColorReply, error) {
return c.AllocColorReply(c.AllocColorRequest(Cmap, Red, Green, Blue))
}
// Write request to wire for AllocColor
func (c *Conn) AllocColorRequest(Cmap Id, Red uint16, Green uint16, Blue uint16) *Cookie {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 84 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
Put16(buf[b:], Red)
b += 2
Put16(buf[b:], Green)
b += 2
Put16(buf[b:], Blue)
b += 2
b += 2 // padding
return c.sendRequest(true, buf)
}
// Request reply for AllocColor
// size: 20
type AllocColorReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
Red uint16
Green uint16
Blue uint16
// padding: 2 bytes
Pixel uint32
}
// Read reply AllocColor
func (c *Conn) AllocColorReply(cook *Cookie) (*AllocColorReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(AllocColorReply)
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.Red = Get16(buf[b:])
b += 2
v.Green = Get16(buf[b:])
b += 2
v.Blue = Get16(buf[b:])
b += 2
b += 2 // padding
v.Pixel = Get32(buf[b:])
b += 4
return v, nil
}
// Request AllocNamedColor
// size: (12 + pad((int(NameLen) * 1)))
func (c *Conn) AllocNamedColor(Cmap Id, NameLen uint16, Name string) (*AllocNamedColorReply, error) {
return c.AllocNamedColorReply(c.AllocNamedColorRequest(Cmap, NameLen, Name))
}
// Write request to wire for AllocNamedColor
func (c *Conn) AllocNamedColorRequest(Cmap Id, NameLen uint16, Name string) *Cookie {
size := (12 + pad((int(NameLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 85 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
Put16(buf[b:], NameLen)
b += 2
b += 2 // padding
copy(buf[b:], Name[:NameLen])
b += pad(int(NameLen))
return c.sendRequest(true, buf)
}
// Request reply for AllocNamedColor
// size: 24
type AllocNamedColorReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
Pixel uint32
ExactRed uint16
ExactGreen uint16
ExactBlue uint16
VisualRed uint16
VisualGreen uint16
VisualBlue uint16
}
// Read reply AllocNamedColor
func (c *Conn) AllocNamedColorReply(cook *Cookie) (*AllocNamedColorReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(AllocNamedColorReply)
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.Pixel = Get32(buf[b:])
b += 4
v.ExactRed = Get16(buf[b:])
b += 2
v.ExactGreen = Get16(buf[b:])
b += 2
v.ExactBlue = Get16(buf[b:])
b += 2
v.VisualRed = Get16(buf[b:])
b += 2
v.VisualGreen = Get16(buf[b:])
b += 2
v.VisualBlue = Get16(buf[b:])
b += 2
return v, nil
}
// Request AllocColorCells
// size: 12
func (c *Conn) AllocColorCells(Contiguous bool, Cmap Id, Colors uint16, Planes uint16) (*AllocColorCellsReply, error) {
return c.AllocColorCellsReply(c.AllocColorCellsRequest(Contiguous, Cmap, Colors, Planes))
}
// Write request to wire for AllocColorCells
func (c *Conn) AllocColorCellsRequest(Contiguous bool, Cmap Id, Colors uint16, Planes uint16) *Cookie {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = 86 // request opcode
b += 1
if Contiguous {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
Put16(buf[b:], Colors)
b += 2
Put16(buf[b:], Planes)
b += 2
return c.sendRequest(true, buf)
}
// Request reply for AllocColorCells
// size: ((32 + pad((int(PixelsLen) * 4))) + pad((int(MasksLen) * 4)))
type AllocColorCellsReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
PixelsLen uint16
MasksLen uint16
// padding: 20 bytes
Pixels []uint32 // size: pad((int(PixelsLen) * 4))
Masks []uint32 // size: pad((int(MasksLen) * 4))
}
// Read reply AllocColorCells
func (c *Conn) AllocColorCellsReply(cook *Cookie) (*AllocColorCellsReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(AllocColorCellsReply)
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.PixelsLen = Get16(buf[b:])
b += 2
v.MasksLen = Get16(buf[b:])
b += 2
b += 20 // padding
v.Pixels = make([]uint32, v.PixelsLen)
for i := 0; i < int(v.PixelsLen); i++ {
v.Pixels[i] = Get32(buf[b:])
b += 4
}
b = pad(b)
v.Masks = make([]uint32, v.MasksLen)
for i := 0; i < int(v.MasksLen); i++ {
v.Masks[i] = Get32(buf[b:])
b += 4
}
b = pad(b)
return v, nil
}
// Request AllocColorPlanes
// size: 16
func (c *Conn) AllocColorPlanes(Contiguous bool, Cmap Id, Colors uint16, Reds uint16, Greens uint16, Blues uint16) (*AllocColorPlanesReply, error) {
return c.AllocColorPlanesReply(c.AllocColorPlanesRequest(Contiguous, Cmap, Colors, Reds, Greens, Blues))
}
// Write request to wire for AllocColorPlanes
func (c *Conn) AllocColorPlanesRequest(Contiguous bool, Cmap Id, Colors uint16, Reds uint16, Greens uint16, Blues uint16) *Cookie {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = 87 // request opcode
b += 1
if Contiguous {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
Put16(buf[b:], Colors)
b += 2
Put16(buf[b:], Reds)
b += 2
Put16(buf[b:], Greens)
b += 2
Put16(buf[b:], Blues)
b += 2
return c.sendRequest(true, buf)
}
// Request reply for AllocColorPlanes
// size: (32 + pad((int(PixelsLen) * 4)))
type AllocColorPlanesReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
PixelsLen uint16
// padding: 2 bytes
RedMask uint32
GreenMask uint32
BlueMask uint32
// padding: 8 bytes
Pixels []uint32 // size: pad((int(PixelsLen) * 4))
}
// Read reply AllocColorPlanes
func (c *Conn) AllocColorPlanesReply(cook *Cookie) (*AllocColorPlanesReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(AllocColorPlanesReply)
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.PixelsLen = Get16(buf[b:])
b += 2
b += 2 // padding
v.RedMask = Get32(buf[b:])
b += 4
v.GreenMask = Get32(buf[b:])
b += 4
v.BlueMask = Get32(buf[b:])
b += 4
b += 8 // padding
v.Pixels = make([]uint32, v.PixelsLen)
for i := 0; i < int(v.PixelsLen); i++ {
v.Pixels[i] = Get32(buf[b:])
b += 4
}
b = pad(b)
return v, nil
}
// Request FreeColors
// size: (12 + pad((len(Pixels) * 4)))
// Write request to wire for FreeColors
func (c *Conn) FreeColors(Cmap Id, PlaneMask uint32, Pixels []uint32) {
size := (12 + pad((len(Pixels) * 4)))
b := 0
buf := make([]byte, size)
buf[b] = 88 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
Put32(buf[b:], PlaneMask)
b += 4
for i := 0; i < int(len(Pixels)); i++ {
Put32(buf[b:], Pixels[i])
b += 4
}
b = pad(b)
c.sendRequest(false, buf)
}
// Request StoreColors
// size: (8 + pad((len(Items) * 12)))
// Write request to wire for StoreColors
func (c *Conn) StoreColors(Cmap Id, Items []Coloritem) {
size := (8 + pad((len(Items) * 12)))
b := 0
buf := make([]byte, size)
buf[b] = 89 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
b += ColoritemListBytes(buf[b:], Items)
c.sendRequest(false, buf)
}
// Request StoreNamedColor
// size: (16 + pad((int(NameLen) * 1)))
// Write request to wire for StoreNamedColor
func (c *Conn) StoreNamedColor(Flags byte, Cmap Id, Pixel uint32, NameLen uint16, Name string) {
size := (16 + pad((int(NameLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 90 // request opcode
b += 1
buf[b] = Flags
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
Put32(buf[b:], Pixel)
b += 4
Put16(buf[b:], NameLen)
b += 2
b += 2 // padding
copy(buf[b:], Name[:NameLen])
b += pad(int(NameLen))
c.sendRequest(false, buf)
}
// Request QueryColors
// size: (8 + pad((len(Pixels) * 4)))
func (c *Conn) QueryColors(Cmap Id, Pixels []uint32) (*QueryColorsReply, error) {
return c.QueryColorsReply(c.QueryColorsRequest(Cmap, Pixels))
}
// Write request to wire for QueryColors
func (c *Conn) QueryColorsRequest(Cmap Id, Pixels []uint32) *Cookie {
size := (8 + pad((len(Pixels) * 4)))
b := 0
buf := make([]byte, size)
buf[b] = 91 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
for i := 0; i < int(len(Pixels)); i++ {
Put32(buf[b:], Pixels[i])
b += 4
}
b = pad(b)
return c.sendRequest(true, buf)
}
// Request reply for QueryColors
// size: (32 + pad((int(ColorsLen) * 8)))
type QueryColorsReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
ColorsLen uint16
// padding: 22 bytes
Colors []Rgb // size: pad((int(ColorsLen) * 8))
}
// Read reply QueryColors
func (c *Conn) QueryColorsReply(cook *Cookie) (*QueryColorsReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(QueryColorsReply)
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.ColorsLen = Get16(buf[b:])
b += 2
b += 22 // padding
v.Colors = make([]Rgb, v.ColorsLen)
b += ReadRgbList(buf[b:], v.Colors)
return v, nil
}
// Request LookupColor
// size: (12 + pad((int(NameLen) * 1)))
func (c *Conn) LookupColor(Cmap Id, NameLen uint16, Name string) (*LookupColorReply, error) {
return c.LookupColorReply(c.LookupColorRequest(Cmap, NameLen, Name))
}
// Write request to wire for LookupColor
func (c *Conn) LookupColorRequest(Cmap Id, NameLen uint16, Name string) *Cookie {
size := (12 + pad((int(NameLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 92 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cmap))
b += 4
Put16(buf[b:], NameLen)
b += 2
b += 2 // padding
copy(buf[b:], Name[:NameLen])
b += pad(int(NameLen))
return c.sendRequest(true, buf)
}
// Request reply for LookupColor
// size: 20
type LookupColorReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
ExactRed uint16
ExactGreen uint16
ExactBlue uint16
VisualRed uint16
VisualGreen uint16
VisualBlue uint16
}
// Read reply LookupColor
func (c *Conn) LookupColorReply(cook *Cookie) (*LookupColorReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(LookupColorReply)
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.ExactRed = Get16(buf[b:])
b += 2
v.ExactGreen = Get16(buf[b:])
b += 2
v.ExactBlue = Get16(buf[b:])
b += 2
v.VisualRed = Get16(buf[b:])
b += 2
v.VisualGreen = Get16(buf[b:])
b += 2
v.VisualBlue = Get16(buf[b:])
b += 2
return v, nil
}
// Request CreateCursor
// size: 32
// Write request to wire for CreateCursor
func (c *Conn) CreateCursor(Cid Id, Source Id, Mask Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16, X uint16, Y uint16) {
size := 32
b := 0
buf := make([]byte, size)
buf[b] = 93 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cid))
b += 4
Put32(buf[b:], uint32(Source))
b += 4
Put32(buf[b:], uint32(Mask))
b += 4
Put16(buf[b:], ForeRed)
b += 2
Put16(buf[b:], ForeGreen)
b += 2
Put16(buf[b:], ForeBlue)
b += 2
Put16(buf[b:], BackRed)
b += 2
Put16(buf[b:], BackGreen)
b += 2
Put16(buf[b:], BackBlue)
b += 2
Put16(buf[b:], X)
b += 2
Put16(buf[b:], Y)
b += 2
c.sendRequest(false, buf)
}
// Request CreateGlyphCursor
// size: 32
// Write request to wire for CreateGlyphCursor
func (c *Conn) CreateGlyphCursor(Cid Id, SourceFont Id, MaskFont Id, SourceChar uint16, MaskChar uint16, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) {
size := 32
b := 0
buf := make([]byte, size)
buf[b] = 94 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cid))
b += 4
Put32(buf[b:], uint32(SourceFont))
b += 4
Put32(buf[b:], uint32(MaskFont))
b += 4
Put16(buf[b:], SourceChar)
b += 2
Put16(buf[b:], MaskChar)
b += 2
Put16(buf[b:], ForeRed)
b += 2
Put16(buf[b:], ForeGreen)
b += 2
Put16(buf[b:], ForeBlue)
b += 2
Put16(buf[b:], BackRed)
b += 2
Put16(buf[b:], BackGreen)
b += 2
Put16(buf[b:], BackBlue)
b += 2
c.sendRequest(false, buf)
}
// Request FreeCursor
// size: 8
// Write request to wire for FreeCursor
func (c *Conn) FreeCursor(Cursor Id) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 95 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Cursor))
b += 4
c.sendRequest(false, buf)
}
// Request RecolorCursor
// size: 20
// Write request to wire for RecolorCursor
func (c *Conn) RecolorCursor(Cursor Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) {
size := 20
b := 0
buf := make([]byte, size)
buf[b] = 96 // request opcode
b += 1
b += 1 // padding
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:], ForeRed)
b += 2
Put16(buf[b:], ForeGreen)
b += 2
Put16(buf[b:], ForeBlue)
b += 2
Put16(buf[b:], BackRed)
b += 2
Put16(buf[b:], BackGreen)
b += 2
Put16(buf[b:], BackBlue)
b += 2
c.sendRequest(false, buf)
}
// Request QueryBestSize
// size: 12
func (c *Conn) QueryBestSize(Class byte, Drawable Id, Width uint16, Height uint16) (*QueryBestSizeReply, error) {
return c.QueryBestSizeReply(c.QueryBestSizeRequest(Class, Drawable, Width, Height))
}
// Write request to wire for QueryBestSize
func (c *Conn) QueryBestSizeRequest(Class byte, Drawable Id, Width uint16, Height uint16) *Cookie {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = 97 // request opcode
b += 1
buf[b] = Class
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Drawable))
b += 4
Put16(buf[b:], Width)
b += 2
Put16(buf[b:], Height)
b += 2
return c.sendRequest(true, buf)
}
// Request reply for QueryBestSize
// size: 12
type QueryBestSizeReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
Width uint16
Height uint16
}
// Read reply QueryBestSize
func (c *Conn) QueryBestSizeReply(cook *Cookie) (*QueryBestSizeReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(QueryBestSizeReply)
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.Width = Get16(buf[b:])
b += 2
v.Height = Get16(buf[b:])
b += 2
return v, nil
}
// Request QueryExtension
// size: (8 + pad((int(NameLen) * 1)))
func (c *Conn) QueryExtension(NameLen uint16, Name string) (*QueryExtensionReply, error) {
return c.QueryExtensionReply(c.QueryExtensionRequest(NameLen, Name))
}
// Write request to wire for QueryExtension
func (c *Conn) QueryExtensionRequest(NameLen uint16, Name string) *Cookie {
size := (8 + pad((int(NameLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 98 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put16(buf[b:], NameLen)
b += 2
b += 2 // padding
copy(buf[b:], Name[:NameLen])
b += pad(int(NameLen))
return c.sendRequest(true, buf)
}
// Request reply for QueryExtension
// size: 12
type QueryExtensionReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
Present bool
MajorOpcode byte
FirstEvent byte
FirstError byte
}
// Read reply QueryExtension
func (c *Conn) QueryExtensionReply(cook *Cookie) (*QueryExtensionReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(QueryExtensionReply)
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
if buf[b] == 1 {
v.Present = true
} else {
v.Present = false
}
b += 1
v.MajorOpcode = buf[b]
b += 1
v.FirstEvent = buf[b]
b += 1
v.FirstError = buf[b]
b += 1
return v, nil
}
// Request ListExtensions
// size: 3
func (c *Conn) ListExtensions() (*ListExtensionsReply, error) {
return c.ListExtensionsReply(c.ListExtensionsRequest())
}
// Write request to wire for ListExtensions
func (c *Conn) ListExtensionsRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 99 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for ListExtensions
// size: (32 + StrListSize(Names))
type ListExtensionsReply struct {
Sequence uint16
Length uint32
NamesLen byte
// padding: 24 bytes
Names []Str // size: StrListSize(Names)
}
// Read reply ListExtensions
func (c *Conn) ListExtensionsReply(cook *Cookie) (*ListExtensionsReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(ListExtensionsReply)
b := 1 // skip reply determinant
v.NamesLen = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
b += 24 // padding
v.Names = make([]Str, v.NamesLen)
b += ReadStrList(buf[b:], v.Names)
return v, nil
}
// Request ChangeKeyboardMapping
// size: (8 + pad(((int(KeycodeCount) * int(KeysymsPerKeycode)) * 4)))
// Write request to wire for ChangeKeyboardMapping
func (c *Conn) ChangeKeyboardMapping(KeycodeCount byte, FirstKeycode Keycode, KeysymsPerKeycode byte, Keysyms []Keysym) {
size := (8 + pad(((int(KeycodeCount) * int(KeysymsPerKeycode)) * 4)))
b := 0
buf := make([]byte, size)
buf[b] = 100 // request opcode
b += 1
buf[b] = KeycodeCount
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = byte(FirstKeycode)
b += 1
buf[b] = KeysymsPerKeycode
b += 1
b += 2 // padding
for i := 0; i < int((int(KeycodeCount) * int(KeysymsPerKeycode))); i++ {
Put32(buf[b:], uint32(Keysyms[i]))
b += 4
}
b = pad(b)
c.sendRequest(false, buf)
}
// Request GetKeyboardMapping
// size: 6
func (c *Conn) GetKeyboardMapping(FirstKeycode Keycode, Count byte) (*GetKeyboardMappingReply, error) {
return c.GetKeyboardMappingReply(c.GetKeyboardMappingRequest(FirstKeycode, Count))
}
// Write request to wire for GetKeyboardMapping
func (c *Conn) GetKeyboardMappingRequest(FirstKeycode Keycode, Count byte) *Cookie {
size := 6
b := 0
buf := make([]byte, size)
buf[b] = 101 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = byte(FirstKeycode)
b += 1
buf[b] = Count
b += 1
return c.sendRequest(true, buf)
}
// Request reply for GetKeyboardMapping
// size: (32 + pad((int(Length) * 4)))
type GetKeyboardMappingReply struct {
Sequence uint16
Length uint32
KeysymsPerKeycode byte
// padding: 24 bytes
Keysyms []Keysym // size: pad((int(Length) * 4))
}
// Read reply GetKeyboardMapping
func (c *Conn) GetKeyboardMappingReply(cook *Cookie) (*GetKeyboardMappingReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetKeyboardMappingReply)
b := 1 // skip reply determinant
v.KeysymsPerKeycode = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
b += 24 // padding
v.Keysyms = make([]Keysym, v.Length)
for i := 0; i < int(v.Length); i++ {
v.Keysyms[i] = Keysym(Get32(buf[b:]))
b += 4
}
b = pad(b)
return v, nil
}
// Request ChangeKeyboardControl
// size: (4 + (4 + pad((4 * popCount(int(ValueMask))))))
// Write request to wire for ChangeKeyboardControl
func (c *Conn) ChangeKeyboardControl(ValueMask uint32, ValueList []uint32) {
size := (4 + (4 + pad((4 * popCount(int(ValueMask))))))
b := 0
buf := make([]byte, size)
buf[b] = 102 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], ValueMask)
b += 4
for i := 0; i < popCount(int(ValueMask)); i++ {
Put32(buf[b:], ValueList[i])
b += 4
}
b = pad(b)
c.sendRequest(false, buf)
}
// Request GetKeyboardControl
// size: 3
func (c *Conn) GetKeyboardControl() (*GetKeyboardControlReply, error) {
return c.GetKeyboardControlReply(c.GetKeyboardControlRequest())
}
// Write request to wire for GetKeyboardControl
func (c *Conn) GetKeyboardControlRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 103 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for GetKeyboardControl
// size: (20 + pad(32))
type GetKeyboardControlReply struct {
Sequence uint16
Length uint32
GlobalAutoRepeat byte
LedMask uint32
KeyClickPercent byte
BellPercent byte
BellPitch uint16
BellDuration uint16
// padding: 2 bytes
AutoRepeats []byte // size: pad(32)
}
// Read reply GetKeyboardControl
func (c *Conn) GetKeyboardControlReply(cook *Cookie) (*GetKeyboardControlReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetKeyboardControlReply)
b := 1 // skip reply determinant
v.GlobalAutoRepeat = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.LedMask = Get32(buf[b:])
b += 4
v.KeyClickPercent = buf[b]
b += 1
v.BellPercent = buf[b]
b += 1
v.BellPitch = Get16(buf[b:])
b += 2
v.BellDuration = Get16(buf[b:])
b += 2
b += 2 // padding
v.AutoRepeats = make([]byte, 32)
copy(v.AutoRepeats[:32], buf[b:])
b += pad(int(32))
return v, nil
}
// Request Bell
// size: 4
// Write request to wire for Bell
func (c *Conn) Bell(Percent int8) {
size := 4
b := 0
buf := make([]byte, size)
buf[b] = 104 // request opcode
b += 1
buf[b] = byte(Percent)
b += 1
c.sendRequest(false, buf)
}
// Request ChangePointerControl
// size: 12
// Write request to wire for ChangePointerControl
func (c *Conn) ChangePointerControl(AccelerationNumerator int16, AccelerationDenominator int16, Threshold int16, DoAcceleration bool, DoThreshold bool) {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = 105 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put16(buf[b:], uint16(AccelerationNumerator))
b += 2
Put16(buf[b:], uint16(AccelerationDenominator))
b += 2
Put16(buf[b:], uint16(Threshold))
b += 2
if DoAcceleration {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
if DoThreshold {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
c.sendRequest(false, buf)
}
// Request GetPointerControl
// size: 3
func (c *Conn) GetPointerControl() (*GetPointerControlReply, error) {
return c.GetPointerControlReply(c.GetPointerControlRequest())
}
// Write request to wire for GetPointerControl
func (c *Conn) GetPointerControlRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 106 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for GetPointerControl
// size: 32
type GetPointerControlReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
AccelerationNumerator uint16
AccelerationDenominator uint16
Threshold uint16
// padding: 18 bytes
}
// Read reply GetPointerControl
func (c *Conn) GetPointerControlReply(cook *Cookie) (*GetPointerControlReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetPointerControlReply)
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.AccelerationNumerator = Get16(buf[b:])
b += 2
v.AccelerationDenominator = Get16(buf[b:])
b += 2
v.Threshold = Get16(buf[b:])
b += 2
b += 18 // padding
return v, nil
}
// Request SetScreenSaver
// size: 10
// Write request to wire for SetScreenSaver
func (c *Conn) SetScreenSaver(Timeout int16, Interval int16, PreferBlanking byte, AllowExposures byte) {
size := 10
b := 0
buf := make([]byte, size)
buf[b] = 107 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put16(buf[b:], uint16(Timeout))
b += 2
Put16(buf[b:], uint16(Interval))
b += 2
buf[b] = PreferBlanking
b += 1
buf[b] = AllowExposures
b += 1
c.sendRequest(false, buf)
}
// Request GetScreenSaver
// size: 3
func (c *Conn) GetScreenSaver() (*GetScreenSaverReply, error) {
return c.GetScreenSaverReply(c.GetScreenSaverRequest())
}
// Write request to wire for GetScreenSaver
func (c *Conn) GetScreenSaverRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 108 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for GetScreenSaver
// size: 32
type GetScreenSaverReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
Timeout uint16
Interval uint16
PreferBlanking byte
AllowExposures byte
// padding: 18 bytes
}
// Read reply GetScreenSaver
func (c *Conn) GetScreenSaverReply(cook *Cookie) (*GetScreenSaverReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetScreenSaverReply)
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.Timeout = Get16(buf[b:])
b += 2
v.Interval = Get16(buf[b:])
b += 2
v.PreferBlanking = buf[b]
b += 1
v.AllowExposures = buf[b]
b += 1
b += 18 // padding
return v, nil
}
// Request ChangeHosts
// size: (8 + pad((int(AddressLen) * 1)))
// Write request to wire for ChangeHosts
func (c *Conn) ChangeHosts(Mode byte, Family byte, AddressLen uint16, Address []byte) {
size := (8 + pad((int(AddressLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 109 // request opcode
b += 1
buf[b] = Mode
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Family
b += 1
b += 1 // padding
Put16(buf[b:], AddressLen)
b += 2
copy(buf[b:], Address[:AddressLen])
b += pad(int(AddressLen))
c.sendRequest(false, buf)
}
// Request ListHosts
// size: 3
func (c *Conn) ListHosts() (*ListHostsReply, error) {
return c.ListHostsReply(c.ListHostsRequest())
}
// Write request to wire for ListHosts
func (c *Conn) ListHostsRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 110 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for ListHosts
// size: (32 + HostListSize(Hosts))
type ListHostsReply struct {
Sequence uint16
Length uint32
Mode byte
HostsLen uint16
// padding: 22 bytes
Hosts []Host // size: HostListSize(Hosts)
}
// Read reply ListHosts
func (c *Conn) ListHostsReply(cook *Cookie) (*ListHostsReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(ListHostsReply)
b := 1 // skip reply determinant
v.Mode = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.HostsLen = Get16(buf[b:])
b += 2
b += 22 // padding
v.Hosts = make([]Host, v.HostsLen)
b += ReadHostList(buf[b:], v.Hosts)
return v, nil
}
// Request SetAccessControl
// size: 4
// Write request to wire for SetAccessControl
func (c *Conn) SetAccessControl(Mode byte) {
size := 4
b := 0
buf := make([]byte, size)
buf[b] = 111 // request opcode
b += 1
buf[b] = Mode
b += 1
c.sendRequest(false, buf)
}
// Request SetCloseDownMode
// size: 4
// Write request to wire for SetCloseDownMode
func (c *Conn) SetCloseDownMode(Mode byte) {
size := 4
b := 0
buf := make([]byte, size)
buf[b] = 112 // request opcode
b += 1
buf[b] = Mode
b += 1
c.sendRequest(false, buf)
}
// Request KillClient
// size: 8
// Write request to wire for KillClient
func (c *Conn) KillClient(Resource uint32) {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = 113 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], Resource)
b += 4
c.sendRequest(false, buf)
}
// Request RotateProperties
// size: (12 + pad((int(AtomsLen) * 4)))
// Write request to wire for RotateProperties
func (c *Conn) RotateProperties(Window Id, AtomsLen uint16, Delta int16, Atoms []Id) {
size := (12 + pad((int(AtomsLen) * 4)))
b := 0
buf := make([]byte, size)
buf[b] = 114 // request opcode
b += 1
b += 1 // padding
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
Put32(buf[b:], uint32(Window))
b += 4
Put16(buf[b:], AtomsLen)
b += 2
Put16(buf[b:], uint16(Delta))
b += 2
for i := 0; i < int(AtomsLen); i++ {
Put32(buf[b:], uint32(Atoms[i]))
b += 4
}
b = pad(b)
c.sendRequest(false, buf)
}
// Request ForceScreenSaver
// size: 4
// Write request to wire for ForceScreenSaver
func (c *Conn) ForceScreenSaver(Mode byte) {
size := 4
b := 0
buf := make([]byte, size)
buf[b] = 115 // request opcode
b += 1
buf[b] = Mode
b += 1
c.sendRequest(false, buf)
}
// Request SetPointerMapping
// size: (4 + pad((int(MapLen) * 1)))
func (c *Conn) SetPointerMapping(MapLen byte, Map []byte) (*SetPointerMappingReply, error) {
return c.SetPointerMappingReply(c.SetPointerMappingRequest(MapLen, Map))
}
// Write request to wire for SetPointerMapping
func (c *Conn) SetPointerMappingRequest(MapLen byte, Map []byte) *Cookie {
size := (4 + pad((int(MapLen) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 116 // request opcode
b += 1
buf[b] = MapLen
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
copy(buf[b:], Map[:MapLen])
b += pad(int(MapLen))
return c.sendRequest(true, buf)
}
// Request reply for SetPointerMapping
// size: 8
type SetPointerMappingReply struct {
Sequence uint16
Length uint32
Status byte
}
// Read reply SetPointerMapping
func (c *Conn) SetPointerMappingReply(cook *Cookie) (*SetPointerMappingReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(SetPointerMappingReply)
b := 1 // skip reply determinant
v.Status = buf[b]
b += 1
return v, nil
}
// Request GetPointerMapping
// size: 3
func (c *Conn) GetPointerMapping() (*GetPointerMappingReply, error) {
return c.GetPointerMappingReply(c.GetPointerMappingRequest())
}
// Write request to wire for GetPointerMapping
func (c *Conn) GetPointerMappingRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 117 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for GetPointerMapping
// size: (32 + pad((int(MapLen) * 1)))
type GetPointerMappingReply struct {
Sequence uint16
Length uint32
MapLen byte
// padding: 24 bytes
Map []byte // size: pad((int(MapLen) * 1))
}
// Read reply GetPointerMapping
func (c *Conn) GetPointerMappingReply(cook *Cookie) (*GetPointerMappingReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetPointerMappingReply)
b := 1 // skip reply determinant
v.MapLen = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
b += 24 // padding
v.Map = make([]byte, v.MapLen)
copy(v.Map[:v.MapLen], buf[b:])
b += pad(int(v.MapLen))
return v, nil
}
// Request SetModifierMapping
// size: (4 + pad(((int(KeycodesPerModifier) * 8) * 1)))
func (c *Conn) SetModifierMapping(KeycodesPerModifier byte, Keycodes []Keycode) (*SetModifierMappingReply, error) {
return c.SetModifierMappingReply(c.SetModifierMappingRequest(KeycodesPerModifier, Keycodes))
}
// Write request to wire for SetModifierMapping
func (c *Conn) SetModifierMappingRequest(KeycodesPerModifier byte, Keycodes []Keycode) *Cookie {
size := (4 + pad(((int(KeycodesPerModifier) * 8) * 1)))
b := 0
buf := make([]byte, size)
buf[b] = 118 // request opcode
b += 1
buf[b] = KeycodesPerModifier
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
for i := 0; i < int((int(KeycodesPerModifier) * 8)); i++ {
buf[b] = byte(Keycodes[i])
b += 1
}
b = pad(b)
return c.sendRequest(true, buf)
}
// Request reply for SetModifierMapping
// size: 8
type SetModifierMappingReply struct {
Sequence uint16
Length uint32
Status byte
}
// Read reply SetModifierMapping
func (c *Conn) SetModifierMappingReply(cook *Cookie) (*SetModifierMappingReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(SetModifierMappingReply)
b := 1 // skip reply determinant
v.Status = buf[b]
b += 1
return v, nil
}
// Request GetModifierMapping
// size: 3
func (c *Conn) GetModifierMapping() (*GetModifierMappingReply, error) {
return c.GetModifierMappingReply(c.GetModifierMappingRequest())
}
// Write request to wire for GetModifierMapping
func (c *Conn) GetModifierMappingRequest() *Cookie {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 119 // request opcode
b += 1
return c.sendRequest(true, buf)
}
// Request reply for GetModifierMapping
// size: (32 + pad(((int(KeycodesPerModifier) * 8) * 1)))
type GetModifierMappingReply struct {
Sequence uint16
Length uint32
KeycodesPerModifier byte
// padding: 24 bytes
Keycodes []Keycode // size: pad(((int(KeycodesPerModifier) * 8) * 1))
}
// Read reply GetModifierMapping
func (c *Conn) GetModifierMappingReply(cook *Cookie) (*GetModifierMappingReply, error) {
buf, err := c.waitForReply(cook)
if err != nil {
return nil, err
}
v := new(GetModifierMappingReply)
b := 1 // skip reply determinant
v.KeycodesPerModifier = buf[b]
b += 1
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
b += 24 // padding
v.Keycodes = make([]Keycode, (int(v.KeycodesPerModifier) * 8))
for i := 0; i < int((int(v.KeycodesPerModifier) * 8)); i++ {
v.Keycodes[i] = Keycode(buf[b])
b += 1
}
b = pad(b)
return v, nil
}
// Request NoOperation
// size: 3
// Write request to wire for NoOperation
func (c *Conn) NoOperation() {
size := 3
b := 0
buf := make([]byte, size)
buf[b] = 127 // request opcode
b += 1
c.sendRequest(false, buf)
}