本文整理汇总了Golang中github.com/BurntSushi/xgbutil/xprop.PropValNums函数的典型用法代码示例。如果您正苦于以下问题:Golang PropValNums函数的具体用法?Golang PropValNums怎么用?Golang PropValNums使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PropValNums函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例2: updateCurrentViewport
func updateCurrentViewport() {
currentViewport, _ = xprop.PropValNums(
xprop.GetProperty(
XU,
XU.RootWin(),
"DEEPIN_SCREEN_VIEWPORT",
))
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}