aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/plasma6-spectacle/files/extra-patch-pipewire-off
blob: 3eb884a1ca2f7e08c7353bd4630737e5b2bd6696 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
--- CMakeLists.txt.orig	2025-06-12 09:06:01 UTC
+++ CMakeLists.txt
@@ -87,12 +87,16 @@ find_package(LayerShellQt REQUIRED)
 find_package(Wayland REQUIRED COMPONENTS Client)
 find_package(PlasmaWaylandProtocols REQUIRED)
 find_package(LayerShellQt REQUIRED)
-find_package(KPipeWire)
+option(DISABLE_PIPEWIRE "Disable PipeWire support." ON)
+if(NOT DISABLE_PIPEWIRE)
+    find_package(KPipeWire REQUIRED)
+    set(PIPEWIRE_FOUND 1)
+endif()
 find_package(OpenCV 4.7 REQUIRED core imgproc)
 
 set_package_properties(KPipeWire PROPERTIES DESCRIPTION
     "Used to record pipewire streams into a file"
-    TYPE REQUIRED
+    TYPE OPTIONAL
 )
 
 # optional components
--- src/CMakeLists.txt.orig	2025-06-12 09:06:01 UTC
+++ src/CMakeLists.txt
@@ -19,6 +19,10 @@ qt_add_qml_module(spectacle URI ${SPECTACLE_QML_URI} D
 add_executable(spectacle)
 qt_add_qml_module(spectacle URI ${SPECTACLE_QML_URI} DEPENDENCIES QtCore QtQuick)
 
+if(PIPEWIRE_FOUND)
+    list(APPEND SPECTACLE_SRCS Platforms/VideoPlatformWayland.cpp)
+endif()
+
 target_sources(spectacle PRIVATE
     ${SPECTACLE_SRCS}
     CaptureModeModel.cpp
@@ -60,7 +64,6 @@ target_sources(spectacle PRIVATE
     Platforms/PlatformNull.cpp
     Platforms/screencasting.cpp
     Platforms/VideoPlatform.cpp
-    Platforms/VideoPlatformWayland.cpp
     RecordingModeModel.cpp
     ScreenShotEffect.cpp
     ShortcutActions.cpp
@@ -106,6 +109,10 @@ target_include_directories(spectacle PUBLIC ${OpenCV_I
 
 target_include_directories(spectacle PUBLIC ${OpenCV_INCLUDE_DIRS})
 
+if(PIPEWIRE_FOUND)
+    target_link_libraries(spectacle PRIVATE K::KPipeWireRecord)
+endif()
+
 target_link_libraries(spectacle PRIVATE
     Qt::Concurrent
     Qt::DBus
@@ -131,7 +138,6 @@ target_link_libraries(spectacle PRIVATE
     KF6::StatusNotifierItem
     KF6::PrisonScanner
     KF6::Crash
-    K::KPipeWireRecord
     Wayland::Client
     LayerShellQt::Interface
     ${OpenCV_LIBRARIES}
--- src/Config.h.in.orig	2025-06-12 09:06:01 UTC
+++ src/Config.h.in
@@ -7,6 +7,9 @@
 /* Define to 1 if we have Purpose */
 #cmakedefine PURPOSE_FOUND 1
 
+/* Define to 1 if we are building with PIPEWIRE */
+#cmakedefine PIPEWIRE_FOUND 1
+
 /* Set the Spectacle version from CMake */
 #cmakedefine SPECTACLE_VERSION "@SPECTACLE_VERSION@"
 
--- src/Platforms/PlatformLoader.cpp.orig	2025-06-12 09:06:01 UTC
+++ src/Platforms/PlatformLoader.cpp
@@ -11,7 +11,9 @@
 
 #include "ImagePlatformKWin.h"
 #include "PlatformNull.h"
+#ifdef PIPEWIRE_FOUND
 #include "VideoPlatformWayland.h"
+#endif
 
 #ifdef XCB_FOUND
 #include "ImagePlatformXcb.h"
@@ -74,9 +76,12 @@ VideoPlatformPtr getForcedVideoPlatform()
         return nullptr;
     }
 
+#ifdef PIPEWIRE_FOUND
     if (platformName == VideoPlatformWayland::staticMetaObject.className()) {
         return std::make_unique<VideoPlatformWayland>();
-    } else if (platformName == VideoPlatformNull::staticMetaObject.className()) {
+    } else
+#endif
+    if (platformName == VideoPlatformNull::staticMetaObject.className()) {
         return std::make_unique<VideoPlatformNull>();
     } else if (!platformName.isEmpty()) {
         qWarning() << "SPECTACLE_VIDEO_PLATFORM:" << platformName << "is invalid";
@@ -90,9 +95,11 @@ VideoPlatformPtr loadVideoPlatform()
     if (auto platform = getForcedVideoPlatform()) {
         return platform;
     }
+#ifdef PIPEWIRE_FOUND
     if (KWindowSystem::isPlatformWayland()) {
         return std::make_unique<VideoPlatformWayland>();
     }
+#endif
     if (KWindowSystem::isPlatformX11()) {
         return std::make_unique<VideoPlatformNull>(i18nc("@info", "Screen recording is not available on X11."));
     }