Remove Qt 5 specific code

This commit is contained in:
Vlad Zahorodnii 2023-02-25 22:21:59 +02:00
parent d9f5d432be
commit 10df3b0eb0
59 changed files with 57 additions and 738 deletions

View file

@ -46,14 +46,9 @@ find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
UiTools
Widgets
)
if (QT_MAJOR_VERSION EQUAL "5")
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS X11Extras)
find_package(Qt6XkbCommonSupport REQUIRED)
else()
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient ShaderTools)
if (Qt6WaylandClient_VERSION VERSION_LESS "6.4.1") # TODO Plasma 6: Drop once minimum Qt version is 6.4.1+
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient ShaderTools)
if (Qt6WaylandClient_VERSION VERSION_LESS "6.4.1") # TODO Plasma 6: Drop once minimum Qt version is 6.4.1+
include(Qt6WaylandClientMacrosKde)
endif()
endif()
find_package(Qt${QT_MAJOR_VERSION}Test ${QT_MIN_VERSION} CONFIG QUIET)
@ -210,14 +205,6 @@ set_package_properties(PlasmaWaylandProtocols PROPERTIES
URL "https://invent.kde.org/libraries/plasma-wayland-protocols/"
)
if (QT_MAJOR_VERSION EQUAL "5")
find_package(QtWaylandScanner)
set_package_properties(QtWaylandScanner PROPERTIES
TYPE REQUIRED
PURPOSE "Required for building KWin with Wayland support"
)
endif()
find_package(XKB 0.7.0)
set_package_properties(XKB PROPERTIES
TYPE REQUIRED
@ -313,14 +300,6 @@ set_package_properties(X11_XCB PROPERTIES
TYPE OPTIONAL
)
# dependencies for QPA plugin
if (QT_MAJOR_VERSION EQUAL "5")
find_package(Qt6FontDatabaseSupport REQUIRED)
find_package(Qt6ThemeSupport REQUIRED)
find_package(Qt6ServiceSupport REQUIRED)
find_package(Qt6EventDispatcherSupport REQUIRED)
endif()
find_package(Freetype)
set_package_properties(Freetype PROPERTIES
DESCRIPTION "A font rendering engine"

View file

@ -51,6 +51,7 @@ set_target_properties(testClientMachine PROPERTIES COMPILE_DEFINITIONS "NO_NONE_
target_link_libraries(testClientMachine
Qt::Concurrent
Qt::GuiPrivate
Qt::Test
Qt::Widgets
@ -62,11 +63,6 @@ target_link_libraries(testClientMachine
${X11_X11_LIB} # to make jenkins happy
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(testClientMachine Qt::X11Extras)
else()
target_link_libraries(testClientMachine Qt::GuiPrivate)
endif()
add_test(NAME kwin-testClientMachine COMMAND testClientMachine)
ecm_mark_as_test(testClientMachine)
@ -76,6 +72,7 @@ ecm_mark_as_test(testClientMachine)
add_executable(testXcbWrapper test_xcb_wrapper.cpp xcb_scaling_mock.cpp)
target_link_libraries(testXcbWrapper
Qt::GuiPrivate
Qt::Test
Qt::Widgets
@ -84,11 +81,6 @@ target_link_libraries(testXcbWrapper
XCB::XCB
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(testXcbWrapper Qt::X11Extras)
else()
target_link_libraries(testXcbWrapper Qt::GuiPrivate)
endif()
add_test(NAME kwin-testXcbWrapper COMMAND testXcbWrapper)
ecm_mark_as_test(testXcbWrapper)
@ -96,6 +88,7 @@ if (XCB_ICCCM_FOUND)
add_executable(testXcbSizeHints test_xcb_size_hints.cpp xcb_scaling_mock.cpp)
set_target_properties(testXcbSizeHints PROPERTIES COMPILE_DEFINITIONS "NO_NONE_WINDOW")
target_link_libraries(testXcbSizeHints
Qt::GuiPrivate
Qt::Test
Qt::Widgets
@ -105,11 +98,6 @@ if (XCB_ICCCM_FOUND)
XCB::ICCCM
XCB::XCB
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(testXcbSizeHints Qt::X11Extras)
else()
target_link_libraries(testXcbSizeHints Qt::GuiPrivate)
endif()
add_test(NAME kwin-testXcbSizeHints COMMAND testXcbSizeHints)
ecm_mark_as_test(testXcbSizeHints)
endif()
@ -120,6 +108,7 @@ endif()
add_executable(testXcbWindow test_xcb_window.cpp xcb_scaling_mock.cpp)
target_link_libraries(testXcbWindow
Qt::GuiPrivate
Qt::Test
Qt::Widgets
@ -128,11 +117,6 @@ target_link_libraries(testXcbWindow
XCB::XCB
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(testXcbWindow Qt::X11Extras)
else()
target_link_libraries(testXcbWindow Qt::GuiPrivate)
endif()
add_test(NAME kwin-testXcbWindow COMMAND testXcbWindow)
ecm_mark_as_test(testXcbWindow)
@ -213,6 +197,7 @@ target_link_libraries(testXkb
kwin
Qt::Gui
Qt::GuiPrivate
Qt::Test
Qt::Widgets
@ -223,11 +208,6 @@ target_link_libraries(testXkb
XKB::XKB
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(testXkb Qt6::XkbCommonSupportPrivate)
else()
target_link_libraries(testXkb Qt::GuiPrivate)
endif()
add_test(NAME kwin-testXkb COMMAND testXkb)
ecm_mark_as_test(testXkb)

View file

@ -1,50 +1,13 @@
add_subdirectory(helper)
add_library(KWinIntegrationTestFramework SHARED)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml
BASENAME input-method-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v3.xml
BASENAME text-input-unstable-v3
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework
PROTOCOL protocols/wlr-layer-shell-unstable-v1.xml
BASENAME wlr-layer-shell-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework
PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
BASENAME xdg-shell
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
BASENAME xdg-decoration-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml
BASENAME idle-inhibit-unstable-v1
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-device-v2.xml
BASENAME kde-output-device-v2
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-management-v2.xml
BASENAME kde-output-management-v2
)
ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework
PROTOCOL ${WaylandProtocols_DATADIR}/staging/fractional-scale/fractional-scale-v1.xml
BASENAME fractional-scale-v1
)
else()
qt6_generate_wayland_protocol_client_sources(KWinIntegrationTestFramework
qt6_generate_wayland_protocol_client_sources(KWinIntegrationTestFramework
NO_INCLUDE_CORE_ONLY
FILES
${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml
)
qt6_generate_wayland_protocol_client_sources(KWinIntegrationTestFramework
)
qt6_generate_wayland_protocol_client_sources(KWinIntegrationTestFramework
FILES
${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v3.xml
${CMAKE_CURRENT_SOURCE_DIR}/protocols/wlr-layer-shell-unstable-v1.xml
@ -54,8 +17,7 @@ else()
${WaylandProtocols_DATADIR}/staging/fractional-scale/fractional-scale-v1.xml
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-device-v2.xml
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-management-v2.xml
)
endif()
)
target_sources(KWinIntegrationTestFramework PRIVATE
../../src/cursor.cpp

View file

@ -102,23 +102,17 @@ void GlobalShortcutsTest::testNonLatinLayout_data()
QTest::newRow("Left Ctrl + Tab") << KEY_LEFTCTRL << Qt::CTRL << KEY_TAB << Qt::Key_Tab;
QTest::newRow("Left Ctrl + W") << KEY_LEFTCTRL << Qt::CTRL << KEY_W << Qt::Key_W;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QTest::newRow("Left Ctrl + `") << KEY_LEFTCTRL << Qt::CTRL << KEY_GRAVE << Qt::Key_QuoteLeft;
#endif
QTest::newRow("Left Alt + Tab") << KEY_LEFTALT << Qt::ALT << KEY_TAB << Qt::Key_Tab;
QTest::newRow("Left Alt + W") << KEY_LEFTALT << Qt::ALT << KEY_W << Qt::Key_W;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QTest::newRow("Left Alt + `") << KEY_LEFTALT << Qt::ALT << KEY_GRAVE << Qt::Key_QuoteLeft;
#endif
QTest::newRow("Left Shift + Tab") << KEY_LEFTSHIFT << Qt::SHIFT << KEY_TAB << Qt::Key_Tab;
QTest::newRow("Left Meta + Tab") << KEY_LEFTMETA << Qt::META << KEY_TAB << Qt::Key_Tab;
QTest::newRow("Left Meta + W") << KEY_LEFTMETA << Qt::META << KEY_W << Qt::Key_W;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QTest::newRow("Left Meta + `") << KEY_LEFTMETA << Qt::META << KEY_GRAVE << Qt::Key_QuoteLeft;
#endif
}
void GlobalShortcutsTest::testNonLatinLayout()
@ -403,13 +397,6 @@ void GlobalShortcutsTest::testSetupWindowShortcut()
QVERIFY(dialog->isInternal());
auto sequenceEdit = workspace()->shortcutDialog()->findChild<QKeySequenceEdit *>();
QVERIFY(sequenceEdit);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// the QKeySequenceEdit field does not get focus, we need to pass it focus manually
QEXPECT_FAIL("", "Edit does not have focus", Continue);
QVERIFY(sequenceEdit->hasFocus());
sequenceEdit->setFocus();
#endif
QTRY_VERIFY(sequenceEdit->hasFocus());
quint32 timestamp = 0;

View file

@ -17,7 +17,4 @@ kwineffects_unit_tests(
add_executable(kwinglplatformtest kwinglplatformtest.cpp mock_gl.cpp ../../src/libkwineffects/kwinglplatform.cpp)
add_test(NAME kwineffects-kwinglplatformtest COMMAND kwinglplatformtest)
target_link_libraries(kwinglplatformtest Qt::Test Qt::Gui KF6::ConfigCore XCB::XCB)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(kwinglplatformtest Qt::X11Extras)
endif()
ecm_mark_as_test(kwinglplatformtest)

View file

@ -31,9 +31,6 @@ target_link_libraries(testTabBoxClientModel
XCB::XCB
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(testTabBoxClientModel Qt::X11Extras)
endif()
add_test(NAME kwin-testTabBoxClientModel COMMAND testTabBoxClientModel)
ecm_mark_as_test(testTabBoxClientModel)
@ -68,9 +65,6 @@ target_link_libraries(testTabBoxHandler
XCB::XCB
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(testTabBoxHandler Qt::X11Extras)
endif()
add_test(NAME kwin-testTabBoxHandler COMMAND testTabBoxHandler)
ecm_mark_as_test(testTabBoxHandler)

View file

@ -12,11 +12,8 @@
#include "mock_tabboxhandler.h"
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
using namespace KWin;
void TestTabBoxClientModel::initTestCase()

View file

@ -10,11 +10,7 @@
#include "clientmodel.h"
#include "mock_tabboxhandler.h"
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
using namespace KWin;

View file

@ -13,11 +13,7 @@
// Qt
#include <QApplication>
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
// xcb
#include <xcb/xcb.h>
// system

View file

@ -8,11 +8,7 @@
*/
#include <QTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#include "main.h"
#include "utils/common.h"

View file

@ -12,11 +12,7 @@
// Qt
#include <QApplication>
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#include <netwm.h>
// xcb
#include <xcb/xcb.h>

View file

@ -12,11 +12,7 @@
// Qt
#include <QApplication>
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
// xcb
#include <xcb/xcb.h>

View file

@ -12,11 +12,7 @@
// Qt
#include <QApplication>
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#include <netwm.h>
// xcb
#include <xcb/xcb.h>

View file

@ -133,13 +133,8 @@ static const TransKey g_rgQtToSymX[] = {
{XKB_KEY_XF86AudioNext, Qt::Key_MediaNext, Qt::KeyboardModifiers()},
{XKB_KEY_XF86AudioRecord, Qt::Key_MediaRecord, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Mail, Qt::Key_LaunchMail, Qt::KeyboardModifiers()},
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
{XKB_KEY_XF86MyComputer, Qt::Key_LaunchMedia, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Calculater, Qt::Key_Calculator, Qt::KeyboardModifiers()},
#else
{XKB_KEY_XF86MyComputer, Qt::Key_Launch0, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Calculator, Qt::Key_Launch1, Qt::KeyboardModifiers()},
#endif
{XKB_KEY_XF86Memo, Qt::Key_Memo, Qt::KeyboardModifiers()},
{XKB_KEY_XF86ToDoList, Qt::Key_ToDoList, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Calendar, Qt::Key_Calendar, Qt::KeyboardModifiers()},
@ -241,7 +236,6 @@ static const TransKey g_rgQtToSymX[] = {
{XKB_KEY_XF86TouchpadOn, Qt::Key_TouchpadOn, Qt::KeyboardModifiers()},
{XKB_KEY_XF86TouchpadOff, Qt::Key_TouchpadOff, Qt::KeyboardModifiers()},
{XKB_KEY_XF86AudioMicMute, Qt::Key_MicMute, Qt::KeyboardModifiers()},
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
{XKB_KEY_XF86Launch0, Qt::Key_Launch0, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch1, Qt::Key_Launch1, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch2, Qt::Key_Launch2, Qt::KeyboardModifiers()},
@ -258,22 +252,6 @@ static const TransKey g_rgQtToSymX[] = {
{XKB_KEY_XF86LaunchD, Qt::Key_LaunchD, Qt::KeyboardModifiers()},
{XKB_KEY_XF86LaunchE, Qt::Key_LaunchE, Qt::KeyboardModifiers()},
{XKB_KEY_XF86LaunchF, Qt::Key_LaunchF, Qt::KeyboardModifiers()},
#else
{XKB_KEY_XF86Launch0, Qt::Key_Launch2, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch1, Qt::Key_Launch3, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch2, Qt::Key_Launch4, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch3, Qt::Key_Launch5, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch4, Qt::Key_Launch6, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch5, Qt::Key_Launch7, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch6, Qt::Key_Launch8, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch7, Qt::Key_Launch9, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch8, Qt::Key_LaunchA, Qt::KeyboardModifiers()},
{XKB_KEY_XF86Launch9, Qt::Key_LaunchB, Qt::KeyboardModifiers()},
{XKB_KEY_XF86LaunchA, Qt::Key_LaunchC, Qt::KeyboardModifiers()},
{XKB_KEY_XF86LaunchB, Qt::Key_LaunchD, Qt::KeyboardModifiers()},
{XKB_KEY_XF86LaunchC, Qt::Key_LaunchE, Qt::KeyboardModifiers()},
{XKB_KEY_XF86LaunchD, Qt::Key_LaunchF, Qt::KeyboardModifiers()},
#endif
// Latin-1
{XKB_KEY_exclam, Qt::Key_Exclam, Qt::KeyboardModifiers()},

View file

@ -227,9 +227,6 @@ target_link_libraries(kwin
Wayland::Server
lcms2::lcms2
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(kwin Qt6::X11Extras Qt6::XkbCommonSupportPrivate)
endif()
if (KWIN_BUILD_NOTIFICATIONS)
target_link_libraries(kwin KF6::Notifications)

View file

@ -19,9 +19,6 @@ set(X11PLATFORM_SOURCES
add_library(KWinX11Platform OBJECT ${X11PLATFORM_SOURCES})
target_link_libraries(KWinX11Platform kwin KF6::Crash X11::X11 XCB::XKB PkgConfig::XKBX11)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(KWinX11Platform Qt::X11Extras)
endif()
if (X11_Xi_FOUND)
target_sources(KWinX11Platform PRIVATE x11_standalone_xinputintegration.cpp)
target_link_libraries(KWinX11Platform X11::Xi)

View file

@ -45,11 +45,7 @@
#include <QOpenGLContext>
#include <QThread>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#include <span>

View file

@ -10,11 +10,7 @@
#include <QDebug>
#include <QKeyEvent>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
#else
#include <QtGui/private/qxkbcommon_p.h>
#endif
namespace KWin
{

View file

@ -20,9 +20,6 @@
#include "x11_standalone_overlaywindow.h"
#include <QOpenGLContext>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtPlatformHeaders/QEGLNativeContext>
#endif
#include <drm_fourcc.h>
namespace KWin
@ -97,17 +94,6 @@ void EglBackend::init()
EGLContext shareContext = EGL_NO_CONTEXT;
if (qtShareContext) {
qDebug(KWIN_X11STANDALONE) << "Global share context format:" << qtShareContext->format();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const QVariant nativeHandle = qtShareContext->nativeHandle();
if (!nativeHandle.canConvert<QEGLNativeContext>()) {
setFailed(QStringLiteral("Invalid QOpenGLContext::globalShareContext()"));
return;
} else {
QEGLNativeContext handle = qvariant_cast<QEGLNativeContext>(nativeHandle);
shareContext = handle.context();
shareDisplay = handle.display();
}
#else
const auto nativeHandle = qtShareContext->nativeInterface<QNativeInterface::QEGLContext>();
if (nativeHandle) {
shareContext = nativeHandle->nativeContext();
@ -116,7 +102,6 @@ void EglBackend::init()
setFailed(QStringLiteral("Invalid QOpenGLContext::globalShareContext()"));
return;
}
#endif
}
if (shareContext == EGL_NO_CONTEXT) {
setFailed(QStringLiteral("QOpenGLContext::globalShareContext() is required"));

View file

@ -39,14 +39,7 @@
// Qt
#include <QDebug>
#include <QOpenGLContext>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtPlatformHeaders/QGLXNativeContext>
#endif
// system
#include <unistd.h>
@ -350,16 +343,6 @@ bool GlxBackend::initRenderingContext()
GLXContext globalShareContext = nullptr;
if (qtGlobalShareContext) {
qDebug(KWIN_X11STANDALONE) << "Global share context format:" << qtGlobalShareContext->format();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const QVariant nativeHandle = qtGlobalShareContext->nativeHandle();
if (!nativeHandle.canConvert<QGLXNativeContext>()) {
qCDebug(KWIN_X11STANDALONE) << "Invalid QOpenGLContext::globalShareContext()";
return false;
} else {
QGLXNativeContext handle = qvariant_cast<QGLXNativeContext>(nativeHandle);
globalShareContext = handle.context();
}
#else
const auto nativeHandle = qtGlobalShareContext->nativeInterface<QNativeInterface::QGLXContext>();
if (nativeHandle) {
globalShareContext = nativeHandle->nativeContext();
@ -367,7 +350,6 @@ bool GlxBackend::initRenderingContext()
qCDebug(KWIN_X11STANDALONE) << "Invalid QOpenGLContext::globalShareContext()";
return false;
}
#endif
}
if (!globalShareContext) {
qCWarning(KWIN_X11STANDALONE) << "QOpenGLContext::globalShareContext() is required";

View file

@ -8,11 +8,7 @@
#include "x11_standalone_glxconvenience.h"
#include "x11_standalone_logging.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
namespace KWin
{

View file

@ -8,11 +8,7 @@
#include "x11_standalone_glxconvenience.h"
#include "x11_standalone_logging.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
namespace KWin
{

View file

@ -325,11 +325,7 @@ bool Compositor::setupStart()
if (!Workspace::self() && m_backend && m_backend->compositingType() == QPainterCompositing) {
// Force Software QtQuick on first startup with QPainter.
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
#else
QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
#endif
}
Q_EMIT sceneCreated();

View file

@ -163,11 +163,7 @@ void ScriptedEffectLoader::queryAndLoadAll()
m_queryConnection = QMetaObject::Connection();
},
Qt::QueuedConnection);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
watcher->setFuture(QtConcurrent::run(this, &ScriptedEffectLoader::findAllEffects));
#else
watcher->setFuture(QtConcurrent::run(&ScriptedEffectLoader::findAllEffects, this));
#endif
}
QList<KPluginMetaData> ScriptedEffectLoader::findAllEffects() const

View file

@ -331,18 +331,6 @@ bool MouseClickEffect::tabletToolEvent(QTabletEvent *event)
auto &tabletEvent = m_tabletTools[event->uniqueId()];
if (!tabletEvent.m_color.isValid()) {
switch (event->pointerType()) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
case QTabletEvent::UnknownPointer:
case QTabletEvent::Pen:
tabletEvent.m_color = MouseClickConfig::color1();
break;
case QTabletEvent::Eraser:
tabletEvent.m_color = MouseClickConfig::color2();
break;
case QTabletEvent::Cursor:
tabletEvent.m_color = MouseClickConfig::color3();
break;
#else
case QPointingDevice::PointerType::Unknown:
case QPointingDevice::PointerType::Generic:
case QPointingDevice::PointerType::Finger:
@ -355,7 +343,6 @@ bool MouseClickEffect::tabletToolEvent(QTabletEvent *event)
case QPointingDevice::PointerType::Cursor:
tabletEvent.m_color = MouseClickConfig::color3();
break;
#endif
}
}
switch (event->type()) {

View file

@ -314,20 +314,12 @@ void ExpoLayout::removeCell(ExpoCell *cell)
polish();
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void ExpoLayout::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
#else
void ExpoLayout::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
#endif
{
if (newGeometry.size() != oldGeometry.size()) {
polish();
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QQuickItem::geometryChanged(newGeometry, oldGeometry);
#else
QQuickItem::geometryChange(newGeometry, oldGeometry);
#endif
}
static int distance(const QPoint &a, const QPoint &b)

View file

@ -50,11 +50,7 @@ public:
Q_INVOKABLE void forceLayout();
protected:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
#else
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
#endif
void updatePolish() override;
Q_SIGNALS:

View file

@ -8,12 +8,8 @@ target_link_libraries(kwin_killer_helper
KF6::AuthCore
KF6::I18n
KF6::WidgetsAddons
Qt::GuiPrivate
Qt::Widgets
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(kwin_killer_helper Qt::X11Extras)
else()
target_link_libraries(kwin_killer_helper Qt::GuiPrivate)
endif()
install(TARGETS kwin_killer_helper DESTINATION ${KDE_INSTALL_LIBEXECDIR})

View file

@ -12,11 +12,7 @@
#include <QCommandLineParser>
#include <QDebug>
#include <QProcess>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#include <xcb/xcb.h>
#include <cerrno>

View file

@ -64,7 +64,6 @@ SwitchEvent::SwitchEvent(State state, std::chrono::microseconds timestamp, Input
{
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
TabletEvent::TabletEvent(Type t, const QPointingDevice *dev, const QPointF &pos, const QPointF &globalPos,
qreal pressure, float xTilt, float yTilt,
float tangentialPressure, qreal rotation, float z,
@ -73,16 +72,5 @@ TabletEvent::TabletEvent(Type t, const QPointingDevice *dev, const QPointF &pos,
, m_id(tabletId)
{
}
#else
TabletEvent::TabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z,
Qt::KeyboardModifiers keyState, qint64 uniqueID,
Qt::MouseButton button, Qt::MouseButtons buttons, const TabletToolId &tabletId)
: QTabletEvent(t, pos, globalPos, device, pointerType, pressure, xTilt, yTilt, tangentialPressure, rotation, z, keyState, uniqueID, button, buttons)
, m_id(tabletId)
{
}
#endif
}

View file

@ -210,18 +210,10 @@ public:
class TabletEvent : public QTabletEvent
{
public:
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
TabletEvent(Type t, const QPointingDevice *dev, const QPointF &pos, const QPointF &globalPos,
qreal pressure, float xTilt, float yTilt,
float tangentialPressure, qreal rotation, float z,
Qt::KeyboardModifiers keyState, Qt::MouseButton button, Qt::MouseButtons buttons, const TabletToolId &tabletId);
#else
TabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z,
Qt::KeyboardModifiers keyState, qint64 uniqueID,
Qt::MouseButton button, Qt::MouseButtons buttons, const TabletToolId &tabletId);
#endif
const TabletToolId &tabletId() const
{

View file

@ -42,13 +42,11 @@ target_link_libraries(kwineffects
KF6::WindowSystem
XCB::XCB
PRIVATE
Qt::GuiPrivate
Qt::Quick
KF6::I18n
kwinglutils
)
if (QT_MAJOR_VERSION EQUAL "6")
target_link_libraries(kwineffects PRIVATE Qt::GuiPrivate)
endif()
set_target_properties(kwineffects PROPERTIES
VERSION ${KWINEFFECTS_VERSION}
SOVERSION ${KWINEFFECTS_SOVERSION}

View file

@ -26,12 +26,10 @@
#include <QOpenGLContext>
#include <QOpenGLFramebufferObject>
#include <QTimer>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QQuickGraphicsDevice>
#include <QQuickOpenGLUtils>
#include <QQuickRenderTarget>
#include <private/qeventpoint_p.h> // for QMutableEventPoint
#endif
namespace KWin
{
@ -83,14 +81,8 @@ public:
bool m_visible = true;
bool m_automaticRepaint = true;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QList<QTouchEvent::TouchPoint> touchPoints;
Qt::TouchPointStates touchState;
QTouchDevice *touchDevice;
#else
QList<QEventPoint> touchPoints;
QPointingDevice *touchDevice;
#endif
ulong lastMousePressTime = 0;
Qt::MouseButton lastMousePressButton = Qt::NoButton;
@ -147,11 +139,7 @@ OffscreenQuickView::OffscreenQuickView(QObject *parent, QWindow *renderWindow, E
if (!usingGl) {
qCDebug(LIBKWINEFFECTS) << "QtQuick Software rendering mode detected";
d->m_useBlit = true;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->m_renderControl->initialize(nullptr);
#else
d->m_renderControl->initialize();
#endif
} else {
QSurfaceFormat format;
format.setOption(QSurfaceFormat::ResetNotification);
@ -170,12 +158,8 @@ OffscreenQuickView::OffscreenQuickView(QObject *parent, QWindow *renderWindow, E
d->m_offscreenSurface->create();
d->m_glcontext->makeCurrent(d->m_offscreenSurface.get());
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->m_renderControl->initialize(d->m_glcontext.get());
#else
d->m_view->setGraphicsDevice(QQuickGraphicsDevice::fromOpenGLContext(d->m_glcontext.get()));
d->m_renderControl->initialize();
#endif
d->m_glcontext->doneCurrent();
// On Wayland, contexts are implicitly shared and QOpenGLContext::globalShareContext() is null.
@ -201,14 +185,7 @@ OffscreenQuickView::OffscreenQuickView(QObject *parent, QWindow *renderWindow, E
connect(d->m_renderControl.get(), &QQuickRenderControl::renderRequested, this, &OffscreenQuickView::handleRenderRequested);
connect(d->m_renderControl.get(), &QQuickRenderControl::sceneChanged, this, &OffscreenQuickView::handleSceneChanged);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->touchDevice = new QTouchDevice{};
d->touchDevice->setCapabilities(QTouchDevice::Position);
d->touchDevice->setType(QTouchDevice::TouchScreen);
d->touchDevice->setMaximumTouchPoints(10);
#else
d->touchDevice = new QPointingDevice({}, {}, QInputDevice::DeviceType::TouchScreen, {}, QInputDevice::Capability::Position, 10, {});
#endif
}
OffscreenQuickView::~OffscreenQuickView()
@ -283,37 +260,21 @@ void OffscreenQuickView::update()
return;
}
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->m_view->setRenderTarget(d->m_fbo.get());
#else
d->m_view->setRenderTarget(QQuickRenderTarget::fromOpenGLTexture(d->m_fbo->texture(), d->m_fbo->size()));
#endif
}
d->m_renderControl->polishItems();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
d->m_renderControl->beginFrame();
#endif
d->m_renderControl->sync();
d->m_renderControl->render();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
d->m_renderControl->endFrame();
#endif
if (usingGl) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->m_view->resetOpenGLState();
#else
QQuickOpenGLUtils::resetOpenGLState();
#endif
}
if (d->m_useBlit) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d->m_image = d->m_renderControl->grab();
#else
d->m_image = d->m_view->grabWindow();
#endif
}
if (usingGl) {
@ -389,11 +350,7 @@ bool OffscreenQuickView::forwardTouchDown(qint32 id, const QPointF &pos, std::ch
{
d->updateTouchState(Qt::TouchPointPressed, id, pos);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QTouchEvent event(QEvent::TouchBegin, d->touchDevice, Qt::NoModifier, d->touchState, d->touchPoints);
#else
QTouchEvent event(QEvent::TouchBegin, d->touchDevice, Qt::NoModifier, d->touchPoints);
#endif
event.setTimestamp(std::chrono::duration_cast<std::chrono::milliseconds>(time).count());
QCoreApplication::sendEvent(d->m_view.get(), &event);
@ -404,11 +361,7 @@ bool OffscreenQuickView::forwardTouchMotion(qint32 id, const QPointF &pos, std::
{
d->updateTouchState(Qt::TouchPointMoved, id, pos);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QTouchEvent event(QEvent::TouchUpdate, d->touchDevice, Qt::NoModifier, d->touchState, d->touchPoints);
#else
QTouchEvent event(QEvent::TouchUpdate, d->touchDevice, Qt::NoModifier, d->touchPoints);
#endif
event.setTimestamp(std::chrono::duration_cast<std::chrono::milliseconds>(time).count());
QCoreApplication::sendEvent(d->m_view.get(), &event);
@ -419,11 +372,7 @@ bool OffscreenQuickView::forwardTouchUp(qint32 id, std::chrono::microseconds tim
{
d->updateTouchState(Qt::TouchPointReleased, id, QPointF{});
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QTouchEvent event(QEvent::TouchEnd, d->touchDevice, Qt::NoModifier, d->touchState, d->touchPoints);
#else
QTouchEvent event(QEvent::TouchEnd, d->touchDevice, Qt::NoModifier, d->touchPoints);
#endif
event.setTimestamp(std::chrono::duration_cast<std::chrono::milliseconds>(time).count());
QCoreApplication::sendEvent(d->m_view.get(), &event);
@ -543,11 +492,7 @@ void OffscreenQuickView::Private::updateTouchState(Qt::TouchPointState state, qi
if (point.state() == Qt::TouchPointReleased) {
return true;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
point.setState(Qt::TouchPointStationary);
#else
QMutableEventPoint::setState(point, QEventPoint::Stationary);
#endif
return false;
}),
touchPoints.end());
@ -571,19 +516,11 @@ void OffscreenQuickView::Private::updateTouchState(Qt::TouchPointState state, qi
}
QTouchEvent::TouchPoint point;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
point.setState(Qt::TouchPointPressed);
point.setId(id + idOffset);
point.setScreenPos(pos);
point.setScenePos(m_view->mapFromGlobal(pos.toPoint()));
point.setPos(m_view->mapFromGlobal(pos.toPoint()));
#else
QMutableEventPoint::setState(point, QEventPoint::Pressed);
QMutableEventPoint::setId(point, id + idOffset);
QMutableEventPoint::setGlobalPosition(point, pos);
QMutableEventPoint::setScenePosition(point, m_view->mapFromGlobal(pos.toPoint()));
QMutableEventPoint::setPosition(point, m_view->mapFromGlobal(pos.toPoint()));
#endif
touchPoints.append(point);
} break;
@ -593,21 +530,11 @@ void OffscreenQuickView::Private::updateTouchState(Qt::TouchPointState state, qi
}
auto &point = *changed;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
point.setLastPos(point.pos());
point.setLastScenePos(point.scenePos());
point.setLastScreenPos(point.screenPos());
point.setState(Qt::TouchPointMoved);
point.setScenePos(m_view->mapFromGlobal(pos.toPoint()));
point.setPos(m_view->mapFromGlobal(pos.toPoint()));
point.setScreenPos(pos);
#else
QMutableEventPoint::setGlobalLastPosition(point, point.globalPosition());
QMutableEventPoint::setState(point, QEventPoint::Updated);
QMutableEventPoint::setScenePosition(point, m_view->mapFromGlobal(pos.toPoint()));
QMutableEventPoint::setPosition(point, m_view->mapFromGlobal(pos.toPoint()));
QMutableEventPoint::setGlobalPosition(point, pos);
#endif
} break;
case Qt::TouchPointReleased: {
if (changed == touchPoints.end()) {
@ -615,26 +542,12 @@ void OffscreenQuickView::Private::updateTouchState(Qt::TouchPointState state, qi
}
auto &point = *changed;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
point.setLastPos(point.pos());
point.setLastScreenPos(point.screenPos());
point.setState(Qt::TouchPointReleased);
#else
QMutableEventPoint::setGlobalLastPosition(point, point.globalPosition());
QMutableEventPoint::setState(point, QEventPoint::Released);
#endif
} break;
default:
break;
}
// The touch state value is used in QTouchEvent and includes all the states
// that the current touch points are in.
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
touchState = std::accumulate(touchPoints.begin(), touchPoints.end(), Qt::TouchPointStates{}, [](auto init, const auto &point) {
return init | point.state();
});
#endif
}
OffscreenQuickScene::OffscreenQuickScene(QObject *parent)

View file

@ -48,12 +48,7 @@
#include <QStandardPaths>
#include <QTranslator>
#include <qplatformdefs.h>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#include <cerrno>
@ -596,11 +591,7 @@ void Application::updateX11Time(xcb_generic_event_t *event)
setX11Time(time);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
bool XcbEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long int *result)
#else
bool XcbEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
#endif
{
if (eventType == "xcb_generic_event_t") {
return kwinApp()->dispatchEvent(static_cast<xcb_generic_event_t *>(message));

View file

@ -46,11 +46,7 @@ class Window;
class XcbEventFilter : public QAbstractNativeEventFilter
{
public:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
bool nativeEventFilter(const QByteArray &eventType, void *message, long int *result) override;
#else
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
#endif
};
class X11EventFilterContainer : public QObject

View file

@ -40,11 +40,7 @@
#include <QSurfaceFormat>
#include <QVBoxLayout>
#include <qplatformdefs.h>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#include <QtDBus>
// system

View file

@ -769,14 +769,6 @@ void ConfigurationModule::initQml()
}
KPluginMetaData metaData(packageRoot + QLatin1String("/metadata.json"));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (!metaData.isValid()) {
metaData = KPluginMetaData::fromDesktopFile(packageRoot + QLatin1String("/metadata.desktop"));
if (metaData.isValid()) {
qWarning("metadata.desktop format is obsolete. Please convert %s to JSON metadata", qPrintable(metaData.fileName()));
}
}
#endif
if (!metaData.isValid()) {
return;
}

View file

@ -28,11 +28,3 @@ target_link_libraries(KWinQpaPlugin PRIVATE
Fontconfig::Fontconfig
kwin
)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(KWinQpaPlugin PRIVATE
Qt::FontDatabaseSupportPrivate
Qt::ThemeSupportPrivate
Qt::EventDispatcherSupportPrivate
Qt::ServiceSupportPrivate
)
endif()

View file

@ -28,16 +28,10 @@
#include <qpa/qplatformwindow.h>
#include <qpa/qwindowsysteminterface.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtEventDispatcherSupport/private/qunixeventdispatcher_qpa_p.h>
#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
#include <QtThemeSupport/private/qgenericunixthemes_p.h>
#else
#include <QtGui/private/qgenericunixeventdispatcher_p.h>
#include <QtGui/private/qgenericunixfontdatabase_p.h>
#include <QtGui/private/qgenericunixthemes_p.h>
#include <QtGui/private/qunixeventdispatcher_qpa_p.h>
#endif
namespace KWin
{

View file

@ -12,11 +12,7 @@
#include <epoxy/egl.h>
#include <QObject>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtServiceSupport/private/qgenericunixservices_p.h>
#else
#include <QtGui/private/qgenericunixservices_p.h>
#endif
#include <qpa/qplatformintegration.h>
namespace KWin

View file

@ -71,14 +71,6 @@ void GenericScriptedConfig::createUi()
}
KPluginMetaData metaData(packageRoot + QLatin1String("/metadata.json"));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (!metaData.isValid()) {
metaData = KPluginMetaData::fromDesktopFile(packageRoot + QLatin1String("/metadata.desktop"));
if (metaData.isValid()) {
qWarning("metadata.desktop format is obsolete. Please convert %s to JSON metadata", qPrintable(metaData.fileName()));
}
}
#endif
if (!metaData.isValid()) {
layout->addWidget(new QLabel(i18nc("Required file does not exist", "%1 does not contain a valid metadata.json file", qPrintable(packageRoot))));
return;

View file

@ -170,11 +170,7 @@ void KWin::Script::run()
m_starting = true;
QFutureWatcher<QByteArray> *watcher = new QFutureWatcher<QByteArray>(this);
connect(watcher, &QFutureWatcherBase::finished, this, &Script::slotScriptLoadedFromFile);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
watcher->setFuture(QtConcurrent::run(this, &KWin::Script::loadScriptFromFile, fileName()));
#else
watcher->setFuture(QtConcurrent::run(&KWin::Script::loadScriptFromFile, this, fileName()));
#endif
}
QByteArray KWin::Script::loadScriptFromFile(const QString &fileName)

View file

@ -58,16 +58,9 @@ void ThumbnailTextureProvider::setTexture(const std::shared_ptr<GLTexture> &nati
if (m_nativeTexture != nativeTexture) {
const GLuint textureId = nativeTexture->texture();
m_nativeTexture = nativeTexture;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_texture.reset(m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture,
&textureId, 0,
nativeTexture->size(),
QQuickWindow::TextureHasAlphaChannel));
#else
m_texture.reset(QNativeInterface::QSGOpenGLTexture::fromNative(textureId, m_window,
nativeTexture->size(),
QQuickWindow::TextureHasAlphaChannel));
#endif
m_texture->setFiltering(QSGTexture::Linear);
m_texture->setHorizontalWrapMode(QSGTexture::ClampToEdge);
m_texture->setVerticalWrapMode(QSGTexture::ClampToEdge);

View file

@ -377,20 +377,12 @@ QQmlListProperty<KWin::Window> DeclarativeScriptWorkspaceWrapper::clients()
return QQmlListProperty<KWin::Window>(this, nullptr, &DeclarativeScriptWorkspaceWrapper::countClientList, &DeclarativeScriptWorkspaceWrapper::atClientList);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int DeclarativeScriptWorkspaceWrapper::countClientList(QQmlListProperty<KWin::Window> *clients)
#else
qsizetype DeclarativeScriptWorkspaceWrapper::countClientList(QQmlListProperty<KWin::Window> *clients)
#endif
{
return workspace()->allClientList().size();
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
KWin::Window *DeclarativeScriptWorkspaceWrapper::atClientList(QQmlListProperty<KWin::Window> *clients, int index)
#else
KWin::Window *DeclarativeScriptWorkspaceWrapper::atClientList(QQmlListProperty<KWin::Window> *clients, qsizetype index)
#endif
{
return workspace()->allClientList().at(index);
}

View file

@ -353,13 +353,8 @@ class DeclarativeScriptWorkspaceWrapper : public WorkspaceWrapper
Q_PROPERTY(QQmlListProperty<KWin::Window> clients READ clients)
public:
QQmlListProperty<KWin::Window> clients();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
static int countClientList(QQmlListProperty<KWin::Window> *clients);
static KWin::Window *atClientList(QQmlListProperty<KWin::Window> *clients, int index);
#else
static qsizetype countClientList(QQmlListProperty<KWin::Window> *clients);
static KWin::Window *atClientList(QQmlListProperty<KWin::Window> *clients, qsizetype index);
#endif
explicit DeclarativeScriptWorkspaceWrapper(QObject *parent = nullptr);
};

View file

@ -74,7 +74,6 @@ void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEvent
const auto button = m_tipDown ? Qt::LeftButton : Qt::NoButton;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// TODO: Not correct, but it should work fine. In long term, we need to stop using QTabletEvent.
const QPointingDevice *dev = QPointingDevice::primaryPointingDevice();
TabletEvent ev(t, dev, pos, pos, pressure,
@ -83,14 +82,6 @@ void TabletInputRedirection::tabletToolEvent(KWin::InputRedirection::TabletEvent
rotation,
0, // z
Qt::NoModifier, button, button, tabletToolId);
#else
TabletEvent ev(t, pos, pos, QTabletEvent::Stylus, QTabletEvent::Pen, pressure,
xTilt, yTilt,
0, // tangentialPressure
rotation,
0, // z
Qt::NoModifier, tabletToolId.m_uniqueId, button, button, tabletToolId);
#endif
ev.setTimestamp(std::chrono::duration_cast<std::chrono::milliseconds>(time).count());
input()->processSpies(std::bind(&InputEventSpy::tabletToolEvent, std::placeholders::_1, &ev));

View file

@ -304,11 +304,7 @@ void Tile::insertChild(int position, Tile *item)
const bool wasEmpty = m_children.isEmpty();
item->setParent(this);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_children.insert(std::clamp(position, 0, m_children.length()), item);
#else
m_children.insert(std::clamp<qsizetype>(position, 0, m_children.length()), item);
#endif
if (wasEmpty) {
Q_EMIT isLayoutChanged(true);

View file

@ -845,20 +845,11 @@ void ShortcutDialog::accept()
{
QKeySequence seq = shortcut();
if (!seq.isEmpty()) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (seq[0] == Qt::Key_Escape) {
#else
if (seq[0] == QKeyCombination(Qt::Key_Escape)) {
#endif
reject();
return;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (seq[0] == Qt::Key_Space
|| (seq[0] & Qt::KeyboardModifierMask) == 0) {
#else
if (seq[0] == QKeyCombination(Qt::Key_Space) || seq[0].keyboardModifiers() == Qt::NoModifier) {
#endif
// clear
m_ui.keySequenceEdit->clear();
QDialog::accept();

View file

@ -29,15 +29,8 @@ add_executable(testWaylandSeat)
set( testWaylandSeat_SRCS
test_wayland_seat.cpp
)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(testWaylandSeat_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml
BASENAME pointer-gestures-unstable-v1
)
else()
qt6_generate_wayland_protocol_client_sources(testWaylandSeat FILES
qt6_generate_wayland_protocol_client_sources(testWaylandSeat FILES
${WaylandProtocols_DATADIR}/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml)
endif()
target_sources(testWaylandSeat PRIVATE ${testWaylandSeat_SRCS})
target_link_libraries( testWaylandSeat Qt::Test Qt::Gui KF6::WaylandClient kwin Wayland::Client Wayland::Server)
add_test(NAME kwayland-testWaylandSeat COMMAND testWaylandSeat)

View file

@ -32,15 +32,8 @@ ecm_mark_as_test(testNoXdgRuntimeDir)
# Test Tablet Interface
########################################################
add_executable(testTabletInterface)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(TABLET_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/tablet/tablet-unstable-v2.xml
BASENAME tablet-unstable-v2
)
else()
qt6_generate_wayland_protocol_client_sources(testTabletInterface FILES
qt6_generate_wayland_protocol_client_sources(testTabletInterface FILES
${WaylandProtocols_DATADIR}/unstable/tablet/tablet-unstable-v2.xml)
endif()
target_sources(testTabletInterface PRIVATE test_tablet_interface.cpp ${TABLET_SRCS})
target_link_libraries( testTabletInterface Qt::Test kwin KF6::WaylandClient Wayland::Client)
add_test(NAME kwayland-testTabletInterface COMMAND testTabletInterface)
@ -50,15 +43,8 @@ ecm_mark_as_test(testTabletInterface)
# Test DataControlInterface
########################################################
add_executable(testDataControlInterface test_datacontrol_interface.cpp ${DATACONTROL_SRCS})
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(DATACONTROL_SRCS
PROTOCOL ${PROJECT_SOURCE_DIR}/src/wayland/protocols/wlr-data-control-unstable-v1.xml
BASENAME wlr-data-control-unstable-v1
)
else()
qt6_generate_wayland_protocol_client_sources(testDataControlInterface FILES
qt6_generate_wayland_protocol_client_sources(testDataControlInterface FILES
${PROJECT_SOURCE_DIR}/src/wayland/protocols/wlr-data-control-unstable-v1.xml)
endif()
target_sources(testDataControlInterface PRIVATE test_datacontrol_interface.cpp ${DATACONTROL_SRCS})
target_link_libraries( testDataControlInterface Qt::Test kwin KF6::WaylandClient Wayland::Client)
add_test(NAME kwayland-testDataControlInterface COMMAND testDataControlInterface)
@ -68,15 +54,8 @@ ecm_mark_as_test(testDataControlInterface)
# Test Keyboard Shortcuts Inhibitor Interface
########################################################
add_executable(testKeyboardShortcutsInhibitorInterface)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(KEYBOARD_SHORTCUTS_INHIBITOR_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml
BASENAME keyboard-shortcuts-inhibit-unstable-v1
)
else()
qt6_generate_wayland_protocol_client_sources(testKeyboardShortcutsInhibitorInterface FILES
qt6_generate_wayland_protocol_client_sources(testKeyboardShortcutsInhibitorInterface FILES
${WaylandProtocols_DATADIR}/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml)
endif()
target_sources(testKeyboardShortcutsInhibitorInterface PRIVATE test_keyboard_shortcuts_inhibitor_interface.cpp ${KEYBOARD_SHORTCUTS_INHIBITOR_SRCS})
target_link_libraries(testKeyboardShortcutsInhibitorInterface Qt::Test kwin KF6::WaylandClient Wayland::Client)
add_test(NAME kwayland-testKeyboardShortcutsInhibitorInterface COMMAND testKeyboardShortcutsInhibitorInterface)
@ -86,15 +65,8 @@ ecm_mark_as_test(testKeyboardShortcutsInhibitorInterface)
# Test Viewporter Interface
########################################################
add_executable(testViewporterInterface)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(VIEWPORTER_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/stable/viewporter/viewporter.xml
BASENAME viewporter
)
else()
qt6_generate_wayland_protocol_client_sources(testViewporterInterface FILES
qt6_generate_wayland_protocol_client_sources(testViewporterInterface FILES
${WaylandProtocols_DATADIR}/stable/viewporter/viewporter.xml)
endif()
target_sources(testViewporterInterface PRIVATE test_viewporter_interface.cpp ${VIEWPORTER_SRCS})
target_link_libraries(testViewporterInterface Qt::Test kwin KF6::WaylandClient Wayland::Client)
add_test(NAME kwayland-testViewporterInterface COMMAND testViewporterInterface)
@ -104,15 +76,8 @@ ecm_mark_as_test(testViewporterInterface)
# Test ScreencastV1Interface
########################################################
add_executable(testScreencastV1Interface)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(SCREENCAST_SRCS
PROTOCOL PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/zkde-screencast-unstable-v1.xml
BASENAME zkde-screencast-unstable-v1
)
else()
qt6_generate_wayland_protocol_client_sources(testScreencastV1Interface FILES
qt6_generate_wayland_protocol_client_sources(testScreencastV1Interface FILES
${PLASMA_WAYLAND_PROTOCOLS_DIR}/zkde-screencast-unstable-v1.xml)
endif()
target_sources(testScreencastV1Interface PRIVATE test_screencast.cpp ${SCREENCAST_SRCS})
target_link_libraries(testScreencastV1Interface Qt::Test kwin Wayland::Client KF6::WaylandClient)
add_test(NAME kwayland-testScreencastV1Interface COMMAND testScreencastV1Interface)
@ -122,18 +87,11 @@ ecm_mark_as_test(testScreencastV1Interface)
# Test InputMethod Interface
########################################################
add_executable(testInputMethodInterface)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(INPUTMETHOD_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml
BASENAME input-method-unstable-v1
)
else()
qt6_generate_wayland_protocol_client_sources(testInputMethodInterface
qt6_generate_wayland_protocol_client_sources(testInputMethodInterface
NO_INCLUDE_CORE_ONLY
FILES
${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml
)
endif()
)
target_sources(testInputMethodInterface PRIVATE test_inputmethod_interface.cpp ../../tests/fakeoutput.cpp ${INPUTMETHOD_SRCS})
target_link_libraries(testInputMethodInterface Qt::Test kwin KF6::WaylandClient Wayland::Client)
add_test(NAME kwayland-testInputMethodInterface COMMAND testInputMethodInterface)
@ -143,21 +101,10 @@ ecm_mark_as_test(testInputMethodInterface)
# Test LayerShellV1 Interface
########################################################
add_executable(testLayerShellV1Interface)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(LAYERSHELLV1_SRCS
PROTOCOL ${PROJECT_SOURCE_DIR}/src/wayland/protocols/wlr-layer-shell-unstable-v1.xml
BASENAME wlr-layer-shell-unstable-v1
)
ecm_add_qtwayland_client_protocol(LAYERSHELLV1_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
BASENAME xdg-shell
)
else()
qt6_generate_wayland_protocol_client_sources(testLayerShellV1Interface FILES
qt6_generate_wayland_protocol_client_sources(testLayerShellV1Interface FILES
${PROJECT_SOURCE_DIR}/src/wayland/protocols/wlr-layer-shell-unstable-v1.xml
${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
)
endif()
)
target_sources(testLayerShellV1Interface PRIVATE test_layershellv1_interface.cpp ${LAYERSHELLV1_SRCS})
target_link_libraries(testLayerShellV1Interface Qt::Test kwin KF6::WaylandClient Wayland::Client)
add_test(NAME kwayland-testLayerShellV1Interface COMMAND testLayerShellV1Interface)
@ -168,15 +115,8 @@ ecm_mark_as_test(testLayerShellV1Interface)
# Test TextInputV3 Interface
########################################################
add_executable(testTextInputV3Interface)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(TEXTINPUTV3_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v3.xml
BASENAME text-input-unstable-v3
)
else()
qt6_generate_wayland_protocol_client_sources(testTextInputV3Interface FILES
qt6_generate_wayland_protocol_client_sources(testTextInputV3Interface FILES
${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v3.xml)
endif()
target_sources(testTextInputV3Interface PRIVATE test_textinputv3_interface.cpp ${TEXTINPUTV3_SRCS})
target_link_libraries(testTextInputV3Interface Qt::Test kwin KF6::WaylandClient Wayland::Client)
add_test(NAME kwayland-testTextInputV3Interface COMMAND testTextInputV3Interface)
@ -186,15 +126,8 @@ ecm_mark_as_test(testTextInputV3Interface)
# Test TextInputV1 Interface
########################################################
add_executable(testTextInputV1Interface)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(TEXTINPUTV1_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v1.xml
BASENAME text-input-unstable-v1
)
else()
qt6_generate_wayland_protocol_client_sources(testTextInputV1Interface FILES
qt6_generate_wayland_protocol_client_sources(testTextInputV1Interface FILES
${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v1.xml)
endif()
target_sources(testTextInputV1Interface PRIVATE test_textinputv1_interface.cpp ${TEXTINPUTV1_SRCS})
target_link_libraries(testTextInputV1Interface Qt::Test kwin KF6::WaylandClient Wayland::Client)
add_test(NAME kwayland-testTextInputV1Interface COMMAND testTextInputV1Interface)

View file

@ -132,11 +132,7 @@ Workspace::Workspace()
, m_placementTracker(std::make_unique<PlacementTracker>(this))
{
// If KWin was already running it saved its configuration after loosing the selection -> Reread
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QFuture<void> reparseConfigFuture = QtConcurrent::run(options, &Options::reparseConfiguration);
#else
QFuture<void> reparseConfigFuture = QtConcurrent::run(&Options::reparseConfiguration, options);
#endif
_self = this;

View file

@ -17,11 +17,7 @@
// Qt
#include <QKeyEvent>
#include <QTemporaryFile>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtXkbCommonSupport/private/qxkbcommon_p.h>
#else
#include <QtGui/private/qxkbcommon_p.h>
#endif
// xkbcommon
#include <xkbcommon/xkbcommon-compose.h>
#include <xkbcommon/xkbcommon-keysyms.h>
@ -576,11 +572,6 @@ Qt::Key Xkb::toQtKey(xkb_keysym_t keySym,
} else if (qtKey > 0xff && keySym <= 0xff) {
// XKB_KEY_mu, XKB_KEY_ydiaeresis go here
qtKey = Qt::Key(keySym);
#if QT_VERSION_MAJOR < 6 // since Qt 5 LTS is frozen
} else if (keySym == XKB_KEY_Sys_Req) {
// fixed in QTBUG-92087
qtKey = Qt::Key_SysReq;
#endif
}
return qtKey;
}

View file

@ -42,11 +42,7 @@ void DataBridge::init()
kwinApp()->installNativeEventFilter(this);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
bool DataBridge::nativeEventFilter(const QByteArray &eventType, void *message, long int *)
#else
bool DataBridge::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *)
#endif
{
if (eventType == "xcb_generic_event_t") {
xcb_generic_event_t *event = static_cast<xcb_generic_event_t *>(message);

View file

@ -51,11 +51,7 @@ public:
return m_dnd;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
bool nativeEventFilter(const QByteArray &eventType, void *message, long int *result) override;
#else
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
#endif
private:
void init();

View file

@ -242,11 +242,7 @@ void Xwayland::dispatchEvents(DispatchEventsMode mode)
auto pollEventFunc = mode == DispatchEventsMode::Poll ? xcb_poll_for_event : xcb_poll_for_queued_event;
while (xcb_generic_event_t *event = pollEventFunc(connection)) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
long result = 0;
#else
qintptr result = 0;
#endif
QAbstractEventDispatcher *dispatcher = QCoreApplication::eventDispatcher();
dispatcher->filterNativeEvent(QByteArrayLiteral("xcb_generic_event_t"), event, &result);

View file

@ -1,7 +1,3 @@
if (QT_MAJOR_VERSION EQUAL "5")
find_package(Qt6 REQUIRED COMPONENTS WaylandClient)
endif()
if (XCB_ICCCM_FOUND)
set(normalhintsbasesizetest_SRCS normalhintsbasesizetest.cpp)
add_executable(normalhintsbasesizetest ${normalhintsbasesizetest_SRCS})
@ -11,21 +7,11 @@ endif()
# next target
set(screenedgeshowtest_SRCS screenedgeshowtest.cpp)
add_executable(screenedgeshowtest ${screenedgeshowtest_SRCS})
target_link_libraries(screenedgeshowtest Qt::Widgets KF6::ConfigCore KF6::WindowSystem KF6::WaylandClient ${XCB_XCB_LIBRARY})
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(screenedgeshowtest Qt::X11Extras)
else()
target_link_libraries(screenedgeshowtest Qt::GuiPrivate)
endif()
target_link_libraries(screenedgeshowtest Qt::GuiPrivate Qt::Widgets KF6::ConfigCore KF6::WindowSystem KF6::WaylandClient ${XCB_XCB_LIBRARY})
target_include_directories(screenedgeshowtest PRIVATE ${CMAKE_SOURCE_DIR}/src)
add_executable(x11shadowreader x11shadowreader.cpp)
target_link_libraries(x11shadowreader XCB::XCB Qt::Widgets KF6::ConfigCore KF6::WindowSystem)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(x11shadowreader Qt::X11Extras)
else()
target_link_libraries(x11shadowreader Qt::GuiPrivate)
endif()
target_link_libraries(x11shadowreader XCB::XCB Qt::GuiPrivate Qt::Widgets KF6::ConfigCore KF6::WindowSystem)
target_include_directories(x11shadowreader PRIVATE ${CMAKE_SOURCE_DIR}/src)
add_executable(pointerconstraints pointerconstraintstest.cpp)
@ -41,23 +27,5 @@ target_link_libraries(cursorhotspottest Qt::Widgets)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if (QT_MAJOR_VERSION EQUAL "5")
add_executable(xdgactivationtest-qt5 xdgactivationtest-qt5.cpp)
target_link_libraries(xdgactivationtest-qt5 Qt::Widgets Qt::WaylandClient Qt::WaylandClientPrivate Wayland::Client)
ecm_add_qtwayland_client_protocol(xdgactivationtest-qt5
PROTOCOL ${WaylandProtocols_DATADIR}/staging/xdg-activation/xdg-activation-v1.xml
BASENAME xdg-activation-v1
)
add_executable(lockscreenoverlaytest lockscreenoverlaytest.cpp)
target_link_libraries(lockscreenoverlaytest Qt::Widgets Qt::WaylandClient Qt::WaylandClientPrivate Wayland::Client KF6::WindowSystem)
ecm_add_qtwayland_client_protocol(lockscreenoverlaytest
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-lockscreen-overlay-v1.xml
BASENAME kde-lockscreen-overlay-v1
)
endif()
if (TARGET Qt6::Gui)
add_executable(xdgactivationtest-qt6 xdgactivationtest-qt6.cpp)
target_link_libraries(xdgactivationtest-qt6 Qt6::Widgets)
endif()
add_executable(xdgactivationtest-qt6 xdgactivationtest-qt6.cpp)
target_link_libraries(xdgactivationtest-qt6 Qt6::Widgets)

View file

@ -16,11 +16,7 @@
#include <QToolButton>
#include <QWidget>
#include <QWindow>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
#include <KWindowSystem>

View file

@ -12,11 +12,7 @@
#include <QLabel>
#include <QVBoxLayout>
#include <QWidget>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#endif
static QVector<uint32_t> readShadow(quint32 windowId)
{

View file

@ -1,90 +0,0 @@
/*
SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org>
SPDX-FileCopyrightText: 2022 Ilya Fedin <fedin-ilja2010@ya.ru>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "qwayland-xdg-activation-v1.h"
#include <QWaylandClientExtensionTemplate>
#include <QtWidgets>
#include <qpa/qplatformnativeinterface.h>
class WaylandXdgActivationTokenV1 : public QObject, public QtWayland::xdg_activation_token_v1
{
Q_OBJECT
public:
void xdg_activation_token_v1_done(const QString &token) override
{
Q_EMIT done(token);
}
Q_SIGNALS:
void done(const QString &token);
};
class WaylandXdgActivationV1 : public QWaylandClientExtensionTemplate<WaylandXdgActivationV1>, public QtWayland::xdg_activation_v1
{
public:
WaylandXdgActivationV1()
: QWaylandClientExtensionTemplate<WaylandXdgActivationV1>(1)
{
// QWaylandClientExtensionTemplate invokes this with a QueuedConnection but we want shortcuts
// to be inhibited immediately.
QMetaObject::invokeMethod(this, "addRegistryListener");
}
WaylandXdgActivationTokenV1 *requestXdgActivationToken(wl_seat *seat, struct ::wl_surface *surface, uint32_t serial, const QString &app_id)
{
auto wl = get_activation_token();
auto provider = new WaylandXdgActivationTokenV1;
provider->init(wl);
if (surface) {
provider->set_surface(surface);
}
if (!app_id.isEmpty()) {
provider->set_app_id(app_id);
}
if (seat) {
provider->set_serial(serial, seat);
}
provider->commit();
return provider;
}
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget window1(nullptr, Qt::Window);
window1.setWindowTitle("Window 1");
window1.setLayout(new QVBoxLayout);
QPushButton p("Raise the Window 2");
window1.layout()->addWidget(&p);
window1.show();
QWidget window2(nullptr, Qt::Window);
window2.setWindowTitle("Window 2");
window2.show();
WaylandXdgActivationV1 activation;
QObject::connect(&p, &QPushButton::clicked, &app, [&] {
QPlatformNativeInterface *native = qGuiApp->platformNativeInterface();
auto seat = static_cast<wl_seat *>(native->nativeResourceForIntegration("wl_seat"));
wl_surface *surface = reinterpret_cast<wl_surface *>(native->nativeResourceForWindow(QByteArrayLiteral("surface"), window1.windowHandle()));
auto req = activation.requestXdgActivationToken(seat, surface, 0, {});
QObject::connect(req, &WaylandXdgActivationTokenV1::done, &app, [&activation, &window2](const QString &token) {
window2.show();
QPlatformNativeInterface *native = qGuiApp->platformNativeInterface();
wl_surface *surface = reinterpret_cast<wl_surface *>(native->nativeResourceForWindow(QByteArrayLiteral("surface"), window2.windowHandle()));
activation.activate(token, surface);
});
});
return app.exec();
}
#include "xdgactivationtest-qt5.moc"