summaryrefslogtreecommitdiffstats
path: root/src/application-lib/waylandqtamclientextension_p.h
blob: 669c94b0f4b2ea4d759bc046d406964a72fe62f6 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef WAYLANDQTAMCLIENTEXTENSION_P_H
#define WAYLANDQTAMCLIENTEXTENSION_P_H

#include <QVariantMap>
#include <QtWaylandClient/QWaylandClientExtensionTemplate>
#include "private/qwayland-qtam-extension.h"

#include <QtAppManApplication/qtappmanapplicationglobal.h>

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

QT_FORWARD_DECLARE_CLASS(QWindow)

QT_BEGIN_NAMESPACE_AM

class Q_APPMANAPPLICATION_EXPORT WaylandQtAMClientExtension : public QWaylandClientExtensionTemplate<WaylandQtAMClientExtension>,
        public ::QtWayland::qtam_extension
{
    Q_OBJECT

public:
    WaylandQtAMClientExtension();
    ~WaylandQtAMClientExtension() override;

    QVariantMap windowProperties(QWindow *window) const;
    bool setWindowProperty(QWindow *window, const QString &name, const QVariant &value);
    void clearWindowPropertyCache(QWindow *window);

Q_SIGNALS:
    void windowPropertyChanged(QWindow *window, const QString &name, const QVariant &value);

protected:
    bool eventFilter(QObject *o, QEvent *e) override;

private:
    bool setWindowPropertyHelper(QWindow *window, const QString &name, const QVariant &value);
    void sendPropertyToServer(::wl_surface *surface, const QString &name, const QVariant &value);
    void qtam_extension_window_property_changed(wl_surface *surface, const QString &name, wl_array *value) override;

    QMap<QWindow *, QVariantMap> m_windowProperties;    // AXIVION Line Qt-QMapWithPointerKey: cleared on destroyed signal
    QMap<QWindow *, ::wl_surface *> m_windowToSurface;  // AXIVION Line Qt-QMapWithPointerKey: cleared on destroyed signal
};

QT_END_NAMESPACE_AM

#endif // WAYLANDQTAMCLIENTEXTENSION_P_H