mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-11-16 15:05:57 +01:00
core: immediately create session lock surfaces (#421)
* core: immediately create session lock surfaces Instead of waiting for the `locked` event, create session lock surfaces right away. * core: don't allow unlock_and_destroy if `locked` has never been recieved
This commit is contained in:
parent
b407128cae
commit
69d37d2663
2 changed files with 19 additions and 4 deletions
|
@ -400,6 +400,9 @@ void CHyprlock::run() {
|
|||
|
||||
acquireSessionLock();
|
||||
|
||||
if (m_bTerminate) // Recieved finished
|
||||
exit(1);
|
||||
|
||||
g_pAuth = std::make_unique<CAuth>();
|
||||
g_pAuth->start();
|
||||
|
||||
|
@ -409,6 +412,8 @@ void CHyprlock::run() {
|
|||
registerSignalAction(SIGSEGV, handleCriticalSignal);
|
||||
registerSignalAction(SIGABRT, handleCriticalSignal);
|
||||
|
||||
createSessionLockSurfaces();
|
||||
|
||||
pollfd pollfds[] = {
|
||||
{
|
||||
.fd = wl_display_get_fd(m_sWaylandState.display),
|
||||
|
@ -925,7 +930,7 @@ void CHyprlock::acquireSessionLock() {
|
|||
m_sLockState.lock = ext_session_lock_manager_v1_lock(m_sWaylandState.sessionLock);
|
||||
ext_session_lock_v1_add_listener(m_sLockState.lock, &sessionLockListener, nullptr);
|
||||
|
||||
// wait for wayland to signal whether the session lock has been acquired
|
||||
// roundtrip in case the compositor sends `finished` right away
|
||||
wl_display_roundtrip(m_sWaylandState.display);
|
||||
}
|
||||
|
||||
|
@ -936,6 +941,12 @@ void CHyprlock::releaseSessionLock() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!m_bLocked) {
|
||||
// Would be a protocol error to allow this
|
||||
Debug::log(ERR, "Trying to unlock the session, but never recieved the locked event!");
|
||||
return;
|
||||
}
|
||||
|
||||
ext_session_lock_v1_unlock_and_destroy(m_sLockState.lock);
|
||||
m_sLockState.lock = nullptr;
|
||||
|
||||
|
@ -947,12 +958,14 @@ void CHyprlock::releaseSessionLock() {
|
|||
wl_display_roundtrip(m_sWaylandState.display);
|
||||
}
|
||||
|
||||
void CHyprlock::onLockLocked() {
|
||||
Debug::log(LOG, "onLockLocked called");
|
||||
|
||||
void CHyprlock::createSessionLockSurfaces() {
|
||||
for (auto& o : m_vOutputs) {
|
||||
o->sessionLockSurface = std::make_unique<CSessionLockSurface>(o.get());
|
||||
}
|
||||
}
|
||||
|
||||
void CHyprlock::onLockLocked() {
|
||||
Debug::log(LOG, "onLockLocked called");
|
||||
|
||||
m_bLocked = true;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ class CHyprlock {
|
|||
void acquireSessionLock();
|
||||
void releaseSessionLock();
|
||||
|
||||
void createSessionLockSurfaces();
|
||||
|
||||
void attemptRestoreOnDeath();
|
||||
|
||||
void spawnAsync(const std::string& cmd);
|
||||
|
|
Loading…
Reference in a new issue