mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-03 13:41:59 -07:00
input: only configure newly added touch devices
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user