Fix focus stealing prevention during kontact startup, with tips dialog

enabled.

svn path=/trunk/kdebase/kwin/; revision=277883
This commit is contained in:
Luboš Luňák 2004-01-08 16:18:07 +00:00
parent e2aef0dd51
commit 581fa5f585
3 changed files with 17 additions and 11 deletions

View file

@ -653,7 +653,8 @@ Time Client::readUserTimeMapTimestamp( const KStartupInfoData* asn_data,
if( act->hasTransient( this, true ))
; // is transient for currently active window, even though it's not
// the same app (e.g. kcookiejar dialog) -> allow activation
else if( groupTransient() && mainClients().isEmpty())
else if( groupTransient() &&
findClientInList( mainClients(), SameApplicationActiveHackPredicate( this )) == NULL )
; // standalone transient
else
first_window = false;

11
utils.h
View file

@ -175,6 +175,17 @@ struct name \
KWIN_CHECK_PREDICATE( TruePredicate, cl == cl /*true, avoid warning about 'cl' */ );
template< typename T >
Client* findClientInList( const ClientList& list, T predicate )
{
for ( ClientList::ConstIterator it = list.begin(); it != list.end(); ++it)
{
if ( predicate( const_cast< const Client* >( *it)))
return *it;
}
return NULL;
}
inline
int timestampCompare( Time time1, Time time2 ) // like strcmp()
{

View file

@ -631,16 +631,10 @@ inline bool Workspace::sessionSaving() const
template< typename T >
inline Client* Workspace::findClient( T predicate )
{
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
{
if ( predicate( const_cast< const Client* >( *it)))
return *it;
}
for ( ClientList::ConstIterator it = desktops.begin(); it != desktops.end(); ++it)
{
if ( predicate( const_cast< const Client* >( *it)))
return *it;
}
if( Client* ret = findClientInList( clients, predicate ))
return ret;
if( Client* ret = findClientInList( desktops, predicate ))
return ret;
return NULL;
}