Oops. Qt3.2 used to set resource class in WM_CLASS all lowercase, but

Qt3.3 capitalizes it (part of my own patch IIRC, hehe :-/), so all
the workarounds for specific apps no longer work -> force resource class
to be always lowercase.

svn path=/trunk/kdebase/kwin/; revision=290521
This commit is contained in:
Luboš Luňák 2004-02-23 12:47:28 +00:00
parent 1e121b6c94
commit 3abd0ebdf0
6 changed files with 26 additions and 12 deletions

View file

@ -1540,7 +1540,8 @@ NET::WindowType Client::windowType( bool strict, int supported_types ) const
&& abs( width() - workspace()->clientArea( FullArea, this ).width()) < 10 )
wt = NET::TopMenu;
}
const char* const oo_prefix = "OpenOffice.org"; // QCString has no startsWith()
const char* const oo_prefix = "openoffice.org"; // QCString has no startsWith()
// oo_prefix is lowercase, because resourceClass() is forced to be lowercase
if( qstrncmp( resourceClass(), oo_prefix, strlen( oo_prefix )) == 0 && wt == NET::Dialog )
wt = NET::Normal; // see bug #66065
if( wt == NET::Unknown ) // this is more or less suggested in NETWM spec

View file

@ -573,12 +573,12 @@ inline int Client::mappingState() const
inline QCString Client::resourceName() const
{
return resource_name;
return resource_name; // it is always lowercase
}
inline QCString Client::resourceClass() const
{
return resource_class;
return resource_class; // it is always lowercase
}
inline

View file

@ -204,14 +204,15 @@ void Workspace::checkTransients( Window w )
//****************************************
// hacks for broken apps here
// all resource classes are forced to be lowercase
bool Client::resourceMatch( const Client* c1, const Client* c2 )
{
// xv has "xv" as resource name, and different strings starting with "XV" as resource class
if( qstrncmp( c1->resourceClass(), "XV", 2 ) == 0 && c1->resourceName() == "xv" )
return qstrncmp( c2->resourceClass(), "XV", 2 ) == 0 && c2->resourceName() == "xv";
if( qstrncmp( c1->resourceClass(), "xv", 2 ) == 0 && c1->resourceName() == "xv" )
return qstrncmp( c2->resourceClass(), "xv", 2 ) == 0 && c2->resourceName() == "xv";
// Mozilla has "Mozilla" as resource name, and different strings as resource class
if( c1->resourceName() == "Mozilla" )
return c2->resourceName() == "Mozilla";
if( c1->resourceName() == "mozilla" )
return c2->resourceName() == "mozilla";
return c1->resourceClass() == c2->resourceClass();
}
@ -290,7 +291,7 @@ bool Client::sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool ac
||
// hacks here
// Mozilla has resourceName() and resourceClass() swapped
c1->resourceName() == "Mozilla" && c2->resourceName() == "Mozilla" )
c1->resourceName() == "mozilla" && c2->resourceName() == "mozilla" )
{
if( !active_hack ) // without the active hack for focus stealing prevention,
return c1 == c2; // different mainwindows are always different apps

View file

@ -95,8 +95,10 @@ bool Client::manage( Window w, bool isMapped )
XClassHint classHint;
if ( XGetClassHint( qt_xdisplay(), client, &classHint ) )
{
resource_name = classHint.res_name;
resource_class = classHint.res_class;
// Qt3.2 and older had this all lowercase, Qt3.3 capitalized resource class
// force lowercase, so that workarounds listing resource classes still work
resource_name = QCString( classHint.res_name ).lower();
resource_class = QCString( classHint.res_class ).lower();
XFree( classHint.res_name );
XFree( classHint.res_class );
}

View file

@ -127,6 +127,16 @@ unsigned long Options::updateSettings()
ignorePositionClasses = config->readListEntry("IgnorePositionClasses");
ignoreFocusStealingClasses = config->readListEntry("IgnoreFocusStealingClasses");
// Qt3.2 and older had resource class all lowercase, but Qt3.3 has it capitalized
// therefore Client::resourceClass() forces lowercase, force here lowercase as well
for( QStringList::Iterator it = ignorePositionClasses.begin();
it != ignorePositionClasses.end();
++it )
(*it) = (*it).lower();
for( QStringList::Iterator it = ignoreFocusStealingClasses.begin();
it != ignoreFocusStealingClasses.end();
++it )
(*it) = (*it).lower();
// Mouse bindings
config->setGroup( "MouseBindings");

4
sm.cpp
View file

@ -161,7 +161,7 @@ void Workspace::loadSessionInfo()
info->wmCommand = config->readEntry( QString("wmCommand")+n ).latin1();
info->wmClientMachine = config->readEntry( QString("wmClientMachine")+n ).latin1();
info->resourceName = config->readEntry( QString("resourceName")+n ).latin1();
info->resourceClass = config->readEntry( QString("resourceClass")+n ).latin1();
info->resourceClass = config->readEntry( QString("resourceClass")+n ).lower().latin1();
info->geometry = config->readRectEntry( QString("geometry")+n );
info->restore = config->readRectEntry( QString("restore")+n );
info->fsrestore = config->readRectEntry( QString("fsrestore")+n );
@ -195,7 +195,7 @@ void Workspace::loadFakeSessionInfo()
fakeSession.append( info );
info->windowRole = config->readEntry( QString("windowRole")+n ).latin1();
info->resourceName = config->readEntry( QString("resourceName")+n ).latin1();
info->resourceClass = config->readEntry( QString("resourceClass")+n ).latin1();
info->resourceClass = config->readEntry( QString("resourceClass")+n ).lower().latin1();
info->wmClientMachine = config->readEntry( QString("clientMachine")+n ).latin1();
info->geometry = config->readRectEntry( QString("geometry")+n );
info->restore = config->readRectEntry( QString("restore")+n );