Watch properties also on the group leader window, for now only

the startup notification property, but it could be extended
to read icons etc. as well if needed (ICCCM 4.1.2.7).

svn path=/trunk/kdebase/kwin/; revision=291218
icc-effect-5.14.5
Luboš Luňák 2004-02-25 09:51:47 +00:00
parent 9ace7a3634
commit d2e94b988e
7 changed files with 79 additions and 9 deletions

View File

@ -25,6 +25,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "notifications.h"
#include "atoms.h"
#include "group.h"
extern Time qt_x_time;
@ -636,6 +637,10 @@ Time Client::readUserTimeMapTimestamp( const KStartupInfoData* asn_data,
|| ( asn_data->timestamp() != -1U
&& timestampCompare( asn_data->timestamp(), time ) > 0 )))
time = asn_data->timestamp();
if( time == -1U
|| ( group()->userTime() != -1U
&& timestampCompare( time, group()->userTime()) > 0 ))
time = group()->userTime();
kdDebug( 1212 ) << "User timestamp, ASN:" << time << endl;
if( time == -1U )
{ // The window doesn't have any timestamp.
@ -734,7 +739,7 @@ void Client::setActive( bool act)
void Client::startupIdChanged()
{
KStartupInfoData asn_data;
bool asn_valid = workspace()->checkStartupNotification( this, asn_data );
bool asn_valid = workspace()->checkStartupNotification( window(), asn_data );
if( !asn_valid )
return;
if( asn_data.desktop() != 0 )
@ -756,5 +761,20 @@ void Client::updateUrgency()
if( urgency )
demandAttention();
}
//****************************************
// Group
//****************************************
void Group::startupIdChanged()
{
KStartupInfoData asn_data;
bool asn_valid = workspace()->checkStartupNotification( leader_wid, asn_data );
if( !asn_valid )
return;
if( asn_data.timestamp() != -1U && user_time != -1U
&&timestampCompare( asn_data.timestamp(), user_time ) > 0 )
user_time = asn_data.timestamp();
}
} // namespace

View File

@ -19,6 +19,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "workspace.h"
#include "atoms.h"
#include "tabbox.h"
#include "group.h"
#include <qwhatsthis.h>
#include <kkeynative.h>
@ -1463,5 +1464,20 @@ void Client::keyPressEvent( uint key_code )
QCursor::setPos( pos );
}
// ****************************************
// Group
// ****************************************
bool Group::groupEvent( XEvent* e )
{
unsigned long dirty[ 2 ];
leader_info->event( e, dirty, 2 ); // pass through the NET stuff
if ( ( dirty[ WinInfo::PROTOCOLS ] & NET::WMIcon) != 0 )
getIcons();
if(( dirty[ WinInfo::PROTOCOLS2 ] & NET::WM2StartupId ) != 0 )
startupIdChanged();
return false;
}
} // namespace

View File

@ -21,7 +21,10 @@ License. See the file "COPYING" for the exact licensing terms.
#include "workspace.h"
#include "client.h"
#include <assert.h>
#include <kstartupinfo.h>
/*
TODO
@ -37,13 +40,27 @@ namespace KWinInternal
//********************************************
Group::Group( Window leader_P, Workspace* workspace_P )
: leader_client( workspace_P->findClient( WindowMatchPredicate( leader_P ))),
: leader_client( NULL ),
leader_wid( leader_P ),
workspace_( workspace_P )
_workspace( workspace_P ),
leader_info( NULL ),
user_time( -1U )
{
if( leader_P != None )
{
leader_client = workspace_P->findClient( WindowMatchPredicate( leader_P ));
unsigned long properties[ 2 ] = { 0, NET::WM2StartupId };
leader_info = new NETWinInfo( qt_xdisplay(), leader_P, workspace()->rootWin(),
properties, 2 );
}
workspace()->addGroup( this, Allowed );
}
Group::~Group()
{
delete leader_info;
}
QPixmap Group::icon() const
{
if( leader_client != NULL )
@ -107,6 +124,10 @@ void Group::lostLeader()
}
}
void Group::getIcons()
{
// TODO - also needs adding the flag to NETWinInfo
}
//***************************************
// Workspace

17
group.h
View File

@ -14,6 +14,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "utils.h"
#include <X11/X.h>
#include <netwm.h>
namespace KWinInternal
{
@ -25,6 +26,7 @@ class Group
{
public:
Group( Window leader, Workspace* workspace );
~Group();
Window leader() const;
const Client* leaderClient() const;
Client* leaderClient();
@ -36,11 +38,17 @@ class Group
void gotLeader( Client* leader );
void lostLeader();
Workspace* workspace();
bool groupEvent( XEvent* e );
Time userTime() const;
private:
void getIcons();
void startupIdChanged();
ClientList _members;
Client* leader_client;
Window leader_wid;
Workspace* workspace_;
Workspace* _workspace;
NETWinInfo* leader_info;
Time user_time;
};
inline Window Group::leader() const
@ -65,7 +73,12 @@ inline const ClientList& Group::members() const
inline Workspace* Group::workspace()
{
return workspace_;
return _workspace;
}
inline Time Group::userTime() const
{
return user_time;
}
} // namespace

View File

@ -128,7 +128,7 @@ bool Client::manage( Window w, bool isMapped )
keep_above = keep_below = false;
KStartupInfoData asn_data;
bool asn_valid = workspace()->checkStartupNotification( this, asn_data );
bool asn_valid = workspace()->checkStartupNotification( window(), asn_data );
workspace()->updateClientLayer( this );

View File

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

View File

@ -219,7 +219,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
// only called from Client::destroyClient() or Client::releaseWindow()
void removeClient( Client*, allowed_t );
bool checkStartupNotification( const Client* c, KStartupInfoData& data );
bool checkStartupNotification( Window w, KStartupInfoData& data );
void focusToNull(); // SELI public?