File indexing completed on 2024-05-19 05:32:40

0001 /*
0002     SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 #pragma once
0007 
0008 #include <QObject>
0009 #include <chrono>
0010 
0011 #include "core/renderbackend.h"
0012 #include "effect/globals.h"
0013 #include "wayland/qwayland-server-presentation-time.h"
0014 
0015 namespace KWin
0016 {
0017 
0018 class Display;
0019 class SurfaceInterface;
0020 
0021 class PresentationTime : public QObject, QtWaylandServer::wp_presentation
0022 {
0023     Q_OBJECT
0024 public:
0025     explicit PresentationTime(Display *display, QObject *parent);
0026 
0027 private:
0028     void wp_presentation_bind_resource(Resource *resource) override;
0029     void wp_presentation_destroy(Resource *resource) override;
0030     void wp_presentation_feedback(Resource *resource, wl_resource *surface, uint32_t callback) override;
0031 };
0032 
0033 class PresentationTimeFeedback : public PresentationFeedback
0034 {
0035 public:
0036     PresentationTimeFeedback();
0037     ~PresentationTimeFeedback() override;
0038 
0039     wl_list resources;
0040 
0041     void presented(std::chrono::nanoseconds refreshCycleDuration, std::chrono::nanoseconds timestamp, PresentationMode mode) override;
0042 };
0043 
0044 }