linuxfb: Make first window fullscreen like eglfs
...unless the legacy behavior is requested via QT_QPA_FB_FORCE_FULLSCREEN=0 or the platform plugin overrides QFbScreen::flags() to return QFbScreen::DontForceFirstWindowToFullScreen. The long pending asymmetry between eglfs and linuxfb is going to end because with the increased focus on the integrated Qt Quick Software backend the expectation for launching apps with -platform linuxfb is to behave in the normal, eglfs style, embedded manner. Forcing every app to handle this manually in QML is silly. Widget applications also benefit since the old non-fullscreen main window approach is pretty much never what is wanted (considering there is no desktop and the content in the background is either garbage or whatever was on the terminal). However, not every fbconvenience-based platform wants this. For example, vnc should remain with the old way where window sizes are not altered. vnc therefore opts out via QFbScreen::flags(). bsdfb follows the linuxfb behavior. [ChangeLog][Important Behavior Changes] The linuxfb and bsdfb platform plugins now follow the behavior of eglfs by making the first window fullscreen. This provides consistency and avoids applications having to make their windows match the screen size manually. The new behavior can be disabled by setting the environment variable QT_QPA_FB_FORCE_FULLSCREEN=0. Task-number: QTBUG-48658 Task-number: QTBUG-56306 Change-Id: I63d917147ce37205e29cbd0c6f37f35c46d4509c Reviewed-by: Louai Al-Khanji <louai.al-khanji@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
aa3d08ee86
commit
be17ca27f6
@ -154,6 +154,11 @@ QWindow *QFbScreen::topLevelAt(const QPoint & p) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QFbScreen::windowCount() const
|
||||
{
|
||||
return mWindowStack.count();
|
||||
}
|
||||
|
||||
void QFbScreen::setDirty(const QRect &rect)
|
||||
{
|
||||
QRect intersection = rect.intersected(mGeometry);
|
||||
@ -313,5 +318,10 @@ QFbWindow *QFbScreen::windowForId(WId wid) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
QFbScreen::Flags QFbScreen::flags() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -66,7 +66,13 @@ class QFbBackingStore;
|
||||
class QFbScreen : public QObject, public QPlatformScreen
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Flag {
|
||||
DontForceFirstWindowToFullScreen = 0x01
|
||||
};
|
||||
Q_DECLARE_FLAGS(Flags, Flag)
|
||||
|
||||
QFbScreen();
|
||||
~QFbScreen();
|
||||
|
||||
@ -85,6 +91,8 @@ public:
|
||||
virtual void raise(QFbWindow *window);
|
||||
virtual void lower(QFbWindow *window);
|
||||
virtual void topWindowChanged(QWindow *) {}
|
||||
virtual int windowCount() const;
|
||||
virtual Flags flags() const;
|
||||
|
||||
void addPendingBackingStore(QFbBackingStore *bs) { mPendingBackingStores << bs; }
|
||||
|
||||
@ -126,6 +134,8 @@ private:
|
||||
bool mIsUpToDate;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QFbScreen::Flags)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QFBSCREEN_P_H
|
||||
|
@ -74,8 +74,13 @@ void QFbWindow::setGeometry(const QRect &rect)
|
||||
|
||||
void QFbWindow::setVisible(bool visible)
|
||||
{
|
||||
QFbScreen *fbScreen = platformScreen();
|
||||
if (visible) {
|
||||
if (mWindowState & Qt::WindowFullScreen)
|
||||
bool convOk = false;
|
||||
static bool envDisableForceFullScreen = qEnvironmentVariableIntValue("QT_QPA_FB_FORCE_FULLSCREEN", &convOk) == 0 && convOk;
|
||||
const bool platformDisableForceFullScreen = fbScreen->flags().testFlag(QFbScreen::DontForceFirstWindowToFullScreen);
|
||||
const bool forceFullScreen = !envDisableForceFullScreen && !platformDisableForceFullScreen && fbScreen->windowCount() == 0;
|
||||
if (forceFullScreen || (mWindowState & Qt::WindowFullScreen))
|
||||
setGeometry(platformScreen()->geometry());
|
||||
else if (mWindowState & Qt::WindowMaximized)
|
||||
setGeometry(platformScreen()->availableGeometry());
|
||||
@ -83,9 +88,9 @@ void QFbWindow::setVisible(bool visible)
|
||||
QPlatformWindow::setVisible(visible);
|
||||
|
||||
if (visible)
|
||||
platformScreen()->addWindow(this);
|
||||
fbScreen->addWindow(this);
|
||||
else
|
||||
platformScreen()->removeWindow(this);
|
||||
fbScreen->removeWindow(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,5 +183,10 @@ bool QVNCScreen::swapBytes() const
|
||||
}
|
||||
#endif
|
||||
|
||||
QFbScreen::Flags QVncScreen::flags() const
|
||||
{
|
||||
return QFbScreen::DontForceFirstWindowToFullScreen;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -70,6 +70,8 @@ public:
|
||||
void disableClientCursor(QVncClient *client);
|
||||
QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
|
||||
|
||||
Flags flags() const Q_DECL_OVERRIDE;
|
||||
|
||||
void clearDirty() { dirtyRegion = QRegion(); }
|
||||
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
|
Loading…
x
Reference in New Issue
Block a user