mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 00:05:58 +01:00
config: Add input:scroll_factor configuration (#4980)
* Allow for input:scroll_factor configuration This PR will allow for a `scroll_factor` configuration within an `input` block. The purpose is to control the scroll factor of external mice. Closes #2574. * clang-format
This commit is contained in:
parent
f8a081b56d
commit
0ee69058c4
2 changed files with 4 additions and 2 deletions
|
@ -455,6 +455,7 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addConfigValue("input:scroll_method", {STRVAL_EMPTY});
|
||||
m_pConfig->addConfigValue("input:scroll_button", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("input:scroll_button_lock", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("input:scroll_factor", {1.f});
|
||||
m_pConfig->addConfigValue("input:scroll_points", {STRVAL_EMPTY});
|
||||
m_pConfig->addConfigValue("input:touchpad:natural_scroll", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("input:touchpad:disable_while_typing", Hyprlang::INT{1});
|
||||
|
|
|
@ -666,9 +666,10 @@ void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) {
|
|||
}
|
||||
|
||||
void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
|
||||
static auto PSCROLLFACTOR = CConfigValue<Hyprlang::FLOAT>("input:touchpad:scroll_factor");
|
||||
static auto PINPUTSCROLLFACTOR = CConfigValue<Hyprlang::FLOAT>("input:scroll_factor");
|
||||
static auto PTOUCHPADSCROLLFACTOR = CConfigValue<Hyprlang::FLOAT>("input:touchpad:scroll_factor");
|
||||
|
||||
auto factor = (*PSCROLLFACTOR <= 0.f || e->source != WLR_AXIS_SOURCE_FINGER ? 1.f : *PSCROLLFACTOR);
|
||||
auto factor = (*PTOUCHPADSCROLLFACTOR <= 0.f || e->source == WLR_AXIS_SOURCE_FINGER ? *PTOUCHPADSCROLLFACTOR : *PINPUTSCROLLFACTOR);
|
||||
|
||||
const auto EMAP = std::unordered_map<std::string, std::any>{{"event", e}};
|
||||
EMIT_HOOK_EVENT_CANCELLABLE("mouseAxis", EMAP);
|
||||
|
|
Loading…
Reference in a new issue