summaryrefslogtreecommitdiffstats
path: root/src/qtwaylandscanner
diff options
context:
space:
mode:
authorJorgen Lind <jorgen.lind@digia.com>2013-12-17 15:26:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-27 22:37:38 +0100
commit62568606a22ab9a6742a196956577356c0e10656 (patch)
tree06cc5032e0c6c1091765279c6e4d7d149d11d92f /src/qtwaylandscanner
parentb2052422d923350bd6e8a7d5426646227daebfc1 (diff)
QtWaylandScanner: add server api for specifically creating new objects
Its no that obvious I think that setting the id == 0 when ading a resource is the right thing to do This commit can potentially break a CI build since it will not force a regeneration of the generated headers, but the "local" cpp files will use the updated header interface. To fix this clean the QtCompositor and the QtWaylandClient include directories in QtBase Change-Id: I32db799dfe338f38c3941eeeb22dd91ed0c7e77d Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/qtwaylandscanner')
-rw-r--r--src/qtwaylandscanner/qtwaylandscanner.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp
index bd8471e0a..437832229 100644
--- a/src/qtwaylandscanner/qtwaylandscanner.cpp
+++ b/src/qtwaylandscanner/qtwaylandscanner.cpp
@@ -437,6 +437,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath)
printf(" void init(struct ::wl_client *client, int id);\n");
printf(" void init(struct ::wl_display *display);\n");
printf("\n");
+ printf(" Resource *add(struct ::wl_client *client);\n");
printf(" Resource *add(struct ::wl_client *client, int id);\n");
printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id);\n");
printf("\n");
@@ -585,6 +586,14 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath)
printf(" }\n");
printf("\n");
+ printf(" %s::Resource *%s::add(struct ::wl_client *client)\n", interfaceName, interfaceName);
+ printf(" {\n");
+ printf(" Resource *resource = bind(client, 0);\n");
+ printf(" m_resource_map.insert(client, resource);\n");
+ printf(" return resource;\n");
+ printf(" }\n");
+ printf("\n");
+
printf(" %s::Resource *%s::add(struct ::wl_client *client, int id)\n", interfaceName, interfaceName);
printf(" {\n");
printf(" Resource *resource = bind(client, id);\n");
@@ -639,6 +648,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath)
QByteArray interfaceMember = hasRequests ? "&m_" + interface.name + "_interface" : QByteArray("0");
+ //We should consider changing bind so that it doesn't special case id == 0
+ //and use function overloading instead. Jan do you have a lot of code dependent on this behavior?
printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id)\n", interfaceName, interfaceName);
printf(" {\n");
printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped);