xcb: notify when the logical DPI changes; add Q_MM_PER_INCH constant
Change-Id: I15696bf45ae99cc5b0fd95dab4884fc85cbfc6da Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
parent
168f32f3f4
commit
5021c1d977
@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
|
||||
static const qreal Q_PI = qreal(3.14159265358979323846); // pi
|
||||
static const qreal Q_2PI = qreal(6.28318530717958647693); // 2*pi
|
||||
static const qreal Q_PI2 = qreal(1.57079632679489661923); // pi/2
|
||||
static const qreal Q_MM_PER_INCH = 25.4;
|
||||
|
||||
inline int qIntSqrtInt(int v)
|
||||
{
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <private/qmath_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -242,8 +243,8 @@ QImage::Format QXcbScreen::format() const
|
||||
|
||||
QDpi QXcbScreen::logicalDpi() const
|
||||
{
|
||||
return QDpi(25.4 * m_virtualSize.width() / m_virtualSizeMillimeters.width(),
|
||||
25.4 * m_virtualSize.height() / m_virtualSizeMillimeters.height());
|
||||
return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(),
|
||||
Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height());
|
||||
}
|
||||
|
||||
QPlatformCursor *QXcbScreen::cursor() const
|
||||
@ -315,6 +316,9 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan
|
||||
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry());
|
||||
QWindowSystemInterface::handleScreenAvailableGeometryChange(QPlatformScreen::screen(), availableGeometry());
|
||||
QWindowSystemInterface::handleScreenOrientationChange(QPlatformScreen::screen(), m_orientation);
|
||||
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QPlatformScreen::screen(),
|
||||
Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(),
|
||||
Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height());
|
||||
}
|
||||
|
||||
void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
|
||||
|
Loading…
Reference in New Issue
Block a user