1// Copyright (C) 2021 LG Electronics Inc.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include <QtQml/qqmlextensionplugin.h>
5#include <QtQml/qqml.h>
6
7#include <QtWaylandCompositor/qwaylandquickextension.h>
8#include <QtWaylandCompositor/private/qwaylandpresentationtime_p.h>
9
10QT_BEGIN_NAMESPACE
11
12Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandPresentationTime)
13
14/*!
15 \qmlmodule QtWayland.Compositor.PresentationTime
16 \title Qt Wayland Presentation Time Extension
17 \ingroup qmlmodules
18 \since 6.3
19 \brief Provides tracking the timing when a frame is presented on screen.
20
21 \section2 Summary
22 The PresentationTime extension provides a way to track rendering timing
23 for a surface. Client can request feedbacks associated with a surface,
24 then compositor send events for the feedback with the time when the surface
25 is presented on-screen.
26
27 PresentationTime corresponds to the Wayland \c wp_presentation interface.
28
29 \section2 Usage
30 To use this module, import it like this:
31 \qml
32 import QtWayland.Compositor.PresentationTime
33 \endqml
34*/
35
36class QWaylandCompositorPresentationTimePlugin : public QQmlExtensionPlugin
37{
38 Q_OBJECT
39 Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
40public:
41 void registerTypes(const char *uri) override
42 {
43 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWayland.Compositor.PresentationTime"));
44 defineModule(uri);
45 }
46
47 static void defineModule(const char *uri)
48 {
49 qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
50 qmlRegisterType<QWaylandPresentationTime>(uri, versionMajor: 1, versionMinor: 0, qmlName: "PresentationTime");
51 }
52};
53QT_END_NAMESPACE
54
55#include "qwaylandcompositorpresentationtimeplugin.moc"
56

source code of qtwayland/src/imports/compositor-extensions/presentationtime/qwaylandcompositorpresentationtimeplugin.cpp