|
|
|
@ -158,7 +158,7 @@ TDEStartupInfo::~TDEStartupInfo()
|
|
|
|
|
void TDEStartupInfo::got_message( const TQString& msg_P )
|
|
|
|
|
{
|
|
|
|
|
// TODO do something with SCREEN= ?
|
|
|
|
|
kdDebug( 172 ) << "got:" << msg_P << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] got:" << msg_P << endl;
|
|
|
|
|
TQString msg = msg_P.stripWhiteSpace();
|
|
|
|
|
if( msg.startsWith( "new:" )) // must match length below
|
|
|
|
|
got_startup_info( msg.mid( 4 ), false );
|
|
|
|
@ -207,7 +207,7 @@ void TDEStartupInfo::window_added( WId w_P )
|
|
|
|
|
switch( ret )
|
|
|
|
|
{
|
|
|
|
|
case Match:
|
|
|
|
|
kdDebug( 172 ) << "new window match" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] new window match" << endl;
|
|
|
|
|
break;
|
|
|
|
|
case NoMatch:
|
|
|
|
|
break; // nothing
|
|
|
|
@ -238,7 +238,7 @@ void TDEStartupInfo::new_startup_info_internal( const TDEStartupInfoId& id_P,
|
|
|
|
|
{ // already reported, update
|
|
|
|
|
d->startups[ id_P ].update( data_P );
|
|
|
|
|
d->startups[ id_P ].age = 0; // CHECKME
|
|
|
|
|
kdDebug( 172 ) << "updating" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] updating" << endl;
|
|
|
|
|
if( d->startups[ id_P ].silent() == Data::Yes
|
|
|
|
|
&& !( d->flags & AnnounceSilenceChanges ))
|
|
|
|
|
{
|
|
|
|
@ -254,7 +254,7 @@ void TDEStartupInfo::new_startup_info_internal( const TDEStartupInfoId& id_P,
|
|
|
|
|
{ // already reported, update
|
|
|
|
|
d->silent_startups[ id_P ].update( data_P );
|
|
|
|
|
d->silent_startups[ id_P ].age = 0; // CHECKME
|
|
|
|
|
kdDebug( 172 ) << "updating silenced" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] updating silenced" << endl;
|
|
|
|
|
if( d->silent_startups[ id_P ].silent() != Data::Yes )
|
|
|
|
|
{
|
|
|
|
|
d->startups[ id_P ] = d->silent_startups[ id_P ];
|
|
|
|
@ -268,7 +268,7 @@ void TDEStartupInfo::new_startup_info_internal( const TDEStartupInfoId& id_P,
|
|
|
|
|
if( d->uninited_startups.contains( id_P ))
|
|
|
|
|
{
|
|
|
|
|
d->uninited_startups[ id_P ].update( data_P );
|
|
|
|
|
kdDebug( 172 ) << "updating uninited" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] updating uninited" << endl;
|
|
|
|
|
if( !update_P ) // uninited finally got new:
|
|
|
|
|
{
|
|
|
|
|
d->startups[ id_P ] = d->uninited_startups[ id_P ];
|
|
|
|
@ -281,18 +281,18 @@ void TDEStartupInfo::new_startup_info_internal( const TDEStartupInfoId& id_P,
|
|
|
|
|
}
|
|
|
|
|
if( update_P ) // change: without any new: first
|
|
|
|
|
{
|
|
|
|
|
kdDebug( 172 ) << "adding uninited" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] adding uninited" << endl;
|
|
|
|
|
d->uninited_startups.insert( id_P, data_P );
|
|
|
|
|
}
|
|
|
|
|
else if( data_P.silent() != Data::Yes || d->flags & AnnounceSilenceChanges )
|
|
|
|
|
{
|
|
|
|
|
kdDebug( 172 ) << "adding" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] adding" << endl;
|
|
|
|
|
d->startups.insert( id_P, data_P );
|
|
|
|
|
emit gotNewStartup( id_P, data_P );
|
|
|
|
|
}
|
|
|
|
|
else // new silenced, and silent shouldn't be announced
|
|
|
|
|
{
|
|
|
|
|
kdDebug( 172 ) << "adding silent" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] adding silent" << endl;
|
|
|
|
|
d->silent_startups.insert( id_P, data_P );
|
|
|
|
|
}
|
|
|
|
|
d->cleanup->start( 1000 ); // 1 sec
|
|
|
|
@ -319,18 +319,18 @@ void TDEStartupInfo::remove_startup_info_internal( const TDEStartupInfoId& id_P
|
|
|
|
|
return;
|
|
|
|
|
if( d->startups.contains( id_P ))
|
|
|
|
|
{
|
|
|
|
|
kdDebug( 172 ) << "removing" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] removing" << endl;
|
|
|
|
|
emit gotRemoveStartup( id_P, d->startups[ id_P ]);
|
|
|
|
|
d->startups.remove( id_P );
|
|
|
|
|
}
|
|
|
|
|
else if( d->silent_startups.contains( id_P ))
|
|
|
|
|
{
|
|
|
|
|
kdDebug( 172 ) << "removing silent" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] removing silent" << endl;
|
|
|
|
|
d->silent_startups.remove( id_P );
|
|
|
|
|
}
|
|
|
|
|
else if( d->uninited_startups.contains( id_P ))
|
|
|
|
|
{
|
|
|
|
|
kdDebug( 172 ) << "removing uninited" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] removing uninited" << endl;
|
|
|
|
|
d->uninited_startups.remove( id_P );
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
@ -384,7 +384,7 @@ bool TDEStartupInfo::sendStartup( const TDEStartupInfoId& id_P, const TDEStartup
|
|
|
|
|
TQString msg = TQString::fromLatin1( "new: %1 %2" )
|
|
|
|
|
.arg( id_P.to_text()).arg( data_P.to_text());
|
|
|
|
|
msg = check_required_startup_fields( msg, data_P, tqt_xscreen());
|
|
|
|
|
kdDebug( 172 ) << "sending " << msg << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] sending " << msg << endl;
|
|
|
|
|
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -398,7 +398,7 @@ bool TDEStartupInfo::sendStartupX( Display* disp_P, const TDEStartupInfoId& id_P
|
|
|
|
|
.arg( id_P.to_text()).arg( data_P.to_text());
|
|
|
|
|
msg = check_required_startup_fields( msg, data_P, DefaultScreen( disp_P ));
|
|
|
|
|
#ifdef KSTARTUPINFO_ALL_DEBUG
|
|
|
|
|
kdDebug( 172 ) << "sending " << msg << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] sending " << msg << endl;
|
|
|
|
|
#endif
|
|
|
|
|
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
|
|
|
|
|
}
|
|
|
|
@ -409,7 +409,7 @@ TQString TDEStartupInfo::check_required_startup_fields( const TQString& msg, con
|
|
|
|
|
TQString ret = msg;
|
|
|
|
|
if( data_P.name().isEmpty())
|
|
|
|
|
{
|
|
|
|
|
// kdWarning( 172 ) << "NAME not specified in initial startup message" << endl;
|
|
|
|
|
// kdWarning( 172 ) << "[tdecore-tdestartupinfo] NAME not specified in initial startup message" << endl;
|
|
|
|
|
TQString name = data_P.bin();
|
|
|
|
|
if( name.isEmpty())
|
|
|
|
|
name = "UNKNOWN";
|
|
|
|
@ -427,7 +427,7 @@ bool TDEStartupInfo::sendChange( const TDEStartupInfoId& id_P, const TDEStartupI
|
|
|
|
|
KXMessages msgs;
|
|
|
|
|
TQString msg = TQString::fromLatin1( "change: %1 %2" )
|
|
|
|
|
.arg( id_P.to_text()).arg( data_P.to_text());
|
|
|
|
|
kdDebug( 172 ) << "sending " << msg << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] sending " << msg << endl;
|
|
|
|
|
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -440,7 +440,7 @@ bool TDEStartupInfo::sendChangeX( Display* disp_P, const TDEStartupInfoId& id_P,
|
|
|
|
|
TQString msg = TQString::fromLatin1( "change: %1 %2" )
|
|
|
|
|
.arg( id_P.to_text()).arg( data_P.to_text());
|
|
|
|
|
#ifdef KSTARTUPINFO_ALL_DEBUG
|
|
|
|
|
kdDebug( 172 ) << "sending " << msg << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] sending " << msg << endl;
|
|
|
|
|
#endif
|
|
|
|
|
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
|
|
|
|
|
}
|
|
|
|
@ -451,7 +451,7 @@ bool TDEStartupInfo::sendFinish( const TDEStartupInfoId& id_P )
|
|
|
|
|
return false;
|
|
|
|
|
KXMessages msgs;
|
|
|
|
|
TQString msg = TQString::fromLatin1( "remove: %1" ).arg( id_P.to_text());
|
|
|
|
|
kdDebug( 172 ) << "sending " << msg << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] sending " << msg << endl;
|
|
|
|
|
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -462,7 +462,7 @@ bool TDEStartupInfo::sendFinishX( Display* disp_P, const TDEStartupInfoId& id_P
|
|
|
|
|
return false;
|
|
|
|
|
TQString msg = TQString::fromLatin1( "remove: %1" ).arg( id_P.to_text());
|
|
|
|
|
#ifdef KSTARTUPINFO_ALL_DEBUG
|
|
|
|
|
kdDebug( 172 ) << "sending " << msg << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] sending " << msg << endl;
|
|
|
|
|
#endif
|
|
|
|
|
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
|
|
|
|
|
}
|
|
|
|
@ -474,7 +474,7 @@ bool TDEStartupInfo::sendFinish( const TDEStartupInfoId& id_P, const TDEStartupI
|
|
|
|
|
KXMessages msgs;
|
|
|
|
|
TQString msg = TQString::fromLatin1( "remove: %1 %2" )
|
|
|
|
|
.arg( id_P.to_text()).arg( data_P.to_text());
|
|
|
|
|
kdDebug( 172 ) << "sending " << msg << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] sending " << msg << endl;
|
|
|
|
|
msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -487,7 +487,7 @@ bool TDEStartupInfo::sendFinishX( Display* disp_P, const TDEStartupInfoId& id_P,
|
|
|
|
|
TQString msg = TQString::fromLatin1( "remove: %1 %2" )
|
|
|
|
|
.arg( id_P.to_text()).arg( data_P.to_text());
|
|
|
|
|
#ifdef KSTARTUPINFO_ALL_DEBUG
|
|
|
|
|
kdDebug( 172 ) << "sending " << msg << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] sending " << msg << endl;
|
|
|
|
|
#endif
|
|
|
|
|
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
|
|
|
|
|
}
|
|
|
|
@ -606,13 +606,13 @@ TDEStartupInfo::startup_t TDEStartupInfo::check_startup_internal( WId w_P, TDESt
|
|
|
|
|
// - No - Is this a NET_WM compliant app ?
|
|
|
|
|
// - Yes - test for pid match
|
|
|
|
|
// - No - test for WM_CLASS match
|
|
|
|
|
kdDebug( 172 ) << "check_startup" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] check_startup" << endl;
|
|
|
|
|
TQCString id = windowStartupId( w_P );
|
|
|
|
|
if( !id.isNull())
|
|
|
|
|
{
|
|
|
|
|
if( id.isEmpty() || id == "0" ) // means ignore this window
|
|
|
|
|
{
|
|
|
|
|
kdDebug( 172 ) << "ignore" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] ignore" << endl;
|
|
|
|
|
return NoMatch;
|
|
|
|
|
}
|
|
|
|
|
return find_id( id, id_O, data_O ) ? Match : NoMatch;
|
|
|
|
@ -657,7 +657,7 @@ TDEStartupInfo::startup_t TDEStartupInfo::check_startup_internal( WId w_P, TDESt
|
|
|
|
|
&& transient_for != None )
|
|
|
|
|
return NoMatch;
|
|
|
|
|
#endif
|
|
|
|
|
kdDebug( 172 ) << "check_startup:cantdetect" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] check_startup:cantdetect" << endl;
|
|
|
|
|
return CantDetect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -666,7 +666,7 @@ bool TDEStartupInfo::find_id( const TQCString& id_P, TDEStartupInfoId* id_O,
|
|
|
|
|
{
|
|
|
|
|
if( d == NULL )
|
|
|
|
|
return false;
|
|
|
|
|
kdDebug( 172 ) << "find_id:" << id_P << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] find_id:" << id_P << endl;
|
|
|
|
|
TDEStartupInfoId id;
|
|
|
|
|
id.initId( id_P );
|
|
|
|
|
if( d->startups.contains( id ))
|
|
|
|
@ -675,7 +675,7 @@ bool TDEStartupInfo::find_id( const TQCString& id_P, TDEStartupInfoId* id_O,
|
|
|
|
|
*id_O = id;
|
|
|
|
|
if( data_O != NULL )
|
|
|
|
|
*data_O = d->startups[ id ];
|
|
|
|
|
kdDebug( 172 ) << "check_startup_id:match" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] check_startup_id:match" << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
@ -686,7 +686,7 @@ bool TDEStartupInfo::find_pid( pid_t pid_P, const TQCString& hostname_P,
|
|
|
|
|
{
|
|
|
|
|
if( d == NULL )
|
|
|
|
|
return false;
|
|
|
|
|
kdDebug( 172 ) << "find_pid:" << pid_P << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] find_pid:" << pid_P << endl;
|
|
|
|
|
for( TQMap< TDEStartupInfoId, Data >::Iterator it = d->startups.begin();
|
|
|
|
|
it != d->startups.end();
|
|
|
|
|
++it )
|
|
|
|
@ -699,7 +699,7 @@ bool TDEStartupInfo::find_pid( pid_t pid_P, const TQCString& hostname_P,
|
|
|
|
|
*data_O = *it;
|
|
|
|
|
// non-compliant, remove on first match
|
|
|
|
|
remove_startup_info_internal( it.key());
|
|
|
|
|
kdDebug( 172 ) << "check_startup_pid:match" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] check_startup_pid:match" << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -713,7 +713,7 @@ bool TDEStartupInfo::find_wclass( TQCString res_name, TQCString res_class,
|
|
|
|
|
return false;
|
|
|
|
|
res_name = res_name.lower();
|
|
|
|
|
res_class = res_class.lower();
|
|
|
|
|
kdDebug( 172 ) << "find_wclass:" << res_name << ":" << res_class << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] find_wclass:" << res_name << ":" << res_class << endl;
|
|
|
|
|
for( TQMap< TDEStartupInfoId, Data >::Iterator it = d->startups.begin();
|
|
|
|
|
it != d->startups.end();
|
|
|
|
|
++it )
|
|
|
|
@ -727,7 +727,7 @@ bool TDEStartupInfo::find_wclass( TQCString res_name, TQCString res_class,
|
|
|
|
|
*data_O = *it;
|
|
|
|
|
// non-compliant, remove on first match
|
|
|
|
|
remove_startup_info_internal( it.key());
|
|
|
|
|
kdDebug( 172 ) << "check_startup_wclass:match" << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] check_startup_wclass:match" << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -858,7 +858,7 @@ void TDEStartupInfo::startups_cleanup_internal( bool age_P )
|
|
|
|
|
{
|
|
|
|
|
const TDEStartupInfoId& key = it.key();
|
|
|
|
|
++it;
|
|
|
|
|
kdDebug( 172 ) << "startups entry timeout:" << key.id() << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] startups entry timeout:" << key.id() << endl;
|
|
|
|
|
remove_startup_info_internal( key );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -877,7 +877,7 @@ void TDEStartupInfo::startups_cleanup_internal( bool age_P )
|
|
|
|
|
{
|
|
|
|
|
const TDEStartupInfoId& key = it.key();
|
|
|
|
|
++it;
|
|
|
|
|
kdDebug( 172 ) << "silent entry timeout:" << key.id() << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] silent entry timeout:" << key.id() << endl;
|
|
|
|
|
remove_startup_info_internal( key );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -896,7 +896,7 @@ void TDEStartupInfo::startups_cleanup_internal( bool age_P )
|
|
|
|
|
{
|
|
|
|
|
const TDEStartupInfoId& key = it.key();
|
|
|
|
|
++it;
|
|
|
|
|
kdDebug( 172 ) << "uninited entry timeout:" << key.id() << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] uninited entry timeout:" << key.id() << endl;
|
|
|
|
|
remove_startup_info_internal( key );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -919,7 +919,7 @@ void TDEStartupInfo::clean_all_noncompliant()
|
|
|
|
|
}
|
|
|
|
|
const TDEStartupInfoId& key = it.key();
|
|
|
|
|
++it;
|
|
|
|
|
kdDebug( 172 ) << "entry cleaning:" << key.id() << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] entry cleaning:" << key.id() << endl;
|
|
|
|
|
remove_startup_info_internal( key );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -936,7 +936,7 @@ TQCString TDEStartupInfo::createNewStartupId()
|
|
|
|
|
hostname[sizeof(hostname)-1] = '\0';
|
|
|
|
|
TQCString id = TQString(TQString( "%1;%2;%3;%4_TIME%5" ).arg( hostname ).arg( tm.tv_sec )
|
|
|
|
|
.arg( tm.tv_usec ).arg( getpid()).arg( GET_QT_X_USER_TIME() )).utf8();
|
|
|
|
|
kdDebug( 172 ) << "creating: " << id << ":" << tqAppName() << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] creating: " << id << ":" << tqAppName() << endl;
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -978,7 +978,7 @@ void TDEStartupInfoId::initId( const TQCString& id_P )
|
|
|
|
|
{
|
|
|
|
|
d->id = id_P;
|
|
|
|
|
#ifdef KSTARTUPINFO_ALL_DEBUG
|
|
|
|
|
kdDebug( 172 ) << "using: " << d->id << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] using: " << d->id << endl;
|
|
|
|
|
#endif
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -987,7 +987,7 @@ void TDEStartupInfoId::initId( const TQCString& id_P )
|
|
|
|
|
{ // already has id
|
|
|
|
|
d->id = startup_env;
|
|
|
|
|
#ifdef KSTARTUPINFO_ALL_DEBUG
|
|
|
|
|
kdDebug( 172 ) << "reusing: " << d->id << endl;
|
|
|
|
|
kdDebug( 172 ) << "[tdecore-tdestartupinfo] reusing: " << d->id << endl;
|
|
|
|
|
#endif
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|