From kde-commits Mon Feb 07 14:35:54 2005 From: =?utf-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 07 Feb 2005 14:35:54 +0000 To: kde-commits Subject: kdebase/kwin Message-Id: <20050207143554.5060E1BABD () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=110778843812994 CVS commit by lunakl: Avoid unnecessary roundtrips finding out WM_CLIENT_MACHINE when setting caption. M +11 -15 client.cpp 1.449 M +2 -0 client.h 1.176 M +2 -1 manage.cpp 2.72 --- kdebase/kwin/client.cpp #1.448:1.449 @@ -1277,5 +1277,5 @@ void Client::setCaption( const QString& bool was_suffix = ( !cap_suffix.isEmpty()); QString machine_suffix; - if( !isLocalMachine( wmClientMachine( false ))) + if( wmClientMachine( false ) != "localhost" && !isLocalMachine( wmClientMachine( false ))) machine_suffix = " <@" + wmClientMachine( true ) + ">"; cap_suffix = machine_suffix; @@ -1470,15 +1470,4 @@ QCString Client::staticWmCommand(WId w) /*! - Returns WM_CLIENT_MACHINE property for a given window. - */ -QCString Client::staticWmClientMachine(WId w) - { - QCString result = getStringProperty(w, XA_WM_CLIENT_MACHINE); - if (result.isEmpty()) - result = "localhost"; - return result; - } - -/*! Returns WM_CLIENT_LEADER property for a given window. */ @@ -1535,4 +1524,13 @@ QCString Client::wmCommand() } +void Client::getWmClientMachine() + { + client_machine = getStringProperty(window(), XA_WM_CLIENT_MACHINE); + if( client_machine.isEmpty() && wmClientLeaderWin && wmClientLeaderWin!=window()) + client_machine = getStringProperty(wmClientLeaderWin, XA_WM_CLIENT_MACHINE); + if( client_machine.isEmpty()) + client_machine = "localhost"; + } + /*! Returns client machine for this client, @@ -1541,7 +1539,5 @@ QCString Client::wmCommand() QCString Client::wmClientMachine( bool use_localhost ) const { - QCString result = staticWmClientMachine(window()); - if (result.isEmpty() && wmClientLeaderWin && wmClientLeaderWin!=window()) - result = staticWmClientMachine(wmClientLeaderWin); + QCString result = client_machine; if( use_localhost ) { // special name for the local machine (localhost) --- kdebase/kwin/client.h #1.175:1.176 @@ -359,4 +359,5 @@ class Client : public QObject, public KD void getIcons(); void getWmClientLeader(); + void getWmClientMachine(); void fetchName(); void fetchIconicName(); @@ -499,4 +500,5 @@ class Client : public QObject, public KD QCString resource_name; QCString resource_class; + QCString client_machine; QString cap_normal, cap_iconic, cap_suffix; WId wmClientLeaderWin; --- kdebase/kwin/manage.cpp #2.71:2.72 @@ -94,4 +94,6 @@ bool Client::manage( Window w, bool isMa window_role = staticWindowRole( w ); + getWmClientLeader(); + getWmClientMachine(); // first only read the caption text, so that setupWindowRules() can use it for matching, // and only then really set the caption using setCaption(), which checks for duplicates etc. @@ -104,5 +106,4 @@ bool Client::manage( Window w, bool isMa fetchIconicName(); getWMHints(); // needs to be done before readTransient() because of reading the group - getWmClientLeader(); // needs to be done before readTransient() because of same app comparing modal = ( info->state() & NET::Modal ) != 0; // needs to be valid before handling groups readTransient();