Commit 5a3ef9e8 authored by Volker Krause's avatar Volker Krause
Browse files

Make the screencast code build with Qt6

This needs the latest Plasma Wayland protocols.
parent 4ba66e7e
Pipeline #171775 passed with stage
in 13 minutes and 9 seconds
......@@ -22,25 +22,28 @@ if(TARGET PkgConfig::PipeWire)
if (QT_MAJOR_VERSION EQUAL "5")
ecm_add_qtwayland_client_protocol(SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/screencast.xml
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/zkde-screencast-unstable-v1.xml
BASENAME zkde-screencast-unstable-v1
)
else()
qt6_generate_wayland_protocol_client_sources(taskmanagerplugin FILES
${PLASMA_WAYLAND_PROTOCOLS_DIR}/screencast.xml)
${PLASMA_WAYLAND_PROTOCOLS_DIR}/zkde-screencast-unstable-v1.xml)
endif()
target_include_directories(taskmanagerplugin PRIVATE ${Libdrm_INCLUDE_DIR})
target_compile_definitions(taskmanagerplugin PRIVATE -DWITH_PIPEWIRE)
target_sources(taskmanagerplugin PUBLIC pipewirecore.cpp pipewiresourceitem.cpp pipewiresourcestream.cpp screencasting.cpp screencastingrequest.cpp ${SRCS})
target_link_libraries(taskmanagerplugin PkgConfig::PipeWire
Qt::Qml Qt5::Gui_EGL Qt::GuiPrivate
Qt::Qml Qt::GuiPrivate
KF5::I18n
KF5::WaylandClient
Wayland::Client)
if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GLESv2")
target_link_libraries(taskmanagerplugin Qt5::Gui_GLESv2)
else()
elseif(TARGET Qt5::Gui_GL)
target_link_libraries(taskmanagerplugin Qt5::Gui_GL)
endif()
if (TARGET Qt5::Gui_EGL)
target_link_libraries(taskmanagerplugin Qt5::Gui_EGL)
endif()
endif()
......@@ -23,7 +23,9 @@
#include <EGL/eglext.h>
#include <libdrm/drm_fourcc.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtPlatformHeaders/QEGLNativeContext>
#endif
static void pwInit()
{
......@@ -229,7 +231,12 @@ void PipeWireSourceItem::updateTextureDmaBuf(const QVector<DmaBufPlane> &planes,
qCWarning(PIPEWIRE_LOGGING) << "glEGLImageTargetTexture2DOES is not available" << window();
return;
}
if (!window() || !window()->openglContext() || !m_stream) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto openglContext = window()->openglContext();
#else
const auto openglContext = static_cast<QOpenGLContext *>(window()->rendererInterface()->getResource(window(), QSGRendererInterface::OpenGLContextResource));
#endif
if (!window() || !openglContext || !m_stream) {
qCWarning(PIPEWIRE_LOGGING) << "need a window and a context" << window();
return;
}
......@@ -268,7 +275,12 @@ void PipeWireSourceItem::updateTextureDmaBuf(const QVector<DmaBufPlane> &planes,
int textureId = m_texture->textureId();
QQuickWindow::CreateTextureOption textureOption = format == DRM_FORMAT_ARGB8888 ? QQuickWindow::TextureHasAlphaChannel : QQuickWindow::TextureIsOpaque;
setEnabled(true);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return window()->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, &textureId, 0 /*a vulkan thing?*/, size, textureOption);
#else
return QNativeInterface::QSGOpenGLTexture::fromNative(textureId, window(), size, textureOption);
#endif
;
};
if (window()->isVisible()) {
update();
......
......@@ -29,7 +29,9 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtPlatformHeaders/QEGLNativeContext>
#endif
#undef Status
#if !PW_CHECK_VERSION(0, 3, 29)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment