2022-12-05 18:05:15 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
2023-04-27 14:55:13 +02:00
|
|
|
#include "hyprland-toplevel-export-v1-protocol.h"
|
2023-04-16 00:43:41 +02:00
|
|
|
#include "Screencopy.hpp"
|
2022-12-05 18:05:15 +01:00
|
|
|
|
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class CMonitor;
|
|
|
|
class CWindow;
|
|
|
|
|
|
|
|
class CToplevelExportProtocolManager {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
2022-12-05 18:05:15 +01:00
|
|
|
CToplevelExportProtocolManager();
|
|
|
|
|
2022-12-20 03:18:47 +01:00
|
|
|
void bindManager(wl_client* client, void* data, uint32_t version, uint32_t id);
|
2024-04-27 13:43:12 +02:00
|
|
|
void captureToplevel(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, PHLWINDOW handle);
|
2023-04-16 00:43:41 +02:00
|
|
|
void removeClient(CScreencopyClient* client, bool force = false);
|
|
|
|
void removeFrame(SScreencopyFrame* frame, bool force = false);
|
2022-12-20 03:18:47 +01:00
|
|
|
void copyFrame(wl_client* client, wl_resource* resource, wl_resource* buffer, int32_t ignore_damage);
|
2022-12-16 18:17:31 +01:00
|
|
|
void displayDestroy();
|
2024-04-27 13:43:12 +02:00
|
|
|
void onWindowUnmap(PHLWINDOW pWindow);
|
2024-07-21 13:09:54 +02:00
|
|
|
void onOutputCommit(CMonitor* pMonitor);
|
2022-12-05 18:05:15 +01:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
private:
|
2023-04-16 00:43:41 +02:00
|
|
|
wl_global* m_pGlobal = nullptr;
|
|
|
|
std::list<SScreencopyFrame> m_lFrames;
|
|
|
|
std::list<CScreencopyClient> m_lClients;
|
2022-12-05 18:05:15 +01:00
|
|
|
|
2023-04-16 00:43:41 +02:00
|
|
|
wl_listener m_liDisplayDestroy;
|
2022-12-05 18:05:15 +01:00
|
|
|
|
2023-04-16 00:43:41 +02:00
|
|
|
std::vector<SScreencopyFrame*> m_vFramesAwaitingWrite;
|
2022-12-05 18:05:15 +01:00
|
|
|
|
2023-04-16 00:43:41 +02:00
|
|
|
void shareFrame(SScreencopyFrame* frame);
|
2023-07-20 12:42:25 +02:00
|
|
|
bool copyFrameDmabuf(SScreencopyFrame* frame, timespec* now);
|
2023-04-16 00:43:41 +02:00
|
|
|
bool copyFrameShm(SScreencopyFrame* frame, timespec* now);
|
2023-07-20 12:42:25 +02:00
|
|
|
void sendDamage(SScreencopyFrame* frame);
|
2023-04-17 23:57:24 +02:00
|
|
|
|
|
|
|
friend class CScreencopyClient;
|
2022-12-05 18:05:15 +01:00
|
|
|
};
|