| 1 | // Copyright (C) 2019 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef WL_REGION_H |
| 5 | #define WL_REGION_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtWaylandCompositor/qtwaylandcompositorglobal.h> |
| 19 | |
| 20 | #include <QRegion> |
| 21 | #include <private/qglobal_p.h> |
| 22 | |
| 23 | #include <wayland-util.h> |
| 24 | #include <QtWaylandCompositor/private/qwayland-server-wayland.h> |
| 25 | |
| 26 | QT_BEGIN_NAMESPACE |
| 27 | |
| 28 | namespace QtWayland { |
| 29 | |
| 30 | class Q_WAYLANDCOMPOSITOR_EXPORT Region : public QtWaylandServer::wl_region |
| 31 | { |
| 32 | public: |
| 33 | Region(struct wl_client *client, uint32_t id); |
| 34 | ~Region() override; |
| 35 | |
| 36 | static Region *fromResource(struct ::wl_resource *resource); |
| 37 | |
| 38 | uint id() const { return wl_resource_get_id(resource()->handle); } |
| 39 | |
| 40 | QRegion region() const { return m_region; } |
| 41 | |
| 42 | private: |
| 43 | Q_DISABLE_COPY(Region) |
| 44 | |
| 45 | QRegion m_region; |
| 46 | |
| 47 | void region_destroy_resource(Resource *) override; |
| 48 | |
| 49 | void region_destroy(Resource *resource) override; |
| 50 | void region_add(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h) override; |
| 51 | void region_subtract(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h) override; |
| 52 | }; |
| 53 | |
| 54 | } |
| 55 | |
| 56 | QT_END_NAMESPACE |
| 57 | |
| 58 | #endif // WL_REGION_H |
| 59 | |
| 60 | |