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

Golang xprop.PropValNums函数代码示例

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

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



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

示例1: WmHintsGet

// WM_HINTS get
func WmHintsGet(xu *xgbutil.XUtil,
	win xproto.Window) (hints *Hints, err error) {

	lenExpect := 9
	raw, err := xprop.PropValNums(xprop.GetProperty(xu, win, "WM_HINTS"))
	if err != nil {
		return nil, err
	}
	if len(raw) != lenExpect {
		return nil,
			fmt.Errorf("WmHints: There are %d fields in "+
				"WM_HINTS, but xgbutil expects %d.", len(raw), lenExpect)
	}

	hints = &Hints{}
	hints.Flags = raw[0]
	hints.Input = raw[1]
	hints.InitialState = raw[2]
	hints.IconPixmap = xproto.Pixmap(raw[3])
	hints.IconWindow = xproto.Window(raw[4])
	hints.IconX = raw[5]
	hints.IconY = raw[6]
	hints.IconMask = xproto.Pixmap(raw[7])
	hints.WindowGroup = xproto.Window(raw[8])

	return hints, nil
}
开发者ID:droundy,项目名称:xgbutil,代码行数:28,代码来源:icccm.go


示例2: updateCurrentViewport

func updateCurrentViewport() {
	currentViewport, _ = xprop.PropValNums(
		xprop.GetProperty(
			XU,
			XU.RootWin(),
			"DEEPIN_SCREEN_VIEWPORT",
		))
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:8,代码来源:client_manager.go


示例3: DesktopGeometryGet

// _NET_DESKTOP_GEOMETRY get
func DesktopGeometryGet(xu *xgbutil.XUtil) (*DesktopGeometry, error) {
	geom, err := xprop.PropValNums(xprop.GetProperty(xu, xu.RootWin(),
		"_NET_DESKTOP_GEOMETRY"))
	if err != nil {
		return nil, err
	}

	return &DesktopGeometry{Width: int(geom[0]), Height: int(geom[1])}, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:10,代码来源:ewmh.go


示例4: WmStrutGet

// _NET_WM_STRUT get
func WmStrutGet(xu *xgbutil.XUtil, win xproto.Window) (*WmStrut, error) {
	struts, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_NET_WM_STRUT"))
	if err != nil {
		return nil, err
	}

	return &WmStrut{
		Left:   struts[0],
		Right:  struts[1],
		Top:    struts[2],
		Bottom: struts[3],
	}, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:15,代码来源:ewmh.go


示例5: WmIconGeometryGet

// _NET_WM_ICON_GEOMETRY get
func WmIconGeometryGet(xu *xgbutil.XUtil,
	win xproto.Window) (*WmIconGeometry, error) {

	geom, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_NET_WM_ICON_GEOMETRY"))
	if err != nil {
		return nil, err
	}

	return &WmIconGeometry{
		X:      int(geom[0]),
		Y:      int(geom[1]),
		Width:  geom[2],
		Height: geom[3],
	}, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:17,代码来源:ewmh.go


示例6: DesktopViewportGet

// _NET_DESKTOP_VIEWPORT get
func DesktopViewportGet(xu *xgbutil.XUtil) ([]DesktopViewport, error) {
	coords, err := xprop.PropValNums(xprop.GetProperty(xu, xu.RootWin(),
		"_NET_DESKTOP_VIEWPORT"))
	if err != nil {
		return nil, err
	}

	viewports := make([]DesktopViewport, len(coords)/2)
	for i, _ := range viewports {
		viewports[i] = DesktopViewport{
			X: int(coords[i*2]),
			Y: int(coords[i*2+1]),
		}
	}
	return viewports, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:17,代码来源:ewmh.go


示例7: WmStateGet

// WM_STATE get
func WmStateGet(xu *xgbutil.XUtil, win xproto.Window) (*WmState, error) {
	raw, err := xprop.PropValNums(xprop.GetProperty(xu, win, "WM_STATE"))
	if err != nil {
		return nil, err
	}
	if len(raw) != 2 {
		return nil,
			fmt.Errorf("WmState: Expected two integers in WM_STATE property "+
				"but xgbutil found %d in '%v'.", len(raw), raw)
	}

	return &WmState{
		State: raw[0],
		Icon:  xproto.Window(raw[1]),
	}, nil
}
开发者ID:droundy,项目名称:xgbutil,代码行数:17,代码来源:icccm.go


示例8: WmFullscreenMonitorsGet

// _NET_WM_FULLSCREEN_MONITORS get
func WmFullscreenMonitorsGet(xu *xgbutil.XUtil,
	win xproto.Window) (*WmFullscreenMonitors, error) {

	raw, err := xprop.PropValNums(
		xprop.GetProperty(xu, win, "_NET_WM_FULLSCREEN_MONITORS"))
	if err != nil {
		return nil, err
	}

	return &WmFullscreenMonitors{
		Top:    raw[0],
		Bottom: raw[1],
		Left:   raw[2],
		Right:  raw[3],
	}, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:17,代码来源:ewmh.go


示例9: FrameExtentsGet

// _NET_FRAME_EXTENTS get
func FrameExtentsGet(xu *xgbutil.XUtil,
	win xproto.Window) (*FrameExtents, error) {

	raw, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_NET_FRAME_EXTENTS"))
	if err != nil {
		return nil, err
	}

	return &FrameExtents{
		Left:   int(raw[0]),
		Right:  int(raw[1]),
		Top:    int(raw[2]),
		Bottom: int(raw[3]),
	}, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:17,代码来源:ewmh.go


示例10: WmStrutPartialGet

// _NET_WM_STRUT_PARTIAL get
func WmStrutPartialGet(xu *xgbutil.XUtil,
	win xproto.Window) (*WmStrutPartial, error) {

	struts, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_NET_WM_STRUT_PARTIAL"))
	if err != nil {
		return nil, err
	}

	return &WmStrutPartial{
		Left: struts[0], Right: struts[1], Top: struts[2], Bottom: struts[3],
		LeftStartY: struts[4], LeftEndY: struts[5],
		RightStartY: struts[6], RightEndY: struts[7],
		TopStartX: struts[8], TopEndX: struts[9],
		BottomStartX: struts[10], BottomEndX: struts[11],
	}, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:18,代码来源:ewmh.go


示例11: WmIconSizeGet

// WM_ICON_SIZE get
func WmIconSizeGet(xu *xgbutil.XUtil, win xproto.Window) (*IconSize, error) {
	raw, err := xprop.PropValNums(xprop.GetProperty(xu, win, "WM_ICON_SIZE"))
	if err != nil {
		return nil, err
	}
	if len(raw) != 6 {
		return nil,
			fmt.Errorf("WmIconSize: Expected six integers in WM_ICON_SIZE "+
				"property, but xgbutil found "+"%d in '%v'.", len(raw), raw)
	}

	return &IconSize{
		MinWidth: raw[0], MinHeight: raw[1],
		MaxWidth: raw[2], MaxHeight: raw[3],
		WidthInc: raw[4], HeightInc: raw[5],
	}, nil
}
开发者ID:droundy,项目名称:xgbutil,代码行数:18,代码来源:icccm.go


示例12: WorkareaGet

// _NET_WORKAREA get
func WorkareaGet(xu *xgbutil.XUtil) ([]Workarea, error) {
	rects, err := xprop.PropValNums(xprop.GetProperty(xu, xu.RootWin(),
		"_NET_WORKAREA"))
	if err != nil {
		return nil, err
	}

	workareas := make([]Workarea, len(rects)/4)
	for i, _ := range workareas {
		workareas[i] = Workarea{
			X:      int(rects[i*4]),
			Y:      int(rects[i*4+1]),
			Width:  rects[i*4+2],
			Height: rects[i*4+3],
		}
	}
	return workareas, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:19,代码来源:ewmh.go


示例13: load

func (sock *XEmbedSocket) load() error {
	vals, err := xprop.PropValNums(xprop.GetProperty(sock.X, sock.id, "_XEMBED_INFO"))
	if err != nil {
		sock.Version = 0
		sock.Flags = SocketFlags(0)

		return nil // Fucking Qt.
	}

	if len(vals) < 2 {
		return fmt.Errorf("Expected 2 nums in property -- got %d", len(vals))
	}

	sock.Version = uint32(vals[0])
	sock.Flags = SocketFlags(vals[1])

	return nil
}
开发者ID:AmandaCameron,项目名称:gobar,代码行数:18,代码来源:embedder.go


示例14: checkDeepinWindowViewports

// works for old deepin wm.
func checkDeepinWindowViewports(xid xproto.Window) (bool, error) {
	viewports, err := xprop.PropValNums(xprop.GetProperty(XU, xid,
		"DEEPIN_WINDOW_VIEWPORTS"))
	if err != nil {
		return false, err
	}

	workspaces := make([][]uint, 0)
	for i := uint(0); i < viewports[0]; i++ {
		viewport := make([]uint, 2)
		viewport[0] = viewports[i*2+1]
		viewport[1] = viewports[i*2+2]
		workspaces = append(workspaces, viewport)
	}
	if currentViewport == nil {
		updateCurrentViewport()
	}
	return isCoverWorkspace(workspaces, currentViewport), nil
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:20,代码来源:client_manager.go


示例15: DesktopLayoutGet

// _NET_DESKTOP_LAYOUT get
func DesktopLayoutGet(xu *xgbutil.XUtil) (dl *DesktopLayout, err error) {
	dlraw, err := xprop.PropValNums(xprop.GetProperty(xu, xu.RootWin(),
		"_NET_DESKTOP_LAYOUT"))
	if err != nil {
		return nil, err
	}

	dl = &DesktopLayout{}
	dl.Orientation = int(dlraw[0])
	dl.Columns = int(dlraw[1])
	dl.Rows = int(dlraw[2])

	if len(dlraw) > 3 {
		dl.StartingCorner = int(dlraw[3])
	} else {
		dl.StartingCorner = TopLeft
	}

	return dl, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:21,代码来源:ewmh.go


示例16: WmOpaqueRegionGet

// _NET_WM_OPAQUE_REGION get
func WmOpaqueRegionGet(xu *xgbutil.XUtil,
	win xproto.Window) ([]WmOpaqueRegion, error) {

	raw, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_NET_WM_OPAQUE_REGION"))
	if err != nil {
		return nil, err
	}

	regions := make([]WmOpaqueRegion, len(raw)/4)
	for i, _ := range regions {
		regions[i] = WmOpaqueRegion{
			X:      int(raw[i*4+0]),
			Y:      int(raw[i*4+1]),
			Width:  raw[i*4+2],
			Height: raw[i*4+3],
		}
	}
	return regions, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:21,代码来源:ewmh.go


示例17: WmNormalHintsGet

// WM_NORMAL_HINTS get
func WmNormalHintsGet(xu *xgbutil.XUtil,
	win xproto.Window) (nh *NormalHints, err error) {

	lenExpect := 18
	hints, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"WM_NORMAL_HINTS"))
	if err != nil {
		return nil, err
	}
	if len(hints) != lenExpect {
		return nil,
			fmt.Errorf("WmNormalHint: There are %d fields in WM_NORMAL_HINTS, "+
				"but xgbutil expects %d.", len(hints), lenExpect)
	}

	nh = &NormalHints{}
	nh.Flags = hints[0]
	nh.X = hints[1]
	nh.Y = hints[2]
	nh.Width = hints[3]
	nh.Height = hints[4]
	nh.MinWidth = hints[5]
	nh.MinHeight = hints[6]
	nh.MaxWidth = hints[7]
	nh.MaxHeight = hints[8]
	nh.WidthInc = hints[9]
	nh.HeightInc = hints[10]
	nh.MinAspectNum = hints[11]
	nh.MinAspectDen = hints[12]
	nh.MaxAspectNum = hints[13]
	nh.MaxAspectDen = hints[14]
	nh.BaseWidth = hints[15]
	nh.BaseHeight = hints[16]
	nh.WinGravity = hints[17]

	if nh.WinGravity <= 0 {
		nh.WinGravity = xproto.GravityNorthWest
	}

	return nh, nil
}
开发者ID:droundy,项目名称:xgbutil,代码行数:42,代码来源:icccm.go


示例18: WmHintsGet

// _MOTIF_WM_HINTS get
func WmHintsGet(xu *xgbutil.XUtil, win xproto.Window) (mh *Hints, err error) {
	lenExpect := 5
	hints, err := xprop.PropValNums(xprop.GetProperty(xu, win,
		"_MOTIF_WM_HINTS"))
	if err != nil {
		return nil, err
	}
	if len(hints) != lenExpect {
		return nil,
			fmt.Errorf("motif.WmHintsGet: There are %d fields in "+
				"_MOTIF_WM_HINTS, but xgbutil expects %d.",
				len(hints), lenExpect)
	}

	mh = &Hints{}
	mh.Flags = hints[0]
	mh.Function = hints[1]
	mh.Decoration = hints[2]
	mh.Input = hints[3]
	mh.Status = hints[4]

	return
}
开发者ID:droundy,项目名称:xgbutil,代码行数:24,代码来源:motif.go


示例19: WmIconGet

// _NET_WM_ICON get
func WmIconGet(xu *xgbutil.XUtil, win xproto.Window) ([]WmIcon, error) {
	icon, err := xprop.PropValNums(xprop.GetProperty(xu, win, "_NET_WM_ICON"))
	if err != nil {
		return nil, err
	}

	wmicons := make([]WmIcon, 0)
	start := uint(0)
	for int(start) < len(icon) {
		w, h := icon[start], icon[start+1]
		upto := w * h

		wmicon := WmIcon{
			Width:  w,
			Height: h,
			Data:   icon[(start + 2):(start + upto + 2)],
		}
		wmicons = append(wmicons, wmicon)

		start += upto + 2
	}

	return wmicons, nil
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:25,代码来源:ewmh.go


示例20: VisibleDesktopsGet

// _NET_VISIBLE_DESKTOPS get
// This is not part of the EWMH spec, but is a property of my own creation.
// It allows the window manager to report that it has multiple desktops
// viewable at the same time. (This conflicts with other EWMH properties,
// so I don't think this will ever be added to the official spec.)
func VisibleDesktopsGet(xu *xgbutil.XUtil) ([]uint, error) {
	return xprop.PropValNums(xprop.GetProperty(xu, xu.RootWin(),
		"_NET_VISIBLE_DESKTOPS"))
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:9,代码来源:ewmh.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang xprop.PropValStr函数代码示例发布时间:2022-05-24
下一篇:
Golang xprop.GetProperty函数代码示例发布时间: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