Make setting QT_SCALE_FACTOR work on Wayland
QWindow geometry accessors return geometry in device independent pixels. Normally this coordinate system is equivalent to the Wayland native coordinate system, but this is not the case when QT_SCALE_FACTOR is set. Replace QWindow geometry calls with the helpers from QPlatformWindow which return geometry in the native coordinate system: QWindow::geometry() -> QPlatformWindow::windowGeometry() QWindow::frameGeometry() -> QPlatformWindow::windowFrameGeometry() Task-number: QTBUG-87762 Fixes: QTBUG-88064 Change-Id: I8c96237b49c754bb978f1739d090962be770c271 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
f73b8a94f4
commit
b18aba6a42
@ -134,7 +134,7 @@ void QWaylandWlShellSurface::applyConfigure()
|
|||||||
{
|
{
|
||||||
if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen))
|
if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen))
|
||||||
&& !(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) {
|
&& !(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) {
|
||||||
m_normalSize = m_window->window()->frameGeometry().size();
|
m_normalSize = m_window->windowFrameGeometry().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pending.states != m_applied.states)
|
if (m_pending.states != m_applied.states)
|
||||||
|
@ -83,7 +83,7 @@ QWaylandXdgSurface::Toplevel::~Toplevel()
|
|||||||
void QWaylandXdgSurface::Toplevel::applyConfigure()
|
void QWaylandXdgSurface::Toplevel::applyConfigure()
|
||||||
{
|
{
|
||||||
if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
|
if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
|
||||||
m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size();
|
m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size();
|
||||||
|
|
||||||
if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive))
|
if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive))
|
||||||
m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window);
|
m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window);
|
||||||
|
@ -192,10 +192,11 @@ void QWaylandWindow::initWindow()
|
|||||||
mSurface->set_buffer_scale(scale());
|
mSurface->set_buffer_scale(scale());
|
||||||
|
|
||||||
setWindowFlags(window()->flags());
|
setWindowFlags(window()->flags());
|
||||||
if (window()->geometry().isEmpty())
|
QRect geometry = windowGeometry();
|
||||||
|
if (geometry.isEmpty())
|
||||||
setGeometry_helper(QRect(QPoint(), QSize(500,500)));
|
setGeometry_helper(QRect(QPoint(), QSize(500,500)));
|
||||||
else
|
else
|
||||||
setGeometry_helper(window()->geometry());
|
setGeometry_helper(geometry);
|
||||||
setMask(window()->mask());
|
setMask(window()->mask());
|
||||||
if (mShellSurface)
|
if (mShellSurface)
|
||||||
mShellSurface->requestWindowStates(window()->windowStates());
|
mShellSurface->requestWindowStates(window()->windowStates());
|
||||||
@ -427,7 +428,7 @@ void QWaylandWindow::setVisible(bool visible)
|
|||||||
initWindow();
|
initWindow();
|
||||||
mDisplay->flushRequests();
|
mDisplay->flushRequests();
|
||||||
|
|
||||||
setGeometry(window()->geometry());
|
setGeometry(windowGeometry());
|
||||||
// Don't flush the events here, or else the newly visible window may start drawing, but since
|
// Don't flush the events here, or else the newly visible window may start drawing, but since
|
||||||
// there was no frame before it will be stuck at the waitForFrameSync() in
|
// there was no frame before it will be stuck at the waitForFrameSync() in
|
||||||
// QWaylandShmBackingStore::beginPaint().
|
// QWaylandShmBackingStore::beginPaint().
|
||||||
|
Loading…
x
Reference in New Issue
Block a user