summaryrefslogtreecommitdiff
path: root/src/desktop/Window.cpp
diff options
context:
space:
mode:
authorMike Will <myQwil@gmail.com>2024-12-06 01:16:58 -0500
committerVaxry <vaxry@vaxry.net>2024-12-11 17:27:49 +0000
commitdf956a0f6fbcfd7397b2d7b86883c0936c7795ec (patch)
tree269946352158faa6a455c9e87337cb83c37998eb /src/desktop/Window.cpp
parent33f271c29a0069a95755b1d3252aeebe0fd85287 (diff)
windowrules: add rules for mouse and touchpad scroll factors (#8655)
Diffstat (limited to 'src/desktop/Window.cpp')
-rw-r--r--src/desktop/Window.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index e4651e61..e2106e4a 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -718,6 +718,10 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
try {
*(search->second(m_pSelf.lock())) = CWindowOverridableVar(std::stoi(VARS[1]), priority);
} catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r.szRule, e.what()); }
+ } else if (auto search = g_pConfigManager->mfWindowProperties.find(VARS[0]); search != g_pConfigManager->mfWindowProperties.end()) {
+ try {
+ *(search->second(m_pSelf.lock())) = CWindowOverridableVar(std::stof(VARS[1]), priority);
+ } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r.szRule, e.what()); }
} else if (r.szRule.starts_with("idleinhibit")) {
auto IDLERULE = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
@@ -1178,6 +1182,16 @@ int CWindow::getRealBorderSize() {
return m_sWindowData.borderSize.valueOr(*PBORDERSIZE);
}
+float CWindow::getScrollMouse() {
+ static auto PINPUTSCROLLFACTOR = CConfigValue<Hyprlang::FLOAT>("input:scroll_factor");
+ return m_sWindowData.scrollMouse.valueOr(*PINPUTSCROLLFACTOR);
+}
+
+float CWindow::getScrollTouchpad() {
+ static auto PTOUCHPADSCROLLFACTOR = CConfigValue<Hyprlang::FLOAT>("input:touchpad:scroll_factor");
+ return m_sWindowData.scrollTouchpad.valueOr(*PTOUCHPADSCROLLFACTOR);
+}
+
bool CWindow::canBeTorn() {
static auto PTEARING = CConfigValue<Hyprlang::INT>("general:allow_tearing");
return m_sWindowData.tearing.valueOr(m_bTearingHint) && *PTEARING;
@@ -1602,6 +1616,9 @@ void CWindow::unsetWindowData(eOverridePriority priority) {
for (auto const& element : g_pConfigManager->miWindowProperties) {
element.second(m_pSelf.lock())->unset(priority);
}
+ for (auto const& element : g_pConfigManager->mfWindowProperties) {
+ element.second(m_pSelf.lock())->unset(priority);
+ }
}
bool CWindow::isX11OverrideRedirect() {