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
work/m_layershell
Michail Vourlakos 3 years ago
parent 20bad7c191
commit 1ea3130573

@ -62,6 +62,8 @@ AbstractWindowInterface::AbstractWindowInterface(QObject *parent)
emit currentActivityChanged(); emit currentActivityChanged();
}); });
connect(KWindowSystem::self(), &KWindowSystem::showingDesktopChanged, this, &AbstractWindowInterface::setIsShowingDesktop);
//! KWin Service tracking //! KWin Service tracking
m_kwinServiceWatcher->setConnection(QDBusConnection::sessionBus()); m_kwinServiceWatcher->setConnection(QDBusConnection::sessionBus());
m_kwinServiceWatcher->setWatchedServices(QStringList({KWINSERVICE})); m_kwinServiceWatcher->setWatchedServices(QStringList({KWINSERVICE}));
@ -88,6 +90,21 @@ AbstractWindowInterface::~AbstractWindowInterface()
m_windowsTracker->deleteLater(); 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() QString AbstractWindowInterface::currentDesktop()
{ {
return m_currentDesktop; return m_currentDesktop;

@ -103,6 +103,7 @@ public:
virtual AppData appDataFor(WindowId wid) = 0; virtual AppData appDataFor(WindowId wid) = 0;
bool inCurrentDesktopActivity(const WindowInfoWrap &winfo); bool inCurrentDesktopActivity(const WindowInfoWrap &winfo);
bool isShowingDesktop() const;
bool hasBlockedTracking(const WindowId &wid) const; bool hasBlockedTracking(const WindowId &wid) const;
@ -139,6 +140,8 @@ signals:
void currentDesktopChanged(); void currentDesktopChanged();
void currentActivityChanged(); void currentActivityChanged();
void isShowingDesktopChanged();
void latteWindowAdded(); void latteWindowAdded();
protected: protected:
@ -181,9 +184,13 @@ private slots:
void initKWinInterface(); void initKWinInterface();
void windowRemovedSlot(WindowId wid); void windowRemovedSlot(WindowId wid);
void setIsShowingDesktop(const bool &showing);
void onVirtualDesktopNavigationWrappingAroundChanged(bool navigationWrappingAround); void onVirtualDesktopNavigationWrappingAroundChanged(bool navigationWrappingAround);
private: private:
bool m_isShowingDesktop{false};
bool m_isKWinInterfaceAvailable{false}; bool m_isKWinInterfaceAvailable{false};
bool m_isVirtualDesktopNavigationWrappingAround{true}; bool m_isVirtualDesktopNavigationWrappingAround{true};

@ -152,6 +152,7 @@ bool TrackedGeneralInfo::isTracking(const WindowInfoWrap &winfo) const
bool TrackedGeneralInfo::isShown(const WindowInfoWrap &winfo) const bool TrackedGeneralInfo::isShown(const WindowInfoWrap &winfo) const
{ {
return (winfo.isValid() return (winfo.isValid()
&& !m_wm->isShowingDesktop()
&& isTrackingCurrentActivity() && isTrackingCurrentActivity()
&& winfo.isOnDesktop(m_wm->currentDesktop()) && winfo.isOnDesktop(m_wm->currentDesktop())
&& winfo.isOnActivity(m_wm->currentActivity())); && winfo.isOnActivity(m_wm->currentActivity()));

@ -108,7 +108,8 @@ void Windows::init()
}); });
connect(m_wm, &AbstractWindowInterface::currentDesktopChanged, this, &Windows::updateAllHints); 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) void Windows::initLayoutHints(Latte::Layout::GenericLayout *layout)
@ -903,6 +904,10 @@ void Windows::updateHints(Latte::View *view)
//! First Pass //! First Pass
for (const auto &winfo : m_windows) { for (const auto &winfo : m_windows) {
if (m_wm->isShowingDesktop()) {
break;
}
if (!existsFaultyWindow && (winfo.wid()<=0 || winfo.geometry() == QRect(0, 0, 0, 0))) { if (!existsFaultyWindow && (winfo.wid()<=0 || winfo.geometry() == QRect(0, 0, 0, 0))) {
existsFaultyWindow = true; existsFaultyWindow = true;
} }
@ -966,7 +971,7 @@ void Windows::updateHints(Latte::View *view)
} }
//! PASS 2 //! PASS 2
if (foundActiveInCurScreen && !foundActiveTouchInCurScreen) { if (!m_wm->isShowingDesktop() && foundActiveInCurScreen && !foundActiveTouchInCurScreen) {
//! Second Pass to track also Child windows if needed //! Second Pass to track also Child windows if needed
//qDebug() << "Windows Array..."; //qDebug() << "Windows Array...";
@ -1069,6 +1074,10 @@ void Windows::updateHints(Latte::Layout::GenericLayout *layout) {
WindowId maxWinId; WindowId maxWinId;
for (const auto &winfo : m_windows) { for (const auto &winfo : m_windows) {
if (m_wm->isShowingDesktop()) {
break;
}
if (!existsFaultyWindow && (winfo.wid()<=0 || winfo.geometry() == QRect(0, 0, 0, 0))) { if (!existsFaultyWindow && (winfo.wid()<=0 || winfo.geometry() == QRect(0, 0, 0, 0))) {
existsFaultyWindow = true; existsFaultyWindow = true;
} }

Loading…
Cancel
Save