void Client::startupIdChanged() { TDEStartupInfoId asn_id; TDEStartupInfoData asn_data; bool asn_valid = workspace()->checkStartupNotification( window(), asn_id, asn_data ); if( !asn_valid ) return; // If the ASN contains desktop, move it to the desktop, otherwise move it to the current // desktop (since the new ASN should make the window act like if it's a new application // launched). However don't affect the window's desktop if it's set to be on all desktops. int desktop = workspace()->currentDesktop(); if( asn_data.desktop() != 0 ) desktop = asn_data.desktop(); if( !isOnAllDesktops()) workspace()->sendClientToDesktop( this, desktop, true ); if( asn_data.xinerama() != -1 ) workspace()->sendClientToScreen( this, asn_data.xinerama()); Time timestamp = asn_id.timestamp(); if( timestamp == 0 && asn_data.timestamp() != -1U ) timestamp = asn_data.timestamp(); if( timestamp != 0 ) { bool activate = workspace()->allowClientActivation( this, timestamp ); if( asn_data.desktop() != 0 && !isOnCurrentDesktop()) activate = false; // it was started on different desktop than current one if( activate ) workspace()->activateClient( this ); else demandAttention(); } }
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 TDELauncher when launching KNotify) need to access X. Notify::Event e = isOnCurrentDesktop() ? Notify::DemandAttentionCurrent : Notify::DemandAttentionOther; // 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. if( Notify::makeDemandAttention( e )) info->setState( set ? NET::DemandsAttention : 0, NET::DemandsAttention ); if( demandAttentionKNotifyTimer == NULL ) { demandAttentionKNotifyTimer = new TQTimer( this ); connect( demandAttentionKNotifyTimer, TQT_SIGNAL( timeout()), TQT_SLOT( demandAttentionKNotify())); } demandAttentionKNotifyTimer->start( 1000, true ); } else info->setState( set ? NET::DemandsAttention : 0, NET::DemandsAttention ); workspace()->clientAttentionChanged( this, set ); }
void Task::updateThumbnail() { if ( !isOnCurrentDesktop() ) return; if ( !isActive() ) return; if ( !_grab.isNull() ) // We're already processing one... return; // // We do this as a two stage process to remove the delay caused // by the thumbnail generation. This makes things much smoother // on slower machines. // QWidget *rootWin = qApp->desktop(); #ifdef KDE_3_2 QRect geom = _info.geometry(); #else QRect geom = _info.geometry; #endif _grab = QPixmap::grabWindow( rootWin->winId(), geom.x(), geom.y(), geom.width(), geom.height() ); if ( !_grab.isNull() ) QTimer::singleShot( 200, this, SLOT( generateThumbnail() ) ); }
void Client::demandAttentionKNotify() { Notify::Event e = isOnCurrentDesktop() ? Notify::DemandAttentionCurrent : Notify::DemandAttentionOther; Notify::raise( e, i18n( "Window '%1' demands attention." ).arg( KStringHandler::csqueeze(caption())), this ); demandAttentionKNotifyTimer->stop(); demandAttentionKNotifyTimer->deleteLater(); demandAttentionKNotifyTimer = NULL; }
void AbstractClient::setDesktop(int desktop) { const int numberOfDesktops = VirtualDesktopManager::self()->count(); if (desktop != NET::OnAllDesktops) // Do range check desktop = qMax(1, qMin(numberOfDesktops, desktop)); desktop = qMin(numberOfDesktops, rules()->checkDesktop(desktop)); if (m_desktop == desktop) return; int was_desk = m_desktop; const bool wasOnCurrentDesktop = isOnCurrentDesktop(); m_desktop = desktop; doSetDesktop(desktop, was_desk); FocusChain::self()->update(this, FocusChain::MakeFirst); updateWindowRules(Rules::Desktop); emit desktopChanged(); if (wasOnCurrentDesktop != isOnCurrentDesktop()) emit desktopPresenceChanged(this, was_desk); }