plenty improvements for touching/active state flags

--fixes and improvements to identify windows that are
touching or are active and how all of them are used
in order to color properly the view
pull/5/head
Michail Vourlakos 6 years ago
parent 17c602347b
commit f040cc8828

@ -252,7 +252,7 @@ void WindowsTracker::updateFlags()
maxWinId = winfo.wid();
}
if ((isTouchingPanelEdge(winfo) || (m_latteView->visibility()->intersects(winfo)))) {
if (isTouchingViewEdge(winfo) || isTouchingView(winfo)) {
if (winfo.isActive()) {
foundActiveTouch = true;
activeTouchWinId = winfo.wid();
@ -318,27 +318,36 @@ bool WindowsTracker::isMaximizedInCurrentScreen(const WindowInfoWrap &winfo)
return false;
}
bool WindowsTracker::isTouchingPanelEdge(const WindowInfoWrap &winfo)
bool WindowsTracker::isTouchingView(const WindowInfoWrap &winfo)
{
if (winfo.isValid() && !winfo.isMinimized() && m_wm->isOnCurrentDesktop(winfo.wid()) && m_wm->isOnCurrentActivity(winfo.wid())) {
bool touchingPanelEdge{false};
return m_latteView->visibility()->intersects(winfo);
}
return false;
}
bool WindowsTracker::isTouchingViewEdge(const WindowInfoWrap &winfo)
{
if (winfo.isValid() && !winfo.isMinimized() && m_wm->isOnCurrentDesktop(winfo.wid()) && m_wm->isOnCurrentActivity(winfo.wid())) {
bool touchingViewEdge{false};
QRect screenGeometry = m_latteView->screenGeometry();
bool inCurrentScreen{screenGeometry.contains(winfo.geometry().topLeft()) || screenGeometry.contains(winfo.geometry().bottomRight())};
if (inCurrentScreen) {
if (m_latteView->location() == Plasma::Types::TopEdge) {
touchingPanelEdge = (winfo.geometry().y() == m_availableScreenGeometry.y());
touchingViewEdge = (winfo.geometry().y() == m_availableScreenGeometry.y());
} else if (m_latteView->location() == Plasma::Types::BottomEdge) {
touchingPanelEdge = (winfo.geometry().bottom() == m_availableScreenGeometry.bottom());
touchingViewEdge = (winfo.geometry().bottom() == m_availableScreenGeometry.bottom());
} else if (m_latteView->location() == Plasma::Types::LeftEdge) {
touchingPanelEdge = (winfo.geometry().x() == m_availableScreenGeometry.x());
touchingViewEdge = (winfo.geometry().x() == m_availableScreenGeometry.x());
} else if (m_latteView->location() == Plasma::Types::RightEdge) {
touchingPanelEdge = (winfo.geometry().right() == m_availableScreenGeometry.right());
touchingViewEdge = (winfo.geometry().right() == m_availableScreenGeometry.right());
}
}
return touchingPanelEdge;
return touchingViewEdge;
}
return false;

@ -94,7 +94,8 @@ private:
bool isActiveInCurrentScreen(const WindowInfoWrap &winfo);
bool isMaximizedInCurrentScreen(const WindowInfoWrap &winfo);
bool isTouchingPanelEdge(const WindowInfoWrap &winfo);
bool isTouchingViewEdge(const WindowInfoWrap &winfo);
bool isTouchingView(const WindowInfoWrap &winfo);
private:
bool m_enabled{false};

@ -88,8 +88,8 @@ Loader{
//! contents with the disabled windows palette WHEN the active window is not touching our view
if (root.windowColors === Latte.Types.TouchingWindowColors
&& latteView.windowsTracker.existsWindowTouching
&& latteView.windowsTracker.touchingWindowScheme
&& latteView.windowsTracker.touchingWindowScheme !== latteView.windowsTracker.activeWindowScheme) {
&& !latteView.windowsTracker.activeWindowTouching
&& latteView.windowsTracker.touchingWindowScheme) {
return applyTheme.inactiveBackgroundColor;
}
}
@ -103,8 +103,8 @@ Loader{
//! contents with the disabled windows palette WHEN the active window is not touching our view
if (root.windowColors === Latte.Types.TouchingWindowColors
&& latteView.windowsTracker.existsWindowTouching
&& latteView.windowsTracker.touchingWindowScheme
&& latteView.windowsTracker.touchingWindowScheme !== latteView.windowsTracker.activeWindowScheme) {
&& !latteView.windowsTracker.activeWindowTouching
&& latteView.windowsTracker.touchingWindowScheme) {
return applyTheme.inactiveTextColor;
}
}

Loading…
Cancel
Save