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:
parent
e9613ce5b7
commit
6000c4af02
@ -42,6 +42,7 @@
|
|||||||
#include "qwaylanddisplay.h"
|
#include "qwaylanddisplay.h"
|
||||||
|
|
||||||
#include "qwaylandeventthread.h"
|
#include "qwaylandeventthread.h"
|
||||||
|
#include "qwaylandintegration.h"
|
||||||
#include "qwaylandwindow.h"
|
#include "qwaylandwindow.h"
|
||||||
#include "qwaylandscreen.h"
|
#include "qwaylandscreen.h"
|
||||||
#include "qwaylandcursor.h"
|
#include "qwaylandcursor.h"
|
||||||
@ -49,9 +50,7 @@
|
|||||||
#include "qwaylandclipboard.h"
|
#include "qwaylandclipboard.h"
|
||||||
#include "qwaylanddatadevicemanager.h"
|
#include "qwaylanddatadevicemanager.h"
|
||||||
|
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
|
||||||
#include "qwaylandglintegration.h"
|
#include "qwaylandglintegration.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "qwaylandwindowmanagerintegration.h"
|
#include "qwaylandwindowmanagerintegration.h"
|
||||||
|
|
||||||
@ -79,14 +78,12 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle)
|
|||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
QWaylandGLIntegration * QWaylandDisplay::glIntegration() const
|
||||||
QWaylandGLIntegration * QWaylandDisplay::eglIntegration()
|
|
||||||
{
|
{
|
||||||
return mEglIntegration;
|
return mWaylandIntegration->glIntegration();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration()
|
QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() const
|
||||||
{
|
{
|
||||||
return mWindowManagerIntegration;
|
return mWindowManagerIntegration;
|
||||||
}
|
}
|
||||||
@ -103,8 +100,9 @@ void QWaylandDisplay::setLastKeyboardFocusInputDevice(QWaylandInputDevice *devic
|
|||||||
|
|
||||||
static QWaylandDisplay *display = 0;
|
static QWaylandDisplay *display = 0;
|
||||||
|
|
||||||
QWaylandDisplay::QWaylandDisplay()
|
QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
|
||||||
: mLastKeyboardFocusInputDevice(0)
|
: mWaylandIntegration(waylandIntegration)
|
||||||
|
, mLastKeyboardFocusInputDevice(0)
|
||||||
, mDndSelectionHandler(0)
|
, mDndSelectionHandler(0)
|
||||||
, mWindowExtension(0)
|
, mWindowExtension(0)
|
||||||
, mSubSurfaceExtension(0)
|
, mSubSurfaceExtension(0)
|
||||||
@ -134,30 +132,15 @@ QWaylandDisplay::QWaylandDisplay()
|
|||||||
|
|
||||||
connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests()));
|
connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests()));
|
||||||
|
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
|
||||||
//mEglIntegration = QWaylandGLIntegration::createGLIntegration(this);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mWindowManagerIntegration = new QWaylandWindowManagerIntegration(this);
|
mWindowManagerIntegration = new QWaylandWindowManagerIntegration(this);
|
||||||
|
|
||||||
blockingReadEvents();
|
blockingReadEvents();
|
||||||
|
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
|
||||||
mEglIntegration->initialize();
|
|
||||||
|
|
||||||
flushRequests();
|
|
||||||
while (mEglIntegration->waitingForEvents())
|
|
||||||
blockingReadEvents();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
waitForScreens();
|
waitForScreens();
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandDisplay::~QWaylandDisplay(void)
|
QWaylandDisplay::~QWaylandDisplay(void)
|
||||||
{
|
{
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
|
||||||
delete mEglIntegration;
|
|
||||||
#endif
|
|
||||||
mEventThread->quit();
|
mEventThread->quit();
|
||||||
mEventThread->wait();
|
mEventThread->wait();
|
||||||
delete mEventThreadObject;
|
delete mEventThreadObject;
|
||||||
@ -172,6 +155,7 @@ void QWaylandDisplay::flushRequests()
|
|||||||
wl_display_flush(mDisplay);
|
wl_display_flush(mDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QWaylandDisplay::blockingReadEvents()
|
void QWaylandDisplay::blockingReadEvents()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && errno == EPIPE) {
|
if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && errno == EPIPE) {
|
||||||
|
@ -69,6 +69,7 @@ class QWaylandTouchExtension;
|
|||||||
class QWaylandQtKeyExtension;
|
class QWaylandQtKeyExtension;
|
||||||
class QWaylandWindow;
|
class QWaylandWindow;
|
||||||
class QWaylandEventThread;
|
class QWaylandEventThread;
|
||||||
|
class QWaylandIntegration;
|
||||||
|
|
||||||
namespace QtWayland {
|
namespace QtWayland {
|
||||||
class qt_output_extension;
|
class qt_output_extension;
|
||||||
@ -88,7 +89,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandDisplay : public QObject, public QtWayland
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QWaylandDisplay(void);
|
QWaylandDisplay(QWaylandIntegration *waylandIntegration);
|
||||||
~QWaylandDisplay(void);
|
~QWaylandDisplay(void);
|
||||||
|
|
||||||
QList<QPlatformScreen *> screens() const { return mScreens; }
|
QList<QPlatformScreen *> screens() const { return mScreens; }
|
||||||
@ -97,11 +98,9 @@ public:
|
|||||||
|
|
||||||
struct wl_surface *createSurface(void *handle);
|
struct wl_surface *createSurface(void *handle);
|
||||||
|
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
QWaylandGLIntegration *glIntegration() const;
|
||||||
QWaylandGLIntegration *eglIntegration();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QWaylandWindowManagerIntegration *windowManagerIntegration();
|
QWaylandWindowManagerIntegration *windowManagerIntegration() const;
|
||||||
|
|
||||||
void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image);
|
void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image);
|
||||||
|
|
||||||
@ -161,6 +160,7 @@ private:
|
|||||||
QList<QPlatformScreen *> mScreens;
|
QList<QPlatformScreen *> mScreens;
|
||||||
QList<QWaylandInputDevice *> mInputDevices;
|
QList<QWaylandInputDevice *> mInputDevices;
|
||||||
QList<Listener> mRegistryListeners;
|
QList<Listener> mRegistryListeners;
|
||||||
|
QWaylandIntegration *mWaylandIntegration;
|
||||||
QWaylandInputDevice *mLastKeyboardFocusInputDevice;
|
QWaylandInputDevice *mLastKeyboardFocusInputDevice;
|
||||||
QWaylandDataDeviceManager *mDndSelectionHandler;
|
QWaylandDataDeviceManager *mDndSelectionHandler;
|
||||||
QtWayland::qt_surface_extension *mWindowExtension;
|
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;
|
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,
|
static void shellHandleConfigure(void *data, struct wl_shell *shell,
|
||||||
uint32_t time, uint32_t edges,
|
uint32_t time, uint32_t edges,
|
||||||
struct wl_surface *surface,
|
struct wl_surface *surface,
|
||||||
|
@ -110,7 +110,7 @@ QWaylandIntegration::QWaylandIntegration()
|
|||||||
, mAccessibility(0)
|
, mAccessibility(0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mDisplay = new QWaylandDisplay();
|
mDisplay = new QWaylandDisplay(this);
|
||||||
mClipboard = new QWaylandClipboard(mDisplay);
|
mClipboard = new QWaylandClipboard(mDisplay);
|
||||||
mDrag = new QWaylandDrag(mDisplay);
|
mDrag = new QWaylandDrag(mDisplay);
|
||||||
|
|
||||||
@ -141,17 +141,9 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
|
|||||||
switch (cap) {
|
switch (cap) {
|
||||||
case ThreadedPixmaps: return true;
|
case ThreadedPixmaps: return true;
|
||||||
case OpenGL:
|
case OpenGL:
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
return mDisplay->glIntegration();
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
case ThreadedOpenGL:
|
case ThreadedOpenGL:
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
return mDisplay->glIntegration() && mDisplay->glIntegration()->supportsThreadedOpenGL();
|
||||||
return mDisplay->eglIntegration()->supportsThreadedOpenGL();
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
case BufferQueueingOpenGL:
|
case BufferQueueingOpenGL:
|
||||||
return true;
|
return true;
|
||||||
case MultipleWindows:
|
case MultipleWindows:
|
||||||
@ -163,21 +155,16 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
|
|||||||
|
|
||||||
QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const
|
QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const
|
||||||
{
|
{
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
if (window->surfaceType() == QWindow::OpenGLSurface && mDisplay->glIntegration())
|
||||||
if (window->surfaceType() == QWindow::OpenGLSurface)
|
return mDisplay->glIntegration()->createEglWindow(window);
|
||||||
return mDisplay->eglIntegration()->createEglWindow(window);
|
|
||||||
#endif
|
|
||||||
return new QWaylandShmWindow(window);
|
return new QWaylandShmWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
||||||
{
|
{
|
||||||
#ifdef QT_WAYLAND_GL_SUPPORT
|
if (mDisplay->glIntegration())
|
||||||
return mDisplay->eglIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle());
|
return mDisplay->glIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle());
|
||||||
#else
|
|
||||||
Q_UNUSED(context);
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const
|
QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const
|
||||||
@ -249,4 +236,9 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co
|
|||||||
return GenericWaylandTheme::createUnixTheme(name);
|
return GenericWaylandTheme::createUnixTheme(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandGLIntegration *QWaylandIntegration::glIntegration() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
class QWaylandBuffer;
|
class QWaylandBuffer;
|
||||||
class QWaylandDisplay;
|
class QWaylandDisplay;
|
||||||
|
class QWaylandGLIntegration;
|
||||||
|
|
||||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration
|
||||||
{
|
{
|
||||||
@ -86,6 +87,7 @@ public:
|
|||||||
|
|
||||||
QPlatformTheme *createPlatformTheme(const QString &name) const;
|
QPlatformTheme *createPlatformTheme(const QString &name) const;
|
||||||
|
|
||||||
|
virtual QWaylandGLIntegration *glIntegration() const;
|
||||||
private:
|
private:
|
||||||
QPlatformFontDatabase *mFontDb;
|
QPlatformFontDatabase *mFontDb;
|
||||||
QPlatformClipboard *mClipboard;
|
QPlatformClipboard *mClipboard;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user