devices: refactor class member vars (#10206)
This commit is contained in:
parent
40147d3a3f
commit
e9c3fcbb64
27 changed files with 585 additions and 578 deletions
|
|
@ -151,7 +151,7 @@ CKeybindManager::CKeybindManager() {
|
|||
return;
|
||||
|
||||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||
if (!PACTIVEKEEB->allowBinds)
|
||||
if (!PACTIVEKEEB->m_allowBinds)
|
||||
return;
|
||||
|
||||
const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(m_pLastLongPressKeybind->handler);
|
||||
|
|
@ -168,7 +168,7 @@ CKeybindManager::CKeybindManager() {
|
|||
return;
|
||||
|
||||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||
if (!PACTIVEKEEB->allowBinds)
|
||||
if (!PACTIVEKEEB->m_allowBinds)
|
||||
return;
|
||||
|
||||
for (const auto& k : m_vActiveKeybinds) {
|
||||
|
|
@ -178,7 +178,7 @@ CKeybindManager::CKeybindManager() {
|
|||
DISPATCHER->second(k->arg);
|
||||
}
|
||||
|
||||
self->updateTimeout(std::chrono::milliseconds(1000 / PACTIVEKEEB->repeatRate));
|
||||
self->updateTimeout(std::chrono::milliseconds(1000 / PACTIVEKEEB->m_repeatRate));
|
||||
},
|
||||
nullptr);
|
||||
|
||||
|
|
@ -431,7 +431,7 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!pKeyboard->allowBinds)
|
||||
if (!pKeyboard->m_allowBinds)
|
||||
return true;
|
||||
|
||||
if (!m_pXKBTranslationState) {
|
||||
|
|
@ -446,8 +446,8 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
|
|||
|
||||
const auto KEYCODE = e.keycode + 8; // Because to xkbcommon it's +8 from libinput
|
||||
|
||||
const xkb_keysym_t keysym = xkb_state_key_get_one_sym(pKeyboard->resolveBindsBySym ? pKeyboard->xkbSymState : m_pXKBTranslationState, KEYCODE);
|
||||
const xkb_keysym_t internalKeysym = xkb_state_key_get_one_sym(pKeyboard->xkbState, KEYCODE);
|
||||
const xkb_keysym_t keysym = xkb_state_key_get_one_sym(pKeyboard->m_resolveBindsBySym ? pKeyboard->m_xkbSymState : m_pXKBTranslationState, KEYCODE);
|
||||
const xkb_keysym_t internalKeysym = xkb_state_key_get_one_sym(pKeyboard->m_xkbState, KEYCODE);
|
||||
|
||||
if (keysym == XKB_KEY_Escape || internalKeysym == XKB_KEY_Escape)
|
||||
PROTO::data->abortDndIfPresent();
|
||||
|
|
@ -764,7 +764,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
|||
if (k->longPress) {
|
||||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||
|
||||
m_pLongPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->repeatDelay));
|
||||
m_pLongPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->m_repeatDelay));
|
||||
m_pLastLongPressKeybind = k;
|
||||
|
||||
continue;
|
||||
|
|
@ -804,7 +804,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
|||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||
|
||||
m_vActiveKeybinds.emplace_back(k);
|
||||
m_pRepeatKeyTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->repeatDelay));
|
||||
m_pRepeatKeyTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->m_repeatDelay));
|
||||
}
|
||||
|
||||
if (!k->nonConsuming)
|
||||
|
|
@ -2541,8 +2541,8 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
const auto KEYPAIRSTRING = std::format("{}{}", (uintptr_t)KB.get(), KEY);
|
||||
|
||||
if (!g_pKeybindManager->m_mKeyToCodeCache.contains(KEYPAIRSTRING)) {
|
||||
xkb_keymap* km = KB->xkbKeymap;
|
||||
xkb_state* ks = KB->xkbState;
|
||||
xkb_keymap* km = KB->m_xkbKeymap;
|
||||
xkb_state* ks = KB->m_xkbState;
|
||||
|
||||
xkb_keycode_t keycode_min, keycode_max;
|
||||
keycode_min = xkb_keymap_min_keycode(km);
|
||||
|
|
|
|||
|
|
@ -805,31 +805,31 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
|
|||
switch (dev->getType()) {
|
||||
case HID_TYPE_TABLET: {
|
||||
CTablet* TAB = reinterpret_cast<CTablet*>(dev.get());
|
||||
if (!TAB->boundOutput.empty()) {
|
||||
mappedArea = outputMappedArea(TAB->boundOutput);
|
||||
mappedArea.translate(TAB->boundBox.pos());
|
||||
} else if (TAB->absolutePos) {
|
||||
mappedArea.x = TAB->boundBox.x;
|
||||
mappedArea.y = TAB->boundBox.y;
|
||||
if (!TAB->m_boundOutput.empty()) {
|
||||
mappedArea = outputMappedArea(TAB->m_boundOutput);
|
||||
mappedArea.translate(TAB->m_boundBox.pos());
|
||||
} else if (TAB->m_absolutePos) {
|
||||
mappedArea.x = TAB->m_boundBox.x;
|
||||
mappedArea.y = TAB->m_boundBox.y;
|
||||
} else
|
||||
mappedArea.translate(TAB->boundBox.pos());
|
||||
mappedArea.translate(TAB->m_boundBox.pos());
|
||||
|
||||
if (!TAB->boundBox.empty()) {
|
||||
mappedArea.w = TAB->boundBox.w;
|
||||
mappedArea.h = TAB->boundBox.h;
|
||||
if (!TAB->m_boundBox.empty()) {
|
||||
mappedArea.w = TAB->m_boundBox.w;
|
||||
mappedArea.h = TAB->m_boundBox.h;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HID_TYPE_TOUCH: {
|
||||
ITouch* TOUCH = reinterpret_cast<ITouch*>(dev.get());
|
||||
if (!TOUCH->boundOutput.empty())
|
||||
mappedArea = outputMappedArea(TOUCH->boundOutput);
|
||||
if (!TOUCH->m_boundOutput.empty())
|
||||
mappedArea = outputMappedArea(TOUCH->m_boundOutput);
|
||||
break;
|
||||
}
|
||||
case HID_TYPE_POINTER: {
|
||||
IPointer* POINTER = reinterpret_cast<IPointer*>(dev.get());
|
||||
if (!POINTER->boundOutput.empty())
|
||||
mappedArea = outputMappedArea(POINTER->boundOutput);
|
||||
if (!POINTER->m_boundOutput.empty())
|
||||
mappedArea = outputMappedArea(POINTER->m_boundOutput);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
|
|
@ -892,11 +892,11 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
listener->pointer = pointer;
|
||||
|
||||
// clang-format off
|
||||
listener->destroy = pointer->events.destroy.registerListener([this] (std::any d) {
|
||||
listener->destroy = pointer->m_events.destroy.registerListener([this] (std::any d) {
|
||||
detachPointer(nullptr);
|
||||
});
|
||||
|
||||
listener->motion = pointer->pointerEvents.motion.registerListener([] (std::any e) {
|
||||
listener->motion = pointer->m_pointerEvents.motion.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SMotionEvent>(e);
|
||||
|
||||
g_pInputManager->onMouseMoved(E);
|
||||
|
|
@ -907,7 +907,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->motionAbsolute = pointer->pointerEvents.motionAbsolute.registerListener([] (std::any e) {
|
||||
listener->motionAbsolute = pointer->m_pointerEvents.motionAbsolute.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SMotionAbsoluteEvent>(e);
|
||||
|
||||
g_pInputManager->onMouseWarp(E);
|
||||
|
|
@ -918,7 +918,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->button = pointer->pointerEvents.button.registerListener([] (std::any e) {
|
||||
listener->button = pointer->m_pointerEvents.button.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SButtonEvent>(e);
|
||||
|
||||
g_pInputManager->onMouseButton(E);
|
||||
|
|
@ -926,7 +926,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->axis = pointer->pointerEvents.axis.registerListener([] (std::any e) {
|
||||
listener->axis = pointer->m_pointerEvents.axis.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SAxisEvent>(e);
|
||||
|
||||
g_pInputManager->onMouseWheel(E);
|
||||
|
|
@ -934,7 +934,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->frame = pointer->pointerEvents.frame.registerListener([] (std::any e) {
|
||||
listener->frame = pointer->m_pointerEvents.frame.registerListener([] (std::any e) {
|
||||
bool shouldSkip = false;
|
||||
if (!g_pSeatManager->mouse.expired() && g_pInputManager->isLocked()) {
|
||||
auto PMONITOR = g_pCompositor->m_lastMonitor.get();
|
||||
|
|
@ -945,7 +945,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pSeatManager->sendPointerFrame();
|
||||
});
|
||||
|
||||
listener->swipeBegin = pointer->pointerEvents.swipeBegin.registerListener([] (std::any e) {
|
||||
listener->swipeBegin = pointer->m_pointerEvents.swipeBegin.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SSwipeBeginEvent>(e);
|
||||
|
||||
g_pInputManager->onSwipeBegin(E);
|
||||
|
|
@ -956,7 +956,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->swipeEnd = pointer->pointerEvents.swipeEnd.registerListener([] (std::any e) {
|
||||
listener->swipeEnd = pointer->m_pointerEvents.swipeEnd.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SSwipeEndEvent>(e);
|
||||
|
||||
g_pInputManager->onSwipeEnd(E);
|
||||
|
|
@ -964,7 +964,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->swipeUpdate = pointer->pointerEvents.swipeUpdate.registerListener([] (std::any e) {
|
||||
listener->swipeUpdate = pointer->m_pointerEvents.swipeUpdate.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SSwipeUpdateEvent>(e);
|
||||
|
||||
g_pInputManager->onSwipeUpdate(E);
|
||||
|
|
@ -972,7 +972,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->pinchBegin = pointer->pointerEvents.pinchBegin.registerListener([] (std::any e) {
|
||||
listener->pinchBegin = pointer->m_pointerEvents.pinchBegin.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SPinchBeginEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->pinchBegin(E.timeMs, E.fingers);
|
||||
|
|
@ -983,7 +983,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->pinchEnd = pointer->pointerEvents.pinchEnd.registerListener([] (std::any e) {
|
||||
listener->pinchEnd = pointer->m_pointerEvents.pinchEnd.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SPinchEndEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->pinchEnd(E.timeMs, E.cancelled);
|
||||
|
|
@ -991,7 +991,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->pinchUpdate = pointer->pointerEvents.pinchUpdate.registerListener([] (std::any e) {
|
||||
listener->pinchUpdate = pointer->m_pointerEvents.pinchUpdate.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SPinchUpdateEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->pinchUpdate(E.timeMs, E.delta, E.scale, E.rotation);
|
||||
|
|
@ -999,7 +999,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->holdBegin = pointer->pointerEvents.holdBegin.registerListener([] (std::any e) {
|
||||
listener->holdBegin = pointer->m_pointerEvents.holdBegin.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SHoldBeginEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->holdBegin(E.timeMs, E.fingers);
|
||||
|
|
@ -1007,7 +1007,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->holdEnd = pointer->pointerEvents.holdEnd.registerListener([] (std::any e) {
|
||||
listener->holdEnd = pointer->m_pointerEvents.holdEnd.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<IPointer::SHoldEndEvent>(e);
|
||||
|
||||
PROTO::pointerGestures->holdEnd(E.timeMs, E.cancelled);
|
||||
|
|
@ -1016,7 +1016,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||
});
|
||||
// clang-format on
|
||||
|
||||
Debug::log(LOG, "Attached pointer {} to global", pointer->hlName);
|
||||
Debug::log(LOG, "Attached pointer {} to global", pointer->m_hlName);
|
||||
}
|
||||
|
||||
void CPointerManager::attachTouch(SP<ITouch> touch) {
|
||||
|
|
@ -1031,11 +1031,11 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||
listener->touch = touch;
|
||||
|
||||
// clang-format off
|
||||
listener->destroy = touch->events.destroy.registerListener([this] (std::any d) {
|
||||
listener->destroy = touch->m_events.destroy.registerListener([this] (std::any d) {
|
||||
detachTouch(nullptr);
|
||||
});
|
||||
|
||||
listener->down = touch->touchEvents.down.registerListener([] (std::any e) {
|
||||
listener->down = touch->m_touchEvents.down.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<ITouch::SDownEvent>(e);
|
||||
|
||||
g_pInputManager->onTouchDown(E);
|
||||
|
|
@ -1046,7 +1046,7 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->up = touch->touchEvents.up.registerListener([] (std::any e) {
|
||||
listener->up = touch->m_touchEvents.up.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<ITouch::SUpEvent>(e);
|
||||
|
||||
g_pInputManager->onTouchUp(E);
|
||||
|
|
@ -1054,7 +1054,7 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->motion = touch->touchEvents.motion.registerListener([] (std::any e) {
|
||||
listener->motion = touch->m_touchEvents.motion.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<ITouch::SMotionEvent>(e);
|
||||
|
||||
g_pInputManager->onTouchMove(E);
|
||||
|
|
@ -1062,16 +1062,16 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->cancel = touch->touchEvents.cancel.registerListener([] (std::any e) {
|
||||
listener->cancel = touch->m_touchEvents.cancel.registerListener([] (std::any e) {
|
||||
//
|
||||
});
|
||||
|
||||
listener->frame = touch->touchEvents.frame.registerListener([] (std::any e) {
|
||||
listener->frame = touch->m_touchEvents.frame.registerListener([] (std::any e) {
|
||||
g_pSeatManager->sendTouchFrame();
|
||||
});
|
||||
// clang-format on
|
||||
|
||||
Debug::log(LOG, "Attached touch {} to global", touch->hlName);
|
||||
Debug::log(LOG, "Attached touch {} to global", touch->m_hlName);
|
||||
}
|
||||
|
||||
void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
||||
|
|
@ -1086,11 +1086,11 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||
listener->tablet = tablet;
|
||||
|
||||
// clang-format off
|
||||
listener->destroy = tablet->events.destroy.registerListener([this] (std::any d) {
|
||||
listener->destroy = tablet->m_events.destroy.registerListener([this] (std::any d) {
|
||||
detachTablet(nullptr);
|
||||
});
|
||||
|
||||
listener->axis = tablet->tabletEvents.axis.registerListener([] (std::any e) {
|
||||
listener->axis = tablet->m_tabletEvents.axis.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<CTablet::SAxisEvent>(e);
|
||||
|
||||
g_pInputManager->onTabletAxis(E);
|
||||
|
|
@ -1101,7 +1101,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->proximity = tablet->tabletEvents.proximity.registerListener([] (std::any e) {
|
||||
listener->proximity = tablet->m_tabletEvents.proximity.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<CTablet::SProximityEvent>(e);
|
||||
|
||||
g_pInputManager->onTabletProximity(E);
|
||||
|
|
@ -1109,7 +1109,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||
PROTO::idle->onActivity();
|
||||
});
|
||||
|
||||
listener->tip = tablet->tabletEvents.tip.registerListener([] (std::any e) {
|
||||
listener->tip = tablet->m_tabletEvents.tip.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<CTablet::STipEvent>(e);
|
||||
|
||||
g_pInputManager->onTabletTip(E);
|
||||
|
|
@ -1120,7 +1120,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||
g_pKeybindManager->dpms("on");
|
||||
});
|
||||
|
||||
listener->button = tablet->tabletEvents.button.registerListener([] (std::any e) {
|
||||
listener->button = tablet->m_tabletEvents.button.registerListener([] (std::any e) {
|
||||
auto E = std::any_cast<CTablet::SButtonEvent>(e);
|
||||
|
||||
g_pInputManager->onTabletButton(E);
|
||||
|
|
@ -1129,7 +1129,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||
});
|
||||
// clang-format on
|
||||
|
||||
Debug::log(LOG, "Attached tablet {} to global", tablet->hlName);
|
||||
Debug::log(LOG, "Attached tablet {} to global", tablet->m_hlName);
|
||||
}
|
||||
|
||||
void CPointerManager::detachPointer(SP<IPointer> pointer) {
|
||||
|
|
|
|||
|
|
@ -87,18 +87,18 @@ void CSeatManager::setKeyboard(SP<IKeyboard> KEEB) {
|
|||
return;
|
||||
|
||||
if (keyboard)
|
||||
keyboard->active = false;
|
||||
keyboard->m_active = false;
|
||||
keyboard = KEEB;
|
||||
|
||||
if (KEEB)
|
||||
KEEB->active = true;
|
||||
KEEB->m_active = true;
|
||||
|
||||
updateActiveKeyboardData();
|
||||
}
|
||||
|
||||
void CSeatManager::updateActiveKeyboardData() {
|
||||
if (keyboard)
|
||||
PROTO::seat->updateRepeatInfo(keyboard->repeatRate, keyboard->repeatDelay);
|
||||
PROTO::seat->updateRepeatInfo(keyboard->m_repeatRate, keyboard->m_repeatDelay);
|
||||
PROTO::seat->updateKeymap();
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ void CSeatManager::setKeyboardFocus(SP<CWLSurfaceResource> surf) {
|
|||
continue;
|
||||
|
||||
k->sendEnter(surf);
|
||||
k->sendMods(keyboard->modifiersState.depressed, keyboard->modifiersState.latched, keyboard->modifiersState.locked, keyboard->modifiersState.group);
|
||||
k->sendMods(keyboard->m_modifiersState.depressed, keyboard->m_modifiersState.latched, keyboard->m_modifiersState.locked, keyboard->m_modifiersState.group);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,12 +98,12 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) {
|
|||
Vector2D unaccel = e.unaccel;
|
||||
|
||||
if (e.device) {
|
||||
if (e.device->isTouchpad) {
|
||||
if (e.device->flipX) {
|
||||
if (e.device->m_isTouchpad) {
|
||||
if (e.device->m_flipX) {
|
||||
delta.x = -delta.x;
|
||||
unaccel.x = -unaccel.x;
|
||||
}
|
||||
if (e.device->flipY) {
|
||||
if (e.device->m_flipY) {
|
||||
delta.y = -delta.y;
|
||||
unaccel.y = -unaccel.y;
|
||||
}
|
||||
|
|
@ -945,14 +945,14 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||
m_vHIDs.emplace_back(keeb);
|
||||
|
||||
try {
|
||||
keeb->hlName = getNameForNewDevice(keeb->deviceName);
|
||||
keeb->m_hlName = getNameForNewDevice(keeb->m_deviceName);
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "Keyboard had no name???"); // logic error
|
||||
}
|
||||
|
||||
keeb->events.destroy.registerStaticListener(
|
||||
keeb->m_events.destroy.registerStaticListener(
|
||||
[this](void* owner, std::any data) {
|
||||
auto PKEEB = ((IKeyboard*)owner)->self.lock();
|
||||
auto PKEEB = ((IKeyboard*)owner)->m_self.lock();
|
||||
|
||||
if (!PKEEB)
|
||||
return;
|
||||
|
|
@ -962,37 +962,37 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||
},
|
||||
keeb.get());
|
||||
|
||||
keeb->keyboardEvents.key.registerStaticListener(
|
||||
keeb->m_keyboardEvents.key.registerStaticListener(
|
||||
[this](void* owner, std::any data) {
|
||||
auto PKEEB = ((IKeyboard*)owner)->self.lock();
|
||||
auto PKEEB = ((IKeyboard*)owner)->m_self.lock();
|
||||
|
||||
onKeyboardKey(data, PKEEB);
|
||||
|
||||
if (PKEEB->enabled)
|
||||
if (PKEEB->m_enabled)
|
||||
PROTO::idle->onActivity();
|
||||
|
||||
if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
|
||||
if (PKEEB->m_enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
|
||||
g_pKeybindManager->dpms("on");
|
||||
},
|
||||
keeb.get());
|
||||
|
||||
keeb->keyboardEvents.modifiers.registerStaticListener(
|
||||
keeb->m_keyboardEvents.modifiers.registerStaticListener(
|
||||
[this](void* owner, std::any data) {
|
||||
auto PKEEB = ((IKeyboard*)owner)->self.lock();
|
||||
auto PKEEB = ((IKeyboard*)owner)->m_self.lock();
|
||||
|
||||
onKeyboardMod(PKEEB);
|
||||
|
||||
if (PKEEB->enabled)
|
||||
if (PKEEB->m_enabled)
|
||||
PROTO::idle->onActivity();
|
||||
|
||||
if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
|
||||
if (PKEEB->m_enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn)
|
||||
g_pKeybindManager->dpms("on");
|
||||
},
|
||||
keeb.get());
|
||||
|
||||
keeb->keyboardEvents.keymap.registerStaticListener(
|
||||
keeb->m_keyboardEvents.keymap.registerStaticListener(
|
||||
[](void* owner, std::any data) {
|
||||
auto PKEEB = ((IKeyboard*)owner)->self.lock();
|
||||
auto PKEEB = ((IKeyboard*)owner)->m_self.lock();
|
||||
const auto LAYOUT = PKEEB->getActiveLayout();
|
||||
|
||||
if (PKEEB == g_pSeatManager->keyboard) {
|
||||
|
|
@ -1000,7 +1000,7 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||
g_pKeybindManager->m_mKeyToCodeCache.clear();
|
||||
}
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->hlName + "," + LAYOUT});
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->m_hlName + "," + LAYOUT});
|
||||
EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{PKEEB, LAYOUT}));
|
||||
},
|
||||
keeb.get());
|
||||
|
|
@ -1022,7 +1022,7 @@ void CInputManager::setKeyboardLayout() {
|
|||
}
|
||||
|
||||
void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) {
|
||||
auto devname = pKeyboard->hlName;
|
||||
auto devname = pKeyboard->m_hlName;
|
||||
|
||||
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
||||
|
||||
|
|
@ -1044,14 +1044,14 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) {
|
|||
const auto ENABLED = HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "enabled") : true;
|
||||
const auto ALLOWBINDS = HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "keybinds") : true;
|
||||
|
||||
pKeyboard->enabled = ENABLED;
|
||||
pKeyboard->resolveBindsBySym = RESOLVEBINDSBYSYM;
|
||||
pKeyboard->allowBinds = ALLOWBINDS;
|
||||
pKeyboard->m_enabled = ENABLED;
|
||||
pKeyboard->m_resolveBindsBySym = RESOLVEBINDSBYSYM;
|
||||
pKeyboard->m_allowBinds = ALLOWBINDS;
|
||||
|
||||
try {
|
||||
if (NUMLOCKON == pKeyboard->numlockOn && REPEATDELAY == pKeyboard->repeatDelay && REPEATRATE == pKeyboard->repeatRate && RULES != "" &&
|
||||
RULES == pKeyboard->currentRules.rules && MODEL == pKeyboard->currentRules.model && LAYOUT == pKeyboard->currentRules.layout &&
|
||||
VARIANT == pKeyboard->currentRules.variant && OPTIONS == pKeyboard->currentRules.options && FILEPATH == pKeyboard->xkbFilePath) {
|
||||
if (NUMLOCKON == pKeyboard->m_numlockOn && REPEATDELAY == pKeyboard->m_repeatDelay && REPEATRATE == pKeyboard->m_repeatRate && RULES != "" &&
|
||||
RULES == pKeyboard->m_currentRules.rules && MODEL == pKeyboard->m_currentRules.model && LAYOUT == pKeyboard->m_currentRules.layout &&
|
||||
VARIANT == pKeyboard->m_currentRules.variant && OPTIONS == pKeyboard->m_currentRules.options && FILEPATH == pKeyboard->m_xkbFilePath) {
|
||||
Debug::log(LOG, "Not applying config to keyboard, it did not change.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -1060,19 +1060,20 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) {
|
|||
// we can ignore those and just apply
|
||||
}
|
||||
|
||||
pKeyboard->repeatRate = std::max(0, REPEATRATE);
|
||||
pKeyboard->repeatDelay = std::max(0, REPEATDELAY);
|
||||
pKeyboard->numlockOn = NUMLOCKON;
|
||||
pKeyboard->xkbFilePath = FILEPATH;
|
||||
pKeyboard->m_repeatRate = std::max(0, REPEATRATE);
|
||||
pKeyboard->m_repeatDelay = std::max(0, REPEATDELAY);
|
||||
pKeyboard->m_numlockOn = NUMLOCKON;
|
||||
pKeyboard->m_xkbFilePath = FILEPATH;
|
||||
|
||||
pKeyboard->setKeymap(IKeyboard::SStringRuleNames{LAYOUT, MODEL, VARIANT, OPTIONS, RULES});
|
||||
|
||||
const auto LAYOUTSTR = pKeyboard->getActiveLayout();
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->hlName + "," + LAYOUTSTR});
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->m_hlName + "," + LAYOUTSTR});
|
||||
EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{pKeyboard, LAYOUTSTR}));
|
||||
|
||||
Debug::log(LOG, "Set the keyboard layout to {} and variant to {} for keyboard \"{}\"", pKeyboard->currentRules.layout, pKeyboard->currentRules.variant, pKeyboard->hlName);
|
||||
Debug::log(LOG, "Set the keyboard layout to {} and variant to {} for keyboard \"{}\"", pKeyboard->m_currentRules.layout, pKeyboard->m_currentRules.variant,
|
||||
pKeyboard->m_hlName);
|
||||
}
|
||||
|
||||
void CInputManager::newVirtualMouse(SP<CVirtualPointerV1Resource> mouse) {
|
||||
|
|
@ -1095,7 +1096,7 @@ void CInputManager::setupMouse(SP<IPointer> mauz) {
|
|||
m_vHIDs.emplace_back(mauz);
|
||||
|
||||
try {
|
||||
mauz->hlName = getNameForNewDevice(mauz->deviceName);
|
||||
mauz->m_hlName = getNameForNewDevice(mauz->m_deviceName);
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "Mouse had no name???"); // logic error
|
||||
}
|
||||
|
|
@ -1110,18 +1111,18 @@ void CInputManager::setupMouse(SP<IPointer> mauz) {
|
|||
|
||||
g_pPointerManager->attachPointer(mauz);
|
||||
|
||||
mauz->connected = true;
|
||||
mauz->m_connected = true;
|
||||
|
||||
setPointerConfigs();
|
||||
|
||||
mauz->events.destroy.registerStaticListener(
|
||||
mauz->m_events.destroy.registerStaticListener(
|
||||
[this](void* mouse, std::any data) {
|
||||
const auto PMOUSE = (IPointer*)mouse;
|
||||
|
||||
if (!PMOUSE)
|
||||
return;
|
||||
|
||||
destroyPointer(PMOUSE->self.lock());
|
||||
destroyPointer(PMOUSE->m_self.lock());
|
||||
},
|
||||
mauz.get());
|
||||
|
||||
|
|
@ -1132,18 +1133,18 @@ void CInputManager::setupMouse(SP<IPointer> mauz) {
|
|||
|
||||
void CInputManager::setPointerConfigs() {
|
||||
for (auto const& m : m_vPointers) {
|
||||
auto devname = m->hlName;
|
||||
auto devname = m->m_hlName;
|
||||
|
||||
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
||||
|
||||
if (HASCONFIG) {
|
||||
const auto ENABLED = g_pConfigManager->getDeviceInt(devname, "enabled");
|
||||
if (ENABLED && !m->connected) {
|
||||
if (ENABLED && !m->m_connected) {
|
||||
g_pPointerManager->attachPointer(m);
|
||||
m->connected = true;
|
||||
} else if (!ENABLED && m->connected) {
|
||||
m->m_connected = true;
|
||||
} else if (!ENABLED && m->m_connected) {
|
||||
g_pPointerManager->detachPointer(m);
|
||||
m->connected = false;
|
||||
m->m_connected = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1227,8 +1228,8 @@ void CInputManager::setPointerConfigs() {
|
|||
const auto LIBINPUTSENS = std::clamp(g_pConfigManager->getDeviceFloat(devname, "sensitivity", "input:sensitivity"), -1.f, 1.f);
|
||||
libinput_device_config_accel_set_speed(LIBINPUTDEV, LIBINPUTSENS);
|
||||
|
||||
m->flipX = g_pConfigManager->getDeviceInt(devname, "flip_x", "input:touchpad:flip_x") != 0;
|
||||
m->flipY = g_pConfigManager->getDeviceInt(devname, "flip_y", "input:touchpad:flip_y") != 0;
|
||||
m->m_flipX = g_pConfigManager->getDeviceInt(devname, "flip_x", "input:touchpad:flip_x") != 0;
|
||||
m->m_flipY = g_pConfigManager->getDeviceInt(devname, "flip_y", "input:touchpad:flip_y") != 0;
|
||||
|
||||
const auto ACCELPROFILE = g_pConfigManager->getDeviceString(devname, "accel_profile", "input:accel_profile");
|
||||
const auto SCROLLPOINTS = g_pConfigManager->getDeviceString(devname, "scroll_points", "input:scroll_points");
|
||||
|
|
@ -1281,7 +1282,7 @@ void CInputManager::setPointerConfigs() {
|
|||
libinput_device_config_scroll_set_button_lock(LIBINPUTDEV,
|
||||
SCROLLBUTTONLOCK == 0 ? LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED : LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED);
|
||||
|
||||
Debug::log(LOG, "Applied config to mouse {}, sens {:.2f}", m->hlName, LIBINPUTSENS);
|
||||
Debug::log(LOG, "Applied config to mouse {}, sens {:.2f}", m->m_hlName, LIBINPUTSENS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1375,7 +1376,7 @@ void CInputManager::updateKeyboardsLeds(SP<IKeyboard> pKeyboard) {
|
|||
}
|
||||
|
||||
void CInputManager::onKeyboardKey(std::any event, SP<IKeyboard> pKeyboard) {
|
||||
if (!pKeyboard->enabled)
|
||||
if (!pKeyboard->m_enabled)
|
||||
return;
|
||||
|
||||
const bool DISALLOWACTION = pKeyboard->isVirtual() && shouldIgnoreVirtualKeyboard(pKeyboard);
|
||||
|
|
@ -1403,14 +1404,14 @@ void CInputManager::onKeyboardKey(std::any event, SP<IKeyboard> pKeyboard) {
|
|||
}
|
||||
|
||||
void CInputManager::onKeyboardMod(SP<IKeyboard> pKeyboard) {
|
||||
if (!pKeyboard->enabled)
|
||||
if (!pKeyboard->m_enabled)
|
||||
return;
|
||||
|
||||
const bool DISALLOWACTION = pKeyboard->isVirtual() && shouldIgnoreVirtualKeyboard(pKeyboard);
|
||||
|
||||
const auto ALLMODS = accumulateModsFromAllKBs();
|
||||
|
||||
auto MODS = pKeyboard->modifiersState;
|
||||
auto MODS = pKeyboard->m_modifiersState;
|
||||
MODS.depressed = ALLMODS;
|
||||
|
||||
const auto IME = m_sIMERelay.m_pIME.lock();
|
||||
|
|
@ -1425,14 +1426,14 @@ void CInputManager::onKeyboardMod(SP<IKeyboard> pKeyboard) {
|
|||
|
||||
updateKeyboardsLeds(pKeyboard);
|
||||
|
||||
if (pKeyboard->modifiersState.group != pKeyboard->activeLayout) {
|
||||
pKeyboard->activeLayout = pKeyboard->modifiersState.group;
|
||||
if (pKeyboard->m_modifiersState.group != pKeyboard->m_activeLayout) {
|
||||
pKeyboard->m_activeLayout = pKeyboard->m_modifiersState.group;
|
||||
|
||||
const auto LAYOUT = pKeyboard->getActiveLayout();
|
||||
|
||||
Debug::log(LOG, "LAYOUT CHANGED TO {} GROUP {}", LAYOUT, MODS.group);
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->hlName + "," + LAYOUT});
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->m_hlName + "," + LAYOUT});
|
||||
EMIT_HOOK_EVENT("activeLayout", (std::vector<std::any>{pKeyboard, LAYOUT}));
|
||||
}
|
||||
}
|
||||
|
|
@ -1556,7 +1557,7 @@ uint32_t CInputManager::accumulateModsFromAllKBs() {
|
|||
if (kb->isVirtual() && shouldIgnoreVirtualKeyboard(kb))
|
||||
continue;
|
||||
|
||||
if (!kb->enabled)
|
||||
if (!kb->m_enabled)
|
||||
continue;
|
||||
|
||||
finalMask |= kb->getModifiers();
|
||||
|
|
@ -1571,7 +1572,7 @@ void CInputManager::disableAllKeyboards(bool virt) {
|
|||
if (k->isVirtual() != virt)
|
||||
continue;
|
||||
|
||||
k->active = false;
|
||||
k->m_active = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1580,7 +1581,7 @@ void CInputManager::newTouchDevice(SP<Aquamarine::ITouch> pDevice) {
|
|||
m_vHIDs.emplace_back(PNEWDEV);
|
||||
|
||||
try {
|
||||
PNEWDEV->hlName = getNameForNewDevice(PNEWDEV->deviceName);
|
||||
PNEWDEV->m_hlName = getNameForNewDevice(PNEWDEV->m_deviceName);
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "Touch Device had no name???"); // logic error
|
||||
}
|
||||
|
|
@ -1588,9 +1589,9 @@ void CInputManager::newTouchDevice(SP<Aquamarine::ITouch> pDevice) {
|
|||
setTouchDeviceConfigs(PNEWDEV);
|
||||
g_pPointerManager->attachTouch(PNEWDEV);
|
||||
|
||||
PNEWDEV->events.destroy.registerStaticListener(
|
||||
PNEWDEV->m_events.destroy.registerStaticListener(
|
||||
[this](void* owner, std::any data) {
|
||||
auto PDEV = ((ITouch*)owner)->self.lock();
|
||||
auto PDEV = ((ITouch*)owner)->m_self.lock();
|
||||
|
||||
if (!PDEV)
|
||||
return;
|
||||
|
|
@ -1607,20 +1608,20 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) {
|
|||
if (PTOUCHDEV->aq() && PTOUCHDEV->aq()->getLibinputHandle()) {
|
||||
const auto LIBINPUTDEV = PTOUCHDEV->aq()->getLibinputHandle();
|
||||
|
||||
const auto ENABLED = g_pConfigManager->getDeviceInt(PTOUCHDEV->hlName, "enabled", "input:touchdevice:enabled");
|
||||
const auto ENABLED = g_pConfigManager->getDeviceInt(PTOUCHDEV->m_hlName, "enabled", "input:touchdevice:enabled");
|
||||
const auto mode = ENABLED ? LIBINPUT_CONFIG_SEND_EVENTS_ENABLED : LIBINPUT_CONFIG_SEND_EVENTS_DISABLED;
|
||||
if (libinput_device_config_send_events_get_mode(LIBINPUTDEV) != mode)
|
||||
libinput_device_config_send_events_set_mode(LIBINPUTDEV, mode);
|
||||
|
||||
if (libinput_device_config_calibration_has_matrix(LIBINPUTDEV)) {
|
||||
Debug::log(LOG, "Setting calibration matrix for device {}", PTOUCHDEV->hlName);
|
||||
Debug::log(LOG, "Setting calibration matrix for device {}", PTOUCHDEV->m_hlName);
|
||||
// default value of transform being -1 means it's unset.
|
||||
const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(PTOUCHDEV->hlName, "transform", "input:touchdevice:transform"), -1, 7);
|
||||
const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(PTOUCHDEV->m_hlName, "transform", "input:touchdevice:transform"), -1, 7);
|
||||
if (ROTATION > -1)
|
||||
libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]);
|
||||
}
|
||||
|
||||
auto output = g_pConfigManager->getDeviceString(PTOUCHDEV->hlName, "output", "input:touchdevice:output");
|
||||
auto output = g_pConfigManager->getDeviceString(PTOUCHDEV->m_hlName, "output", "input:touchdevice:output");
|
||||
bool bound = !output.empty() && output != STRVAL_EMPTY;
|
||||
const bool AUTODETECT = output == "[[Auto]]";
|
||||
if (!bound && AUTODETECT) {
|
||||
|
|
@ -1631,13 +1632,13 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) {
|
|||
// bound = true;
|
||||
// }
|
||||
}
|
||||
PTOUCHDEV->boundOutput = bound ? output : "";
|
||||
const auto PMONITOR = bound ? g_pCompositor->getMonitorFromName(output) : nullptr;
|
||||
PTOUCHDEV->m_boundOutput = bound ? output : "";
|
||||
const auto PMONITOR = bound ? g_pCompositor->getMonitorFromName(output) : nullptr;
|
||||
if (PMONITOR) {
|
||||
Debug::log(LOG, "Binding touch device {} to output {}", PTOUCHDEV->hlName, PMONITOR->szName);
|
||||
Debug::log(LOG, "Binding touch device {} to output {}", PTOUCHDEV->m_hlName, PMONITOR->szName);
|
||||
// wlr_cursor_map_input_to_output(g_pCompositor->m_sWLRCursor, &PTOUCHDEV->wlr()->base, PMONITOR->output);
|
||||
} else if (bound)
|
||||
Debug::log(ERR, "Failed to bind touch device {} to output '{}': monitor not found", PTOUCHDEV->hlName, output);
|
||||
Debug::log(ERR, "Failed to bind touch device {} to output '{}': monitor not found", PTOUCHDEV->m_hlName, output);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1654,11 +1655,11 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) {
|
|||
void CInputManager::setTabletConfigs() {
|
||||
for (auto const& t : m_vTablets) {
|
||||
if (t->aq()->getLibinputHandle()) {
|
||||
const auto NAME = t->hlName;
|
||||
const auto NAME = t->m_hlName;
|
||||
const auto LIBINPUTDEV = t->aq()->getLibinputHandle();
|
||||
|
||||
const auto RELINPUT = g_pConfigManager->getDeviceInt(NAME, "relative_input", "input:tablet:relative_input");
|
||||
t->relativeInput = RELINPUT;
|
||||
t->m_relativeInput = RELINPUT;
|
||||
|
||||
const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(NAME, "transform", "input:tablet:transform"), -1, 7);
|
||||
Debug::log(LOG, "Setting calibration matrix for device {}", NAME);
|
||||
|
|
@ -1673,22 +1674,22 @@ void CInputManager::setTabletConfigs() {
|
|||
const auto OUTPUT = g_pConfigManager->getDeviceString(NAME, "output", "input:tablet:output");
|
||||
if (OUTPUT != STRVAL_EMPTY) {
|
||||
Debug::log(LOG, "Binding tablet {} to output {}", NAME, OUTPUT);
|
||||
t->boundOutput = OUTPUT;
|
||||
t->m_boundOutput = OUTPUT;
|
||||
} else
|
||||
t->boundOutput = "";
|
||||
t->m_boundOutput = "";
|
||||
|
||||
const auto REGION_POS = g_pConfigManager->getDeviceVec(NAME, "region_position", "input:tablet:region_position");
|
||||
const auto REGION_SIZE = g_pConfigManager->getDeviceVec(NAME, "region_size", "input:tablet:region_size");
|
||||
t->boundBox = {REGION_POS, REGION_SIZE};
|
||||
t->m_boundBox = {REGION_POS, REGION_SIZE};
|
||||
|
||||
const auto ABSOLUTE_REGION_POS = g_pConfigManager->getDeviceInt(NAME, "absolute_region_position", "input:tablet:absolute_region_position");
|
||||
t->absolutePos = ABSOLUTE_REGION_POS;
|
||||
t->m_absolutePos = ABSOLUTE_REGION_POS;
|
||||
|
||||
const auto ACTIVE_AREA_SIZE = g_pConfigManager->getDeviceVec(NAME, "active_area_size", "input:tablet:active_area_size");
|
||||
const auto ACTIVE_AREA_POS = g_pConfigManager->getDeviceVec(NAME, "active_area_position", "input:tablet:active_area_position");
|
||||
if (ACTIVE_AREA_SIZE.x != 0 || ACTIVE_AREA_SIZE.y != 0) {
|
||||
t->activeArea = CBox{ACTIVE_AREA_POS.x / t->aq()->physicalSize.x, ACTIVE_AREA_POS.y / t->aq()->physicalSize.y,
|
||||
(ACTIVE_AREA_POS.x + ACTIVE_AREA_SIZE.x) / t->aq()->physicalSize.x, (ACTIVE_AREA_POS.y + ACTIVE_AREA_SIZE.y) / t->aq()->physicalSize.y};
|
||||
t->m_activeArea = CBox{ACTIVE_AREA_POS.x / t->aq()->physicalSize.x, ACTIVE_AREA_POS.y / t->aq()->physicalSize.y,
|
||||
(ACTIVE_AREA_POS.x + ACTIVE_AREA_SIZE.x) / t->aq()->physicalSize.x, (ACTIVE_AREA_POS.y + ACTIVE_AREA_SIZE.y) / t->aq()->physicalSize.y};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1752,7 +1753,7 @@ std::string CInputManager::getNameForNewDevice(std::string internalName) {
|
|||
|
||||
auto makeNewName = [&]() { return (proposedNewName.empty() ? "unknown-device" : proposedNewName) + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); };
|
||||
|
||||
while (std::find_if(m_vHIDs.begin(), m_vHIDs.end(), [&](const auto& other) { return other->hlName == makeNewName(); }) != m_vHIDs.end())
|
||||
while (std::find_if(m_vHIDs.begin(), m_vHIDs.end(), [&](const auto& other) { return other->m_hlName == makeNewName(); }) != m_vHIDs.end())
|
||||
dupeno++;
|
||||
|
||||
return makeNewName();
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ static void unfocusTool(SP<CTabletTool> tool) {
|
|||
return;
|
||||
|
||||
tool->setSurface(nullptr);
|
||||
if (tool->isDown)
|
||||
if (tool->m_isDown)
|
||||
PROTO::tablet->up(tool);
|
||||
for (auto const& b : tool->buttonsDown) {
|
||||
for (auto const& b : tool->m_buttonsDown) {
|
||||
PROTO::tablet->buttonTool(tool, b, false);
|
||||
}
|
||||
PROTO::tablet->proximityOut(tool);
|
||||
|
|
@ -28,9 +28,9 @@ static void focusTool(SP<CTabletTool> tool, SP<CTablet> tablet, SP<CWLSurfaceRes
|
|||
|
||||
tool->setSurface(surf);
|
||||
PROTO::tablet->proximityIn(tool, tablet, surf);
|
||||
if (tool->isDown)
|
||||
if (tool->m_isDown)
|
||||
PROTO::tablet->down(tool);
|
||||
for (auto const& b : tool->buttonsDown) {
|
||||
for (auto const& b : tool->m_buttonsDown) {
|
||||
PROTO::tablet->buttonTool(tool, b, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ static void focusTool(SP<CTabletTool> tool, SP<CTablet> tablet, SP<CWLSurfaceRes
|
|||
static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = false) {
|
||||
const auto LASTHLSURFACE = CWLSurface::fromResource(g_pSeatManager->state.pointerFocus.lock());
|
||||
|
||||
if (!LASTHLSURFACE || !tool->active) {
|
||||
if (!LASTHLSURFACE || !tool->m_active) {
|
||||
if (tool->getSurface())
|
||||
unfocusTool(tool);
|
||||
|
||||
|
|
@ -69,9 +69,9 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
|
|||
|
||||
// yes, this technically ignores any regions set by the app. Too bad!
|
||||
if (LASTHLSURFACE->getWindow())
|
||||
local = tool->absolutePos * LASTHLSURFACE->getWindow()->m_realSize->goal();
|
||||
local = tool->m_absolutePos * LASTHLSURFACE->getWindow()->m_realSize->goal();
|
||||
else
|
||||
local = tool->absolutePos * BOX->size();
|
||||
local = tool->m_absolutePos * BOX->size();
|
||||
|
||||
if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11)
|
||||
local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy;
|
||||
|
|
@ -106,7 +106,7 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) {
|
|||
const auto PTAB = e.tablet;
|
||||
const auto PTOOL = ensureTabletToolPresent(e.tool);
|
||||
|
||||
if (PTOOL->active && (e.updatedAxes & (CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_X | CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_Y))) {
|
||||
if (PTOOL->m_active && (e.updatedAxes & (CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_X | CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_Y))) {
|
||||
double x = (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_X) ? e.axis.x : NAN;
|
||||
double dx = (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_X) ? e.axisDelta.x : NAN;
|
||||
double y = (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_Y) ? e.axis.y : NAN;
|
||||
|
|
@ -121,14 +121,14 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) {
|
|||
}
|
||||
default: {
|
||||
if (!std::isnan(x))
|
||||
PTOOL->absolutePos.x = x;
|
||||
PTOOL->m_absolutePos.x = x;
|
||||
if (!std::isnan(y))
|
||||
PTOOL->absolutePos.y = y;
|
||||
PTOOL->m_absolutePos.y = y;
|
||||
|
||||
if (PTAB->relativeInput)
|
||||
if (PTAB->m_relativeInput)
|
||||
g_pPointerManager->move(delta);
|
||||
else
|
||||
g_pPointerManager->warpAbsolute(transformToActiveRegion({x, y}, PTAB->activeArea), PTAB);
|
||||
g_pPointerManager->warpAbsolute(transformToActiveRegion({x, y}, PTAB->m_activeArea), PTAB);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -155,13 +155,13 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) {
|
|||
PROTO::tablet->wheel(PTOOL, e.wheelDelta);
|
||||
|
||||
if (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_X)
|
||||
PTOOL->tilt.x = e.tilt.x;
|
||||
PTOOL->m_tilt.x = e.tilt.x;
|
||||
|
||||
if (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_Y)
|
||||
PTOOL->tilt.y = e.tilt.y;
|
||||
PTOOL->m_tilt.y = e.tilt.y;
|
||||
|
||||
if (e.updatedAxes & (CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_X | CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_Y))
|
||||
PROTO::tablet->tilt(PTOOL, PTOOL->tilt);
|
||||
PROTO::tablet->tilt(PTOOL, PTOOL->m_tilt);
|
||||
}
|
||||
|
||||
void CInputManager::onTabletTip(CTablet::STipEvent e) {
|
||||
|
|
@ -169,10 +169,10 @@ void CInputManager::onTabletTip(CTablet::STipEvent e) {
|
|||
const auto PTOOL = ensureTabletToolPresent(e.tool);
|
||||
const auto POS = e.tip;
|
||||
|
||||
if (PTAB->relativeInput)
|
||||
if (PTAB->m_relativeInput)
|
||||
g_pPointerManager->move({0, 0});
|
||||
else
|
||||
g_pPointerManager->warpAbsolute(transformToActiveRegion(POS, PTAB->activeArea), PTAB);
|
||||
g_pPointerManager->warpAbsolute(transformToActiveRegion(POS, PTAB->m_activeArea), PTAB);
|
||||
|
||||
if (e.in)
|
||||
refocus();
|
||||
|
|
@ -184,7 +184,7 @@ void CInputManager::onTabletTip(CTablet::STipEvent e) {
|
|||
else
|
||||
PROTO::tablet->up(PTOOL);
|
||||
|
||||
PTOOL->isDown = e.in;
|
||||
PTOOL->m_isDown = e.in;
|
||||
}
|
||||
|
||||
void CInputManager::onTabletButton(CTablet::SButtonEvent e) {
|
||||
|
|
@ -196,16 +196,16 @@ void CInputManager::onTabletButton(CTablet::SButtonEvent e) {
|
|||
PROTO::tablet->buttonTool(PTOOL, e.button, e.down);
|
||||
|
||||
if (e.down)
|
||||
PTOOL->buttonsDown.push_back(e.button);
|
||||
PTOOL->m_buttonsDown.push_back(e.button);
|
||||
else
|
||||
std::erase(PTOOL->buttonsDown, e.button);
|
||||
std::erase(PTOOL->m_buttonsDown, e.button);
|
||||
}
|
||||
|
||||
void CInputManager::onTabletProximity(CTablet::SProximityEvent e) {
|
||||
const auto PTAB = e.tablet;
|
||||
const auto PTOOL = ensureTabletToolPresent(e.tool);
|
||||
|
||||
PTOOL->active = e.in;
|
||||
PTOOL->m_active = e.in;
|
||||
|
||||
if (!e.in) {
|
||||
if (PTOOL->getSurface())
|
||||
|
|
@ -221,16 +221,16 @@ void CInputManager::newTablet(SP<Aquamarine::ITablet> pDevice) {
|
|||
m_vHIDs.emplace_back(PNEWTABLET);
|
||||
|
||||
try {
|
||||
PNEWTABLET->hlName = g_pInputManager->getNameForNewDevice(pDevice->getName());
|
||||
PNEWTABLET->m_hlName = g_pInputManager->getNameForNewDevice(pDevice->getName());
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "Tablet had no name???"); // logic error
|
||||
}
|
||||
|
||||
g_pPointerManager->attachTablet(PNEWTABLET);
|
||||
|
||||
PNEWTABLET->events.destroy.registerStaticListener(
|
||||
PNEWTABLET->m_events.destroy.registerStaticListener(
|
||||
[this](void* owner, std::any d) {
|
||||
auto TABLET = ((CTablet*)owner)->self;
|
||||
auto TABLET = ((CTablet*)owner)->m_self;
|
||||
destroyTablet(TABLET.lock());
|
||||
},
|
||||
PNEWTABLET.get());
|
||||
|
|
@ -249,14 +249,14 @@ SP<CTabletTool> CInputManager::ensureTabletToolPresent(SP<Aquamarine::ITabletToo
|
|||
m_vHIDs.emplace_back(PTOOL);
|
||||
|
||||
try {
|
||||
PTOOL->hlName = g_pInputManager->getNameForNewDevice(pTool->getName());
|
||||
PTOOL->m_hlName = g_pInputManager->getNameForNewDevice(pTool->getName());
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "Tablet had no name???"); // logic error
|
||||
}
|
||||
|
||||
PTOOL->events.destroy.registerStaticListener(
|
||||
PTOOL->m_events.destroy.registerStaticListener(
|
||||
[this](void* owner, std::any d) {
|
||||
auto TOOL = ((CTabletTool*)owner)->self;
|
||||
auto TOOL = ((CTabletTool*)owner)->m_self;
|
||||
destroyTabletTool(TOOL.lock());
|
||||
},
|
||||
PTOOL.get());
|
||||
|
|
@ -269,44 +269,44 @@ void CInputManager::newTabletPad(SP<Aquamarine::ITabletPad> pDevice) {
|
|||
m_vHIDs.emplace_back(PNEWPAD);
|
||||
|
||||
try {
|
||||
PNEWPAD->hlName = g_pInputManager->getNameForNewDevice(pDevice->getName());
|
||||
PNEWPAD->m_hlName = g_pInputManager->getNameForNewDevice(pDevice->getName());
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "Pad had no name???"); // logic error
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
PNEWPAD->events.destroy.registerStaticListener([this](void* owner, std::any d) {
|
||||
auto PAD = ((CTabletPad*)owner)->self;
|
||||
PNEWPAD->m_events.destroy.registerStaticListener([this](void* owner, std::any d) {
|
||||
auto PAD = ((CTabletPad*)owner)->m_self;
|
||||
destroyTabletPad(PAD.lock());
|
||||
}, PNEWPAD.get());
|
||||
|
||||
PNEWPAD->padEvents.button.registerStaticListener([](void* owner, std::any e) {
|
||||
PNEWPAD->m_padEvents.button.registerStaticListener([](void* owner, std::any e) {
|
||||
const auto E = std::any_cast<CTabletPad::SButtonEvent>(e);
|
||||
const auto PPAD = ((CTabletPad*)owner)->self.lock();
|
||||
const auto PPAD = ((CTabletPad*)owner)->m_self.lock();
|
||||
|
||||
PROTO::tablet->mode(PPAD, 0, E.mode, E.timeMs);
|
||||
PROTO::tablet->buttonPad(PPAD, E.button, E.timeMs, E.down);
|
||||
}, PNEWPAD.get());
|
||||
|
||||
PNEWPAD->padEvents.strip.registerStaticListener([](void* owner, std::any e) {
|
||||
PNEWPAD->m_padEvents.strip.registerStaticListener([](void* owner, std::any e) {
|
||||
const auto E = std::any_cast<CTabletPad::SStripEvent>(e);
|
||||
const auto PPAD = ((CTabletPad*)owner)->self.lock();
|
||||
const auto PPAD = ((CTabletPad*)owner)->m_self.lock();
|
||||
|
||||
PROTO::tablet->strip(PPAD, E.strip, E.position, E.finger, E.timeMs);
|
||||
}, PNEWPAD.get());
|
||||
|
||||
PNEWPAD->padEvents.ring.registerStaticListener([](void* owner, std::any e) {
|
||||
PNEWPAD->m_padEvents.ring.registerStaticListener([](void* owner, std::any e) {
|
||||
const auto E = std::any_cast<CTabletPad::SRingEvent>(e);
|
||||
const auto PPAD = ((CTabletPad*)owner)->self.lock();
|
||||
const auto PPAD = ((CTabletPad*)owner)->m_self.lock();
|
||||
|
||||
PROTO::tablet->ring(PPAD, E.ring, E.position, E.finger, E.timeMs);
|
||||
}, PNEWPAD.get());
|
||||
|
||||
PNEWPAD->padEvents.attach.registerStaticListener([](void* owner, std::any e) {
|
||||
const auto PPAD = ((CTabletPad*)owner)->self.lock();
|
||||
PNEWPAD->m_padEvents.attach.registerStaticListener([](void* owner, std::any e) {
|
||||
const auto PPAD = ((CTabletPad*)owner)->m_self.lock();
|
||||
const auto TOOL = std::any_cast<SP<CTabletTool>>(e);
|
||||
|
||||
PPAD->parent = TOOL;
|
||||
PPAD->m_parent = TOOL;
|
||||
}, PNEWPAD.get());
|
||||
// clang-format on
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
|||
static auto PSWIPEINVR = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch_invert");
|
||||
EMIT_HOOK_EVENT_CANCELLABLE("touchDown", e);
|
||||
|
||||
auto PMONITOR = g_pCompositor->getMonitorFromName(!e.device->boundOutput.empty() ? e.device->boundOutput : "");
|
||||
auto PMONITOR = g_pCompositor->getMonitorFromName(!e.device->m_boundOutput.empty() ? e.device->m_boundOutput : "");
|
||||
|
||||
PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_lastMonitor.lock();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue