1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-12 01:17:55 +03:00

improve responsiveness for DynamicStruts Scenario

--add a timer blocker in order to reduce struts calls
at window manager. This way the entire desktop experience
becomes more stable and fluent.
This commit is contained in:
Michail Vourlakos 2021-12-10 17:04:34 +02:00
parent 65d34ce53a
commit dd5e0778a7
2 changed files with 22 additions and 2 deletions

View File

@ -79,11 +79,15 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
connect(m_latteView, &Latte::View::inEditModeChanged, this, &VisibilityManager::initViewFlags);
// disabling this call because it was creating too many struts calls and
// could create reduced responsiveness for DynamicStruts Scenario(for example
// when dragging active window from a floating dock/panel)
/*
connect(m_latteView, &Latte::View::absoluteGeometryChanged, this, [&]() {
if (m_mode == Types::AlwaysVisible) {
updateStrutsBasedOnLayoutsAndActivities();
}
});
});*/
//! Frame Extents
connect(m_latteView, &Latte::View::headThicknessGapChanged, this, &VisibilityManager::onHeadThicknessChanged);
@ -147,6 +151,10 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
m_timerPublishFrameExtents.setSingleShot(true);
connect(&m_timerPublishFrameExtents, &QTimer::timeout, this, [&]() { publishFrameExtents(); });
m_timerBlockStrutsUpdate.setInterval(1000);
m_timerBlockStrutsUpdate.setSingleShot(true);
connect(&m_timerBlockStrutsUpdate, &QTimer::timeout, this, [&]() { updateStrutsBasedOnLayoutsAndActivities(); });
restoreConfig();
}
@ -260,7 +268,13 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
}
m_connections[base] = connect(this, &VisibilityManager::strutsThicknessChanged, this, [&]() {
updateStrutsBasedOnLayoutsAndActivities();
bool execute = !m_timerBlockStrutsUpdate.isActive();
m_timerBlockStrutsUpdate.start();
if (execute) {
updateStrutsBasedOnLayoutsAndActivities();
}
});
m_connections[base+1] = connect(m_corona->activitiesConsumer(), &KActivities::Consumer::currentActivityChanged, this, [&]() {

View File

@ -218,6 +218,12 @@ private:
QTimer m_timerHide;
QTimer m_timerStartUp;
QTimer m_timerPublishFrameExtents;
//! This timer is very important because it blocks how fast struts are updated.
//! By using this timer we help the window manager in order to correspond to new
//! struts (for example changing windows maximized state or geometry) without
//! createing binding loops between the app and the window manager.
//! That was reproducable in a floating panel when we were dragging the active window.
QTimer m_timerBlockStrutsUpdate;
bool m_isBelowLayer{false};
bool m_isHidden{false};