mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-10 20:58:18 +03:00
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
This commit is contained in:
parent
dd3e5d2442
commit
b839283d5b
@ -318,6 +318,15 @@ void Effects::setInputMask(QRect area)
|
|||||||
m_inputMask = area;
|
m_inputMask = area;
|
||||||
|
|
||||||
if (KWindowSystem::isPlatformX11()) {
|
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);
|
m_corona->wm()->setInputMask(m_view, area);
|
||||||
} else {
|
} else {
|
||||||
//under wayland mask() is providing the Input Area
|
//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) {
|
if (m_absoluteGeometry == absGeometry && !bypassChecks) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -596,6 +596,11 @@ void VisibilityManager::publishFrameExtents(bool forceUpdate)
|
|||||||
m_frameExtentsLocation = m_latteView->location();
|
m_frameExtentsLocation = m_latteView->location();
|
||||||
m_frameExtentsHeadThicknessGap = m_latteView->headThicknessGap();
|
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);
|
QMargins frameExtents(0, 0, 0, 0);
|
||||||
|
|
||||||
if (m_latteView->location() == Plasma::Types::LeftEdge) {
|
if (m_latteView->location() == Plasma::Types::LeftEdge) {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <QtDBus>
|
#include <QtDBus>
|
||||||
|
|
||||||
// KDE
|
// KDE
|
||||||
|
#include <KWindowSystem>
|
||||||
#include <KActivities/Controller>
|
#include <KActivities/Controller>
|
||||||
|
|
||||||
namespace Latte {
|
namespace Latte {
|
||||||
@ -124,7 +125,19 @@ bool AbstractWindowInterface::isFullScreenWindow(const QRect &wGeometry) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const auto scr : qGuiApp->screens()) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,12 +155,23 @@ bool AbstractWindowInterface::isPlasmaPanel(const QRect &wGeometry) const
|
|||||||
bool isTouchingVerticalEdge{false};
|
bool isTouchingVerticalEdge{false};
|
||||||
|
|
||||||
for (const auto scr : qGuiApp->screens()) {
|
for (const auto scr : qGuiApp->screens()) {
|
||||||
if (scr->geometry().contains(wGeometry.center())) {
|
auto screenGeometry = scr->geometry();
|
||||||
if (wGeometry.y() == scr->geometry().y() || wGeometry.bottom() == scr->geometry().bottom()) {
|
|
||||||
|
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;
|
isTouchingHorizontalEdge = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wGeometry.left() == scr->geometry().left() || wGeometry.right() == scr->geometry().right()) {
|
if (wGeometry.left() == screenGeometry.left() || wGeometry.right() == screenGeometry.right()) {
|
||||||
isTouchingVerticalEdge = true;
|
isTouchingVerticalEdge = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,8 +199,19 @@ bool AbstractWindowInterface::isSidepanel(const QRect &wGeometry) const
|
|||||||
QRect screenGeometry;
|
QRect screenGeometry;
|
||||||
|
|
||||||
for (const auto scr : qGuiApp->screens()) {
|
for (const auto scr : qGuiApp->screens()) {
|
||||||
if (scr->geometry().contains(wGeometry.center())) {
|
auto curScrGeometry = scr->geometry();
|
||||||
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();
|
||||||
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
#include "../../view/view.h"
|
#include "../../view/view.h"
|
||||||
#include "../../view/positioner.h"
|
#include "../../view/positioner.h"
|
||||||
|
|
||||||
|
// Qt
|
||||||
|
#include <KWindowSystem>
|
||||||
|
|
||||||
namespace Latte {
|
namespace Latte {
|
||||||
namespace WindowSystem {
|
namespace WindowSystem {
|
||||||
namespace Tracker {
|
namespace Tracker {
|
||||||
@ -683,18 +686,40 @@ bool Windows::isActive(const WindowInfoWrap &winfo)
|
|||||||
|
|
||||||
bool Windows::isActiveInViewScreen(Latte::View *view, 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()
|
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)
|
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
|
//! 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
|
//! in order to avoid: https://bugs.kde.org/show_bug.cgi?id=397700
|
||||||
return (winfo.isValid() && !winfo.isMinimized()
|
return (winfo.isValid() && !winfo.isMinimized()
|
||||||
&& !winfo.isShaded()
|
&& !winfo.isShaded()
|
||||||
&& winfo.isMaximized()
|
&& 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)
|
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();
|
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())};
|
bool inCurrentScreen{screenGeometry.contains(windowgeometry.topLeft()) || screenGeometry.contains(windowgeometry.bottomRight())};
|
||||||
|
|
||||||
if (inCurrentScreen) {
|
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;
|
//qDebug() << "TRACKING | TOUCHING VIEW EDGE:"<< touchingViewEdge << " TOUCHING VIEW:" << foundTouchInCurScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user