unified window captions ( not propagated yet)

svn path=/trunk/kdebase/kwin/; revision=35364
This commit is contained in:
Matthias Ettrich 1999-11-28 20:55:52 +00:00
parent 070b0971cc
commit 82b0710065
3 changed files with 27 additions and 1 deletions

View file

@ -410,7 +410,18 @@ void Client::fetchName()
if ( XFetchName( qt_xdisplay(), win, &name ) && name ) {
QString s = QString::fromLatin1( name );
if ( s != caption() ) {
setCaption( QString::fromLatin1( name ) );
setCaption( "" );
if (workspace()->hasCaption( s ) ){
int i = 2;
QString s2;
do {
s2 = s + " <" + QString::number(i) + ">";
i++;
} while (workspace()->hasCaption(s2) );
s = s2;
}
setCaption( s );
if ( !isWithdrawn() )
captionChange( caption() );
}

View file

@ -775,6 +775,19 @@ void Workspace::iconifyOrDeiconifyTransientsOf( Client* c )
}
/*!
Returns whether a client with the specified \a caption exists, or not.
*/
bool Workspace::hasCaption( const QString& caption )
{
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) {
if ( (*it)->caption() == caption )
return TRUE;
}
return FALSE;
}
/*!
Tries to activate the client by asking X for the input focus. This
function does not perform any show, raise or desktop switching. See

View file

@ -100,6 +100,8 @@ public:
bool iconifyMeansWithdraw( Client* );
void iconifyOrDeiconifyTransientsOf( Client* );
bool hasCaption( const QString& caption );
public slots:
void setCurrentDesktop( int new_desktop );
// keybindings