2024-04-19 23:16:35 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include "WaylandProtocol.hpp"
|
2024-04-20 14:25:29 +02:00
|
|
|
#include "tearing-control-v1.hpp"
|
2024-04-19 23:16:35 +02:00
|
|
|
|
|
|
|
class CWindow;
|
|
|
|
class CTearingControlProtocol;
|
|
|
|
|
|
|
|
class CTearingControl {
|
|
|
|
public:
|
2024-04-20 14:25:29 +02:00
|
|
|
CTearingControl(SP<CWpTearingControlV1> resource_, wlr_surface* surf_);
|
2024-04-19 23:16:35 +02:00
|
|
|
|
2024-04-20 14:25:29 +02:00
|
|
|
void onHint(wpTearingControlV1PresentationHint hint_);
|
2024-04-19 23:16:35 +02:00
|
|
|
|
|
|
|
bool good();
|
|
|
|
|
|
|
|
bool operator==(const wl_resource* other) const {
|
|
|
|
return other == resource->resource();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const CTearingControl* other) const {
|
|
|
|
return other->resource == resource;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2024-04-20 14:25:29 +02:00
|
|
|
void updateWindow();
|
2024-04-19 23:16:35 +02:00
|
|
|
|
2024-04-20 14:25:29 +02:00
|
|
|
SP<CWpTearingControlV1> resource;
|
2024-04-27 13:43:12 +02:00
|
|
|
PHLWINDOWREF pWindow;
|
|
|
|
wpTearingControlV1PresentationHint hint = WP_TEARING_CONTROL_V1_PRESENTATION_HINT_VSYNC;
|
2024-04-19 23:16:35 +02:00
|
|
|
|
|
|
|
friend class CTearingControlProtocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CTearingControlProtocol : public IWaylandProtocol {
|
|
|
|
public:
|
|
|
|
CTearingControlProtocol(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);
|
|
|
|
|
|
|
|
private:
|
2024-04-21 20:29:45 +02:00
|
|
|
void onManagerResourceDestroy(wl_resource* res);
|
|
|
|
void onControllerDestroy(CTearingControl* control);
|
|
|
|
void onGetController(wl_client* client, wl_resource* resource, uint32_t id, wlr_surface* surf);
|
2024-04-27 13:43:12 +02:00
|
|
|
void onWindowDestroy(PHLWINDOW pWindow);
|
2024-04-19 23:16:35 +02:00
|
|
|
|
2024-04-21 20:29:45 +02:00
|
|
|
//
|
2024-04-20 14:25:29 +02:00
|
|
|
std::vector<UP<CWpTearingControlManagerV1>> m_vManagers;
|
|
|
|
std::vector<UP<CTearingControl>> m_vTearingControllers;
|
2024-04-21 20:29:45 +02:00
|
|
|
|
|
|
|
friend class CTearingControl;
|
2024-04-19 23:16:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
namespace PROTO {
|
|
|
|
inline UP<CTearingControlProtocol> tearing;
|
|
|
|
};
|