Prefer the newer way of getting startup timestamp from the ASN startup id.

svn path=/trunk/kdebase/kwin/; revision=314706
This commit is contained in:
Luboš Luňák 2004-05-26 09:24:14 +00:00
parent 598c604fb6
commit d551f871fb
5 changed files with 40 additions and 17 deletions

View file

@ -661,18 +661,27 @@ KWIN_COMPARE_PREDICATE( SameApplicationActiveHackPredicate, const Client*,
!cl->isSplash() && !cl->isToolbar() && !cl->isTopMenu() && !cl->isUtility() && !cl->isMenu()
&& Client::belongToSameApplication( cl, value, true ) && cl != value);
Time Client::readUserTimeMapTimestamp( const KStartupInfoData* asn_data,
Time Client::readUserTimeMapTimestamp( const KStartupInfoId* asn_id, const KStartupInfoData* asn_data,
const SessionInfo* session ) const
{
Time time = info->userTime();
kdDebug( 1212 ) << "User timestamp, initial:" << time << endl;
// newer ASN timestamp always replaces user timestamp, unless user timestamp is 0
// helps e.g. with konqy reusing
if( asn_data != NULL && time != 0
&& ( time == -1U
|| ( asn_data->timestamp() != -1U
&& timestampCompare( asn_data->timestamp(), time ) > 0 )))
time = asn_data->timestamp();
if( asn_data != NULL && time != 0 )
{
// prefer timestamp from ASN id (timestamp from data is obsolete way)
if( asn_id->timestamp() != 0
&& ( time == -1U || timestampCompare( asn_id->timestamp(), time ) > 0 ))
{
time = asn_id->timestamp();
}
else if( asn_data->timestamp() != -1U
&& ( time == -1U || timestampCompare( asn_data->timestamp(), time ) > 0 ))
{
time = asn_data->timestamp();
}
}
kdDebug( 1212 ) << "User timestamp, ASN:" << time << endl;
if( time == -1U )
{ // The window doesn't have any timestamp.
@ -785,13 +794,17 @@ void Client::setActive( bool act)
void Client::startupIdChanged()
{
KStartupInfoId asn_id;
KStartupInfoData asn_data;
bool asn_valid = workspace()->checkStartupNotification( window(), asn_data );
bool asn_valid = workspace()->checkStartupNotification( window(), asn_id, asn_data );
if( !asn_valid )
return;
if( asn_data.desktop() != 0 )
workspace()->sendClientToDesktop( this, asn_data.desktop(), true );
if( asn_data.timestamp() != -1U )
Time timestamp = asn_id.timestamp();
if( timestamp == 0 && asn_data.timestamp() != -1U )
timestamp = asn_data.timestamp();
if( timestamp != 0 )
{
bool activate = workspace()->allowClientActivation( this, asn_data.timestamp());
if( asn_data.desktop() != 0 && !isOnCurrentDesktop())
@ -815,13 +828,21 @@ void Client::updateUrgency()
void Group::startupIdChanged()
{
KStartupInfoId asn_id;
KStartupInfoData asn_data;
bool asn_valid = workspace()->checkStartupNotification( leader_wid, asn_data );
bool asn_valid = workspace()->checkStartupNotification( leader_wid, asn_id, asn_data );
if( !asn_valid )
return;
if( asn_data.timestamp() != -1U && user_time != -1U
&&timestampCompare( asn_data.timestamp(), user_time ) > 0 )
if( asn_id.timestamp() != 0 && user_time != -1U
&& timestampCompare( asn_id.timestamp(), user_time ) > 0 )
{
user_time = asn_id.timestamp();
}
else if( asn_data.timestamp() != -1U && user_time != -1U
&& timestampCompare( asn_data.timestamp(), user_time ) > 0 )
{
user_time = asn_data.timestamp();
}
}
void Group::updateUserTime( Time time )

View file

@ -379,7 +379,7 @@ private slots:
void rawShow(); // just shows it
void rawHide(); // just hides it
Time readUserTimeMapTimestamp( const KStartupInfoData* asn_data,
Time readUserTimeMapTimestamp( const KStartupInfoId* asn_id, const KStartupInfoData* asn_data,
const SessionInfo* session ) const;
Time readUserCreationTime() const;
static bool sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool active_hack );

View file

@ -129,8 +129,9 @@ bool Client::manage( Window w, bool isMapped )
if( keep_above && keep_below )
keep_above = keep_below = false;
KStartupInfoId asn_id;
KStartupInfoData asn_data;
bool asn_valid = workspace()->checkStartupNotification( window(), asn_data );
bool asn_valid = workspace()->checkStartupNotification( window(), asn_id, asn_data );
workspace()->updateClientLayer( this );
@ -393,7 +394,7 @@ bool Client::manage( Window w, bool isMapped )
// - keep it?
XLowerWindow( qt_xdisplay(), frameId());
user_time = readUserTimeMapTimestamp( asn_valid ? &asn_data : NULL, session );
user_time = readUserTimeMapTimestamp( asn_valid ? &asn_id : NULL, asn_valid ? &asn_data : NULL, session );
if( isTopMenu()) // they're shown in Workspace::addClient() if their mainwindow
hideClient( true ); // is the active one

View file

@ -1977,9 +1977,9 @@ QString Workspace::desktopName( int desk ) const
return QString::fromUtf8( rootInfo->desktopName( desk ) );
}
bool Workspace::checkStartupNotification( Window w, KStartupInfoData& data )
bool Workspace::checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data )
{
return startup->checkStartup( w, data ) == KStartupInfo::Match;
return startup->checkStartup( w, id, data ) == KStartupInfo::Match;
}
/*!

View file

@ -28,6 +28,7 @@ class QPopupMenu;
class KConfig;
class KGlobalAccel;
class KStartupInfo;
class KStartupInfoId;
class KStartupInfoData;
namespace KWinInternal
@ -222,7 +223,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
void removeGroup( Group* group, allowed_t );
Group* findClientLeaderGroup( const Client* c ) const;
bool checkStartupNotification( Window w, KStartupInfoData& data );
bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
void focusToNull(); // SELI public?