input: add option to rotate device input (#11947)
This commit is contained in:
parent
da31e82aab
commit
6a01c399a9
3 changed files with 13 additions and 0 deletions
|
|
@ -478,6 +478,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "input:rotation",
|
||||
.description = "Sets the rotation of a device in degrees clockwise off the logical neutral position. Value is clamped to the range 0 to 359.",
|
||||
.type = CONFIG_OPTION_INT,
|
||||
.data = SConfigOptionDescription::SRangeData{0, 0, 359},
|
||||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "input:left_handed",
|
||||
.description = "Switches RMB and LMB",
|
||||
|
|
|
|||
|
|
@ -654,6 +654,7 @@ CConfigManager::CConfigManager() {
|
|||
registerConfigVar("input:off_window_axis_events", Hyprlang::INT{1});
|
||||
registerConfigVar("input:sensitivity", {0.f});
|
||||
registerConfigVar("input:accel_profile", {STRVAL_EMPTY});
|
||||
registerConfigVar("input:rotation", Hyprlang::INT{0});
|
||||
registerConfigVar("input:kb_file", {STRVAL_EMPTY});
|
||||
registerConfigVar("input:kb_layout", {"us"});
|
||||
registerConfigVar("input:kb_variant", {STRVAL_EMPTY});
|
||||
|
|
@ -789,6 +790,7 @@ CConfigManager::CConfigManager() {
|
|||
m_config->addSpecialCategory("device", {"name"});
|
||||
m_config->addSpecialConfigValue("device", "sensitivity", {0.F});
|
||||
m_config->addSpecialConfigValue("device", "accel_profile", {STRVAL_EMPTY});
|
||||
m_config->addSpecialConfigValue("device", "rotation", Hyprlang::INT{0});
|
||||
m_config->addSpecialConfigValue("device", "kb_file", {STRVAL_EMPTY});
|
||||
m_config->addSpecialConfigValue("device", "kb_layout", {"us"});
|
||||
m_config->addSpecialConfigValue("device", "kb_variant", {STRVAL_EMPTY});
|
||||
|
|
|
|||
|
|
@ -1279,6 +1279,11 @@ 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);
|
||||
|
||||
if (libinput_device_config_rotation_is_available(LIBINPUTDEV)) {
|
||||
const auto ROTATION = std::clamp(g_pConfigManager->getDeviceInt(devname, "rotation", "input:rotation"), 0, 359);
|
||||
libinput_device_config_rotation_set_angle(LIBINPUTDEV, ROTATION);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue