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
pull/16/head
Michail Vourlakos 5 years ago
parent e034f0bc9f
commit 3d323fc00e

@ -34,6 +34,8 @@
namespace Latte { namespace Latte {
namespace WindowSystem { namespace WindowSystem {
#define MAXPLASMAPANELTHICKNESS 96
AbstractWindowInterface::AbstractWindowInterface(QObject *parent) AbstractWindowInterface::AbstractWindowInterface(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
@ -127,15 +129,28 @@ bool AbstractWindowInterface::isPlasmaPanel(const QRect &wGeometry) const
return false; return false;
} }
bool isTouchingHorizontalEdge{false};
bool isTouchingVerticalEdge{false};
for (const auto scr : qGuiApp->screens()) { for (const auto scr : qGuiApp->screens()) {
if (scr->geometry().contains(wGeometry.center())) { if (scr->geometry().contains(wGeometry.center())) {
if (wGeometry.y() == scr->geometry().y() if (wGeometry.y() == scr->geometry().y() || wGeometry.bottom() == scr->geometry().bottom()) {
|| wGeometry.bottom() == scr->geometry().bottom() isTouchingHorizontalEdge = true;
|| wGeometry.left() == scr->geometry().left() }
|| wGeometry.right() == scr->geometry().right()) {
return 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; return false;

Loading…
Cancel
Save