mirror of
https://github.com/KDE/latte-dock.git
synced 2025-08-26 05:49:29 +03:00
Fix #558, Dodge all windows and activities
This commit is contained in:
@ -68,6 +68,7 @@ public:
|
||||
virtual WindowInfoWrap requestInfo(WindowId wid) const = 0;
|
||||
virtual WindowInfoWrap requestInfoActive() const = 0;
|
||||
virtual bool isOnCurrentDesktop(WindowId wid) const = 0;
|
||||
virtual bool isOnCurrentActivity(WindowId wid) const = 0;
|
||||
virtual const std::list<WindowId> &windows() const = 0;
|
||||
|
||||
virtual void skipTaskBar(const QDialog &dialog) const = 0;
|
||||
|
@ -344,7 +344,7 @@ void VisibilityManagerPrivate::dodgeActive(WindowId wid)
|
||||
winfo = wm->requestInfo(wm->activeWindow());
|
||||
}
|
||||
|
||||
if (wm->isOnCurrentDesktop(wid))
|
||||
if (wm->isOnCurrentDesktop(wid) && wm->isOnCurrentActivity(wid))
|
||||
raiseDock(!intersects(winfo));
|
||||
}
|
||||
|
||||
@ -367,15 +367,17 @@ void VisibilityManagerPrivate::dodgeMaximized(WindowId wid)
|
||||
|
||||
auto isMaxVert = [&]() noexcept -> bool {
|
||||
return winfo.isMaxVert()
|
||||
|| (view->screen() && view->screen()->availableSize().height() <= winfo.geometry().height() && intersects(winfo));
|
||||
|| (view->screen() && view->screen()->availableSize().height() <= winfo.geometry().height()
|
||||
&& intersects(winfo));
|
||||
};
|
||||
|
||||
auto isMaxHoriz = [&]() noexcept -> bool {
|
||||
return winfo.isMaxHoriz()
|
||||
|| (view->screen() && view->screen()->availableSize().width() <= winfo.geometry().width() && intersects(winfo));
|
||||
|| (view->screen() && view->screen()->availableSize().width() <= winfo.geometry().width()
|
||||
&& intersects(winfo));
|
||||
};
|
||||
|
||||
if (wm->isOnCurrentDesktop(wid) && !winfo.isMinimized() && intersects(winfo))
|
||||
if (wm->isOnCurrentDesktop(wid) && wm->isOnCurrentActivity(wid))
|
||||
raiseDock(view->formFactor() == Plasma::Types::Vertical
|
||||
? !isMaxHoriz() : !isMaxVert());
|
||||
}
|
||||
@ -391,7 +393,7 @@ void VisibilityManagerPrivate::dodgeWindows(WindowId wid)
|
||||
windows[wid] = wm->requestInfo(wid);
|
||||
auto &winfo = windows[wid];
|
||||
|
||||
if (!winfo.isValid() || !wm->isOnCurrentDesktop(wid))
|
||||
if (!winfo.isValid() || !wm->isOnCurrentDesktop(wid) || !wm->isOnCurrentActivity(wid))
|
||||
return;
|
||||
|
||||
if (intersects(winfo))
|
||||
@ -409,7 +411,7 @@ void VisibilityManagerPrivate::checkAllWindows()
|
||||
|
||||
for (const auto &winfo : windows) {
|
||||
// <WindowId, WindowInfoWrap>
|
||||
if (!winfo.isValid() || !wm->isOnCurrentDesktop(winfo.wid()))
|
||||
if (!winfo.isValid() || !wm->isOnCurrentDesktop(winfo.wid()) || !wm->isOnCurrentActivity(winfo.wid()))
|
||||
continue;
|
||||
|
||||
if (winfo.isFullscreen()) {
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
WindowInfoWrap requestInfo(WindowId wid) const override;
|
||||
WindowInfoWrap requestInfoActive() const override;
|
||||
bool isOnCurrentDesktop(WindowId wid) const override;
|
||||
bool isOnCurrentActivity(WindowId wid) const override;
|
||||
const std::list<WindowId> &windows() const override;
|
||||
|
||||
void skipTaskBar(const QDialog &dialog) const override;
|
||||
|
@ -204,6 +204,14 @@ bool XWindowInterface::isOnCurrentDesktop(WindowId wid) const
|
||||
return winfo.valid() && winfo.isOnCurrentDesktop();
|
||||
}
|
||||
|
||||
bool XWindowInterface::isOnCurrentActivity(WindowId wid) const
|
||||
{
|
||||
KWindowInfo winfo(wid.value<WId>(), 0, NET::WM2Activities);
|
||||
|
||||
return winfo.valid()
|
||||
&& (winfo.activities().contains(m_activities->currentActivity()) || winfo.activities().empty());
|
||||
}
|
||||
|
||||
WindowInfoWrap XWindowInterface::requestInfo(WindowId wid) const
|
||||
{
|
||||
const KWindowInfo winfo{wid.value<WId>(), NET::WMFrameExtents
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
WindowInfoWrap requestInfo(WindowId wid) const override;
|
||||
WindowInfoWrap requestInfoActive() const override;
|
||||
bool isOnCurrentDesktop(WindowId wid) const override;
|
||||
bool isOnCurrentActivity(WindowId wid) const override;
|
||||
const std::list<WindowId> &windows() const override;
|
||||
|
||||
void skipTaskBar(const QDialog &dialog) const override;
|
||||
|
Reference in New Issue
Block a user