mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-09 17:18:11 +03:00
move dodgeAllWindows to windowtracker
This commit is contained in:
parent
e1d44bc157
commit
a2566d1414
@ -166,6 +166,10 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
|||||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connections[0] = connect(this, &VisibilityManager::containsMouseChanged, this, [&]() {
|
||||||
|
raiseView(m_containsMouse);
|
||||||
|
});
|
||||||
|
|
||||||
raiseView(m_containsMouse);
|
raiseView(m_containsMouse);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -176,11 +180,12 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
|||||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||||
}
|
}
|
||||||
|
|
||||||
connections[0] = connect(wm, &WindowSystem::activeWindowChanged
|
connections[0] = connect(this, &VisibilityManager::containsMouseChanged
|
||||||
, this, &VisibilityManager::dodgeActive);
|
, this, &VisibilityManager::dodgeActive);
|
||||||
connections[1] = connect(wm, &WindowSystem::windowChanged
|
connections[1] = connect(m_latteView->windowsTracker(), &WindowsTracker::activeWindowTouchingChanged
|
||||||
, this, &VisibilityManager::dodgeActive);
|
, this, &VisibilityManager::dodgeActive);
|
||||||
dodgeActive(wm->activeWindow());
|
|
||||||
|
dodgeActive();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -190,11 +195,12 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
|||||||
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
m_latteView->surface()->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AutoHide);
|
||||||
}
|
}
|
||||||
|
|
||||||
connections[0] = connect(wm, &WindowSystem::activeWindowChanged
|
connections[0] = connect(this, &VisibilityManager::containsMouseChanged
|
||||||
, this, &VisibilityManager::dodgeMaximized);
|
, this, &VisibilityManager::dodgeMaximized);
|
||||||
connections[1] = connect(wm, &WindowSystem::windowChanged
|
connections[1] = connect(m_latteView->windowsTracker(), &WindowsTracker::activeWindowMaximizedChanged
|
||||||
, this, &VisibilityManager::dodgeMaximized);
|
, this, &VisibilityManager::dodgeActive);
|
||||||
dodgeMaximized(wm->activeWindow());
|
|
||||||
|
dodgeMaximized();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -433,11 +439,11 @@ void VisibilityManager::updateHiddenState()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Types::DodgeActive:
|
case Types::DodgeActive:
|
||||||
dodgeActive(wm->activeWindow());
|
dodgeActive();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types::DodgeMaximized:
|
case Types::DodgeMaximized:
|
||||||
dodgeMaximized(wm->activeWindow());
|
dodgeMaximized();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types::DodgeAllWindows:
|
case Types::DodgeAllWindows:
|
||||||
@ -474,7 +480,7 @@ void VisibilityManager::activeWindowDraggingStarted()
|
|||||||
updateHiddenState();
|
updateHiddenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisibilityManager::dodgeActive(WindowId wid)
|
void VisibilityManager::dodgeActive()
|
||||||
{
|
{
|
||||||
if (raiseTemporarily)
|
if (raiseTemporarily)
|
||||||
return;
|
return;
|
||||||
@ -485,27 +491,10 @@ void VisibilityManager::dodgeActive(WindowId wid)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto winfo = wm->requestInfo(wid);
|
raiseView(!m_latteView->windowsTracker()->activeWindowTouching());
|
||||||
|
|
||||||
if (!winfo.isValid() || !winfo.isActive()) {
|
|
||||||
winfo = wm->requestInfo(wm->activeWindow());
|
|
||||||
|
|
||||||
if (!winfo.isValid()) {
|
|
||||||
//! very rare case that window manager doesn't have any active window at all
|
|
||||||
raiseView(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//! don't send false raiseView signal when containing mouse, // Johan comment
|
|
||||||
//! I don't know why that wasn't winfo.wid() //active window, but just wid//the window that made the call
|
|
||||||
if (wm->isOnCurrentDesktop(winfo.wid()) && wm->isOnCurrentActivity(winfo.wid())) {
|
|
||||||
bool overlaps{intersects(winfo)};
|
|
||||||
raiseView(!overlaps);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisibilityManager::dodgeMaximized(WindowId wid)
|
void VisibilityManager::dodgeMaximized()
|
||||||
{
|
{
|
||||||
if (raiseTemporarily)
|
if (raiseTemporarily)
|
||||||
return;
|
return;
|
||||||
@ -516,36 +505,7 @@ void VisibilityManager::dodgeMaximized(WindowId wid)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto winfo = wm->requestInfo(wid);
|
raiseView(!m_latteView->windowsTracker()->activeWindowMaximized());
|
||||||
|
|
||||||
if (!winfo.isValid() || !winfo.isActive()) {
|
|
||||||
winfo = wm->requestInfo(wm->activeWindow());
|
|
||||||
|
|
||||||
if (!winfo.isValid()) {
|
|
||||||
//! very rare case that window manager doesn't have any active window at all
|
|
||||||
raiseView(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto intersectsMaxVert = [&]() noexcept -> bool {
|
|
||||||
return ((winfo.isMaxVert()
|
|
||||||
|| (m_latteView->screen() && m_latteView->screen()->availableSize().height() <= winfo.geometry().height()))
|
|
||||||
&& intersects(winfo));
|
|
||||||
};
|
|
||||||
|
|
||||||
auto intersectsMaxHoriz = [&]() noexcept -> bool {
|
|
||||||
return ((winfo.isMaxHoriz()
|
|
||||||
|| (m_latteView->screen() && m_latteView->screen()->availableSize().width() <= winfo.geometry().width()))
|
|
||||||
&& intersects(winfo));
|
|
||||||
};
|
|
||||||
|
|
||||||
//! don't send false raiseView signal when containing mouse, // Johan comment
|
|
||||||
//! I don't know why that wasn't winfo.wid() //active window, but just wid//the window that made the call
|
|
||||||
if (wm->isOnCurrentDesktop(winfo.wid()) && wm->isOnCurrentActivity(winfo.wid())) {
|
|
||||||
bool overlapsMaximized{m_latteView->formFactor() == Plasma::Types::Vertical ? intersectsMaxHoriz() : intersectsMaxVert()};
|
|
||||||
raiseView(!overlapsMaximized);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisibilityManager::dodgeAllWindows()
|
void VisibilityManager::dodgeAllWindows()
|
||||||
|
@ -146,14 +146,13 @@ private:
|
|||||||
void setViewGeometry(const QRect &rect);
|
void setViewGeometry(const QRect &rect);
|
||||||
|
|
||||||
void windowAdded(WindowId id);
|
void windowAdded(WindowId id);
|
||||||
void dodgeActive(WindowId id);
|
|
||||||
void dodgeMaximized(WindowId id);
|
|
||||||
|
|
||||||
void updateStrutsBasedOnLayoutsAndActivities();
|
void updateStrutsBasedOnLayoutsAndActivities();
|
||||||
void viewEventManager(QEvent *ev);
|
void viewEventManager(QEvent *ev);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void dodgeAllWindows();
|
void dodgeAllWindows();
|
||||||
|
void dodgeActive();
|
||||||
|
void dodgeMaximized();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AbstractWindowInterface *wm;
|
AbstractWindowInterface *wm;
|
||||||
|
@ -359,9 +359,22 @@ bool WindowsTracker::isActiveInCurrentScreen(const WindowInfoWrap &winfo)
|
|||||||
|
|
||||||
bool WindowsTracker::isMaximizedInCurrentScreen(const WindowInfoWrap &winfo)
|
bool WindowsTracker::isMaximizedInCurrentScreen(const WindowInfoWrap &winfo)
|
||||||
{
|
{
|
||||||
|
auto viewIntersectsMaxVert = [&]() noexcept -> bool {
|
||||||
|
return ((winfo.isMaxVert()
|
||||||
|
|| (m_latteView->screen() && m_latteView->screen()->availableSize().height() <= winfo.geometry().height()))
|
||||||
|
&& m_latteView->visibility()->intersects(winfo));
|
||||||
|
};
|
||||||
|
|
||||||
|
auto viewIntersectsMaxHoriz = [&]() noexcept -> bool {
|
||||||
|
return ((winfo.isMaxHoriz()
|
||||||
|
|| (m_latteView->screen() && m_latteView->screen()->availableSize().width() <= winfo.geometry().width()))
|
||||||
|
&& m_latteView->visibility()->intersects(winfo));
|
||||||
|
};
|
||||||
|
|
||||||
//! updated implementation to identify the screen that the maximized window is present
|
//! updated implementation to identify the screen that the maximized window is present
|
||||||
//! in order to avoid: https://bugs.kde.org/show_bug.cgi?id=397700
|
//! in order to avoid: https://bugs.kde.org/show_bug.cgi?id=397700
|
||||||
return (winfo.isValid() && !winfo.isMinimized() && winfo.isMaximized()
|
return (winfo.isValid() && !winfo.isMinimized()
|
||||||
|
&& (winfo.isMaximized() || viewIntersectsMaxVert() || viewIntersectsMaxHoriz())
|
||||||
&& m_availableScreenGeometry.contains(winfo.geometry().center()));
|
&& m_availableScreenGeometry.contains(winfo.geometry().center()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,8 +233,10 @@ Item{
|
|||||||
Binding{
|
Binding{
|
||||||
target: latteView && latteView.windowsTracker ? latteView.windowsTracker : null
|
target: latteView && latteView.windowsTracker ? latteView.windowsTracker : null
|
||||||
property: "enabled"
|
property: "enabled"
|
||||||
when: latteView && latteView.windowsTracker
|
when: latteView && latteView.windowsTracker && latteView.visibility
|
||||||
value: (latteView && latteView.visibility && latteView.visibility.mode === Latte.Types.DodgeAllWindows)
|
value: (latteView && latteView.visibility
|
||||||
|
&& !(latteView.visibility.mode === Latte.Types.AlwaysVisible
|
||||||
|
|| latteView.visibility.mode === Latte.Types.WindowsGoBelow))
|
||||||
|| ((root.backgroundOnlyOnMaximized
|
|| ((root.backgroundOnlyOnMaximized
|
||||||
|| plasmoid.configuration.solidBackgroundForMaximized
|
|| plasmoid.configuration.solidBackgroundForMaximized
|
||||||
|| root.disablePanelShadowMaximized
|
|| root.disablePanelShadowMaximized
|
||||||
|
Loading…
Reference in New Issue
Block a user