mirror of
https://github.com/KDE/krfb
synced 2026-07-02 00:01:18 -07:00
Compare commits
45 Commits
v21.04.0
...
release/21
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
874c804ab8 | ||
|
|
383b437e18 | ||
|
|
336a82e188 | ||
|
|
b40ec95bd0 | ||
|
|
13316b761d | ||
|
|
8bf9b96ee3 | ||
|
|
3191a85976 | ||
|
|
99ef2060a8 | ||
|
|
320158de70 | ||
|
|
08bac276d3 | ||
|
|
6528ad1fcc | ||
|
|
cff205798c | ||
|
|
828a402b4a | ||
|
|
406ebc9e69 | ||
|
|
7fb0a163a5 | ||
|
|
c729e9e048 | ||
|
|
45548e020a | ||
|
|
dc64af6f5e | ||
|
|
2af26baf56 | ||
|
|
e07f2c1f11 | ||
|
|
e5e2b293e8 | ||
|
|
6cb2b22bf6 | ||
|
|
0316c376f2 | ||
|
|
b8f972d59e | ||
|
|
073cec3dc3 | ||
|
|
58088b6ca0 | ||
|
|
a4cc0e8e7b | ||
|
|
3a1a5ad7a2 | ||
|
|
8e667abe69 | ||
|
|
2e82546012 | ||
|
|
6f342f45ae | ||
|
|
acc70e4cee | ||
|
|
4d84d14070 | ||
|
|
adc8b8069c | ||
|
|
218f0e20f6 | ||
|
|
4f2861415a | ||
|
|
eb1dc503bd | ||
|
|
8f0de62401 | ||
|
|
028ac099ea | ||
|
|
5e18689b8e | ||
|
|
68866dc4fa | ||
|
|
15f5654e5b | ||
|
|
76e36c0761 | ||
|
|
0afcfc82b9 | ||
|
|
730e4d74a8 |
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# Ignore the following files
|
||||
*~
|
||||
*.[oa]
|
||||
*.diff
|
||||
*.kate-swp
|
||||
*.kdev4
|
||||
.kdev_include_paths
|
||||
*.kdevelop.pcs
|
||||
*.moc
|
||||
*.moc.cpp
|
||||
*.orig
|
||||
*.user
|
||||
.*.swp
|
||||
.swp.*
|
||||
Doxyfile
|
||||
Makefile
|
||||
/build*/
|
||||
.cmake/
|
||||
CMakeLists.txt.user*
|
||||
*.unc-backup*
|
||||
.clang-format
|
||||
/compile_commands.json
|
||||
.clangd
|
||||
.cache
|
||||
.idea
|
||||
/cmake-build*
|
||||
@@ -1,15 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# KDE Application Version, managed by release script
|
||||
set (RELEASE_SERVICE_VERSION_MAJOR "21")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "03")
|
||||
set (RELEASE_SERVICE_VERSION_MICRO "70")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "08")
|
||||
set (RELEASE_SERVICE_VERSION_MICRO "3")
|
||||
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
|
||||
|
||||
project(krfb VERSION ${RELEASE_SERVICE_VERSION})
|
||||
|
||||
set(QT_MIN_VERSION 5.12.0)
|
||||
set(KF5_MIN_VERSION 5.68.0)
|
||||
set(QT_MIN_VERSION 5.15.0)
|
||||
set(KF5_MIN_VERSION 5.83.0)
|
||||
|
||||
find_package(ECM ${KF5_MIN_VERSION} NO_MODULE REQUIRED)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${ECM_MODULE_PATH})
|
||||
@@ -77,12 +77,35 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} )
|
||||
|
||||
find_package(LibVNCServer REQUIRED)
|
||||
|
||||
find_package(PipeWire)
|
||||
set_package_properties(PipeWire PROPERTIES
|
||||
|
||||
pkg_check_modules(PipeWire IMPORTED_TARGET libpipewire-0.3)
|
||||
add_feature_info(PipeWire PipeWire_FOUND "Required for pipewire screencast plugin")
|
||||
|
||||
find_package(gbm)
|
||||
set_package_properties(gbm PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required for pipewire screencast plugin"
|
||||
PURPOSE "Required for dma-buf support in pipewire screencast plugin."
|
||||
)
|
||||
|
||||
find_package(EGL)
|
||||
set_package_properties(EGL PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required for dma-buf support in pipewire screencast plugin."
|
||||
)
|
||||
|
||||
find_package(epoxy)
|
||||
set_package_properties(epoxy PROPERTIES DESCRIPTION "libepoxy"
|
||||
URL "https://github.com/anholt/libepoxy"
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required for dma-buf support in pipewire screencast plugin."
|
||||
)
|
||||
|
||||
if(EGL_FOUND AND gbm_FOUND AND epoxy_FOUND)
|
||||
set (HAVE_DMA_BUF TRUE)
|
||||
else()
|
||||
set (HAVE_DMA_BUF FALSE)
|
||||
endif()
|
||||
|
||||
ecm_setup_version(PROJECT
|
||||
VARIABLE_PREFIX KRFB
|
||||
VERSION_HEADER "krfb_version.h")
|
||||
|
||||
128
CMakePresets.json
Normal file
128
CMakePresets.json
Normal file
@@ -0,0 +1,128 @@
|
||||
{
|
||||
"version": 2,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "dev",
|
||||
"displayName": "Build as debug",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "asan",
|
||||
"displayName": "Build with Asan support.",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-asan",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"ECM_ENABLE_SANITIZERS" : "'address;undefined'",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-clang",
|
||||
"displayName": "dev-clang",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-clang",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
},
|
||||
"environment": {
|
||||
"CXX": "clang++",
|
||||
"CCACHE_DISABLE": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "unity",
|
||||
"displayName": "Build with CMake unity support.",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-unity",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_UNITY_BUILD": "ON",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"displayName": "Build as release mode.",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "profile",
|
||||
"displayName": "profile",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-profile",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "clazy",
|
||||
"displayName": "clazy",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-clazy",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
},
|
||||
"environment": {
|
||||
"CXX": "clazy",
|
||||
"CCACHE_DISABLE": "ON"
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "dev",
|
||||
"configurePreset": "dev"
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"configurePreset": "release"
|
||||
},
|
||||
{
|
||||
"name": "dev-clang",
|
||||
"configurePreset": "dev-clang"
|
||||
},
|
||||
{
|
||||
"name": "asan",
|
||||
"configurePreset": "asan"
|
||||
},
|
||||
{
|
||||
"name": "unity",
|
||||
"configurePreset": "unity"
|
||||
},
|
||||
{
|
||||
"name": "clazy",
|
||||
"configurePreset": "clazy",
|
||||
"environment": {
|
||||
"CLAZY_CHECKS" : "level0,level1,detaching-member,ifndef-define-typo,isempty-vs-count,qrequiredresult-candidates,reserve-candidates,signal-with-return-value,unneeded-cast,function-args-by-ref,function-args-by-value,returning-void-expression,no-ctor-missing-parent-argument,isempty-vs-count,qhash-with-char-pointer-key,raw-environment-function,qproperty-type-mismatch,old-style-connect,qstring-allocations,container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,qstring-varargs,level2,detaching-member,heap-allocated-small-trivial-type,isempty-vs-count,qstring-varargs,qvariant-template-instantiation,raw-environment-function,reserve-candidates,signal-with-return-value,thread-with-slots,no-ctor-missing-parent-argument,no-missing-typeinfo",
|
||||
"CCACHE_DISABLE" : "ON"
|
||||
}
|
||||
}
|
||||
],
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "dev",
|
||||
"configurePreset": "dev",
|
||||
"output": {"outputOnFailure": true},
|
||||
"execution": {"noTestsAction": "error", "stopOnFailure": false}
|
||||
},
|
||||
{
|
||||
"name": "asan",
|
||||
"configurePreset": "asan",
|
||||
"output": {"outputOnFailure": true},
|
||||
"execution": {"noTestsAction": "error", "stopOnFailure": true}
|
||||
}
|
||||
]
|
||||
}
|
||||
2
CMakePresets.json.license
Normal file
2
CMakePresets.json.license
Normal file
@@ -0,0 +1,2 @@
|
||||
# SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
@@ -1,122 +0,0 @@
|
||||
#.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"
|
||||
)
|
||||
104
cmake/modules/Findgbm.cmake
Normal file
104
cmake/modules/Findgbm.cmake
Normal file
@@ -0,0 +1,104 @@
|
||||
#.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.
|
||||
|
||||
#=============================================================================
|
||||
# SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
|
||||
# SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#=============================================================================
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||
message(FATAL_ERROR "CMake 2.8.12 is required by Findgbm.cmake")
|
||||
endif()
|
||||
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
|
||||
message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Findgbm.cmake")
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
# Use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PKG_gbm QUIET gbm)
|
||||
|
||||
set(gbm_DEFINITIONS ${PKG_gbm_CFLAGS_OTHER})
|
||||
set(gbm_VERSION ${PKG_gbm_VERSION})
|
||||
|
||||
find_path(gbm_INCLUDE_DIR
|
||||
NAMES
|
||||
gbm.h
|
||||
HINTS
|
||||
${PKG_gbm_INCLUDE_DIRS}
|
||||
)
|
||||
find_library(gbm_LIBRARY
|
||||
NAMES
|
||||
gbm
|
||||
HINTS
|
||||
${PKG_gbm_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(gbm
|
||||
FOUND_VAR
|
||||
gbm_FOUND
|
||||
REQUIRED_VARS
|
||||
gbm_LIBRARY
|
||||
gbm_INCLUDE_DIR
|
||||
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_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${gbm_DEFINITIONS}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${gbm_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(gbm_LIBRARY gbm_INCLUDE_DIR)
|
||||
|
||||
# compatibility variables
|
||||
set(gbm_LIBRARIES ${gbm_LIBRARY})
|
||||
set(gbm_INCLUDE_DIRS ${gbm_INCLUDE_DIR})
|
||||
set(gbm_VERSION_STRING ${gbm_VERSION})
|
||||
|
||||
else()
|
||||
message(STATUS "Findgbm.cmake cannot find gbm on Windows systems.")
|
||||
set(gbm_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(gbm PROPERTIES
|
||||
URL "https://www.mesa3d.org"
|
||||
DESCRIPTION "Mesa gbm library."
|
||||
)
|
||||
@@ -15,4 +15,4 @@ target_link_libraries (krfb_events_x11
|
||||
krfbprivate
|
||||
)
|
||||
|
||||
install (TARGETS krfb_events_x11 DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb)
|
||||
install (TARGETS krfb_events_x11 DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb/events)
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Comment=X11 XFakeInput based event handler for KRfb
|
||||
Comment[ca]=Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb
|
||||
Comment[ca@valencia]=Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb
|
||||
Comment[da]=X11 XFakeInput baseret hændelseshåndtering til KRfb
|
||||
Comment[de]=Ereignis-Modul basierend auf X11 XFakeInput für KRfb
|
||||
Comment[el]=Χειριστής γεγονότων με βάση το X11 XFakeInput για το KRfb
|
||||
Comment[en_GB]=X11 XFakeInput based event handler for KRfb
|
||||
Comment[es]=Gestor de eventos basado en XFakeInput de X11 para KRfb
|
||||
Comment[et]=KRfb X11 XFakeInput'i põhine sündmuste käitleja
|
||||
Comment[eu]=KRfb-rako «X11 XFakeInput»en oinarritutako gertaera maneiatzailea
|
||||
Comment[fi]=KRfb:n X11 XFakeInput -pohjainen tapahtumakäsittelijä
|
||||
Comment[fr]=Gestionnaire d'évènements utilisant XFakeInput de X11 pour KRfb
|
||||
Comment[gl]=Xestor de eventos para KRfb baseado no XFakeInput de X11
|
||||
Comment[ia]=Maneator de evento de X11 basate sur XFakeInput per KRfb
|
||||
Comment[it]=Gestore eventi basato su XFakeInput di X11 per KRfb
|
||||
Comment[ko]=X11 XFakeInput 기반 KRfb 이벤트 핸들러
|
||||
Comment[nl]=Op X11 XFakeInput gebaseerde behandelaar van gebeurtenis voor KRfb
|
||||
Comment[nn]=X11 XFakeInput-basert hendingshandtering for KRfb
|
||||
Comment[pl]=Obsługa wydarzeń X11 oparta na XFakeInput dla KRfb
|
||||
Comment[pt]=Tratamento de eventos baseado no XFakeInput do X11 para o KRfb
|
||||
Comment[pt_BR]=Manipulador de eventos baseado no XFakeInput do X11 para o KRfb
|
||||
Comment[sk]=X11 Spracovateľ udalostí založený na XFakeInput pre KRfb
|
||||
Comment[sl]=Upravljalnik dogodkov za KRfb na podlagi X11 XFakeInput
|
||||
Comment[sv]=Händelsehanterare för Krfb baserad på X11 XFakeInput
|
||||
Comment[uk]=Обробник подій для KRfb на основі XFakeInput X11
|
||||
Comment[x-test]=xxX11 XFakeInput based event handler for KRfbxx
|
||||
Comment[zh_CN]=基于 X11 XFakeInput 的 KRfb 事件处理器
|
||||
Comment[zh_TW]=KRfb 基於 X11 XFakeInput 的事件處理器
|
||||
Name=X11 XFakeInput based event handler for KRfb
|
||||
Name[ca]=Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb
|
||||
Name[ca@valencia]=Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb
|
||||
Name[da]=X11 XFakeInput baseret hændelseshåndtering til KRfb
|
||||
Name[de]=Ereignis-Modul basierend auf X11 XFakeInput für KRfb
|
||||
Name[el]=Χειριστής γεγονότων με βάση το X11 XFakeInput για το KRfb
|
||||
Name[en_GB]=X11 XFakeInput based event handler for KRfb
|
||||
Name[es]=Gestor de eventos basado en XFakeInput de X11 para KRfb
|
||||
Name[et]=KRfb X11 XFakeInput'i põhine sündmuste käitleja
|
||||
Name[eu]=KRfb-rako «X11 XFakeInput»en oinarritutako gertaera maneiatzailea
|
||||
Name[fi]=KRfb:n X11 XFakeInput -pohjainen tapahtumakäsittelijä
|
||||
Name[fr]=Gestionnaire d'évènements utilisant XFakeInput de X11 pour KRfb
|
||||
Name[gl]=Xestor de eventos para KRfb baseado no XFakeInput de X11
|
||||
Name[ia]=Maneator de evento de X11 basate sur XFakeInput per KRfb
|
||||
Name[it]=Gestore eventi basato su XFakeInput di X11 per KRfb
|
||||
Name[ko]=X11 XFakeInput 기반 KRfb 이벤트 핸들러
|
||||
Name[nl]=Op X11 XFakeInput gebaseerde behandelaar van gebeurtenis voor KRfb
|
||||
Name[nn]=X11 XFakeInput-basert hendingshandtering for KRfb
|
||||
Name[pl]=Obsługa wydarzeń X11 oparta na XFakeInput dla KRfb
|
||||
Name[pt]=Tratamento de eventos baseado no XFakeInput do X11 para o KRfb
|
||||
Name[pt_BR]=Manipulador de eventos baseado no XFakeInput do X11 para o KRfb
|
||||
Name[sk]=X11 Spracovateľ udalostí založený na XFakeInput pre KRfb
|
||||
Name[sl]=Upravljalnik dogodkov za KRfb na podlagi X11 XFakeInput
|
||||
Name[sv]=Händelsehanterare för Krfb baserad på X11 XFakeInput
|
||||
Name[uk]=Обробник подій для KRfb на основі XFakeInput X11
|
||||
Name[x-test]=xxX11 XFakeInput based event handler for KRfbxx
|
||||
Name[zh_CN]=基于 X11 XFakeInput 的 KRfb 事件处理器
|
||||
Name[zh_TW]=KRfb 基於 X11 XFakeInput 的事件處理器
|
||||
Type=Service
|
||||
ServiceTypes=krfb/events
|
||||
|
||||
X-KDE-Library=krfb_events_x11
|
||||
X-KDE-PluginInfo-Name=x11
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=https://www.kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
@@ -60,9 +60,6 @@
|
||||
"Name[x-test]": "xxX11 Event handler for KRfbxx",
|
||||
"Name[zh_CN]": "X11 KRfb 事件处理器",
|
||||
"Name[zh_TW]": "KRfb 的 X11 事件處理器",
|
||||
"ServiceTypes": [
|
||||
"krfb/events"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "http://www.kde.org"
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ target_link_libraries (krfb_events_xdp
|
||||
)
|
||||
|
||||
install (TARGETS krfb_events_xdp
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb/events
|
||||
)
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Comment=Xdg-desktop-portal based event handler for KRfb
|
||||
Comment[ca]=Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb
|
||||
Comment[ca@valencia]=Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb
|
||||
Comment[da]=Xdg-desktop-portal baseret hændelseshåndtering til KRfb
|
||||
Comment[de]=Ereignis-Modul basierend auf Xdg-desktop-portal für KRfb
|
||||
Comment[el]=Χειριστής γεγονότων με βάση το xdg-desktop-portal για το KRfb
|
||||
Comment[en_GB]=Xdg-desktop-portal based event handler for KRfb
|
||||
Comment[es]=Gestor de eventos basado en Xdg-desktop-portal para KRfb
|
||||
Comment[et]=KRfb Xdg-desktop-portal'i põhine sündmuste käitleja
|
||||
Comment[eu]=KRfb-rako «xdg-desktop-portal»en oinarritutako maneiatzailea
|
||||
Comment[fi]=KRfb:n XDG-desktop-portal-pohjainen tapahtumakäsittelijä
|
||||
Comment[fr]=Gestionnaire d'évènements utilisant Xdg-desktop-portal pour KRfb
|
||||
Comment[gl]=Xestor de eventos para KRfb baseado en Xdg-desktop-portal
|
||||
Comment[ia]=Maneator de evento basate sur Xdg-desktop-portal per KRfb
|
||||
Comment[it]=Gestore eventi basato su xdg-desktop-portal per KRfb
|
||||
Comment[ko]=Xdg-desktop-portal 기반 KRfb 이벤트 핸들러
|
||||
Comment[nl]=Op Xdg-desktop-portal gebaseerde behandelaar van gebeurtenis voor KRfb
|
||||
Comment[nn]=Xdg-desktop-portal-basert hendingshandtering for KRfb
|
||||
Comment[pl]=Obsługa wydarzeń oparta na Xdg-desktop-portal dla KRfb
|
||||
Comment[pt]=Tratamento de eventos baseado no Xdg-desktop-portal para o KRfb
|
||||
Comment[pt_BR]=Manipulador de eventos baseado no xdg-desktop-portal para o KRfb
|
||||
Comment[sk]=Obsluha udalostí založená na Xdg-desktop-portal pre KRfb
|
||||
Comment[sl]=Upravljalnik dogodkov za KRfb na podlagi namiznega portala Xdg
|
||||
Comment[sv]=Händelsehanterare för Krfb baserad på xdg-desktop-portal
|
||||
Comment[uk]=Обробник подій для KRfb на основі Xdg-desktop-portal
|
||||
Comment[x-test]=xxXdg-desktop-portal based event handler for KRfbxx
|
||||
Comment[zh_CN]=基于 xdg-desktop-portal 的 KRfb 事件处理器
|
||||
Comment[zh_TW]=KRfb 基於 Xdg-desktop-portal 的事件處理器
|
||||
Name=Xdg-desktop-portal based event handler for KRfb
|
||||
Name[ca]=Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb
|
||||
Name[ca@valencia]=Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb
|
||||
Name[da]=Xdg-desktop-portal baseret hændelseshåndtering til KRfb
|
||||
Name[de]=Ereignis-Modul basierend auf Xdg-desktop-portal für KRfb
|
||||
Name[el]=Χειριστής γεγονότων με βάση το xdg-desktop-portal για το KRfb
|
||||
Name[en_GB]=Xdg-desktop-portal based event handler for KRfb
|
||||
Name[es]=Gestor de eventos basado en Xdg-desktop-portal para KRfb
|
||||
Name[et]=KRfb Xdg-desktop-portal'i põhine sündmuste käitleja
|
||||
Name[eu]=KRfb-rako «xdg-desktop-portal»en oinarritutako maneiatzailea
|
||||
Name[fi]=KRfb:n XDG-desktop-portal-pohjainen tapahtumakäsittelijä
|
||||
Name[fr]=Gestionnaire d'évènements utilisant Xdg-desktop-portal pour KRfb
|
||||
Name[gl]=Xestor de eventos para KRfb baseado en Xdg-desktop-portal
|
||||
Name[ia]=Mneator de evento basate sur Xdg-desktop-portal per KRfb
|
||||
Name[it]=Gestore eventi basato su xdg-desktop-portal per KRfb
|
||||
Name[ko]=Xdg-desktop-portal 기반 KRfb 이벤트 핸들러
|
||||
Name[nl]=Op Xdg-desktop-portal gebaseerde behandelaar van gebeurtenis voor KRfb
|
||||
Name[nn]=Xdg-desktop-portal-basert hendingshandtering for KRfb
|
||||
Name[pl]=Obsługa wydarzeń oparta na Xdg-desktop-portal dla KRfb
|
||||
Name[pt]=Tratamento de eventos baseado no Xdg-desktop-portal para o KRfb
|
||||
Name[pt_BR]=Manipulador de eventos baseado no xdg-desktop-portal para o KRfb
|
||||
Name[sk]=Obsluha udalostí založená na Xdg-desktop-portal pre KRfb
|
||||
Name[sl]=Upravljalnik dogodkov za KRfb na podlagi namiznega portala Xdg
|
||||
Name[sv]=Händelsehanterare för Krfb baserad på xdg-desktop-portal
|
||||
Name[uk]=Обробник подій для KRfb на основі Xdg-desktop-portal
|
||||
Name[x-test]=xxXdg-desktop-portal based event handler for KRfbxx
|
||||
Name[zh_CN]=基于 xdg-desktop-portal 的 KRfb 事件处理器
|
||||
Name[zh_TW]=KRfb 基於 Xdg-desktop-portal 的事件處理器
|
||||
Type=Service
|
||||
ServiceTypes=krfb/events
|
||||
|
||||
X-KDE-Library=krfb_events_xdp
|
||||
X-KDE-PluginInfo-Name=xdp
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=https://www.kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
|
||||
@@ -60,9 +60,6 @@
|
||||
"Name[x-test]": "xxXdg-desktop-portal Event handler for KRfbxx",
|
||||
"Name[zh_CN]": "xdg-desktop-portal KRfb 事件处理器",
|
||||
"Name[zh_TW]": "KRfb 的 Xdg-desktop-portal 事件處理器",
|
||||
"ServiceTypes": [
|
||||
"krfb/events"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "http://www.kde.org"
|
||||
}
|
||||
|
||||
@@ -33,21 +33,22 @@ add_library(krfb_framebuffer_pw
|
||||
${krfb_framebuffer_pw_SRCS}
|
||||
)
|
||||
|
||||
|
||||
check_include_file("linux/dma-buf.h" HAVE_LINUX_DMABUF_H)
|
||||
if (HAVE_LINUX_DMABUF_H)
|
||||
target_compile_definitions(krfb_framebuffer_pw PRIVATE -DHAVE_LINUX_DMABUF_H)
|
||||
endif ()
|
||||
|
||||
target_link_libraries (krfb_framebuffer_pw
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::DBus
|
||||
KF5::CoreAddons
|
||||
krfbprivate
|
||||
PipeWire::PipeWire
|
||||
target_link_libraries(krfb_framebuffer_pw
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::DBus
|
||||
KF5::CoreAddons
|
||||
krfbprivate
|
||||
PkgConfig::PipeWire
|
||||
)
|
||||
|
||||
if (HAVE_DMA_BUF)
|
||||
target_link_libraries(krfb_framebuffer_pw
|
||||
${epoxy_LIBRARIES}
|
||||
gbm::gbm
|
||||
)
|
||||
endif()
|
||||
|
||||
install (TARGETS krfb_framebuffer_pw
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb/framebuffer
|
||||
)
|
||||
|
||||
@@ -64,9 +64,6 @@
|
||||
"Name[x-test]": "xxPipeWire Framebuffer for KRfbxx",
|
||||
"Name[zh_CN]": "KRfb 的 PipeWire 帧缓冲机制",
|
||||
"Name[zh_TW]": "KRfb 的 PipeWire Framebuffer",
|
||||
"ServiceTypes": [
|
||||
"krfb/framebuffer"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "http://www.kde.org"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2018-2021 Jan Grulich <jgrulich@redhat.com>
|
||||
Copyright (C) 2018 Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
Copyright (C) 2018 Jan Grulich <jgrulich@redhat.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
@@ -8,6 +8,8 @@
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "config-krfb.h"
|
||||
|
||||
// system
|
||||
#include <sys/mman.h>
|
||||
#include <cstring>
|
||||
@@ -18,24 +20,15 @@
|
||||
#include <QScreen>
|
||||
#include <QSocketNotifier>
|
||||
#include <QDebug>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
// pipewire
|
||||
#include <pipewire/version.h>
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
#include <spa/utils/result.h>
|
||||
#ifdef HAVE_LINUX_DMABUF_H
|
||||
#include <linux/dma-buf.h>
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <spa/param/format-utils.h>
|
||||
#include <spa/param/video/format-utils.h>
|
||||
#include <spa/param/props.h>
|
||||
#include <spa/utils/result.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
@@ -46,6 +39,16 @@
|
||||
#include "xdp_dbus_remotedesktop_interface.h"
|
||||
#include "krfb_fb_pipewire_debug.h"
|
||||
|
||||
#if HAVE_DMA_BUF
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <gbm.h>
|
||||
#include <epoxy/egl.h>
|
||||
#include <epoxy/gl.h>
|
||||
#endif /* HAVE_DMA_BUF */
|
||||
|
||||
static const int BYTES_PER_PIXEL = 4;
|
||||
static const uint MIN_SUPPORTED_XDP_KDE_SC_VERSION = 1;
|
||||
|
||||
Q_DECLARE_METATYPE(PWFrameBuffer::Stream);
|
||||
@@ -71,18 +74,29 @@ const QDBusArgument &operator >> (const QDBusArgument &arg, PWFrameBuffer::Strea
|
||||
return arg;
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
/**
|
||||
* @brief The PwType class - helper class to contain pointers to raw C pipewire media mappings
|
||||
*/
|
||||
class PwType {
|
||||
public:
|
||||
spa_type_media_type media_type;
|
||||
spa_type_media_subtype media_subtype;
|
||||
spa_type_format_video format_video;
|
||||
spa_type_video_format video_format;
|
||||
};
|
||||
#endif
|
||||
#if HAVE_DMA_BUF
|
||||
const char * formatGLError(GLenum err)
|
||||
{
|
||||
switch(err) {
|
||||
case GL_NO_ERROR:
|
||||
return "GL_NO_ERROR";
|
||||
case GL_INVALID_ENUM:
|
||||
return "GL_INVALID_ENUM";
|
||||
case GL_INVALID_VALUE:
|
||||
return "GL_INVALID_VALUE";
|
||||
case GL_INVALID_OPERATION:
|
||||
return "GL_INVALID_OPERATION";
|
||||
case GL_STACK_OVERFLOW:
|
||||
return "GL_STACK_OVERFLOW";
|
||||
case GL_STACK_UNDERFLOW:
|
||||
return "GL_STACK_UNDERFLOW";
|
||||
case GL_OUT_OF_MEMORY:
|
||||
return "GL_OUT_OF_MEMORY";
|
||||
default:
|
||||
return (QLatin1String("0x") + QString::number(err, 16)).toLocal8Bit().constData();
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_DMA_BUF */
|
||||
|
||||
/**
|
||||
* @brief The PWFrameBuffer::Private class - private counterpart of PWFramebuffer class. This is the entity where
|
||||
@@ -96,21 +110,13 @@ public:
|
||||
private:
|
||||
friend class PWFrameBuffer;
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
static void onCoreError(void *data, uint32_t id, int seq, int res, const char *message);
|
||||
static void onStreamParamChanged(void *data, uint32_t id, const struct spa_pod *format);
|
||||
#else
|
||||
static void onStateChanged(void *data, pw_remote_state old, pw_remote_state state, const char *error);
|
||||
static void onStreamFormatChanged(void *data, const struct spa_pod *format);
|
||||
#endif
|
||||
static void onStreamStateChanged(void *data, pw_stream_state old, pw_stream_state state, const char *error_message);
|
||||
static void onStreamProcess(void *data);
|
||||
|
||||
void initDbus();
|
||||
void initPw();
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
void initializePwTypes();
|
||||
#endif
|
||||
|
||||
// dbus handling
|
||||
void handleSessionCreated(quint32 &code, QVariantMap &results);
|
||||
@@ -126,7 +132,6 @@ private:
|
||||
PWFrameBuffer *q;
|
||||
|
||||
// pipewire stuff
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
struct pw_context *pwContext = nullptr;
|
||||
struct pw_core *pwCore = nullptr;
|
||||
struct pw_stream *pwStream = nullptr;
|
||||
@@ -140,22 +145,6 @@ private:
|
||||
// event handlers
|
||||
pw_core_events pwCoreEvents = {};
|
||||
pw_stream_events pwStreamEvents = {};
|
||||
#else
|
||||
pw_core *pwCore = nullptr;
|
||||
pw_loop *pwLoop = nullptr;
|
||||
pw_thread_loop *pwMainLoop = nullptr;
|
||||
pw_stream *pwStream = nullptr;
|
||||
pw_remote *pwRemote = nullptr;
|
||||
pw_type *pwCoreType = nullptr;
|
||||
PwType *pwType = nullptr;
|
||||
|
||||
spa_hook remoteListener = {};
|
||||
spa_hook streamListener = {};
|
||||
|
||||
// event handlers
|
||||
pw_remote_events pwRemoteEvents = {};
|
||||
pw_stream_events pwStreamEvents = {};
|
||||
#endif
|
||||
|
||||
uint pwStreamNodeId = 0;
|
||||
|
||||
@@ -173,21 +162,32 @@ private:
|
||||
QDBusUnixFileDescriptor pipewireFd;
|
||||
|
||||
// screen geometry holder
|
||||
struct {
|
||||
quint32 width;
|
||||
quint32 height;
|
||||
} screenGeometry = {};
|
||||
QSize streamSize;
|
||||
QSize videoSize;
|
||||
|
||||
// Allowed devices
|
||||
uint devices = 0;
|
||||
|
||||
// sanity indicator
|
||||
bool isValid = true;
|
||||
|
||||
#if HAVE_DMA_BUF
|
||||
struct EGLStruct {
|
||||
QList<QByteArray> extensions;
|
||||
EGLDisplay display = EGL_NO_DISPLAY;
|
||||
EGLContext context = EGL_NO_CONTEXT;
|
||||
};
|
||||
|
||||
bool m_eglInitialized = false;
|
||||
qint32 m_drmFd = 0; // for GBM buffer mmap
|
||||
gbm_device *m_gbmDevice = nullptr; // for passed GBM buffer retrieval
|
||||
|
||||
EGLStruct m_egl;
|
||||
#endif /* HAVE_DMA_BUF */
|
||||
};
|
||||
|
||||
PWFrameBuffer::Private::Private(PWFrameBuffer *q) : q(q)
|
||||
{
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
pwCoreEvents.version = PW_VERSION_CORE_EVENTS;
|
||||
pwCoreEvents.error = &onCoreError;
|
||||
|
||||
@@ -195,16 +195,72 @@ PWFrameBuffer::Private::Private(PWFrameBuffer *q) : q(q)
|
||||
pwStreamEvents.state_changed = &onStreamStateChanged;
|
||||
pwStreamEvents.param_changed = &onStreamParamChanged;
|
||||
pwStreamEvents.process = &onStreamProcess;
|
||||
#else
|
||||
// initialize event handlers, remote end and stream-related
|
||||
pwRemoteEvents.version = PW_VERSION_REMOTE_EVENTS;
|
||||
pwRemoteEvents.state_changed = &onStateChanged;
|
||||
|
||||
pwStreamEvents.version = PW_VERSION_STREAM_EVENTS;
|
||||
pwStreamEvents.state_changed = &onStreamStateChanged;
|
||||
pwStreamEvents.format_changed = &onStreamFormatChanged;
|
||||
pwStreamEvents.process = &onStreamProcess;
|
||||
#endif
|
||||
#if HAVE_DMA_BUF
|
||||
m_drmFd = open("/dev/dri/renderD128", O_RDWR);
|
||||
|
||||
if (m_drmFd < 0) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to open drm render node: " << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
m_gbmDevice = gbm_create_device(m_drmFd);
|
||||
|
||||
if (!m_gbmDevice) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Cannot create GBM device: " << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the list of client extensions
|
||||
const char* clientExtensionsCString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
||||
const QByteArray clientExtensionsString = QByteArray::fromRawData(clientExtensionsCString, qstrlen(clientExtensionsCString));
|
||||
if (clientExtensionsString.isEmpty()) {
|
||||
// If eglQueryString() returned NULL, the implementation doesn't support
|
||||
// EGL_EXT_client_extensions. Expect an EGL_BAD_DISPLAY error.
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "No client extensions defined! " << formatGLError(eglGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
m_egl.extensions = clientExtensionsString.split(' ');
|
||||
|
||||
// Use eglGetPlatformDisplayEXT() to get the display pointer
|
||||
// if the implementation supports it.
|
||||
if (!m_egl.extensions.contains(QByteArrayLiteral("EGL_EXT_platform_base")) ||
|
||||
!m_egl.extensions.contains(QByteArrayLiteral("EGL_MESA_platform_gbm"))) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "One of required EGL extensions is missing";
|
||||
return;
|
||||
}
|
||||
|
||||
m_egl.display = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, m_gbmDevice, nullptr);
|
||||
|
||||
if (m_egl.display == EGL_NO_DISPLAY) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Error during obtaining EGL display: " << formatGLError(eglGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
EGLint major, minor;
|
||||
if (eglInitialize(m_egl.display, &major, &minor) == EGL_FALSE) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Error during eglInitialize: " << formatGLError(eglGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
if (eglBindAPI(EGL_OPENGL_API) == EGL_FALSE) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "bind OpenGL API failed";
|
||||
return;
|
||||
}
|
||||
|
||||
m_egl.context = eglCreateContext(m_egl.display, nullptr, EGL_NO_CONTEXT, nullptr);
|
||||
|
||||
if (m_egl.context == EGL_NO_CONTEXT) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Couldn't create EGL context: " << formatGLError(eglGetError());
|
||||
return;
|
||||
}
|
||||
|
||||
qCDebug(KRFB_FB_PIPEWIRE) << "Egl initialization succeeded";
|
||||
qCDebug(KRFB_FB_PIPEWIRE) << QStringLiteral("EGL version: %1.%2").arg(major).arg(minor);
|
||||
|
||||
m_eglInitialized = true;
|
||||
#endif /* HAVE_DMA_BUF */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,13 +286,8 @@ void PWFrameBuffer::Private::initDbus()
|
||||
|
||||
// create session
|
||||
auto sessionParameters = QVariantMap {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
{ QStringLiteral("session_handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) },
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
|
||||
#else
|
||||
{ QStringLiteral("session_handle_token"), QStringLiteral("krfb%1").arg(qrand()) },
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
|
||||
#endif
|
||||
};
|
||||
auto sessionReply = dbusXdpRemoteDesktopService->CreateSession(sessionParameters);
|
||||
sessionReply.waitForFinished();
|
||||
@@ -281,11 +332,7 @@ void PWFrameBuffer::Private::handleSessionCreated(quint32 &code, QVariantMap &re
|
||||
auto selectionOptions = QVariantMap {
|
||||
// We have to specify it's an uint, otherwise xdg-desktop-portal will not forward it to backend implementation
|
||||
{ QStringLiteral("types"), QVariant::fromValue<uint>(7) }, // request all (KeyBoard, Pointer, TouchScreen)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
|
||||
#else
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
|
||||
#endif
|
||||
};
|
||||
auto selectorReply = dbusXdpRemoteDesktopService->SelectDevices(sessionPath, selectionOptions);
|
||||
selectorReply.waitForFinished();
|
||||
@@ -326,11 +373,7 @@ void PWFrameBuffer::Private::handleDevicesSelected(quint32 &code, QVariantMap &r
|
||||
auto selectionOptions = QVariantMap {
|
||||
{ QStringLiteral("types"), QVariant::fromValue<uint>(1) }, // only MONITOR is supported
|
||||
{ QStringLiteral("multiple"), false },
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
|
||||
#else
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
|
||||
#endif
|
||||
};
|
||||
auto selectorReply = dbusXdpScreenCastService->SelectSources(sessionPath, selectionOptions);
|
||||
selectorReply.waitForFinished();
|
||||
@@ -370,11 +413,7 @@ void PWFrameBuffer::Private::handleSourcesSelected(quint32 &code, QVariantMap &)
|
||||
|
||||
// start session
|
||||
auto startParameters = QVariantMap {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
|
||||
#else
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
|
||||
#endif
|
||||
};
|
||||
auto startReply = dbusXdpRemoteDesktopService->Start(sessionPath, QString(), startParameters);
|
||||
startReply.waitForFinished();
|
||||
@@ -431,25 +470,10 @@ void PWFrameBuffer::Private::handleRemoteDesktopStarted(quint32 &code, QVariantM
|
||||
return;
|
||||
}
|
||||
|
||||
QSize streamResolution = qdbus_cast<QSize>(streams.first().map.value(QStringLiteral("size")));
|
||||
screenGeometry.width = streamResolution.width();
|
||||
screenGeometry.height = streamResolution.height();
|
||||
|
||||
devices = results.value(QStringLiteral("types")).toUInt();
|
||||
|
||||
pwStreamNodeId = streams.first().nodeId;
|
||||
|
||||
// Reallocate our buffer with actual needed size
|
||||
q->fb = static_cast<char*>(malloc(screenGeometry.width * screenGeometry.height * 4));
|
||||
|
||||
if (!q->fb) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to allocate buffer";
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Q_EMIT q->frameBufferChanged();
|
||||
|
||||
initPw();
|
||||
}
|
||||
|
||||
@@ -463,8 +487,9 @@ void PWFrameBuffer::Private::initPw() {
|
||||
// init pipewire (required)
|
||||
pw_init(nullptr, nullptr); // args are not used anyways
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
pwMainLoop = pw_thread_loop_new("pipewire-main-loop", nullptr);
|
||||
pw_thread_loop_lock(pwMainLoop);
|
||||
|
||||
pwContext = pw_context_new(pw_thread_loop_get_loop(pwMainLoop), nullptr, 0);
|
||||
if (!pwContext) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to create PipeWire context";
|
||||
@@ -484,49 +509,15 @@ void PWFrameBuffer::Private::initPw() {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to create PipeWire stream";
|
||||
return;
|
||||
}
|
||||
#else
|
||||
// initialize our source
|
||||
pwLoop = pw_loop_new(nullptr);
|
||||
pwMainLoop = pw_thread_loop_new(pwLoop, "pipewire-main-loop");
|
||||
// create PipeWire core object (required)
|
||||
pwCore = pw_core_new(pwLoop, nullptr);
|
||||
pwCoreType = pw_core_get_type(pwCore);
|
||||
|
||||
initializePwTypes();
|
||||
|
||||
// pw_remote should be initialized before type maps or connection error will happen
|
||||
pwRemote = pw_remote_new(pwCore, nullptr, 0);
|
||||
// init PipeWire remote, add listener to handle events
|
||||
pw_remote_add_listener(pwRemote, &remoteListener, &pwRemoteEvents, this);
|
||||
pw_remote_connect_fd(pwRemote, pipewireFd.fileDescriptor());
|
||||
#endif
|
||||
|
||||
if (pw_thread_loop_start(pwMainLoop) < 0) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to start main PipeWire loop";
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
pw_thread_loop_unlock(pwMainLoop);
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::initializePwTypes - helper method to initialize and map all needed
|
||||
* Pipewire types from core to type structure.
|
||||
*/
|
||||
void PWFrameBuffer::Private::initializePwTypes()
|
||||
{
|
||||
// raw C-like PipeWire type map
|
||||
spa_type_map *map = pwCoreType->map;
|
||||
pwType = new PwType();
|
||||
|
||||
spa_type_media_type_map(map, &pwType->media_type);
|
||||
spa_type_media_subtype_map(map, &pwType->media_subtype);
|
||||
spa_type_format_video_map(map, &pwType->format_video);
|
||||
spa_type_video_format_map(map, &pwType->video_format);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
void PWFrameBuffer::Private::onCoreError(void *data, uint32_t id, int seq, int res, const char *message)
|
||||
{
|
||||
Q_UNUSED(data);
|
||||
@@ -536,32 +527,6 @@ void PWFrameBuffer::Private::onCoreError(void *data, uint32_t id, int seq, int r
|
||||
|
||||
qInfo() << "core error: " << message;
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::onStateChanged - global state tracking for pipewire connection
|
||||
* @param data pointer that you have set in pw_remote_add_listener call's last argument
|
||||
* @param state new state that connection has changed to
|
||||
* @param error optional error message, is set to non-null if state is error
|
||||
*/
|
||||
void PWFrameBuffer::Private::onStateChanged(void *data, pw_remote_state /*old*/, pw_remote_state state, const char *error)
|
||||
{
|
||||
qInfo() << "remote state: " << pw_remote_state_as_string(state);
|
||||
|
||||
auto d = static_cast<PWFrameBuffer::Private*>(data);
|
||||
|
||||
switch (state) {
|
||||
case PW_REMOTE_STATE_ERROR:
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "remote error: " << error;
|
||||
break;
|
||||
case PW_REMOTE_STATE_CONNECTED:
|
||||
d->pwStream = d->createReceivingStream();
|
||||
break;
|
||||
default:
|
||||
qInfo() << "remote state: " << pw_remote_state_as_string(state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::onStreamStateChanged - called whenever stream state changes on pipewire server
|
||||
@@ -571,35 +536,20 @@ void PWFrameBuffer::Private::onStateChanged(void *data, pw_remote_state /*old*/,
|
||||
*/
|
||||
void PWFrameBuffer::Private::onStreamStateChanged(void *data, pw_stream_state /*old*/, pw_stream_state state, const char *error_message)
|
||||
{
|
||||
Q_UNUSED(data);
|
||||
|
||||
qInfo() << "Stream state changed: " << pw_stream_state_as_string(state);
|
||||
|
||||
auto *d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
switch (state) {
|
||||
case PW_STREAM_STATE_ERROR:
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "pipewire stream error: " << error_message;
|
||||
break;
|
||||
case PW_STREAM_STATE_PAUSED:
|
||||
pw_stream_set_active(d->pwStream, true);
|
||||
break;
|
||||
case PW_STREAM_STATE_STREAMING:
|
||||
case PW_STREAM_STATE_UNCONNECTED:
|
||||
case PW_STREAM_STATE_CONNECTING:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
switch (state) {
|
||||
case PW_STREAM_STATE_ERROR:
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "pipewire stream error: " << error_message;
|
||||
break;
|
||||
case PW_STREAM_STATE_CONFIGURE:
|
||||
pw_stream_set_active(d->pwStream, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -608,69 +558,53 @@ void PWFrameBuffer::Private::onStreamStateChanged(void *data, pw_stream_state /*
|
||||
* @param data pointer that you have set in pw_stream_add_listener call's last argument
|
||||
* @param format format that's being proposed
|
||||
*/
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
void PWFrameBuffer::Private::onStreamParamChanged(void *data, uint32_t id, const struct spa_pod *format)
|
||||
#else
|
||||
void PWFrameBuffer::Private::onStreamFormatChanged(void *data, const struct spa_pod *format)
|
||||
#endif
|
||||
{
|
||||
qInfo() << "Stream format changed";
|
||||
auto *d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
auto d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
|
||||
const int bpp = 4;
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
if (!format || id != SPA_PARAM_Format) {
|
||||
#else
|
||||
if (!format) {
|
||||
pw_stream_finish_format(d->pwStream, 0, nullptr, 0);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
d->videoFormat = new spa_video_info_raw();
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
spa_format_video_raw_parse(format, d->videoFormat);
|
||||
#else
|
||||
spa_format_video_raw_parse(format, d->videoFormat, &d->pwType->format_video);
|
||||
#endif
|
||||
auto width = d->videoFormat->size.width;
|
||||
auto height = d->videoFormat->size.height;
|
||||
auto stride = SPA_ROUND_UP_N(width * bpp, 4);
|
||||
auto stride = SPA_ROUND_UP_N(width * BYTES_PER_PIXEL, 4);
|
||||
auto size = height * stride;
|
||||
d->streamSize = QSize(width, height);
|
||||
|
||||
uint8_t buffer[1024];
|
||||
auto builder = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
|
||||
// setup buffers and meta header for new format
|
||||
const struct spa_pod *params[2];
|
||||
const struct spa_pod *params[3];
|
||||
|
||||
#if HAVE_DMA_BUF
|
||||
const auto bufferTypes = d->m_eglInitialized ? (1 << SPA_DATA_DmaBuf) | (1 << SPA_DATA_MemFd) | (1 << SPA_DATA_MemPtr) :
|
||||
(1 << SPA_DATA_MemFd) | (1 << SPA_DATA_MemPtr);
|
||||
#else
|
||||
const auto bufferTypes = (1 << SPA_DATA_MemFd) | (1 << SPA_DATA_MemPtr);
|
||||
#endif /* HAVE_DMA_BUF */
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(size),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
|
||||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 1, 32),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)));
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16),
|
||||
SPA_PARAM_BUFFERS_dataType, SPA_POD_CHOICE_FLAGS_Int(bufferTypes)));
|
||||
params[1] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
|
||||
SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
|
||||
SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header))));
|
||||
pw_stream_update_params(d->pwStream, params, 2);
|
||||
#else
|
||||
params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_object(&builder,
|
||||
d->pwCoreType->param.idBuffers, d->pwCoreType->param_buffers.Buffers,
|
||||
":", d->pwCoreType->param_buffers.size, "i", size,
|
||||
":", d->pwCoreType->param_buffers.stride, "i", stride,
|
||||
":", d->pwCoreType->param_buffers.buffers, "iru", 8, SPA_POD_PROP_MIN_MAX(1, 32),
|
||||
":", d->pwCoreType->param_buffers.align, "i", 16));
|
||||
params[1] = reinterpret_cast<spa_pod *>(spa_pod_builder_object(&builder,
|
||||
d->pwCoreType->param.idMeta, d->pwCoreType->param_meta.Meta,
|
||||
":", d->pwCoreType->param_meta.type, "I", d->pwCoreType->meta.Header,
|
||||
":", d->pwCoreType->param_meta.size, "i", sizeof(struct spa_meta_header)));
|
||||
pw_stream_finish_format(d->pwStream, 0, params, 2);
|
||||
#endif
|
||||
params[2] = reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(&builder,
|
||||
SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, SPA_PARAM_META_type,
|
||||
SPA_POD_Id(SPA_META_VideoCrop), SPA_PARAM_META_size,
|
||||
SPA_POD_Int(sizeof(struct spa_meta_region))));
|
||||
pw_stream_update_params(d->pwStream, params, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,75 +614,42 @@ void PWFrameBuffer::Private::onStreamFormatChanged(void *data, const struct spa_
|
||||
*/
|
||||
void PWFrameBuffer::Private::onStreamProcess(void *data)
|
||||
{
|
||||
auto *d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
auto d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
|
||||
pw_buffer *buf;
|
||||
if (!(buf = pw_stream_dequeue_buffer(d->pwStream))) {
|
||||
pw_buffer* next_buffer;
|
||||
pw_buffer* buffer = nullptr;
|
||||
|
||||
next_buffer = pw_stream_dequeue_buffer(d->pwStream);
|
||||
while (next_buffer) {
|
||||
buffer = next_buffer;
|
||||
next_buffer = pw_stream_dequeue_buffer(d->pwStream);
|
||||
|
||||
if (next_buffer) {
|
||||
pw_stream_queue_buffer(d->pwStream, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->handleFrame(buf);
|
||||
d->handleFrame(buffer);
|
||||
|
||||
pw_stream_queue_buffer(d->pwStream, buf);
|
||||
pw_stream_queue_buffer(d->pwStream, buffer);
|
||||
}
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90) && defined(HAVE_LINUX_DMABUF_H)
|
||||
static void syncDmaBuf(int fd, uint64_t start_or_end)
|
||||
{
|
||||
struct dma_buf_sync sync = { 0 };
|
||||
sync.flags = start_or_end | DMA_BUF_SYNC_READ;
|
||||
|
||||
while(true) {
|
||||
int ret;
|
||||
ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync);
|
||||
if (ret == -1 && errno == EINTR) {
|
||||
continue;
|
||||
} else if (ret == -1) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to synchronize DMA buffer: " << strerror(errno);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
{
|
||||
auto *spaBuffer = pwBuffer->buffer;
|
||||
void *src = spaBuffer->datas[0].data;
|
||||
auto spaBuffer = pwBuffer->buffer;
|
||||
uint8_t *src = nullptr;
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
if (!src && spaBuffer->datas->type != SPA_DATA_DmaBuf) {
|
||||
if (spaBuffer->datas[0].chunk->size == 0) {
|
||||
qCDebug(KRFB_FB_PIPEWIRE) << "discarding null buffer";
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
const quint32 maxSize = spaBuffer->datas[0].maxsize;
|
||||
|
||||
std::function<void()> cleanup;
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
#ifdef HAVE_LINUX_DMABUF_H
|
||||
if (spaBuffer->datas->type == SPA_DATA_DmaBuf) {
|
||||
const int fd = spaBuffer->datas[0].fd;
|
||||
auto map = mmap(
|
||||
nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
||||
PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (map == MAP_FAILED) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to mmap the dmabuf: " << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
syncDmaBuf(fd, DMA_BUF_SYNC_START);
|
||||
src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
|
||||
|
||||
cleanup = [map, spaBuffer, fd] {
|
||||
syncDmaBuf(fd, DMA_BUF_SYNC_END);
|
||||
munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset);
|
||||
};
|
||||
} else
|
||||
#endif
|
||||
const qint64 srcStride = spaBuffer->datas[0].chunk->stride;
|
||||
if (spaBuffer->datas->type == SPA_DATA_MemFd) {
|
||||
uint8_t *map = static_cast<uint8_t*>(mmap(
|
||||
nullptr, spaBuffer->datas->maxsize + spaBuffer->datas->mapoffset,
|
||||
@@ -763,36 +664,175 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
cleanup = [map, spaBuffer] {
|
||||
munmap(map, spaBuffer->datas->maxsize + spaBuffer->datas->mapoffset);
|
||||
};
|
||||
} else if (spaBuffer->datas[0].type == SPA_DATA_MemPtr) {
|
||||
src = static_cast<uint8_t*>(spaBuffer->datas[0].data);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_DMA_BUF
|
||||
else if (spaBuffer->datas->type == SPA_DATA_DmaBuf) {
|
||||
if (!m_eglInitialized) {
|
||||
// Shouldn't reach this
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to process DMA buffer.";
|
||||
return;
|
||||
}
|
||||
|
||||
const qint32 srcStride = spaBuffer->datas[0].chunk->stride;
|
||||
if (srcStride != q->paddedWidth()) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Got buffer with stride different from screen stride" << srcStride << "!=" << q->paddedWidth();
|
||||
gbm_import_fd_data importInfo = {static_cast<int>(spaBuffer->datas->fd), static_cast<uint32_t>(streamSize.width()),
|
||||
static_cast<uint32_t>(streamSize.height()), static_cast<uint32_t>(spaBuffer->datas[0].chunk->stride), GBM_BO_FORMAT_ARGB8888};
|
||||
gbm_bo *imported = gbm_bo_import(m_gbmDevice, GBM_BO_IMPORT_FD, &importInfo, GBM_BO_USE_SCANOUT);
|
||||
if (!imported) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to process buffer: Cannot import passed GBM fd - " << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
// bind context to render thread
|
||||
eglMakeCurrent(m_egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE, m_egl.context);
|
||||
|
||||
// create EGL image from imported BO
|
||||
EGLImageKHR image = eglCreateImageKHR(m_egl.display, nullptr, EGL_NATIVE_PIXMAP_KHR, imported, nullptr);
|
||||
|
||||
if (image == EGL_NO_IMAGE_KHR) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to record frame: Error creating EGLImageKHR - " << formatGLError(glGetError());
|
||||
gbm_bo_destroy(imported);
|
||||
return;
|
||||
}
|
||||
|
||||
// create GL 2D texture for framebuffer
|
||||
GLuint texture;
|
||||
glGenTextures(1, &texture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
|
||||
|
||||
src = static_cast<uint8_t*>(malloc(srcStride * streamSize.height()));
|
||||
|
||||
GLenum glFormat = GL_BGRA;
|
||||
switch (videoFormat->format) {
|
||||
case SPA_VIDEO_FORMAT_RGBx:
|
||||
glFormat = GL_RGBA;
|
||||
break;
|
||||
case SPA_VIDEO_FORMAT_RGBA:
|
||||
glFormat = GL_RGBA;
|
||||
break;
|
||||
case SPA_VIDEO_FORMAT_BGRx:
|
||||
glFormat = GL_BGRA;
|
||||
break;
|
||||
case SPA_VIDEO_FORMAT_RGB:
|
||||
glFormat = GL_RGB;
|
||||
break;
|
||||
case SPA_VIDEO_FORMAT_BGR:
|
||||
glFormat = GL_BGR;
|
||||
break;
|
||||
default:
|
||||
glFormat = GL_BGRA;
|
||||
break;
|
||||
}
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, glFormat, GL_UNSIGNED_BYTE, src);
|
||||
|
||||
if (!src) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to get image from DMA buffer.";
|
||||
gbm_bo_destroy(imported);
|
||||
return;
|
||||
}
|
||||
|
||||
cleanup = [src] {
|
||||
free(src);
|
||||
};
|
||||
|
||||
glDeleteTextures(1, &texture);
|
||||
eglDestroyImageKHR(m_egl.display, image);
|
||||
|
||||
gbm_bo_destroy(imported);
|
||||
}
|
||||
#endif /* HAVE_DMA_BUF */
|
||||
|
||||
struct spa_meta_region* videoMetadata =
|
||||
static_cast<struct spa_meta_region*>(spa_buffer_find_meta_data(
|
||||
spaBuffer, SPA_META_VideoCrop, sizeof(*videoMetadata)));
|
||||
|
||||
if (videoMetadata && (videoMetadata->region.size.width > static_cast<uint32_t>(streamSize.width()) ||
|
||||
videoMetadata->region.size.height > static_cast<uint32_t>(streamSize.height()))) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Stream metadata sizes are wrong!";
|
||||
return;
|
||||
}
|
||||
|
||||
q->tiles.append(QRect(0, 0, q->width(), q->height()));
|
||||
std::memcpy(q->fb, src, maxSize);
|
||||
cleanup();
|
||||
// Use video metadata when video size from metadata is set and smaller than
|
||||
// video stream size, so we need to adjust it.
|
||||
bool videoFullWidth = true;
|
||||
bool videoFullHeight = true;
|
||||
if (videoMetadata && videoMetadata->region.size.width != 0 &&
|
||||
videoMetadata->region.size.height != 0) {
|
||||
if (videoMetadata->region.size.width < static_cast<uint32_t>(streamSize.width())) {
|
||||
videoFullWidth = false;
|
||||
} else if (videoMetadata->region.size.height < static_cast<uint32_t>(streamSize.height())) {
|
||||
videoFullHeight = false;
|
||||
}
|
||||
}
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
if (videoFormat->format == SPA_VIDEO_FORMAT_BGRA || videoFormat->format == SPA_VIDEO_FORMAT_BGRx) {
|
||||
for (uint y = 0; y < videoFormat->size.height; y++) {
|
||||
for (uint x = 0; x < videoFormat->size.width; x++) {
|
||||
uint offset = y * spaBuffer->datas->chunk->stride + x * 4;
|
||||
std::swap(q->fb[offset], q->fb[offset + 2]);
|
||||
QSize prevVideoSize = videoSize;
|
||||
if (!videoFullHeight || !videoFullWidth) {
|
||||
videoSize = QSize(videoMetadata->region.size.width, videoMetadata->region.size.height);
|
||||
} else {
|
||||
videoSize = streamSize;
|
||||
}
|
||||
|
||||
if (!q->fb || videoSize != prevVideoSize) {
|
||||
if (q->fb) {
|
||||
free(q->fb);
|
||||
}
|
||||
q->fb = static_cast<char*>(malloc(videoSize.width() * videoSize.height() * BYTES_PER_PIXEL));
|
||||
|
||||
if (!q->fb) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to allocate buffer";
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Q_EMIT q->frameBufferChanged();
|
||||
}
|
||||
|
||||
const qint32 dstStride = videoSize.width() * BYTES_PER_PIXEL;
|
||||
Q_ASSERT(dstStride <= srcStride);
|
||||
|
||||
if (!videoFullHeight && (videoMetadata->region.position.y + videoSize.height() <= streamSize.height())) {
|
||||
src += srcStride * videoMetadata->region.position.y;
|
||||
}
|
||||
|
||||
const int xOffset = !videoFullWidth && (videoMetadata->region.position.x + videoSize.width() <= streamSize.width())
|
||||
? videoMetadata->region.position.x * BYTES_PER_PIXEL : 0;
|
||||
|
||||
char *dst = q->fb;
|
||||
for (int i = 0; i < videoSize.height(); ++i) {
|
||||
// Adjust source content based on crop video position if needed
|
||||
src += xOffset;
|
||||
std::memcpy(dst, src, dstStride);
|
||||
|
||||
if (videoFormat->format == SPA_VIDEO_FORMAT_BGRA || videoFormat->format == SPA_VIDEO_FORMAT_BGRx) {
|
||||
for (int j = 0; j < dstStride; j += 4) {
|
||||
std::swap(dst[j], dst[j + 2]);
|
||||
}
|
||||
}
|
||||
} else if (videoFormat->format != SPA_VIDEO_FORMAT_RGB) {
|
||||
|
||||
src += srcStride - xOffset;
|
||||
dst += dstStride;
|
||||
}
|
||||
|
||||
if (spaBuffer->datas->type == SPA_DATA_MemFd ||
|
||||
spaBuffer->datas->type == SPA_DATA_DmaBuf) {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
if (videoFormat->format != SPA_VIDEO_FORMAT_RGB) {
|
||||
const QImage::Format format = videoFormat->format == SPA_VIDEO_FORMAT_BGR ? QImage::Format_BGR888
|
||||
: videoFormat->format == SPA_VIDEO_FORMAT_RGBx ? QImage::Format_RGBX8888
|
||||
: QImage::Format_RGB32;
|
||||
|
||||
QImage img((uchar*) q->fb, videoFormat->size.width, videoFormat->size.height, spaBuffer->datas->chunk->stride, format);
|
||||
QImage img((uchar*) q->fb, videoSize.width(), videoSize.height(), dstStride, format);
|
||||
img.convertTo(QImage::Format_RGB888);
|
||||
}
|
||||
#endif
|
||||
|
||||
q->tiles.append(QRect(0, 0, videoSize.width(), videoSize.height()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -803,28 +843,19 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
pw_stream *PWFrameBuffer::Private::createReceivingStream()
|
||||
{
|
||||
spa_rectangle pwMinScreenBounds = SPA_RECTANGLE(1, 1);
|
||||
spa_rectangle pwMaxScreenBounds = SPA_RECTANGLE(screenGeometry.width, screenGeometry.height);
|
||||
spa_rectangle pwMaxScreenBounds = SPA_RECTANGLE(UINT32_MAX, UINT32_MAX);
|
||||
|
||||
spa_fraction pwFramerateMin = SPA_FRACTION(0, 1);
|
||||
spa_fraction pwFramerateMax = SPA_FRACTION(60, 1);
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
auto stream = pw_stream_new_simple(pw_thread_loop_get_loop(pwMainLoop), "krfb-fb-consume-stream",
|
||||
pw_properties_new(PW_KEY_MEDIA_TYPE, "Video",
|
||||
PW_KEY_MEDIA_CATEGORY, "Capture",
|
||||
PW_KEY_MEDIA_ROLE, "Screen",
|
||||
nullptr),
|
||||
&pwStreamEvents, this);
|
||||
pw_properties* reuseProps = pw_properties_new_string("pipewire.client.reuse=1");
|
||||
|
||||
auto stream = pw_stream_new(pwCore, "krfb-fb-consume-stream", reuseProps);
|
||||
|
||||
#else
|
||||
auto reuseProps = pw_properties_new("pipewire.client.reuse", "1", nullptr); // null marks end of varargs
|
||||
auto stream = pw_stream_new(pwRemote, "krfb-fb-consume-stream", reuseProps);
|
||||
#endif
|
||||
uint8_t buffer[1024] = {};
|
||||
const spa_pod *params[1];
|
||||
auto builder = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
|
||||
SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
|
||||
@@ -836,25 +867,10 @@ pw_stream *PWFrameBuffer::Private::createReceivingStream()
|
||||
SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle(&pwMaxScreenBounds, &pwMinScreenBounds, &pwMaxScreenBounds),
|
||||
SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&pwFramerateMin),
|
||||
SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&pwFramerateMax, &pwFramerateMin, &pwFramerateMax)));
|
||||
#else
|
||||
params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_object(&builder,
|
||||
pwCoreType->param.idEnumFormat, pwCoreType->spa_format,
|
||||
"I", pwType->media_type.video,
|
||||
"I", pwType->media_subtype.raw,
|
||||
":", pwType->format_video.format, "I", pwType->video_format.RGBx,
|
||||
":", pwType->format_video.size, "Rru", &pwMaxScreenBounds, SPA_POD_PROP_MIN_MAX(&pwMinScreenBounds, &pwMaxScreenBounds),
|
||||
":", pwType->format_video.framerate, "F", &pwFramerateMin,
|
||||
":", pwType->format_video.max_framerate, "Fru", &pwFramerateMax, 2, &pwFramerateMin, &pwFramerateMax));
|
||||
pw_stream_add_listener(stream, &streamListener, &pwStreamEvents, this);
|
||||
#endif
|
||||
|
||||
auto flags = static_cast<pw_stream_flags>(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE | PW_STREAM_FLAG_MAP_BUFFERS);
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
if (pw_stream_connect(stream, PW_DIRECTION_INPUT, PW_ID_ANY, flags, params, 1) != 0) {
|
||||
#else
|
||||
if (pw_stream_connect(stream, PW_DIRECTION_INPUT, nullptr, flags, params, 1) != 0) {
|
||||
#endif
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Could not connect receiving stream";
|
||||
pw_stream_add_listener(stream, &streamListener, &pwStreamEvents, this);
|
||||
|
||||
if (pw_stream_connect(stream, PW_DIRECTION_INPUT, pwStreamNodeId, PW_STREAM_FLAG_AUTOCONNECT, params, 1) != 0) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
@@ -867,23 +883,10 @@ PWFrameBuffer::Private::~Private()
|
||||
pw_thread_loop_stop(pwMainLoop);
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 9)
|
||||
if (pwType) {
|
||||
delete pwType;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pwStream) {
|
||||
pw_stream_destroy(pwStream);
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
if (pwRemote) {
|
||||
pw_remote_destroy(pwRemote);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
if (pwCore) {
|
||||
pw_core_disconnect(pwCore);
|
||||
}
|
||||
@@ -891,22 +894,10 @@ PWFrameBuffer::Private::~Private()
|
||||
if (pwContext) {
|
||||
pw_context_destroy(pwContext);
|
||||
}
|
||||
#else
|
||||
if (pwCore) {
|
||||
pw_core_destroy(pwCore);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pwMainLoop) {
|
||||
pw_thread_loop_destroy(pwMainLoop);
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
if (pwLoop) {
|
||||
pw_loop_leave(pwLoop);
|
||||
pw_loop_destroy(pwLoop);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PWFrameBuffer::PWFrameBuffer(WId winid, QObject *parent)
|
||||
@@ -917,9 +908,6 @@ PWFrameBuffer::PWFrameBuffer(WId winid, QObject *parent)
|
||||
// PipeWire connectivity is initialized after D-Bus session is started
|
||||
d->initDbus();
|
||||
|
||||
// FIXME: for now use some initial size, later on we will reallocate this with the actual size we get from portal
|
||||
d->screenGeometry.width = 800;
|
||||
d->screenGeometry.height = 600;
|
||||
fb = nullptr;
|
||||
}
|
||||
|
||||
@@ -936,12 +924,12 @@ int PWFrameBuffer::depth()
|
||||
|
||||
int PWFrameBuffer::height()
|
||||
{
|
||||
return static_cast<qint32>(d->screenGeometry.height);
|
||||
return d->videoSize.height();
|
||||
}
|
||||
|
||||
int PWFrameBuffer::width()
|
||||
{
|
||||
return static_cast<qint32>(d->screenGeometry.width);
|
||||
return d->videoSize.width();
|
||||
}
|
||||
|
||||
int PWFrameBuffer::paddedWidth()
|
||||
|
||||
@@ -24,11 +24,11 @@ class PWFrameBuffer: public FrameBuffer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef struct {
|
||||
using Stream = struct {
|
||||
uint nodeId;
|
||||
QVariantMap map;
|
||||
} Stream;
|
||||
typedef QList<Stream> Streams;
|
||||
};
|
||||
using Streams = QList<Stream>;
|
||||
|
||||
PWFrameBuffer(WId winid, QObject *parent = nullptr);
|
||||
virtual ~PWFrameBuffer() override;
|
||||
|
||||
@@ -28,5 +28,5 @@ target_link_libraries (krfb_framebuffer_qt
|
||||
)
|
||||
|
||||
install (TARGETS krfb_framebuffer_qt
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb/framebuffer
|
||||
)
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
"Id": "qt",
|
||||
"License": "GPL",
|
||||
"Name": "Qt Framebuffer for KRfb",
|
||||
"Name[ca@valencia]": "«Framebuffer» de les Qt per al KRfb.",
|
||||
"Name[ca]": "«Framebuffer» de les Qt per al KRfb.",
|
||||
"Name[ca@valencia]": "«Framebuffer» de les Qt per al KRfb",
|
||||
"Name[ca]": "«Framebuffer» de les Qt per al KRfb",
|
||||
"Name[cs]": "Qt Framebuffer pro KRfb",
|
||||
"Name[da]": "Qt-framebuffer til KRfb",
|
||||
"Name[de]": "Qt-Framebuffer für KRfb",
|
||||
@@ -75,9 +75,6 @@
|
||||
"Name[x-test]": "xxQt Framebuffer for KRfbxx",
|
||||
"Name[zh_CN]": "KRfb 的 Qt 帧缓冲",
|
||||
"Name[zh_TW]": "Krfb 的 Qt Framebuffer",
|
||||
"ServiceTypes": [
|
||||
"krfb/framebuffer"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "https://www.kde.org"
|
||||
}
|
||||
|
||||
@@ -26,11 +26,7 @@ QtFrameBuffer::QtFrameBuffer(WId id, QObject *parent)
|
||||
if (screen) {
|
||||
primaryScreen = screen;
|
||||
fbImage = screen->grabWindow(win).toImage();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
fb = new char[fbImage.sizeInBytes()];
|
||||
#else
|
||||
fb = new char[fbImage.byteCount()];
|
||||
#endif
|
||||
} else {
|
||||
fb = nullptr;
|
||||
primaryScreen = nullptr;
|
||||
@@ -108,11 +104,7 @@ void QtFrameBuffer::updateFrameBuffer()
|
||||
tiles.append(img.rect());
|
||||
#endif
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
memcpy(fb, img.bits(), static_cast<size_t>(img.sizeInBytes()));
|
||||
#else
|
||||
memcpy(fb, img.bits(), img.byteCount());
|
||||
#endif
|
||||
fbImage = img;
|
||||
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ target_link_libraries (krfb_framebuffer_xcb
|
||||
)
|
||||
|
||||
install (TARGETS krfb_framebuffer_xcb
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb/framebuffer
|
||||
)
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
"Id": "xcb",
|
||||
"License": "GPL",
|
||||
"Name": "X11 Framebuffer for KRfb",
|
||||
"Name[ca@valencia]": "«Framebuffer» de l'X11 per al KRfb.",
|
||||
"Name[ca]": "«Framebuffer» de l'X11 per al KRfb.",
|
||||
"Name[ca@valencia]": "«Framebuffer» de l'X11 per al KRfb",
|
||||
"Name[ca]": "«Framebuffer» de l'X11 per al KRfb",
|
||||
"Name[cs]": "X11 Framebuffer pro KRfb",
|
||||
"Name[da]": "X11-framebuffer til KRfb",
|
||||
"Name[de]": "X11-Framebuffer für KRfb",
|
||||
@@ -75,9 +75,6 @@
|
||||
"Name[x-test]": "xxX11 Framebuffer for KRfbxx",
|
||||
"Name[zh_CN]": "XRfb 的 X11 帧缓冲",
|
||||
"Name[zh_TW]": "KRfb 的 X11 Framebuffer",
|
||||
"ServiceTypes": [
|
||||
"krfb/framebuffer"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "https://www.kde.org"
|
||||
}
|
||||
|
||||
@@ -9,3 +9,6 @@
|
||||
|
||||
/* Define if XShm is available */
|
||||
#cmakedefine HAVE_XSHM 1
|
||||
|
||||
/* Define if DMA-BUF support is available */
|
||||
#cmakedefine01 HAVE_DMA_BUF
|
||||
|
||||
@@ -37,9 +37,9 @@ ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle(i18n("New Connection"));
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||
QWidget *mainWidget = new QWidget(this);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||
auto mainWidget = new QWidget(this);
|
||||
auto mainLayout = new QVBoxLayout;
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(mainWidget);
|
||||
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
|
||||
|
||||
@@ -64,9 +64,7 @@ void EventsManager::loadPlugins()
|
||||
{
|
||||
//qDebug();
|
||||
|
||||
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb"), [](const KPluginMetaData & md) {
|
||||
return md.serviceTypes().contains(QStringLiteral("krfb/events"));
|
||||
});
|
||||
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb/events"));
|
||||
|
||||
QVectorIterator<KPluginMetaData> i(plugins);
|
||||
i.toBack();
|
||||
|
||||
@@ -63,9 +63,7 @@ void FrameBufferManager::loadPlugins()
|
||||
{
|
||||
//qDebug();
|
||||
|
||||
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb"), [](const KPluginMetaData & md) {
|
||||
return md.serviceTypes().contains(QStringLiteral("krfb/framebuffer"));
|
||||
});
|
||||
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb/framebuffer"));
|
||||
|
||||
QVectorIterator<KPluginMetaData> i(plugins);
|
||||
i.toBack();
|
||||
|
||||
@@ -34,7 +34,7 @@ class KRFBPRIVATE_EXPORT FrameBufferPlugin : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
explicit FrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
~FrameBufferPlugin() override;
|
||||
|
||||
virtual FrameBuffer *frameBuffer(WId id) = 0;
|
||||
|
||||
@@ -33,7 +33,13 @@
|
||||
#include <KStringHandler>
|
||||
#include <KWallet/KWallet>
|
||||
|
||||
#include <dnssd/publicservice.h>
|
||||
#include <kdnssd_version.h>
|
||||
#if KDNSSD_VERSION >= QT_VERSION_CHECK(5, 84, 0)
|
||||
#include <KDNSSD/PublicService>
|
||||
#else
|
||||
#include <DNSSD/PublicService>
|
||||
#endif
|
||||
|
||||
using KWallet::Wallet;
|
||||
|
||||
// used for KWallet folder name
|
||||
|
||||
@@ -3,8 +3,8 @@ Type=ServiceType
|
||||
X-KDE-ServiceType=krfb/events
|
||||
|
||||
Comment=Event plugins for KRfb
|
||||
Comment[ca]=Connectors d'esdeveniments per al KRfb.
|
||||
Comment[ca@valencia]=Connectors d'esdeveniments per al KRfb.
|
||||
Comment[ca]=Connectors d'esdeveniments per al KRfb
|
||||
Comment[ca@valencia]=Connectors d'esdeveniments per al KRfb
|
||||
Comment[cs]=Moduly událostí pro KRfb
|
||||
Comment[da]=Hændelses-plugins til KRfb
|
||||
Comment[de]=Ereignis-Module für KRfb
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"KPlugin": {
|
||||
"Description": "Events plugins for KRfb",
|
||||
"Description[ca@valencia]": "Connectors d'esdeveniments per al KRfb.",
|
||||
"Description[ca]": "Connectors d'esdeveniments per al KRfb.",
|
||||
"Description[ca@valencia]": "Connectors d'esdeveniments per al KRfb",
|
||||
"Description[ca]": "Connectors d'esdeveniments per al KRfb",
|
||||
"Description[cs]": "Moduly událostí pro KRfb",
|
||||
"Description[da]": "Hændelses-plugins til KRfb",
|
||||
"Description[de]": "Ereignis-Module für KRfb",
|
||||
|
||||
@@ -5,8 +5,8 @@ X-KDE-ServiceType=krfb/framebuffer
|
||||
Comment=Frame Buffer plugins for KRfb
|
||||
Comment[bg]=Приставки за фреймбуфер за KRfb
|
||||
Comment[bs]=Priključci framebafera za KRfb
|
||||
Comment[ca]=Connectors de «framebuffer» per al KRfb.
|
||||
Comment[ca@valencia]=Connectors de «framebuffer» per al KRfb.
|
||||
Comment[ca]=Connectors de «framebuffer» per al KRfb
|
||||
Comment[ca@valencia]=Connectors de «framebuffer» per al KRfb
|
||||
Comment[cs]=Moduly Frame bufferu pro KRfb
|
||||
Comment[da]=Framebuffer-plugins til KRfb
|
||||
Comment[de]=Framebuffer-Module für KRfb
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"KPlugin": {
|
||||
"Description": "Frame Buffer plugins for KRfb",
|
||||
"Description[ca@valencia]": "Connectors de «Frame Buffer» per al KRfb.",
|
||||
"Description[ca]": "Connectors de «Frame Buffer» per al KRfb.",
|
||||
"Description[ca@valencia]": "Connectors de «Frame Buffer» per al KRfb",
|
||||
"Description[ca]": "Connectors de «Frame Buffer» per al KRfb",
|
||||
"Description[cs]": "Moduly Frame bufferu pro KRfb",
|
||||
"Description[da]": "Framebuffer-plugins til KRfb",
|
||||
"Description[de]": "Framebuffer-Module für KRfb",
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
class Security: public QWidget, public Ui::Security
|
||||
{
|
||||
public:
|
||||
Security(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
explicit Security(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
walletWarning = new KMessageWidget(this);
|
||||
walletWarning->setText(i18n("Storing passwords in config file is insecure!"));
|
||||
@@ -83,10 +83,7 @@ public:
|
||||
}
|
||||
|
||||
void fillFrameBuffersCombo() {
|
||||
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(
|
||||
QStringLiteral("krfb"), [](const KPluginMetaData & md) {
|
||||
return md.serviceTypes().contains(QStringLiteral("krfb/framebuffer"));
|
||||
});
|
||||
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb/framebuffer"));
|
||||
QSet<QString> unique;
|
||||
QVectorIterator<KPluginMetaData> i(plugins);
|
||||
i.toBack();
|
||||
@@ -110,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
m_passwordLineEdit->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
QWidget *mainWidget = new QWidget;
|
||||
auto mainWidget = new QWidget;
|
||||
m_ui.setupUi(mainWidget);
|
||||
m_ui.krfbIconLabel->setPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(128));
|
||||
m_ui.enableUnattendedCheckBox->setChecked(
|
||||
@@ -255,7 +252,7 @@ void MainWindow::showConfiguration()
|
||||
return;
|
||||
}
|
||||
|
||||
KConfigDialog *dialog = new KConfigDialog(this, QStringLiteral("settings"), KrfbConfig::self());
|
||||
auto dialog = new KConfigDialog(this, QStringLiteral("settings"), KrfbConfig::self());
|
||||
dialog->addPage(new TCP, i18n("Network"), QStringLiteral("network-wired"));
|
||||
dialog->addPage(new Security, i18n("Security"), QStringLiteral("security-high"));
|
||||
dialog->addPage(new ConfigFramebuffer, i18n("Screen capture"), QStringLiteral("video-display"));
|
||||
|
||||
@@ -43,7 +43,7 @@ class MainWindow : public KXmlGuiWindow
|
||||
private:
|
||||
Ui::MainWidget m_ui;
|
||||
bool m_passwordEditable;
|
||||
QLineEdit *m_passwordLineEdit;
|
||||
QLineEdit *m_passwordLineEdit = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,11 +43,14 @@
|
||||
<summary xml:lang="ca">Comparteix l'escriptori amb un altre ordinador a través de VNC</summary>
|
||||
<summary xml:lang="ca-valencia">Comparteix l'escriptori amb un altre ordinador a través de VNC</summary>
|
||||
<summary xml:lang="cs">Sdílejte své pracovní prostředí na jiný počítač pomocí VNC</summary>
|
||||
<summary xml:lang="da">Del dit skrivebord til en anden computer via VNC</summary>
|
||||
<summary xml:lang="de">Verbindung Ihrer Arbeitsfläche zu anderen Rechnern über VNC</summary>
|
||||
<summary xml:lang="el">Μοιραστείτε την επιφάνεια εργασίας σας με άλλον υπολογιστή μέσω VNC</summary>
|
||||
<summary xml:lang="en-GB">Share your desktop to another computer via VNC</summary>
|
||||
<summary xml:lang="es">Compartir su escritorio con otro equipo usando VNC</summary>
|
||||
<summary xml:lang="et">Oma töölaua jagamine VNC kaudu teise arvutisse</summary>
|
||||
<summary xml:lang="eu">Partekatu zure mahaigaina beste ordenagailu batekin VNC erabiliz</summary>
|
||||
<summary xml:lang="fi">Jaa työpöytä toiselle koneelle VNC:n kautta</summary>
|
||||
<summary xml:lang="fr">Partager votre bureau avec un autre ordinateur grâce à « VNC »</summary>
|
||||
<summary xml:lang="ia">Compartir tu scriptorio a un altere computator via VNC</summary>
|
||||
<summary xml:lang="id">Bagikan desktopmu ke komputer lainnya via VNC</summary>
|
||||
@@ -62,6 +65,7 @@
|
||||
<summary xml:lang="sv">Dela ditt skrivbord med en annan dator via VNC</summary>
|
||||
<summary xml:lang="uk">Надайте вашу стільницю у спільне користування з іншим комп'ютером за допомогою VNC</summary>
|
||||
<summary xml:lang="x-test">xxShare your desktop to another computer via VNCxx</summary>
|
||||
<summary xml:lang="zh-CN">通过 VNC 分享您的桌面到另一台电脑</summary>
|
||||
<description>
|
||||
<p>Krfb Desktop Sharing is a server application that allows you to share your current session with a user on another machine, who can use a VNC client to view or even control the desktop.</p>
|
||||
<p xml:lang="ca">El Krfb és una aplicació de servidor que permet compartir la vostra sessió actual amb un usuari en una altra màquina, la qual pot emprar un client VNC per a veure o controlar l'escriptori.</p>
|
||||
@@ -76,6 +80,7 @@
|
||||
<p xml:lang="fi">Krfb-työpöytäjako on palvelinsovellus, jolla voit jakaa nykyisen istuntosi toisen koneen käyttäjälle, joka voi VNC-asiakkaalla nähdä tai jopa hallita työpöytääsi.</p>
|
||||
<p xml:lang="fr">Le partage de bureau Krfb est une application de serveur qui vous permet de partager votre session courante avec un utilisateur sur une autre machine, qui peut utiliser un client VNC pour afficher et même contrôler le bureau.</p>
|
||||
<p xml:lang="gl">Krfb é unha aplicación de servidor que permite compartir a sesión actual cun usuario que está noutro equipo, que pode usar un cliente VNC para ver ou mesmo controlar o escritorio.</p>
|
||||
<p xml:lang="ia">Krfb Desktop Sharing es un application de servitor que te permitte compartir tu session currente con un usator sur un altere machina,le qual pote usar un cliente VNC per vider o anque controlar le scriptorio.</p>
|
||||
<p xml:lang="id">Krfb Desktop Sharing adalah aplikasi server yang memungkinkan kamu untuk berbagi sesimu saat ini dengan pengguna di mesin lain, yang bisa menggunakan klien VNC untuk menampilkan atau bahkan mengendalikan desktop.</p>
|
||||
<p xml:lang="it">Condivisione del desktop Krfb è un'applicazione server che permette di condividere la sessione attuale con un utente su un'altra macchina, che potrà usare un client VNC per visualizzare ed anche controllare il desktop.</p>
|
||||
<p xml:lang="ko">Krfb 데스크톱 공유는 현재 세션을 다른 머신의 사용자와 VNC를 통해서 공유하거나 원격 제어를 요청할 수 있는 서버 프로그램입니다.</p>
|
||||
@@ -143,9 +148,9 @@
|
||||
</provides>
|
||||
<project_group>KDE</project_group>
|
||||
<releases>
|
||||
<release version="20.12.3" date="2021-03-04"/>
|
||||
<release version="20.12.2" date="2021-02-04"/>
|
||||
<release version="20.12.1" date="2021-01-07"/>
|
||||
<release version="20.12.0" date="2020-12-10"/>
|
||||
<release version="21.08.3" date="2021-11-04"/>
|
||||
<release version="21.08.2" date="2021-10-07"/>
|
||||
<release version="21.08.1" date="2021-09-02"/>
|
||||
<release version="21.08.0" date="2021-08-12"/>
|
||||
</releases>
|
||||
</component>
|
||||
|
||||
@@ -84,6 +84,8 @@ GenericName[el]=Κοινή χρήση επιφάνειας εργασίας (VNC
|
||||
GenericName[en_GB]=Desktop Sharing (VNC)
|
||||
GenericName[es]=Escritorio compartido (VNC)
|
||||
GenericName[et]=Töölaua jagamine (VNC)
|
||||
GenericName[eu]=Mahaigaina partekatzea (VNC)
|
||||
GenericName[fi]=Työpöydän jakaminen (VNC)
|
||||
GenericName[fr]=Partage de bureaux (VNC)
|
||||
GenericName[ia]=Compartir de scriptorio (VNC)
|
||||
GenericName[it]=Condivisione del desktop (VNC)
|
||||
@@ -97,6 +99,7 @@ GenericName[sl]=Souporaba namizja (VNC)
|
||||
GenericName[sv]=Skrivbordsdelning (VNC)
|
||||
GenericName[uk]=Спільні стільниці (VNC)
|
||||
GenericName[x-test]=xxDesktop Sharing (VNC)xx
|
||||
GenericName[zh_CN]=桌面共享 (VNC)
|
||||
Comment=Desktop Sharing
|
||||
Comment[af]=Werkskerm Deeling
|
||||
Comment[ar]=مشاركة سطح المكتب
|
||||
|
||||
Reference in New Issue
Block a user