mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-01 01:17:51 +03:00
remove irrelevant windows from Track::History
--last active windows that were minimized OR changed screen must be removed from last active window history
This commit is contained in:
parent
59a4d63ca6
commit
1b5de7d859
@ -284,23 +284,29 @@ void LastActiveWindow::windowChanged(const WindowId &wid)
|
||||
{
|
||||
if (m_winId == wid && !wid.isNull()) {
|
||||
setInformation(m_windowsTracker->infoFor(wid));
|
||||
} else if (m_history.contains(wid)) {
|
||||
//! remove from history minimized windows or windows that changed screen
|
||||
//! and update information accordingly with the first window found from
|
||||
//! history after the removal
|
||||
WindowInfoWrap winfo = m_windowsTracker->infoFor(wid);
|
||||
if (winfo.isMinimized() || !m_trackedInfo->isTracking(winfo)) {
|
||||
m_history.removeAll(wid);
|
||||
|
||||
if (m_history.count() > 0) {
|
||||
setInformation(m_windowsTracker->infoFor(m_history[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LastActiveWindow::windowRemoved(const WindowId &wid)
|
||||
{
|
||||
bool wasFirst{false};
|
||||
|
||||
if (m_history.contains(wid)) {
|
||||
if (m_history[0] == wid) {
|
||||
wasFirst = true;
|
||||
}
|
||||
|
||||
m_history.removeAll(wid);
|
||||
}
|
||||
|
||||
if (wasFirst && !m_history.isEmpty()) {
|
||||
setInformation(m_windowsTracker->infoFor(m_history[0]));
|
||||
if (m_history.count() > 0) {
|
||||
setInformation(m_windowsTracker->infoFor(m_history[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,6 +142,15 @@ void TrackedGeneralInfo::setActiveWindow(const WindowId &wid)
|
||||
m_lastActiveWindow->setInformation(m_tracker->infoFor(wid));
|
||||
}
|
||||
|
||||
bool TrackedGeneralInfo::isTracking(const WindowInfoWrap &winfo) const
|
||||
{
|
||||
return (winfo.isValid()
|
||||
&& !winfo.isPlasmaDesktop()
|
||||
&& !winfo.isMinimized()
|
||||
&& winfo.isOnDesktop(m_wm->currentDesktop())
|
||||
&& winfo.isOnActivity(m_wm->currentActivity()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ public:
|
||||
|
||||
void setActiveWindow(const WindowId &wid);
|
||||
|
||||
virtual bool isTracking(const WindowInfoWrap &winfo) const;
|
||||
|
||||
signals:
|
||||
void lastActiveWindowChanged();
|
||||
|
||||
|
@ -95,6 +95,12 @@ void TrackedViewInfo::setTouchingWindowScheme(SchemeColors *scheme)
|
||||
m_touchingWindowScheme = scheme;
|
||||
}
|
||||
|
||||
bool TrackedViewInfo::isTracking(const WindowInfoWrap &winfo) const
|
||||
{
|
||||
return TrackedGeneralInfo::isTracking(winfo)
|
||||
&& m_availableScreenGeometry.contains(winfo.geometry().center());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ public:
|
||||
SchemeColors *touchingWindowScheme() const;
|
||||
void setTouchingWindowScheme(SchemeColors *scheme);
|
||||
|
||||
bool isTracking(const WindowInfoWrap &winfo) const override;
|
||||
|
||||
private:
|
||||
bool m_activeWindowTouching;
|
||||
bool m_existsWindowTouching;
|
||||
|
Loading…
Reference in New Issue
Block a user