mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 05:26:01 +01:00
renderer: add the lockdead_screen_delay
This commit is contained in:
parent
3fb47372b7
commit
75695da6a5
5 changed files with 27 additions and 4 deletions
|
@ -1121,6 +1121,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
.type = CONFIG_OPTION_BOOL,
|
.type = CONFIG_OPTION_BOOL,
|
||||||
.data = SConfigOptionDescription::SBoolData{false},
|
.data = SConfigOptionDescription::SBoolData{false},
|
||||||
},
|
},
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "misc:lockdead_screen_delay",
|
||||||
|
.description = "the delay in ms after the lockdead screen appears if the lock screen did not appear after a lock event occurred.",
|
||||||
|
.type = CONFIG_OPTION_INT,
|
||||||
|
.data = SConfigOptionDescription::SRangeData{1000, 0, 5000},
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* binds:
|
* binds:
|
||||||
|
|
|
@ -377,6 +377,7 @@ CConfigManager::CConfigManager() {
|
||||||
m_pConfig->addConfigValue("misc:middle_click_paste", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("misc:middle_click_paste", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("misc:render_unfocused_fps", Hyprlang::INT{15});
|
m_pConfig->addConfigValue("misc:render_unfocused_fps", Hyprlang::INT{15});
|
||||||
m_pConfig->addConfigValue("misc:disable_xdg_env_checks", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("misc:disable_xdg_env_checks", Hyprlang::INT{0});
|
||||||
|
m_pConfig->addConfigValue("misc:lockdead_screen_delay", Hyprlang::INT{1000});
|
||||||
|
|
||||||
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
||||||
|
|
|
@ -57,6 +57,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
|
||||||
|
|
||||||
m_pSessionLock = std::make_unique<SSessionLock>();
|
m_pSessionLock = std::make_unique<SSessionLock>();
|
||||||
m_pSessionLock->lock = pLock;
|
m_pSessionLock->lock = pLock;
|
||||||
|
m_pSessionLock->mLockTimer.reset();
|
||||||
|
|
||||||
m_pSessionLock->listeners.newSurface = pLock->events.newLockSurface.registerListener([this](std::any data) {
|
m_pSessionLock->listeners.newSurface = pLock->events.newLockSurface.registerListener([this](std::any data) {
|
||||||
auto SURFACE = std::any_cast<SP<CSessionLockSurface>>(data);
|
auto SURFACE = std::any_cast<SP<CSessionLockSurface>>(data);
|
||||||
|
@ -176,3 +177,14 @@ bool CSessionLockManager::isSessionLockPresent() {
|
||||||
bool CSessionLockManager::anySessionLockSurfacesPresent() {
|
bool CSessionLockManager::anySessionLockSurfacesPresent() {
|
||||||
return m_pSessionLock && std::ranges::any_of(m_pSessionLock->vSessionLockSurfaces, [](const auto& surf) { return surf->mapped; });
|
return m_pSessionLock && std::ranges::any_of(m_pSessionLock->vSessionLockSurfaces, [](const auto& surf) { return surf->mapped; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSessionLockManager::shallConsiderLockMissing() {
|
||||||
|
Debug::log(LOG, "Shall lock called"); //Locked since got locked by {:i}", m_pSessionLock->mLockTimer.getSeconds());
|
||||||
|
|
||||||
|
if (!m_pSessionLock)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
static auto LOCKDEAD_SCREEN_DELAY = CConfigValue<Hyprlang::INT>("misc:lockdead_screen_delay");
|
||||||
|
|
||||||
|
return static_cast<int>(m_pSessionLock->mLockTimer.getMillis()) > *LOCKDEAD_SCREEN_DELAY;
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ struct SSessionLockSurface {
|
||||||
|
|
||||||
struct SSessionLock {
|
struct SSessionLock {
|
||||||
WP<CSessionLock> lock;
|
WP<CSessionLock> lock;
|
||||||
|
CTimer mLockTimer;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<SSessionLockSurface>> vSessionLockSurfaces;
|
std::vector<std::unique_ptr<SSessionLockSurface>> vSessionLockSurfaces;
|
||||||
std::unordered_map<uint64_t, CTimer> mMonitorsWithoutMappedSurfaceTimers;
|
std::unordered_map<uint64_t, CTimer> mMonitorsWithoutMappedSurfaceTimers;
|
||||||
|
@ -61,6 +62,8 @@ class CSessionLockManager {
|
||||||
|
|
||||||
void onLockscreenRenderedOnMonitor(uint64_t id);
|
void onLockscreenRenderedOnMonitor(uint64_t id);
|
||||||
|
|
||||||
|
bool shallConsiderLockMissing();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UP<SSessionLock> m_pSessionLock;
|
UP<SSessionLock> m_pSessionLock;
|
||||||
|
|
||||||
|
|
|
@ -1045,9 +1045,10 @@ void CHyprRenderer::renderLockscreen(PHLMONITOR pMonitor, timespec* now, const C
|
||||||
Vector2D translate = {geometry.x, geometry.y};
|
Vector2D translate = {geometry.x, geometry.y};
|
||||||
|
|
||||||
const auto PSLS = g_pSessionLockManager->getSessionLockSurfaceForMonitor(pMonitor->ID);
|
const auto PSLS = g_pSessionLockManager->getSessionLockSurfaceForMonitor(pMonitor->ID);
|
||||||
if (!PSLS)
|
if (!PSLS) {
|
||||||
|
if (g_pSessionLockManager->shallConsiderLockMissing())
|
||||||
renderSessionLockMissing(pMonitor);
|
renderSessionLockMissing(pMonitor);
|
||||||
else {
|
} else {
|
||||||
renderSessionLockSurface(PSLS, pMonitor, now);
|
renderSessionLockSurface(PSLS, pMonitor, now);
|
||||||
g_pSessionLockManager->onLockscreenRenderedOnMonitor(pMonitor->ID);
|
g_pSessionLockManager->onLockscreenRenderedOnMonitor(pMonitor->ID);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue