• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang xwindow.RootGeometry函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ApplyStruts

func (hds *Heads) ApplyStruts(clients Clients) {
	hds.workarea = make(xinerama.Heads, len(hds.geom))
	for i, hd := range hds.geom {
		hds.workarea[i] = xrect.New(hd.X(), hd.Y(), hd.Width(), hd.Height())
	}

	rgeom := xwindow.RootGeometry(hds.X)
	for i := 0; i < clients.Len(); i++ {
		c := clients.Get(i)

		strut, _ := ewmh.WmStrutPartialGet(hds.X, c.Id())
		if strut == nil {
			continue
		}
		xrect.ApplyStrut(hds.workarea, rgeom.Width(), rgeom.Height(),
			strut.Left, strut.Right, strut.Top, strut.Bottom,
			strut.LeftStartY, strut.LeftEndY,
			strut.RightStartY, strut.RightEndY,
			strut.TopStartX, strut.TopEndX,
			strut.BottomStartX, strut.BottomEndX)
	}
	for _, wrk := range hds.workspaces.Wrks {
		wrk.Place()
	}
}
开发者ID:dlintw,项目名称:wingo,代码行数:25,代码来源:heads.go


示例2: query

func query(X *xgbutil.XUtil) xinerama.Heads {
	if X.ExtInitialized("XINERAMA") {
		heads, err := xinerama.PhysicalHeads(X)
		if err != nil || len(heads) == 0 {
			if err == nil {
				logger.Warning.Printf("Could not find any physical heads " +
					"with the Xinerama extension.")
			} else {
				logger.Warning.Printf("Could not load physical heads via "+
					"Xinerama: %s", err)
			}
			logger.Warning.Printf("Assuming one head with size equivalent " +
				"to the root window.")
		} else {
			return heads
		}
	}

	// If we're here, then something went wrong or the Xinerama extension
	// isn't available. So query the root window for its geometry and use that.
	rgeom := xwindow.RootGeometry(X)
	return xinerama.Heads{
		xrect.New(rgeom.X(), rgeom.Y(), rgeom.Width(), rgeom.Height()),
	}
}
开发者ID:dlintw,项目名称:wingo,代码行数:25,代码来源:heads.go


示例3: main

func main() {
	X, err := xgbutil.NewConn()
	if err != nil {
		log.Fatalln(err)
	}

	// The message box uses the keybind module, so we must initialize it.
	keybind.Initialize(X)

	// Creating a new message prompt is as simple as supply an X connection,
	// a theme and a configuration. We use built in defaults here.
	msgPrompt := prompt.NewMessage(X,
		prompt.DefaultMessageTheme, prompt.DefaultMessageConfig)

	// Show maps the message prompt window.
	// If a duration is specified, the window does NOT acquire focus and
	// automatically disappears after the specified time.
	// If a duration is not specified (i.e., '0'), then the window is mapped,
	// and acquires focus. It does not disappear until it loses focus or when
	// the user hits the "confirm" or "cancel" keys (usually "enter" and
	// "escape").
	timeout := 2 * time.Second // or "0" for no timeout.
	msgPrompt.Show(xwindow.RootGeometry(X), "Hello, world!", timeout, hidden)

	xevent.Main(X)
}
开发者ID:pascience,项目名称:foci,代码行数:26,代码来源:main.go


示例4: ewmhDesktopGeometry

func ewmhDesktopGeometry() {
	rgeom := xwindow.RootGeometry(X)

	ewmh.DesktopGeometrySet(X,
		&ewmh.DesktopGeometry{
			Width:  rgeom.Width(),
			Height: rgeom.Height(),
		})
}
开发者ID:cshapeshifter,项目名称:wingo,代码行数:9,代码来源:ewmh.go


示例5: getPrimaryScreenBestResolution

func getPrimaryScreenBestResolution() (w uint16, h uint16) {
	// if connect to x failed, just return 1024x768
	w, h = 1024, 768

	XU, err := xgbutil.NewConn()
	if err != nil {
		return
	}
	err = randr.Init(XU.Conn())
	if err != nil {
		return
	}
	_, err = randr.QueryVersion(XU.Conn(), 1, 4).Reply()
	if err != nil {
		return
	}
	Root := xproto.Setup(XU.Conn()).DefaultScreen(XU.Conn()).Root
	resources, err := randr.GetScreenResources(XU.Conn(), Root).Reply()
	if err != nil {
		return
	}

	bestModes := make([]uint32, 0)
	for _, output := range resources.Outputs {
		reply, err := randr.GetOutputInfo(XU.Conn(), output, 0).Reply()
		if err == nil && reply.NumModes > 1 {
			bestModes = append(bestModes, uint32(reply.Modes[0]))
		}
	}

	w, h = 0, 0
	for _, m := range resources.Modes {
		for _, id := range bestModes {
			if id == m.Id {
				bw, bh := m.Width, m.Height
				if w == 0 || h == 0 {
					w, h = bw, bh
				} else if uint32(bw)*uint32(bh) < uint32(w)*uint32(h) {
					w, h = bw, bh
				}
			}
		}
	}

	if w == 0 || h == 0 {
		// get resource failed, use root window's geometry
		rootRect := xwindow.RootGeometry(XU)
		w, h = uint16(rootRect.Width()), uint16(rootRect.Height())
	}

	if w == 0 || h == 0 {
		w, h = 1024, 768 // default value
	}

	logger.Debugf("primary screen's best resolution is %dx%d", w, h)
	return
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:57,代码来源:utils.go


示例6: HeadGeom

func (wrk *Sticky) HeadGeom() xrect.Rect {
	return xwindow.RootGeometry(wrk.X)
}
开发者ID:mkrull,项目名称:wingo,代码行数:3,代码来源:interface.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang xwindow.Window类代码示例发布时间:2022-05-24
下一篇:
Golang xwindow.New函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap