2024-05-03 02:27:59 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <array>
|
|
|
|
#include "WaylandProtocol.hpp"
|
|
|
|
#include "wlr-virtual-pointer-unstable-v1.hpp"
|
|
|
|
#include "../helpers/signal/Signal.hpp"
|
2024-07-21 13:09:54 +02:00
|
|
|
#include "../devices/IPointer.hpp"
|
2024-07-29 18:14:19 +02:00
|
|
|
#include "../helpers/Monitor.hpp"
|
2024-05-03 02:27:59 +02:00
|
|
|
|
2024-05-03 23:34:10 +02:00
|
|
|
class CVirtualPointerV1Resource {
|
2024-05-03 02:27:59 +02:00
|
|
|
public:
|
2024-07-29 16:27:09 +02:00
|
|
|
CVirtualPointerV1Resource(SP<CZwlrVirtualPointerV1> resource_, WP<CMonitor> boundOutput_);
|
2024-05-03 23:34:10 +02:00
|
|
|
~CVirtualPointerV1Resource();
|
2024-05-03 02:27:59 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
CSignal destroy;
|
2024-07-21 13:09:54 +02:00
|
|
|
CSignal move;
|
|
|
|
CSignal warp;
|
|
|
|
CSignal button;
|
|
|
|
CSignal axis;
|
|
|
|
CSignal frame;
|
|
|
|
|
|
|
|
CSignal swipeBegin;
|
|
|
|
CSignal swipeUpdate;
|
|
|
|
CSignal swipeEnd;
|
|
|
|
|
|
|
|
CSignal pinchBegin;
|
|
|
|
CSignal pinchUpdate;
|
|
|
|
CSignal pinchEnd;
|
|
|
|
|
|
|
|
CSignal holdBegin;
|
|
|
|
CSignal holdEnd;
|
2024-05-03 02:27:59 +02:00
|
|
|
} events;
|
|
|
|
|
2024-07-29 16:27:09 +02:00
|
|
|
bool good();
|
|
|
|
wl_client* client();
|
2024-07-21 13:09:54 +02:00
|
|
|
|
2024-07-29 16:27:09 +02:00
|
|
|
std::string name;
|
|
|
|
|
|
|
|
WP<CMonitor> boundOutput;
|
2024-05-03 02:27:59 +02:00
|
|
|
|
|
|
|
private:
|
2024-07-21 13:09:54 +02:00
|
|
|
SP<CZwlrVirtualPointerV1> resource;
|
2024-05-03 02:27:59 +02:00
|
|
|
|
2024-07-21 13:09:54 +02:00
|
|
|
uint32_t axis = 0;
|
2024-05-03 02:27:59 +02:00
|
|
|
|
2024-07-21 13:09:54 +02:00
|
|
|
std::array<IPointer::SAxisEvent, 2> axisEvents;
|
2024-05-03 02:27:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CVirtualPointerProtocol : public IWaylandProtocol {
|
|
|
|
public:
|
|
|
|
CVirtualPointerProtocol(const wl_interface* iface, const int& ver, const std::string& name);
|
|
|
|
|
|
|
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
|
|
|
|
|
|
|
struct {
|
2024-05-03 23:34:10 +02:00
|
|
|
CSignal newPointer; // SP<CVirtualPointerV1Resource>
|
2024-05-03 02:27:59 +02:00
|
|
|
} events;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void onManagerResourceDestroy(wl_resource* res);
|
2024-05-03 23:34:10 +02:00
|
|
|
void destroyResource(CVirtualPointerV1Resource* pointer);
|
2024-07-29 16:27:09 +02:00
|
|
|
void onCreatePointer(CZwlrVirtualPointerManagerV1* pMgr, wl_resource* seat, uint32_t id, WP<CMonitor> output);
|
2024-05-03 02:27:59 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
std::vector<UP<CZwlrVirtualPointerManagerV1>> m_vManagers;
|
2024-05-03 23:34:10 +02:00
|
|
|
std::vector<SP<CVirtualPointerV1Resource>> m_vPointers;
|
2024-05-03 02:27:59 +02:00
|
|
|
|
2024-05-03 23:34:10 +02:00
|
|
|
friend class CVirtualPointerV1Resource;
|
2024-05-03 02:27:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
namespace PROTO {
|
|
|
|
inline UP<CVirtualPointerProtocol> virtualPointer;
|
|
|
|
};
|