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


Golang Workspace.IsVisible方法代碼示例

本文整理匯總了Golang中github.com/BurntSushi/wingo/workspace.Workspace.IsVisible方法的典型用法代碼示例。如果您正苦於以下問題:Golang Workspace.IsVisible方法的具體用法?Golang Workspace.IsVisible怎麽用?Golang Workspace.IsVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/BurntSushi/wingo/workspace.Workspace的用法示例。


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

示例1: RemoveWorkspace

func (hds *Heads) RemoveWorkspace(wk *workspace.Workspace) {
	// Don't allow it if this would result in fewer workspaces than there
	// are active physical heads.
	if len(hds.geom) == len(hds.workspaces.Wrks) {
		return
	}

	// There's a bit of complexity in choosing where to move the clients to.
	// Namely, if we're removing a hidden workspace, it's a simple matter of
	// moving the clients. However, if we're removing a visible workspace,
	// we have to make sure to make another workspace that is hidden take
	// its place. (Such a workspace is guaranteed to exist because we have at
	// least one more workspace than there are active physical heads.)
	if !wk.IsVisible() {
		moveClientsTo := hds.workspaces.Wrks[len(hds.workspaces.Wrks)-1]
		if moveClientsTo == wk {
			moveClientsTo = hds.workspaces.Wrks[len(hds.workspaces.Wrks)-2]
		}
		wk.RemoveAllAndAdd(moveClientsTo)
	} else {
		// Find the last-most hidden workspace that is not itself.
		for i := len(hds.workspaces.Wrks) - 1; i >= 0; i-- {
			work := hds.workspaces.Wrks[i]
			if work != wk && !work.IsVisible() {
				hds.SwitchWorkspaces(wk, work)
				wk.RemoveAllAndAdd(work)
				break
			}
		}
	}
	hds.workspaces.Remove(wk)
}
開發者ID:dlintw,項目名稱:wingo,代碼行數:32,代碼來源:workspace.go

示例2: RemoveWorkspace

func (hds *Heads) RemoveWorkspace(wk *workspace.Workspace) {
	// Don't allow it if this would result in fewer workspaces than there
	// are active physical heads.
	if len(hds.geom) == len(hds.Workspaces.Wrks) {
		panic("Cannot have fewer workspaces than active monitors.")
	}

	// A non-empty workspace cannot be removed.
	if len(wk.Clients) > 0 {
		panic(fmt.Sprintf("Non-empty workspace '%s' cannot be removed.", wk))
	}

	if wk.IsVisible() {
		// Find the last-most hidden workspace that is not itself and switch.
		for i := len(hds.Workspaces.Wrks) - 1; i >= 0; i-- {
			work := hds.Workspaces.Wrks[i]
			if work != wk && !work.IsVisible() {
				hds.SwitchWorkspaces(wk, work)
				break
			}
		}
	}
	hds.Workspaces.Remove(wk)
}
開發者ID:Pursuit92,項目名稱:wingo,代碼行數:24,代碼來源:workspace.go


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