support X11::GlobalScaling properly

--as it appears many users are using Plasma GlobalScaling
in conjuction with PLASMA_USE_QT_SCALING. This commit
provides plenty of fixes for that scenario in order to
make things workable.
--adjust X11::InputMask based on devicePixelRatio()
--adjust X11::GtkFrameExtents based on devicePixelRatio()
--adjust View::absoluteGeometry() based on devicePixelRatio()
--adjust WM::Tracker based on devicePixelRatio()
--adjust WM::AbstractInterface based on devicePixelRatio()

BUG:444222
FIXED-IN:0.10.3
work/m_layershell
Michail Vourlakos 3 years ago
parent dd3e5d2442
commit b839283d5b

@ -318,6 +318,15 @@ void Effects::setInputMask(QRect area)
m_inputMask = area;
if (KWindowSystem::isPlatformX11()) {
if (m_view->devicePixelRatio() != 1.0) {
//!Fix for X11 Global Scale
auto ratio = m_view->devicePixelRatio();
area = QRect(qRound(area.x() * ratio),
qRound(area.y() * ratio),
qRound(area.width()*ratio),
qRound(area.height() * ratio));
}
m_corona->wm()->setInputMask(m_view, area);
} else {
//under wayland mask() is providing the Input Area

@ -642,6 +642,15 @@ void View::updateAbsoluteGeometry(bool bypassChecks)
}
}
if (KWindowSystem::isPlatformX11() && devicePixelRatio() != 1.0) {
//!Fix for X11 Global Scale, I dont think this could be pixel perfect accurate
auto factor = devicePixelRatio();
absGeometry = QRect(qRound(absGeometry.x() * factor),
qRound(absGeometry.y() * factor),
qRound(absGeometry.width() * factor),
qRound(absGeometry.height() * factor));
}
if (m_absoluteGeometry == absGeometry && !bypassChecks) {
return;
}

@ -596,6 +596,11 @@ void VisibilityManager::publishFrameExtents(bool forceUpdate)
m_frameExtentsLocation = m_latteView->location();
m_frameExtentsHeadThicknessGap = m_latteView->headThicknessGap();
if (KWindowSystem::isPlatformX11() && m_latteView->devicePixelRatio()!=1.0) {
//!Fix for X11 Global Scale
m_frameExtentsHeadThicknessGap = qRound(m_frameExtentsHeadThicknessGap * m_latteView->devicePixelRatio());
}
QMargins frameExtents(0, 0, 0, 0);
if (m_latteView->location() == Plasma::Types::LeftEdge) {

@ -17,6 +17,7 @@
#include <QtDBus>
// KDE
#include <KWindowSystem>
#include <KActivities/Controller>
namespace Latte {
@ -124,7 +125,19 @@ bool AbstractWindowInterface::isFullScreenWindow(const QRect &wGeometry) const
}
for (const auto scr : qGuiApp->screens()) {
if (wGeometry == scr->geometry()) {
auto screenGeometry = scr->geometry();
if (KWindowSystem::isPlatformX11() && scr->devicePixelRatio() != 1.0) {
//!Fix for X11 Global Scale, I dont think this could be pixel perfect accurate
auto factor = scr->devicePixelRatio();
screenGeometry = QRect(qRound(screenGeometry.x() * factor),
qRound(screenGeometry.y() * factor),
qRound(screenGeometry.width() * factor),
qRound(screenGeometry.height() * factor));
}
if (wGeometry == screenGeometry) {
return true;
}
}
@ -142,12 +155,23 @@ bool AbstractWindowInterface::isPlasmaPanel(const QRect &wGeometry) const
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()) {
auto screenGeometry = scr->geometry();
if (KWindowSystem::isPlatformX11() && scr->devicePixelRatio() != 1.0) {
//!Fix for X11 Global Scale, I dont think this could be pixel perfect accurate
auto factor = scr->devicePixelRatio();
screenGeometry = QRect(qRound(screenGeometry.x() * factor),
qRound(screenGeometry.y() * factor),
qRound(screenGeometry.width() * factor),
qRound(screenGeometry.height() * factor));
}
if (screenGeometry.contains(wGeometry.center())) {
if (wGeometry.y() == screenGeometry.y() || wGeometry.bottom() == screenGeometry.bottom()) {
isTouchingHorizontalEdge = true;
}
if (wGeometry.left() == scr->geometry().left() || wGeometry.right() == scr->geometry().right()) {
if (wGeometry.left() == screenGeometry.left() || wGeometry.right() == screenGeometry.right()) {
isTouchingVerticalEdge = true;
}
@ -175,8 +199,19 @@ bool AbstractWindowInterface::isSidepanel(const QRect &wGeometry) const
QRect screenGeometry;
for (const auto scr : qGuiApp->screens()) {
if (scr->geometry().contains(wGeometry.center())) {
screenGeometry = scr->geometry();
auto curScrGeometry = scr->geometry();
if (KWindowSystem::isPlatformX11() && scr->devicePixelRatio() != 1.0) {
//!Fix for X11 Global Scale, I dont think this could be pixel perfect accurate
auto factor = scr->devicePixelRatio();
curScrGeometry = QRect(qRound(curScrGeometry.x() * factor),
qRound(curScrGeometry.y() * factor),
qRound(curScrGeometry.width() * factor),
qRound(curScrGeometry.height() * factor));
}
if (curScrGeometry.contains(wGeometry.center())) {
screenGeometry = curScrGeometry;
break;
}
}

@ -19,6 +19,9 @@
#include "../../view/view.h"
#include "../../view/positioner.h"
// Qt
#include <KWindowSystem>
namespace Latte {
namespace WindowSystem {
namespace Tracker {
@ -683,18 +686,40 @@ bool Windows::isActive(const WindowInfoWrap &winfo)
bool Windows::isActiveInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
{
auto screenGeometry = m_views[view]->screenGeometry();
if (KWindowSystem::isPlatformX11() && view->devicePixelRatio() != 1.0) {
//!Fix for X11 Global Scale, I dont think this could be pixel perfect accurate
auto factor = view->devicePixelRatio();
screenGeometry = QRect(qRound(screenGeometry.x() * factor),
qRound(screenGeometry.y() * factor),
qRound(screenGeometry.width() * factor),
qRound(screenGeometry.height() * factor));
}
return (winfo.isValid() && winfo.isActive() && !winfo.isMinimized()
&& m_views[view]->screenGeometry().contains(winfo.geometry().center()));
&& screenGeometry.contains(winfo.geometry().center()));
}
bool Windows::isMaximizedInViewScreen(Latte::View *view, const WindowInfoWrap &winfo)
{
auto screenGeometry = m_views[view]->screenGeometry();
if (KWindowSystem::isPlatformX11() && view->devicePixelRatio() != 1.0) {
//!Fix for X11 Global Scale, I dont think this could be pixel perfect accurate
auto factor = view->devicePixelRatio();
screenGeometry = QRect(qRound(screenGeometry.x() * factor),
qRound(screenGeometry.y() * factor),
qRound(screenGeometry.width() * factor),
qRound(screenGeometry.height() * factor));
}
//! updated implementation to identify the screen that the maximized window is present
//! in order to avoid: https://bugs.kde.org/show_bug.cgi?id=397700
return (winfo.isValid() && !winfo.isMinimized()
&& !winfo.isShaded()
&& winfo.isMaximized()
&& m_views[view]->screenGeometry().contains(winfo.geometry().center()));
&& screenGeometry.contains(winfo.geometry().center()));
}
bool Windows::isTouchingView(Latte::View *view, const WindowSystem::WindowInfoWrap &winfo)
@ -713,6 +738,15 @@ bool Windows::isTouchingViewEdge(Latte::View *view, const QRect &windowgeometry)
QRect screenGeometry = view->screenGeometry();
if (KWindowSystem::isPlatformX11() && view->devicePixelRatio() != 1.0) {
//!Fix for X11 Global Scale, I dont think this could be pixel perfect accurate
auto factor = view->devicePixelRatio();
screenGeometry = QRect(qRound(screenGeometry.x() * factor),
qRound(screenGeometry.y() * factor),
qRound(screenGeometry.width() * factor),
qRound(screenGeometry.height() * factor));
}
bool inCurrentScreen{screenGeometry.contains(windowgeometry.topLeft()) || screenGeometry.contains(windowgeometry.bottomRight())};
if (inCurrentScreen) {
@ -923,7 +957,7 @@ void Windows::updateHints(Latte::View *view)
}
}
//qDebug() << "TRACKING | ACTIVE:"<< foundActive << " ACT_CUR_SCR:" << foundTouchInCurScreen << " MAXIM:"<<foundMaximizedInCurScreen;
//qDebug() << "TRACKING | ACTIVE:"<< foundActive << " ACT_TOUCH_CUR_SCR:" << foundActiveTouchInCurScreen << " MAXIM:"<<foundMaximizedInCurScreen;
//qDebug() << "TRACKING | TOUCHING VIEW EDGE:"<< touchingViewEdge << " TOUCHING VIEW:" << foundTouchInCurScreen;
}

Loading…
Cancel
Save