summaryrefslogtreecommitdiffstats
path: root/src/window-lib/waylandwindow.h
blob: 4951cada5a20dfa6830b5a94eb511fb8dea41bd0 (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
61
62
63
64
65
66
67
68
69
// 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 WAYLANDWINDOW_H
#define WAYLANDWINDOW_H

#include <QtAppManWindow/window.h>

#if QT_CONFIG(am_multi_process)

#include <QtWaylandCompositor/QWaylandQuickSurface>
#include <QtWaylandCompositor/QWaylandXdgShell>
#include <QtCore/QTimer>

QT_BEGIN_NAMESPACE_AM

class WindowSurface;

class WaylandWindow : public Window
{
    Q_OBJECT
    Q_PROPERTY(QWaylandQuickSurface *waylandSurface READ waylandSurface NOTIFY waylandSurfaceChanged FINAL)
    Q_PROPERTY(QWaylandXdgSurface *waylandXdgSurface READ waylandXdgSurface NOTIFY waylandXdgSurfaceChanged FINAL)

public:
    WaylandWindow(Application *app, WindowSurface *surface);

    bool isInProcess() const override { return false; }

    bool isPopup() const override;
    QPoint requestedPopupPosition() const override;

    bool setWindowProperty(const QString &name, const QVariant &value) override;
    QVariant windowProperty(const QString &name) const override;
    QVariantMap windowProperties() const override;

    ContentState contentState() const override;

    void close() override;

    QSize size() const override;
    void resize(const QSize &size) override;

    WindowSurface *surface() const { return m_surface; }

    QWaylandQuickSurface *waylandSurface() const;
    QWaylandXdgSurface *waylandXdgSurface() const;

Q_SIGNALS:
    void waylandSurfaceChanged();
    void waylandXdgSurfaceChanged();

private Q_SLOTS:
    void onContentStateChanged();

private:
    QString applicationId() const;

    WindowSurface *m_surface;
    QVariantMap m_windowProperties;
};

QT_END_NAMESPACE_AM

#endif // QT_CONFIG(am_multi_process)

#endif // WAYLANDWINDOW_H