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

Conversation

harenayo
Copy link
Contributor

Describe your PR, what does it fix/add?

I found that Hyprland handles m_sWLRSession->events.active signal by listener_sessionActive.

addWLSignal(&m_sWLRSession->events.active, &Events::listen_sessionActive, m_sWLRSession, "Session");

void Events::listener_sessionActive(wl_listener* listener, void* data) {
Debug::log(LOG, "Session got activated!");
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);
}
g_pConfigManager->m_bWantsMonitorReload = true;
}

listener_sessionActive always does an activation process.

But I think m_sWLRSession->events.active is emitted whether the session get activated or inactivated.

https://github.com/hyprwm/wlroots-hyprland/blob/422207dbcf0949e28042403edab539159282885e/backend/session/session.c#L24-L35

That's why I made the following changes:

  • Check m_sWLRSession->active in listener_sessionActive.
  • Move the code for switching VTs into listener_sessionActive.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

I'm not sure that the second change (the code for VTs) works correctly.

Is it ready for merging, or does it need work?

It is ready.

@harenayo harenayo changed the title Fix listener_sessionActive to handle an event correctly when the session get inactivated Fix listener_sessionActive to handle an event correctly when the session get inactivated Jun 28, 2024
src/events/Misc.cpp Outdated Show resolved Hide resolved
@harenayo harenayo force-pushed the fix-session-active-listener branch from 9725e61 to 1648f03 Compare June 29, 2024 17:15
@harenayo harenayo force-pushed the fix-session-active-listener branch from 1648f03 to 7c75a36 Compare June 29, 2024 17:39
@harenayo harenayo requested a review from vaxerski June 29, 2024 17:40
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@vaxerski vaxerski merged commit 1f43a5c into hyprwm:main Jun 29, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants