Compositor: Don't require OpenGL to build the QML APIs

[ChangeLog][Compositor API] The compositor API now works without OpenGL support.

This makes the compositor API work with shared memory clients only. If OpenGL
clients connect they will currently punch holes in the compositor window, but
fixing that is out of scope for this patch.

Fixes: QTBUG-74896
Change-Id: I6c1ba82f28ba9edecf380e471124e15d16f9518e
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2017-01-12 14:04:04 +01:00 committed by Johan Helsing
parent 5de4be4185
commit dfa4796eae
2 changed files with 14 additions and 0 deletions

View File

@ -36,7 +36,9 @@
#include <QPixmap> #include <QPixmap>
#include <QDrag> #include <QDrag>
#include <QWindow> #include <QWindow>
#if QT_CONFIG(opengl)
#include <QOpenGLWindow> #include <QOpenGLWindow>
#endif
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <QtWaylandClient/private/qwaylandintegration_p.h> #include <QtWaylandClient/private/qwaylandintegration_p.h>
@ -107,6 +109,7 @@ public:
QPoint mousePressPos; QPoint mousePressPos;
}; };
#if QT_CONFIG(opengl)
class TestGlWindow : public QOpenGLWindow class TestGlWindow : public QOpenGLWindow
{ {
Q_OBJECT Q_OBJECT
@ -136,6 +139,7 @@ void TestGlWindow::paintGL()
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
++paintGLCalled; ++paintGLCalled;
} }
#endif // QT_CONFIG(opengl)
class tst_WaylandClient : public QObject class tst_WaylandClient : public QObject
{ {
@ -176,7 +180,9 @@ private slots:
void dontCrashOnMultipleCommits(); void dontCrashOnMultipleCommits();
void hiddenTransientParent(); void hiddenTransientParent();
void hiddenPopupParent(); void hiddenPopupParent();
#if QT_CONFIG(opengl)
void glWindow(); void glWindow();
#endif // QT_CONFIG(opengl)
void longWindowTitle(); void longWindowTitle();
private: private:
@ -458,6 +464,7 @@ void tst_WaylandClient::hiddenPopupParent()
QTRY_VERIFY(compositor->surface()); QTRY_VERIFY(compositor->surface());
} }
#if QT_CONFIG(opengl)
void tst_WaylandClient::glWindow() void tst_WaylandClient::glWindow()
{ {
QSKIP("Skipping GL tests, as not supported by all CI systems: See https://bugreports.qt.io/browse/QTBUG-65802"); QSKIP("Skipping GL tests, as not supported by all CI systems: See https://bugreports.qt.io/browse/QTBUG-65802");
@ -483,6 +490,7 @@ void tst_WaylandClient::glWindow()
testWindow->setVisible(false); testWindow->setVisible(false);
QTRY_VERIFY(!compositor->surface()); QTRY_VERIFY(!compositor->surface());
} }
#endif // QT_CONFIG(opengl)
void tst_WaylandClient::longWindowTitle() void tst_WaylandClient::longWindowTitle()
{ {

View File

@ -28,7 +28,9 @@
#include "mockcompositor.h" #include "mockcompositor.h"
#include <QtGui/QRasterWindow> #include <QtGui/QRasterWindow>
#if QT_CONFIG(opengl)
#include <QtGui/QOpenGLWindow> #include <QtGui/QOpenGLWindow>
#endif
using namespace MockCompositor; using namespace MockCompositor;
@ -39,7 +41,9 @@ private slots:
void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); } void cleanup() { QTRY_VERIFY2(isClean(), qPrintable(dirtyMessage())); }
void createDestroySurface(); void createDestroySurface();
void waitForFrameCallbackRaster(); void waitForFrameCallbackRaster();
#if QT_CONFIG(opengl)
void waitForFrameCallbackGl(); void waitForFrameCallbackGl();
#endif
void negotiateShmFormat(); void negotiateShmFormat();
}; };
@ -89,6 +93,7 @@ void tst_surface::waitForFrameCallbackRaster()
} }
} }
#if QT_CONFIG(opengl)
void tst_surface::waitForFrameCallbackGl() void tst_surface::waitForFrameCallbackGl()
{ {
QSKIP("TODO: This currently fails, needs a fix"); QSKIP("TODO: This currently fails, needs a fix");
@ -129,6 +134,7 @@ void tst_surface::waitForFrameCallbackGl()
bufferSpy.removeFirst(); bufferSpy.removeFirst();
} }
} }
#endif // QT_CONFIG(opengl)
void tst_surface::negotiateShmFormat() void tst_surface::negotiateShmFormat()
{ {