input: only configure newly added touch devices

This commit is contained in:
vaxerski 2023-05-24 22:17:33 +02:00
parent a4c120d608
commit 12227d7b6a
2 changed files with 17 additions and 7 deletions

View file

@ -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);
}
}

View file

@ -91,7 +91,7 @@ class CInputManager {
void setKeyboardLayout();
void setPointerConfigs();
void setTouchDeviceConfigs();
void setTouchDeviceConfigs(STouchDevice* dev = nullptr);
void setTabletConfigs();
void updateDragIcon();