aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-07-31 15:46:42 +0200
committervaxerski <[email protected]>2022-07-31 15:46:42 +0200
commita1d1ec4c4696b5e44c7d7135c4191aa795811bee (patch)
tree351aeeba6539f61a7138f5d5d7921555de1b87eb
parentd9687c93ee9fe627bcda3a01b80ecf9faf9ddc65 (diff)
downloadHyprland-a1d1ec4c4696b5e44c7d7135c4191aa795811bee.tar.gz
Hyprland-a1d1ec4c4696b5e44c7d7135c4191aa795811bee.zip
added misc:mouse_move_enables_dpms
-rw-r--r--src/Compositor.hpp1
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/managers/KeybindManager.cpp2
-rw-r--r--src/managers/KeybindManager.hpp3
-rw-r--r--src/managers/input/InputManager.cpp6
5 files changed, 13 insertions, 0 deletions
diff --git a/src/Compositor.hpp b/src/Compositor.hpp
index fd40d911..15e22014 100644
--- a/src/Compositor.hpp
+++ b/src/Compositor.hpp
@@ -94,6 +94,7 @@ public:
bool m_bReadyToProcess = false;
bool m_bSessionActive = true;
+ bool m_bDPMSStateON = true;
// ------------------------------------------------- //
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 88ed90e3..f327c0aa 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -52,6 +52,7 @@ void CConfigManager::setDefaultVars() {
configValues["misc:disable_splash_rendering"].intValue = 0;
configValues["misc:no_vfr"].intValue = 1;
configValues["misc:damage_entire_on_snapshot"].intValue = 0;
+ configValues["misc:mouse_move_enables_dpms"].intValue = 0;
configValues["debug:int"].intValue = 0;
configValues["debug:log_damage"].intValue = 0;
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 9da1b0b6..155cc38b 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -1340,4 +1340,6 @@ void CKeybindManager::dpms(std::string arg) {
if (enable)
g_pHyprRenderer->damageMonitor(m.get());
}
+
+ g_pCompositor->m_bDPMSStateON = enable;
}
diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp
index b938c557..4f0d29f9 100644
--- a/src/managers/KeybindManager.hpp
+++ b/src/managers/KeybindManager.hpp
@@ -6,6 +6,8 @@
#include <unordered_map>
#include <functional>
+class CInputManager;
+
struct SKeybind {
std::string key = "";
int keycode = -1;
@@ -101,6 +103,7 @@ private:
static void dpms(std::string);
friend class CCompositor;
+ friend class CInputManager;
};
inline std::unique_ptr<CKeybindManager> g_pKeybindManager;
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 21c3be68..29b16c3b 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -29,6 +29,7 @@ void CInputManager::onMouseWarp(wlr_pointer_motion_absolute_event* e) {
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
static auto *const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
+ static auto* const PMOUSEDPMS = &g_pConfigManager->getConfigValuePtr("misc:mouse_move_enables_dpms")->intValue;
if (!g_pCompositor->m_bReadyToProcess)
return;
@@ -41,6 +42,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (g_pCompositor->m_sSeat.mouse->virt)
return; // don't refocus on virt
+ if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS) {
+ // enable dpms
+ g_pKeybindManager->dpms("on");
+ }
+
Vector2D mouseCoords = getMouseCoordsInternal();
const auto MOUSECOORDSFLOORED = mouseCoords.floor();