wayland/screencopy: add screencopy

This commit is contained in:
outfoxxed 2025-01-14 04:43:05 -08:00
parent 918dd2392d
commit cd429142a4
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
37 changed files with 3149 additions and 3 deletions

View file

@ -0,0 +1,50 @@
#pragma once
#include <qtclasshelpermacros.h>
#include <qwayland-hyprland-toplevel-export-v1.h>
#include "../../toplevel_management/handle.hpp"
#include "../manager.hpp"
namespace qs::wayland::screencopy::hyprland {
class HyprlandScreencopyManager;
class HyprlandScreencopyContext
: public ScreencopyContext
, public QtWayland::hyprland_toplevel_export_frame_v1 {
public:
explicit HyprlandScreencopyContext(
HyprlandScreencopyManager* manager,
toplevel_management::impl::ToplevelHandle* handle,
bool paintCursors
);
~HyprlandScreencopyContext() override;
Q_DISABLE_COPY_MOVE(HyprlandScreencopyContext);
void captureFrame() override;
protected:
// clang-format off
void hyprland_toplevel_export_frame_v1_buffer(uint32_t format, uint32_t width, uint32_t height, uint32_t stride) override;
void hyprland_toplevel_export_frame_v1_linux_dmabuf(uint32_t format, uint32_t width, uint32_t height) override;
void hyprland_toplevel_export_frame_v1_flags(uint32_t flags) override;
void hyprland_toplevel_export_frame_v1_buffer_done() override;
void hyprland_toplevel_export_frame_v1_ready(uint32_t tvSecHi, uint32_t tvSecLo, uint32_t tvNsec) override;
void hyprland_toplevel_export_frame_v1_failed() override;
// clang-format on
private slots:
void onToplevelDestroyed();
private:
HyprlandScreencopyManager* manager;
buffer::WlBufferRequest request;
bool copiedFirstFrame = false;
toplevel_management::impl::ToplevelHandle* handle;
bool paintCursors;
};
} // namespace qs::wayland::screencopy::hyprland