summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/cursor/cursorshapev1.h
blob: 0befc322318289ebe5551936c149929b27a86848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (C) 2023 David Edmundson <davidedmundson@kde.org>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef MOCKCOMPOSITOR_CURSORSHAPE_H
#define MOCKCOMPOSITOR_CURSORSHAPE_H

#include "coreprotocol.h"
#include <qwayland-server-cursor-shape-v1.h>

namespace MockCompositor {

class CursorShapeDevice;

class CursorShapeManager : public Global, public QtWaylandServer::wp_cursor_shape_manager_v1
{
    Q_OBJECT
public:
    explicit CursorShapeManager(CoreCompositor *compositor, int version = 1);
    QList<CursorShapeDevice *> m_cursorDevices;

protected:
    void wp_cursor_shape_manager_v1_get_pointer(Resource *resource, uint32_t id, wl_resource *pointer) override;
};

class CursorShapeDevice : public QObject, public QtWaylandServer::wp_cursor_shape_device_v1
{
    Q_OBJECT
public:
    explicit CursorShapeDevice(Pointer *pointer, wl_client *client, int id, int version);
    Pointer *m_pointer;
    shape m_currentShape = shape_default;

Q_SIGNALS:
    void setCursor(uint serial);

protected:
    void wp_cursor_shape_device_v1_destroy_resource(Resource *resource) override;
    void wp_cursor_shape_device_v1_destroy(Resource *resource) override;
    void wp_cursor_shape_device_v1_set_shape(Resource *resource, uint32_t serial, uint32_t shape) override;
};

}

#endif