Ejemplo n.º 1
0
void Client::demandAttention(bool set)
{
    if (isActive())
        set = false;
    if (demands_attention == set)
        return;
    demands_attention = set;
    if (demands_attention) {
        // Demand attention flag is often set right from manage(), when focus stealing prevention
        // steps in. At that time the window has no taskbar entry yet, so KNotify cannot place
        // e.g. the passive popup next to it. So wait up to 1 second for the icon geometry
        // to be set.
        // Delayed call to KNotify also solves the problem of having X server grab in manage(),
        // which may deadlock when KNotify (or KLauncher when launching KNotify) need to access X.

        // Setting the demands attention state needs to be done directly in KWin, because
        // KNotify would try to set it, resulting in a call to KNotify again, etc.

        info->setState(set ? NET::DemandsAttention : 0, NET::DemandsAttention);

        if (demandAttentionKNotifyTimer == NULL) {
            demandAttentionKNotifyTimer = new QTimer(this);
            demandAttentionKNotifyTimer->setSingleShot(true);
            connect(demandAttentionKNotifyTimer, SIGNAL(timeout()), SLOT(demandAttentionKNotify()));
        }
        demandAttentionKNotifyTimer->start(1000);
    } else
        info->setState(set ? NET::DemandsAttention : 0, NET::DemandsAttention);
    workspace()->clientAttentionChanged(this, set);
    emit demandsAttentionChanged();
}
Ejemplo n.º 2
0
void AbstractClient::demandAttention(bool set)
{
    if (isActive())
        set = false;
    if (m_demandsAttention == set)
        return;
    m_demandsAttention = set;
    if (info) {
        info->setState(set ? NET::DemandsAttention : NET::States(0), NET::DemandsAttention);
    }
    workspace()->clientAttentionChanged(this, set);
    emit demandsAttentionChanged();
}