From 1f50a3aa50b934a181cd0d18c260f2533ab63d43 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 24 Feb 2011 17:31:15 +0100 Subject: Make it build when EGL is not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 12 ++++++++++- src/plugins/platforms/wayland/qwaylandinclude.h | 6 ++++++ .../platforms/wayland/qwaylandintegration.cpp | 4 ++++ src/plugins/platforms/wayland/wayland.pro | 24 ++++++++++++++-------- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ca23165..c3e87a1 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -171,8 +171,9 @@ void QWaylandDisplay::flushRequests(void) QWaylandDisplay::QWaylandDisplay(void) : mWriteNotifier(0) { +#ifdef QT_WAYLAND_GL_SUPPORT EGLint major, minor; - +#endif mDisplay = wl_display_connect(NULL); if (mDisplay == NULL) { fprintf(stderr, "failed to create display: %m\n"); @@ -182,6 +183,7 @@ QWaylandDisplay::QWaylandDisplay(void) wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this); +#ifdef QT_WAYLAND_GL_SUPPORT mNativeEglDisplay = wl_egl_display_create(mDisplay); mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); @@ -193,6 +195,12 @@ QWaylandDisplay::QWaylandDisplay(void) return; } } +#else + mNativeEglDisplay = 0; + mEglDisplay = 0; +#endif + + eventDispatcher(); int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); @@ -208,7 +216,9 @@ QWaylandDisplay::QWaylandDisplay(void) QWaylandDisplay::~QWaylandDisplay(void) { close(mFd); +#ifdef QT_WAYLAND_GL_SUPPORT eglTerminate(mEglDisplay); +#endif wl_display_destroy(mDisplay); } diff --git a/src/plugins/platforms/wayland/qwaylandinclude.h b/src/plugins/platforms/wayland/qwaylandinclude.h index afaa885..0135251 100644 --- a/src/plugins/platforms/wayland/qwaylandinclude.h +++ b/src/plugins/platforms/wayland/qwaylandinclude.h @@ -44,6 +44,7 @@ #include +#ifdef QT_WAYLAND_GL_SUPPORT #include #define GL_GLEXT_PROTOTYPES @@ -54,4 +55,9 @@ #include #include +#else +typedef void* EGLDisplay; +typedef void* EGLConfig; +#endif + #endif // QWAYLANDINCLUDE_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9483a47..7c0f69e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -54,7 +54,9 @@ #include #include +#ifdef QT_WAYLAND_GL_SUPPORT #include +#endif QWaylandIntegration::QWaylandIntegration(bool useOpenGL) : mFontDb(new QFontconfigDatabase()) @@ -71,8 +73,10 @@ QWaylandIntegration::screens() const QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) const { +#ifdef QT_WAYLAND_GL_SUPPORT if (mUseOpenGL) return new QGLPixmapData(type); +#endif return new QRasterPixmapData(type); } diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index e40e423..9faa59b 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -8,15 +8,11 @@ DEFINES += Q_PLATFORM_WAYLAND SOURCES = main.cpp \ qwaylandintegration.cpp \ qwaylandshmsurface.cpp \ - qwaylanddrmsurface.cpp \ qwaylandinputdevice.cpp \ - qwaylandglcontext.cpp \ qwaylandcursor.cpp \ qwaylanddisplay.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - qwaylandeglwindow.cpp \ qwaylandshmwindow.cpp HEADERS = qwaylandintegration.h \ @@ -24,19 +20,31 @@ HEADERS = qwaylandintegration.h \ qwaylanddisplay.h \ qwaylandwindow.h \ qwaylandscreen.h \ - qwaylandglcontext.h \ qwaylandshmsurface.h \ qwaylanddrmsurface.h \ qwaylandbuffer.h \ - ../eglconvenience/qeglconvenience.h \ qwaylandinclude.h \ qwaylandeglwindow.h \ qwaylandshmwindow.h -contains(QT_CONFIG, opengl) { +LIBS += -lwayland-client +LIBS += -lxkbcommon + +contains(QT_CONFIG, opengles2) { QT += opengl + LIBS += -lwayland-egl -lEGL + + SOURCES += qwaylanddrmsurface.cpp \ + qwaylandglcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qwaylandeglwindow.cpp + + HEADERS += qwaylandglcontext.h \ + ../eglconvenience/qeglconvenience.h \ + + DEFINES += QT_WAYLAND_GL_SUPPORT } -LIBS += -lwayland-client -lwayland-egl -lxkbcommon -lEGL + unix { CONFIG += link_pkgconfig PKGCONFIG += libdrm -- cgit v0.12