summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-11-15 15:18:25 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-11-22 13:12:47 (GMT)
commit687d44569dbccea72c582c6d7da9a271ae2c86c8 (patch)
treec20aa5e504e8fbbf85068be824053a30eea2e025 /src
parentc5a085cb82a9b8e91e37575e19014b60dd2e4216 (diff)
downloadQt-687d44569dbccea72c582c6d7da9a271ae2c86c8.zip
Qt-687d44569dbccea72c582c6d7da9a271ae2c86c8.tar.gz
Qt-687d44569dbccea72c582c6d7da9a271ae2c86c8.tar.bz2
No more windowsurface for QGLWidget in Lighthouse
Reviewed-by: paul
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qplatformwindowformat_qpa.cpp39
-rw-r--r--src/gui/kernel/qplatformwindowformat_qpa.h16
-rw-r--r--src/gui/kernel/qwidget_qpa.cpp7
-rw-r--r--src/opengl/qgl_qpa.cpp1
4 files changed, 35 insertions, 28 deletions
diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp
index d497e85..f0dad17 100644
--- a/src/gui/kernel/qplatformwindowformat_qpa.cpp
+++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp
@@ -53,7 +53,7 @@ public:
, opts(QPlatformWindowFormat::DoubleBuffer | QPlatformWindowFormat::DepthBuffer
| QPlatformWindowFormat::Rgba | QPlatformWindowFormat::DirectRendering
| QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions
- | QPlatformWindowFormat::UseDefaultSharedContext)
+ | QPlatformWindowFormat::UseDefaultSharedContext | QPlatformWindowFormat::HasWindowSurface)
, depthSize(-1)
, accumSize(-1)
, stencilSize(-1)
@@ -616,31 +616,32 @@ QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const
return d->sharedContext;
}
-///*!
-// \fn bool QPlatformWindowFormat::hasOverlay() const
+/*!
+ \fn bool QPlatformWindowFormat::hasWindowSurface() const
-// Returns true if overlay plane is enabled; otherwise returns false.
+ Returns true if the corresponding widget has an instance of QWindowSurface.
-// Overlay is disabled by default.
+ Otherwise returns false.
-// \sa setOverlay()
-//*/
+ WindowSurface is enabled by default.
-///*!
-// If \a enable is true enables an overlay plane; otherwise disables
-// the overlay plane.
+ \sa setOverlay()
+*/
-// Enabling the overlay plane will cause QGLWidget to create an
-// additional context in an overlay plane. See the QGLWidget
-// documentation for further information.
+/*!
+ If \a enable is true a top level QWidget will create a QWindowSurface at creation;
-// \sa hasOverlay()
-//*/
+ otherwise the QWidget will only have a QPlatformWindow.
-//void QPlatformWindowFormat::setOverlay(bool enable)
-//{
-// setOption(enable ? QPlatformWindowFormat::HasOverlay : QPlatformWindowFormat::NoOverlay);
-//}
+ This is usefull for ie. QGLWidget where the QPlatformGLContext controlls the surface.
+
+ \sa hasOverlay()
+*/
+
+void QPlatformWindowFormat::setWindowSurface(bool enable)
+{
+ setOption(enable ? QPlatformWindowFormat::HasWindowSurface : QPlatformWindowFormat::NoWindowSurface);
+}
/*!
Sets the format option to \a opt.
diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h
index 63df76a..790385b 100644
--- a/src/gui/kernel/qplatformwindowformat_qpa.h
+++ b/src/gui/kernel/qplatformwindowformat_qpa.h
@@ -67,6 +67,7 @@ public:
SampleBuffers = 0x0200,
DeprecatedFunctions = 0x0400,
UseDefaultSharedContext = 0x0800,
+ HasWindowSurface = 0x1000,
SingleBuffer = DoubleBuffer << 16,
NoDepthBuffer = DepthBuffer << 16,
ColorIndex = Rgba << 16,
@@ -78,7 +79,8 @@ public:
NoOverlay = HasOverlay << 16,
NoSampleBuffers = SampleBuffers << 16,
NoDeprecatedFunctions = DeprecatedFunctions << 16,
- NoDefaultSharedContext = UseDefaultSharedContext << 16
+ NoDefaultSharedContext = UseDefaultSharedContext << 16,
+ NoWindowSurface = HasWindowSurface << 16
};
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
@@ -149,8 +151,8 @@ public:
void setDirectRendering(bool enable);
bool useDefaultSharedContext() const;
void setUseDefaultSharedContext(bool enable);
-// bool hasOverlay() const;
-// void setOverlay(bool enable);
+ bool hasWindowSurface() const;
+ void setWindowSurface(bool enable);
void setOption(QPlatformWindowFormat::FormatOptions opt);
bool testOption(QPlatformWindowFormat::FormatOptions opt) const;
@@ -219,10 +221,10 @@ inline bool QPlatformWindowFormat::directRendering() const
return testOption(QPlatformWindowFormat::DirectRendering);
}
-//inline bool QPlatformWindowFormat::hasOverlay() const
-//{
-// return testOption(QPlatformWindowFormat::HasOverlay);
-//}
+inline bool QPlatformWindowFormat::hasWindowSurface() const
+{
+ return testOption(QPlatformWindowFormat::HasWindowSurface);
+}
inline bool QPlatformWindowFormat::sampleBuffers() const
{
diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp
index ac8b37d..aff959e 100644
--- a/src/gui/kernel/qwidget_qpa.cpp
+++ b/src/gui/kernel/qwidget_qpa.cpp
@@ -97,7 +97,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
}
Q_ASSERT(platformWindow);
- if (!surface) {
+ if (!surface && platformWindow && q->platformWindowFormat().hasWindowSurface()) {
surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId());
}
@@ -831,7 +831,10 @@ QPaintEngine *QWidget::paintEngine() const
QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys()
{
Q_Q(QWidget);
- return QApplicationPrivate::platformIntegration()->createWindowSurface(q,0);
+ if (q->platformWindowFormat().hasWindowSurface())
+ return QApplicationPrivate::platformIntegration()->createWindowSurface(q,0);
+ else
+ return 0;
}
void QWidgetPrivate::setModal_sys()
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index 4b530de..1197013 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -134,6 +134,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
winFormat.setSharedContext(shareContext->d_func()->platformContext);
}
winFormat.setWindowApi(QPlatformWindowFormat::OpenGL);
+ winFormat.setWindowSurface(false);
widget->setPlatformWindowFormat(winFormat);
widget->winId();//make window
}