summaryrefslogtreecommitdiffstats
path: root/src/qtwaylandscanner
Commit message (Collapse)AuthorAgeFilesLines
* QWaylandScanner: port from QList to std::vectorMarc Mutz2019-08-031-24/+25
| | | | | | | | | QList is going away in Qt 6, and CoW is not needed, as containers and elements are only ever moved, not copied, and NRVO is in effect everywhere. Change-Id: Ie738da3619f0b8048fbd07e5911db0960133d553 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* QWaylandScanner: tidy upMarc Mutz2019-08-031-81/+79
| | | | | | | | | | | | | | | | | | | | This change - standardizes on using boolean needsXy to handle join-style omissions of commas or newlines instead of inspecting the index of the element in various forms, which enables - standardize on C++11 ranged for loops instead of indexed loops - use braced initialization for structs, with designators, which are strictly a C++20 feature but are being used in QtWayland already, so should be safe (they originally come from C99). Together, they make the code easier to understand, because the variation of patterns used in the program is reduced. Change-Id: Ib96620a9ecbe4ee47e59290ed758f0ec1bffcfd6 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* QWaylandScanner: add trailing commas to enumerations and braced initializationMarc Mutz2019-07-251-4/+2
| | | | | | | | This is allowed since C++11, and K&R C, resp., and doing so simplifies the code. Change-Id: I4bf5bc50b46c6b811ec386b92bfb0a7529a32645 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Eradicate Q_FOREACH loops [1/2]: trivial casesMarc Mutz2019-05-211-5/+5
| | | | | | | | | | | | | | | In this patch, we port Q_FOREACH loops to C++11 ranged-for loops. All cases are trivial in the sense that either the argument is already const or is trivially marked as const, either by qAsConst(), or, in the case of rvalues, by storing to a const auto temporary first. In addition, all loop bodies are clear enough to confirm that the container we iterate over is not changed under iteration. This does not exclude cases where a loop is prematurely exited just after calling a modifier on the container, as that is safe, if not especially elegant. Change-Id: I87a63f07797437d421567d60e52305391a3c4f21 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Client: Add safer fromObject function to scannerJohan Klokkhammer Helsing2019-05-011-0/+11
| | | | | | | | | | | | | | | | | | | | | | Makes the scanner produce generated static functions such as QtWaylandClient::wl_surface *wl_surface::fromObject(struct ::wl_surface *object); Which casts from the wayland-scanner generated types, such as struct ::wl_surface *, to types types generated by qtwaylandscanner, but performs a check to see if the listener is set to the wrapper class first (at least for interfaces with events). This lets us easily fix crashes in a couple of places where we receive events with wayland objects that we didn't create. Also adds nullptr checks whenever we use the fromWlSurface() and fromWlOutput() functions to handle failed conversions. Task-number: QTBUG-73801 Fixes: QTBUG-74085 Change-Id: I9f33c31c7d1a939ccb3ebbbcb0eb67af10037237 Reviewed-by: Jaroslaw Kubik <jarek@froglogic.com> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-12-051-0/+1
|\ | | | | | | | | | | | | Conflicts: src/compositor/compositor_api/qwaylandquickitem.cpp Change-Id: I5e01a0731e880e3eb8eab349043756a5993e3050
| * Scanner: Add include for QListJohan Klokkhammer Helsing2018-12-051-0/+1
| | | | | | | | | | | | | | | | QList is not included when built with QT_NO_QOBJECT defined. Change-Id: Iaf8874583e81b08a49ec246a5de0b62803c8ed7e Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-12-041-3/+1
|\| | | | | | | Change-Id: I29192963efa6753a4cf222a3aec92ab400deb2f0
| * Fix unused variables, in preparation for adding warning_cleanSergio Martins2018-11-301-3/+1
| | | | | | | | | | | | | | The QByteArray one seems like an actual bug. Change-Id: I11de9c7a10cdd3e70f9f6af18bcce3bd3bf54320 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | qtwaylandscanner: Generate Resource::object without interface prefixJohan Klokkhammer Helsing2018-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows writing template functions like this template<typename return_type> return_type *fromResource(struct ::wl_resource *resource) { if (auto *r = return_type::Resource::fromResource(resource)) return static_cast<return_type *>(r->object()); return nullptr; } Letting us easily cast a wl_resource to a wrapper type, i.e.: wl_resource *resource = ... auto *surfacePrivate = fromResource<QWaylandSurfacePrivate>(resource); This can hopefully let us reduce some boilerplate in the future. Change-Id: I41630f35b3472baa39d88d89c1c6503cc0e6584a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Scanner: Assert resource in destroy handlersJohan Klokkhammer Helsing2018-11-021-0/+1
| | | | | | | | | | Change-Id: I8e32b267a4cc5a4cfc462f7819a378573e179134 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* | Fix compilation with libwayland < 1.10 (again)Johan Klokkhammer Helsing2018-10-051-1/+6
| | | | | | | | | | | | | | | | wl_proxy_marshal_constructor_versioned was added in libwayland v1.10.0, use the old way with wl_proxy_marshal_constructor for older versions instead. Change-Id: I4514212e0b44ecbf200769759667186f71b279b6 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Don't include system versions of wayland protocolJohan Klokkhammer Helsing2018-10-031-2/+15
|/ | | | | | | | | | | | | | | | | | | | | wayland-client.h and wayland-server.h includes protocol generated for the version of wayland.xml corresponding to the libwayland version. This becomes a problem when we want to support a version of wayland.xml that's newer than the system libwayland. The solution is to include wayland-client-core.h and wayland-client-server.h instead. These headers don't include any wayland-scanner generated code, so we can safely compile and link code generated against the version of wayland.xml that we ship. [ChangeLog] Code generated by qtwaylandscanner now includes wayland-client-core.h and wayland-server-core.h instead of wayland-client.h and wayland-server.h. This might break source compatibility for code using custom wayland extensions. Fixes: QTBUG-70553 Change-Id: Ice0cdb60ecc4f936acc0e158b96f7978549f62c1 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Don't use members of wl_resourceJohan Klokkhammer Helsing2018-09-181-2/+2
| | | | | | | | | When we switch to only including core wayland headers, wl_resource will be an opaque type. Use the getters and setter functions instead. Task-number: QTBUG-70553 Change-Id: I7d84d48a4ee3586f231a331cd15716686dcee775 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Remove ifdefs for unsupported libwayland versionsJohan Klokkhammer Helsing2018-09-171-3/+0
| | | | | | | The ifdefs were for version 1.2.0. Change-Id: Ie58745c7cf4c0fba45bc5203d24e9913d3a8b8ce Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Scanner: Don't crash when calling fromResource with nullptrJohan Klokkhammer Helsing2018-08-291-0/+2
| | | | | | Change-Id: I85c17e50cf917a51e74fa03fcdc647def6e4bdfd Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Convert qtwaylandscanner into a classJohan Klokkhammer Helsing2018-08-091-128/+191
| | | | | | | | Encapsulate what the scanner needs of functions and state into a class, Scanner, instead of keeping everything in the global namespace. Change-Id: Idd4b412bb7f709f24c86abe82b135c09b7985878 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Disable the -Wmissing-field-initializers warning for Clang tooThiago Macieira2018-05-231-0/+1
| | | | | | | qwldatadevicemanager.cpp:277:1: warning: missing field 'finish' initializer [-Wmissing-field-initializers] Change-Id: I052407b777ec43f78378fffd15311263e7498287 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Use nullptr instead of 0 or NULLJohan Klokkhammer Helsing2018-02-201-1/+1
| | | | | | | | Applied automatic fixes using clang-tidy's modernize-use-nullptr, and some manual cleanup to prevent QFlag macros to be affected. Change-Id: I88f94390185bc6e6f23693b68723cd5710815ae6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qtwaylandscanner: Remove globals when destroying wrappersJohan Klokkhammer Helsing2017-10-251-0/+23
| | | | | | | | | | | | | When globals are destroyed on the compositor side, send the "global_remove" event and set the resource implementation to nullptr so all further requests are ignored. This also adds a compositor test to see if outputs are removed when they are deleted. Change-Id: Ib77a4c3d4c2c93283a14ac20f5964e2ce08a1d38 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Use nullptr instead of 0 in qtwaylandscannerJohan Klokkhammer Helsing2017-08-151-16/+16
| | | | | Change-Id: I5ffee26a4c0cd7726e007cc0692e403e15b5726e Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Disable the GCC warning about missing initializersThiago Macieira2017-06-221-0/+12
| | | | | | | | | New fields are appended to the structure, so we can't initialize them as we would lose compatibility with earlier versions of libwayland. So just disable the warning. Change-Id: Ia3e896da908f42939148fffd14c4806ce3468e56 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Add QWaylandShellSurface::fromResource()Giulio Camuffo2016-03-291-1/+8
| | | | | | | | | | Also make sure that the generated *::Resource::fromResource() code returns null if it doesn't own the resource or if the interface is wrong. Change-Id: I904e0dd49dd6e535ef8cab6687c6869e1000048d Reviewed-by: Johan Helsing <johan.helsing@theqtcompany.com> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
* Simplify client-side API for Wayland extensionsErik Larsson2016-03-181-0/+8
| | | | | | | | | | | This simplifies the client-side API for Wayland extensions by introducing QWaylandClientExtension/QWaylandClientExtensionTemplate classes. These classes takes care of the initialization of the extension if it matches the interface name. Change-Id: I7c4fb34563563af4be072cdebda54954b79cddbe Reviewed-by: Johan Helsing <johan.helsing@theqtcompany.com> Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Allow initializing the server protocol classes with a wl_resourceGiulio Camuffo2016-02-101-1/+25
| | | | | Change-Id: I3efd23284392e0ff587f86c7c163c0e4ffadb1f1 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
* Updated license headersAntti Kokko2016-01-201-14/+20
| | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I76ae5d3e64f096eb3163d6163a38d68c7c1ca756 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge branch '5.6' into wip-compositor-apiLaszlo Agocs2015-10-271-4/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qwindow-compositor changes from 5.6 will be adapted separately. The traditional wayland-egl path is tested and is functional like before. The EGLStream support will be verified separately once the qwindow-compositor changes are ready. Conflicts: examples/wayland/qwindow-compositor/qwindowcompositor.cpp examples/wayland/qwindow-compositor/textureblitter.cpp examples/wayland/qwindow-compositor/textureblitter.h examples/wayland/server-buffer/client/client.pro examples/wayland/server-buffer/compositor/compositor.pro src/compositor/compositor_api/qwaylandbufferref.cpp src/compositor/compositor_api/qwaylandbufferref.h src/compositor/hardware_integration/qwlclientbufferintegration_p.h src/compositor/wayland_wrapper/qwlkeyboard.cpp src/compositor/wayland_wrapper/qwlkeyboard_p.h src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.h src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro Change-Id: Ic2e3a6e8f74606c35b1e27cd4016fa133527d7ba
| * Fix for QStringBuilderLaszlo Agocs2015-10-191-4/+23
| | | | | | | | | | Change-Id: I2a7b82bd2705919a91492edfccac02f4d8fc2c9b Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com>
* | Fix % warning when using generated filesJørgen Lind2015-09-101-1/+1
| | | | | | | | | | Change-Id: Ib7857743140d9f2dfa5bf1ff2187af8f3e2478da Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* | Rename QtCompositor to QtWaylandCompositorJørgen Lind2015-09-101-5/+0
| | | | | | | | | | | | | | enable building QtWaylandCompositor by default Change-Id: I7cf34052b304ca9fef55b7e30ef6a6367b5d75f1 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* | Add an assert in QtWaylandScanner for duplicate bindsJørgen Lind2015-09-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | Since Q_SIGNALS are a one -> many distribution we can end up signalling creation requests to many slots. Its then important that we verify that only one of these actually binds an object for the object id. Its a programming error to have this situation, hence its an assert, and not a runtime check that gives a warning. The bind will overwrite the object and the last bind will continue to work as normal in release mode. Change-Id: I1f469066cf5287789249763843e6cbaa545ee619
* | Improve QWaylandExtensionJørgen Lind2015-08-281-1/+1
| | | | | | | | | | | | | | | | By using curiously recurring template pattern we can generate a getter which is very convenient, and all QWaylandExtensions should have this casting operation Change-Id: Idb5a786655f2e106cf5388b11ed71e8b6ddddec0
* | Rework how we manage extensionsJørgen Lind2015-08-281-1/+16
|/ | | | Change-Id: If2cbf096e7419bc1bda007d5167ce39d1a5d50ae
* Reset wayland object pointer after destroyArnaud Vrac2015-05-071-0/+4
| | | | | | | This allows calling init() on the wayland object again after destroy() Change-Id: I7856cc8ec676eee7575e15a5d1f81cf1b89537c8 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
* Update copyright headersJani Heikkinen2015-02-171-22/+14
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I5a74d32515c3f1fe7aa1916f4241c92832510f8c Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* Fix the compositor's wayland versioningGiulio Camuffo2014-10-091-24/+27
| | | | | | | | | We cannot just assume all clients implement the same version of the various interfaces as the compositor does. Keep track of them, and react accordingly when creating a resource or sending an event. Change-Id: I9792433a14d49c5c4df0c892fc1349ce0dfb0d43 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Explicitly define the interface versionsGiulio Camuffo2014-08-231-6/+6
| | | | | | | | | | Currently a global is bound with the version the interface has in the xml file. This is a problem for apps that explicitly link to libwayland-client because they may link to a newer libwayland, so the version of some interface may be higher than the one that it is actually implemented. Change-Id: Id0dbe6c0f1e05fe91954b9d8d9472d42d2053cdc Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Bind the globals with the highest version availableGiulio Camuffo2014-08-051-1/+1
| | | | | Change-Id: I639b124f15416905c17665755b3288c905880f39 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Fix generated code for interface names not starting with qt_ or wl_Giulio Camuffo2014-06-121-5/+5
| | | | | | | | | The generated code for an interface without a qt_ or wl_ prefix was broken, and could not compile. This commit needs a 'make clean' to let qtwaylandscanner run again. Change-Id: Id9c7e3f87385f83eeffd1e8718c854a405f411f0 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Merge remote-tracking branch 'origin/dev' into stableOswald Buddenhagen2014-02-191-3/+3
|\ | | | | | | | | | | | | Conflicts: src/compositor/wayland_wrapper/qwlsurface.cpp Change-Id: I3b6a4af41f272d3dc7fc920ba2542f2dd7978175
| * Fix compiler warnings because of deprecated apisJorgen Lind2014-01-171-3/+3
| | | | | | | | | | Change-Id: I60faee3fb4b9a74a13c8489a5dd1df7a2a5a4ae4 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Strip custom prefix from interface namePier Luigi Fiorini2014-02-091-9/+14
|/ | | | | | | | Interface names for some protocols might not start with wl_ or qt_, with this change users can specify a prefix of their liking. Change-Id: I70d40985165c49114b525bdec2a872aa5b0dad6d Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* QtWaylandScanner: add server api for specifically creating new objectsJorgen Lind2013-12-271-0/+11
| | | | | | | | | | | | | 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>
* Add a preprocessor protocol name variableJorgen Lind2013-12-271-16/+20
| | | | | | | | | | | We should convert - to _ in the preprocessor protocol name since - will lead to a new token, but we don't since it is better to fail early here and the official wayland-scanner doesn't do this either. The generated c++ header will give a compiler error when being used which gives the user a chance to change the protocol name. Change-Id: I049bdecacc8ed9a70c0879494d4d358ce53f3320 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Remove compiler warning qtwaylandscannerJorgen Lind2013-12-271-11/+11
| | | | | | | We don't need the interface name anymore Change-Id: I8b1d334a549adb388da083dd8f4261755a54ff20 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Make it possible to install the generated headersJorgen Lind2013-12-241-9/+52
| | | | | | | | | | Adding a header_path parameter. This will cause the scanner to generate header includes that look for corresponding files in that path. Also when we'r installing files, then c++ classes needs to be exported Change-Id: Ic539c0861143d7200b9cae85ca902a17ea0d0a8d Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Generate more useful methods for new_id requestsJan Arne Petersen2013-11-221-6/+1
| | | | | Change-Id: I3206bf7e0ffc99e9ec10d949f51ad043aca2548c Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Fix creating new objects (with id == 0)Jan Arne Petersen2013-11-221-1/+1
| | | | | | Change-Id: I2a6740d5e1a4367d2980e3fb17617c2f1cb95041 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Bind to version 1 of an interfaceJan Arne Petersen2013-11-221-1/+1
| | | | | | | | | Just require version 1 instead of the latest available version of an interface for now. Explicit support for requesting a higher version should be added still. Change-Id: Ib1b8303191e000227e27e07b1adf837993ac3497 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Fix scanner to support also hex values in enumsJan Arne Petersen2013-08-281-3/+3
| | | | | | | | | Read the value of an enum entry as a QByteArray. There is not any need to convert it into an int in between. Change-Id: Ie75d30dc22f7e81ddcff64990e3c6f030f31ef79 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Andy Nichols <andy.nichols@digia.com>