"New Desktop" in to Desktop menu

Adding a new desktop entry to create a new desktop and move the
selected window there.

REVIEW: 104781
This commit is contained in:
makis marimpis 2012-04-29 18:32:34 +03:00 committed by Martin Gräßlin
parent 8ebba542b0
commit a9e66dc7f3
3 changed files with 18 additions and 0 deletions

View file

@ -497,6 +497,13 @@ void Workspace::desktopPopupAboutToShow()
!active_popup_client->isOnAllDesktops() && active_popup_client->desktop() == i)
action->setChecked(true);
}
desk_popup->addSeparator();
action = desk_popup->addAction(i18nc("Create a new desktop and move there the window", "&New Desktop"));
action->setData(numberOfDesktops() + 1);
if (numberOfDesktops() >= Workspace::self()->maxNumberOfDesktops())
action->setEnabled(false);
}
/*!
@ -1435,6 +1442,8 @@ void Workspace::slotSendToDesktop(QAction *action)
// the 'on_all_desktops' menu entry
active_popup_client->setOnAllDesktops(!active_popup_client->isOnAllDesktops());
return;
} else if (desk > numberOfDesktops()) {
setNumberOfDesktops(desk);
}
sendClientToDesktop(active_popup_client, desk, false);

View file

@ -1422,6 +1422,11 @@ bool Workspace::setCurrentDesktop(int new_desktop)
return true;
}
int Workspace::maxNumberOfDesktops() const
{
return KWIN_MAX_NUMBER_DESKTOPS;
}
#ifdef KWIN_BUILD_ACTIVITIES
//BEGIN threaded activity list fetching

View file

@ -214,6 +214,10 @@ public:
* @returns Total number of desktops currently in existence.
*/
int numberOfDesktops() const;
/**
* @returns The maximum number of desktops that KWin supports.
*/
int maxNumberOfDesktops() const;
/**
* Set the number of available desktops to @a count. This function overrides any previous
* grid layout.