Take surface idle inhibitors into account only after window is added to the workspace

This helps to reduce having N sources for the same information.
This commit is contained in:
Vlad Zahorodnii 2024-01-29 12:51:18 +02:00
parent 19970bd639
commit 795b619704
2 changed files with 6 additions and 2 deletions

View file

@ -31,6 +31,10 @@ IdleInhibition::~IdleInhibition() = default;
void IdleInhibition::registerClient(Window *client)
{
if (!client->surface()) {
return;
}
auto updateInhibit = [this, client] {
update(client);
};
@ -81,6 +85,7 @@ void IdleInhibition::update(Window *client)
void IdleInhibition::slotWorkspaceCreated()
{
connect(workspace(), &Workspace::windowAdded, this, &IdleInhibition::registerClient);
connect(workspace(), &Workspace::currentDesktopChanged, this, &IdleInhibition::slotDesktopChanged);
}

View file

@ -388,8 +388,7 @@ bool WaylandServer::init(InitializationFlags flags)
}
m_idle = new IdleInterface(m_display, m_display);
auto idleInhibition = new IdleInhibition(m_idle);
connect(this, &WaylandServer::windowAdded, idleInhibition, &IdleInhibition::registerClient);
new IdleInhibition(m_idle);
new IdleInhibitManagerV1Interface(m_display, m_display);
new IdleNotifyV1Interface(m_display, m_display);
m_plasmaShell = new PlasmaShellInterface(m_display, m_display);