當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。