wayland/core: move to new impl (#6268)

* wayland/core/dmabuf: move to new impl

it's the final countdown
This commit is contained in:
Vaxry 2024-06-08 10:07:59 +02:00 committed by GitHub
parent c31d9ef417
commit 6967a31450
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 5388 additions and 2226 deletions

View file

@ -1,6 +1,7 @@
#include "Tablet.hpp"
#include "../defines.hpp"
#include "../protocols/Tablet.hpp"
#include "../protocols/core/Compositor.hpp"
SP<CTablet> CTablet::create(wlr_tablet* tablet) {
SP<CTablet> pTab = SP<CTablet>(new CTablet(tablet));
@ -295,32 +296,29 @@ CTabletTool::~CTabletTool() {
void CTabletTool::disconnectCallbacks() {
hyprListener_destroy.removeCallback();
hyprListener_destroySurface.removeCallback();
listeners.destroySurface.reset();
}
wlr_surface* CTabletTool::getSurface() {
return pSurface;
SP<CWLSurfaceResource> CTabletTool::getSurface() {
return pSurface.lock();
}
void CTabletTool::setSurface(wlr_surface* surf) {
void CTabletTool::setSurface(SP<CWLSurfaceResource> surf) {
if (surf == pSurface)
return;
if (pSurface) {
hyprListener_destroySurface.removeCallback();
pSurface = nullptr;
listeners.destroySurface.reset();
pSurface.reset();
}
pSurface = surf;
if (surf) {
hyprListener_destroySurface.initCallback(
&surf->events.destroy,
[this](void* owner, void* data) {
PROTO::tablet->proximityOut(self.lock());
pSurface = nullptr;
hyprListener_destroySurface.removeCallback();
},
this, "CTabletTool");
listeners.destroySurface = surf->events.destroy.registerListener([this](std::any d) {
PROTO::tablet->proximityOut(self.lock());
pSurface.reset();
listeners.destroySurface.reset();
});
}
}

View file

@ -12,6 +12,7 @@ struct wlr_tablet_pad;
class CTabletTool;
class CTabletPad;
class CWLSurfaceResource;
/*
A tablet device
@ -197,32 +198,35 @@ class CTabletTool : public IHID {
HID_TABLET_TOOL_CAPABILITY_WHEEL = (1 << 5),
};
virtual uint32_t getCapabilities();
wlr_tablet_tool* wlr();
virtual eHIDType getType();
wlr_surface* getSurface();
void setSurface(wlr_surface*);
virtual uint32_t getCapabilities();
wlr_tablet_tool* wlr();
virtual eHIDType getType();
SP<CWLSurfaceResource> getSurface();
void setSurface(SP<CWLSurfaceResource>);
WP<CTabletTool> self;
Vector2D tilt;
bool active = false; // true if in proximity
uint32_t toolCapabilities = 0;
WP<CTabletTool> self;
Vector2D tilt;
bool active = false; // true if in proximity
uint32_t toolCapabilities = 0;
bool isDown = false;
std::vector<uint32_t> buttonsDown;
Vector2D absolutePos; // last known absolute position.
bool isDown = false;
std::vector<uint32_t> buttonsDown;
Vector2D absolutePos; // last known absolute position.
std::string hlName;
std::string hlName;
private:
CTabletTool(wlr_tablet_tool* tool);
void disconnectCallbacks();
void disconnectCallbacks();
wlr_surface* pSurface = nullptr;
WP<CWLSurfaceResource> pSurface;
wlr_tablet_tool* tool = nullptr;
wlr_tablet_tool* tool = nullptr;
DYNLISTENER(destroy);
DYNLISTENER(destroySurface);
struct {
CHyprSignalListener destroySurface;
} listeners;
};