mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-22 06:03:55 +03:00
more startup improvements
--visibility: simplify and improve code for restoring and saving values --enable visibility mode early on the startup sequence --enable windows tracking after startup phase has ended --windows tracking respect also view geometry changes and not only window changes from the desktop environment
This commit is contained in:
parent
7a7af88e99
commit
a033a20062
@ -114,8 +114,6 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
|
||||
publishFrameExtents(forceUpdate);
|
||||
}
|
||||
|
||||
m_timerStartUp.setInterval(4000);
|
||||
m_timerStartUp.setSingleShot(true);
|
||||
m_timerShow.setSingleShot(true);
|
||||
m_timerHide.setSingleShot(true);
|
||||
|
||||
@ -146,6 +144,14 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view)
|
||||
connect(&m_timerBlockStrutsUpdate, &QTimer::timeout, this, [&]() { updateStrutsBasedOnLayoutsAndActivities(); });
|
||||
|
||||
restoreConfig();
|
||||
|
||||
//! connect save values after they have been restored
|
||||
connect(this, &VisibilityManager::enableKWinEdgesChanged, this, &VisibilityManager::saveConfig);
|
||||
connect(this, &VisibilityManager::modeChanged, this, &VisibilityManager::saveConfig);
|
||||
connect(this, &VisibilityManager::raiseOnDesktopChanged, this, &VisibilityManager::saveConfig);
|
||||
connect(this, &VisibilityManager::raiseOnActivityChanged, this, &VisibilityManager::saveConfig);
|
||||
connect(this, &VisibilityManager::timerShowChanged, this, &VisibilityManager::saveConfig);
|
||||
connect(this, &VisibilityManager::timerHideChanged, this, &VisibilityManager::saveConfig);
|
||||
}
|
||||
|
||||
VisibilityManager::~VisibilityManager()
|
||||
@ -209,8 +215,11 @@ void VisibilityManager::setViewOnFrontLayer()
|
||||
|
||||
void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
||||
{
|
||||
if (m_mode == mode)
|
||||
if (m_mode == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Updating visibility mode to :::: " << mode;
|
||||
|
||||
Q_ASSERT_X(mode != Types::None, staticMetaObject.className(), "set visibility to Types::None");
|
||||
|
||||
@ -367,8 +376,6 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
||||
break;
|
||||
}
|
||||
|
||||
m_latteView->containment()->config().writeEntry("visibility", static_cast<int>(m_mode));
|
||||
|
||||
emit modeChanged();
|
||||
}
|
||||
|
||||
@ -977,8 +984,9 @@ void VisibilityManager::dodgeAllWindows()
|
||||
|
||||
void VisibilityManager::saveConfig()
|
||||
{
|
||||
if (!m_latteView->containment())
|
||||
if (!m_latteView->containment()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto config = m_latteView->containment()->config();
|
||||
|
||||
@ -987,58 +995,20 @@ void VisibilityManager::saveConfig()
|
||||
config.writeEntry("timerHide", m_timerHideInterval);
|
||||
config.writeEntry("raiseOnDesktopChange", m_raiseOnDesktopChange);
|
||||
config.writeEntry("raiseOnActivityChange", m_raiseOnActivityChange);
|
||||
config.writeEntry("visibility", static_cast<int>(m_mode));
|
||||
|
||||
m_latteView->containment()->configNeedsSaving();
|
||||
}
|
||||
|
||||
void VisibilityManager::restoreConfig()
|
||||
{
|
||||
if (!m_latteView || !m_latteView->containment()){
|
||||
return;
|
||||
}
|
||||
|
||||
auto config = m_latteView->containment()->config();
|
||||
m_timerShow.setInterval(config.readEntry("timerShow", 0));
|
||||
m_timerHideInterval = qMax(HIDEMINIMUMINTERVAL, config.readEntry("timerHide", 700));
|
||||
emit timerShowChanged();
|
||||
emit timerHideChanged();
|
||||
|
||||
m_enableKWinEdgesFromUser = config.readEntry("enableKWinEdges", true);
|
||||
emit enableKWinEdgesChanged();
|
||||
|
||||
setTimerHide(qMax(HIDEMINIMUMINTERVAL, config.readEntry("timerHide", 700)));
|
||||
setTimerShow(config.readEntry("timerShow", 0));
|
||||
setEnableKWinEdges(config.readEntry("enableKWinEdges", true));
|
||||
setRaiseOnDesktop(config.readEntry("raiseOnDesktopChange", false));
|
||||
setRaiseOnActivity(config.readEntry("raiseOnActivityChange", false));
|
||||
|
||||
auto storedMode = (Types::Visibility)(m_latteView->containment()->config().readEntry("visibility", (int)(Types::DodgeActive)));
|
||||
|
||||
if (storedMode == Types::AlwaysVisible) {
|
||||
qDebug() << "Loading visibility mode: Always Visible , on startup...";
|
||||
setMode(Types::AlwaysVisible);
|
||||
} else {
|
||||
connect(&m_timerStartUp, &QTimer::timeout, this, [&]() {
|
||||
if (!m_latteView || !m_latteView->containment()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Types::Visibility fMode = (Types::Visibility)(m_latteView->containment()->config().readEntry("visibility", (int)(Types::DodgeActive)));
|
||||
qDebug() << "Loading visibility mode:" << fMode << " on startup...";
|
||||
setMode(fMode);
|
||||
});
|
||||
connect(m_latteView->containment(), &Plasma::Containment::userConfiguringChanged
|
||||
, this, [&](bool configuring) {
|
||||
if (configuring && m_timerStartUp.isActive())
|
||||
m_timerStartUp.start(100);
|
||||
});
|
||||
|
||||
m_timerStartUp.start();
|
||||
}
|
||||
|
||||
connect(m_latteView->containment(), &Plasma::Containment::userConfiguringChanged
|
||||
, this, [&](bool configuring) {
|
||||
if (!configuring) {
|
||||
saveConfig();
|
||||
}
|
||||
});
|
||||
setMode((Types::Visibility)(config.readEntry("visibility", (int)(Types::DodgeActive))));
|
||||
}
|
||||
|
||||
bool VisibilityManager::containsMouse() const
|
||||
|
@ -220,7 +220,6 @@ private:
|
||||
|
||||
QTimer m_timerShow;
|
||||
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
|
||||
|
@ -8,6 +8,7 @@
|
||||
// local
|
||||
#include "currentscreentracker.h"
|
||||
#include "allscreenstracker.h"
|
||||
#include "../positioner.h"
|
||||
#include "../view.h"
|
||||
#include "../../lattecorona.h"
|
||||
#include "../../wm/tracker/windowstracker.h"
|
||||
@ -34,10 +35,14 @@ WindowsTracker::WindowsTracker(Latte::View *parent)
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_latteView->positioner(), &Positioner::startupFinished, this, [&]() {
|
||||
//! During startup phase windows tracking is not enabled and does not
|
||||
//! influence startup sequence at all. At the same time to windows tracking
|
||||
//! takes place during startup and as such startup time is reduced
|
||||
m_wm->windowsTracker()->addView(m_latteView);
|
||||
|
||||
emit allScreensChanged();
|
||||
emit currentScreenChanged();
|
||||
});
|
||||
}
|
||||
|
||||
WindowsTracker::~WindowsTracker()
|
||||
|
@ -41,6 +41,11 @@ Windows::Windows(AbstractWindowInterface *parent)
|
||||
m_updateApplicationDataTimer.setSingleShot(true);
|
||||
connect(&m_updateApplicationDataTimer, &QTimer::timeout, this, &Windows::updateApplicationData);
|
||||
|
||||
//! delayed update all hints
|
||||
m_updateAllHintsTimer.setInterval(300);
|
||||
m_updateAllHintsTimer.setSingleShot(true);
|
||||
connect(&m_updateAllHintsTimer, &QTimer::timeout, this, &Windows::updateAllHints);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@ -169,6 +174,7 @@ void Windows::addView(Latte::View *view)
|
||||
|
||||
connect(view, &Latte::View::isTouchingBottomViewAndIsBusyChanged, this, &Windows::updateExtraViewHints);
|
||||
connect(view, &Latte::View::isTouchingTopViewAndIsBusyChanged, this, &Windows::updateExtraViewHints);
|
||||
connect(view, &Latte::View::absoluteGeometryChanged, this, &Windows::updateAllHintsAfterTimer);
|
||||
|
||||
updateAllHints();
|
||||
|
||||
@ -821,6 +827,14 @@ void Windows::updateScreenGeometries()
|
||||
}
|
||||
}
|
||||
|
||||
void Windows::updateAllHintsAfterTimer()
|
||||
{
|
||||
if (!m_updateAllHintsTimer.isActive()) {
|
||||
updateAllHints();
|
||||
m_updateAllHintsTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
void Windows::updateAllHints()
|
||||
{
|
||||
for (const auto view : m_views.keys()) {
|
||||
|
@ -127,6 +127,7 @@ private:
|
||||
void cleanupFaultyWindows();
|
||||
|
||||
void updateAllHints();
|
||||
void updateAllHintsAfterTimer();
|
||||
|
||||
//! Views
|
||||
void updateHints(Latte::View *view);
|
||||
@ -182,6 +183,7 @@ private:
|
||||
|
||||
QMap<WindowId, WindowInfoWrap> m_windows;
|
||||
|
||||
QTimer m_updateAllHintsTimer;
|
||||
//! Some applications delay their application name/icon identification
|
||||
//! such as Libreoffice that updates its StartupWMClass after
|
||||
//! its startup
|
||||
|
Loading…
x
Reference in New Issue
Block a user