//____________________________________________________________________________________ void MdiWindowShadowFactory::unregisterWidget( QWidget* widget ) { if( !isRegistered( widget ) ) return; widget->removeEventFilter( this ); _registeredWidgets.remove( widget ); removeShadow( widget ); }
//____________________________________________________________________________________ bool MdiWindowShadowFactory::eventFilter( QObject* object, QEvent* event ) { switch( event->type() ) { // TODO: possibly implement ZOrderChange event, to make sure that // the shadow is always painted on top case QEvent::ZOrderChange: updateShadowZOrder( object ); break; case QEvent::Destroy: if( isRegistered( object ) ) { _registeredWidgets.remove( object ); removeShadow( object ); } break; case QEvent::Hide: hideShadows( object ); break; case QEvent::Show: installShadow( object ); updateShadowGeometry( object ); updateShadowZOrder( object ); break; case QEvent::Move: case QEvent::Resize: updateShadowGeometry( object ); break; default: break; } return QObject::eventFilter( object, event ); }
/*! 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 }