summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-10-10 08:34:43 +0200
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-10-10 08:34:43 +0200
commit64abfad7ef7bf477d97284c46eb8a7def90dcdc5 (patch)
treed524e760efe8f2af408cee14d888340469adf097
parent10abf9d3553003b2e82f21d58a2f3abc7c048999 (diff)
parenta694ae228ee1779b1c6ec3cae8f1178dea6d7a5d (diff)
Merge remote-tracking branch 'origin/5.15' into wip/cmake
Conflicts: src/client/configure.json src/compositor/configure.json Change-Id: If7d6d78d38bc2b6cc1deda389960b5b0c048e922
-rw-r--r--src/client/configure.json35
-rw-r--r--src/compositor/configure.json29
-rw-r--r--src/qtwaylandscanner/qtwaylandscanner.cpp57
-rw-r--r--tests/auto/client/inputcontext/tst_inputcontext.cpp2
4 files changed, 100 insertions, 23 deletions
diff --git a/src/client/configure.json b/src/client/configure.json
index 1bf2f433b..1aa514ce6 100644
--- a/src/client/configure.json
+++ b/src/client/configure.json
@@ -9,7 +9,24 @@
"libraries": {
"wayland-client": {
"label": "Wayland client library",
- "test": "wayland",
+ "headers": "wayland-version.h",
+ "test": {
+ "main": [
+ "#if WAYLAND_VERSION_MAJOR < 1",
+ "# error Wayland 1.8.0 or higher required",
+ "#endif",
+ "#if WAYLAND_VERSION_MAJOR == 1",
+ "# if WAYLAND_VERSION_MINOR < 8",
+ "# error Wayland 1.8.0 or higher required",
+ "# endif",
+ "# if WAYLAND_VERSION_MINOR == 8",
+ "# if WAYLAND_VERSION_MICRO < 0",
+ "# error Wayland 1.8.0 or higher required",
+ "# endif",
+ "# endif",
+ "#endif"
+ ]
+ },
"sources": [
{ "type": "pkgConfig", "args": "wayland-client" },
"-lwayland-client"
@@ -17,7 +34,10 @@
},
"wayland-cursor": {
"label": "Wayland cursor library",
- "test": "wayland_cursor",
+ "headers": "wayland-cursor.h",
+ "test": {
+ "main": "struct wl_cursor_image *image = 0;"
+ },
"use": "wayland-client",
"sources": [
{ "type": "pkgConfig", "args": "wayland-cursor" },
@@ -26,7 +46,10 @@
},
"wayland-egl": {
"label": "Wayland EGL library",
- "test": "wayland_egl",
+ "headers": "wayland-egl.h",
+ "test": {
+ "main": "struct wl_egl_window *window = wl_egl_window_create(0, 100, 100);"
+ },
"sources": [
{ "type": "pkgConfig", "args": "wayland-egl" },
"-lwayland-egl",
@@ -35,7 +58,11 @@
},
"xcomposite": {
"label": "XComposite",
- "test": "xcomposite",
+ "headers": "X11/extensions/Xcomposite.h",
+ "test": {
+ "main": "XCompositeRedirectWindow((Display *)0,(Window) 0, CompositeRedirectManual);"
+
+ },
"sources": [
{ "type": "pkgConfig", "args": "xcomposite" },
"-lxcomposite"
diff --git a/src/compositor/configure.json b/src/compositor/configure.json
index 9ed17d760..0377dd7be 100644
--- a/src/compositor/configure.json
+++ b/src/compositor/configure.json
@@ -9,14 +9,34 @@
"libraries": {
"wayland-server": {
"label": "wayland-server",
- "test": "wayland",
+ "headers": "wayland-version.h",
+ "test": {
+ "main": [
+ "#if WAYLAND_VERSION_MAJOR < 1",
+ "# error Wayland 1.8.0 or higher required",
+ "#endif",
+ "#if WAYLAND_VERSION_MAJOR == 1",
+ "# if WAYLAND_VERSION_MINOR < 8",
+ "# error Wayland 1.8.0 or higher required",
+ "# endif",
+ "# if WAYLAND_VERSION_MINOR == 8",
+ "# if WAYLAND_VERSION_MICRO < 0",
+ "# error Wayland 1.8.0 or higher required",
+ "# endif",
+ "# endif",
+ "#endif"
+ ]
+ },
"sources": [
{ "type": "pkgConfig", "args": "wayland-server" },
"-lwayland-server"
]
},
"wayland-egl": {
- "test": "wayland_egl",
+ "headers": "wayland-egl.h",
+ "test": {
+ "main": "struct wl_egl_window *window = wl_egl_window_create(0, 100, 100);"
+ },
"sources": [
{ "type": "pkgConfig", "args": "wayland-egl" },
"-lwayland-egl",
@@ -45,7 +65,10 @@
]
},
"xcomposite": {
- "test": "xcomposite",
+ "headers": "X11/extensions/Xcomposite.h",
+ "test": {
+ "main": "XCompositeRedirectWindow((Display *)0,(Window) 0, CompositeRedirectManual);"
+ },
"sources": [
{ "type": "pkgConfig", "args": "xcomposite" },
"-lxcomposite"
diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp
index 9691b857f..24977a2f2 100644
--- a/src/qtwaylandscanner/qtwaylandscanner.cpp
+++ b/src/qtwaylandscanner/qtwaylandscanner.cpp
@@ -92,7 +92,7 @@ private:
};
bool isServerSide();
- bool parseOption(const char *str);
+ bool parseOption(const QByteArray &str);
QByteArray byteArrayValue(const QXmlStreamReader &xml, const char *name);
int intValue(const QXmlStreamReader &xml, const char *name, int defaultValue = 0);
@@ -123,29 +123,55 @@ private:
QByteArray m_scannerName;
QByteArray m_headerPath;
QByteArray m_prefix;
+ QVector <QByteArray> m_includes;
QXmlStreamReader *m_xml = nullptr;
};
bool Scanner::parseArguments(int argc, char **argv)
{
- m_scannerName = argv[0];
+ QVector<QByteArray> args;
+ args.reserve(argc);
+ for (int i = 0; i < argc; ++i)
+ args << QByteArray(argv[i]);
- if (argc <= 2 || !parseOption(argv[1]))
+ m_scannerName = args[0];
+
+ if (argc <= 2 || !parseOption(args[1]))
return false;
- m_protocolFilePath = QByteArray(argv[2]);
+ m_protocolFilePath = args[2];
- if (argc >= 4)
- m_headerPath = QByteArray(argv[3]);
- if (argc == 5)
- m_prefix = QByteArray(argv[4]);
+ if (argc > 3 && !args[3].startsWith('-')) {
+ // legacy positional arguments
+ m_headerPath = args[3];
+ if (argc == 5)
+ m_prefix = args[4];
+ } else {
+ // --header-path=<path> (14 characters)
+ // --prefix=<prefix> (9 characters)
+ // --add-include=<include> (14 characters)
+ for (int pos = 3; pos < argc; pos++) {
+ const QByteArray &option = args[pos];
+ if (option.startsWith("--header-path=")) {
+ m_headerPath = option.mid(14);
+ } else if (option.startsWith("--prefix=")) {
+ m_prefix = option.mid(10);
+ } else if (option.startsWith("--add-include=")) {
+ auto include = option.mid(14);
+ if (!include.isEmpty())
+ m_includes << include;
+ } else {
+ return false;
+ }
+ }
+ }
return true;
}
void Scanner::printUsage()
{
- fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path] [prefix]\n", m_scannerName.constData());
+ fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [--header-path=<path>] [--prefix=<prefix>] [--add-include=<include>]\n", m_scannerName.constData());
}
bool Scanner::isServerSide()
@@ -153,15 +179,15 @@ bool Scanner::isServerSide()
return m_option == ServerHeader || m_option == ServerCode;
}
-bool Scanner::parseOption(const char *str)
+bool Scanner::parseOption(const QByteArray &str)
{
- if (str == QLatin1String("client-header"))
+ if (str == "client-header")
m_option = ClientHeader;
- else if (str == QLatin1String("server-header"))
+ else if (str == "server-header")
m_option = ServerHeader;
- else if (str == QLatin1String("client-code"))
+ else if (str == "client-code")
m_option = ClientCode;
- else if (str == QLatin1String("server-code"))
+ else if (str == "server-code")
m_option = ServerCode;
else
return false;
@@ -441,6 +467,9 @@ bool Scanner::process()
if (m_xml->hasError())
return false;
+ for (auto b : qAsConst(m_includes))
+ printf("#include %s\n", b.constData());
+
if (m_option == ServerHeader) {
QByteArray inclusionGuard = QByteArray("QT_WAYLAND_SERVER_") + preProcessorProtocolName.constData();
printf("#ifndef %s\n", inclusionGuard.constData());
diff --git a/tests/auto/client/inputcontext/tst_inputcontext.cpp b/tests/auto/client/inputcontext/tst_inputcontext.cpp
index b1a5a7f17..7c0132e35 100644
--- a/tests/auto/client/inputcontext/tst_inputcontext.cpp
+++ b/tests/auto/client/inputcontext/tst_inputcontext.cpp
@@ -58,8 +58,6 @@ private:
QByteArray mComposeModule = QByteArray("QComposeInputContext"); // default input context
QByteArray mIbusModule = QByteArray("QIBusPlatformInputContext");
QByteArray mWaylandModule = QByteArray("QtWaylandClient::QWaylandInputContext");
-
- TextInputManager *mTextInputManager = nullptr;
};
void tst_inputcontext::initTestCase()