From 3d323fc00e52949e71be89622c6c172a96de2fdc Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 22 Nov 2019 00:25:43 +0200 Subject: [PATCH] ignore plasma side-style panels/windows --all plasma windows that are touching a screen edge and their thickness based on the edge they are touching is below 96px. are NOT consider as plasma panels and are treated like normal windows for all Latte codepaths --- app/wm/abstractwindowinterface.cpp | 33 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/app/wm/abstractwindowinterface.cpp b/app/wm/abstractwindowinterface.cpp index 5a411ebe8..491e93040 100644 --- a/app/wm/abstractwindowinterface.cpp +++ b/app/wm/abstractwindowinterface.cpp @@ -34,6 +34,8 @@ namespace Latte { namespace WindowSystem { +#define MAXPLASMAPANELTHICKNESS 96 + AbstractWindowInterface::AbstractWindowInterface(QObject *parent) : QObject(parent) { @@ -57,9 +59,9 @@ AbstractWindowInterface::AbstractWindowInterface(QObject *parent) connect(this, &AbstractWindowInterface::windowRemoved, this, &AbstractWindowInterface::windowRemovedSlot); - // connect(this, &AbstractWindowInterface::windowChanged, this, [&](WindowId wid) { - // qDebug() << "WINDOW CHANGED ::: " << wid; - // }); + // connect(this, &AbstractWindowInterface::windowChanged, this, [&](WindowId wid) { + // qDebug() << "WINDOW CHANGED ::: " << wid; + // }); connect(m_activities.data(), &KActivities::Consumer::currentActivityChanged, this, [&](const QString &id) { m_currentActivity = id; @@ -122,22 +124,35 @@ bool AbstractWindowInterface::isPlasmaDesktop(const QRect &wGeometry) const } bool AbstractWindowInterface::isPlasmaPanel(const QRect &wGeometry) const -{ +{ if (wGeometry.isEmpty()) { return false; } + bool isTouchingHorizontalEdge{false}; + bool isTouchingVerticalEdge{false}; + for (const auto scr : qGuiApp->screens()) { if (scr->geometry().contains(wGeometry.center())) { - if (wGeometry.y() == scr->geometry().y() - || wGeometry.bottom() == scr->geometry().bottom() - || wGeometry.left() == scr->geometry().left() - || wGeometry.right() == scr->geometry().right()) { - return true; + if (wGeometry.y() == scr->geometry().y() || wGeometry.bottom() == scr->geometry().bottom()) { + isTouchingHorizontalEdge = true; + } + + if (wGeometry.left() == scr->geometry().left() || wGeometry.right() == scr->geometry().right()) { + isTouchingVerticalEdge = true; + } + + if (isTouchingVerticalEdge && isTouchingHorizontalEdge) { + break; } } } + if ((isTouchingHorizontalEdge && wGeometry.height() < MAXPLASMAPANELTHICKNESS) + || (isTouchingVerticalEdge && wGeometry.width() < MAXPLASMAPANELTHICKNESS)) { + return true; + } + return false; }