1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-19 06:03:42 +03:00

more improvements for MultipleLayouts case

--fix the strut setting between multiple running
layouts. When the activity is changing then each dock/panel
removes or adds its struts accordingly
This commit is contained in:
Michail Vourlakos 2018-01-13 20:00:03 +02:00
parent 4280c14acd
commit 19cd67627d
4 changed files with 27 additions and 23 deletions

View File

@ -1193,7 +1193,7 @@ void DockView::setMaskArea(QRect area)
setMask(fixedMask); setMask(fixedMask);
} }
qDebug() << "dock mask set:" << m_maskArea; // qDebug() << "dock mask set:" << m_maskArea;
emit maskAreaChanged(); emit maskAreaChanged();
} }

View File

@ -444,15 +444,16 @@ void LayoutManager::loadLayouts()
void LayoutManager::loadLatteLayout(QString layoutPath) void LayoutManager::loadLatteLayout(QString layoutPath)
{ {
qDebug() << " -------------------------------------------------------------------- ";
qDebug() << " -------------------------------------------------------------------- ";
if (m_corona->containments().size() > 0) { if (m_corona->containments().size() > 0) {
qDebug() << "There are still containments present :::: " << m_corona->containments().size(); qDebug() << "LOAD LATTE LAYOUT ::: There are still containments present !!!! :: " << m_corona->containments().size();
} }
if (!layoutPath.isEmpty() && m_corona->containments().size() == 0) { if (!layoutPath.isEmpty() && m_corona->containments().size() == 0) {
if (!layoutPath.isEmpty()) { qDebug() << "LOADING CORONA LAYOUT:" << layoutPath;
qDebug() << "loading layout:" << layoutPath;
m_corona->loadLayout(layoutPath); m_corona->loadLayout(layoutPath);
}
//! ~~~ ADDING DOCKVIEWS AND ENFORCE LOADING IF TASKS ARENT PRESENT BASED ON SCREENS ~~~ !// //! ~~~ ADDING DOCKVIEWS AND ENFORCE LOADING IF TASKS ARENT PRESENT BASED ON SCREENS ~~~ !//
@ -523,7 +524,7 @@ bool LayoutManager::switchToLayout(QString layoutName)
m_activeLayouts.removeFirst(); m_activeLayouts.removeFirst();
layout->unloadContainments(); layout->unloadContainments();
layout->unloadDockViews(); layout->unloadDockViews();
layout->deleteLater(); delete layout;
} }
if (initializingMultipleLayouts) { if (initializingMultipleLayouts) {
@ -598,7 +599,7 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
layoutsToUnload.removeFirst(); layoutsToUnload.removeFirst();
tempLayout->unloadContainments(); tempLayout->unloadContainments();
tempLayout->unloadDockViews(); tempLayout->unloadDockViews();
tempLayout->deleteLater(); delete tempLayout;
} }
} }

View File

@ -113,7 +113,7 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
switch (this->mode) { switch (this->mode) {
case Dock::AlwaysVisible: { case Dock::AlwaysVisible: {
if (view->containment() && !view->containment()->isUserConfiguring() && view->screen()) { if (view->containment() && !view->containment()->isUserConfiguring() && view->screen()) {
wm->setDockStruts(*view, dockGeometry, view->location()); updateStrutsBasedOnLayoutsAndActivities();
} }
connections[0] = connect(view->containment(), &Plasma::Containment::locationChanged connections[0] = connect(view->containment(), &Plasma::Containment::locationChanged
@ -129,20 +129,8 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
if (dockCorona && dockCorona->layoutManager()->memoryUsage() == Dock::MultipleLayouts) { if (dockCorona && dockCorona->layoutManager()->memoryUsage() == Dock::MultipleLayouts) {
if (dockView->managedLayout() && (dockView->managedLayout()->name() == dockCorona->layoutManager()->currentLayoutName())) {
wm->setDockStruts(*view, dockGeometry, view->location());
} else {
wm->removeDockStruts(*view);
}
connections[2] = connect(dockCorona->activitiesConsumer(), &KActivities::Consumer::currentActivityChanged, this, [&]() { connections[2] = connect(dockCorona->activitiesConsumer(), &KActivities::Consumer::currentActivityChanged, this, [&]() {
Layout *mLayout = dockView->managedLayout(); updateStrutsBasedOnLayoutsAndActivities();
if (mLayout && (mLayout->name() == dockCorona->layoutManager()->currentLayoutName())) {
wm->setDockStruts(*view, dockGeometry, view->location());
} else {
wm->removeDockStruts(*view);
}
}); });
} }
@ -208,6 +196,19 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
emit q->modeChanged(); emit q->modeChanged();
} }
void VisibilityManagerPrivate::updateStrutsBasedOnLayoutsAndActivities()
{
bool multipleLayoutsAndCurrent = (dockCorona->layoutManager()->memoryUsage() == Dock::MultipleLayouts
&& dockView->managedLayout()
&& dockCorona->layoutManager()->currentLayoutName() == dockView->managedLayout()->name());
if (dockCorona->layoutManager()->memoryUsage() == Dock::SingleLayout || multipleLayoutsAndCurrent) {
wm->setDockStruts(*view, dockGeometry, view->location());
} else {
wm->removeDockStruts(*view);
}
}
void VisibilityManagerPrivate::setRaiseOnDesktop(bool enable) void VisibilityManagerPrivate::setRaiseOnDesktop(bool enable)
{ {
if (enable == raiseOnDesktopChange) if (enable == raiseOnDesktopChange)
@ -349,7 +350,7 @@ inline void VisibilityManagerPrivate::setDockGeometry(const QRect &geometry)
this->dockGeometry = geometry; this->dockGeometry = geometry;
if (mode == Dock::AlwaysVisible && !view->containment()->isUserConfiguring() && view->screen()) { if (mode == Dock::AlwaysVisible && !view->containment()->isUserConfiguring() && view->screen()) {
wm->setDockStruts(*view, this->dockGeometry, view->containment()->location()); updateStrutsBasedOnLayoutsAndActivities();
} }
} }

View File

@ -67,6 +67,8 @@ public:
bool intersects(const WindowInfoWrap &winfo); bool intersects(const WindowInfoWrap &winfo);
void updateStrutsBasedOnLayoutsAndActivities();
void saveConfig(); void saveConfig();
void restoreConfig(); void restoreConfig();