From 01a17ea9ba2afeb08a3c40b15baa3b3cdef41a48 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Wed, 29 Jul 2020 00:13:16 +0300 Subject: [PATCH] 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. --- app/view/visibilitymanager.cpp | 22 ++++++++++++++++------ app/view/visibilitymanager.h | 4 ++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/view/visibilitymanager.cpp b/app/view/visibilitymanager.cpp index 3fa296dc2..602667aa9 100644 --- a/app/view/visibilitymanager.cpp +++ b/app/view/visibilitymanager.cpp @@ -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(); diff --git a/app/view/visibilitymanager.h b/app/view/visibilitymanager.h index 1dac8b1b1..4eddccf9b 100644 --- a/app/view/visibilitymanager.h +++ b/app/view/visibilitymanager.h @@ -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;