1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-08 13:18:09 +03:00

fix screenForContainment in MulitpleShared mode

This commit is contained in:
Michail Vourlakos 2019-06-15 21:38:07 +03:00
parent 1b0de4f312
commit b71baccc14
5 changed files with 36 additions and 7 deletions

View File

@ -789,8 +789,8 @@ int Corona::screenForContainment(const Plasma::Containment *containment) const
}
}
Latte::CentralLayout *currentLayout = m_layoutsManager->currentLayout();
Latte::View *view = currentLayout->viewForContainment(containment);
Plasma::Containment *c = const_cast<Plasma::Containment *>(containment);
Latte::View *view = m_layoutsManager->synchronizer()->viewForContainment(c);
if (view && view->screen()) {
return m_screenPool->id(view->screen()->name());
@ -823,8 +823,7 @@ void Corona::showAlternativesForApplet(Plasma::Applet *applet)
return;
}
Latte::CentralLayout *currentLayout = m_layoutsManager->currentLayout();
Latte::View *latteView = currentLayout->viewForContainment(applet->containment());
Latte::View *latteView = m_layoutsManager->synchronizer()->viewForContainment(applet->containment());
KDeclarative::QmlObjectSharedEngine *qmlObj{nullptr};

View File

@ -338,9 +338,9 @@ void GenericLayout::setLastConfigViewFor(Latte::View *view)
emit lastConfigViewForChanged(view);
}
Latte::View *GenericLayout::viewForContainment(const Plasma::Containment *containment)
Latte::View *GenericLayout::viewForContainment(Plasma::Containment *containment)
{
if (m_latteViews.contains(containment)) {
if (m_containments.contains(containment) && m_latteViews.contains(containment)) {
return m_latteViews[containment];
}

View File

@ -90,7 +90,7 @@ public:
const QList<Plasma::Containment *> *containments();
Latte::View *highestPriorityView();
Latte::View *viewForContainment(const Plasma::Containment *containment);
Latte::View *viewForContainment(Plasma::Containment *containment);
virtual QList<Latte::View *> sortedLatteViews(QList<Latte::View *> views = QList<Latte::View *>());
virtual QList<Latte::View *> viewsWithPlasmaShortcuts();
virtual QList<Latte::View *> latteViews();

View File

@ -33,6 +33,9 @@
#include <QDir>
#include <QFile>
// Plasma
#include <Plasma/Containment>
// KDE
#include <KActivities/Consumer>
#include <KActivities/Controller>
@ -356,6 +359,27 @@ SharedLayout *Synchronizer::sharedLayout(QString id) const
return nullptr;
}
Latte::View *Synchronizer::viewForContainment(Plasma::Containment *containment)
{
for (auto layout : m_centralLayouts) {
Latte::View *view = layout->viewForContainment(containment);
if (view) {
return view;
}
}
for (auto layout : m_sharedLayouts) {
Latte::View *view = layout->viewForContainment(containment);
if (view) {
return view;
}
}
return nullptr;
}
void Synchronizer::addLayout(CentralLayout *layout)
{
if (!m_centralLayouts.contains(layout)) {

View File

@ -38,6 +38,10 @@ class Manager;
}
}
namespace Plasma {
class Containment;
}
namespace KActivities {
class Controller;
}
@ -100,6 +104,8 @@ public:
QStringList runningActivities();
QStringList orphanedActivities(); //! These are activities that haven't been assigned to specific layout
Latte::View *viewForContainment(Plasma::Containment *containment);
CentralLayout *currentLayout() const;
CentralLayout *centralLayout(QString id) const;
SharedLayout *sharedLayout(QString id) const;