Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:upgrade to 5.103 #1

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.16)

set(KF_VERSION "5.90.0") # handled by release scripts
set(KF_VERSION "5.103.0") # handled by release scripts
project(KWindowSystem VERSION ${KF_VERSION})

# ECM setup
include(FeatureSummary)
find_package(ECM 5.90.0 NO_MODULE)
find_package(ECM 5.103.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)

Expand All @@ -22,7 +22,7 @@ include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(CMakeFindFrameworks)
include(ECMQtDeclareLoggingCategory)

include(ECMDeprecationSettings)
include(ECMAddQch)
include(ECMPoQmTools)

Expand Down Expand Up @@ -58,7 +58,7 @@ if (APPLE)
cmake_find_frameworks(CoreFoundation)
endif()

if(WIN32)
if(WIN32 AND QT_MAJOR_VERSION EQUAL "5")
find_package(Qt5WinExtras REQUIRED)
endif()

Expand All @@ -80,9 +80,11 @@ if(X11_FOUND)
endif()

# Subdirectories
ecm_install_po_files_as_qm(po)
ecm_install_po_files_as_qm(poqm)

add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f02)
ecm_set_disabled_deprecation_versions(
QT 5.15.2
)

add_subdirectory(src)
if (BUILD_TESTING)
Expand Down Expand Up @@ -117,7 +119,7 @@ install(EXPORT KF5WindowSystemTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" F


install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kwindowsystem_version.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF} COMPONENT Devel )
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KWindowSystem COMPONENT Devel )

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

Expand Down
10 changes: 6 additions & 4 deletions autotests/compositingenabled_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <QTest>
#include <kmanagerselection.h>

#include "kx11extras.h"

class CompositingEnabledTest : public QObject
{
Q_OBJECT
Expand All @@ -18,23 +20,23 @@ private Q_SLOTS:
void CompositingEnabledTest::testRecreatingNetEventFilter()
{
// this test simulates the condition that the compositor gets enabled while the NetEventFilter gets recreated
QVERIFY(!KWindowSystem::compositingActive());
QVERIFY(!KX11Extras::compositingActive());

// fake the compositor
QSignalSpy compositingChangedSpy(KWindowSystem::self(), &KWindowSystem::compositingChanged);
QSignalSpy compositingChangedSpy(KX11Extras::self(), &KX11Extras::compositingChanged);
QVERIFY(compositingChangedSpy.isValid());
KSelectionOwner compositorSelection("_NET_WM_CM_S0");
QSignalSpy claimedSpy(&compositorSelection, &KSelectionOwner::claimedOwnership);
QVERIFY(claimedSpy.isValid());
compositorSelection.claim(true);
connect(&compositorSelection, &KSelectionOwner::claimedOwnership, [] {
// let's connect to a signal which will cause a re-creation of NetEventFilter
QSignalSpy workAreaChangedSpy(KWindowSystem::self(), &KWindowSystem::workAreaChanged);
QSignalSpy workAreaChangedSpy(KX11Extras::self(), &KX11Extras::workAreaChanged);
QVERIFY(workAreaChangedSpy.isValid());
});

QVERIFY(claimedSpy.wait());
QTRY_VERIFY(KWindowSystem::compositingActive());
QTRY_VERIFY(KX11Extras::compositingActive());
QCOMPARE(compositingChangedSpy.count(), 1);
}

Expand Down
23 changes: 12 additions & 11 deletions autotests/kmanagerselectiontest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include "kmanagerselectiontest.h"
#include "cptr_p.h"

#include <QSignalSpy>
#include <kselectionowner.h>
Expand All @@ -28,15 +29,15 @@ void KManagerSelectionTest::xSync()
xcb_connection_t *c = QX11Info::connection();
const xcb_get_input_focus_cookie_t cookie = xcb_get_input_focus(c);
xcb_generic_error_t *error = nullptr;
QScopedPointer<xcb_get_input_focus_reply_t, QScopedPointerPodDeleter> sync(xcb_get_input_focus_reply(c, cookie, &error));
UniqueCPointer<xcb_get_input_focus_reply_t> sync(xcb_get_input_focus_reply(c, cookie, &error));
if (error) {
free(error);
}
}

void KManagerSelectionTest::claim(KSelectionOwner *owner, bool force, bool forceKill)
{
QSignalSpy claimSpy(owner, SIGNAL(claimedOwnership()));
QSignalSpy claimSpy(owner, &KSelectionOwner::claimedOwnership);
owner->claim(force, forceKill);
xSync();
QVERIFY(claimSpy.wait());
Expand All @@ -53,7 +54,7 @@ void KManagerSelectionTest::testAcquireRelease()
SigCheckWatcher sw(watcher);
SigCheckOwner so(owner);
claim(&owner);
QSignalSpy newOwnerSpy(&watcher, SIGNAL(newOwner(xcb_window_t)));
QSignalSpy newOwnerSpy(&watcher, &KSelectionWatcher::newOwner);
QVERIFY(newOwnerSpy.wait());
QVERIFY(sw.newowner == true);
QVERIFY(sw.lostowner == false);
Expand All @@ -69,7 +70,7 @@ void KManagerSelectionTest::testInitiallyOwned()
KSelectionWatcher watcher(SNAME);
SigCheckWatcher sw(watcher);
owner.release();
QSignalSpy lostOwnerSpy(&watcher, SIGNAL(lostOwner()));
QSignalSpy lostOwnerSpy(&watcher, &KSelectionWatcher::lostOwner);
QVERIFY(lostOwnerSpy.wait(2000));
QVERIFY(sw.newowner == false);
QVERIFY(sw.lostowner == true);
Expand All @@ -83,14 +84,14 @@ void KManagerSelectionTest::testLostOwnership()
KSelectionOwner owner2(SNAME);
claim(&owner1);

QSignalSpy claimSpy(&owner2, SIGNAL(failedToClaimOwnership()));
QSignalSpy claimSpy(&owner2, &KSelectionOwner::failedToClaimOwnership);
owner2.claim(false);
claimSpy.wait();
QCOMPARE(claimSpy.count(), 1);
claim(&owner2, true, false);

QEXPECT_FAIL("", "selectionClear event is not sent to the same X client", Abort);
QSignalSpy lostOwnershipSpy(&owner1, SIGNAL(lostOwnership()));
QSignalSpy lostOwnershipSpy(&owner1, &KSelectionOwner::lostOwnership);
QVERIFY(lostOwnershipSpy.wait());
QVERIFY(owner1.ownerWindow() == XCB_WINDOW_NONE);
QVERIFY(owner2.ownerWindow() != XCB_WINDOW_NONE);
Expand All @@ -103,7 +104,7 @@ void KManagerSelectionTest::testWatching()
KSelectionOwner owner1(SNAME);
KSelectionOwner owner2(SNAME);
SigCheckWatcher sw(watcher);
QSignalSpy newOwnerSpy(&watcher, SIGNAL(newOwner(xcb_window_t)));
QSignalSpy newOwnerSpy(&watcher, &KSelectionWatcher::newOwner);
QVERIFY(newOwnerSpy.isValid());
claim(&owner1);
if (newOwnerSpy.isEmpty()) {
Expand All @@ -124,7 +125,7 @@ void KManagerSelectionTest::testWatching()
QVERIFY(sw.newowner == true);
QVERIFY(sw.lostowner == false);
sw.newowner = sw.lostowner = false;
QSignalSpy lostOwnerSpy(&watcher, SIGNAL(lostOwner()));
QSignalSpy lostOwnerSpy(&watcher, &KSelectionWatcher::lostOwner);
owner2.release();
xSync();
QVERIFY(lostOwnerSpy.wait());
Expand All @@ -140,7 +141,7 @@ void KManagerSelectionTest::testWatching()
SigCheckOwner::SigCheckOwner(const KSelectionOwner &owner)
: lostownership(false)
{
connect(&owner, SIGNAL(lostOwnership()), this, SLOT(lostOwnership()));
connect(&owner, &KSelectionOwner::lostOwnership, this, &SigCheckOwner::lostOwnership);
}

void SigCheckOwner::lostOwnership()
Expand All @@ -152,8 +153,8 @@ SigCheckWatcher::SigCheckWatcher(const KSelectionWatcher &watcher)
: newowner(false)
, lostowner(false)
{
connect(&watcher, SIGNAL(newOwner(xcb_window_t)), this, SLOT(newOwner()));
connect(&watcher, SIGNAL(lostOwner()), this, SLOT(lostOwner()));
connect(&watcher, &KSelectionWatcher::newOwner, this, &SigCheckWatcher::newOwner);
connect(&watcher, &KSelectionWatcher::lostOwner, this, &SigCheckWatcher::lostOwner);
}

void SigCheckWatcher::newOwner()
Expand Down
14 changes: 9 additions & 5 deletions autotests/kstartupinfo_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include <xcb/xcb.h>

#include "cptr_p.h"

Q_DECLARE_METATYPE(KStartupInfoId)
Q_DECLARE_METATYPE(KStartupInfoData)

Expand All @@ -33,7 +35,7 @@ class KStartupInfo_UnitTest : public QObject
{
qRegisterMetaType<KStartupInfoId>();
qRegisterMetaType<KStartupInfoData>();
connect(&m_listener, SIGNAL(gotNewStartup(KStartupInfoId, KStartupInfoData)), this, SLOT(slotNewStartup(KStartupInfoId, KStartupInfoData)));
connect(&m_listener, &KStartupInfo::gotNewStartup, this, &KStartupInfo_UnitTest::slotNewStartup);
}

protected Q_SLOTS:
Expand Down Expand Up @@ -85,13 +87,13 @@ void KStartupInfo_UnitTest::testStart()
const QString bin = "dir with space/kstartupinfo_unittest";
data.setBin(bin);

QSignalSpy removedSpy(&m_listener, SIGNAL(gotRemoveStartup(KStartupInfoId, KStartupInfoData)));
QSignalSpy removedSpy(&m_listener, &KStartupInfo::gotRemoveStartup);
QVERIFY(removedSpy.isValid());

KStartupInfo::sendStartup(id, data);
KStartupInfo::sendFinish(id, data);

QSignalSpy spy(this, SIGNAL(ready()));
QSignalSpy spy(this, &KStartupInfo_UnitTest::ready);
spy.wait(5000);

QCOMPARE(m_receivedCount, 1);
Expand All @@ -117,7 +119,7 @@ static void doSync()
auto *c = QX11Info::connection();
const auto cookie = xcb_get_input_focus(c);
xcb_generic_error_t *error = nullptr;
QScopedPointer<xcb_get_input_focus_reply_t, QScopedPointerPodDeleter> sync(xcb_get_input_focus_reply(c, cookie, &error));
UniqueCPointer<xcb_get_input_focus_reply_t> sync(xcb_get_input_focus_reply(c, cookie, &error));
if (error) {
free(error);
}
Expand Down Expand Up @@ -155,7 +157,7 @@ void KStartupInfo_UnitTest::dontCrashCleanup()
data.setSilent(KStartupInfoData::Yes);
}

QSignalSpy spy(&m_listener, SIGNAL(gotRemoveStartup(KStartupInfoId, KStartupInfoData)));
QSignalSpy spy(&m_listener, &KStartupInfo::gotRemoveStartup);
QFETCH(bool, change);
if (change) {
KStartupInfo::sendChange(id, data);
Expand Down Expand Up @@ -326,12 +328,14 @@ void KStartupInfo_UnitTest::createNewStartupIdForTimestampTest()

void KStartupInfo_UnitTest::setNewStartupIdTest()
{
#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 102)
{
QWindow window;
const QByteArray str = "somefancyidwhichisrandom_kstartupinfo_unittest_2";
KStartupInfo::setNewStartupId(&window, str);
QCOMPARE(KStartupInfo::startupId(), str);
}
#endif

#if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 62)
{
Expand Down
Loading