From c7537e30ba4698b52d90b68875af16285785bf70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 14 Apr 2011 15:48:36 +0200 Subject: Remove hasOpenGL. This changes breaks binary compatibillity so you will need to use $QTBUILDDIR/bin/syncqt and recompile all applications --- src/gui/kernel/qplatformintegration_qpa.cpp | 10 ---------- src/gui/kernel/qplatformintegration_qpa.h | 4 +--- src/opengl/qgl.cpp | 4 ---- src/opengl/qgl_qpa.cpp | 3 ++- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 4 ++-- src/plugins/platforms/eglfs/qeglfsscreen.h | 1 + src/plugins/platforms/eglfs/qeglfswindow.h | 3 --- src/plugins/platforms/openkode/qopenkodeintegration.cpp | 6 +----- src/plugins/platforms/openkode/qopenkodeintegration.h | 2 -- src/plugins/platforms/wayland/qwaylandintegration.cpp | 1 + src/plugins/platforms/wayland/qwaylandintegration.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 9 +++++++++ src/plugins/platforms/xcb/qxcbintegration.h | 3 ++- src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++-- src/plugins/platforms/xlib/qxlibintegration.cpp | 9 +++++++++ src/plugins/platforms/xlib/qxlibintegration.h | 3 ++- src/plugins/platforms/xlib/qxlibwindow.cpp | 4 ++-- 17 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index c45a953..d559c53 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -69,16 +69,6 @@ QPlatformEventLoopIntegration *QPlatformIntegration::createEventLoopIntegration( } /*! - Returns whether the given platform integration supports OpenGL. - - Default implementation returns false, -*/ -bool QPlatformIntegration::hasOpenGL() const -{ - return false; -} - -/*! Accessor for the platform integrations fontdatabase. Default implementation returns a default QPlatformFontDatabase. diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 0aacefa..d06272c 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -67,6 +67,7 @@ class Q_GUI_EXPORT QPlatformIntegration public: enum Capability { ThreadedPixmaps = 1, + OpenGL = 2 }; virtual ~QPlatformIntegration() { } @@ -95,9 +96,6 @@ public: // the gui thread. All of the functions in QWindowSystemInterface are thread safe. virtual QPlatformEventLoopIntegration *createEventLoopIntegration() const; -//jl:XXX should it be hasGLContext and do we need it at all? - virtual bool hasOpenGL() const; - // Access native handles. The window handle is already available from Wid; virtual QPlatformNativeInterface *nativeInterface() const; }; diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index b3b459d..057fb55 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1423,10 +1423,6 @@ QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags() } } -#ifdef Q_WS_QPA - hasOpenGL(); // ### I have no idea why this is needed here, but it makes things work for testlite -#endif - QString versionString(QLatin1String(reinterpret_cast(glGetString(GL_VERSION)))); OpenGLVersionFlags versionFlags = qOpenGLVersionFlagsFromString(versionString); if (currentCtx) { diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 4bac1fb..994344c 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -127,7 +127,8 @@ void QGLContextPrivate::setupSharing() { bool QGLFormat::hasOpenGL() { - return QApplicationPrivate::platformIntegration()->hasOpenGL(); + return QApplicationPrivate::platformIntegration() + ->hasCapability(QPlatformIntegration::OpenGL); } void qDeleteQGLContext(void *handle) diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 78981f9..1bc0806 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -44,12 +44,12 @@ #include "qeglfswindow.h" #include "qeglfswindowsurface.h" +#include "qgenericunixfontdatabase.h" + #include #include #include -#include "qgenericunixfontdatabase.h" - #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h index 6a2a504..f300842 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.h +++ b/src/plugins/platforms/eglfs/qeglfsscreen.h @@ -44,6 +44,7 @@ #include +#include #include diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h index ad51114..f125eab 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.h +++ b/src/plugins/platforms/eglfs/qeglfswindow.h @@ -45,12 +45,9 @@ #include "qeglfsintegration.h" #include "qeglfsscreen.h" - #include #include -#include - QT_BEGIN_NAMESPACE class QEglFSWindow : public QPlatformWindow diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index e98f322..703b1a9 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -192,6 +192,7 @@ bool QOpenKODEIntegration::hasCapability(QPlatformIntegration::Capability cap) c { switch (cap) { case ThreadedPixmaps: return true; + case OpenGL: return true; default: return QPlatformIntegration::hasCapability(cap); } } @@ -228,11 +229,6 @@ QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId) return returnSurface; } -bool QOpenKODEIntegration::hasOpenGL() const -{ - return true; -} - QPlatformEventLoopIntegration *QOpenKODEIntegration::createEventLoopIntegration() const { if (!mEventLoopIntegration) { diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index a788091..d5aac98 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -96,8 +96,6 @@ public: QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - bool hasOpenGL() const; - QPlatformEventLoopIntegration *createEventLoopIntegration() const; QPlatformFontDatabase *fontDatabase() const; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 04f3d9a..3f3ee5e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -75,6 +75,7 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co { switch (cap) { case ThreadedPixmaps: return true; + case OpenGL: return hasOpenGL(); default: return QPlatformIntegration::hasCapability(cap); } } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index 20f8c5c..fc9b8d6 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -63,9 +63,9 @@ public: QPlatformFontDatabase *fontDatabase() const; +private: bool hasOpenGL() const; -private: QPlatformFontDatabase *mFontDb; QWaylandDisplay *mDisplay; bool mUseOpenGL; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 63c26a1..9df5f14 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -73,6 +73,15 @@ QXcbIntegration::~QXcbIntegration() delete m_connection; } +bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + case OpenGL: return hasOpenGL(); + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QXcbIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 6c9634e..d27fd71 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -55,6 +55,7 @@ public: QXcbIntegration(); ~QXcbIntegration(); + bool hasCapability(Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; @@ -65,11 +66,11 @@ public: QPixmap grabWindow(WId window, int x, int y, int width, int height) const; QPlatformFontDatabase *fontDatabase() const; - bool hasOpenGL() const; QPlatformNativeInterface *nativeInterface()const; private: + bool hasOpenGL() const; QList m_screens; QXcbConnection *m_connection; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 107e004..0456638 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -113,7 +113,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw) #if defined(XCB_USE_GLX) || defined(XCB_USE_EGL) if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasOpenGL()) + && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) { #if defined(XCB_USE_GLX) XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), tlw->platformWindowFormat()); @@ -491,7 +491,7 @@ void QXcbWindow::requestActivateWindow() QPlatformGLContext *QXcbWindow::glContext() const { - if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) { + if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) { printf("no opengl\n"); return 0; } diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index 8deb2f3..78f907a 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -73,6 +73,15 @@ QXlibIntegration::QXlibIntegration(bool useOpenGL) mScreens.append(mPrimaryScreen); } +bool QXlibIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + case OpenGL: return hasOpenGL(); + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const { #ifndef QT_NO_OPENGL diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h index f8efae0..1a2515a 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.h +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -60,6 +60,7 @@ class QXlibIntegration : public QPlatformIntegration public: QXlibIntegration(bool useOpenGL = false); + bool hasCapability(Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; @@ -73,9 +74,9 @@ public: QPlatformNativeInterface *nativeInterface() const; +private: bool hasOpenGL() const; -private: bool mUseOpenGL; QXlibScreen *mPrimaryScreen; QList mScreens; diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 82e377c..9a05fc6 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -81,7 +81,7 @@ QXlibWindow::QXlibWindow(QWidget *window) int h = window->height(); if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { + && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) ) { #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) XVisualInfo *visualInfo = qglx_findVisualInfo(mScreen->display()->nativeDisplay(),mScreen->xScreenNumber(),window->platformWindowFormat()); @@ -656,7 +656,7 @@ void QXlibWindow::setCursor(const Cursor &cursor) QPlatformGLContext *QXlibWindow::glContext() const { - if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) + if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) return 0; if (!mGLContext) { QXlibWindow *that = const_cast(this); -- cgit v0.12