diff --git a/CMakeLists.txt b/CMakeLists.txt index be821cc4..f12dc354 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,15 +2,15 @@ # # SPDX-License-Identifier: LGPL-3.0-or-later -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) -set(VERSION +set(DTK_VERSION "5.6.8" CACHE STRING "define project version" ) project(qt5platform-plugins - VERSION ${VERSION} + VERSION ${DTK_VERSION} DESCRIPTION "DTK platform plugin module" HOMEPAGE_URL "https://github.com/linuxdeepin/qt5platform-plugins" LANGUAGES CXX C @@ -19,6 +19,16 @@ project(qt5platform-plugins include(GNUInstallDirs) include(CMakePackageConfigHelpers) +if("${PROJECT_VERSION_MAJOR}" STREQUAL "5") + set(QT_VERSION_MAJOR "5") +elseif("${PROJECT_VERSION_MAJOR}" STREQUAL "6") + set(QT_VERSION_MAJOR "6") + set(DTK_VERSION_MAJOR "6") +else() + message(SEND_ERROR "not support Prject Version ${PROJECT_VERSION}.") +endif() +message(${PROJECT_VERSION_MAJOR}) + set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_AUTOMOC ON) @@ -28,4 +38,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(REQUIRED_QT_VERSION 5.15.0) add_subdirectory(xcb) -add_subdirectory(wayland) +if("${PROJECT_VERSION_MAJOR}" STREQUAL "5") + add_subdirectory(wayland) +endif() +message(${PROJECT_VERSION_MAJOR}) diff --git a/archlinux/PKGBUILD b/archlinux/PKGBUILD index 0c6fc52a..b185dcbb 100644 --- a/archlinux/PKGBUILD +++ b/archlinux/PKGBUILD @@ -11,23 +11,22 @@ url="https://github.com/linuxdeepin/qt5platform-plugins" license=('GPL3') provides=('deepin-qt5platform-plugins') conflicts=('deepin-qt5platform-plugins') -depends=('cairo' 'kwayland' 'qt5-wayland' 'qt5-x11extras') -makedepends=('git' 'expac' 'qt5-xcb-private-headers' 'libglvnd' 'libxcb') +depends=('cairo' 'kwayland' 'qt5-wayland' 'qt5-x11extras' 'qtbase5-private-dev') +makedepends=('git' 'expac' 'qt5-xcb-private-headers' 'libglvnd' 'ninja' 'cmake' 'libxcb') groups=('deepin-git') source=("${sourcetars[@]}") sha512sums=('SKIP') build() { - cd $sourcedir - cmake . -GNinja \ - -DMKSPECS_INSTALL_DIR=lib/qt/mkspecs/modules/\ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_BUILD_TYPE=Release - ninja + cd $sourcedir + cmake . -GNinja \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=Release + ninja } package() { - cd $sourcedir - make INSTALL_ROOT="$pkgdir" install + cd $sourcedir + make INSTALL_ROOT="$pkgdir" install } diff --git a/debian/rules b/debian/rules index cf3ae0d8..ff01a882 100755 --- a/debian/rules +++ b/debian/rules @@ -1,5 +1,4 @@ #!/usr/bin/make -f -export QT_SELECT=5 %: dh $@ diff --git a/src/dapplicationeventmonitor.cpp b/src/dapplicationeventmonitor.cpp index 77aa5f11..6be7d16f 100644 --- a/src/dapplicationeventmonitor.cpp +++ b/src/dapplicationeventmonitor.cpp @@ -6,7 +6,13 @@ #include #include + +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) +#include +typedef QPointingDevice QTouchDevice; +#else #include +#endif DPP_BEGIN_NAMESPACE @@ -58,8 +64,11 @@ DApplicationEventMonitor::InputDeviceType DApplicationEventMonitor::eventType(QE case QEvent::TouchEnd: case QEvent::TouchCancel: { QTouchEvent *pTouchEvent = static_cast(event); - +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + if (pTouchEvent->device()->type() == QInputDevice::DeviceType::TouchScreen) { +#else if (pTouchEvent->device()->type() == QTouchDevice::TouchScreen) { +#endif last_input_device_type = TouchScreen; } break; diff --git a/src/dnativesettings.cpp b/src/dnativesettings.cpp index e68e427d..a6f33c57 100644 --- a/src/dnativesettings.cpp +++ b/src/dnativesettings.cpp @@ -90,7 +90,12 @@ void DNativeSettings::init(const QMetaObject *metaObject) int allKeyPropertyTyep = 0; QMetaObjectBuilder &ob = m_objectBuilder; + +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + ob.setFlags(ob.flags() | DynamicMetaObject); +#else ob.setFlags(ob.flags() | QMetaObjectBuilder::DynamicMetaObject); +#endif // 先删除所有的属性,等待重构 while (ob.propertyCount() > 0) { @@ -177,7 +182,8 @@ void DNativeSettings::init(const QMetaObject *metaObject) // 将所有属性名称设置给对象 if (allKeyPropertyTyep == qMetaTypeId>()) { - m_base->setProperty(ALL_KEYS, QVariant::fromValue(m_settings->settingKeys().toSet())); + QSet set(m_settings->settingKeys().begin(), m_settings->settingKeys().end()); + m_base->setProperty(ALL_KEYS, QVariant::fromValue(set)); } else { m_base->setProperty(ALL_KEYS, QVariant::fromValue(m_settings->settingKeys())); } @@ -438,13 +444,21 @@ int DNativeSettings::metaCall(QMetaObject::Call _c, int _id, void ** _a) // 0为return type, 因此参数值下标从1开始 if (signal_method.parameterCount() > 0) { +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + QVariant arg(signal_method.parameterMetaType(0), _a[1]); +#else QVariant arg(signal_method.parameterType(0), _a[1]); +#endif // 获取参数1,获取参数2 data1 = arg.toInt(); } if (signal_method.parameterCount() > 1) { +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + QVariant arg(signal_method.parameterMetaType(1), _a[2]); +#else QVariant arg(signal_method.parameterType(1), _a[2]); +#endif data2 = arg.toInt(); } } diff --git a/src/dselectedtexttooltip.cpp b/src/dselectedtexttooltip.cpp index 3d7d25e5..3d29c855 100644 --- a/src/dselectedtexttooltip.cpp +++ b/src/dselectedtexttooltip.cpp @@ -51,7 +51,7 @@ void DSelectedTextTooltip::onFontChanged() QFontMetrics font_metrics(qApp->font()); int tooltip_width = 0; for (auto &font_info : m_textInfoVec) { - int tmp_width = font_metrics.width(font_info.optName); + int tmp_width = font_metrics.horizontalAdvance(font_info.optName); font_info.textWidth = tmp_width + 2 * TEXT_SPACINGWIDGET; tooltip_width += font_info.textWidth; } @@ -64,7 +64,8 @@ void DSelectedTextTooltip::onFontChanged() void DSelectedTextTooltip::updateColor() { // 参考DtkGui - QColor rgb_color = qApp->palette().background().color().toRgb(); + QColor rgb_color = qApp->palette().window().color().toRgb(); + float luminance = 0.299 * rgb_color.redF() + 0.587 * rgb_color.greenF() + 0.114 * rgb_color.blueF(); if (qRound(luminance * 255) > 191) { diff --git a/src/dxcbxsettings.cpp b/src/dxcbxsettings.cpp index 5e9b2363..4fa80281 100644 --- a/src/dxcbxsettings.cpp +++ b/src/dxcbxsettings.cpp @@ -452,7 +452,7 @@ class Q_DECL_HIDDEN DXcbXSettingsPrivate void init(xcb_window_t setting_window, DXcbXSettings *object) { x_settings_window = setting_window; - mapped.insertMulti(x_settings_window, object); + mapped.insert(x_settings_window, object); initialized = true; populateSettings(getSettings()); diff --git a/wayland/dwayland/CMakeLists.txt b/wayland/dwayland/CMakeLists.txt index ef493585..6a0e4474 100644 --- a/wayland/dwayland/CMakeLists.txt +++ b/wayland/dwayland/CMakeLists.txt @@ -4,7 +4,10 @@ project(dwayland) -find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui WaylandClient XkbCommonSupport) +find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui WaylandClient) +if(${QT_VERSION_MAJOR} STREQUAL "5") + find_package(Qt5 REQUIRED COMPONENTS XkbCommonSupport) +endif() add_definitions(-DQT5DWAYLANDPLUGIN_LIBRARY -DQT_DEPRECATED_WARNINGS) @@ -40,15 +43,26 @@ PRIVATE ${CMAKE_SOURCE_DIR}/src ) +if("${QT_VERSION_MAJOR}" STREQUAL "6") + list(GET Qt6WaylandClient_PRIVATE_INCLUDE_DIRS 0 dir) + if(EXISTS ${dir}) + target_include_directories(${PROJECT_NAME} PRIVATE ${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS}) + else() + target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/wayland/qtwayland-dev/${Qt6_VERSION}) + endif() +endif() + target_link_libraries(${PROJECT_NAME} PRIVATE - Qt5::Core - Qt5::GuiPrivate - Qt5::XkbCommonSupportPrivate - Qt5::WaylandClientPrivate + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::GuiPrivate + Qt${QT_VERSION_MAJOR}::WaylandClient ) +if(${QT_VERSION_MAJOR} STREQUAL "5") + target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::XkbCommonSupportPrivate Qt5::WaylandClientPrivate) +endif() if(NOT INSTALL_PATH) - set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt5/plugins/platforms) + set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/plugins/platforms) endif() install(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_PATH}) diff --git a/wayland/wayland-shell/CMakeLists.txt b/wayland/wayland-shell/CMakeLists.txt index f3b6d63f..a369df3c 100644 --- a/wayland/wayland-shell/CMakeLists.txt +++ b/wayland/wayland-shell/CMakeLists.txt @@ -4,15 +4,19 @@ project(kwayland-shell) -find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Widgets XkbCommonSupport WaylandClient) +find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Widgets WaylandClient) + +if(${QT_VERSION_MAJOR} STREQUAL "5") + find_package(Qt5 REQUIRED COMPONENTS XkbCommonSupport) +endif() include(wayland-shell.cmake) try_compile(DEEPIN_KWIN_TEST_COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR}/deepin-kwin-test - ${CMAKE_CURRENT_LIST_DIR}/config.tests/deepin-kwin-test deepin-kwin-test) + ${CMAKE_CURRENT_LIST_DIR}/config.tests/deepin-kwin-test deepin-kwin-test CMAKE_FLAGS -DQT_VERSION_MAJOR=${QT_VERSION_MAJOR}) try_compile(WAYLAND_TEST_COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR}/wayland_test - ${CMAKE_CURRENT_LIST_DIR}/config.tests/wayland_test wayland_test) + ${CMAKE_CURRENT_LIST_DIR}/config.tests/wayland_test wayland_test CMAKE_FLAGS -DQT_VERSION_MAJOR=${QT_VERSION_MAJOR}) if(WAYLAND_TEST_COMPILE_RESULT) add_definitions(-DUSE_DEEPIN_WAYLAND) @@ -49,18 +53,20 @@ endif() target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src) list(APPEND COMMON_LIBS - Qt5::Core - Qt5::Gui - Qt5::GuiPrivate - Qt5::Widgets - Qt5::WidgetsPrivate - Qt5::WaylandClient - Qt5::WaylandClientPrivate - Qt5::XkbCommonSupportPrivate + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::GuiPrivate + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::WidgetsPrivate + Qt${QT_VERSION_MAJOR}::WaylandClient ) +if(${QT_VERSION_MAJOR} STREQUAL "5") + list(APPEND COMMON_LIBS Qt5::XkbCommonSupportPrivate Qt5::WaylandClientPrivate) +endif() + target_link_libraries(${PROJECT_NAME} ${COMMON_LIBS}) if(NOT INSTALL_PATH) - set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt5/plugins/wayland-shell-integration) + set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/plugins/wayland-shell-integration) endif() install(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_PATH}) diff --git a/wayland/wayland-shell/config.tests/deepin-kwin-test/CMakeLists.txt b/wayland/wayland-shell/config.tests/deepin-kwin-test/CMakeLists.txt index 6455b5d1..2c6cceb8 100644 --- a/wayland/wayland-shell/config.tests/deepin-kwin-test/CMakeLists.txt +++ b/wayland/wayland-shell/config.tests/deepin-kwin-test/CMakeLists.txt @@ -2,12 +2,10 @@ # # SPDX-License-Identifier: LGPL-3.0-or-later -cmake_minimum_required(VERSION 3.10) - project(deepin-kwin-test) set(REQUIRED_QT_VERSION 5.15.0) -find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS WaylandClient) +find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS WaylandClient) include(../../wayland-shell.cmake) @@ -18,11 +16,19 @@ set(AUTOMOC_COMPILER_PREDEFINES ON) add_executable(${PROJECT_NAME} main.cpp) -list(APPEND COMMON_LIBS - Qt5::WaylandClientPrivate -) +if("${QT_VERSION_MAJOR}" STREQUAL "5") + list(APPEND COMMON_LIBS Qt5::WaylandClientPrivate) +endif() target_link_libraries(${PROJECT_NAME} PUBLIC ${COMMON_LIBS}) +if(${QT_VERSION_MAJOR} STREQUAL "6") + list(GET Qt6WaylandClient_PRIVATE_INCLUDE_DIRS 0 dir) + if(EXISTS ${dir}) + target_include_directories(${PROJECT_NAME} PRIVATE ${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS}) + else() + target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../../qtwayland-dev/${Qt6_VERSION}) + endif() +endif() target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR} diff --git a/wayland/wayland-shell/config.tests/wayland_test/CMakeLists.txt b/wayland/wayland-shell/config.tests/wayland_test/CMakeLists.txt index b7b9ba31..7103cd2f 100644 --- a/wayland/wayland-shell/config.tests/wayland_test/CMakeLists.txt +++ b/wayland/wayland-shell/config.tests/wayland_test/CMakeLists.txt @@ -2,12 +2,13 @@ # # SPDX-License-Identifier: LGPL-3.0-or-later -cmake_minimum_required(VERSION 3.10) - project(wayland_test) set(REQUIRED_QT_VERSION 5.15.0) -find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui WaylandClient XkbCommonSupport) +find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui WaylandClient) +if(${QT_VERSION_MAJOR} STREQUAL "5") + find_package(Qt5 REQUIRED COMPONENTS XkbCommonSupport) +endif() include(../../wayland-shell.cmake) @@ -19,12 +20,13 @@ set(AUTOMOC_COMPILER_PREDEFINES ON) add_executable(${PROJECT_NAME} main.cpp) list(APPEND COMMON_LIBS - Qt5::Core - Qt5::CorePrivate - Qt5::GuiPrivate - Qt5::WaylandClientPrivate - Qt5::XkbCommonSupportPrivate + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::CorePrivate + Qt${QT_VERSION_MAJOR}::GuiPrivate ) +if(${QT_VERSION_MAJOR} STREQUAL "5") + list(APPEND COMMON_LIBS Qt5::WaylandClientPrivate Qt5::XkbCommonSupportPrivate) +endif() target_link_libraries(${PROJECT_NAME} PUBLIC ${COMMON_LIBS}) target_include_directories(${PROJECT_NAME} PUBLIC diff --git a/wayland/wayland-shell/main.cpp b/wayland/wayland-shell/main.cpp index c2106efc..1f7e88a5 100644 --- a/wayland/wayland-shell/main.cpp +++ b/wayland/wayland-shell/main.cpp @@ -15,7 +15,6 @@ class QKWaylandShellIntegrationPlugin : public QWaylandShellIntegrationPlugin QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override { Q_UNUSED(key); Q_UNUSED(paramList); - qWarning() << "shell is nullptr" << shellVersion; return nullptr; } }; diff --git a/xcb/CMakeLists.txt b/xcb/CMakeLists.txt index d8575ab6..d0628f73 100644 --- a/xcb/CMakeLists.txt +++ b/xcb/CMakeLists.txt @@ -4,14 +4,19 @@ project(dxcb) -find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Widgets DBus XcbQpa X11Extras EdidSupport XkbCommonSupport) +find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Widgets DBus) +if(${QT_VERSION_MAJOR} STREQUAL "5") + find_package(Qt5 REQUIRED COMPONENTS XcbQpa X11Extras EdidSupport XkbCommonSupport) +else() + find_package(Qt6 REQUIRED COMPONENTS OpenGL) +endif() # NOTE(sbw): 禁止语法树上的 vrp 优化,-O2/-O3 默认开启,会导致测试虚析构函数 HOOK 失败 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-vrp" CACHE STRING "disable vrp optimization" FORCE) -add_definitions(-DDXCB_VERSION=\"${VERSION}\") +add_definitions(-DDXCB_VERSION=\"${DTK_VERSION}\") if(CMAKE_BUILD_TYPE STREQUAL "Release") - add_definitions(-DQT_NO_DEBUG_OUTPUT=true) + add_definitions(-DQT_NO_DEBUG_OUTPUT=TRUE) endif() file(GLOB GLOBAL_HEADERS ${CMAKE_CURRENT_LIST_DIR}/*.h) file(GLOB GLOBAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/*.cpp ${CMAKE_CURRENT_LIST_DIR}/3rdparty/*.c) @@ -29,8 +34,13 @@ endif() include(${CMAKE_SOURCE_DIR}/src/src.cmake) -qt5_add_dbus_interface(DBUS_INTERFACE_XMLS ${CMAKE_SOURCE_DIR}/misc/com.deepin.im.xml im_interface) -qt5_add_dbus_interface(DBUS_INTERFACE_XMLS ${CMAKE_SOURCE_DIR}/misc/org.freedesktop.DBus.xml dbus_interface) +if(${QT_VERSION_MAJOR} STREQUAL "5") + qt5_add_dbus_interface(DBUS_INTERFACE_XMLS ${CMAKE_SOURCE_DIR}/misc/com.deepin.im.xml im_interface) + qt5_add_dbus_interface(DBUS_INTERFACE_XMLS ${CMAKE_SOURCE_DIR}/misc/org.freedesktop.DBus.xml dbus_interface) +else() + qt6_add_dbus_interface(DBUS_INTERFACE_XMLS ${CMAKE_SOURCE_DIR}/misc/com.deepin.im.xml im_interface) + qt6_add_dbus_interface(DBUS_INTERFACE_XMLS ${CMAKE_SOURCE_DIR}/misc/org.freedesktop.DBus.xml dbus_interface) +endif() set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin/plugins/platforms) @@ -40,20 +50,27 @@ include(${CMAKE_CURRENT_LIST_DIR}/linux.cmake) target_link_libraries(${PROJECT_NAME} PRIVATE - Qt5::Core - Qt5::CorePrivate - Qt5::Gui - Qt5::GuiPrivate - Qt5::Widgets - Qt5::XcbQpa - Qt5::EdidSupport - Qt5::EdidSupportPrivate - Qt5::XkbCommonSupport - Qt5::XkbCommonSupportPrivate - Qt5::X11Extras + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::CorePrivate + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::GuiPrivate + Qt${QT_VERSION_MAJOR}::Widgets ) +if(${QT_VERSION_MAJOR} STREQUAL "5") + target_link_libraries(${PROJECT_NAME} + PRIVATE + Qt5::XcbQpa + Qt5::EdidSupport + Qt5::EdidSupportPrivate + Qt5::XkbCommonSupport + Qt5::XkbCommonSupportPrivate + Qt5::X11Extras + ) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::OpenGL Qt6::OpenGLPrivate) +endif() if(NOT INSTALL_PATH) - set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt5/plugins/platforms) + set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/plugins/platforms) endif() install(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_PATH}) diff --git a/xcb/dforeignplatformwindow_x11.cpp b/xcb/dforeignplatformwindow_x11.cpp index a05efc94..80ad7495 100644 --- a/xcb/dforeignplatformwindow_x11.cpp +++ b/xcb/dforeignplatformwindow_x11.cpp @@ -338,9 +338,11 @@ void DForeignPlatformWindow::updateWindowState() void DForeignPlatformWindow::updateWindowTypes() { - QXcbWindowFunctions::WmWindowTypes window_types = wmWindowTypes(); - Qt::WindowFlags window_flags = 0; - + auto window_types = wmWindowTypes(); + Qt::WindowFlags window_flags = (Qt::WindowFlags)0; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + typedef QXcbWindow QXcbWindowFunctions ; +#endif if (window_types & QXcbWindowFunctions::Normal) window_flags |= Qt::Window; if (window_types & QXcbWindowFunctions::Desktop) diff --git a/xcb/dnotitlebarwindowhelper.cpp b/xcb/dnotitlebarwindowhelper.cpp index e0b44844..0191e49a 100644 --- a/xcb/dnotitlebarwindowhelper.cpp +++ b/xcb/dnotitlebarwindowhelper.cpp @@ -2,6 +2,9 @@ // // SPDX-License-Identifier: LGPL-3.0-or-later +#define protected public +#include +#undef protected #include "dnotitlebarwindowhelper.h" #include "vtablehook.h" #include "utility.h" @@ -9,9 +12,6 @@ #include "dnativesettings.h" #include "dplatformintegration.h" -#define protected public -#include -#undef protected #include #include #include @@ -57,7 +57,7 @@ DNoTitlebarWindowHelper::DNoTitlebarWindowHelper(QWindow *window, quint32 window updateWindowBlurPathsFromProperty(); updateAutoInputMaskByClipPathFromProperty(); } else { - qWarning() << "native settings is invalid for window: 0x" << hex << windowID; + qWarning() << "native settings is invalid for window: 0x" << /*hex <<*/ windowID; } connect(DWMSupport::instance(), &DXcbWMSupport::hasScissorWindowChanged, this, &DNoTitlebarWindowHelper::updateWindowShape); diff --git a/xcb/dplatformbackingstorehelper.cpp b/xcb/dplatformbackingstorehelper.cpp index 545e63ab..5a44d0d3 100644 --- a/xcb/dplatformbackingstorehelper.cpp +++ b/xcb/dplatformbackingstorehelper.cpp @@ -130,7 +130,11 @@ void DPlatformBackingStoreHelper::flush(QWindow *window, const QRegion ®ion, const QPoint &offset = (window_helper->m_frameWindow->m_contentGeometry.topLeft() - 2 * window_helper->m_frameWindow->contentOffsetHint()) * device_pixel_ratio; +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + border_brush.setTransform(QTransform(1, 0, 0, 1, offset.x(), offset.y())); +#else border_brush.setMatrix(QMatrix(1, 0, 0, 1, offset.x(), offset.y())); +#endif pa.setRenderHint(QPainter::Antialiasing); pa.setCompositionMode(QPainter::CompositionMode_Source); diff --git a/xcb/dplatformintegration.cpp b/xcb/dplatformintegration.cpp index 03f3f66e..9ea296d7 100644 --- a/xcb/dplatformintegration.cpp +++ b/xcb/dplatformintegration.cpp @@ -2,6 +2,10 @@ // // SPDX-License-Identifier: GPL-3.0-or-later +#define private public +#include +#undef private + #include "dplatformintegration.h" #include "global.h" #include "dforeignplatformwindow.h" @@ -461,7 +465,7 @@ QPaintEngine *DPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDe static QPaintEngine::PaintEngineFeatures disable_features = QPaintEngine::PaintEngineFeatures(-1); if (int(disable_features) < 0) { - disable_features = 0; + disable_features = QPaintEngine::PaintEngineFeatures(); QByteArray data = qgetenv("DXCB_PAINTENGINE_DISABLE_FEATURES"); @@ -473,12 +477,14 @@ QPaintEngine *DPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDe if (ok) break; - disable_features = 0; + disable_features = QPaintEngine::PaintEngineFeatures(); } QSettings settings(QSettings::IniFormat, QSettings::UserScope, "deepin", "qt-theme"); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) settings.setIniCodec("utf-8"); +#endif settings.beginGroup("Platform"); bool ok = false; @@ -486,7 +492,7 @@ QPaintEngine *DPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDe disable_features = QPaintEngine::PaintEngineFeatures(settings.value("PaintEngineDisableFeatures").toByteArray().toInt(&ok, 16)); if (!ok) - disable_features = 0; + disable_features = QPaintEngine::PaintEngineFeatures(); } while (false); } @@ -714,7 +720,12 @@ static xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage free(formatsReply); return XCB_NONE; } + +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + memcpy(xi->data, img.constBits(), img.sizeInBytes()); +#else memcpy(xi->data, img.constBits(), img.byteCount()); +#endif xcb_pixmap_t pix = xcb_generate_id(conn); xcb_create_pixmap(conn, 32, pix, screen->root(), w, h); @@ -1024,7 +1035,11 @@ void DPlatformIntegration::initialize() } #ifdef Q_OS_LINUX +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + m_eventFilter = new XcbNativeEventFilter(connection()); +#else m_eventFilter = new XcbNativeEventFilter(defaultConnection()); +#endif qApp->installNativeEventFilter(m_eventFilter); if (!qEnvironmentVariableIsSet("DXCB_DISABLE_HOOK_CURSOR")) { diff --git a/xcb/dplatformintegration.h b/xcb/dplatformintegration.h index f4b8f594..ea1e68b9 100644 --- a/xcb/dplatformintegration.h +++ b/xcb/dplatformintegration.h @@ -74,8 +74,13 @@ class DPlatformIntegration : public DPlatformIntegrationParent { return static_cast(DPlatformIntegrationParent::instance());} inline static QXcbConnection *xcbConnection() - { return instance()->defaultConnection();} - + { +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + return instance()->connection(); +#else + return instance()->defaultConnection(); +#endif + } inline XcbNativeEventFilter *eventFilter() { return m_eventFilter;} diff --git a/xcb/dplatformopenglcontexthelper.cpp b/xcb/dplatformopenglcontexthelper.cpp index 8d281986..4fe962f2 100644 --- a/xcb/dplatformopenglcontexthelper.cpp +++ b/xcb/dplatformopenglcontexthelper.cpp @@ -50,8 +50,11 @@ static void drawCornerImage(const QImage &source, const QPoint &source_offset, Q GL_RGBA, GL_UNSIGNED_BYTE, tmp_image.bits()); tmp_image = tmp_image.mirrored(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + brush.setTransform(QTransform(1, 0, 0, 1, -source_offset.x() - br.x(), -source_offset.y() - br.y())); +#else brush.setMatrix(QMatrix(1, 0, 0, 1, -source_offset.x() - br.x(), -source_offset.y() - br.y())); - +#endif QPainter pa(&tmp_image); pa.setRenderHint(QPainter::Antialiasing); @@ -95,9 +98,11 @@ void DPlatformOpenGLContextHelper::swapBuffers(QPlatformSurface *surface) if (window_helper->m_isUserSetClipPath) { const QRect &content_rect = QRect(window_helper->m_frameWindow->contentOffsetHint() * device_pixel_ratio, window_size); QBrush border_brush(window_helper->m_frameWindow->platformBackingStore->toImage()); - +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + border_brush.setTransform(QTransform(1, 0, 0, 1, -content_rect.x(), -content_rect.y())); +#else border_brush.setMatrix(QMatrix(1, 0, 0, 1, -content_rect.x(), -content_rect.y())); - +#endif pa_device.fillPath(path, border_brush); } else { const QImage &frame_image = window_helper->m_frameWindow->platformBackingStore->toImage(); diff --git a/xcb/dplatformwindowhelper.cpp b/xcb/dplatformwindowhelper.cpp index eef403a4..fd88f2d7 100644 --- a/xcb/dplatformwindowhelper.cpp +++ b/xcb/dplatformwindowhelper.cpp @@ -604,9 +604,16 @@ bool DPlatformWindowHelper::eventFilter(QObject *watched, QEvent *event) && !qFuzzyCompare(posF.y(), rectF.height()) && rectF.contains(posF)) { m_frameWindow->unsetCursor(); + +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + QScopedPointer mevent(QMutableSinglePointEvent::from(e->clone())); + mevent->mutablePoint().setPosition(m_nativeWindow->window()->mapFromGlobal(e->globalPos())); + mevent->mutablePoint().setScenePosition(m_nativeWindow->window()->mapFromGlobal(e->globalPos())); + qApp->sendEvent(m_nativeWindow->window(), mevent.data()); +#else e->l = e->w = m_nativeWindow->window()->mapFromGlobal(e->globalPos()); qApp->sendEvent(m_nativeWindow->window(), e); - +#endif return true; } @@ -638,7 +645,11 @@ bool DPlatformWindowHelper::eventFilter(QObject *watched, QEvent *event) case QEvent::DragMove: case QEvent::Drop: { DQDropEvent *e = static_cast(event); +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + e->m_pos -= m_frameWindow->contentOffsetHint(); +#else e->p -= m_frameWindow->contentOffsetHint(); +#endif #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) Q_FALLTHROUGH(); #endif @@ -683,10 +694,16 @@ bool DPlatformWindowHelper::eventFilter(QObject *watched, QEvent *event) if (!event->isAccepted()) { DQMouseEvent *e = static_cast(event); +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + QScopedPointer mevent(QMutableSinglePointEvent::from(e->clone())); + mevent->mutablePoint().setPosition(m_frameWindow->mapFromGlobal(e->globalPos())); + mevent->mutablePoint().setScenePosition(m_frameWindow->mapFromGlobal(e->globalPos())); + m_frameWindow->mouseMoveEvent(dynamic_cast(mevent.data())); +#else e->l = e->w = m_frameWindow->mapFromGlobal(e->globalPos()); QGuiApplicationPrivate::setMouseEventSource(e, Qt::MouseEventSynthesizedByQt); m_frameWindow->mouseMoveEvent(e); - +#endif return true; } break; @@ -758,8 +775,11 @@ bool DPlatformWindowHelper::eventFilter(QObject *watched, QEvent *event) const DeviceType type = DPlatformIntegration::instance()->eventFilter()->xiEventSource(ev); if (type != UnknowDevice) - ev->mouseState |= Qt::MouseButton(Qt::MaxMouseButton + type); - +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + ev->m_mouseState |= Qt::MaxMouseButton | Qt::MouseButton(type); +#else + ev->mouseState |= Qt::MaxMouseButton | Qt::MouseButton(type); +#endif break; } #endif diff --git a/xcb/linux.cmake b/xcb/linux.cmake index d367d26c..b05a302c 100644 --- a/xcb/linux.cmake +++ b/xcb/linux.cmake @@ -6,7 +6,8 @@ find_package(PkgConfig REQUIRED) pkg_check_modules( XCB - REQUIRED IMPORTED_TARGET + REQUIRED + IMPORTED_TARGET x11-xcb xi xcb-renderutil @@ -29,40 +30,58 @@ pkg_check_modules( xcb-damage xcb-xinerama mtdev - egl -) + egl) target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::XCB) # Don't link cairo library pkg_check_modules(CAIRO REQUIRED IMPORTED_TARGET cairo) target_include_directories(${PROJECT_NAME} PRIVATE ${CAIRO_INCLUDE_DIRS}) -get_property(QT_ENABLED_PRIVATE_FEATURES TARGET Qt5::Gui PROPERTY QT_ENABLED_PRIVATE_FEATURES) - +get_property( + QT_ENABLED_PRIVATE_FEATURES + TARGET Qt${QT_VERSION_MAJOR}::Gui + PROPERTY QT_ENABLED_PRIVATE_FEATURES) macro(try_add_defines feature defines) list(FIND QT_ENABLED_PRIVATE_FEATURES ${feature} index) - if (index GREATER 0) + if(index GREATER 0) add_definitions(${defines}) + else() + message("can't find ${feature} index = ${index}") endif() endmacro() -try_add_defines("xcb-xlib" "-DXCB_USE_XLIB -DXCB_USE_XINPUT2 -DXCB_USE_XINPUT21 -DXCB_USE_XINPUT22") -try_add_defines("xcb-sm" "-DXCB_USE_SM") -try_add_defines("xcb-qt" "-DXCB_USE_RENDER") +if(${QT_VERSION_MAJOR} STREQUAL "5") + try_add_defines( + "xcb-xlib" + "-DXCB_USE_XLIB -DXCB_USE_XINPUT2 -DXCB_USE_XINPUT21 -DXCB_USE_XINPUT22") + try_add_defines("xcb-sm" "-DXCB_USE_SM") + try_add_defines("xcb-qt" "-DXCB_USE_RENDER") +else() + try_add_defines( + "xcb_xlib" + "-DXCB_USE_XLIB -DXCB_USE_XINPUT2 -DXCB_USE_XINPUT21 -DXCB_USE_XINPUT22") + try_add_defines("xcb_sm" "-DXCB_USE_SM") + try_add_defines("xcb_qt" "-DXCB_USE_RENDER") +endif() list(FIND QT_ENABLED_PRIVATE_FEATURES "system-xcb" index) -if (index GREATER 0) +if(index GREATER 0) try_add_defines("xcb-render" "-DXCB_USE_RENDER") try_add_defines("xkb" "-DXCB_USE_RENDER") else() add_definitions(-DXCB_USE_RENDER) endif() -list(GET Qt5Core_INCLUDE_DIRS 0 dir) -if(EXISTS ${dir}QtXcb/${Qt5_VERSION}/QtXcb/private) - include_directories(${dir}QtXcb/${Qt5_VERSION}/QtXcb/private) -elseif(EXISTS ${CMAKE_CURRENT_LIST_DIR}/libqt5xcbqpa-dev/${Qt5_VERSION}) - include_directories(${CMAKE_CURRENT_LIST_DIR}/libqt5xcbqpa-dev/${Qt5_VERSION}) +if(${QT_VERSION_MAJOR} STREQUAL "5") + list(GET Qt5Core_INCLUDE_DIRS 0 dir) + if(EXISTS ${dir}QtXcb/${Qt5_VERSION}/QtXcb/private) + include_directories(${dir}QtXcb/${Qt5_VERSION}/QtXcb/private) + elseif(EXISTS ${CMAKE_CURRENT_LIST_DIR}/libqt5xcbqpa-dev/${Qt5_VERSION}) + include_directories( + ${CMAKE_CURRENT_LIST_DIR}/libqt5xcbqpa-dev/${Qt5_VERSION}) + else() + message(FATAL_ERROR "Not support Qt Version: ${Qt5_VERSION}") + endif() else() - message(FATAL_ERROR "Not support Qt Version: ${Qt5_VERSION}") + include_directories(${CMAKE_CURRENT_LIST_DIR}/libqt6xcbqpa-dev/${Qt6_VERSION}) endif() diff --git a/xcb/utility.h b/xcb/utility.h index f98ddc4f..16e5225b 100644 --- a/xcb/utility.h +++ b/xcb/utility.h @@ -194,9 +194,16 @@ inline QRegion operator *(const QRegion &pointRegion, qreal scale) return pointRegion; QRegion pixelRegon; +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + for (auto region = pointRegion.begin(); region != pointRegion.end(); + ++region) { + pixelRegon += (*region) * scale; + } +#else foreach (const QRect &rect, pointRegion.rects()) { pixelRegon += rect * scale; } +#endif return pixelRegon; } QT_END_NAMESPACE diff --git a/xcb/utility_x11.cpp b/xcb/utility_x11.cpp index b8c01c86..4bd030ea 100644 --- a/xcb/utility_x11.cpp +++ b/xcb/utility_x11.cpp @@ -14,7 +14,12 @@ #include #include #include +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +#else #include +#endif + #include #include #include @@ -224,7 +229,6 @@ void Utility::setFrameExtents(WId wid, const QMargins &margins) data[1] = int32_t(margins.right()); data[2] = int32_t(margins.top()); data[3] = int32_t(margins.bottom()); - xcb_change_property_checked(QX11Info::connection(), XCB_PROP_MODE_REPLACE, xcb_window_t(wid), frameExtents, XCB_ATOM_CARDINAL, 32, 4, data); } @@ -233,7 +237,18 @@ static QVector qregion2XcbRectangles(const QRegion ®ion) QVector rectangles; rectangles.reserve(region.rectCount()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + for (auto rect = region.cbegin(); rect != region.cend(); ++rect) { + xcb_rectangle_t r; + + r.x = rect->x(); + r.y = rect->y(); + r.width = rect->width(); + r.height = rect->height(); + rectangles << r; + } +#else for (const QRect &rect : region.rects()) { xcb_rectangle_t r; @@ -244,6 +259,7 @@ static QVector qregion2XcbRectangles(const QRegion ®ion) rectangles << r; } +#endif return rectangles; } @@ -286,6 +302,19 @@ void Utility::setShapePath(quint32 WId, const QPainterPath &path, bool onlyInput QVector rectangles; foreach(const QPolygonF &polygon, path.toFillPolygons()) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QRegion region(polygon.toPolygon()); + for (auto area = region.cbegin(); area != region.cend(); ++area) { + xcb_rectangle_t rectangle; + + rectangle.x = area->x(); + rectangle.y = area->y(); + rectangle.width = area->width(); + rectangle.height = area->height(); + + rectangles.append(std::move(rectangle)); + } +#else foreach(const QRect &area, QRegion(polygon.toPolygon()).rects()) { xcb_rectangle_t rectangle; @@ -296,6 +325,7 @@ void Utility::setShapePath(quint32 WId, const QPainterPath &path, bool onlyInput rectangles.append(std::move(rectangle)); } +#endif } ::setShapeRectangles(WId, rectangles, onlyInput, transparentInput); @@ -402,11 +432,15 @@ bool Utility::setWindowCursor(quint32 WId, Utility::CornerEdge ce) QRegion Utility::regionAddMargins(const QRegion ®ion, const QMargins &margins, const QPoint &offset) { QRegion tmp; - +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + for(auto rect = region.cbegin(); rect != region.cend(); ++rect) { + tmp += rect->translated(offset) + margins; + } +#else for (const QRect &rect : region.rects()) { tmp += rect.translated(offset) + margins; } - +#endif return tmp; } @@ -556,9 +590,16 @@ bool Utility::blurWindowBackground(const quint32 WId, const QVector &a path.addRoundedRect(area.x, area.y, area.width, area.height, area.xRadius, area.yRaduis); foreach(const QPolygonF &polygon, path.toFillPolygons()) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QRegion region(polygon.toPolygon()); + for(auto area = region.cbegin(); area != region.cend(); ++area) { + rects << area->x() << area->y() << area->width() << area->height(); + } +#else foreach(const QRect &area, QRegion(polygon.toPolygon()).rects()) { rects << area.x() << area.y() << area.width() << area.height(); } +#endif } } } @@ -610,9 +651,16 @@ bool Utility::blurWindowBackgroundByPaths(const quint32 WId, const QList= QT_VERSION_CHECK(6, 0, 0) + QRegion region(polygon.toPolygon()); + for(auto area = region.cbegin(); area != region.cend(); ++area) { + rects << area->x() << area->y() << area->width() << area->height(); + } +#else foreach(const QRect &area, QRegion(polygon.toPolygon()).rects()) { rects << area.x() << area.y() << area.width() << area.height(); } +#endif } } @@ -632,10 +680,9 @@ bool Utility::blurWindowBackgroundByImage(const quint32 WId, const QRect &blurRe area.reserve(5); area << blurRect.x() << blurRect.y() << blurRect.width() << blurRect.height() << maskImage.bytesPerLine(); - - array.reserve(area.size() * sizeof(qint32) / sizeof(char) * area.size() + maskImage.byteCount()); + array.reserve(area.size() * sizeof(qint32) / sizeof(char) * area.size() + maskImage.sizeInBytes()); array.append((const char*)area.constData(), sizeof(qint32) / sizeof(char) * area.size()); - array.append((const char*)maskImage.constBits(), maskImage.byteCount()); + array.append((const char*)maskImage.constBits(), maskImage.sizeInBytes()); clearWindowProperty(WId, DXcbWMSupport::instance()->_net_wm_deepin_blur_region_rounded_atom); setWindowProperty(WId, DXcbWMSupport::instance()->_net_wm_deepin_blur_region_mask, diff --git a/xcb/windoweventhook.cpp b/xcb/windoweventhook.cpp index b08b0502..15d7ddd5 100644 --- a/xcb/windoweventhook.cpp +++ b/xcb/windoweventhook.cpp @@ -379,7 +379,7 @@ void WindowEventHook::handlePropertyNotifyEvent(QXcbWindowEventListener *el, con #ifdef XCB_USE_XINPUT22 static Qt::KeyboardModifiers translateModifiers(const QXcbKeyboard::_mod_masks &rmod_masks, int s) { - Qt::KeyboardModifiers ret = 0; + Qt::KeyboardModifiers ret = Qt::KeyboardModifiers(); if (s & XCB_MOD_MASK_SHIFT) ret |= Qt::ShiftModifier; if (s & XCB_MOD_MASK_CONTROL) @@ -485,7 +485,11 @@ bool WindowEventHook::windowEvent(QXcbWindow *window, QEvent *event) Qt::DropActions support_actions = qvariant_cast(ev->mimeData()->property("_d_dxcb_support_actions")); if (support_actions != Qt::IgnoreAction) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + ev->m_actions = support_actions; +#else ev->act = support_actions; +#endif } } default: diff --git a/xcb/xcbnativeeventfilter.cpp b/xcb/xcbnativeeventfilter.cpp index 31122dd9..d8156508 100644 --- a/xcb/xcbnativeeventfilter.cpp +++ b/xcb/xcbnativeeventfilter.cpp @@ -22,7 +22,13 @@ #include #include +#include +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) +#define CONNECTION DPlatformIntegration::instance()->connection() +#else +#define CONNECTION DPlatformIntegration::instance()->defaultConnection() +#endif DPP_BEGIN_NAMESPACE XcbNativeEventFilter::XcbNativeEventFilter(QXcbConnection *connection) @@ -67,7 +73,11 @@ static inline bool isXIEvent(xcb_generic_event_t *event, int opCode) return e->extension == opCode; } +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) +bool XcbNativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) +#else bool XcbNativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) +#endif { Q_UNUSED(eventType) Q_UNUSED(result) @@ -120,13 +130,13 @@ bool XcbNativeEventFilter::nativeEventFilter(const QByteArray &eventType, void * } else if (pn->atom == DXcbWMSupport::instance()->_deepin_wallpaper_shared_key) { DXcbWMSupport::instance()->wallpaperSharedChanged(); } else { - if (pn->window != DPlatformIntegration::instance()->defaultConnection()->rootWindow()) { + if (pn->window != CONNECTION->rootWindow()) { return false; } - if (pn->atom == DPlatformIntegration::instance()->defaultConnection()->atom(QXcbAtom::_NET_SUPPORTED)) { + if (pn->atom == CONNECTION->atom(QXcbAtom::_NET_SUPPORTED)) { DXcbWMSupport::instance()->updateNetWMAtoms(); - } else if (pn->atom == DPlatformIntegration::instance()->defaultConnection()->atom(QXcbAtom::_NET_SUPPORTING_WM_CHECK)) { + } else if (pn->atom == CONNECTION->atom(QXcbAtom::_NET_SUPPORTING_WM_CHECK)) { DXcbWMSupport::instance()->updateWMName(); } else if (pn->atom == DXcbWMSupport::instance()->_kde_net_wm_blur_rehind_region_atom) { DXcbWMSupport::instance()->updateRootWindowProperties(); diff --git a/xcb/xcbnativeeventfilter.h b/xcb/xcbnativeeventfilter.h index f7666c93..da6d151c 100644 --- a/xcb/xcbnativeeventfilter.h +++ b/xcb/xcbnativeeventfilter.h @@ -32,7 +32,12 @@ class XcbNativeEventFilter : public QAbstractNativeEventFilter XcbNativeEventFilter(QXcbConnection *connection); QClipboard::Mode clipboardModeForAtom(xcb_atom_t a) const; + +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) Q_DECL_OVERRIDE; +#else bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; +#endif DeviceType xiEventSource(const QInputEvent *event) const;