| 1 | // Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> |
| 2 | // Copyright (C) 2017 The Qt Company Ltd. |
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 4 | |
| 5 | #ifndef QWAYLANDQUICKOUTPUT_H |
| 6 | #define QWAYLANDQUICKOUTPUT_H |
| 7 | |
| 8 | #include <QtQuick/QQuickWindow> |
| 9 | #include <QtWaylandCompositor/qwaylandoutput.h> |
| 10 | #include <QtWaylandCompositor/qwaylandquickchildren.h> |
| 11 | |
| 12 | QT_REQUIRE_CONFIG(wayland_compositor_quick); |
| 13 | |
| 14 | QT_BEGIN_NAMESPACE |
| 15 | |
| 16 | class QWaylandQuickCompositor; |
| 17 | class QQuickWindow; |
| 18 | |
| 19 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandQuickOutput : public QWaylandOutput, public QQmlParserStatus |
| 20 | { |
| 21 | Q_INTERFACES(QQmlParserStatus) |
| 22 | Q_OBJECT |
| 23 | Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandQuickOutput) |
| 24 | Q_PROPERTY(bool automaticFrameCallback READ automaticFrameCallback WRITE setAutomaticFrameCallback NOTIFY automaticFrameCallbackChanged) |
| 25 | QML_NAMED_ELEMENT(WaylandOutput) |
| 26 | QML_ADDED_IN_VERSION(1, 0) |
| 27 | public: |
| 28 | QWaylandQuickOutput(); |
| 29 | QWaylandQuickOutput(QWaylandCompositor *compositor, QWindow *window); |
| 30 | |
| 31 | void update() override; |
| 32 | |
| 33 | bool automaticFrameCallback() const; |
| 34 | void setAutomaticFrameCallback(bool automatic); |
| 35 | |
| 36 | QQuickItem *pickClickableItem(const QPointF &position); |
| 37 | |
| 38 | public Q_SLOTS: |
| 39 | void updateStarted(); |
| 40 | |
| 41 | Q_SIGNALS: |
| 42 | void automaticFrameCallbackChanged(); |
| 43 | |
| 44 | protected: |
| 45 | void initialize() override; |
| 46 | void classBegin() override; |
| 47 | void componentComplete() override; |
| 48 | |
| 49 | private: |
| 50 | void doFrameCallbacks(); |
| 51 | |
| 52 | bool m_updateScheduled = false; |
| 53 | bool m_automaticFrameCallback = true; |
| 54 | }; |
| 55 | |
| 56 | QT_END_NAMESPACE |
| 57 | |
| 58 | #endif |
| 59 | |