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
This commit is contained in:
parent
9ace7a3634
commit
d2e94b988e
7 changed files with 79 additions and 9 deletions
|
@ -25,6 +25,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
|
|
||||||
#include "notifications.h"
|
#include "notifications.h"
|
||||||
#include "atoms.h"
|
#include "atoms.h"
|
||||||
|
#include "group.h"
|
||||||
|
|
||||||
extern Time qt_x_time;
|
extern Time qt_x_time;
|
||||||
|
|
||||||
|
@ -636,6 +637,10 @@ Time Client::readUserTimeMapTimestamp( const KStartupInfoData* asn_data,
|
||||||
|| ( asn_data->timestamp() != -1U
|
|| ( asn_data->timestamp() != -1U
|
||||||
&& timestampCompare( asn_data->timestamp(), time ) > 0 )))
|
&& timestampCompare( asn_data->timestamp(), time ) > 0 )))
|
||||||
time = asn_data->timestamp();
|
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;
|
kdDebug( 1212 ) << "User timestamp, ASN:" << time << endl;
|
||||||
if( time == -1U )
|
if( time == -1U )
|
||||||
{ // The window doesn't have any timestamp.
|
{ // The window doesn't have any timestamp.
|
||||||
|
@ -734,7 +739,7 @@ void Client::setActive( bool act)
|
||||||
void Client::startupIdChanged()
|
void Client::startupIdChanged()
|
||||||
{
|
{
|
||||||
KStartupInfoData asn_data;
|
KStartupInfoData asn_data;
|
||||||
bool asn_valid = workspace()->checkStartupNotification( this, asn_data );
|
bool asn_valid = workspace()->checkStartupNotification( window(), asn_data );
|
||||||
if( !asn_valid )
|
if( !asn_valid )
|
||||||
return;
|
return;
|
||||||
if( asn_data.desktop() != 0 )
|
if( asn_data.desktop() != 0 )
|
||||||
|
@ -757,4 +762,19 @@ void Client::updateUrgency()
|
||||||
demandAttention();
|
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
|
||||||
|
&×tampCompare( asn_data.timestamp(), user_time ) > 0 )
|
||||||
|
user_time = asn_data.timestamp();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
16
events.cpp
16
events.cpp
|
@ -19,6 +19,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "atoms.h"
|
#include "atoms.h"
|
||||||
#include "tabbox.h"
|
#include "tabbox.h"
|
||||||
|
#include "group.h"
|
||||||
|
|
||||||
#include <qwhatsthis.h>
|
#include <qwhatsthis.h>
|
||||||
#include <kkeynative.h>
|
#include <kkeynative.h>
|
||||||
|
@ -1463,5 +1464,20 @@ void Client::keyPressEvent( uint key_code )
|
||||||
QCursor::setPos( pos );
|
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
|
} // namespace
|
||||||
|
|
25
group.cpp
25
group.cpp
|
@ -21,7 +21,10 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
|
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <kstartupinfo.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO
|
TODO
|
||||||
|
@ -37,13 +40,27 @@ namespace KWinInternal
|
||||||
//********************************************
|
//********************************************
|
||||||
|
|
||||||
Group::Group( Window leader_P, Workspace* workspace_P )
|
Group::Group( Window leader_P, Workspace* workspace_P )
|
||||||
: leader_client( workspace_P->findClient( WindowMatchPredicate( leader_P ))),
|
: leader_client( NULL ),
|
||||||
leader_wid( leader_P ),
|
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 );
|
workspace()->addGroup( this, Allowed );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Group::~Group()
|
||||||
|
{
|
||||||
|
delete leader_info;
|
||||||
|
}
|
||||||
|
|
||||||
QPixmap Group::icon() const
|
QPixmap Group::icon() const
|
||||||
{
|
{
|
||||||
if( leader_client != NULL )
|
if( leader_client != NULL )
|
||||||
|
@ -107,6 +124,10 @@ void Group::lostLeader()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Group::getIcons()
|
||||||
|
{
|
||||||
|
// TODO - also needs adding the flag to NETWinInfo
|
||||||
|
}
|
||||||
|
|
||||||
//***************************************
|
//***************************************
|
||||||
// Workspace
|
// Workspace
|
||||||
|
|
17
group.h
17
group.h
|
@ -14,6 +14,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
|
#include <netwm.h>
|
||||||
|
|
||||||
namespace KWinInternal
|
namespace KWinInternal
|
||||||
{
|
{
|
||||||
|
@ -25,6 +26,7 @@ class Group
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Group( Window leader, Workspace* workspace );
|
Group( Window leader, Workspace* workspace );
|
||||||
|
~Group();
|
||||||
Window leader() const;
|
Window leader() const;
|
||||||
const Client* leaderClient() const;
|
const Client* leaderClient() const;
|
||||||
Client* leaderClient();
|
Client* leaderClient();
|
||||||
|
@ -36,11 +38,17 @@ class Group
|
||||||
void gotLeader( Client* leader );
|
void gotLeader( Client* leader );
|
||||||
void lostLeader();
|
void lostLeader();
|
||||||
Workspace* workspace();
|
Workspace* workspace();
|
||||||
|
bool groupEvent( XEvent* e );
|
||||||
|
Time userTime() const;
|
||||||
private:
|
private:
|
||||||
|
void getIcons();
|
||||||
|
void startupIdChanged();
|
||||||
ClientList _members;
|
ClientList _members;
|
||||||
Client* leader_client;
|
Client* leader_client;
|
||||||
Window leader_wid;
|
Window leader_wid;
|
||||||
Workspace* workspace_;
|
Workspace* _workspace;
|
||||||
|
NETWinInfo* leader_info;
|
||||||
|
Time user_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Window Group::leader() const
|
inline Window Group::leader() const
|
||||||
|
@ -65,7 +73,12 @@ inline const ClientList& Group::members() const
|
||||||
|
|
||||||
inline Workspace* Group::workspace()
|
inline Workspace* Group::workspace()
|
||||||
{
|
{
|
||||||
return workspace_;
|
return _workspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Time Group::userTime() const
|
||||||
|
{
|
||||||
|
return user_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -128,7 +128,7 @@ bool Client::manage( Window w, bool isMapped )
|
||||||
keep_above = keep_below = false;
|
keep_above = keep_below = false;
|
||||||
|
|
||||||
KStartupInfoData asn_data;
|
KStartupInfoData asn_data;
|
||||||
bool asn_valid = workspace()->checkStartupNotification( this, asn_data );
|
bool asn_valid = workspace()->checkStartupNotification( window(), asn_data );
|
||||||
|
|
||||||
workspace()->updateClientLayer( this );
|
workspace()->updateClientLayer( this );
|
||||||
|
|
||||||
|
|
|
@ -1947,9 +1947,9 @@ QString Workspace::desktopName( int desk ) const
|
||||||
return QString::fromUtf8( rootInfo->desktopName( desk ) );
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -219,7 +219,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
|
||||||
// only called from Client::destroyClient() or Client::releaseWindow()
|
// only called from Client::destroyClient() or Client::releaseWindow()
|
||||||
void removeClient( Client*, allowed_t );
|
void removeClient( Client*, allowed_t );
|
||||||
|
|
||||||
bool checkStartupNotification( const Client* c, KStartupInfoData& data );
|
bool checkStartupNotification( Window w, KStartupInfoData& data );
|
||||||
|
|
||||||
void focusToNull(); // SELI public?
|
void focusToNull(); // SELI public?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue