diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-05-24 22:17:33 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-05-24 22:17:33 +0200 |
| commit | 12227d7b6a9e780a9d3747c0109e11377b1c07c6 (patch) | |
| tree | 6e77c58eb8c2e7da9108844526e5340684fcfe97 /src/managers/input/InputManager.cpp | |
| parent | a4c120d6081ee35b7997afdec451480048242d06 (diff) | |
input: only configure newly added touch devices
Diffstat (limited to 'src/managers/input/InputManager.cpp')
| -rw-r--r-- | src/managers/input/InputManager.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 964730be..79b71c95 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1313,7 +1313,7 @@ void CInputManager::newTouchDevice(wlr_input_device* pDevice) { Debug::log(ERR, "Touch Device had no name???"); // logic error } - setTouchDeviceConfigs(); + setTouchDeviceConfigs(PNEWDEV); wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, pDevice); Debug::log(LOG, "New touch device added at %lx", PNEWDEV); @@ -1322,14 +1322,13 @@ void CInputManager::newTouchDevice(wlr_input_device* pDevice) { &pDevice->events.destroy, [&](void* owner, void* data) { destroyTouchDevice((STouchDevice*)data); }, PNEWDEV, "TouchDevice"); } -void CInputManager::setTouchDeviceConfigs() { - for (auto& m : m_lTouchDevices) { - const auto PTOUCHDEV = &m; +void CInputManager::setTouchDeviceConfigs(STouchDevice* dev) { + auto setConfig = [&](STouchDevice* const PTOUCHDEV) -> void { const auto HASCONFIG = g_pConfigManager->deviceConfigExists(PTOUCHDEV->name); - if (wlr_input_device_is_libinput(m.pWlrDevice)) { - const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(m.pWlrDevice); + if (wlr_input_device_is_libinput(PTOUCHDEV->pWlrDevice)) { + const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(PTOUCHDEV->pWlrDevice); const int ROTATION = std::clamp(HASCONFIG ? g_pConfigManager->getDeviceInt(PTOUCHDEV->name, "transform") : g_pConfigManager->getInt("input:touchdevice:transform"), 0, 7); @@ -1342,6 +1341,17 @@ void CInputManager::setTouchDeviceConfigs() { else PTOUCHDEV->boundOutput = ""; } + }; + + if (dev) { + setConfig(dev); + return; + } + + for (auto& m : m_lTouchDevices) { + const auto PTOUCHDEV = &m; + + setConfig(PTOUCHDEV); } } |
