gnu: kwindowsystem: Fix test failure with Qt 5.12.

* gnu/packages/patches/kwindowsystem-qt-compat.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/kde-frameworks.scm (kwindowsystem)[source](patches): New field.
[inputs]: Add XCB-UTIL-WM.
This commit is contained in:
Marius Bakke 2019-10-18 18:53:13 +02:00
parent 133be097a8
commit 07abc851ce
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA
3 changed files with 101 additions and 1 deletions

View file

@ -1015,6 +1015,7 @@ dist_patch_DATA = \
%D%/packages/patches/kobodeluxe-graphics-window-signed-char.patch \
%D%/packages/patches/kodi-set-libcurl-ssl-parameters.patch \
%D%/packages/patches/kodi-skip-test-449.patch \
%D%/packages/patches/kwindowsystem-qt-compat.patch \
%D%/packages/patches/laby-make-install.patch \
%D%/packages/patches/lcalc-default-parameters-1.patch \
%D%/packages/patches/lcalc-default-parameters-2.patch \

View file

@ -1081,6 +1081,7 @@ (define-public kwindowsystem
"mirror://kde/stable/frameworks/"
(version-major+minor version) "/"
name "-" version ".tar.xz"))
(patches (search-patches "kwindowsystem-qt-compat.patch"))
(sha256
(base32
"10zdxm08d758zbwlrbsn0ghxjpf39ids2s5pnca072gbrbrxv656"))))
@ -1096,7 +1097,8 @@ (define-public kwindowsystem
`(("libxrender" ,libxrender)
("qtbase" ,qtbase)
("qtx11extras" ,qtx11extras)
("xcb-utils-keysyms" ,xcb-util-keysyms)))
("xcb-utils-keysyms" ,xcb-util-keysyms)
("xcb-util-wm" ,xcb-util-wm)))
(arguments
`(#:phases
(modify-phases %standard-phases

View file

@ -0,0 +1,97 @@
Fix test failure with Qt 5.12.
Taken from upstream:
https://cgit.kde.org/kwindowsystem.git/commit/?id=14998613603c7d8f91b011a2c9c20396067add0e
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index f8e67f0..c1121a7 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -12,12 +12,12 @@ add_subdirectory(helper)
if (NOT APPLE)
find_package(X11)
- find_package(XCB COMPONENTS XCB KEYSYMS)
+ find_package(XCB COMPONENTS XCB ICCCM KEYSYMS)
endif()
macro(KWINDOWSYSTEM_UNIT_TESTS)
foreach(_testname ${ARGN})
- set(libs KF5::WindowSystem Qt5::Test Qt5::Widgets Qt5::X11Extras XCB::KEYSYMS)
+ set(libs KF5::WindowSystem Qt5::Test Qt5::Widgets Qt5::X11Extras XCB::ICCCM XCB::KEYSYMS)
if(X11_FOUND)
list(APPEND libs ${XCB_XCB_LIBRARY})
endif()
diff --git a/autotests/kwindowinfox11test.cpp b/autotests/kwindowinfox11test.cpp
index 634c650..f483c46 100644
--- a/autotests/kwindowinfox11test.cpp
+++ b/autotests/kwindowinfox11test.cpp
@@ -25,8 +25,11 @@
#include <qtest_widgets.h>
#include <QScreen>
#include <QSignalSpy>
+#include <QSysInfo>
#include <QX11Info>
+#include <xcb/xcb_icccm.h>
+
#include <unistd.h>
Q_DECLARE_METATYPE(WId)
@@ -598,19 +601,23 @@ void KWindowInfoX11Test::testWindowRole()
void KWindowInfoX11Test::testClientMachine()
{
+ const QByteArray oldHostName = QSysInfo::machineHostName().toLocal8Bit();
+
KWindowInfo info(window->winId(), NET::Properties(), NET::WM2ClientMachine);
- QVERIFY(info.clientMachine().isNull());
+ QCOMPARE(info.clientMachine(), oldHostName);
// client machine needs to be set through xcb
+ const QByteArray newHostName = oldHostName + "2";
xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, window->winId(),
- XCB_ATOM_WM_CLIENT_MACHINE, XCB_ATOM_STRING, 8, 9, "localhost");
+ XCB_ATOM_WM_CLIENT_MACHINE, XCB_ATOM_STRING, 8, newHostName.count(),
+ newHostName.data());
xcb_flush(QX11Info::connection());
// it's just a property change so we can easily refresh
QX11Info::getTimestamp();
KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2ClientMachine);
- QCOMPARE(info2.clientMachine(), QByteArrayLiteral("localhost"));
+ QCOMPARE(info2.clientMachine(), newHostName);
}
void KWindowInfoX11Test::testName()
@@ -680,11 +687,25 @@ void KWindowInfoX11Test::testTransientFor()
void KWindowInfoX11Test::testGroupLeader()
{
- KWindowInfo info(window->winId(), NET::Properties(), NET::WM2GroupLeader);
- QCOMPARE(info.groupLeader(), WId(0));
+ // WM_CLIENT_LEADER is set by default
+ KWindowInfo info1(window->winId(), NET::Properties(), NET::WM2GroupLeader);
+ QVERIFY(info1.groupLeader() != XCB_WINDOW_NONE);
+
+ xcb_connection_t *connection = QX11Info::connection();
+ xcb_window_t rootWindow = QX11Info::appRootWindow();
+
+ xcb_window_t leader = xcb_generate_id(connection);
+ xcb_create_window(connection, XCB_COPY_FROM_PARENT, leader, rootWindow, 0, 0, 1, 1,
+ 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr);
+
+ xcb_icccm_wm_hints_t hints = {};
+ hints.flags = XCB_ICCCM_WM_HINT_WINDOW_GROUP;
+ hints.window_group = leader;
+ xcb_icccm_set_wm_hints(connection, leader, &hints);
+ xcb_icccm_set_wm_hints(connection, window->winId(), &hints);
- // TODO: here we should try to set a group leader and re-read it
- // this needs setting and parsing the WMHints
+ KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2GroupLeader);
+ QCOMPARE(info2.groupLeader(), leader);
}
void KWindowInfoX11Test::testExtendedStrut()