From 7b3336252c1d27491026863a1be81f30a5bae490 Mon Sep 17 00:00:00 2001 From: Diego Iastrubni Date: Wed, 13 Aug 2008 16:33:54 +0000 Subject: [PATCH] Add LRM to the end of the window title to fix situations in which there are several windows with the same name and "<%n>" is appended to the window title. It should have no affect on LTR desktops, and on RTL desktops it fixes the display. BUG: 154840 svn path=/trunk/KDE/kdebase/workspace/; revision=846529 --- client.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/client.cpp b/client.cpp index 9705888bfb..77682670e2 100644 --- a/client.cpp +++ b/client.cpp @@ -1347,6 +1347,15 @@ QString Client::readName() const KWIN_COMPARE_PREDICATE( FetchNameInternalPredicate, Client, const Client*, (!cl->isSpecialWindow() || cl->isToolbar()) && cl != value && cl->caption() == value->caption()); +// The list is taken from http://www.unicode.org/reports/tr9/ +QChar LRM(0x200E); +QChar RLM(0x200F); +QChar LRE(0x202A); +QChar RLE(0x202B); +QChar LRO(0x202D); +QChar RLO(0x202E); +QChar PDF(0x202C); + void Client::setCaption( const QString& _s, bool force ) { QString s = _s; @@ -1362,7 +1371,12 @@ void Client::setCaption( const QString& _s, bool force ) bool was_suffix = ( !cap_suffix.isEmpty()); QString machine_suffix; if( wmClientMachine( false ) != "localhost" && !isLocalMachine( wmClientMachine( false ))) + { // how come doen't it compile in one line? what am i missing...? + // machine_suffix = " <@" + wmClientMachine( true ) + '>' + LRM; machine_suffix = " <@" + wmClientMachine( true ) + '>'; + // this is used to fix issue: http://bugs.kde.org/show_bug.cgi?id=154840 + machine_suffix = machine_suffix + LRM; + } QString shortcut_suffix = !shortcut().isEmpty() ? ( " {" + shortcut().toString() + '}' ) : QString(); cap_suffix = machine_suffix + shortcut_suffix; if ( ( !isSpecialWindow() || isToolbar()) && workspace()->findClient( FetchNameInternalPredicate( this ))) @@ -1370,7 +1384,7 @@ void Client::setCaption( const QString& _s, bool force ) int i = 2; do { - cap_suffix = machine_suffix + " <" + QString::number(i) + '>' + shortcut_suffix; + cap_suffix = machine_suffix + " <" + QString::number(i) + '>' + LRM + shortcut_suffix; i++; } while ( workspace()->findClient( FetchNameInternalPredicate( this ))); info->setVisibleName( caption().toUtf8() );