Fixed handling of X11 Xmb WM name atom. Non-latin1 window captions were not

displayed correctly before.

svn path=/trunk/kdebase/kwin/; revision=66444
This commit is contained in:
Vojtech Bubnik 2000-10-05 11:19:39 +00:00
parent dc66d38dda
commit c0459f2a91

View file

@ -674,10 +674,18 @@ void Client::fetchName()
if ( info->name() ) { if ( info->name() ) {
s = QString::fromUtf8( info->name() ); s = QString::fromUtf8( info->name() );
} else { } else {
char* c = 0; XTextProperty tp;
if ( XFetchName( qt_xdisplay(), win, &c ) != 0 ) { char **text;
s = QString::fromLocal8Bit( c ); int count;
XFree( c ); if ( XGetTextProperty( qt_xdisplay(), win, &tp, XA_WM_NAME) != 0 && tp.value != NULL ) {
if ( tp.encoding == XA_STRING )
s = QString::fromLocal8Bit( (const char*) tp.value );
else if ( XmbTextPropertyToTextList( qt_xdisplay(), &tp, &text, &count) == Success &&
text != NULL && count > 0 ) {
s = QString::fromLocal8Bit( text[0] );
XFreeStringList( text );
}
XFree( tp.value );
} }
} }