aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/protocols/ToplevelExport.hpp
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-04-15 23:43:41 +0100
committervaxerski <[email protected]>2023-04-15 23:43:41 +0100
commitedad24c257c1264e2d0c05b04798b6c90515831e (patch)
tree06cc06108ea9c868bdeab4c2aef6701f0eb029d9 /src/protocols/ToplevelExport.hpp
parent12604b76763abf96b513ad45a1700efae6b5c420 (diff)
downloadHyprland-edad24c257c1264e2d0c05b04798b6c90515831e.tar.gz
Hyprland-edad24c257c1264e2d0c05b04798b6c90515831e.zip
Screencopy: unify frame and client between impls + event
Adds a new event to both hooks and ipc: screencopy
Diffstat (limited to 'src/protocols/ToplevelExport.hpp')
-rw-r--r--src/protocols/ToplevelExport.hpp54
1 files changed, 12 insertions, 42 deletions
diff --git a/src/protocols/ToplevelExport.hpp b/src/protocols/ToplevelExport.hpp
index e9042e66..eb94fb86 100644
--- a/src/protocols/ToplevelExport.hpp
+++ b/src/protocols/ToplevelExport.hpp
@@ -3,6 +3,7 @@
#include "../defines.hpp"
#include "wlr-foreign-toplevel-management-unstable-v1-protocol.h"
#include "hyprland-toplevel-export-v1-protocol.h"
+#include "Screencopy.hpp"
#include <list>
#include <vector>
@@ -10,61 +11,30 @@
class CMonitor;
class CWindow;
-struct SToplevelClient {
- int ref = 0;
- wl_resource* resource = nullptr;
-
- bool operator==(const SToplevelClient& other) const {
- return resource == other.resource;
- }
-};
-
-struct SToplevelFrame {
- wl_resource* resource = nullptr;
- SToplevelClient* client = nullptr;
-
- uint32_t shmFormat = 0;
- uint32_t dmabufFormat = 0;
- wlr_box box = {0};
- int shmStride = 0;
-
- bool overlayCursor = false;
-
- wlr_buffer_cap bufferCap = WLR_BUFFER_CAP_SHM;
-
- wlr_buffer* buffer = nullptr;
-
- CWindow* pWindow = nullptr;
-
- bool operator==(const SToplevelFrame& other) const {
- return resource == other.resource && client == other.client;
- }
-};
-
class CToplevelExportProtocolManager {
public:
CToplevelExportProtocolManager();
void bindManager(wl_client* client, void* data, uint32_t version, uint32_t id);
void captureToplevel(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, CWindow* handle);
- void removeClient(SToplevelClient* client, bool force = false);
- void removeFrame(SToplevelFrame* frame, bool force = false);
+ void removeClient(CScreencopyClient* client, bool force = false);
+ void removeFrame(SScreencopyFrame* frame, bool force = false);
void copyFrame(wl_client* client, wl_resource* resource, wl_resource* buffer, int32_t ignore_damage);
void displayDestroy();
void onWindowUnmap(CWindow* pWindow);
private:
- wl_global* m_pGlobal = nullptr;
- std::list<SToplevelFrame> m_lFrames;
- std::list<SToplevelClient> m_lClients;
+ wl_global* m_pGlobal = nullptr;
+ std::list<SScreencopyFrame> m_lFrames;
+ std::list<CScreencopyClient> m_lClients;
- wl_listener m_liDisplayDestroy;
+ wl_listener m_liDisplayDestroy;
- std::vector<SToplevelFrame*> m_vFramesAwaitingWrite;
+ std::vector<SScreencopyFrame*> m_vFramesAwaitingWrite;
- void shareFrame(SToplevelFrame* frame);
- bool copyFrameDmabuf(SToplevelFrame* frame);
- bool copyFrameShm(SToplevelFrame* frame, timespec* now);
+ void shareFrame(SScreencopyFrame* frame);
+ bool copyFrameDmabuf(SScreencopyFrame* frame);
+ bool copyFrameShm(SScreencopyFrame* frame, timespec* now);
- void onMonitorRender(CMonitor* pMonitor);
+ void onMonitorRender(CMonitor* pMonitor);
}; \ No newline at end of file