Use KWindowInfo::clientMachine in ClientMachine::resolve
Let's use the available API instead of duplicating code. Nice side effect: client_machine.cpp doesn't include utils.h any more which simplifies the unit test. REVIEW: 117473
This commit is contained in:
parent
4a79cec8a6
commit
cf498cc14b
3 changed files with 4 additions and 14 deletions
|
@ -43,8 +43,6 @@ ecm_mark_as_test(testVirtualDesktops)
|
|||
set( testClientMachine_SRCS
|
||||
test_client_machine.cpp
|
||||
../client_machine.cpp
|
||||
../utils.cpp
|
||||
../atoms.cpp # needed by utils.cpp
|
||||
)
|
||||
add_executable( testClientMachine ${testClientMachine_SRCS} )
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
#include "testutils.h"
|
||||
// KWin
|
||||
#include "../atoms.h" // needed for utils to compile
|
||||
#include "../client_machine.h"
|
||||
#include "../utils.h"
|
||||
#include "../xcbutils.h"
|
||||
// Qt
|
||||
#include <QApplication>
|
||||
|
@ -34,12 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
|
||||
namespace KWin {
|
||||
// just to make the linker of utils happy
|
||||
Atoms* atoms;
|
||||
|
||||
}
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
class TestClientMachine : public QObject
|
||||
|
|
|
@ -19,8 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
// own
|
||||
#include "client_machine.h"
|
||||
// KWin
|
||||
#include "utils.h"
|
||||
// KF5
|
||||
#include <KWindowInfo>
|
||||
// Qt
|
||||
#include <QtConcurrentRun>
|
||||
#include <QFutureWatcher>
|
||||
|
@ -173,9 +173,9 @@ void ClientMachine::resolve(xcb_window_t window, xcb_window_t clientLeader)
|
|||
if (m_resolved) {
|
||||
return;
|
||||
}
|
||||
QByteArray name = getStringProperty(window, XCB_ATOM_WM_CLIENT_MACHINE);
|
||||
QByteArray name = KWindowInfo(window, NET::Properties(), NET::WM2ClientMachine).clientMachine();
|
||||
if (name.isEmpty() && clientLeader && clientLeader != window) {
|
||||
name = getStringProperty(clientLeader, XCB_ATOM_WM_CLIENT_MACHINE);
|
||||
name = KWindowInfo(clientLeader, NET::Properties(), NET::WM2ClientMachine).clientMachine();
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
name = localhost();
|
||||
|
|
Loading…
Reference in a new issue