Android/LinuxFb: fix QWidget::showFullScreen()

Previously, showFullScreen() had a race condition: it depended
on QFbScreen::setGeometry() being called after the window state was
set (that would trigger QPlatformScreen::resizeMaximizedWindows(), which
was the only part of the code that reacted to WindowFullScreen).
On Android this caused random behaviour.

Task-number: QTBUG-33294
Change-Id: I228e6af4139af1a47387e7d80757d7b46e859580
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
bb10
Paul Olav Tvete 2013-10-22 14:06:29 +02:00 committed by The Qt Project
parent bd3f3f31bf
commit aa7fa09312
2 changed files with 23 additions and 0 deletions

View File

@ -77,6 +77,26 @@ void QFbWindow::setGeometry(const QRect &rect)
QPlatformWindow::setGeometry(rect);
}
void QFbWindow::setVisible(bool visible)
{
if (visible) {
if (mWindowState & Qt::WindowFullScreen)
setGeometry(platformScreen()->geometry());
else if (mWindowState & Qt::WindowMaximized)
setGeometry(platformScreen()->availableGeometry());
}
QPlatformWindow::setVisible(visible);
}
void QFbWindow::setWindowState(Qt::WindowState state)
{
QPlatformWindow::setWindowState(state);
mWindowState = state;
platformScreen()->invalidateRectCache();
}
void QFbWindow::setWindowFlags(Qt::WindowFlags flags)
{
mWindowFlags = flags;

View File

@ -59,7 +59,9 @@ public:
virtual void lower();
virtual void setGeometry(const QRect &rect);
virtual void setVisible(bool visible);
virtual void setWindowState(Qt::WindowState state);
virtual void setWindowFlags(Qt::WindowFlags type);
virtual Qt::WindowFlags windowFlags() const;
@ -78,6 +80,7 @@ protected:
QFbBackingStore *mBackingStore;
QRect mOldGeometry;
Qt::WindowFlags mWindowFlags;
Qt::WindowState mWindowState;
WId mWindowId;
};