From 5372ec5c131e23cccfbabc43d700ffbbbad973ec Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 7 Sep 2016 10:15:28 +0200 Subject: Make the custom extension example more interesting Define a protocol that does something visible. Change-Id: I29133eeffbb2c98a61ee59b241dcf6a6a0f543cb Reviewed-by: Johan Helsing --- .../custom-extension/compositor/customextension.h | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'examples/wayland/custom-extension/compositor/customextension.h') diff --git a/examples/wayland/custom-extension/compositor/customextension.h b/examples/wayland/custom-extension/compositor/customextension.h index 8419eeea3..b1b00408b 100644 --- a/examples/wayland/custom-extension/compositor/customextension.h +++ b/examples/wayland/custom-extension/compositor/customextension.h @@ -48,24 +48,30 @@ #include #include "qwayland-server-custom.h" -namespace QtWayland { - -class CustomExtension : public QWaylandCompositorExtensionTemplate, public QtWaylandServer::qt_example_extension +class CustomExtension : public QWaylandCompositorExtensionTemplate + , public QtWaylandServer::qt_example_extension { Q_OBJECT public: - CustomExtension(); + CustomExtension(QWaylandCompositor *compositor = 0); void initialize() Q_DECL_OVERRIDE; - Q_INVOKABLE void sendEvent(QWaylandSurface *surface, uint time, const QString &text, uint value); signals: - void requestReceived(const QString &text, uint value); + void surfaceAdded(QWaylandSurface *surface); + void bounce(QWaylandSurface *surface, uint ms); + void spin(QWaylandSurface *surface, uint ms); + +public slots: + void setFontSize(QWaylandSurface *surface, uint pixelSize); + void showDecorations(QWaylandClient *client, bool); + void close(QWaylandSurface *surface); + protected: - virtual void example_extension_qtrequest(Resource *resource, const QString &text, int32_t value) Q_DECL_OVERRIDE; + void example_extension_bounce(Resource *resource, wl_resource *surface, uint32_t duration) Q_DECL_OVERRIDE; + void example_extension_spin(Resource *resource, wl_resource *surface, uint32_t duration) Q_DECL_OVERRIDE; + void example_extension_register_surface(Resource *resource, wl_resource *surface) Q_DECL_OVERRIDE; }; Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(CustomExtension) -} - #endif // CUSTOMEXTENSION_H -- cgit v1.2.3