本文整理汇总了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
}
示例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
}