From d551f871fbe2de44c9640b41f42e30cb8a45579e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 26 May 2004 09:24:14 +0000 Subject: [PATCH] Prefer the newer way of getting startup timestamp from the ASN startup id. svn path=/trunk/kdebase/kwin/; revision=314706 --- activation.cpp | 43 ++++++++++++++++++++++++++++++++----------- client.h | 2 +- manage.cpp | 5 +++-- workspace.cpp | 4 ++-- workspace.h | 3 ++- 5 files changed, 40 insertions(+), 17 deletions(-) diff --git a/activation.cpp b/activation.cpp index dc6413e9ae..cf327aa1f0 100644 --- a/activation.cpp +++ b/activation.cpp @@ -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 - &×tampCompare( 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 ) diff --git a/client.h b/client.h index ad1096958c..ce8d8c3ebc 100644 --- a/client.h +++ b/client.h @@ -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 ); diff --git a/manage.cpp b/manage.cpp index 62a4f7c550..ffade9f4e3 100644 --- a/manage.cpp +++ b/manage.cpp @@ -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 diff --git a/workspace.cpp b/workspace.cpp index ef46197115..8543b482ba 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -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; } /*! diff --git a/workspace.h b/workspace.h index ef9f0edbd2..06ce61b8ea 100644 --- a/workspace.h +++ b/workspace.h @@ -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?