@@ -76,8 +76,8 @@ if(CUDA_FOUND)
7676 add_compile_definitions (SUNSHINE_BUILD_CUDA )
7777endif ()
7878
79- # libdrm is required for both DRM (KMS) and Wayland
80- if (${SUNSHINE_ENABLE_DRM} OR ${SUNSHINE_ENABLE_WAYLAND} )
79+ # libdrm is required for DRM (KMS), Wayland, and KWin ScreenCast
80+ if (${SUNSHINE_ENABLE_DRM} OR ${SUNSHINE_ENABLE_WAYLAND} OR ${SUNSHINE_ENABLE_KWIN} )
8181 find_package (LIBDRM REQUIRED )
8282else ()
8383 set (LIBDRM_FOUND OFF )
@@ -245,7 +245,7 @@ if(GIO_FOUND)
245245endif ()
246246
247247# Pipewire
248- if (${SUNSHINE_ENABLE_PORTAL} )
248+ if (${SUNSHINE_ENABLE_PORTAL} OR ${SUNSHINE_ENABLE_KWIN} )
249249 pkg_check_modules (PIPEWIRE libpipewire-0.3 REQUIRED )
250250else ()
251251 set (PIPEWIRE_FOUND OFF )
@@ -266,10 +266,23 @@ if(PIPEWIRE_FOUND AND GIO_FOUND AND ${SUNSHINE_ENABLE_PORTAL})
266266 "${CMAKE_SOURCE_DIR} /src/platform/linux/portalgrab.cpp" )
267267endif ()
268268
269+ # KWin ScreenCast (direct Wayland protocol, bypasses portal)
270+ set (KWIN_FOUND OFF )
271+ if (WAYLAND_FOUND AND PIPEWIRE_FOUND AND ${SUNSHINE_ENABLE_KWIN} )
272+ set (KWIN_FOUND ON )
273+ add_compile_definitions (SUNSHINE_BUILD_KWIN )
274+ GEN_WAYLAND ("${CMAKE_SOURCE_DIR} /third-party/plasma-wayland-protocols/src/protocols" "" zkde-screencast-unstable-v1 )
275+ list (APPEND PLATFORM_TARGET_FILES
276+ "${CMAKE_SOURCE_DIR} /src/platform/linux/kwingrab.cpp" )
277+ elseif (${SUNSHINE_ENABLE_KWIN} AND NOT WAYLAND_FOUND)
278+ message (WARNING "SUNSHINE_ENABLE_KWIN requires SUNSHINE_ENABLE_WAYLAND — KWin capture disabled" )
279+ endif ()
280+
269281if (NOT ${CUDA_FOUND}
270282 AND NOT ${WAYLAND_FOUND}
271283 AND NOT ${X11_FOUND}
272284 AND NOT ${PORTAL_FOUND}
285+ AND NOT ${KWIN_FOUND}
273286 AND NOT (${LIBDRM_FOUND} AND ${LIBCAP_FOUND} )
274287 AND NOT ${LIBVA_FOUND} )
275288 message (FATAL_ERROR "Couldn't find either cuda, libva, pipewire, wayland, x11, or (libdrm and libcap)" )
0 commit comments