當前位置: 首頁>>代碼示例>>Golang>>正文


Golang xevent.ReplayPointer函數代碼示例

本文整理匯總了Golang中github.com/BurntSushi/xgbutil/xevent.ReplayPointer函數的典型用法代碼示例。如果您正苦於以下問題:Golang ReplayPointer函數的具體用法?Golang ReplayPointer怎麽用?Golang ReplayPointer使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ReplayPointer函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Run

func (cmd Focus) Run() gribble.Value {
	return syncRun(func() gribble.Value {
		return withClient(cmd.Client, func(c *xclient.Client) {
			if c == nil {
				focus.Root()

				// Use the mouse coordinates to find which workspace it was
				// clicked in. If a workspace can be found (i.e., no clicks in
				// dead areas), then activate it.
				xc, rw := wm.X.Conn(), wm.X.RootWin()
				qp, err := xproto.QueryPointer(xc, rw).Reply()
				if err != nil {
					logger.Warning.Printf("Could not query pointer: %s", err)
					return
				}

				geom := xrect.New(int(qp.RootX), int(qp.RootY), 1, 1)
				if wrk := wm.Heads.FindMostOverlap(geom); wrk != nil {
					wm.SetWorkspace(wrk, false)
				}
			} else {
				c.Focus()
				xevent.ReplayPointer(wm.X)
			}
		})
	})
}
開發者ID:BurntSushi,項目名稱:wingo,代碼行數:27,代碼來源:commands.go

示例2: commandFun

func (mcmd mouseCommand) commandFun() func(c *client) {
	tryShellFun := commandShellFun(mcmd.cmd)
	if tryShellFun != nil {
		return func(c *client) {
			tryShellFun()
			xevent.ReplayPointer(X)
		}
	}

	switch mcmd.cmd {
	case "FocusRaise":
		return func(c *client) {
			focus.Focus(c)
			stack.Raise(c)
			xevent.ReplayPointer(X)
		}
	case "Focus":
		return func(c *client) {
			focus.Focus(c)
			xevent.ReplayPointer(X)
		}
	case "Raise":
		return func(c *client) {
			stack.Raise(c)
			xevent.ReplayPointer(X)
		}
	case "Close":
		return func(c *client) {
			c.Close()
		}
	case "MaximizeToggle":
		return func(c *client) {
			// c.MaximizeToggle()
		}
	case "Minimize":
		return func(c *client) {
			c.workspace.IconifyToggle(c)
		}
	}

	logger.Warning.Printf("Undefined mouse command: '%s'", mcmd.cmd)

	return nil
}
開發者ID:dlintw,項目名稱:wingo,代碼行數:44,代碼來源:command_mouse.go

示例3: setup

func (mcmd mouseCommand) setup(c Client, wid xproto.Window) {
	// Check if this command is a drag... If it is, it needs special attention.
	if mcmd.cmdName == "MouseMove" {
		setupMoveDrag(c, wid, mcmd.buttonStr, true)
		return
	}
	if mcmd.cmdName == "MouseResize" {
		direction, err := cmdHacks.MouseResizeDirection(mcmd.cmdStr)
		if err != nil {
			logger.Warning.Println("Could not setup MouseResize: %s", err)
			return
		}
		setupResizeDrag(c, wid, mcmd.buttonStr, true, strToDirection(direction))
		return
	}

	// If we're putting this on the client or frame window, we need to propagate
	// the events (i.e., grab synchronously).
	// Otherwise, we don't need to grab at all!
	run := func() {
		go func() {
			mouseClientLock.Lock()
			defer mouseClientLock.Unlock()

			MouseClientClicked = c.Id()
			_, err := gribbleEnv.Run(mcmd.cmdStr)
			if err != nil {
				logger.Warning.Println(err)
			}
			MouseClientClicked = 0
		}()
	}
	if wid == c.Id() || (c.Frame() != nil && wid == c.Frame().Parent().Id) {
		if mcmd.down {
			f := func() {
				run()
				xevent.ReplayPointer(X)
			}
			mcmd.attach(wid, f, true, true)
		} else { // we have to handle release grabs specially!
			mcmd.attachGrabRelease(wid, run)
		}
	} else {
		mcmd.attach(wid, run, false, false)
	}
}
開發者ID:pascience,項目名稱:foci,代碼行數:46,代碼來源:bindings_mouse.go


注:本文中的github.com/BurntSushi/xgbutil/xevent.ReplayPointer函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。