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

displayed correctly before.

svn path=/trunk/kdebase/kwin/; revision=66444
icc-effect-5.14.5
Vojtech Bubnik 2000-10-05 11:19:39 +00:00
parent dc66d38dda
commit c0459f2a91
1 changed files with 13 additions and 5 deletions

View File

@ -674,11 +674,19 @@ void Client::fetchName()
if ( info->name() ) {
s = QString::fromUtf8( info->name() );
} else {
char* c = 0;
if ( XFetchName( qt_xdisplay(), win, &c ) != 0 ) {
s = QString::fromLocal8Bit( c );
XFree( c );
}
XTextProperty tp;
char **text;
int count;
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 );
}
}
if ( s != caption() ) {