diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-08-03 10:44:00 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-08-03 10:44:00 (GMT) |
commit | 42cdfaf86d34afeb6448723839fef70fe477deed (patch) | |
tree | 8049aa269c5e5234f83ac20d02f1b919869a2e99 /src | |
parent | c0eb289559705e15fe13013c72a218e647ad6d90 (diff) | |
download | Qt-42cdfaf86d34afeb6448723839fef70fe477deed.zip Qt-42cdfaf86d34afeb6448723839fef70fe477deed.tar.gz Qt-42cdfaf86d34afeb6448723839fef70fe477deed.tar.bz2 |
Make QOpenKODEWindow not delete context when in fullscreen mode
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/openkode/qopenkodewindow.cpp | 59 | ||||
-rw-r--r-- | src/plugins/platforms/openkode/qopenkodewindow.h | 2 |
2 files changed, 32 insertions, 29 deletions
diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index c890641..454a50f 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -76,7 +76,7 @@ void kdProcessKeyEvents( const KDEvent *event ) #endif //KD_ATX_keyboard QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) - : QPlatformWindow(tlw) + : QPlatformWindow(tlw), isFullScreen(false) { if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenVG) { m_eglApi = EGL_OPENVG_API; @@ -121,15 +121,14 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) return; } - bool fullscreen = false; KDboolean exclusive(false); if (kdSetWindowPropertybv(m_kdWindow,KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, &exclusive)) { - fullscreen = true; + isFullScreen = true; } - if (fullscreen) { + if (isFullScreen) { tlw->setGeometry(screen->geometry()); - screen->setFullScreen(fullscreen); + screen->setFullScreen(isFullScreen); }else { const KDint windowSize[2] = { tlw->width(), tlw->height() }; if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { @@ -150,7 +149,7 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) - if (!fullscreen || (fullscreen && !QPlatformGLContext::defaultSharedContext())) { + if (!isFullScreen || (isFullScreen && !QPlatformGLContext::defaultSharedContext())) { if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) { qErrnoWarning(kdGetError(), "Could not realize native window"); return; @@ -179,31 +178,33 @@ QOpenKODEWindow::~QOpenKODEWindow() } void QOpenKODEWindow::setGeometry(const QRect &rect) { - if (!m_kdWindow) { + if (isFullScreen) { QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens(); QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0)); widget()->setGeometry(screen->geometry()); return; } bool needToDeleteContext = false; - const QRect geo = geometry(); - if (geo.size() != rect.size()) { - const KDint windowSize[2] = { rect.width(), rect.height() }; - if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { - qErrnoWarning(kdGetError(), "Could not set native window size"); - //return; - } else { - needToDeleteContext = true; + if (!isFullScreen) { + const QRect geo = geometry(); + if (geo.size() != rect.size()) { + const KDint windowSize[2] = { rect.width(), rect.height() }; + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { + qErrnoWarning(kdGetError(), "Could not set native window size"); + //return; + } else { + needToDeleteContext = true; + } } - } - if (geo.topLeft() != rect.topLeft()) { - const KDint windowPos[2] = { rect.x(), rect.y() }; - if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { - qErrnoWarning(kdGetError(), "Could not set native window position"); - //return; - } else { - needToDeleteContext = true; + if (geo.topLeft() != rect.topLeft()) { + const KDint windowPos[2] = { rect.x(), rect.y() }; + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + qErrnoWarning(kdGetError(), "Could not set native window position"); + //return; + } else { + needToDeleteContext = true; + } } } @@ -211,13 +212,13 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) if (needToDeleteContext) { qDebug() << "deleting context"; delete m_platformGlContext; - } - QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens(); - QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0)); - EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); - m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig, - m_eglContextAttrs.data(),surface,m_eglApi); + QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens(); + QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0)); + EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); + m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig, + m_eglContextAttrs.data(),surface,m_eglApi); + } } void QOpenKODEWindow::setVisible(bool visible) diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index 1980c15..27d33d6 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -79,6 +79,8 @@ private: QVector<EGLint> m_eglContextAttrs; EGLenum m_eglApi; QEGLPlatformContext *m_platformGlContext; + + bool isFullScreen; }; QT_END_NAMESPACE |