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


Golang xproto.QueryExtension函数代码示例

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


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

示例1: Init

// Init must be called before using the BIG-REQUESTS extension.
func Init(c *xgb.Conn) error {
	reply, err := xproto.QueryExtension(c, 12, "BIG-REQUESTS").Reply()
	switch {
	case err != nil:
		return err
	case !reply.Present:
		return xgb.Errorf("No extension named BIG-REQUESTS could be found on on the server.")
	}

	c.ExtLock.Lock()
	c.Extensions["BIG-REQUESTS"] = reply.MajorOpcode
	c.ExtLock.Unlock()
	for evNum, fun := range xgb.NewExtEventFuncs["BIG-REQUESTS"] {
		xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun
	}
	for errNum, fun := range xgb.NewExtErrorFuncs["BIG-REQUESTS"] {
		xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun
	}
	return nil
}
开发者ID:BurntSushi,项目名称:xgb,代码行数:21,代码来源:bigreq.go

示例2: Init

// Init must be called before using the XVideo-MotionCompensation extension.
func Init(c *xgb.Conn) error {
	reply, err := xproto.QueryExtension(c, 25, "XVideo-MotionCompensation").Reply()
	switch {
	case err != nil:
		return err
	case !reply.Present:
		return xgb.Errorf("No extension named XVideo-MotionCompensation could be found on on the server.")
	}

	xgb.ExtLock.Lock()
	c.Extensions["XVideo-MotionCompensation"] = reply.MajorOpcode
	for evNum, fun := range xgb.NewExtEventFuncs["XVideo-MotionCompensation"] {
		xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun
	}
	for errNum, fun := range xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] {
		xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun
	}
	xgb.ExtLock.Unlock()

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


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