Skip to content

Commit 24f34bd

Browse files
committed
fix: cannot build on Archlinux
dock use some only deepin of qt api. Log:
1 parent 9bda8c8 commit 24f34bd

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,32 @@ include(DDEShellPackageMacros)
5252
include(KDEClangFormat)
5353
include(KDEGitCommitHooks)
5454

55-
find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Concurrent Quick WaylandClient DBus LinguistTools Sql)
55+
find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Concurrent Quick WaylandClient WaylandCompositor DBus LinguistTools Sql)
5656
find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui)
5757
find_package(ICU 74.2 REQUIRED COMPONENTS uc i18n io)
5858
find_package(WaylandProtocols REQUIRED)
5959
find_package(PkgConfig REQUIRED)
6060

61+
try_compile(COMPILE_RESULT
62+
${CMAKE_CURRENT_BINARY_DIR}/try_compile_build
63+
SOURCES ${CMAKE_SOURCE_DIR}/tests/check/qt_wayland_keyextension.cpp
64+
LINK_LIBRARIES
65+
Qt${QT_VERSION_MAJOR}::WaylandCompositorPrivate
66+
Qt${QT_VERSION_MAJOR}::WaylandCompositor
67+
COMPILE_DEFINITIONS
68+
-DQT_WAYLANDCOMPOSITOR_LIB
69+
-DQT_WAYLANDCOMPOSITORPRIVATE_LIB
70+
-DQT_WAYLANDCOMPOSITOR_IMPLEMENTATION
71+
OUTPUT_VARIABLE compile_output
72+
)
73+
74+
if(COMPILE_RESULT)
75+
message(STATUS "Deepin Qt detected (try_compile success)")
76+
add_definitions(-DUSE_DEEPIN_QT)
77+
else()
78+
message(STATUS "Deepin Qt not detected")
79+
endif()
80+
6181
add_subdirectory(frame)
6282
add_subdirectory(shell)
6383
add_subdirectory(example)

panels/dock/pluginmanagerextension.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
#include <private/qwaylandcompositor_p.h>
2323
#undef protected
2424
#include <qpa/qwindowsysteminterface_p.h>
25+
26+
#ifdef USE_DEEPIN_QT
2527
#include <private/qwlqtkey_p.h>
2628
#include <private/qwlqttouch_p.h>
29+
#endif
2730

2831
DGUI_USE_NAMESPACE
2932

@@ -418,11 +421,14 @@ void PluginManager::initialize()
418421
QWindowSystemInterfacePrivate::removeWindowSystemEventhandler(eventHandler);
419422
}
420423

424+
// TODO: Use built-in protocol instead of qt
425+
#ifdef USE_DEEPIN_QT
421426
// 只创建就行
422427
auto qtKey = new QtWayland::QtKeyExtensionGlobal(compositor);
423428
qtKey->setParent(compositor);
424429
auto qtTouch = new QtWayland::TouchExtensionGlobal(compositor);
425430
qtTouch->setParent(compositor);
431+
#endif
426432

427433
init(compositor->display(), 1);
428434
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
2+
//
3+
// SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
#include <QtWaylandCompositor/QWaylandSurface>
6+
#include <QtWaylandCompositor/QWaylandResource>
7+
#include <QtWaylandCompositor/QWaylandCompositor>
8+
9+
#define protected public
10+
#include <private/qwaylandcompositor_p.h>
11+
#undef protected
12+
#include <private/qwlqtkey_p.h>
13+
#include <private/qwlqttouch_p.h>
14+
15+
int main (int argc, char *argv[]) {
16+
new QtWayland::QtKeyExtensionGlobal(nullptr);
17+
return 0;
18+
}

0 commit comments

Comments
 (0)