Skip to content

Commit b99304c

Browse files
committed
Android: fix rendering glitch after window size changes
Currently, apps might end up with half of the window size not rendered or not reflecting size changes. When the root layout size changes, the available size is reported but the screen size is not always sent from Android callbacks, this is the case after an orientation change. So make sure here to update the the screen geometry also when receiving the available geometry. This part amends 7dcf58e. However, the issue was still present in 6.9 and 6.8 before that above commit, to fix that, it's needed to call sendExpose() to send expose event for the window in the new region, and this after propagating the surface change from QtSurface to the platform window. Pick-to: 6.8 6.9 6.10 6.10.0 Fixes: QTBUG-132718 Fixes: QTBUG-134082 Task-number: QTBUG-124140 Change-Id: I390aaba45f324693dc47d7d0110fdb22dc9aca61 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
1 parent 0af13fe commit b99304c

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/android/jar/src/org/qtproject/qt/android/QtSurface.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public void surfaceCreated(SurfaceHolder holder)
3636

3737
@Override
3838
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
39-
{ }
39+
{
40+
// FIXME: this can sometimes cause flicker on orientation change
41+
if (m_surfaceCallback != null)
42+
m_surfaceCallback.onSurfaceChanged(holder.getSurface());
43+
}
4044

4145
@Override
4246
public void surfaceDestroyed(SurfaceHolder holder)

src/plugins/platforms/android/qandroidplatformscreen.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ void QAndroidPlatformScreen::setAvailableGeometry(const QRect &rect)
260260
QRect oldGeometry = m_availableGeometry;
261261

262262
m_availableGeometry = rect;
263+
m_size = sizeForDisplayId(m_displayId);
263264
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry(), availableGeometry());
264265
resizeMaximizedWindows();
265266

src/plugins/platforms/android/qandroidplatformwindow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ void QAndroidPlatformWindow::onSurfaceChanged(QtJniTypes::Surface surface)
325325
clearSurface();
326326
}
327327

328+
sendExpose();
329+
328330
unlockSurface();
329331
}
330332

0 commit comments

Comments
 (0)