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
|
set( testClientMachine_SRCS
|
||||||
test_client_machine.cpp
|
test_client_machine.cpp
|
||||||
../client_machine.cpp
|
../client_machine.cpp
|
||||||
../utils.cpp
|
|
||||||
../atoms.cpp # needed by utils.cpp
|
|
||||||
)
|
)
|
||||||
add_executable( testClientMachine ${testClientMachine_SRCS} )
|
add_executable( testClientMachine ${testClientMachine_SRCS} )
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
// KWin
|
// KWin
|
||||||
#include "../atoms.h" // needed for utils to compile
|
|
||||||
#include "../client_machine.h"
|
#include "../client_machine.h"
|
||||||
#include "../utils.h"
|
|
||||||
#include "../xcbutils.h"
|
#include "../xcbutils.h"
|
||||||
// Qt
|
// Qt
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -34,12 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
namespace KWin {
|
|
||||||
// just to make the linker of utils happy
|
|
||||||
Atoms* atoms;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace KWin;
|
using namespace KWin;
|
||||||
|
|
||||||
class TestClientMachine : public QObject
|
class TestClientMachine : public QObject
|
||||||
|
|
|
@ -19,8 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
// own
|
// own
|
||||||
#include "client_machine.h"
|
#include "client_machine.h"
|
||||||
// KWin
|
// KF5
|
||||||
#include "utils.h"
|
#include <KWindowInfo>
|
||||||
// Qt
|
// Qt
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
|
@ -173,9 +173,9 @@ void ClientMachine::resolve(xcb_window_t window, xcb_window_t clientLeader)
|
||||||
if (m_resolved) {
|
if (m_resolved) {
|
||||||
return;
|
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) {
|
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()) {
|
if (name.isEmpty()) {
|
||||||
name = localhost();
|
name = localhost();
|
||||||
|
|
Loading…
Reference in a new issue