kwin: restore the "demands attention" of clients from the session config

comes with a hack, for reference:
https://ivailo-monev.atlassian.net/browse/KDE-2

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-25 10:09:00 +03:00
parent 5f54837b9a
commit 7fef6648ce
2 changed files with 24 additions and 2 deletions

View file

@ -622,6 +622,7 @@ private slots:
void shadeUnhover(); void shadeUnhover();
void shortcutActivated(); void shortcutActivated();
void delayedMoveResize(); void delayedMoveResize();
void delayedDemandAttention();
private: private:
friend class Bridge; // FRAME friend class Bridge; // FRAME

View file

@ -133,7 +133,8 @@ bool Client::manage(xcb_window_t w, bool isMapped)
original_skip_taskbar = skip_taskbar = (info->state() & NET::SkipTaskbar) != 0; original_skip_taskbar = skip_taskbar = (info->state() & NET::SkipTaskbar) != 0;
skip_pager = (info->state() & NET::SkipPager) != 0; skip_pager = (info->state() & NET::SkipPager) != 0;
bool init_demand_attention = rules()->checkDemandAttention(info->state() & NET::DemandsAttention, !isMapped); bool init_demand_attention = (info->state() & NET::DemandsAttention) != 0;
kDebug(1212) << "State NET::DemandsAttention" << init_demand_attention;
setupCompositing(); setupCompositing();
@ -149,12 +150,16 @@ bool Client::manage(xcb_window_t w, bool isMapped)
SessionInfo* session = workspace()->takeSessionInfo(this); SessionInfo* session = workspace()->takeSessionInfo(this);
if (session) { if (session) {
init_minimize = session->minimized; init_minimize = session->minimized;
init_demand_attention = session->demandAttention;
kDebug(1212) << "Session NET::DemandsAttention" << init_demand_attention;
noborder = session->noBorder; noborder = session->noBorder;
} }
setShortcut(rules()->checkShortcut(session ? session->shortcut : QString(), true)); setShortcut(rules()->checkShortcut(session ? session->shortcut : QString(), true));
init_minimize = rules()->checkMinimize(init_minimize, !isMapped); init_minimize = rules()->checkMinimize(init_minimize, !isMapped);
init_demand_attention = rules()->checkDemandAttention(init_demand_attention, !isMapped);
kDebug(1212) << "Rules NET::DemandsAttention" << init_demand_attention;
noborder = rules()->checkNoBorder(noborder, !isMapped); noborder = rules()->checkNoBorder(noborder, !isMapped);
// Initial desktop placement // Initial desktop placement
@ -558,8 +563,9 @@ bool Client::manage(xcb_window_t w, bool isMapped)
} else if (!session && !isSpecialWindow()) } else if (!session && !isSpecialWindow())
init_demand_attention = true; init_demand_attention = true;
} }
} else } else {
updateVisibility(); updateVisibility();
}
assert(mapping_state != Withdrawn); assert(mapping_state != Withdrawn);
m_managed = true; m_managed = true;
blockGeometryUpdates(false); blockGeometryUpdates(false);
@ -582,7 +588,11 @@ bool Client::manage(xcb_window_t w, bool isMapped)
RuleBook::self()->discardUsed(this, false); // Remove ApplyNow rules RuleBook::self()->discardUsed(this, false); // Remove ApplyNow rules
updateWindowRules(Rules::All); // Was blocked while !isManaged() updateWindowRules(Rules::All); // Was blocked while !isManaged()
kDebug(1212) << "Final NET::DemandsAttention" << init_demand_attention;
demandAttention(init_demand_attention); demandAttention(init_demand_attention);
if (init_demand_attention) {
QTimer::singleShot(2000, this, SLOT(delayedDemandAttention()));
}
updateCompositeBlocking(true); updateCompositeBlocking(true);
@ -593,6 +603,17 @@ bool Client::manage(xcb_window_t w, bool isMapped)
return true; return true;
} }
void Client::delayedDemandAttention()
{
// HACK: do it again if the client still demands attention, it is one of those hacks like the
// one for KMainWindow in the method above - off first and then again for things to detect the
// change in state
if (isDemandingAttention()) {
demandAttention(false);
demandAttention(true);
}
}
// Called only from manage() // Called only from manage()
void Client::embedClient(xcb_window_t w, const XWindowAttributes& attr) void Client::embedClient(xcb_window_t w, const XWindowAttributes& attr)
{ {