diff options
author | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2014-09-06 00:26:20 +0300 |
---|---|---|
committer | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2014-09-08 14:06:08 +0200 |
commit | 929b4f03a67ec9577dcc9ed8981f69489b1e49a4 (patch) | |
tree | 057e5f9651fb491ece393f1703c53fa1c2273eb6 /src/client/qwaylandscreen.cpp | |
parent | 374cb3b2872652317baec299712d7dfde6d9c896 (diff) |
Fix QWaylandScreen geometry and physical size
The wl_output.geometry event carries the physical size of the output,
not the logical one. This happened to work only because the geometry
event was sent before the mode event, which carries the logical size.
Moreover, use the done event to send only one geometry change event
instead of one per advertized mode.
Change-Id: I5b09d56654aac149d90692bb5a3e050cc0d60cb6
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/client/qwaylandscreen.cpp')
-rw-r--r-- | src/client/qwaylandscreen.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp index 2cc719776..6213da87f 100644 --- a/src/client/qwaylandscreen.cpp +++ b/src/client/qwaylandscreen.cpp @@ -95,6 +95,11 @@ QImage::Format QWaylandScreen::format() const return mFormat; } +QSizeF QWaylandScreen::physicalSize() const +{ + return mPhysicalSize; +} + QDpi QWaylandScreen::logicalDpi() const { static int force_dpi = !qgetenv("QT_WAYLAND_FORCE_DPI").isEmpty() ? qgetenv("QT_WAYLAND_FORCE_DPI").toInt() : -1; @@ -153,16 +158,11 @@ void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refr QSize size(width, height); - if (size != mGeometry.size()) { + if (size != mGeometry.size()) mGeometry.setSize(size); - QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry); - QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), mGeometry); - } - if (refresh != mRefreshRate) { + if (refresh != mRefreshRate) mRefreshRate = refresh; - QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); - } } void QWaylandScreen::output_geometry(int32_t x, int32_t y, @@ -202,14 +202,18 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y, if (!model.isEmpty()) mOutputName = model; - QRect geom(x, y, width, height); - - if (mGeometry == geom) - return; + mPhysicalSize = QSize(width, height); + mGeometry.moveTopLeft(QPoint(x, y)); +} - mGeometry = geom; +void QWaylandScreen::output_done() +{ + // the done event is sent after all the geometry and the mode events are sent, + // and the last mode event to be sent is the active one, so we can trust the + // values of mGeometry and mRefreshRate here QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry); QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), mGeometry); + QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); } QT_END_NAMESPACE |