tabbox: Port away from legacy desktop ids
This commit is contained in:
parent
222b23eaa3
commit
e306e1b287
5 changed files with 17 additions and 40 deletions
|
@ -144,12 +144,7 @@ QModelIndex ClientModel::index(Window *client) const
|
|||
return createIndex(row, column);
|
||||
}
|
||||
|
||||
void ClientModel::createClientList(bool partialReset)
|
||||
{
|
||||
createClientList(tabBox->currentDesktop(), partialReset);
|
||||
}
|
||||
|
||||
void ClientModel::createFocusChainClientList(int desktop, Window *start)
|
||||
void ClientModel::createFocusChainClientList(Window *start)
|
||||
{
|
||||
auto c = start;
|
||||
if (!tabBox->isInFocusChain(c)) {
|
||||
|
@ -160,7 +155,7 @@ void ClientModel::createFocusChainClientList(int desktop, Window *start)
|
|||
}
|
||||
auto stop = c;
|
||||
do {
|
||||
Window *add = tabBox->clientToAddToList(c, desktop);
|
||||
Window *add = tabBox->clientToAddToList(c);
|
||||
if (add) {
|
||||
m_mutableClientList += add;
|
||||
}
|
||||
|
@ -168,7 +163,7 @@ void ClientModel::createFocusChainClientList(int desktop, Window *start)
|
|||
} while (c && c != stop);
|
||||
}
|
||||
|
||||
void ClientModel::createStackingOrderClientList(int desktop, Window *start)
|
||||
void ClientModel::createStackingOrderClientList(Window *start)
|
||||
{
|
||||
// TODO: needs improvement
|
||||
const QList<Window *> stacking = tabBox->stackingOrder();
|
||||
|
@ -176,7 +171,7 @@ void ClientModel::createStackingOrderClientList(int desktop, Window *start)
|
|||
auto stop = c;
|
||||
int index = 0;
|
||||
while (c) {
|
||||
Window *add = tabBox->clientToAddToList(c, desktop);
|
||||
Window *add = tabBox->clientToAddToList(c);
|
||||
if (add) {
|
||||
if (start == add) {
|
||||
m_mutableClientList.removeAll(add);
|
||||
|
@ -197,7 +192,7 @@ void ClientModel::createStackingOrderClientList(int desktop, Window *start)
|
|||
}
|
||||
}
|
||||
|
||||
void ClientModel::createClientList(int desktop, bool partialReset)
|
||||
void ClientModel::createClientList(bool partialReset)
|
||||
{
|
||||
auto start = tabBox->activeClient();
|
||||
// TODO: new clients are not added at correct position
|
||||
|
@ -212,11 +207,11 @@ void ClientModel::createClientList(int desktop, bool partialReset)
|
|||
|
||||
switch (tabBox->config().clientSwitchingMode()) {
|
||||
case TabBoxConfig::FocusChainSwitching: {
|
||||
createFocusChainClientList(desktop, start);
|
||||
createFocusChainClientList(start);
|
||||
break;
|
||||
}
|
||||
case TabBoxConfig::StackingOrderSwitching: {
|
||||
createStackingOrderClientList(desktop, start);
|
||||
createStackingOrderClientList(start);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,14 +67,8 @@ public:
|
|||
* the top of the list is kept as a starting point. If not the
|
||||
* current active client is used as the starting point to generate the
|
||||
* list.
|
||||
* @param desktop The desktop for which the list should be created
|
||||
* @param partialReset Keep the currently selected client or regenerate everything
|
||||
*/
|
||||
void createClientList(int desktop, bool partialReset = false);
|
||||
/**
|
||||
* This method is provided as a overload for current desktop
|
||||
* @see createClientList
|
||||
*/
|
||||
void createClientList(bool partialReset = false);
|
||||
/**
|
||||
* @return Returns the current list of Windows.
|
||||
|
@ -93,8 +87,8 @@ public Q_SLOTS:
|
|||
void activate(int index);
|
||||
|
||||
private:
|
||||
void createFocusChainClientList(int desktop, Window *start);
|
||||
void createStackingOrderClientList(int desktop, Window *start);
|
||||
void createFocusChainClientList(Window *start);
|
||||
void createStackingOrderClientList(Window *start);
|
||||
|
||||
QList<Window *> m_clientList;
|
||||
QList<Window *> m_mutableClientList;
|
||||
|
|
|
@ -71,11 +71,6 @@ int TabBoxHandlerImpl::activeScreen() const
|
|||
return workspace()->outputs().indexOf(workspace()->activeOutput());
|
||||
}
|
||||
|
||||
int TabBoxHandlerImpl::currentDesktop() const
|
||||
{
|
||||
return VirtualDesktopManager::self()->current();
|
||||
}
|
||||
|
||||
QString TabBoxHandlerImpl::desktopName(Window *client) const
|
||||
{
|
||||
if (!client->isOnAllDesktops()) {
|
||||
|
@ -104,15 +99,15 @@ Window *TabBoxHandlerImpl::activeClient() const
|
|||
return Workspace::self()->activeWindow();
|
||||
}
|
||||
|
||||
bool TabBoxHandlerImpl::checkDesktop(Window *client, int desktop) const
|
||||
bool TabBoxHandlerImpl::checkDesktop(Window *client) const
|
||||
{
|
||||
switch (config().clientDesktopMode()) {
|
||||
case TabBoxConfig::AllDesktopsClients:
|
||||
return true;
|
||||
case TabBoxConfig::ExcludeCurrentDesktopClients:
|
||||
return !client->isOnDesktop(desktop);
|
||||
return !client->isOnCurrentDesktop();
|
||||
default: // TabBoxConfig::OnlyCurrentDesktopClients
|
||||
return client->isOnDesktop(desktop);
|
||||
return client->isOnCurrentDesktop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,14 +169,14 @@ bool TabBoxHandlerImpl::checkMultiScreen(Window *client) const
|
|||
}
|
||||
}
|
||||
|
||||
Window *TabBoxHandlerImpl::clientToAddToList(Window *client, int desktop) const
|
||||
Window *TabBoxHandlerImpl::clientToAddToList(Window *client) const
|
||||
{
|
||||
if (!client) {
|
||||
return nullptr;
|
||||
}
|
||||
Window *ret = nullptr;
|
||||
|
||||
bool addClient = checkDesktop(client, desktop)
|
||||
bool addClient = checkDesktop(client)
|
||||
&& checkActivity(client)
|
||||
&& checkApplications(client)
|
||||
&& checkMinimized(client)
|
||||
|
|
|
@ -42,7 +42,6 @@ public:
|
|||
|
||||
int activeScreen() const override;
|
||||
Window *activeClient() const override;
|
||||
int currentDesktop() const override;
|
||||
QString desktopName(Window *client) const override;
|
||||
bool isKWinCompositing() const override;
|
||||
Window *nextClientFocusChain(Window *client) const override;
|
||||
|
@ -53,14 +52,14 @@ public:
|
|||
void raiseClient(Window *client) const override;
|
||||
void restack(Window *c, Window *under) override;
|
||||
void shadeClient(Window *c, bool b) const override;
|
||||
Window *clientToAddToList(Window *client, int desktop) const override;
|
||||
Window *clientToAddToList(Window *client) const override;
|
||||
Window *desktopClient() const override;
|
||||
void activateAndClose() override;
|
||||
void highlightWindows(Window *window = nullptr, QWindow *controller = nullptr) override;
|
||||
bool noModifierGrab() const override;
|
||||
|
||||
private:
|
||||
bool checkDesktop(Window *client, int desktop) const;
|
||||
bool checkDesktop(Window *client) const;
|
||||
bool checkActivity(Window *client) const;
|
||||
bool checkApplications(Window *client) const;
|
||||
bool checkMinimized(Window *client) const;
|
||||
|
|
|
@ -120,10 +120,6 @@ public:
|
|||
* on all desktops the name of current desktop will be returned.
|
||||
*/
|
||||
virtual QString desktopName(Window *client) const = 0;
|
||||
/**
|
||||
* @return The number of current desktop
|
||||
*/
|
||||
virtual int currentDesktop() const = 0;
|
||||
|
||||
/**
|
||||
* whether KWin is currently compositing and it's related features (elevating) can be used
|
||||
|
@ -162,7 +158,6 @@ public:
|
|||
/**
|
||||
* Determines if given client will be added to the list:
|
||||
* <UL>
|
||||
* <LI>Depends on desktop</LI>
|
||||
* <LI>if the client wants to have tab focus.</LI>
|
||||
* <LI>The client won't be added if it has modal dialogs</LI>
|
||||
* <LI>In that case the modal dialog will be returned if it isn't already
|
||||
|
@ -171,11 +166,10 @@ public:
|
|||
* screen focus</LI>
|
||||
* </UL>
|
||||
* @param client The client to be checked for inclusion
|
||||
* @param desktop The desktop the client should be on. This is irrelevant if allDesktops is set
|
||||
* @param allDesktops Add clients from all desktops or only from current
|
||||
* @return The client to be included in the list or NULL if it isn't to be included
|
||||
*/
|
||||
virtual Window *clientToAddToList(Window *client, int desktop) const = 0;
|
||||
virtual Window *clientToAddToList(Window *client) const = 0;
|
||||
/**
|
||||
* @return The first desktop window in the stacking order.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue