mirror of
https://github.com/KDE/latte-dock.git
synced 2025-02-03 09:47:22 +03:00
ignore window states when kwin is showing desktop
--this way every dock/panel and also applets that are using the LastActiveWindow API behave like there is no shown window
This commit is contained in:
parent
1365b9f24f
commit
229f92b2c8
@ -62,6 +62,8 @@ AbstractWindowInterface::AbstractWindowInterface(QObject *parent)
|
||||
emit currentActivityChanged();
|
||||
});
|
||||
|
||||
connect(KWindowSystem::self(), &KWindowSystem::showingDesktopChanged, this, &AbstractWindowInterface::setIsShowingDesktop);
|
||||
|
||||
//! KWin Service tracking
|
||||
m_kwinServiceWatcher->setConnection(QDBusConnection::sessionBus());
|
||||
m_kwinServiceWatcher->setWatchedServices(QStringList({KWINSERVICE}));
|
||||
@ -88,6 +90,21 @@ AbstractWindowInterface::~AbstractWindowInterface()
|
||||
m_windowsTracker->deleteLater();
|
||||
}
|
||||
|
||||
bool AbstractWindowInterface::isShowingDesktop() const
|
||||
{
|
||||
return m_isShowingDesktop;
|
||||
}
|
||||
|
||||
void AbstractWindowInterface::setIsShowingDesktop(const bool &showing)
|
||||
{
|
||||
if (m_isShowingDesktop == showing) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_isShowingDesktop = showing;
|
||||
emit isShowingDesktopChanged();
|
||||
}
|
||||
|
||||
QString AbstractWindowInterface::currentDesktop()
|
||||
{
|
||||
return m_currentDesktop;
|
||||
|
@ -103,6 +103,7 @@ public:
|
||||
virtual AppData appDataFor(WindowId wid) = 0;
|
||||
|
||||
bool inCurrentDesktopActivity(const WindowInfoWrap &winfo);
|
||||
bool isShowingDesktop() const;
|
||||
|
||||
bool hasBlockedTracking(const WindowId &wid) const;
|
||||
|
||||
@ -139,6 +140,8 @@ signals:
|
||||
void currentDesktopChanged();
|
||||
void currentActivityChanged();
|
||||
|
||||
void isShowingDesktopChanged();
|
||||
|
||||
void latteWindowAdded();
|
||||
|
||||
protected:
|
||||
@ -181,9 +184,13 @@ private slots:
|
||||
void initKWinInterface();
|
||||
void windowRemovedSlot(WindowId wid);
|
||||
|
||||
void setIsShowingDesktop(const bool &showing);
|
||||
|
||||
void onVirtualDesktopNavigationWrappingAroundChanged(bool navigationWrappingAround);
|
||||
|
||||
private:
|
||||
bool m_isShowingDesktop{false};
|
||||
|
||||
bool m_isKWinInterfaceAvailable{false};
|
||||
bool m_isVirtualDesktopNavigationWrappingAround{true};
|
||||
|
||||
|
@ -152,6 +152,7 @@ bool TrackedGeneralInfo::isTracking(const WindowInfoWrap &winfo) const
|
||||
bool TrackedGeneralInfo::isShown(const WindowInfoWrap &winfo) const
|
||||
{
|
||||
return (winfo.isValid()
|
||||
&& !m_wm->isShowingDesktop()
|
||||
&& isTrackingCurrentActivity()
|
||||
&& winfo.isOnDesktop(m_wm->currentDesktop())
|
||||
&& winfo.isOnActivity(m_wm->currentActivity()));
|
||||
|
@ -108,7 +108,8 @@ void Windows::init()
|
||||
});
|
||||
|
||||
connect(m_wm, &AbstractWindowInterface::currentDesktopChanged, this, &Windows::updateAllHints);
|
||||
connect(m_wm, &AbstractWindowInterface::currentActivityChanged, this, &Windows::updateAllHints);
|
||||
connect(m_wm, &AbstractWindowInterface::currentActivityChanged, this, &Windows::updateAllHints);
|
||||
connect(m_wm, &AbstractWindowInterface::isShowingDesktopChanged, this, &Windows::updateAllHints);
|
||||
}
|
||||
|
||||
void Windows::initLayoutHints(Latte::Layout::GenericLayout *layout)
|
||||
@ -903,6 +904,10 @@ void Windows::updateHints(Latte::View *view)
|
||||
|
||||
//! First Pass
|
||||
for (const auto &winfo : m_windows) {
|
||||
if (m_wm->isShowingDesktop()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!existsFaultyWindow && (winfo.wid()<=0 || winfo.geometry() == QRect(0, 0, 0, 0))) {
|
||||
existsFaultyWindow = true;
|
||||
}
|
||||
@ -966,7 +971,7 @@ void Windows::updateHints(Latte::View *view)
|
||||
}
|
||||
|
||||
//! PASS 2
|
||||
if (foundActiveInCurScreen && !foundActiveTouchInCurScreen) {
|
||||
if (!m_wm->isShowingDesktop() && foundActiveInCurScreen && !foundActiveTouchInCurScreen) {
|
||||
//! Second Pass to track also Child windows if needed
|
||||
|
||||
//qDebug() << "Windows Array...";
|
||||
@ -1069,6 +1074,10 @@ void Windows::updateHints(Latte::Layout::GenericLayout *layout) {
|
||||
WindowId maxWinId;
|
||||
|
||||
for (const auto &winfo : m_windows) {
|
||||
if (m_wm->isShowingDesktop()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!existsFaultyWindow && (winfo.wid()<=0 || winfo.geometry() == QRect(0, 0, 0, 0))) {
|
||||
existsFaultyWindow = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user