Move to new hardware structure for the platform plugins

Change-Id: I0d383e4cdd59c4e4eae5506c814f0c80ecbf58ae
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
Jorgen Lind 2013-11-20 16:19:46 +01:00 committed by The Qt Project
parent e9613ce5b7
commit 6000c4af02
4 changed files with 27 additions and 53 deletions

View File

@ -42,6 +42,7 @@
#include "qwaylanddisplay.h"
#include "qwaylandeventthread.h"
#include "qwaylandintegration.h"
#include "qwaylandwindow.h"
#include "qwaylandscreen.h"
#include "qwaylandcursor.h"
@ -49,9 +50,7 @@
#include "qwaylandclipboard.h"
#include "qwaylanddatadevicemanager.h"
#ifdef QT_WAYLAND_GL_SUPPORT
#include "qwaylandglintegration.h"
#endif
#include "qwaylandwindowmanagerintegration.h"
@ -79,14 +78,12 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle)
return surface;
}
#ifdef QT_WAYLAND_GL_SUPPORT
QWaylandGLIntegration * QWaylandDisplay::eglIntegration()
QWaylandGLIntegration * QWaylandDisplay::glIntegration() const
{
return mEglIntegration;
return mWaylandIntegration->glIntegration();
}
#endif
QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration()
QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() const
{
return mWindowManagerIntegration;
}
@ -103,8 +100,9 @@ void QWaylandDisplay::setLastKeyboardFocusInputDevice(QWaylandInputDevice *devic
static QWaylandDisplay *display = 0;
QWaylandDisplay::QWaylandDisplay()
: mLastKeyboardFocusInputDevice(0)
QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
: mWaylandIntegration(waylandIntegration)
, mLastKeyboardFocusInputDevice(0)
, mDndSelectionHandler(0)
, mWindowExtension(0)
, mSubSurfaceExtension(0)
@ -134,30 +132,15 @@ QWaylandDisplay::QWaylandDisplay()
connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests()));
#ifdef QT_WAYLAND_GL_SUPPORT
//mEglIntegration = QWaylandGLIntegration::createGLIntegration(this);
#endif
mWindowManagerIntegration = new QWaylandWindowManagerIntegration(this);
blockingReadEvents();
#ifdef QT_WAYLAND_GL_SUPPORT
mEglIntegration->initialize();
flushRequests();
while (mEglIntegration->waitingForEvents())
blockingReadEvents();
#endif
waitForScreens();
}
QWaylandDisplay::~QWaylandDisplay(void)
{
#ifdef QT_WAYLAND_GL_SUPPORT
delete mEglIntegration;
#endif
mEventThread->quit();
mEventThread->wait();
delete mEventThreadObject;
@ -172,6 +155,7 @@ void QWaylandDisplay::flushRequests()
wl_display_flush(mDisplay);
}
void QWaylandDisplay::blockingReadEvents()
{
if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && errno == EPIPE) {

View File

@ -69,6 +69,7 @@ class QWaylandTouchExtension;
class QWaylandQtKeyExtension;
class QWaylandWindow;
class QWaylandEventThread;
class QWaylandIntegration;
namespace QtWayland {
class qt_output_extension;
@ -88,7 +89,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland
Q_OBJECT
public:
QWaylandDisplay(void);
QWaylandDisplay(QWaylandIntegration *waylandIntegration);
~QWaylandDisplay(void);
QList<QPlatformScreen *> screens() const { return mScreens; }
@ -97,11 +98,9 @@ public:
struct wl_surface *createSurface(void *handle);
#ifdef QT_WAYLAND_GL_SUPPORT
QWaylandGLIntegration *eglIntegration();
#endif
QWaylandGLIntegration *glIntegration() const;
QWaylandWindowManagerIntegration *windowManagerIntegration();
QWaylandWindowManagerIntegration *windowManagerIntegration() const;
void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image);
@ -161,6 +160,7 @@ private:
QList<QPlatformScreen *> mScreens;
QList<QWaylandInputDevice *> mInputDevices;
QList<Listener> mRegistryListeners;
QWaylandIntegration *mWaylandIntegration;
QWaylandInputDevice *mLastKeyboardFocusInputDevice;
QWaylandDataDeviceManager *mDndSelectionHandler;
QtWayland::qt_surface_extension *mWindowExtension;
@ -178,10 +178,6 @@ private:
void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE;
#ifdef QT_WAYLAND_GL_SUPPORT
QWaylandGLIntegration *mEglIntegration;
#endif
static void shellHandleConfigure(void *data, struct wl_shell *shell,
uint32_t time, uint32_t edges,
struct wl_surface *surface,

View File

@ -110,7 +110,7 @@ QWaylandIntegration::QWaylandIntegration()
, mAccessibility(0)
#endif
{
mDisplay = new QWaylandDisplay();
mDisplay = new QWaylandDisplay(this);
mClipboard = new QWaylandClipboard(mDisplay);
mDrag = new QWaylandDrag(mDisplay);
@ -141,17 +141,9 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
switch (cap) {
case ThreadedPixmaps: return true;
case OpenGL:
#ifdef QT_WAYLAND_GL_SUPPORT
return true;
#else
return false;
#endif
return mDisplay->glIntegration();
case ThreadedOpenGL:
#ifdef QT_WAYLAND_GL_SUPPORT
return mDisplay->eglIntegration()->supportsThreadedOpenGL();
#else
return false;
#endif
return mDisplay->glIntegration() && mDisplay->glIntegration()->supportsThreadedOpenGL();
case BufferQueueingOpenGL:
return true;
case MultipleWindows:
@ -163,21 +155,16 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const
{
#ifdef QT_WAYLAND_GL_SUPPORT
if (window->surfaceType() == QWindow::OpenGLSurface)
return mDisplay->eglIntegration()->createEglWindow(window);
#endif
if (window->surfaceType() == QWindow::OpenGLSurface && mDisplay->glIntegration())
return mDisplay->glIntegration()->createEglWindow(window);
return new QWaylandShmWindow(window);
}
QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
#ifdef QT_WAYLAND_GL_SUPPORT
return mDisplay->eglIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle());
#else
Q_UNUSED(context);
if (mDisplay->glIntegration())
return mDisplay->glIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle());
return 0;
#endif
}
QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const
@ -249,4 +236,9 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co
return GenericWaylandTheme::createUnixTheme(name);
}
QWaylandGLIntegration *QWaylandIntegration::glIntegration() const
{
return 0;
}
QT_END_NAMESPACE

View File

@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
class QWaylandBuffer;
class QWaylandDisplay;
class QWaylandGLIntegration;
class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration
{
@ -86,6 +87,7 @@ public:
QPlatformTheme *createPlatformTheme(const QString &name) const;
virtual QWaylandGLIntegration *glIntegration() const;
private:
QPlatformFontDatabase *mFontDb;
QPlatformClipboard *mClipboard;