Add a WindowManagement capability to QPlatformIntegration

To be set to false by eglfs and similar platforms where no real window
management is provided.

When this capability is not set, some of the changes done for
QTBUG-26903 will be disabled, allowing dialogs to show up at their
QDialog-chosen place on platforms where no WM is present and so
windows are never repositioned by the system.

Change-Id: If1dac3cd11f2a856913a51277431fe3ec644b719
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
Laszlo Agocs 2013-09-13 16:34:48 +02:00 committed by The Qt Project
parent d18ccbb5be
commit 7e2b238c50
4 changed files with 13 additions and 4 deletions

View File

@ -224,6 +224,11 @@ QPlatformServices *QPlatformIntegration::services() const
fill the screen. The default implementation returns true. Returning false for fill the screen. The default implementation returns true. Returning false for
this will cause all windows, including dialogs and popups, to be resized to fill the this will cause all windows, including dialogs and popups, to be resized to fill the
screen. screen.
\value WindowManagement The platform is based on a system that performs window
management. This includes the typical desktop platforms. Can be set to false on
platforms where no window management is available, meaning for example that windows
are never repositioned by the window manager. The default implementation returns true.
*/ */
@ -241,7 +246,7 @@ QPlatformServices *QPlatformIntegration::services() const
bool QPlatformIntegration::hasCapability(Capability cap) const bool QPlatformIntegration::hasCapability(Capability cap) const
{ {
return cap == NonFullScreenWindows || cap == NativeWidgets; return cap == NonFullScreenWindows || cap == NativeWidgets || cap == WindowManagement;
} }
QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const

View File

@ -93,7 +93,8 @@ public:
ApplicationState, ApplicationState,
ForeignWindows, ForeignWindows,
NonFullScreenWindows, NonFullScreenWindows,
NativeWidgets NativeWidgets,
WindowManagement
}; };
virtual ~QPlatformIntegration() { } virtual ~QPlatformIntegration() { }

View File

@ -134,6 +134,7 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
case ThreadedPixmaps: return true; case ThreadedPixmaps: return true;
case OpenGL: return true; case OpenGL: return true;
case ThreadedOpenGL: return true; case ThreadedOpenGL: return true;
case WindowManagement: return false;
default: return QPlatformIntegration::hasCapability(cap); default: return QPlatformIntegration::hasCapability(cap);
} }
} }

View File

@ -110,7 +110,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->setFlags(data.window_flags); win->setFlags(data.window_flags);
fixPosIncludesFrame(); fixPosIncludesFrame();
if (q->testAttribute(Qt::WA_Moved)) if (q->testAttribute(Qt::WA_Moved)
|| !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowManagement))
win->setGeometry(q->geometry()); win->setGeometry(q->geometry());
else else
win->resize(q->size()); win->resize(q->size());
@ -530,7 +531,8 @@ void QWidgetPrivate::show_sys()
} }
const QRect windowRect = window->geometry(); const QRect windowRect = window->geometry();
if (windowRect != geomRect) { if (windowRect != geomRect) {
if (q->testAttribute(Qt::WA_Moved)) if (q->testAttribute(Qt::WA_Moved)
|| !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowManagement))
window->setGeometry(geomRect); window->setGeometry(geomRect);
else else
window->resize(geomRect.size()); window->resize(geomRect.size());