mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-12-23 05:39:49 +01:00
core: check for sessionLockSurface before calling render
This is needed, because when a new monitor is added via `onGlobal` the order of the events is not guaranteed. Meaning that render for a particular monitor might get called before a `CSessionLockSurface` for that monitor exists.
This commit is contained in:
parent
318c00d6d0
commit
8e91c4b0f9
2 changed files with 21 additions and 21 deletions
|
@ -570,9 +570,7 @@ void CHyprlock::unlock() {
|
||||||
m_tFadeEnds = std::chrono::system_clock::now() + std::chrono::milliseconds(500);
|
m_tFadeEnds = std::chrono::system_clock::now() + std::chrono::milliseconds(500);
|
||||||
m_bFadeStarted = true;
|
m_bFadeStarted = true;
|
||||||
|
|
||||||
for (auto& o : m_vOutputs) {
|
renderAllOutputs();
|
||||||
o->sessionLockSurface->render();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// wl_seat
|
// wl_seat
|
||||||
|
@ -758,9 +756,7 @@ static const ext_session_lock_v1_listener sessionLockListener = {
|
||||||
static void displayFailTextTimerCallback(std::shared_ptr<CTimer> self, void* data) {
|
static void displayFailTextTimerCallback(std::shared_ptr<CTimer> self, void* data) {
|
||||||
g_pAuth->m_bDisplayFailText = false;
|
g_pAuth->m_bDisplayFailText = false;
|
||||||
|
|
||||||
for (auto& o : g_pHyprlock->m_vOutputs) {
|
g_pHyprlock->renderAllOutputs();
|
||||||
o->sessionLockSurface->render();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprlock::onPasswordCheckTimer() {
|
void CHyprlock::onPasswordCheckTimer() {
|
||||||
|
@ -779,9 +775,7 @@ void CHyprlock::onPasswordCheckTimer() {
|
||||||
|
|
||||||
g_pAuth->start();
|
g_pAuth->start();
|
||||||
|
|
||||||
for (auto& o : m_vOutputs) {
|
renderAllOutputs();
|
||||||
o->sessionLockSurface->render();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,9 +784,8 @@ void CHyprlock::clearPasswordBuffer() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_sPasswordState.passBuffer = "";
|
m_sPasswordState.passBuffer = "";
|
||||||
for (auto& o : m_vOutputs) {
|
|
||||||
o->sessionLockSurface->render();
|
renderAllOutputs();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprlock::renderOutput(const std::string& stringPort) {
|
void CHyprlock::renderOutput(const std::string& stringPort) {
|
||||||
|
@ -803,9 +796,21 @@ void CHyprlock::renderOutput(const std::string& stringPort) {
|
||||||
|
|
||||||
const auto PMONITOR = MON->get();
|
const auto PMONITOR = MON->get();
|
||||||
|
|
||||||
|
if (!PMONITOR->sessionLockSurface)
|
||||||
|
return;
|
||||||
|
|
||||||
PMONITOR->sessionLockSurface->render();
|
PMONITOR->sessionLockSurface->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHyprlock::renderAllOutputs() {
|
||||||
|
for (auto& o : m_vOutputs) {
|
||||||
|
if (!o->sessionLockSurface)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
o->sessionLockSurface->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CHyprlock::startKeyRepeat(xkb_keysym_t sym) {
|
void CHyprlock::startKeyRepeat(xkb_keysym_t sym) {
|
||||||
if (m_pKeyRepeatTimer) {
|
if (m_pKeyRepeatTimer) {
|
||||||
m_pKeyRepeatTimer->cancel();
|
m_pKeyRepeatTimer->cancel();
|
||||||
|
@ -830,9 +835,7 @@ void CHyprlock::repeatKey(xkb_keysym_t sym) {
|
||||||
m_pKeyRepeatTimer = addTimer(
|
m_pKeyRepeatTimer = addTimer(
|
||||||
std::chrono::milliseconds(m_iKeebRepeatRate), [sym](std::shared_ptr<CTimer> self, void* data) { g_pHyprlock->repeatKey(sym); }, nullptr);
|
std::chrono::milliseconds(m_iKeebRepeatRate), [sym](std::shared_ptr<CTimer> self, void* data) { g_pHyprlock->repeatKey(sym); }, nullptr);
|
||||||
|
|
||||||
for (auto& o : m_vOutputs) {
|
renderAllOutputs();
|
||||||
o->sessionLockSurface->render();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprlock::onKey(uint32_t key, bool down) {
|
void CHyprlock::onKey(uint32_t key, bool down) {
|
||||||
|
@ -863,9 +866,7 @@ void CHyprlock::onKey(uint32_t key, bool down) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pAuth->checkWaiting()) {
|
if (g_pAuth->checkWaiting()) {
|
||||||
for (auto& o : m_vOutputs) {
|
renderAllOutputs();
|
||||||
o->sessionLockSurface->render();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,9 +882,7 @@ void CHyprlock::onKey(uint32_t key, bool down) {
|
||||||
startKeyRepeat(SYM);
|
startKeyRepeat(SYM);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& o : m_vOutputs) {
|
renderAllOutputs();
|
||||||
o->sessionLockSurface->render();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprlock::handleKeySym(xkb_keysym_t sym) {
|
void CHyprlock::handleKeySym(xkb_keysym_t sym) {
|
||||||
|
|
|
@ -64,6 +64,7 @@ class CHyprlock {
|
||||||
std::optional<std::string> passwordLastFailReason();
|
std::optional<std::string> passwordLastFailReason();
|
||||||
|
|
||||||
void renderOutput(const std::string& stringPort);
|
void renderOutput(const std::string& stringPort);
|
||||||
|
void renderAllOutputs();
|
||||||
|
|
||||||
size_t getPasswordBufferLen();
|
size_t getPasswordBufferLen();
|
||||||
size_t getPasswordBufferDisplayLen();
|
size_t getPasswordBufferDisplayLen();
|
||||||
|
|
Loading…
Reference in a new issue