Commit ac67e456 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

screencasting: Adoption of the zkde_screencast_v1 Wayland protocol

Instead of creating the pipewire feeds in the portal, they will be
created in KWin.
Then the portal task becomes to orchestrate the permission and delivery
to the app.

Depends on changes in KWin and Plasma Wayland Protocols
parent 8922d260
......@@ -20,36 +20,6 @@ include(KDEClangFormat)
include(FeatureSummary)
option(ENABLE_PIPEWIRE "Disable PipeWire support. PipeWire is needed for screen sharing and remote desktop" ON)
if(ENABLE_PIPEWIRE)
set(HAVE_PIPEWIRE_SUPPORT 1)
else()
message(STATUS "Disabling PipeWire support")
set(HAVE_PIPEWIRE_SUPPORT 0)
endif()
add_definitions(-DHAVE_PIPEWIRE_SUPPORT=${HAVE_PIPEWIRE_SUPPORT})
if(HAVE_PIPEWIRE_SUPPORT)
find_package(PipeWire)
set_package_properties(PipeWire PROPERTIES
TYPE REQUIRED
PURPOSE "Required for screencast portal"
)
find_package(GBM)
set_package_properties(GBM PROPERTIES
TYPE REQUIRED
PURPOSE "Required for screencast portal"
)
find_package(Epoxy)
set_package_properties(Epoxy PROPERTIES DESCRIPTION "libepoxy"
URL "https://github.com/anholt/libepoxy"
TYPE REQUIRED
PURPOSE "Required for screencast portal"
)
endif()
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
Concurrent
......@@ -72,6 +42,9 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
WidgetsAddons
WindowSystem
)
find_package(Wayland 1.15 REQUIRED COMPONENTS Client)
find_package(PlasmaWaylandProtocols REQUIRED)
find_package(QtWaylandScanner REQUIRED)
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
......
#.rst:
# FindEpoxy
# -------
#
# - Try to find libepoxy.
#
# This will define the following variables:
#
# ``Epoxy_FOUND``
# TRUE if libepoxy was found
# ``Epoxy_LIBRARIES``
# Pass this variable to target_link_libraries()
# ``Epoxy_INCLUDE_DIRS``
# This should be passed to target_include_directories() to use the
# libepoxy headers
# ``Epoxy_DEFINITIONS``
# Can be passed to target_compile_options() if necessary
#
# ``Epoxy_HAS_GLX``
# Whether GLX support is available
# Copyright (c) 2014 Fredrik Höglund <fredrik@kde.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
find_package(PkgConfig QUIET)
pkg_check_modules(PKG_Epoxy QUIET epoxy)
set(Epoxy_DEFINITIONS "${PKG_Epoxy_CFLAGS}")
find_path(Epoxy_INCLUDE_DIRS NAMES epoxy/gl.h HINTS ${PKG_Epoxy_INCLUDEDIR} ${PKG_Epoxy_INCLUDE_DIRS})
find_library(Epoxy_LIBRARIES NAMES epoxy HINTS ${PKG_Epoxy_LIBDIR} ${PKG_Epoxy_LIBRARIES_DIRS})
find_file(Epoxy_GLX_HEADER NAMES epoxy/glx.h HINTS ${Epoxy_INCLUDE_DIRS} DOC "whether GLX is available")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Epoxy DEFAULT_MSG Epoxy_LIBRARIES Epoxy_INCLUDE_DIRS)
mark_as_advanced(Epoxy_INCLUDE_DIRS Epoxy_LIBRARIES Epoxy_HAS_GLX)
#.rst:
# FindGBM
# -------
#
# Try to find gbm on a Unix system.
#
# This will define the following variables:
#
# ``GBM_FOUND``
# True if (the requested version of) GBM is available
# ``GBM_VERSION``
# The version of GBM
# ``GBM_LIBRARIES``
# This can be passed to target_link_libraries() instead of the ``GBM::GBM``
# target
# ``GBM_INCLUDE_DIRS``
# This should be passed to target_include_directories() if the target is not
# used for linking
# ``GBM_DEFINITIONS``
# This should be passed to target_compile_options() if the target is not
# used for linking
#
# If ``GBM_FOUND`` is TRUE, it will also define the following imported target:
#
# ``GBM::GBM``
# The GBM library
#
# In general we recommend using the imported target, as it is easier to use.
# Bear in mind, however, that if the target is in the link interface of an
# exported library, it must be made available by the package config file.
#=============================================================================
# Copyright 2014 Alex Merry <alex.merry@kde.org>
# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# Use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig QUIET)
pkg_check_modules(PKG_GBM QUIET gbm)
set(GBM_DEFINITIONS "${PKG_GBM_CFLAGS_OTHER}")
set(GBM_VERSION "${PKG_GBM_VERSION}")
find_path(GBM_INCLUDE_DIRS
NAMES
gbm.h
HINTS
${PKG_GBM_INCLUDE_DIRS}
)
find_library(GBM_LIBRARIES
NAMES
gbm
HINTS
${PKG_GBM_LIBRARIES_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GBM
FOUND_VAR
GBM_FOUND
REQUIRED_VARS
GBM_LIBRARIES
GBM_INCLUDE_DIRS
VERSION_VAR
GBM_VERSION
)
if(GBM_FOUND AND NOT TARGET GBM::GBM)
add_library(GBM::GBM UNKNOWN IMPORTED)
set_target_properties(GBM::GBM PROPERTIES
IMPORTED_LOCATION "${GBM_LIBRARIES}"
INTERFACE_COMPILE_OPTIONS "${GBM_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${GBM_INCLUDE_DIRS}"
)
endif()
mark_as_advanced(GBM_LIBRARIES GBM_INCLUDE_DIRS)
include(FeatureSummary)
set_package_properties(GBM PROPERTIES
URL "https://www.mesa3d.org"
DESCRIPTION "Mesa gbm library."
)
#.rst:
# FindPipeWire
# -------
#
# Try to find PipeWire on a Unix system.
#
# This will define the following variables:
#
# ``PipeWire_FOUND``
# True if (the requested version of) PipeWire is available
# ``PipeWire_VERSION``
# The version of PipeWire
# ``PipeWire_LIBRARIES``
# This can be passed to target_link_libraries() instead of the ``PipeWire::PipeWire``
# target
# ``PipeWire_INCLUDE_DIRS``
# This should be passed to target_include_directories() if the target is not
# used for linking
# ``PipeWire_DEFINITIONS``
# This should be passed to target_compile_options() if the target is not
# used for linking
#
# If ``PipeWire_FOUND`` is TRUE, it will also define the following imported target:
#
# ``PipeWire::PipeWire``
# The PipeWire library
#
# In general we recommend using the imported target, as it is easier to use.
# Bear in mind, however, that if the target is in the link interface of an
# exported library, it must be made available by the package config file.
#=============================================================================
# Copyright 2014 Alex Merry <alex.merry@kde.org>
# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
# Copyright 2018-2020 Jan Grulich <jgrulich@redhat.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# Use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig QUIET)
pkg_search_module(PKG_PipeWire QUIET libpipewire-0.3 libpipewire-0.2)
pkg_search_module(PKG_Spa QUIET libspa-0.2 libspa-0.1)
set(PipeWire_DEFINITIONS "${PKG_PipeWire_CFLAGS}" "${PKG_Spa_CFLAGS}")
set(PipeWire_VERSION "${PKG_PipeWire_VERSION}")
find_path(PipeWire_INCLUDE_DIRS
NAMES
pipewire/pipewire.h
HINTS
${PKG_PipeWire_INCLUDE_DIRS}
${PKG_PipeWire_INCLUDE_DIRS}/pipewire-0.3
)
find_path(Spa_INCLUDE_DIRS
NAMES
spa/param/props.h
HINTS
${PKG_Spa_INCLUDE_DIRS}
${PKG_Spa_INCLUDE_DIRS}/spa-0.2
)
find_library(PipeWire_LIBRARIES
NAMES
pipewire-0.3
pipewire-0.2
HINTS
${PKG_PipeWire_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PipeWire
FOUND_VAR
PipeWire_FOUND
REQUIRED_VARS
PipeWire_LIBRARIES
PipeWire_INCLUDE_DIRS
Spa_INCLUDE_DIRS
VERSION_VAR
PipeWire_VERSION
)
if(PipeWire_FOUND AND NOT TARGET PipeWire::PipeWire)
add_library(PipeWire::PipeWire UNKNOWN IMPORTED)
set_target_properties(PipeWire::PipeWire PROPERTIES
IMPORTED_LOCATION "${PipeWire_LIBRARIES}"
INTERFACE_COMPILE_OPTIONS "${PipeWire_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${PipeWire_INCLUDE_DIRS};${Spa_INCLUDE_DIRS}"
)
endif()
mark_as_advanced(PipeWire_LIBRARIES PipeWire_INCLUDE_DIRS)
include(FeatureSummary)
set_package_properties(PipeWire PROPERTIES
URL "https://www.pipewire.org"
DESCRIPTION "PipeWire - multimedia processing"
)
configure_file(org.freedesktop.impl.portal.desktop.kde.desktop.in org.freedesktop.impl.portal.desktop.kde.desktop @ONLY)
configure_file(org.freedesktop.impl.portal.desktop.kde.cmake.in org.freedesktop.impl.portal.desktop.kde.service @ONLY)
install(FILES kde.portal DESTINATION ${DATA_INSTALL_DIR}/xdg-desktop-portal/portals)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.impl.portal.desktop.kde.service DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR})
if(HAVE_PIPEWIRE_SUPPORT)
install(FILES kde.portal DESTINATION ${DATA_INSTALL_DIR}/xdg-desktop-portal/portals)
else()
install(FILES kde-no-pipewire.portal DESTINATION ${DATA_INSTALL_DIR}/xdg-desktop-portal/portals RENAME kde.portal)
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.impl.portal.desktop.kde.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
[portal]
DBusName=org.freedesktop.impl.portal.desktop.kde
Interfaces=org.freedesktop.impl.portal.Access;org.freedesktop.impl.portal.Account;org.freedesktop.impl.portal.AppChooser;org.freedesktop.impl.portal.Background;org.freedesktop.impl.portal.Email;org.freedesktop.impl.portal.FileChooser;org.freedesktop.impl.portal.Inhibit;org.freedesktop.impl.portal.Notification;org.freedesktop.impl.portal.Print;org.freedesktop.impl.portal.Screenshot;org.freedesktop.impl.portal.Settings
UseIn=KDE
[Desktop Entry]
Type=Application
Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/xdg-desktop-portal-kde
X-KDE-Wayland-Interfaces=org_kde_kwin_fake_input,org_kde_kwin_remote_access_manager,org_kde_plasma_window_management
X-KDE-Wayland-Interfaces=org_kde_kwin_fake_input,org_kde_plasma_window_management,zkde_screencast_unstable_v1
NoDisplay=true
Icon=kde
......@@ -24,28 +24,26 @@ set(xdg_desktop_portal_kde_SRCS
utils.cpp
userinfodialog.cpp
waylandintegration.cpp
screencast.cpp
screencasting.cpp
screencastwidget.cpp
screenchooserdialog.cpp
remotedesktop.cpp
remotedesktopdialog.cpp
)
if(HAVE_PIPEWIRE_SUPPORT)
set (xdg_desktop_portal_kde_SRCS
${xdg_desktop_portal_kde_SRCS}
screencast.cpp
screencaststream.cpp
screencastwidget.cpp
screenchooserdialog.cpp
remotedesktop.cpp
remotedesktopdialog.cpp)
ki18n_wrap_ui(xdg_desktop_portal_kde_SRCS
screenchooserdialog.ui
remotedesktopdialog.ui)
endif()
ki18n_wrap_ui(xdg_desktop_portal_kde_SRCS
accessdialog.ui
appchooserdialog.ui
screenshotdialog.ui
userinfodialog.ui
screenchooserdialog.ui
remotedesktopdialog.ui
)
ecm_add_qtwayland_client_protocol(xdg_desktop_portal_kde_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/screencast.xml
BASENAME zkde-screencast-unstable-v1
)
set_source_files_properties(../data/org.freedesktop.Accounts.User.xml PROPERTIES NO_NAMESPACE TRUE)
......@@ -70,14 +68,9 @@ target_link_libraries(xdg-desktop-portal-kde
KF5::WaylandClient
KF5::WidgetsAddons
KF5::WindowSystem
)
if (HAVE_PIPEWIRE_SUPPORT)
target_link_libraries(xdg-desktop-portal-kde
PipeWire::PipeWire
${Epoxy_LIBRARIES}
GBM::GBM)
endif()
Wayland::Client
)
install(TARGETS xdg-desktop-portal-kde DESTINATION ${KDE_INSTALL_LIBEXECDIR})
......@@ -88,4 +81,4 @@ install(FILES
install(FILES
xdg-desktop-portal-kde.notifyrc
DESTINATION ${KNOTIFYRC_INSTALL_DIR})
\ No newline at end of file
DESTINATION ${KNOTIFYRC_INSTALL_DIR})
......@@ -39,10 +39,8 @@ DesktopPortal::DesktopPortal(QObject *parent)
const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toUpper();
if (xdgCurrentDesktop == "KDE") {
m_background = new BackgroundPortal(this);
#if HAVE_PIPEWIRE_SUPPORT
m_screenCast = new ScreenCastPortal(this);
m_remoteDesktop = new RemoteDesktopPortal(this);
#endif
m_screenshot = new ScreenshotPortal(this);
WaylandIntegration::init();
}
......
......@@ -37,10 +37,8 @@
#include "settings.h"
#include "waylandintegration.h"
#if HAVE_PIPEWIRE_SUPPORT
#include "screencast.h"
#include "remotedesktop.h"
#endif
class DesktopPortal : public QObject, public QDBusContext
{
......@@ -61,11 +59,8 @@ private:
PrintPortal *m_print;
ScreenshotPortal *m_screenshot;
SettingsPortal *m_settings;
#if HAVE_PIPEWIRE_SUPPORT
ScreenCastPortal *m_screenCast;
RemoteDesktopPortal *m_remoteDesktop;
#endif
};
#endif // XDG_DESKTOP_PORTAL_KDE_DESKTOP_PORTAL_H
......@@ -55,8 +55,8 @@ uint RemoteDesktopPortal::CreateSession(const QDBusObjectPath &handle,
return 2;
}
connect(session, &Session::closed, [this] () {
WaylandIntegration::stopStreaming();
connect(session, &Session::closed, [] () {
WaylandIntegration::stopAllStreaming();
});
return 0;
......@@ -128,7 +128,7 @@ uint RemoteDesktopPortal::Start(const QDBusObjectPath &handle,
if (remoteDesktopDialog->exec()) {
if (session->screenSharingEnabled()) {
if (!WaylandIntegration::startStreaming(remoteDesktopDialog->selectedScreens().first())) {
if (!WaylandIntegration::startStreamingOutput(remoteDesktopDialog->selectedScreens().first(), Screencasting::Hidden)) {
return 2;
}
......
......@@ -44,6 +44,9 @@ RemoteDesktopDialog::RemoteDesktopDialog(const QString &appName, RemoteDesktopPo
}
}
m_dialog->screenCastWidget->itemAt(0, 0)->setSelected(true);
m_dialog->keyboardCheckbox->setChecked(deviceTypes.testFlag(RemoteDesktopPortal::Keyboard));
m_dialog->pointerCheckbox->setChecked(deviceTypes.testFlag(RemoteDesktopPortal::Pointer));
m_dialog->touchScreenCheckbox->setChecked(deviceTypes.testFlag(RemoteDesktopPortal::TouchScreen));
......
......@@ -57,8 +57,8 @@ uint ScreenCastPortal::CreateSession(const QDBusObjectPath &handle,
return 2;
}
connect(session, &Session::closed, [this] () {
WaylandIntegration::stopStreaming();
connect(session, &Session::closed, [] () {
WaylandIntegration::stopAllStreaming();
});
return 0;
......@@ -78,8 +78,6 @@ uint ScreenCastPortal::SelectSources(const QDBusObjectPath &handle,
qCDebug(XdgDesktopPortalKdeScreenCast) << " app_id: " << app_id;
qCDebug(XdgDesktopPortalKdeScreenCast) << " options: " << options;
uint types = Monitor;
ScreenCastSession *session = qobject_cast<ScreenCastSession*>(Session::getSession(session_handle.path()));
if (!session) {
......@@ -87,18 +85,7 @@ uint ScreenCastPortal::SelectSources(const QDBusObjectPath &handle,
return 2;
}
if (options.contains(QStringLiteral("multiple"))) {
session->setMultipleSources(options.value(QStringLiteral("multiple")).toBool());
}
if (options.contains(QStringLiteral("types"))) {
types = (SourceType)(options.value(QStringLiteral("types")).toUInt());
}
if (types == Window) {
qCWarning(XdgDesktopPortalKdeScreenCast) << "Screen cast of a window is not implemented";
return 2;
}
session->setMultipleSources(options.value(QStringLiteral("multiple")).toBool());
// Might be also a RemoteDesktopSession
if (session->type() == Session::RemoteDesktop) {
......@@ -139,19 +126,25 @@ uint ScreenCastPortal::Start(const QDBusObjectPath &handle,
return 2;
}
if (!WaylandIntegration::isEGLInitialized()) {
qCWarning(XdgDesktopPortalKdeScreenCast) << "EGL is not properly initialized";
return 2;
}
QScopedPointer<ScreenChooserDialog, QScopedPointerDeleteLater> screenDialog(new ScreenChooserDialog(app_id, session->multipleSources()));
Utils::setParentWindow(screenDialog.data(), parent_window);
if (options.contains(QStringLiteral("types"))) {
screenDialog->setSourceTypes(SourceTypes(options.value(QStringLiteral("types")).toUInt()));
}
connect(session, &Session::closed, screenDialog.data(), &ScreenChooserDialog::reject);
if (screenDialog->exec()) {
if (!WaylandIntegration::startStreaming(screenDialog->selectedScreens().first())) {
return 2;
for (quint32 outputid : screenDialog->selectedScreens()) {
if (!WaylandIntegration::startStreamingOutput(outputid, Screencasting::Hidden)) {
return 2;
}
}
for (const QByteArray &winid : screenDialog->selectedWindows()) {
if (!WaylandIntegration::startStreamingWindow(winid)) {
return 2;
}
}
QVariant streams = WaylandIntegration::streams();
......
......@@ -31,18 +31,29 @@ class ScreenCastPortal : public QDBusAbstractAdaptor
Q_CLASSINFO("D-Bus Interface", "org.freedesktop.impl.portal.ScreenCast")
Q_PROPERTY(uint version READ version)
Q_PROPERTY(uint AvailableSourceTypes READ AvailableSourceTypes)
Q_PROPERTY(uint AvailableCursorModes READ AvailableCursorModes)
public:
enum SourceType {
Any = 0,
Monitor,
Window
};
Q_ENUM(SourceType);
Q_DECLARE_FLAGS(SourceTypes, SourceType)
enum CursorModes {
Hidden = 1,
Embedded = 2,
Metadata = 4,
};
Q_ENUM(CursorModes);
explicit ScreenCastPortal(QObject *parent);
~ScreenCastPortal();
uint version() const { return 1; }
uint AvailableSourceTypes() const { return Monitor; };
uint AvailableCursorModes() const { return Hidden | Embedded; };
public Q_SLOTS:
uint CreateSession(const QDBusObjectPath &handle,
......
/*
SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "screencasting.h"
#include "qwayland-zkde-screencast-unstable-v1.h"
#include <QRect>
#include <QDebug>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/output.h>
#include <KWayland/Client/plasmawindowmanagement.h>
using namespace KWayland::Client;
class ScreencastingStreamPrivate : public QtWayland::zkde_screencast_stream_unstable_v1
{
public:
ScreencastingStreamPrivate(ScreencastingStream* q) : q(q) {}
~ScreencastingStreamPrivate() {
close();
q->deleteLater();
}
void zkde_screencast_stream_unstable_v1_created(uint32_t node) override {
m_nodeid = node;