diff --git a/plugins/platforms/x11/standalone/x11_output.cpp b/plugins/platforms/x11/standalone/x11_output.cpp index d86aa1bb79..41b35379e8 100644 --- a/plugins/platforms/x11/standalone/x11_output.cpp +++ b/plugins/platforms/x11/standalone/x11_output.cpp @@ -88,4 +88,14 @@ void X11Output::setGammaRampSize(int size) m_gammaRampSize = size; } +QSize X11Output::physicalSize() const +{ + return m_physicalSize; +} + +void X11Output::setPhysicalSize(const QSize &size) +{ + m_physicalSize = size; +} + } diff --git a/plugins/platforms/x11/standalone/x11_output.h b/plugins/platforms/x11/standalone/x11_output.h index ce622d5b63..ea890e42d7 100644 --- a/plugins/platforms/x11/standalone/x11_output.h +++ b/plugins/platforms/x11/standalone/x11_output.h @@ -54,6 +54,9 @@ public: int gammaRampSize() const override; bool setGammaRamp(const GammaRamp &gamma) override; + QSize physicalSize() const override; + void setPhysicalSize(const QSize &size); + private: void setCrtc(xcb_randr_crtc_t crtc); void setGammaRampSize(int size); @@ -61,6 +64,7 @@ private: xcb_randr_crtc_t m_crtc = XCB_NONE; QString m_name; QRect m_geometry; + QSize m_physicalSize; int m_gammaRampSize; int m_refreshRate; diff --git a/plugins/platforms/x11/standalone/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp index ea3d08759e..7defdd7d2d 100644 --- a/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/plugins/platforms/x11/standalone/x11_platform.cpp @@ -506,15 +506,29 @@ void X11StandalonePlatform::doUpdateOutputs() o->setGeometry(geo); o->setRefreshRate(refreshRate * 1000); - QString name; for (int j = 0; j < info->num_outputs; ++j) { Xcb::RandR::OutputInfo outputInfo(outputInfos.at(j)); - if (crtc == outputInfo->crtc) { - name = outputInfo.name(); + if (outputInfo->crtc != crtc) { + continue; + } + QSize physicalSize(outputInfo->mm_width, outputInfo->mm_height); + switch (info->rotation) { + case XCB_RANDR_ROTATION_ROTATE_0: + case XCB_RANDR_ROTATION_ROTATE_180: + break; + case XCB_RANDR_ROTATION_ROTATE_90: + case XCB_RANDR_ROTATION_ROTATE_270: + physicalSize.transpose(); + break; + case XCB_RANDR_ROTATION_REFLECT_X: + case XCB_RANDR_ROTATION_REFLECT_Y: break; } + o->setName(outputInfo.name()); + o->setPhysicalSize(physicalSize); + break; } - o->setName(name); + m_outputs << o; } }