From cf498cc14bd60b75e472779c9f934a1e623c0be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 10 Apr 2014 13:15:16 +0200 Subject: [PATCH] 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 --- autotests/CMakeLists.txt | 2 -- autotests/test_client_machine.cpp | 8 -------- client_machine.cpp | 8 ++++---- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index 475a7a5f90..c10ea6ef92 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -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} ) diff --git a/autotests/test_client_machine.cpp b/autotests/test_client_machine.cpp index 19febf7a5e..dd484537fe 100644 --- a/autotests/test_client_machine.cpp +++ b/autotests/test_client_machine.cpp @@ -19,9 +19,7 @@ along with this program. If not, see . *********************************************************************/ #include "testutils.h" // KWin -#include "../atoms.h" // needed for utils to compile #include "../client_machine.h" -#include "../utils.h" #include "../xcbutils.h" // Qt #include @@ -34,12 +32,6 @@ along with this program. If not, see . #include #include -namespace KWin { -// just to make the linker of utils happy -Atoms* atoms; - -} - using namespace KWin; class TestClientMachine : public QObject diff --git a/client_machine.cpp b/client_machine.cpp index 08234d7b84..dd9cbc1f04 100644 --- a/client_machine.cpp +++ b/client_machine.cpp @@ -19,8 +19,8 @@ along with this program. If not, see . *********************************************************************/ // own #include "client_machine.h" -// KWin -#include "utils.h" +// KF5 +#include // Qt #include #include @@ -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();