From 467e8a19c4e6c3bd4bd7d3e0afcd7b435bd4d6ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Samuel=20R=C3=B8dal?= Date: Wed, 22 Jun 2011 16:26:02 +0200 Subject: [PATCH] Get wayland plugin working again. --- .../gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 7 +++++-- src/plugins/platforms/wayland/qwaylanddisplay.h | 3 +++ src/plugins/platforms/wayland/qwaylandintegration.cpp | 10 ++++++---- src/plugins/platforms/wayland/qwaylandwindow.cpp | 1 + 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp index 41824b0..35c3ca3 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp @@ -104,7 +104,7 @@ void QWaylandReadbackGlxWindow::createSurface() XSync(m_glxIntegration->xDisplay(), False); if (!m_config) - m_config = qglx_findConfig(m_glxIntegration->xDisplay(), m_glxIntegration->screen(), m_window->glFormat()); + m_config = qglx_findConfig(m_glxIntegration->xDisplay(), m_glxIntegration->screen(), m_window->format()); m_glxPixmap = glXCreatePixmap(m_glxIntegration->xDisplay(), m_config, m_pixmap,0); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 6f61cf1..d501659 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -152,9 +152,12 @@ QWaylandDisplay::QWaylandDisplay(void) mEglIntegration->initialize(); #endif - connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); - mFd = wl_display_get_fd(mDisplay, sourceUpdate, this); +} + +void QWaylandDisplay::eventDispatcherCreated(QAbstractEventDispatcher *dispatcher) +{ + connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); mReadNotifier = new QSocketNotifier(mFd, QSocketNotifier::Read, this); connect(mReadNotifier, SIGNAL(activated(int)), this, SLOT(readEvents())); diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 5226f0d..840f768 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -49,6 +49,7 @@ #include +class QAbstractEventDispatcher; class QWaylandInputDevice; class QSocketNotifier; class QWaylandBuffer; @@ -91,6 +92,8 @@ public: QList inputDevices() const { return mInputDevices; } + void eventDispatcherCreated(QAbstractEventDispatcher *dispatcher); + public slots: void createNewScreen(struct wl_output *output, QRect geometry); void readEvents(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index bdd8235..1f1ecda 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -101,10 +101,10 @@ QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const { #ifdef QT_WAYLAND_GL_SUPPORT - return mDisplay->eglIntegration()->createEglWindow(window); -#else - return new QWaylandShmWindow(window); + if (window->surfaceType() == QWindow::OpenGLSurface) + return mDisplay->eglIntegration()->createEglWindow(window); #endif + return new QWaylandShmWindow(window); } QPlatformGLContext *QWaylandIntegration::createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const @@ -125,7 +125,9 @@ QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow * QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const { - return createUnixEventDispatcher(); + QAbstractEventDispatcher *dispatcher = createUnixEventDispatcher(); + mDisplay->eventDispatcherCreated(dispatcher); + return dispatcher; } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index ec62a3c..34fcdad 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -104,6 +104,7 @@ void QWaylandWindow::setVisible(bool visible) if (visible) { wl_surface_map_toplevel(mSurface); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); } else { wl_surface_destroy(mSurface); mSurface = NULL; -- 2.7.4