Core: Move to aquamarine (#6608)
Moves Hyprland from wlroots to aquamarine for the backend. --------- Signed-off-by: Vaxry <vaxry@vaxry.net> Co-authored-by: Mihai Fufezan <mihai@fufexan.net> Co-authored-by: Jan Beich <jbeich@FreeBSD.org> Co-authored-by: vaxerski <vaxerski@users.noreply.github.com> Co-authored-by: UjinT34 <41110182+UjinT34@users.noreply.github.com> Co-authored-by: Tom Englund <tomenglund26@gmail.com> Co-authored-by: Ikalco <73481042+ikalco@users.noreply.github.com> Co-authored-by: diniamo <diniamo53@gmail.com>
This commit is contained in:
parent
f642fb97df
commit
016da234d0
131 changed files with 4755 additions and 3460 deletions
|
|
@ -1,7 +1,8 @@
|
|||
#include "TouchDevice.hpp"
|
||||
#include "../defines.hpp"
|
||||
#include <aquamarine/input/Input.hpp>
|
||||
|
||||
SP<CTouchDevice> CTouchDevice::create(wlr_touch* touch) {
|
||||
SP<CTouchDevice> CTouchDevice::create(SP<Aquamarine::ITouch> touch) {
|
||||
SP<CTouchDevice> pTouch = SP<CTouchDevice>(new CTouchDevice(touch));
|
||||
|
||||
pTouch->self = pTouch;
|
||||
|
|
@ -9,78 +10,63 @@ SP<CTouchDevice> CTouchDevice::create(wlr_touch* touch) {
|
|||
return pTouch;
|
||||
}
|
||||
|
||||
CTouchDevice::CTouchDevice(wlr_touch* touch_) : touch(touch_) {
|
||||
CTouchDevice::CTouchDevice(SP<Aquamarine::ITouch> touch_) : touch(touch_) {
|
||||
if (!touch)
|
||||
return;
|
||||
|
||||
// clang-format off
|
||||
hyprListener_destroy.initCallback(&touch->base.events.destroy, [this] (void* owner, void* data) {
|
||||
listeners.destroy = touch->events.destroy.registerListener([this](std::any d) {
|
||||
events.destroy.emit();
|
||||
disconnectCallbacks();
|
||||
touch = nullptr;
|
||||
}, this, "CTouchDevice");
|
||||
touch.reset();
|
||||
});
|
||||
|
||||
hyprListener_down.initCallback(&touch->events.down, [this] (void* owner, void* data) {
|
||||
auto E = (wlr_touch_down_event*)data;
|
||||
listeners.down = touch->events.down.registerListener([this](std::any d) {
|
||||
auto E = std::any_cast<Aquamarine::ITouch::SDownEvent>(d);
|
||||
|
||||
touchEvents.down.emit(SDownEvent{
|
||||
.timeMs = E->time_msec,
|
||||
.touchID = E->touch_id,
|
||||
.pos = {E->x, E->y},
|
||||
.timeMs = E.timeMs,
|
||||
.touchID = E.touchID,
|
||||
.pos = E.pos,
|
||||
.device = self.lock(),
|
||||
});
|
||||
}, this, "CTouchDevice");
|
||||
});
|
||||
|
||||
hyprListener_up.initCallback(&touch->events.up, [this] (void* owner, void* data) {
|
||||
auto E = (wlr_touch_up_event*)data;
|
||||
listeners.up = touch->events.up.registerListener([this](std::any d) {
|
||||
auto E = std::any_cast<Aquamarine::ITouch::SUpEvent>(d);
|
||||
|
||||
touchEvents.up.emit(SUpEvent{
|
||||
.timeMs = E->time_msec,
|
||||
.touchID = E->touch_id
|
||||
.timeMs = E.timeMs,
|
||||
.touchID = E.touchID,
|
||||
});
|
||||
}, this, "CTouchDevice");
|
||||
});
|
||||
|
||||
hyprListener_motion.initCallback(&touch->events.motion, [this] (void* owner, void* data) {
|
||||
auto E = (wlr_touch_motion_event*)data;
|
||||
listeners.motion = touch->events.move.registerListener([this](std::any d) {
|
||||
auto E = std::any_cast<Aquamarine::ITouch::SMotionEvent>(d);
|
||||
|
||||
touchEvents.motion.emit(SMotionEvent{
|
||||
.timeMs = E->time_msec,
|
||||
.touchID = E->touch_id,
|
||||
.pos = {E->x, E->y},
|
||||
.timeMs = E.timeMs,
|
||||
.touchID = E.touchID,
|
||||
.pos = E.pos,
|
||||
});
|
||||
}, this, "CTouchDevice");
|
||||
});
|
||||
|
||||
hyprListener_cancel.initCallback(&touch->events.cancel, [this] (void* owner, void* data) {
|
||||
auto E = (wlr_touch_cancel_event*)data;
|
||||
listeners.cancel = touch->events.cancel.registerListener([this](std::any d) {
|
||||
auto E = std::any_cast<Aquamarine::ITouch::SCancelEvent>(d);
|
||||
|
||||
touchEvents.cancel.emit(SCancelEvent{
|
||||
.timeMs = E->time_msec,
|
||||
.touchID = E->touch_id
|
||||
.timeMs = E.timeMs,
|
||||
.touchID = E.touchID,
|
||||
});
|
||||
}, this, "CTouchDevice");
|
||||
});
|
||||
|
||||
hyprListener_frame.initCallback(&touch->events.frame, [this] (void* owner, void* data) {
|
||||
touchEvents.frame.emit();
|
||||
}, this, "CTouchDevice");
|
||||
listeners.frame = touch->events.frame.registerListener([this](std::any d) { touchEvents.frame.emit(); });
|
||||
|
||||
// clang-format on
|
||||
|
||||
deviceName = touch->base.name ? touch->base.name : "UNKNOWN";
|
||||
deviceName = touch->getName();
|
||||
}
|
||||
|
||||
bool CTouchDevice::isVirtual() {
|
||||
return false;
|
||||
}
|
||||
|
||||
wlr_touch* CTouchDevice::wlr() {
|
||||
return touch;
|
||||
}
|
||||
|
||||
void CTouchDevice::disconnectCallbacks() {
|
||||
hyprListener_destroy.removeCallback();
|
||||
hyprListener_down.removeCallback();
|
||||
hyprListener_up.removeCallback();
|
||||
hyprListener_motion.removeCallback();
|
||||
hyprListener_cancel.removeCallback();
|
||||
hyprListener_frame.removeCallback();
|
||||
SP<Aquamarine::ITouch> CTouchDevice::aq() {
|
||||
return touch.lock();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue