Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix listener_sessionActive to handle an event correctly when the session get inactivated #6696

Merged
merged 2 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions src/events/Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,25 @@ void Events::listener_RendererDestroy(wl_listener* listener, void* data) {
}

void Events::listener_sessionActive(wl_listener* listener, void* data) {
Debug::log(LOG, "Session got activated!");
if (g_pCompositor->m_sWLRSession->active) {
Debug::log(LOG, "Session got activated!");

g_pCompositor->m_bSessionActive = true;
g_pCompositor->m_bSessionActive = true;

for (auto& m : g_pCompositor->m_vMonitors) {
g_pCompositor->scheduleFrameForMonitor(m.get());
g_pHyprRenderer->applyMonitorRule(m.get(), &m->activeMonitorRule, true);
}
for (auto& m : g_pCompositor->m_vMonitors) {
g_pCompositor->scheduleFrameForMonitor(m.get());
g_pHyprRenderer->applyMonitorRule(m.get(), &m->activeMonitorRule, true);
}

g_pConfigManager->m_bWantsMonitorReload = true;
} else {
Debug::log(LOG, "Session got inactivated!");

g_pConfigManager->m_bWantsMonitorReload = true;
g_pCompositor->m_bSessionActive = false;

for (auto& m : g_pCompositor->m_vMonitors) {
m->noFrameSchedule = true;
m->framesToSkip = 1;
}
}
}
13 changes: 1 addition & 12 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,18 +810,7 @@ bool CKeybindManager::handleVT(xkb_keysym_t keysym) {

Debug::log(LOG, "Switching from VT {} to VT {}", ttynum, TTY);

if (!wlr_session_change_vt(g_pCompositor->m_sWLRSession, TTY))
return true; // probably same session

g_pCompositor->m_bSessionActive = false;

for (auto& m : g_pCompositor->m_vMonitors) {
m->noFrameSchedule = true;
m->framesToSkip = 1;
}

Debug::log(LOG, "Switched to VT {}, destroyed all render data, frames to skip for each: 2", TTY);

wlr_session_change_vt(g_pCompositor->m_sWLRSession, TTY);
return true;
}

Expand Down
Loading