multiple:do not update borderless when no needed

--when activating activities under multiple layouts
the currentActivityChanged() signal is sent from
KActivities before the runningActivitiesChanged() and
as such we can end in considering borderless maximized
window flag before all appropriate layouts have been enabled.
The patch adds a timer and delays borderlessMaximized consideration
when currentActivityChanged signal is received.
work/m_layershell
Michail Vourlakos 3 years ago
parent 544b83ebeb
commit 6ba99f2724

@ -45,16 +45,19 @@ Synchronizer::Synchronizer(QObject *parent)
connect(this, &Synchronizer::layoutsChanged, this, &Synchronizer::reloadAssignedLayouts);
//! KWin update Disabled Borders
connect(this, &Synchronizer::centralLayoutsChanged, this, &Synchronizer::updateKWinDisabledBorders);
connect(this, &Synchronizer::centralLayoutsChanged, this, &Synchronizer::updateBorderlessMaximizedAfterTimer);
connect(m_manager->corona()->universalSettings(), &UniversalSettings::canDisableBordersChanged, this, &Synchronizer::updateKWinDisabledBorders);
m_updateBorderlessMaximized.setInterval(500);
m_updateBorderlessMaximized.setSingleShot(true);
connect(&m_updateBorderlessMaximized, &QTimer::timeout, this, &Synchronizer::updateKWinDisabledBorders);
//! KActivities tracking
connect(m_manager->corona()->activitiesConsumer(), &KActivities::Consumer::activityRemoved,
this, &Synchronizer::onActivityRemoved);
connect(m_manager->corona()->activitiesConsumer(), &KActivities::Consumer::currentActivityChanged,
this, &Synchronizer::onCurrentActivityChanged);
this, &Synchronizer::updateBorderlessMaximizedAfterTimer);
connect(m_manager->corona()->activitiesConsumer(), &KActivities::Consumer::runningActivitiesChanged,
this, [&]() {
@ -465,10 +468,13 @@ void Synchronizer::onActivityRemoved(const QString &activityid)
}
}
void Synchronizer::onCurrentActivityChanged(const QString &activityid)
void Synchronizer::updateBorderlessMaximizedAfterTimer()
{
if (m_manager->memoryUsage() == MemoryUsage::MultipleLayouts) {
updateKWinDisabledBorders();
//! this signal is also triggered when runningactivities are changed and actually is received first
//! this is why we need a timer here in order to delay that execution and not activate/deactivate
//! maximizedborders faulty because syncMultipleLayoutsToActivities(); has not been executed yet
m_updateBorderlessMaximized.start();
}
}

@ -128,10 +128,10 @@ signals:
private slots:
void onActivityRemoved(const QString &activityid);
void onCurrentActivityChanged(const QString &activityid);
void onLayoutAdded(const QString &layoutpath);
void reloadAssignedLayouts();
void updateBorderlessMaximizedAfterTimer();
private:
void addLayout(CentralLayout *layout);
@ -155,6 +155,8 @@ private:
bool m_isLoaded{false};
bool m_isSingleLayoutInDeprecatedRenaming{false};
QTimer m_updateBorderlessMaximized;
Data::LayoutsTable m_layouts;
QList<CentralLayout *> m_centralLayouts;
AssignedLayoutsHash m_assignedLayouts;

Loading…
Cancel
Save