コード例 #1
0
/*!
  Sets the client's active state to \a act.

  This function does only change the visual appearance of the client,
  it does not change the focus setting. Use
  Workspace::activateClient() or Workspace::requestFocus() instead.

  If a client receives or looses the focus, it calls setActive() on
  its own.

 */
void Client::setActive(bool act)
{
    if (active == act)
        return;
    active = act;
    const int ruledOpacity = active
                             ? rules()->checkOpacityActive(qRound(opacity() * 100.0))
                             : rules()->checkOpacityInactive(qRound(opacity() * 100.0));
    setOpacity(ruledOpacity / 100.0);
    workspace()->setActiveClient(act ? this : NULL, Allowed);

    if (active)
        Notify::raise(Notify::Activate);

    if (!active)
        cancelAutoRaise();

    if (!active && shade_mode == ShadeActivated)
        setShade(ShadeNormal);

    StackingUpdatesBlocker blocker(workspace());
    workspace()->updateClientLayer(this);   // active windows may get different layer
    ClientList mainclients = mainClients();
    for (ClientList::ConstIterator it = mainclients.constBegin();
            it != mainclients.constEnd();
            ++it)
        if ((*it)->isFullScreen())  // fullscreens go high even if their transient is active
            workspace()->updateClientLayer(*it);
    if (decoration != NULL)
        decoration->activeChange();
    emit activeChanged();
    updateMouseGrab();
    updateUrgency(); // demand attention again if it's still urgent
    workspace()->checkUnredirect();
}
コード例 #2
0
ファイル: abstract_client.cpp プロジェクト: 8l/kwin
void AbstractClient::setActive(bool act)
{
    if (m_active == act) {
        return;
    }
    m_active = act;
    const int ruledOpacity = m_active
                             ? rules()->checkOpacityActive(qRound(opacity() * 100.0))
                             : rules()->checkOpacityInactive(qRound(opacity() * 100.0));
    setOpacity(ruledOpacity / 100.0);
    workspace()->setActiveClient(act ? this : NULL);

    if (!m_active)
        cancelAutoRaise();

    if (!m_active && shadeMode() == ShadeActivated)
        setShade(ShadeNormal);

    doSetActive();
    emit activeChanged();
    updateMouseGrab();
}
コード例 #3
0
ファイル: activation.cpp プロジェクト: Fat-Zer/tdebase
/*!
  Sets the client's active state to \a act.

  This function does only change the visual appearance of the client,
  it does not change the focus setting. Use
  Workspace::activateClient() or Workspace::requestFocus() instead.

  If a client receives or looses the focus, it calls setActive() on
  its own.

 */
void Client::setActive( bool act, bool updateOpacity_)
    {
    if ( active == act )
        return;
    active = act;
    workspace()->setActiveClient( act ? this : NULL, Allowed );

    if (updateOpacity_) updateOpacity();
    if (isModal() && transientFor())
    {
        if (!act) transientFor()->updateOpacity();
        else if (!transientFor()->custom_opacity) transientFor()->setOpacity(options->translucentActiveWindows, options->activeWindowOpacity);
    }
    updateShadowSize();

    if ( active )
    {
        Notify::raise( Notify::Activate );
        if (options->shadowEnabled(true))
            {
            if (options->shadowEnabled(false))
                {
                // Wait for inactive shadow to expose occluded windows and give
                // them a chance to redraw before painting the active shadow
                removeShadow();
                drawDelayedShadow();
                if (!isDesktop() &&
                       this != workspace()->topClientOnDesktop(desktop()))
                    // If the newly activated window's isn't the desktop, wait
                    // for its shadow to draw, then redraw any shadows
                    // overlapping it.
                    drawOverlappingShadows(true);
                }
            else
                drawShadow();
            }
        }
    else
        {
        removeShadow();

        if (options->shadowEnabled(false))
            {
            if (this == workspace()->topClientOnDesktop(desktop()))
                {
                /* If the newly deactivated window is the top client on the
                 * desktop, then the newly activated window is below it; ensure
                 * that the deactivated window's shadow draws after the
                 * activated window's shadow.
                 */
                if ((shadowAfterClient = workspace()->activeClient()))
                    {
                    drawShadowAfter(shadowAfterClient);
                    }
                }
            else
                {
                drawDelayedShadow();
                }
            }
        }

    if( !active )
        cancelAutoRaise();

    if( !active && shade_mode == ShadeActivated )
        setShade( ShadeNormal );
        
    StackingUpdatesBlocker blocker( workspace());
    workspace()->updateClientLayer( this ); // active windows may get different layer
    // TODO optimize? mainClients() may be a bit expensive
    ClientList mainclients = mainClients();
    for( ClientList::ConstIterator it = mainclients.begin();
         it != mainclients.end();
         ++it )
        if( (*it)->isFullScreen()) // fullscreens go high even if their transient is active
            workspace()->updateClientLayer( *it );
    if( decoration != NULL )
        decoration->activeChange();
    updateMouseGrab();
    updateUrgency(); // demand attention again if it's still urgent
    }
コード例 #4
0
ファイル: abstract_client.cpp プロジェクト: 8l/kwin
void AbstractClient::autoRaise()
{
    workspace()->raiseClient(this);
    cancelAutoRaise();
}