From 22acd85d9cb6023909e359c6848583a3d444466f Mon Sep 17 00:00:00 2001
From: Michail Vourlakos <mvourlakos@gmail.com>
Date: Sun, 19 Jul 2020 17:13:50 +0300
Subject: [PATCH] struts calculations at screen_edge coordinates

--as it appears in wayland the struts calculations must be
applied for exact screen_edge coordinates and use only the
view shown thickness. During the process floating panels
struts were not accurate at all cases and as such they
were fixed also for x11.
---
 app/view/visibilitymanager.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/view/visibilitymanager.cpp b/app/view/visibilitymanager.cpp
index 33b782c31..18b58b8b8 100644
--- a/app/view/visibilitymanager.cpp
+++ b/app/view/visibilitymanager.cpp
@@ -372,23 +372,23 @@ QRect VisibilityManager::acceptableStruts()
 
     switch (m_latteView->location()) {
     case Plasma::Types::TopEdge: {
-        calcs = QRect(m_latteView->x(), m_latteView->y(), m_latteView->width(), shownThickness);
+        calcs = QRect(m_latteView->x(), m_latteView->screenGeometry().top(), m_latteView->width(), shownThickness);
         break;
     }
 
     case Plasma::Types::BottomEdge: {
-        int y = m_latteView->y() + m_latteView->height() - shownThickness;
+        int y = m_latteView->screenGeometry().bottom() - shownThickness + 1 /* +1, is needed in order to not leave a gap at screen_edge*/;
         calcs = QRect(m_latteView->x(), y, m_latteView->width(), shownThickness);
         break;
     }
 
     case Plasma::Types::LeftEdge: {
-        calcs = QRect(m_latteView->x(), m_latteView->y(), shownThickness, m_latteView->height());
+        calcs = QRect(m_latteView->screenGeometry().left(), m_latteView->y(), shownThickness, m_latteView->height());
         break;
     }
 
     case Plasma::Types::RightEdge: {
-        int x = m_latteView->x() + m_latteView->width() - shownThickness;
+        int x = m_latteView->screenGeometry().right() - shownThickness + 1 /* +1, is needed in order to not leave a gap at screen_edge*/;
         calcs = QRect(x, m_latteView->y(), shownThickness, m_latteView->height());
         break;
     }