summaryrefslogtreecommitdiff
path: root/src/protocols/Screencopy.hpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-15 23:43:41 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-15 23:43:41 +0100
commitedad24c257c1264e2d0c05b04798b6c90515831e (patch)
tree06cc06108ea9c868bdeab4c2aef6701f0eb029d9 /src/protocols/Screencopy.hpp
parent12604b76763abf96b513ad45a1700efae6b5c420 (diff)
Screencopy: unify frame and client between impls + event
Adds a new event to both hooks and ipc: screencopy
Diffstat (limited to 'src/protocols/Screencopy.hpp')
-rw-r--r--src/protocols/Screencopy.hpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/protocols/Screencopy.hpp b/src/protocols/Screencopy.hpp
index 77d2b5c3..17b5ed0b 100644
--- a/src/protocols/Screencopy.hpp
+++ b/src/protocols/Screencopy.hpp
@@ -5,21 +5,42 @@
#include <list>
#include <vector>
+#include "../managers/HookSystemManager.hpp"
class CMonitor;
-struct SScreencopyClient {
- int ref = 0;
- wl_resource* resource = nullptr;
+enum eClientOwners
+{
+ CLIENT_SCREENCOPY = 0,
+ CLIENT_TOPLEVEL_EXPORT
+};
+
+class CScreencopyClient {
+ public:
+ CScreencopyClient();
+ ~CScreencopyClient();
+
+ int ref = 0;
+ wl_resource* resource = nullptr;
+
+ eClientOwners clientOwner = CLIENT_SCREENCOPY;
+
+ int frameCounter = 0;
+ int framesInLastHalfSecond = 0;
+ std::chrono::system_clock::time_point lastMeasure;
+ bool sentScreencast = false;
+
+ void onTick();
+ HOOK_CALLBACK_FN* tickCallback = nullptr;
- bool operator==(const SScreencopyClient& other) const {
+ bool operator==(const CScreencopyClient& other) const {
return resource == other.resource;
}
};
struct SScreencopyFrame {
wl_resource* resource = nullptr;
- SScreencopyClient* client = nullptr;
+ CScreencopyClient* client = nullptr;
uint32_t shmFormat = 0;
uint32_t dmabufFormat = 0;
@@ -34,6 +55,7 @@ struct SScreencopyFrame {
wlr_buffer* buffer = nullptr;
CMonitor* pMonitor = nullptr;
+ CWindow* pWindow = nullptr;
bool operator==(const SScreencopyFrame& other) const {
return resource == other.resource && client == other.client;
@@ -45,7 +67,7 @@ class CScreencopyProtocolManager {
CScreencopyProtocolManager();
void bindManager(wl_client* client, void* data, uint32_t version, uint32_t id);
- void removeClient(SScreencopyClient* client, bool force = false);
+ void removeClient(CScreencopyClient* client, bool force = false);
void removeFrame(SScreencopyFrame* frame, bool force = false);
void displayDestroy();
@@ -59,7 +81,7 @@ class CScreencopyProtocolManager {
private:
wl_global* m_pGlobal = nullptr;
std::list<SScreencopyFrame> m_lFrames;
- std::list<SScreencopyClient> m_lClients;
+ std::list<CScreencopyClient> m_lClients;
wl_listener m_liDisplayDestroy;