added misc:mouse_move_enables_dpms

This commit is contained in:
vaxerski 2022-07-31 15:46:42 +02:00
parent d9687c93ee
commit a1d1ec4c46
5 changed files with 13 additions and 0 deletions

View file

@ -94,6 +94,7 @@ public:
bool m_bReadyToProcess = false; bool m_bReadyToProcess = false;
bool m_bSessionActive = true; bool m_bSessionActive = true;
bool m_bDPMSStateON = true;
// ------------------------------------------------- // // ------------------------------------------------- //

View file

@ -52,6 +52,7 @@ void CConfigManager::setDefaultVars() {
configValues["misc:disable_splash_rendering"].intValue = 0; configValues["misc:disable_splash_rendering"].intValue = 0;
configValues["misc:no_vfr"].intValue = 1; configValues["misc:no_vfr"].intValue = 1;
configValues["misc:damage_entire_on_snapshot"].intValue = 0; configValues["misc:damage_entire_on_snapshot"].intValue = 0;
configValues["misc:mouse_move_enables_dpms"].intValue = 0;
configValues["debug:int"].intValue = 0; configValues["debug:int"].intValue = 0;
configValues["debug:log_damage"].intValue = 0; configValues["debug:log_damage"].intValue = 0;

View file

@ -1340,4 +1340,6 @@ void CKeybindManager::dpms(std::string arg) {
if (enable) if (enable)
g_pHyprRenderer->damageMonitor(m.get()); g_pHyprRenderer->damageMonitor(m.get());
} }
g_pCompositor->m_bDPMSStateON = enable;
} }

View file

@ -6,6 +6,8 @@
#include <unordered_map> #include <unordered_map>
#include <functional> #include <functional>
class CInputManager;
struct SKeybind { struct SKeybind {
std::string key = ""; std::string key = "";
int keycode = -1; int keycode = -1;
@ -101,6 +103,7 @@ private:
static void dpms(std::string); static void dpms(std::string);
friend class CCompositor; friend class CCompositor;
friend class CInputManager;
}; };
inline std::unique_ptr<CKeybindManager> g_pKeybindManager; inline std::unique_ptr<CKeybindManager> g_pKeybindManager;

View file

@ -29,6 +29,7 @@ void CInputManager::onMouseWarp(wlr_pointer_motion_absolute_event* e) {
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
static auto *const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; 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) if (!g_pCompositor->m_bReadyToProcess)
return; return;
@ -41,6 +42,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (g_pCompositor->m_sSeat.mouse->virt) if (g_pCompositor->m_sSeat.mouse->virt)
return; // don't refocus on virt return; // don't refocus on virt
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS) {
// enable dpms
g_pKeybindManager->dpms("on");
}
Vector2D mouseCoords = getMouseCoordsInternal(); Vector2D mouseCoords = getMouseCoordsInternal();
const auto MOUSECOORDSFLOORED = mouseCoords.floor(); const auto MOUSECOORDSFLOORED = mouseCoords.floor();