示例#1
0
文件: damage.go 项目: BurntSushi/xgb
// NotifyEventNew constructs a NotifyEvent value that implements xgb.Event from a byte slice.
func NotifyEventNew(buf []byte) xgb.Event {
	v := NotifyEvent{}
	b := 1 // don't read event number

	v.Level = buf[b]
	b += 1

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Drawable = xproto.Drawable(xgb.Get32(buf[b:]))
	b += 4

	v.Damage = Damage(xgb.Get32(buf[b:]))
	b += 4

	v.Timestamp = xproto.Timestamp(xgb.Get32(buf[b:]))
	b += 4

	v.Area = xproto.Rectangle{}
	b += xproto.RectangleRead(buf[b:], &v.Area)

	v.Geometry = xproto.Rectangle{}
	b += xproto.RectangleRead(buf[b:], &v.Geometry)

	return v
}
示例#2
0
文件: xvmc.go 项目: varialus/xgb
// createContextReply reads a byte slice into a CreateContextReply value.
func createContextReply(buf []byte) *CreateContextReply {
	v := new(CreateContextReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.WidthActual = xgb.Get16(buf[b:])
	b += 2

	v.HeightActual = xgb.Get16(buf[b:])
	b += 2

	v.FlagsReturn = xgb.Get32(buf[b:])
	b += 4

	b += 20 // padding

	v.PrivData = make([]uint32, v.Length)
	for i := 0; i < int(v.Length); i++ {
		v.PrivData[i] = xgb.Get32(buf[b:])
		b += 4
	}
	b = xgb.Pad(b)

	return v
}
示例#3
0
文件: xvmc.go 项目: varialus/xgb
// SurfaceInfoRead reads a byte slice into a SurfaceInfo value.
func SurfaceInfoRead(buf []byte, v *SurfaceInfo) int {
	b := 0

	v.Id = Surface(xgb.Get32(buf[b:]))
	b += 4

	v.ChromaFormat = xgb.Get16(buf[b:])
	b += 2

	v.Pad0 = xgb.Get16(buf[b:])
	b += 2

	v.MaxWidth = xgb.Get16(buf[b:])
	b += 2

	v.MaxHeight = xgb.Get16(buf[b:])
	b += 2

	v.SubpictureMaxWidth = xgb.Get16(buf[b:])
	b += 2

	v.SubpictureMaxHeight = xgb.Get16(buf[b:])
	b += 2

	v.McType = xgb.Get32(buf[b:])
	b += 4

	v.Flags = xgb.Get32(buf[b:])
	b += 4

	return b
}
// NotifyEventNew constructs a NotifyEvent value that implements xgb.Event from a byte slice.
func NotifyEventNew(buf []byte) xgb.Event {
	v := NotifyEvent{}
	b := 1 // don't read event number

	v.State = buf[b]
	b += 1

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Time = xproto.Timestamp(xgb.Get32(buf[b:]))
	b += 4

	v.Root = xproto.Window(xgb.Get32(buf[b:]))
	b += 4

	v.Window = xproto.Window(xgb.Get32(buf[b:]))
	b += 4

	v.Kind = buf[b]
	b += 1

	if buf[b] == 1 {
		v.Forced = true
	} else {
		v.Forced = false
	}
	b += 1

	b += 14 // padding

	return v
}
// queryInfoReply reads a byte slice into a QueryInfoReply value.
func queryInfoReply(buf []byte) *QueryInfoReply {
	v := new(QueryInfoReply)
	b := 1 // skip reply determinant

	v.State = buf[b]
	b += 1

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.SaverWindow = xproto.Window(xgb.Get32(buf[b:]))
	b += 4

	v.MsUntilServer = xgb.Get32(buf[b:])
	b += 4

	v.MsSinceUserInput = xgb.Get32(buf[b:])
	b += 4

	v.EventMask = xgb.Get32(buf[b:])
	b += 4

	v.Kind = buf[b]
	b += 1

	b += 7 // padding

	return v
}
示例#6
0
// getXIDListReply reads a byte slice into a GetXIDListReply value.
func getXIDListReply(buf []byte) *GetXIDListReply {
	v := new(GetXIDListReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.IdsLen = xgb.Get32(buf[b:])
	b += 4

	b += 20 // padding

	v.Ids = make([]uint32, v.IdsLen)
	for i := 0; i < int(v.IdsLen); i++ {
		v.Ids[i] = xgb.Get32(buf[b:])
		b += 4
	}

	return v
}
示例#7
0
文件: dri2.go 项目: varialus/xgb
// getParamReply reads a byte slice into a GetParamReply value.
func getParamReply(buf []byte) *GetParamReply {
	v := new(GetParamReply)
	b := 1 // skip reply determinant

	if buf[b] == 1 {
		v.IsParamRecognized = true
	} else {
		v.IsParamRecognized = false
	}
	b += 1

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.ValueHi = xgb.Get32(buf[b:])
	b += 4

	v.ValueLo = xgb.Get32(buf[b:])
	b += 4

	return v
}
示例#8
0
文件: xf86dri.go 项目: rjmcguire/xgb
// getClientDriverNameReply reads a byte slice into a GetClientDriverNameReply value.
func getClientDriverNameReply(buf []byte) *GetClientDriverNameReply {
	v := new(GetClientDriverNameReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.ClientDriverMajorVersion = xgb.Get32(buf[b:])
	b += 4

	v.ClientDriverMinorVersion = xgb.Get32(buf[b:])
	b += 4

	v.ClientDriverPatchVersion = xgb.Get32(buf[b:])
	b += 4

	v.ClientDriverNameLen = xgb.Get32(buf[b:])
	b += 4

	b += 8 // padding

	{
		byteString := make([]byte, v.ClientDriverNameLen)
		copy(byteString[:v.ClientDriverNameLen], buf[b:])
		v.ClientDriverName = string(byteString)
		b += xgb.Pad(int(v.ClientDriverNameLen))
	}

	return v
}
示例#9
0
文件: shm.go 项目: varialus/xgb
// CompletionEventNew constructs a CompletionEvent value that implements xgb.Event from a byte slice.
func CompletionEventNew(buf []byte) xgb.Event {
	v := CompletionEvent{}
	b := 1 // don't read event number

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Drawable = xproto.Drawable(xgb.Get32(buf[b:]))
	b += 4

	v.MinorEvent = xgb.Get16(buf[b:])
	b += 2

	v.MajorEvent = buf[b]
	b += 1

	b += 1 // padding

	v.Shmseg = Seg(xgb.Get32(buf[b:]))
	b += 4

	v.Offset = xgb.Get32(buf[b:])
	b += 4

	return v
}
示例#10
0
文件: record.go 项目: rjmcguire/xgb
// getContextReply reads a byte slice into a GetContextReply value.
func getContextReply(buf []byte) *GetContextReply {
	v := new(GetContextReply)
	b := 1 // skip reply determinant

	if buf[b] == 1 {
		v.Enabled = true
	} else {
		v.Enabled = false
	}
	b += 1

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.ElementHeader = ElementHeader(buf[b])
	b += 1

	b += 3 // padding

	v.NumInterceptedClients = xgb.Get32(buf[b:])
	b += 4

	b += 16 // padding

	v.InterceptedClients = make([]ClientInfo, v.NumInterceptedClients)
	b += ClientInfoReadList(buf[b:], v.InterceptedClients)

	return v
}
示例#11
0
文件: xinerama.go 项目: tejohnso/xgb
// getScreenSizeReply reads a byte slice into a GetScreenSizeReply value.
func getScreenSizeReply(buf []byte) *GetScreenSizeReply {
	v := new(GetScreenSizeReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.Width = xgb.Get32(buf[b:])
	b += 4

	v.Height = xgb.Get32(buf[b:])
	b += 4

	v.Window = xproto.Window(xgb.Get32(buf[b:]))
	b += 4

	v.Screen = xgb.Get32(buf[b:])
	b += 4

	return v
}
示例#12
0
文件: xf86dri.go 项目: rjmcguire/xgb
// openConnectionReply reads a byte slice into a OpenConnectionReply value.
func openConnectionReply(buf []byte) *OpenConnectionReply {
	v := new(OpenConnectionReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.SareaHandleLow = xgb.Get32(buf[b:])
	b += 4

	v.SareaHandleHigh = xgb.Get32(buf[b:])
	b += 4

	v.BusIdLen = xgb.Get32(buf[b:])
	b += 4

	b += 12 // padding

	{
		byteString := make([]byte, v.BusIdLen)
		copy(byteString[:v.BusIdLen], buf[b:])
		v.BusId = string(byteString)
		b += xgb.Pad(int(v.BusIdLen))
	}

	return v
}
示例#13
0
文件: dri2.go 项目: varialus/xgb
// getBuffersWithFormatReply reads a byte slice into a GetBuffersWithFormatReply value.
func getBuffersWithFormatReply(buf []byte) *GetBuffersWithFormatReply {
	v := new(GetBuffersWithFormatReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.Width = xgb.Get32(buf[b:])
	b += 4

	v.Height = xgb.Get32(buf[b:])
	b += 4

	v.Count = xgb.Get32(buf[b:])
	b += 4

	b += 12 // padding

	v.Buffers = make([]DRI2Buffer, v.Count)
	b += DRI2BufferReadList(buf[b:], v.Buffers)

	return v
}
示例#14
0
文件: res.go 项目: BurntSushi/xgb
// ClientRead reads a byte slice into a Client value.
func ClientRead(buf []byte, v *Client) int {
	b := 0

	v.ResourceBase = xgb.Get32(buf[b:])
	b += 4

	v.ResourceMask = xgb.Get32(buf[b:])
	b += 4

	return b
}
示例#15
0
文件: res.go 项目: BurntSushi/xgb
// ResourceIdSpecRead reads a byte slice into a ResourceIdSpec value.
func ResourceIdSpecRead(buf []byte, v *ResourceIdSpec) int {
	b := 0

	v.Resource = xgb.Get32(buf[b:])
	b += 4

	v.Type = xgb.Get32(buf[b:])
	b += 4

	return b
}
示例#16
0
文件: res.go 项目: BurntSushi/xgb
// ClientIdSpecRead reads a byte slice into a ClientIdSpec value.
func ClientIdSpecRead(buf []byte, v *ClientIdSpec) int {
	b := 0

	v.Client = xgb.Get32(buf[b:])
	b += 4

	v.Mask = xgb.Get32(buf[b:])
	b += 4

	return b
}
示例#17
0
文件: dri2.go 项目: varialus/xgb
// AttachFormatRead reads a byte slice into a AttachFormat value.
func AttachFormatRead(buf []byte, v *AttachFormat) int {
	b := 0

	v.Attachment = xgb.Get32(buf[b:])
	b += 4

	v.Format = xgb.Get32(buf[b:])
	b += 4

	return b
}
示例#18
0
文件: res.go 项目: BurntSushi/xgb
// TypeRead reads a byte slice into a Type value.
func TypeRead(buf []byte, v *Type) int {
	b := 0

	v.ResourceType = xproto.Atom(xgb.Get32(buf[b:]))
	b += 4

	v.Count = xgb.Get32(buf[b:])
	b += 4

	return b
}
示例#19
0
文件: xf86dri.go 项目: tejohnso/xgb
// getDrawableInfoReply reads a byte slice into a GetDrawableInfoReply value.
func getDrawableInfoReply(buf []byte) *GetDrawableInfoReply {
	v := new(GetDrawableInfoReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.DrawableTableIndex = xgb.Get32(buf[b:])
	b += 4

	v.DrawableTableStamp = xgb.Get32(buf[b:])
	b += 4

	v.DrawableOriginX = int16(xgb.Get16(buf[b:]))
	b += 2

	v.DrawableOriginY = int16(xgb.Get16(buf[b:]))
	b += 2

	v.DrawableSizeW = int16(xgb.Get16(buf[b:]))
	b += 2

	v.DrawableSizeH = int16(xgb.Get16(buf[b:]))
	b += 2

	v.NumClipRects = xgb.Get32(buf[b:])
	b += 4

	v.BackX = int16(xgb.Get16(buf[b:]))
	b += 2

	v.BackY = int16(xgb.Get16(buf[b:]))
	b += 2

	v.NumBackClipRects = xgb.Get32(buf[b:])
	b += 4

	v.ClipRects = make([]DrmClipRect, v.NumClipRects)
	b += DrmClipRectReadList(buf[b:], v.ClipRects)

	b = (b + 3) & ^3 // alignment gap

	v.BackClipRects = make([]DrmClipRect, v.NumBackClipRects)
	b += DrmClipRectReadList(buf[b:], v.BackClipRects)

	return v
}
示例#20
0
文件: record.go 项目: rjmcguire/xgb
// ClientInfoRead reads a byte slice into a ClientInfo value.
func ClientInfoRead(buf []byte, v *ClientInfo) int {
	b := 0

	v.ClientResource = ClientSpec(xgb.Get32(buf[b:]))
	b += 4

	v.NumRanges = xgb.Get32(buf[b:])
	b += 4

	v.Ranges = make([]Range, v.NumRanges)
	b += RangeReadList(buf[b:], v.Ranges)

	return b
}
示例#21
0
文件: dpms.go 项目: rjmcguire/xgb
// infoReply reads a byte slice into a InfoReply value.
func infoReply(buf []byte) *InfoReply {
	v := new(InfoReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.PowerLevel = xgb.Get16(buf[b:])
	b += 2

	if buf[b] == 1 {
		v.State = true
	} else {
		v.State = false
	}
	b += 1

	b += 21 // padding

	return v
}
示例#22
0
文件: dpms.go 项目: rjmcguire/xgb
// getTimeoutsReply reads a byte slice into a GetTimeoutsReply value.
func getTimeoutsReply(buf []byte) *GetTimeoutsReply {
	v := new(GetTimeoutsReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.StandbyTimeout = xgb.Get16(buf[b:])
	b += 2

	v.SuspendTimeout = xgb.Get16(buf[b:])
	b += 2

	v.OffTimeout = xgb.Get16(buf[b:])
	b += 2

	b += 18 // padding

	return v
}
示例#23
0
文件: res.go 项目: BurntSushi/xgb
// ClientIdValueRead reads a byte slice into a ClientIdValue value.
func ClientIdValueRead(buf []byte, v *ClientIdValue) int {
	b := 0

	v.Spec = ClientIdSpec{}
	b += ClientIdSpecRead(buf[b:], &v.Spec)

	v.Length = xgb.Get32(buf[b:])
	b += 4

	v.Value = make([]uint32, v.Length)
	for i := 0; i < int(v.Length); i++ {
		v.Value[i] = xgb.Get32(buf[b:])
		b += 4
	}

	return b
}
示例#24
0
文件: bigreq.go 项目: BurntSushi/xgb
// enableReply reads a byte slice into a EnableReply value.
func enableReply(buf []byte) *EnableReply {
	v := new(EnableReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.MaximumRequestLength = xgb.Get32(buf[b:])
	b += 4

	return v
}
示例#25
0
文件: xf86dri.go 项目: rjmcguire/xgb
// createDrawableReply reads a byte slice into a CreateDrawableReply value.
func createDrawableReply(buf []byte) *CreateDrawableReply {
	v := new(CreateDrawableReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.HwDrawableHandle = xgb.Get32(buf[b:])
	b += 4

	return v
}
示例#26
0
文件: xf86dri.go 项目: rjmcguire/xgb
// authConnectionReply reads a byte slice into a AuthConnectionReply value.
func authConnectionReply(buf []byte) *AuthConnectionReply {
	v := new(AuthConnectionReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.Authenticated = xgb.Get32(buf[b:])
	b += 4

	return v
}
示例#27
0
文件: xinerama.go 项目: tejohnso/xgb
// isActiveReply reads a byte slice into a IsActiveReply value.
func isActiveReply(buf []byte) *IsActiveReply {
	v := new(IsActiveReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.State = xgb.Get32(buf[b:])
	b += 4

	return v
}
示例#28
0
文件: res.go 项目: BurntSushi/xgb
// ResourceSizeSpecRead reads a byte slice into a ResourceSizeSpec value.
func ResourceSizeSpecRead(buf []byte, v *ResourceSizeSpec) int {
	b := 0

	v.Spec = ResourceIdSpec{}
	b += ResourceIdSpecRead(buf[b:], &v.Spec)

	v.Bytes_ = xgb.Get32(buf[b:])
	b += 4

	v.RefCount = xgb.Get32(buf[b:])
	b += 4

	v.UseCount = xgb.Get32(buf[b:])
	b += 4

	return b
}
示例#29
0
文件: dri2.go 项目: varialus/xgb
// waitSBCReply reads a byte slice into a WaitSBCReply value.
func waitSBCReply(buf []byte) *WaitSBCReply {
	v := new(WaitSBCReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.UstHi = xgb.Get32(buf[b:])
	b += 4

	v.UstLo = xgb.Get32(buf[b:])
	b += 4

	v.MscHi = xgb.Get32(buf[b:])
	b += 4

	v.MscLo = xgb.Get32(buf[b:])
	b += 4

	v.SbcHi = xgb.Get32(buf[b:])
	b += 4

	v.SbcLo = xgb.Get32(buf[b:])
	b += 4

	return v
}
示例#30
0
文件: xinerama.go 项目: tejohnso/xgb
// getStateReply reads a byte slice into a GetStateReply value.
func getStateReply(buf []byte) *GetStateReply {
	v := new(GetStateReply)
	b := 1 // skip reply determinant

	v.State = buf[b]
	b += 1

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.Window = xproto.Window(xgb.Get32(buf[b:]))
	b += 4

	return v
}