Port Workspace::findDesktop() to VirtualDesktop

This commit is contained in:
Vlad Zahorodnii 2021-08-13 11:49:11 +03:00
parent b75f089981
commit 42f2afd80d
4 changed files with 10 additions and 10 deletions

View file

@ -458,7 +458,7 @@ bool Workspace::activateNextClient(AbstractClient* c)
AbstractClient* get_focus = nullptr;
const int desktop = VirtualDesktopManager::self()->current();
VirtualDesktop *desktop = VirtualDesktopManager::self()->currentDesktop();
if (!get_focus && showingDesktop())
get_focus = findDesktop(true, desktop); // to not break the state
@ -482,7 +482,7 @@ bool Workspace::activateNextClient(AbstractClient* c)
}
if (!get_focus) {
// nope, ask the focus chain for the next candidate
get_focus = FocusChain::self()->nextForDesktop(c, desktop);
get_focus = FocusChain::self()->nextForDesktop(c, desktop->x11DesktopNumber());
}
}
@ -505,8 +505,8 @@ void Workspace::setCurrentScreen(int new_screen)
if (!options->focusPolicyIsReasonable())
return;
closeActivePopup();
const int desktop = VirtualDesktopManager::self()->current();
AbstractClient *get_focus = FocusChain::self()->getForActivation(desktop, new_screen);
VirtualDesktop *desktop = VirtualDesktopManager::self()->currentDesktop();
AbstractClient *get_focus = FocusChain::self()->getForActivation(desktop->x11DesktopNumber(), new_screen);
if (get_focus == nullptr)
get_focus = findDesktop(true, desktop);
if (get_focus != nullptr && get_focus != mostRecentlyActivatedClient())

View file

@ -245,7 +245,7 @@ AbstractClient *Workspace::topClientOnDesktop(VirtualDesktop *desktop, int scree
return nullptr;
}
AbstractClient* Workspace::findDesktop(bool topmost, int desktop) const
AbstractClient *Workspace::findDesktop(bool topmost, VirtualDesktop *desktop) const
{
// TODO Q_ASSERT( block_stacking_updates == 0 );
if (topmost) {

View file

@ -434,7 +434,7 @@ void Workspace::initializeX11()
if (new_active_client == nullptr)
new_active_client = topClientOnDesktop(VirtualDesktopManager::self()->currentDesktop(), -1);
if (new_active_client == nullptr)
new_active_client = findDesktop(true, VirtualDesktopManager::self()->current());
new_active_client = findDesktop(true, VirtualDesktopManager::self()->currentDesktop());
}
if (new_active_client != nullptr)
activateClient(new_active_client);
@ -716,7 +716,7 @@ void Workspace::addClient(X11Client *c)
raiseClient(c);
// If there's no active client, make this desktop the active one
if (activeClient() == nullptr && should_get_focus.count() == 0)
activateClient(findDesktop(true, VirtualDesktopManager::self()->current()));
activateClient(findDesktop(true, VirtualDesktopManager::self()->currentDesktop()));
}
c->checkActiveModal();
checkTransients(c->window()); // SELI TODO: Does this really belong here?
@ -1073,7 +1073,7 @@ void Workspace::activateClientOnNewDesktop(uint desktop)
c = active_client;
if (!c)
c = findDesktop(true, desktop);
c = findDesktop(true, VirtualDesktopManager::self()->desktopForX11Id(desktop));
if (c != active_client)
setActiveClient(nullptr);
@ -1187,7 +1187,7 @@ void Workspace::updateCurrentActivity(const QString &new_activity)
c = active_client;
if (!c)
c = findDesktop(true, VirtualDesktopManager::self()->current());
c = findDesktop(true, VirtualDesktopManager::self()->currentDesktop());
if (c != active_client)
setActiveClient(nullptr);

View file

@ -277,7 +277,7 @@ public:
AbstractClient *topClientOnDesktop(VirtualDesktop *desktop, int screen, bool unconstrained = false,
bool only_normal = true) const;
AbstractClient* findDesktop(bool topmost, int desktop) const;
AbstractClient *findDesktop(bool topmost, VirtualDesktop *desktop) const;
void sendClientToDesktop(AbstractClient* c, int desktop, bool dont_activate);
void windowToPreviousDesktop(AbstractClient* c);
void windowToNextDesktop(AbstractClient* c);