Improve tests behaviour on set ups with high dpi
Summary: We are testing on a 100x100 mock display. We'd ask QWidget for our display's dpi, it would not use the mock display but the actual system's. On my system it made the corners overlap with each other and all sorts of weird things happened. Test Plan: The tests actually pass here. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D28224icc-effect-master
parent
80d3f148e0
commit
9b7ab4d16a
|
@ -46,6 +46,9 @@ void SwipeGesture::setStartGeometry(const QRect &geometry)
|
|||
setMinimumY(geometry.y());
|
||||
setMaximumX(geometry.x() + geometry.width());
|
||||
setMaximumY(geometry.y() + geometry.height());
|
||||
|
||||
Q_ASSERT(m_maximumX >= m_minimumX);
|
||||
Q_ASSERT(m_maximumY >= m_minimumY);
|
||||
}
|
||||
|
||||
qreal SwipeGesture::minimumDeltaReachedProgress(const QSizeF &delta) const
|
||||
|
|
|
@ -727,8 +727,7 @@ ScreenEdges::ScreenEdges(QObject *parent)
|
|||
, m_actionLeft(ElectricActionNone)
|
||||
, m_gestureRecognizer(new GestureRecognizer(this))
|
||||
{
|
||||
QWidget w;
|
||||
m_cornerOffset = (w.physicalDpiX() + w.physicalDpiY() + 5) / 6;
|
||||
m_cornerOffset = (Screens::self()->physicalDpiX(0) + Screens::self()->physicalDpiX(0) + 5) / 6;
|
||||
|
||||
connect(workspace(), &Workspace::clientRemoved, this, &ScreenEdges::deleteEdgeForClient);
|
||||
}
|
||||
|
|
10
screens.cpp
10
screens.cpp
|
@ -229,4 +229,14 @@ void Screens::setConfig(KSharedConfig::Ptr config)
|
|||
m_config = config;
|
||||
}
|
||||
|
||||
int Screens::physicalDpiX(int screen) const
|
||||
{
|
||||
return size(screen).width() / physicalSize(screen).width() * qreal(25.4);
|
||||
}
|
||||
|
||||
int Screens::physicalDpiY(int screen) const
|
||||
{
|
||||
return size(screen).height() / physicalSize(screen).height() * qreal(25.4);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in New Issue