当前位置: 首页>>代码示例>>Golang>>正文


Golang xgb.Put16函数代码示例

本文整理汇总了Golang中github.com/BurntSushi/xgb.Put16函数的典型用法代码示例。如果您正苦于以下问题:Golang Put16函数的具体用法?Golang Put16怎么用?Golang Put16使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Put16函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: offsetRequest

// Write request to wire for Offset
// offsetRequest writes a Offset request to a byte slice.
func offsetRequest(c *xgb.Conn, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16) []byte {
	size := 16
	b := 0
	buf := make([]byte, size)

	buf[b] = c.Extensions["SHAPE"]
	b += 1

	buf[b] = 4 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	buf[b] = byte(DestinationKind)
	b += 1

	b += 3 // padding

	xgb.Put32(buf[b:], uint32(DestinationWindow))
	b += 4

	xgb.Put16(buf[b:], uint16(XOffset))
	b += 2

	xgb.Put16(buf[b:], uint16(YOffset))
	b += 2

	return buf
}
开发者ID:tejohnso,项目名称:xgb,代码行数:32,代码来源:shape.go

示例2: getVersionRequest

// Write request to wire for GetVersion
// getVersionRequest writes a GetVersion request to a byte slice.
func getVersionRequest(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) []byte {
	size := 8
	b := 0
	buf := make([]byte, size)

	c.ExtLock.RLock()
	buf[b] = c.Extensions["XTEST"]
	c.ExtLock.RUnlock()
	b += 1

	buf[b] = 0 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	buf[b] = MajorVersion
	b += 1

	b += 1 // padding

	xgb.Put16(buf[b:], MinorVersion)
	b += 2

	return buf
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:28,代码来源:xtest.go

示例3: createContextRequest

// Write request to wire for CreateContext
// createContextRequest writes a CreateContext request to a byte slice.
func createContextRequest(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) []byte {
	size := 24
	b := 0
	buf := make([]byte, size)

	buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
	b += 1

	buf[b] = 2 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(ContextId))
	b += 4

	xgb.Put32(buf[b:], uint32(PortId))
	b += 4

	xgb.Put32(buf[b:], uint32(SurfaceId))
	b += 4

	xgb.Put16(buf[b:], Width)
	b += 2

	xgb.Put16(buf[b:], Height)
	b += 2

	xgb.Put32(buf[b:], Flags)
	b += 4

	return buf
}
开发者ID:varialus,项目名称:xgb,代码行数:36,代码来源:xvmc.go

示例4: createSubpictureRequest

// Write request to wire for CreateSubpicture
// createSubpictureRequest writes a CreateSubpicture request to a byte slice.
func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) []byte {
	size := 20
	b := 0
	buf := make([]byte, size)

	buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
	b += 1

	buf[b] = 6 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(SubpictureId))
	b += 4

	xgb.Put32(buf[b:], uint32(Context))
	b += 4

	xgb.Put32(buf[b:], XvimageId)
	b += 4

	xgb.Put16(buf[b:], Width)
	b += 2

	xgb.Put16(buf[b:], Height)
	b += 2

	return buf
}
开发者ID:varialus,项目名称:xgb,代码行数:33,代码来源:xvmc.go

示例5: setTimeoutsRequest

// Write request to wire for SetTimeouts
// setTimeoutsRequest writes a SetTimeouts request to a byte slice.
func setTimeoutsRequest(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) []byte {
	size := 12
	b := 0
	buf := make([]byte, size)

	buf[b] = c.Extensions["DPMS"]
	b += 1

	buf[b] = 3 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put16(buf[b:], StandbyTimeout)
	b += 2

	xgb.Put16(buf[b:], SuspendTimeout)
	b += 2

	xgb.Put16(buf[b:], OffTimeout)
	b += 2

	return buf
}
开发者ID:rjmcguire,项目名称:xgb,代码行数:27,代码来源:dpms.go

示例6: createSubpictureRequest

// Write request to wire for CreateSubpicture
// createSubpictureRequest writes a CreateSubpicture request to a byte slice.
func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) []byte {
	size := 20
	b := 0
	buf := make([]byte, size)

	c.ExtLock.RLock()
	buf[b] = c.Extensions["XVideo-MotionCompensation"]
	c.ExtLock.RUnlock()
	b += 1

	buf[b] = 6 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(SubpictureId))
	b += 4

	xgb.Put32(buf[b:], uint32(Context))
	b += 4

	xgb.Put32(buf[b:], XvimageId)
	b += 4

	xgb.Put16(buf[b:], Width)
	b += 2

	xgb.Put16(buf[b:], Height)
	b += 2

	return buf
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:35,代码来源:xvmc.go

示例7: Bytes

// Bytes writes a Range16 value to a byte slice.
func (v Range16) Bytes() []byte {
	buf := make([]byte, 4)
	b := 0

	xgb.Put16(buf[b:], v.First)
	b += 2

	xgb.Put16(buf[b:], v.Last)
	b += 2

	return buf
}
开发者ID:rjmcguire,项目名称:xgb,代码行数:13,代码来源:record.go

示例8: unredirectWindowRequest

// Write request to wire for UnredirectWindow
// unredirectWindowRequest writes a UnredirectWindow request to a byte slice.
func unredirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte {
	size := 12
	b := 0
	buf := make([]byte, size)

	c.ExtLock.RLock()
	buf[b] = c.Extensions["Composite"]
	c.ExtLock.RUnlock()
	b += 1

	buf[b] = 3 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Window))
	b += 4

	buf[b] = Update
	b += 1

	b += 3 // padding

	return buf
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:28,代码来源:composite.go

示例9: copyRegionRequest

// Write request to wire for CopyRegion
// copyRegionRequest writes a CopyRegion request to a byte slice.
func copyRegionRequest(c *xgb.Conn, Drawable xproto.Drawable, Region uint32, Dest uint32, Src uint32) []byte {
	size := 20
	b := 0
	buf := make([]byte, size)

	buf[b] = c.Extensions["DRI2"]
	b += 1

	buf[b] = 6 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put32(buf[b:], Region)
	b += 4

	xgb.Put32(buf[b:], Dest)
	b += 4

	xgb.Put32(buf[b:], Src)
	b += 4

	return buf
}
开发者ID:varialus,项目名称:xgb,代码行数:30,代码来源:dri2.go

示例10: waitSBCRequest

// Write request to wire for WaitSBC
// waitSBCRequest writes a WaitSBC request to a byte slice.
func waitSBCRequest(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSbcLo uint32) []byte {
	size := 16
	b := 0
	buf := make([]byte, size)

	buf[b] = c.Extensions["DRI2"]
	b += 1

	buf[b] = 11 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put32(buf[b:], TargetSbcHi)
	b += 4

	xgb.Put32(buf[b:], TargetSbcLo)
	b += 4

	return buf
}
开发者ID:varialus,项目名称:xgb,代码行数:27,代码来源:dri2.go

示例11: subtractRequest

// Write request to wire for Subtract
// subtractRequest writes a Subtract request to a byte slice.
func subtractRequest(c *xgb.Conn, Damage Damage, Repair xfixes.Region, Parts xfixes.Region) []byte {
	size := 16
	b := 0
	buf := make([]byte, size)

	c.ExtLock.RLock()
	buf[b] = c.Extensions["DAMAGE"]
	c.ExtLock.RUnlock()
	b += 1

	buf[b] = 3 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Damage))
	b += 4

	xgb.Put32(buf[b:], uint32(Repair))
	b += 4

	xgb.Put32(buf[b:], uint32(Parts))
	b += 4

	return buf
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:29,代码来源:damage.go

示例12: suspendRequest

// Write request to wire for Suspend
// suspendRequest writes a Suspend request to a byte slice.
func suspendRequest(c *xgb.Conn, Suspend bool) []byte {
	size := 8
	b := 0
	buf := make([]byte, size)

	buf[b] = c.Extensions["MIT-SCREEN-SAVER"]
	b += 1

	buf[b] = 5 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	if Suspend {
		buf[b] = 1
	} else {
		buf[b] = 0
	}
	b += 1

	b += 3 // padding

	return buf
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:27,代码来源:screensaver.go

示例13: getBuffersWithFormatRequest

// Write request to wire for GetBuffersWithFormat
// getBuffersWithFormatRequest writes a GetBuffersWithFormat request to a byte slice.
func getBuffersWithFormatRequest(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []AttachFormat) []byte {
	size := xgb.Pad((12 + xgb.Pad((len(Attachments) * 8))))
	b := 0
	buf := make([]byte, size)

	c.ExtLock.RLock()
	buf[b] = c.Extensions["DRI2"]
	c.ExtLock.RUnlock()
	b += 1

	buf[b] = 7 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Drawable))
	b += 4

	xgb.Put32(buf[b:], Count)
	b += 4

	b += AttachFormatListBytes(buf[b:], Attachments)

	return buf
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:28,代码来源:dri2.go

示例14: getRectanglesRequest

// Write request to wire for GetRectangles
// getRectanglesRequest writes a GetRectangles request to a byte slice.
func getRectanglesRequest(c *xgb.Conn, Window xproto.Window, SourceKind Kind) []byte {
	size := 12
	b := 0
	buf := make([]byte, size)

	c.ExtLock.RLock()
	buf[b] = c.Extensions["SHAPE"]
	c.ExtLock.RUnlock()
	b += 1

	buf[b] = 8 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	xgb.Put32(buf[b:], uint32(Window))
	b += 4

	buf[b] = byte(SourceKind)
	b += 1

	b += 3 // padding

	return buf
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:28,代码来源:shape.go

示例15: sendRequest

// Write request to wire for Send
// sendRequest writes a Send request to a byte slice.
func sendRequest(c *xgb.Conn, Event Event, DataType uint32) []byte {
	size := 104
	b := 0
	buf := make([]byte, size)

	buf[b] = c.Extensions["XEVIE"]
	b += 1

	buf[b] = 3 // request opcode
	b += 1

	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
	b += 2

	{
		structBytes := Event.Bytes()
		copy(buf[b:], structBytes)
		b += xgb.Pad(len(structBytes))
	}

	xgb.Put32(buf[b:], DataType)
	b += 4

	b += 64 // padding

	return buf
}
开发者ID:varialus,项目名称:xgb,代码行数:29,代码来源:xevie.go


注:本文中的github.com/BurntSushi/xgb.Put16函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。