Merge remote-tracking branch 'origin/5.15' into dev

Change-Id: I45b8d2d8a6c512a38a6775bb0fe95358623cef99
This commit is contained in:
Johan Klokkhammer Helsing 2019-10-09 15:31:58 +02:00
commit f3552aebda
3 changed files with 82 additions and 21 deletions

View File

@ -9,7 +9,24 @@
"libraries": { "libraries": {
"wayland-client": { "wayland-client": {
"label": "Wayland client library", "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": [ "sources": [
{ "type": "pkgConfig", "args": "wayland-client" }, { "type": "pkgConfig", "args": "wayland-client" },
"-lwayland-client" "-lwayland-client"
@ -17,7 +34,10 @@
}, },
"wayland-cursor": { "wayland-cursor": {
"label": "Wayland cursor library", "label": "Wayland cursor library",
"test": "wayland_cursor", "headers": "wayland-cursor.h",
"test": {
"main": "struct wl_cursor_image *image = 0;"
},
"use": "wayland-client", "use": "wayland-client",
"sources": [ "sources": [
{ "type": "pkgConfig", "args": "wayland-cursor" }, { "type": "pkgConfig", "args": "wayland-cursor" },
@ -26,7 +46,10 @@
}, },
"wayland-egl": { "wayland-egl": {
"label": "Wayland EGL library", "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": [ "sources": [
{ "type": "pkgConfig", "args": "wayland-egl" }, { "type": "pkgConfig", "args": "wayland-egl" },
"-lwayland-egl", "-lwayland-egl",
@ -35,7 +58,11 @@
}, },
"xcomposite": { "xcomposite": {
"label": "XComposite", "label": "XComposite",
"test": "xcomposite", "headers": "X11/extensions/Xcomposite.h",
"test": {
"main": "XCompositeRedirectWindow((Display *)0,(Window) 0, CompositeRedirectManual);"
},
"sources": [ "sources": [
{ "type": "pkgConfig", "args": "xcomposite" }, { "type": "pkgConfig", "args": "xcomposite" },
"-lxcomposite" "-lxcomposite"
@ -43,7 +70,14 @@
}, },
"glx": { "glx": {
"label": "GLX", "label": "GLX",
"test": "glx", "headers": "GL/glx.h",
"test": {
"main": [
"Display *dpy = XOpenDisplay(0);",
"int items = 0;",
"GLXFBConfig *fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), 0 , &items);"
]
},
"sources": [ "sources": [
{ "type": "pkgConfig", "args": "x11 gl" }, { "type": "pkgConfig", "args": "x11 gl" },
"-lX11 -lGl" "-lX11 -lGl"

View File

@ -92,7 +92,7 @@ private:
}; };
bool isServerSide(); bool isServerSide();
bool parseOption(const char *str); bool parseOption(const QByteArray &str);
QByteArray byteArrayValue(const QXmlStreamReader &xml, const char *name); QByteArray byteArrayValue(const QXmlStreamReader &xml, const char *name);
int intValue(const QXmlStreamReader &xml, const char *name, int defaultValue = 0); int intValue(const QXmlStreamReader &xml, const char *name, int defaultValue = 0);
@ -123,29 +123,55 @@ private:
QByteArray m_scannerName; QByteArray m_scannerName;
QByteArray m_headerPath; QByteArray m_headerPath;
QByteArray m_prefix; QByteArray m_prefix;
QVector <QByteArray> m_includes;
QXmlStreamReader *m_xml = nullptr; QXmlStreamReader *m_xml = nullptr;
}; };
bool Scanner::parseArguments(int argc, char **argv) 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; return false;
m_protocolFilePath = QByteArray(argv[2]); m_protocolFilePath = args[2];
if (argc >= 4) if (argc > 3 && !args[3].startsWith('-')) {
m_headerPath = QByteArray(argv[3]); // legacy positional arguments
if (argc == 5) m_headerPath = args[3];
m_prefix = QByteArray(argv[4]); 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; return true;
} }
void Scanner::printUsage() 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() bool Scanner::isServerSide()
@ -153,15 +179,15 @@ bool Scanner::isServerSide()
return m_option == ServerHeader || m_option == ServerCode; 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; m_option = ClientHeader;
else if (str == QLatin1String("server-header")) else if (str == "server-header")
m_option = ServerHeader; m_option = ServerHeader;
else if (str == QLatin1String("client-code")) else if (str == "client-code")
m_option = ClientCode; m_option = ClientCode;
else if (str == QLatin1String("server-code")) else if (str == "server-code")
m_option = ServerCode; m_option = ServerCode;
else else
return false; return false;
@ -441,6 +467,9 @@ bool Scanner::process()
if (m_xml->hasError()) if (m_xml->hasError())
return false; return false;
for (auto b : qAsConst(m_includes))
printf("#include %s\n", b.constData());
if (m_option == ServerHeader) { if (m_option == ServerHeader) {
QByteArray inclusionGuard = QByteArray("QT_WAYLAND_SERVER_") + preProcessorProtocolName.constData(); QByteArray inclusionGuard = QByteArray("QT_WAYLAND_SERVER_") + preProcessorProtocolName.constData();
printf("#ifndef %s\n", inclusionGuard.constData()); printf("#ifndef %s\n", inclusionGuard.constData());

View File

@ -58,8 +58,6 @@ private:
QByteArray mComposeModule = QByteArray("QComposeInputContext"); // default input context QByteArray mComposeModule = QByteArray("QComposeInputContext"); // default input context
QByteArray mIbusModule = QByteArray("QIBusPlatformInputContext"); QByteArray mIbusModule = QByteArray("QIBusPlatformInputContext");
QByteArray mWaylandModule = QByteArray("QtWaylandClient::QWaylandInputContext"); QByteArray mWaylandModule = QByteArray("QtWaylandClient::QWaylandInputContext");
TextInputManager *mTextInputManager = nullptr;
}; };
void tst_inputcontext::initTestCase() void tst_inputcontext::initTestCase()