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

visibility:update hide timer interval handling

--hide timer now has a default/user set value but
it can also become with different intervals if
specific codepaths require it.
This commit is contained in:
Michail Vourlakos 2020-07-29 00:13:16 +03:00
parent 3b3388d673
commit 01a17ea9ba
2 changed files with 20 additions and 6 deletions

View File

@ -594,17 +594,18 @@ void VisibilityManager::setTimerShow(int msec)
int VisibilityManager::timerHide() const
{
return m_timerHide.interval();
return m_timerHideInterval;
}
void VisibilityManager::setTimerHide(int msec)
{
int interval = qMax(HIDEMINIMUMINTERVAL, msec);
if (m_timerHide.interval() == interval) {
if (m_timerHideInterval == interval) {
return;
}
m_timerHideInterval = interval;
m_timerHide.setInterval(interval);
emit timerHideChanged();
}
@ -683,7 +684,7 @@ void VisibilityManager::raiseView(bool raise)
m_hideNow = false;
emit mustBeHide();
} else if (!m_timerHide.isActive()) {
m_timerHide.start();
startTimerHide();
}
}
}
@ -724,7 +725,7 @@ void VisibilityManager::toggleHiddenState()
emit mustBeShown();
if(m_mode == Latte::Types::SidebarAutoHide) {
m_timerHide.start();
startTimerHide();
}
} else {
emit mustBeHide();
@ -778,6 +779,15 @@ void VisibilityManager::applyActivitiesToHiddenWindows(const QStringList &activi
}
}
void VisibilityManager::startTimerHide(const int &msec)
{
if (msec == 0) {
m_timerHide.start(m_timerHideInterval);
} else {
m_timerHide.start(msec);
}
}
void VisibilityManager::dodgeActive()
{
if (m_raiseTemporarily)
@ -830,7 +840,7 @@ void VisibilityManager::saveConfig()
config.writeEntry("enableKWinEdges", m_enableKWinEdgesFromUser);
config.writeEntry("timerShow", m_timerShow.interval());
config.writeEntry("timerHide", m_timerHide.interval());
config.writeEntry("timerHide", m_timerHideInterval);
config.writeEntry("raiseOnDesktopChange", m_raiseOnDesktopChange);
config.writeEntry("raiseOnActivityChange", m_raiseOnActivityChange);
@ -845,7 +855,7 @@ void VisibilityManager::restoreConfig()
auto config = m_latteView->containment()->config();
m_timerShow.setInterval(config.readEntry("timerShow", 0));
m_timerHide.setInterval(qMax(HIDEMINIMUMINTERVAL, config.readEntry("timerHide", 700)));
m_timerHideInterval = qMax(HIDEMINIMUMINTERVAL, config.readEntry("timerHide", 700));
emit timerShowChanged();
emit timerHideChanged();

View File

@ -191,6 +191,9 @@ private slots:
bool isValidMode() const;
private:
void startTimerHide(const int &msec = 0);
private:
WindowSystem::AbstractWindowInterface *m_wm;
Types::Visibility m_mode{Types::None};
@ -211,6 +214,7 @@ private:
bool m_hideNow{false};
int m_frameExtentsHeadThicknessGap{0};
int m_timerHideInterval{700};
Plasma::Types::Location m_frameExtentsLocation{Plasma::Types::BottomEdge};
QStringList m_blockHidingEvents;