Match WaylandWindow scale to what we set on the buffer, not the screen
Currently if the screen scale changes we report a new devicePixelRatio to rendering but we don't send a new set_buffer_scale nor do we update the buffer sizes. This leaves us in a corrupt state. Change-Id: I5bb2bd5eec440cd1ce9080cd3a3dc65448f68298 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
This commit is contained in:
parent
c9a156f29e
commit
b5b693e888
@ -92,6 +92,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
|
|||||||
, mResizeDirty(false)
|
, mResizeDirty(false)
|
||||||
, mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP"))
|
, mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP"))
|
||||||
, mSentInitialResize(false)
|
, mSentInitialResize(false)
|
||||||
|
, mScale(1)
|
||||||
, mState(Qt::WindowNoState)
|
, mState(Qt::WindowNoState)
|
||||||
, mMask()
|
, mMask()
|
||||||
, mBackingStore(Q_NULLPTR)
|
, mBackingStore(Q_NULLPTR)
|
||||||
@ -189,9 +190,12 @@ void QWaylandWindow::initWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mScale = screen()->scale();
|
||||||
|
|
||||||
// Enable high-dpi rendering. Scale() returns the screen scale factor and will
|
// Enable high-dpi rendering. Scale() returns the screen scale factor and will
|
||||||
// typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale()
|
// typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale()
|
||||||
// to inform the compositor that high-resolution buffers will be provided.
|
// to inform the compositor that high-resolution buffers will be provided.
|
||||||
|
//FIXME this needs to be changed when the screen changes along with a resized backing store
|
||||||
if (mDisplay->compositorVersion() >= 3)
|
if (mDisplay->compositorVersion() >= 3)
|
||||||
set_buffer_scale(scale());
|
set_buffer_scale(scale());
|
||||||
|
|
||||||
@ -847,12 +851,12 @@ bool QWaylandWindow::isExposed() const
|
|||||||
|
|
||||||
int QWaylandWindow::scale() const
|
int QWaylandWindow::scale() const
|
||||||
{
|
{
|
||||||
return screen()->scale();
|
return mScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QWaylandWindow::devicePixelRatio() const
|
qreal QWaylandWindow::devicePixelRatio() const
|
||||||
{
|
{
|
||||||
return screen()->devicePixelRatio();
|
return mScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandWindow::setMouseGrabEnabled(bool grab)
|
bool QWaylandWindow::setMouseGrabEnabled(bool grab)
|
||||||
|
@ -235,6 +235,7 @@ protected:
|
|||||||
|
|
||||||
bool mSentInitialResize;
|
bool mSentInitialResize;
|
||||||
QPoint mOffset;
|
QPoint mOffset;
|
||||||
|
int mScale;
|
||||||
|
|
||||||
QIcon mWindowIcon;
|
QIcon mWindowIcon;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user