mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 01:33:50 +03:00
parent
881d0b47ec
commit
b32171fe21
@ -58,7 +58,15 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
|
||||
m_wm = m_corona->wm();
|
||||
|
||||
connect(this, &VisibilityManager::slideOutFinished, this, &VisibilityManager::updateHiddenState);
|
||||
connect(this, &VisibilityManager::slideInFinished, this, &VisibilityManager::updateHiddenState);
|
||||
connect(this, &VisibilityManager::slideInFinished, this, [&]() {
|
||||
if (m_latteView && !m_latteView->screenEdgeMarginEnabled()) {
|
||||
//! after slide-out the real floating windows should ignore their criteria
|
||||
//! until containsMouse from view has been set to true and false to afterwards
|
||||
updateHiddenState();
|
||||
} else {
|
||||
m_timerHide.stop();
|
||||
}
|
||||
});
|
||||
|
||||
connect(this, &VisibilityManager::enableKWinEdgesChanged, this, &VisibilityManager::updateKWinEdgesSupport);
|
||||
connect(this, &VisibilityManager::modeChanged, this, &VisibilityManager::updateKWinEdgesSupport);
|
||||
@ -66,7 +74,6 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
|
||||
if (m_latteView) {
|
||||
connect(m_latteView, &Latte::View::eventTriggered, this, &VisibilityManager::viewEventManager);
|
||||
connect(m_latteView, &Latte::View::byPassWMChanged, this, &VisibilityManager::updateKWinEdgesSupport);
|
||||
connect(m_latteView, &Latte::View::screenEdgeMarginEnabledChanged, this, &VisibilityManager::updateHideTimer);
|
||||
|
||||
connect(m_latteView, &Latte::View::absoluteGeometryChanged, this, [&]() {
|
||||
if (m_mode == Types::AlwaysVisible && m_latteView->screen()) {
|
||||
@ -334,11 +341,6 @@ QRect VisibilityManager::acceptableStruts()
|
||||
return calcs;
|
||||
}
|
||||
|
||||
bool VisibilityManager::floatHideInterval() const
|
||||
{
|
||||
return (m_latteView && m_latteView->screenEdgeMarginEnabled());
|
||||
}
|
||||
|
||||
bool VisibilityManager::raiseOnDesktop() const
|
||||
{
|
||||
return m_raiseOnDesktopChange;
|
||||
@ -451,39 +453,19 @@ void VisibilityManager::setTimerShow(int msec)
|
||||
|
||||
int VisibilityManager::timerHide() const
|
||||
{
|
||||
if (floatHideInterval()) {
|
||||
return m_floatHideInterval;
|
||||
} else {
|
||||
return m_normalHideInterval;
|
||||
}
|
||||
return m_timerHide.interval();
|
||||
}
|
||||
|
||||
void VisibilityManager::setTimerHide(int msec)
|
||||
{
|
||||
int newInterval = qMax(HIDEMINIMUMINTERVAL, msec);
|
||||
int curInterval = !floatHideInterval() ? m_normalHideInterval : m_floatHideInterval;
|
||||
int interval = qMax(HIDEMINIMUMINTERVAL, msec);
|
||||
|
||||
if (curInterval == newInterval && m_timerHide.interval() == newInterval) {
|
||||
if (m_timerHide.interval() == interval) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (floatHideInterval()) {
|
||||
m_floatHideInterval = newInterval;
|
||||
} else {
|
||||
m_normalHideInterval = newInterval;
|
||||
}
|
||||
|
||||
updateHideTimer();
|
||||
}
|
||||
|
||||
void VisibilityManager::updateHideTimer()
|
||||
{
|
||||
int curInterval = !floatHideInterval() ? m_normalHideInterval : m_floatHideInterval;
|
||||
|
||||
if (m_timerHide.interval() != curInterval) {
|
||||
m_timerHide.setInterval(curInterval);
|
||||
emit timerHideChanged();
|
||||
}
|
||||
m_timerHide.setInterval(interval);
|
||||
emit timerHideChanged();
|
||||
}
|
||||
|
||||
bool VisibilityManager::supportsKWinEdges() const
|
||||
@ -662,8 +644,7 @@ void VisibilityManager::saveConfig()
|
||||
|
||||
config.writeEntry("enableKWinEdges", m_enableKWinEdgesFromUser);
|
||||
config.writeEntry("timerShow", m_timerShow.interval());
|
||||
config.writeEntry("timerHide", m_normalHideInterval);
|
||||
config.writeEntry("timerFloatHide", m_floatHideInterval);
|
||||
config.writeEntry("timerHide", m_timerHide.interval());
|
||||
config.writeEntry("raiseOnDesktopChange", m_raiseOnDesktopChange);
|
||||
config.writeEntry("raiseOnActivityChange", m_raiseOnActivityChange);
|
||||
|
||||
@ -678,11 +659,9 @@ 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)));
|
||||
emit timerShowChanged();
|
||||
|
||||
m_normalHideInterval = qMax(HIDEMINIMUMINTERVAL, config.readEntry("timerHide", 700));
|
||||
m_floatHideInterval = qMax(HIDEMINIMUMINTERVAL, config.readEntry("timerFloatHide", 2700));
|
||||
updateHideTimer();
|
||||
emit timerHideChanged();
|
||||
|
||||
m_enableKWinEdgesFromUser = config.readEntry("enableKWinEdges", true);
|
||||
emit enableKWinEdgesChanged();
|
||||
|
@ -143,8 +143,6 @@ private slots:
|
||||
//! KWin Edges Support functions
|
||||
void updateKWinEdgesSupport();
|
||||
|
||||
void updateHideTimer();
|
||||
|
||||
private:
|
||||
void setContainsMouse(bool contains);
|
||||
|
||||
@ -159,8 +157,6 @@ private:
|
||||
void updateStrutsBasedOnLayoutsAndActivities(bool forceUpdate = false);
|
||||
void viewEventManager(QEvent *ev);
|
||||
|
||||
bool floatHideInterval() const;
|
||||
|
||||
QRect acceptableStruts();
|
||||
|
||||
private slots:
|
||||
@ -188,9 +184,6 @@ private:
|
||||
bool m_raiseOnActivityChange{false};
|
||||
bool m_hideNow{false};
|
||||
|
||||
int m_normalHideInterval{700};
|
||||
int m_floatHideInterval{2700};
|
||||
|
||||
QRect m_publishedStruts;
|
||||
|
||||
//! KWin Edges
|
||||
|
@ -554,8 +554,6 @@ PlasmaComponents.Page {
|
||||
Layout.preferredWidth: width
|
||||
text: latteView.visibility.timerHide
|
||||
|
||||
maxValue: 6000
|
||||
|
||||
onValueChanged: {
|
||||
latteView.visibility.timerHide = value
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user