1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-30 14:50:12 +03:00

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
This commit is contained in:
Michail Vourlakos 2019-11-22 00:25:43 +02:00
parent e034f0bc9f
commit 3d323fc00e

View File

@ -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;
}