input: add per-device scroll-factor (#11241)

This commit is contained in:
Vaxry 2025-09-02 13:16:43 +02:00 committed by GitHub
parent 78e86d879f
commit 127aab8159
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 593 additions and 22 deletions

View file

@ -722,10 +722,11 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque
R"#( {{
"address": "0x{:x}",
"name": "{}",
"defaultSpeed": {:.5f}
"defaultSpeed": {:.5f},
"scrollFactor": {:.2f}
}},)#",
rc<uintptr_t>(m.get()), escapeJSONStrings(m->m_hlName),
m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f);
m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f, m->m_scrollFactor.value_or(-1));
}
trimTrailingComma(result);
@ -826,8 +827,9 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque
result += "mice:\n";
for (auto const& m : g_pInputManager->m_pointers) {
result += std::format("\tMouse at {:x}:\n\t\t{}\n\t\t\tdefault speed: {:.5f}\n", rc<uintptr_t>(m.get()), m->m_hlName,
(m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f));
result += std::format("\tMouse at {:x}:\n\t\t{}\n\t\t\tdefault speed: {:.5f}\n\t\t\tscroll factor: {:.2f}\n", rc<uintptr_t>(m.get()), m->m_hlName,
(m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f),
m->m_scrollFactor.value_or(-1));
}
result += "\n\nKeyboards:\n";