コード例 #1
0
ファイル: commandtray.go プロジェクト: AmandaCameron/gobar
func (ct *CommandTray) Focus() {
	ct.is_focused = true

	ct.selected = 0

	ct.initPopup()

	for _, src := range sources {
		if src.Open(ct) {
			ct.active = append(ct.active, src)
		}
	}

	xevent.MapNotifyFun(func(X *xgbutil.XUtil, e xevent.MapNotifyEvent) {
		ct.popup.Focus()
	}).Connect(ct.X, ct.popup.Id)

	ct.popup.Stack(xproto.StackModeAbove)
	ct.popup.Map()

	ct.keyPress().Connect(ct.X, ct.popup.Id)

	ct.Draw()

	ct.getCommands()

	ct.Draw()
}
コード例 #2
0
ファイル: event.go プロジェクト: pascience/foci
func (c *Client) cbMapNotify() xevent.MapNotifyFun {
	f := func(X *xgbutil.XUtil, ev xevent.MapNotifyEvent) {
		if c.IsMapped() {
			return
		}

		// I don't know what to do here if the client wasn't iconified.
		// It *should* have been unmanaged if the client issues an Unmap
		// on its own...
		if !c.iconified {
			logger.Warning.Printf("POSSIBLE BUG: Client '%s' is trying to map "+
				"itself, but Wingo doesn't think it was iconified.", c)
			return
		}

		c.IconifyToggle()
	}
	return xevent.MapNotifyFun(f)
}