devices: refactor class member vars (#10206)
This commit is contained in:
parent
40147d3a3f
commit
e9c3fcbb64
27 changed files with 585 additions and 578 deletions
|
|
@ -5,62 +5,62 @@
|
|||
SP<CTouchDevice> CTouchDevice::create(SP<Aquamarine::ITouch> touch) {
|
||||
SP<CTouchDevice> pTouch = SP<CTouchDevice>(new CTouchDevice(touch));
|
||||
|
||||
pTouch->self = pTouch;
|
||||
pTouch->m_self = pTouch;
|
||||
|
||||
return pTouch;
|
||||
}
|
||||
|
||||
CTouchDevice::CTouchDevice(SP<Aquamarine::ITouch> touch_) : touch(touch_) {
|
||||
if (!touch)
|
||||
CTouchDevice::CTouchDevice(SP<Aquamarine::ITouch> touch_) : m_touch(touch_) {
|
||||
if (!m_touch)
|
||||
return;
|
||||
|
||||
listeners.destroy = touch->events.destroy.registerListener([this](std::any d) {
|
||||
events.destroy.emit();
|
||||
touch.reset();
|
||||
m_listeners.destroy = m_touch->events.destroy.registerListener([this](std::any d) {
|
||||
m_events.destroy.emit();
|
||||
m_touch.reset();
|
||||
});
|
||||
|
||||
listeners.down = touch->events.down.registerListener([this](std::any d) {
|
||||
m_listeners.down = m_touch->events.down.registerListener([this](std::any d) {
|
||||
auto E = std::any_cast<Aquamarine::ITouch::SDownEvent>(d);
|
||||
|
||||
touchEvents.down.emit(SDownEvent{
|
||||
m_touchEvents.down.emit(SDownEvent{
|
||||
.timeMs = E.timeMs,
|
||||
.touchID = E.touchID,
|
||||
.pos = E.pos,
|
||||
.device = self.lock(),
|
||||
.device = m_self.lock(),
|
||||
});
|
||||
});
|
||||
|
||||
listeners.up = touch->events.up.registerListener([this](std::any d) {
|
||||
m_listeners.up = m_touch->events.up.registerListener([this](std::any d) {
|
||||
auto E = std::any_cast<Aquamarine::ITouch::SUpEvent>(d);
|
||||
|
||||
touchEvents.up.emit(SUpEvent{
|
||||
m_touchEvents.up.emit(SUpEvent{
|
||||
.timeMs = E.timeMs,
|
||||
.touchID = E.touchID,
|
||||
});
|
||||
});
|
||||
|
||||
listeners.motion = touch->events.move.registerListener([this](std::any d) {
|
||||
m_listeners.motion = m_touch->events.move.registerListener([this](std::any d) {
|
||||
auto E = std::any_cast<Aquamarine::ITouch::SMotionEvent>(d);
|
||||
|
||||
touchEvents.motion.emit(SMotionEvent{
|
||||
m_touchEvents.motion.emit(SMotionEvent{
|
||||
.timeMs = E.timeMs,
|
||||
.touchID = E.touchID,
|
||||
.pos = E.pos,
|
||||
});
|
||||
});
|
||||
|
||||
listeners.cancel = touch->events.cancel.registerListener([this](std::any d) {
|
||||
m_listeners.cancel = m_touch->events.cancel.registerListener([this](std::any d) {
|
||||
auto E = std::any_cast<Aquamarine::ITouch::SCancelEvent>(d);
|
||||
|
||||
touchEvents.cancel.emit(SCancelEvent{
|
||||
m_touchEvents.cancel.emit(SCancelEvent{
|
||||
.timeMs = E.timeMs,
|
||||
.touchID = E.touchID,
|
||||
});
|
||||
});
|
||||
|
||||
listeners.frame = touch->events.frame.registerListener([this](std::any d) { touchEvents.frame.emit(); });
|
||||
m_listeners.frame = m_touch->events.frame.registerListener([this](std::any d) { m_touchEvents.frame.emit(); });
|
||||
|
||||
deviceName = touch->getName();
|
||||
m_deviceName = m_touch->getName();
|
||||
}
|
||||
|
||||
bool CTouchDevice::isVirtual() {
|
||||
|
|
@ -68,5 +68,5 @@ bool CTouchDevice::isVirtual() {
|
|||
}
|
||||
|
||||
SP<Aquamarine::ITouch> CTouchDevice::aq() {
|
||||
return touch.lock();
|
||||
return m_touch.lock();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue