当前位置: 首页>>代码示例>>Golang>>正文


Golang xproto.Window函数代码示例

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


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

示例1: NotifyEventNew

// NotifyEventNew constructs a NotifyEvent value that implements xgb.Event from a byte slice.
func NotifyEventNew(buf []byte) xgb.Event {
	v := NotifyEvent{}
	b := 1 // don't read event number

	v.State = buf[b]
	b += 1

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Time = xproto.Timestamp(xgb.Get32(buf[b:]))
	b += 4

	v.Root = xproto.Window(xgb.Get32(buf[b:]))
	b += 4

	v.Window = xproto.Window(xgb.Get32(buf[b:]))
	b += 4

	v.Kind = buf[b]
	b += 1

	if buf[b] == 1 {
		v.Forced = true
	} else {
		v.Forced = false
	}
	b += 1

	b += 14 // padding

	return v
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:34,代码来源:screensaver.go

示例2: toX11WindowId

func (self *SessionModule) toX11WindowId(window_id string) (xproto.Window, error) {
	if id_number, err := strconv.Atoi(window_id); err == nil {
		return xproto.Window(uint32(id_number)), nil
	} else {
		return xproto.Window(0), err
	}
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:7,代码来源:window.go

示例3: 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

示例4: queryInfoReply

// queryInfoReply reads a byte slice into a QueryInfoReply value.
func queryInfoReply(buf []byte) *QueryInfoReply {
	v := new(QueryInfoReply)
	b := 1 // skip reply determinant

	v.State = buf[b]
	b += 1

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.SaverWindow = xproto.Window(xgb.Get32(buf[b:]))
	b += 4

	v.MsUntilServer = xgb.Get32(buf[b:])
	b += 4

	v.MsSinceUserInput = xgb.Get32(buf[b:])
	b += 4

	v.EventMask = xgb.Get32(buf[b:])
	b += 4

	v.Kind = buf[b]
	b += 1

	b += 7 // padding

	return v
}
开发者ID:auroralaboratories,项目名称:corona-api,代码行数:33,代码来源:screensaver.go

示例5: commandArgsClient

// commandArgsClient scans an argument list for a window id.
// A window id has the form 'win:WINDOW-ID_NUMBER'.
// Both 'win:0x0001' and 'win:1' are valid thanks to Go's ParseInt.
// Finally, if the window id corresponds to managed client, return that
// client. Otherwise, return nil and emit an error if we have an invalid ID.
// We also return a bool as a second argument which should be interpreted
// as whether or not to continue the current operation.
// i.e., not finding anything that looks like a window id is safe to ignore,
// but if we find something like an ID and error out, we should stop the
// command entirely.
func commandArgsClient(args []string) (*client, bool) {
	for _, arg := range args {
		if len(arg) < 5 || arg[0:4] != "win:" {
			continue
		}

		maybeId64, err := strconv.ParseInt(arg[4:], 0, 0)
		if err != nil {
			logger.Warning.Printf("'%s' is not a valid window id.", arg[4:])
			return nil, false
		}

		goodId := xproto.Window(maybeId64)
		for _, c := range wingo.clients {
			if c.Id() == goodId {
				return c, true
			}
		}

		logger.Warning.Printf(
			"'%s' is a valid window ID, but does not match any managed "+
				"window ID by Wingo.", arg[4:])
		return nil, false
	}
	return nil, true
}
开发者ID:dlintw,项目名称:wingo,代码行数:36,代码来源:command.go

示例6: addTrayIcon

func (m *TrayManager) addTrayIcon(xid xproto.Window) {
	m.checkValid()
	for _, id := range m.TrayIcons {
		if xproto.Window(id) == xid {
			return
		}
	}

	if d, err := damage.NewDamageId(TrayXU.Conn()); err != nil {
		return
	} else {
		m.dmageInfo[xid] = d
		if err := damage.CreateChecked(TrayXU.Conn(), d, xproto.Drawable(xid), damage.ReportLevelRawRectangles).Check(); err != nil {
			logger.Debug("DamageCreate Failed:", err)
			return
		}
	}
	composite.RedirectWindow(TrayXU.Conn(), xid, composite.RedirectAutomatic)

	m.TrayIcons = append(m.TrayIcons, uint32(xid))
	icon := xwindow.New(TrayXU, xid)
	icon.Listen(xproto.EventMaskVisibilityChange | damage.Notify | xproto.EventMaskStructureNotify)
	icon.Change(xproto.CwBackPixel, 0)

	name, err := ewmh.WmNameGet(TrayXU, xid)
	if err != nil {
		logger.Debug("WmNameGet failed:", err, xid)
	}
	m.nameInfo[xid] = name
	m.notifyInfo[xid] = true
	dbus.Emit(m, "Added", uint32(xid))
	logger.Infof("Added try icon: \"%s\"(%d)", name, uint32(xid))
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:33,代码来源:traymanager.go

示例7: event

func (tray *SystemTray) event(ev xevent.ClientMessageEvent) {
	if ev.Format != 32 {
		return
	}

	if ev.Type != sysTrayMsgAtom {
		return
	}

	opCode := ev.Data.Data32[1]

	if opCode == 0 {
		// SYSTEM_TRAY_REQUEST_DOCK

		icon := tray.newIcon(xproto.Window(ev.Data.Data32[2]))

		if icon != nil {
			tray.Handler.NewIcon(icon)
		}
	} else if opCode == 1 {
		// Not Implemented.

	} else if opCode == 2 {
		// Not Implemented.

	} else {
		// Do Nothing for now.
		fmt.Printf("[SystemTray] Got unknown opcode: %d", opCode)
	}
}
开发者ID:AmandaCameron,项目名称:gobar,代码行数:30,代码来源:listener.go

示例8: getScreenSizeReply

// getScreenSizeReply reads a byte slice into a GetScreenSizeReply value.
func getScreenSizeReply(buf []byte) *GetScreenSizeReply {
	v := new(GetScreenSizeReply)
	b := 1 // skip reply determinant

	b += 1 // padding

	v.Sequence = xgb.Get16(buf[b:])
	b += 2

	v.Length = xgb.Get32(buf[b:]) // 4-byte units
	b += 4

	v.Width = xgb.Get32(buf[b:])
	b += 4

	v.Height = xgb.Get32(buf[b:])
	b += 4

	v.Window = xproto.Window(xgb.Get32(buf[b:]))
	b += 4

	v.Screen = xgb.Get32(buf[b:])
	b += 4

	return v
}
开发者ID:tejohnso,项目名称:xgb,代码行数:27,代码来源:xinerama.go

示例9: CloseWindow

// maybe move to apps-builder
func (m *ClientManager) CloseWindow(xid uint32) bool {
	err := ewmh.CloseWindow(XU, xproto.Window(xid))
	if err != nil {
		logger.Warning("Close window failed:", err)
		return false
	}
	return true
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:9,代码来源:client_manager.go

示例10: main

func main() {
	// winw, winh := 128, 128
	time.Sleep(time.Nanosecond)

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

	libre := xproto.Window(0x4a0001d)
	xclock := xproto.Window(0x480000a)

	showIcon(X, libre, "libre")
	showIcon(X, xclock, "xclock")

	xevent.Main(X)
}
开发者ID:droundy,项目名称:xgbutil,代码行数:17,代码来源:tst_image.go

示例11: ActiveWindow

// maybe move to apps-builder
func (m *ClientManager) ActiveWindow(xid uint32) bool {
	err := activateWindow(xproto.Window(xid))
	if err != nil {
		logger.Warning("Actice window failed:", err)
		return false
	}
	return true
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:9,代码来源:client_manager.go

示例12: PropValWindow

func (a *atomic) PropValWindow(reply *xproto.GetPropertyReply, err error) (xproto.Window, error) {
	if err != nil {
		return 0, err
	}
	if reply.Format != 32 {
		return 0, fmt.Errorf("PropValId: Expected format 32 but got %d", reply.Format)
	}
	return xproto.Window(xgb.Get32(reply.Value)), nil
}
开发者ID:wSCP,项目名称:scpwm-old,代码行数:9,代码来源:atomic.go

示例13: getWindowPid

func getWindowPid(X *xgbutil.XUtil, xid uint32) (uint32, error) {
	pid, err := ewmh.WmPidGet(X, xproto.Window(xid))
	if err != nil {
		logger.Warning("Get window pid failed:", err)
		return 0, err
	}

	return uint32(pid), nil
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:9,代码来源:window_state.go

示例14: getWindowName

func getWindowName(X *xgbutil.XUtil, xid uint32) (string, error) {
	name, err := ewmh.WmNameGet(X, xproto.Window(xid))
	if err != nil {
		logger.Warning("Get window name failed:", err)
		return "", err
	}

	return name, nil
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:9,代码来源:window_state.go

示例15: getWindowState

func getWindowState(X *xgbutil.XUtil, xid uint32) ([]string, error) {
	list, err := ewmh.WmStateGet(X, xproto.Window(xid))
	if err != nil {
		logger.Warning("Get window state failed:", err)
		return []string{}, err
	}

	return list, nil
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:9,代码来源:window_state.go


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