mirror of
https://github.com/KDE/krfb
synced 2026-07-01 15:51:18 -07:00
Compare commits
1 Commits
v21.12.2
...
work/usta_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
095eebda54 |
3
.arcconfig
Normal file
3
.arcconfig
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"phabricator.uri" : "https://phabricator.kde.org/"
|
||||
}
|
||||
26
.gitignore
vendored
26
.gitignore
vendored
@@ -1,26 +0,0 @@
|
||||
# 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,6 +0,0 @@
|
||||
# SPDX-FileCopyrightText: None
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
include:
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml
|
||||
21
.kde-ci.yml
21
.kde-ci.yml
@@ -1,21 +0,0 @@
|
||||
# SPDX-FileCopyrightText: None
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
Dependencies:
|
||||
- 'on': ['@all']
|
||||
'require':
|
||||
'frameworks/extra-cmake-modules': '@stable'
|
||||
'frameworks/ki18n': '@stable'
|
||||
'frameworks/kconfig': '@stable'
|
||||
'frameworks/kcoreaddons': '@stable'
|
||||
'frameworks/kcrash': '@stable'
|
||||
'frameworks/kdbusaddons': '@stable'
|
||||
'frameworks/kdnssd': '@stable'
|
||||
'frameworks/kdoctools': '@stable'
|
||||
'frameworks/knotifications': '@stable'
|
||||
'frameworks/kwallet': '@stable'
|
||||
'frameworks/kwidgetsaddons': '@stable'
|
||||
'frameworks/kwindowsystem': '@stable'
|
||||
'frameworks/kxmlgui': '@stable'
|
||||
'frameworks/kwayland': '@stable'
|
||||
'libraries/plasma-wayland-protocols': '@latest' # can be switched to @stable when 1.5.0 is released
|
||||
@@ -2,14 +2,17 @@ cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# KDE Application Version, managed by release script
|
||||
set (RELEASE_SERVICE_VERSION_MAJOR "21")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "12")
|
||||
set (RELEASE_SERVICE_VERSION_MICRO "2")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "07")
|
||||
set (RELEASE_SERVICE_VERSION_MICRO "70")
|
||||
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.15.0)
|
||||
set(KF5_MIN_VERSION 5.85.0)
|
||||
set(KF5_MIN_VERSION 5.82.0)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
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})
|
||||
@@ -38,7 +41,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
|
||||
DocTools
|
||||
Notifications
|
||||
Wallet
|
||||
Wayland
|
||||
WidgetsAddons
|
||||
WindowSystem
|
||||
XmlGui
|
||||
@@ -81,14 +83,6 @@ find_package(LibVNCServer REQUIRED)
|
||||
|
||||
pkg_check_modules(PipeWire IMPORTED_TARGET libpipewire-0.3)
|
||||
add_feature_info(PipeWire PipeWire_FOUND "Required for pipewire screencast plugin")
|
||||
find_package(PlasmaWaylandProtocols 1.5.0)
|
||||
|
||||
if(PipeWire_FOUND AND PlasmaWaylandProtocols_FOUND)
|
||||
find_package(QtWaylandScanner REQUIRED)
|
||||
find_package(Qt5WaylandClient)
|
||||
find_package(Qt5XkbCommonSupport)
|
||||
find_package(Wayland REQUIRED COMPONENTS Client)
|
||||
endif()
|
||||
|
||||
find_package(gbm)
|
||||
set_package_properties(gbm PROPERTIES
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
{
|
||||
"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}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
@@ -31,7 +31,7 @@ class X11EventsPlugin : public EventsPlugin
|
||||
Q_OBJECT
|
||||
public:
|
||||
X11EventsPlugin(QObject *parent, const QVariantList &args);
|
||||
~X11EventsPlugin() override = default;
|
||||
virtual ~X11EventsPlugin() = default;
|
||||
|
||||
EventHandler *eventHandler() override;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class XdpEventsPlugin : public EventsPlugin
|
||||
Q_OBJECT
|
||||
public:
|
||||
XdpEventsPlugin(QObject *parent, const QVariantList &args);
|
||||
~XdpEventsPlugin() override = default;
|
||||
virtual ~XdpEventsPlugin() = default;
|
||||
|
||||
EventHandler *eventHandler() override;
|
||||
|
||||
|
||||
@@ -5,14 +5,8 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR}
|
||||
set (krfb_framebuffer_pw_SRCS
|
||||
pw_framebuffer.cpp
|
||||
pw_framebufferplugin.cpp
|
||||
|
||||
screencasting.cpp
|
||||
)
|
||||
|
||||
ecm_add_qtwayland_client_protocol(krfb_framebuffer_pw_SRCS
|
||||
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/screencast.xml
|
||||
BASENAME zkde-screencast-unstable-v1
|
||||
)
|
||||
|
||||
ecm_qt_declare_logging_category(krfb_framebuffer_pw_SRCS
|
||||
HEADER krfb_fb_pipewire_debug.h
|
||||
@@ -38,15 +32,12 @@ add_library(krfb_framebuffer_pw
|
||||
MODULE
|
||||
${krfb_framebuffer_pw_SRCS}
|
||||
)
|
||||
set_property(TARGET krfb_framebuffer_pw PROPERTY C_STANDARD 99)
|
||||
|
||||
target_link_libraries(krfb_framebuffer_pw
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::DBus
|
||||
KF5::CoreAddons
|
||||
KF5::WaylandClient
|
||||
Wayland::Client
|
||||
krfbprivate
|
||||
PkgConfig::PipeWire
|
||||
)
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
#include <QDebug>
|
||||
#include <QRandomGenerator>
|
||||
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
|
||||
// pipewire
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
@@ -41,7 +38,6 @@
|
||||
#include "xdp_dbus_screencast_interface.h"
|
||||
#include "xdp_dbus_remotedesktop_interface.h"
|
||||
#include "krfb_fb_pipewire_debug.h"
|
||||
#include "screencasting.h"
|
||||
|
||||
#if HAVE_DMA_BUF
|
||||
#include <fcntl.h>
|
||||
@@ -175,10 +171,6 @@ private:
|
||||
// sanity indicator
|
||||
bool isValid = true;
|
||||
|
||||
QImage cursorTexture;
|
||||
QPoint cursorPosition;
|
||||
QPoint cursorHotspot;
|
||||
|
||||
#if HAVE_DMA_BUF
|
||||
struct EGLStruct {
|
||||
QList<QByteArray> extensions;
|
||||
@@ -560,10 +552,6 @@ void PWFrameBuffer::Private::onStreamStateChanged(void *data, pw_stream_state /*
|
||||
}
|
||||
}
|
||||
|
||||
#define CURSOR_BPP 4
|
||||
#define CURSOR_META_SIZE(w,h) (sizeof(struct spa_meta_cursor) + \
|
||||
sizeof(struct spa_meta_bitmap) + w * h * CURSOR_BPP)
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::onStreamFormatChanged - being executed after stream is set to active
|
||||
* and after setup has been requested to connect to it. The actual video format is being negotiated here.
|
||||
@@ -573,7 +561,7 @@ void PWFrameBuffer::Private::onStreamStateChanged(void *data, pw_stream_state /*
|
||||
void PWFrameBuffer::Private::onStreamParamChanged(void *data, uint32_t id, const struct spa_pod *format)
|
||||
{
|
||||
qInfo() << "Stream format changed";
|
||||
auto d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
auto *d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
|
||||
if (!format || id != SPA_PARAM_Format) {
|
||||
return;
|
||||
@@ -591,6 +579,7 @@ void PWFrameBuffer::Private::onStreamParamChanged(void *data, uint32_t id, const
|
||||
auto builder = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
|
||||
// setup buffers and meta header for new format
|
||||
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) :
|
||||
@@ -599,38 +588,23 @@ void PWFrameBuffer::Private::onStreamParamChanged(void *data, uint32_t id, const
|
||||
const auto bufferTypes = (1 << SPA_DATA_MemFd) | (1 << SPA_DATA_MemPtr);
|
||||
#endif /* HAVE_DMA_BUF */
|
||||
|
||||
QVector<const struct spa_pod *> params = {
|
||||
reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
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_dataType, SPA_POD_CHOICE_FLAGS_Int(bufferTypes))),
|
||||
reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
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)))),
|
||||
reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(&builder,
|
||||
SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header))));
|
||||
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)))),
|
||||
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_Cursor),
|
||||
SPA_PARAM_META_size, SPA_POD_CHOICE_RANGE_Int (CURSOR_META_SIZE (64, 64),
|
||||
CURSOR_META_SIZE (1, 1),
|
||||
CURSOR_META_SIZE (1024, 1024)))),
|
||||
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_VideoDamage),
|
||||
SPA_PARAM_META_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
sizeof(struct spa_meta_region) * 16,
|
||||
sizeof(struct spa_meta_region) * 1,
|
||||
sizeof(struct spa_meta_region) * 16))),
|
||||
};
|
||||
pw_stream_update_params(d->pwStream, params.data(), params.size());
|
||||
SPA_POD_Int(sizeof(struct spa_meta_region))));
|
||||
pw_stream_update_params(d->pwStream, params, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -640,7 +614,7 @@ void PWFrameBuffer::Private::onStreamParamChanged(void *data, uint32_t id, const
|
||||
*/
|
||||
void PWFrameBuffer::Private::onStreamProcess(void *data)
|
||||
{
|
||||
auto d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
auto *d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
|
||||
pw_buffer* next_buffer;
|
||||
pw_buffer* buffer = nullptr;
|
||||
@@ -664,16 +638,9 @@ void PWFrameBuffer::Private::onStreamProcess(void *data)
|
||||
pw_stream_queue_buffer(d->pwStream, buffer);
|
||||
}
|
||||
|
||||
static QImage::Format spaToQImageFormat(quint32 format)
|
||||
{
|
||||
return format == SPA_VIDEO_FORMAT_BGR ? QImage::Format_BGR888
|
||||
: format == SPA_VIDEO_FORMAT_RGBx ? QImage::Format_RGBX8888
|
||||
: QImage::Format_RGB32;
|
||||
}
|
||||
|
||||
void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
{
|
||||
auto spaBuffer = pwBuffer->buffer;
|
||||
auto *spaBuffer = pwBuffer->buffer;
|
||||
uint8_t *src = nullptr;
|
||||
|
||||
if (spaBuffer->datas[0].chunk->size == 0) {
|
||||
@@ -682,7 +649,6 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
}
|
||||
|
||||
std::function<void()> cleanup;
|
||||
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,
|
||||
@@ -738,7 +704,7 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
|
||||
|
||||
src = static_cast<uint8_t*>(malloc(srcStride * streamSize.height()));
|
||||
src = static_cast<uint8_t*>(malloc(streamSize.width() * streamSize.height() * BYTES_PER_PIXEL));
|
||||
|
||||
GLenum glFormat = GL_BGRA;
|
||||
switch (videoFormat->format) {
|
||||
@@ -780,28 +746,6 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
}
|
||||
#endif /* HAVE_DMA_BUF */
|
||||
|
||||
|
||||
// process cursor
|
||||
{
|
||||
struct spa_meta_cursor *cursor = static_cast<struct spa_meta_cursor*>(spa_buffer_find_meta_data (spaBuffer, SPA_META_Cursor, sizeof (*cursor)));
|
||||
if (spa_meta_cursor_is_valid (cursor)) {
|
||||
struct spa_meta_bitmap *bitmap = nullptr;
|
||||
|
||||
if (cursor->bitmap_offset)
|
||||
bitmap = SPA_MEMBER (cursor, cursor->bitmap_offset, struct spa_meta_bitmap);
|
||||
|
||||
if (bitmap && bitmap->size.width > 0 && bitmap->size.height > 0) {
|
||||
const uint8_t *bitmap_data;
|
||||
|
||||
bitmap_data = SPA_MEMBER (bitmap, bitmap->offset, uint8_t);
|
||||
cursorHotspot = { cursor->hotspot.x, cursor->hotspot.y };
|
||||
cursorTexture = QImage(bitmap_data, bitmap->size.width, bitmap->size.height, bitmap->stride, spaToQImageFormat(bitmap->format));
|
||||
}
|
||||
|
||||
cursorPosition = QPoint{ cursor->position.x, cursor->position.y };
|
||||
}
|
||||
}
|
||||
|
||||
struct spa_meta_region* videoMetadata =
|
||||
static_cast<struct spa_meta_region*>(spa_buffer_find_meta_data(
|
||||
spaBuffer, SPA_META_VideoCrop, sizeof(*videoMetadata)));
|
||||
@@ -848,7 +792,7 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
}
|
||||
|
||||
const qint32 dstStride = videoSize.width() * BYTES_PER_PIXEL;
|
||||
Q_ASSERT(dstStride <= srcStride);
|
||||
const qint32 srcStride = spaBuffer->datas[0].chunk->stride;
|
||||
|
||||
if (!videoFullHeight && (videoMetadata->region.position.y + videoSize.height() <= streamSize.height())) {
|
||||
src += srcStride * videoMetadata->region.position.y;
|
||||
@@ -879,21 +823,15 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
}
|
||||
|
||||
if (videoFormat->format != SPA_VIDEO_FORMAT_RGB) {
|
||||
QImage img((uchar*) q->fb, videoSize.width(), videoSize.height(), dstStride, spaToQImageFormat(videoFormat->format));
|
||||
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, videoSize.width(), videoSize.height(), dstStride, format);
|
||||
img.convertTo(QImage::Format_RGB888);
|
||||
}
|
||||
|
||||
if (spa_meta* vdMeta = spa_buffer_find_meta(spaBuffer, SPA_META_VideoDamage)) {
|
||||
struct spa_meta_region *r;
|
||||
spa_meta_for_each(r, vdMeta) {
|
||||
if (!spa_meta_region_is_valid(r))
|
||||
break;
|
||||
|
||||
q->tiles.append(QRect(r->region.position.x, r->region.position.y, r->region.size.width, r->region.size.height));
|
||||
}
|
||||
} else {
|
||||
q->tiles.append(QRect(0, 0, videoSize.width(), videoSize.height()));
|
||||
}
|
||||
q->tiles.append(QRect(0, 0, videoSize.width(), videoSize.height()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -965,6 +903,10 @@ PWFrameBuffer::PWFrameBuffer(WId winid, QObject *parent)
|
||||
: FrameBuffer (winid, parent),
|
||||
d(new Private(this))
|
||||
{
|
||||
// D-Bus is most important in init chain, no toys for us if something is wrong with XDP
|
||||
// PipeWire connectivity is initialized after D-Bus session is started
|
||||
d->initDbus();
|
||||
|
||||
fb = nullptr;
|
||||
}
|
||||
|
||||
@@ -974,38 +916,6 @@ PWFrameBuffer::~PWFrameBuffer()
|
||||
fb = nullptr;
|
||||
}
|
||||
|
||||
void PWFrameBuffer::initDBus()
|
||||
{
|
||||
d->initDbus();
|
||||
}
|
||||
|
||||
void PWFrameBuffer::startVirtualMonitor(const QString& name, const QSize& resolution, qreal dpr)
|
||||
{
|
||||
d->videoSize = resolution * dpr;
|
||||
using namespace KWayland::Client;
|
||||
auto connection = ConnectionThread::fromApplication(this);
|
||||
if (!connection) {
|
||||
qWarning() << "Failed getting Wayland connection from QPA";
|
||||
QCoreApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
auto registry = new Registry(this);
|
||||
connect(registry, &KWayland::Client::Registry::interfaceAnnounced, this, [this, registry, name, dpr, resolution] (const QByteArray &interfaceName, quint32 wlname, quint32 version) {
|
||||
if (interfaceName != "zkde_screencast_unstable_v1")
|
||||
return;
|
||||
|
||||
auto screencasting = new Screencasting(registry, wlname, version, this);
|
||||
auto r = screencasting->createVirtualMonitorStream(name, resolution, dpr, Screencasting::Metadata);
|
||||
connect(r, &ScreencastingStream::created, this, [this] (quint32 nodeId) {
|
||||
d->pwStreamNodeId = nodeId;
|
||||
d->initPw();
|
||||
});
|
||||
});
|
||||
registry->create(connection);
|
||||
registry->setup();
|
||||
}
|
||||
|
||||
int PWFrameBuffer::depth()
|
||||
{
|
||||
return 32;
|
||||
@@ -1059,8 +969,3 @@ bool PWFrameBuffer::isValid() const
|
||||
{
|
||||
return d->isValid;
|
||||
}
|
||||
|
||||
QPoint PWFrameBuffer::cursorPosition()
|
||||
{
|
||||
return d->cursorPosition;
|
||||
}
|
||||
|
||||
@@ -24,18 +24,15 @@ class PWFrameBuffer: public FrameBuffer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using Stream = struct {
|
||||
typedef struct {
|
||||
uint nodeId;
|
||||
QVariantMap map;
|
||||
};
|
||||
using Streams = QList<Stream>;
|
||||
} Stream;
|
||||
typedef QList<Stream> Streams;
|
||||
|
||||
PWFrameBuffer(WId winid, QObject *parent = nullptr);
|
||||
virtual ~PWFrameBuffer() override;
|
||||
|
||||
void initDBus();
|
||||
void startVirtualMonitor(const QString &name, const QSize &resolution, qreal dpr);
|
||||
|
||||
int depth() override;
|
||||
int height() override;
|
||||
int width() override;
|
||||
@@ -43,7 +40,6 @@ public:
|
||||
void getServerFormat(rfbPixelFormat &format) override;
|
||||
void startMonitor() override;
|
||||
void stopMonitor() override;
|
||||
QPoint cursorPosition() override;
|
||||
|
||||
QVariant customProperty(const QString &property) const override;
|
||||
|
||||
|
||||
@@ -36,18 +36,10 @@ PWFrameBufferPlugin::~PWFrameBufferPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
FrameBuffer *PWFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
|
||||
{
|
||||
//NOTE WId is irrelevant in Wayland
|
||||
|
||||
FrameBuffer *PWFrameBufferPlugin::frameBuffer(WId id)
|
||||
{
|
||||
auto pwfb = new PWFrameBuffer(id);
|
||||
if (args.contains(QLatin1String("name"))) {
|
||||
pwfb->startVirtualMonitor(args[QStringLiteral("name")].toString(), args[QStringLiteral("resolution")].toSize(), args[QStringLiteral("scale")].toDouble());
|
||||
} else {
|
||||
// D-Bus is most important in XDG-Desktop-Portals init chain, no toys for us if something is wrong with XDP
|
||||
// PipeWire connectivity is initialized after D-Bus session is started
|
||||
pwfb->initDBus();
|
||||
}
|
||||
|
||||
// sanity check for dbus/wayland/pipewire errors
|
||||
if (!pwfb->isValid()) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
PWFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
virtual ~PWFrameBufferPlugin() override;
|
||||
|
||||
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
|
||||
FrameBuffer *frameBuffer(WId id) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(PWFrameBufferPlugin)
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
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 <KWayland/Client/output.h>
|
||||
#include <KWayland/Client/plasmawindowmanagement.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <QDebug>
|
||||
#include <QRect>
|
||||
|
||||
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;
|
||||
Q_EMIT q->created(node);
|
||||
}
|
||||
|
||||
void zkde_screencast_stream_unstable_v1_closed() override
|
||||
{
|
||||
Q_EMIT q->closed();
|
||||
}
|
||||
|
||||
void zkde_screencast_stream_unstable_v1_failed(const QString &error) override
|
||||
{
|
||||
Q_EMIT q->failed(error);
|
||||
}
|
||||
|
||||
uint m_nodeId = 0;
|
||||
QPointer<ScreencastingStream> q;
|
||||
};
|
||||
|
||||
ScreencastingStream::ScreencastingStream(QObject *parent)
|
||||
: QObject(parent)
|
||||
, d(new ScreencastingStreamPrivate(this))
|
||||
{
|
||||
}
|
||||
|
||||
ScreencastingStream::~ScreencastingStream() = default;
|
||||
|
||||
quint32 ScreencastingStream::nodeId() const
|
||||
{
|
||||
return d->m_nodeId;
|
||||
}
|
||||
|
||||
class ScreencastingPrivate : public QtWayland::zkde_screencast_unstable_v1
|
||||
{
|
||||
public:
|
||||
ScreencastingPrivate(Registry *registry, int id, int version, Screencasting *q)
|
||||
: QtWayland::zkde_screencast_unstable_v1(*registry, id, version)
|
||||
, q(q)
|
||||
{
|
||||
}
|
||||
|
||||
ScreencastingPrivate(::zkde_screencast_unstable_v1 *screencasting, Screencasting *q)
|
||||
: QtWayland::zkde_screencast_unstable_v1(screencasting)
|
||||
, q(q)
|
||||
{
|
||||
}
|
||||
|
||||
~ScreencastingPrivate()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
Screencasting *const q;
|
||||
};
|
||||
|
||||
Screencasting::Screencasting(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
Screencasting::Screencasting(Registry *registry, int id, int version, QObject *parent)
|
||||
: QObject(parent)
|
||||
, d(new ScreencastingPrivate(registry, id, version, this))
|
||||
{
|
||||
}
|
||||
|
||||
Screencasting::~Screencasting() = default;
|
||||
|
||||
ScreencastingStream *Screencasting::createOutputStream(Output *output, CursorMode mode)
|
||||
{
|
||||
auto stream = new ScreencastingStream(this);
|
||||
stream->setObjectName(output->model());
|
||||
stream->d->init(d->stream_output(*output, mode));
|
||||
return stream;
|
||||
}
|
||||
|
||||
ScreencastingStream *Screencasting::createWindowStream(PlasmaWindow *window, CursorMode mode)
|
||||
{
|
||||
auto stream = createWindowStream(QString::fromUtf8(window->uuid()), mode);
|
||||
stream->setObjectName(window->appId());
|
||||
return stream;
|
||||
}
|
||||
|
||||
ScreencastingStream *Screencasting::createWindowStream(const QString &uuid, CursorMode mode)
|
||||
{
|
||||
auto stream = new ScreencastingStream(this);
|
||||
stream->d->init(d->stream_window(uuid, mode));
|
||||
return stream;
|
||||
}
|
||||
|
||||
ScreencastingStream * Screencasting::createVirtualMonitorStream(const QString& name, const QSize& resolution, qreal dpr, Screencasting::CursorMode mode)
|
||||
{
|
||||
auto stream = new ScreencastingStream(this);
|
||||
stream->d->init(d->stream_virtual_output(name, resolution.width(), resolution.height(), wl_fixed_from_double(dpr), mode));
|
||||
return stream;
|
||||
}
|
||||
|
||||
void Screencasting::setup(::zkde_screencast_unstable_v1 *screencasting)
|
||||
{
|
||||
d.reset(new ScreencastingPrivate(screencasting, this));
|
||||
}
|
||||
|
||||
void Screencasting::destroy()
|
||||
{
|
||||
d.reset(nullptr);
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QVector>
|
||||
#include <optional>
|
||||
|
||||
struct zkde_screencast_unstable_v1;
|
||||
|
||||
namespace KWayland
|
||||
{
|
||||
namespace Client
|
||||
{
|
||||
class PlasmaWindow;
|
||||
class Registry;
|
||||
class Output;
|
||||
}
|
||||
}
|
||||
|
||||
class ScreencastingPrivate;
|
||||
class ScreencastingSourcePrivate;
|
||||
class ScreencastingStreamPrivate;
|
||||
class ScreencastingStream : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ScreencastingStream(QObject *parent);
|
||||
~ScreencastingStream() override;
|
||||
|
||||
quint32 nodeId() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void created(quint32 nodeid);
|
||||
void failed(const QString &error);
|
||||
void closed();
|
||||
|
||||
private:
|
||||
friend class Screencasting;
|
||||
QScopedPointer<ScreencastingStreamPrivate> d;
|
||||
};
|
||||
|
||||
class Screencasting : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Screencasting(QObject *parent = nullptr);
|
||||
explicit Screencasting(KWayland::Client::Registry *registry, int id, int version, QObject *parent = nullptr);
|
||||
~Screencasting() override;
|
||||
|
||||
enum CursorMode {
|
||||
Hidden = 1,
|
||||
Embedded = 2,
|
||||
Metadata = 4,
|
||||
};
|
||||
Q_ENUM(CursorMode);
|
||||
|
||||
ScreencastingStream *createOutputStream(KWayland::Client::Output *output, CursorMode mode);
|
||||
ScreencastingStream *createWindowStream(KWayland::Client::PlasmaWindow *window, CursorMode mode);
|
||||
ScreencastingStream *createWindowStream(const QString &uuid, CursorMode mode);
|
||||
ScreencastingStream *createVirtualMonitorStream(const QString &name, const QSize &resolution, qreal dpr, CursorMode mode);
|
||||
|
||||
void setup(zkde_screencast_unstable_v1 *screencasting);
|
||||
void destroy();
|
||||
|
||||
Q_SIGNALS:
|
||||
void initialized();
|
||||
void removed();
|
||||
void sourcesChanged();
|
||||
|
||||
private:
|
||||
QScopedPointer<ScreencastingPrivate> d;
|
||||
};
|
||||
@@ -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",
|
||||
|
||||
@@ -26,7 +26,11 @@ 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;
|
||||
@@ -104,7 +108,11 @@ 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;
|
||||
|
||||
}
|
||||
|
||||
@@ -36,9 +36,8 @@ QtFrameBufferPlugin::~QtFrameBufferPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
FrameBuffer *QtFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
|
||||
FrameBuffer *QtFrameBufferPlugin::frameBuffer(WId id)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
return new QtFrameBuffer(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
QtFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
~QtFrameBufferPlugin() override;
|
||||
|
||||
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
|
||||
FrameBuffer *frameBuffer(WId id) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QtFrameBufferPlugin)
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -605,7 +605,7 @@ QList<QRect> XCBFrameBuffer::modifiedTiles() {
|
||||
} else {
|
||||
// not using shared memory
|
||||
// will use just xcb_image_get() and copy pixels
|
||||
for (const QRect& r : std::as_const(tiles)) {
|
||||
for (const QRect& r : qAsConst(tiles)) {
|
||||
// I did not find XGetSubImage() analog in XCB!!
|
||||
// need function that copies pixels from one image to another
|
||||
xcb_image_t *damagedImage = xcb_image_get(
|
||||
|
||||
@@ -37,9 +37,8 @@ XCBFrameBufferPlugin::~XCBFrameBufferPlugin()
|
||||
}
|
||||
|
||||
|
||||
FrameBuffer *XCBFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
|
||||
FrameBuffer *XCBFrameBufferPlugin::frameBuffer(WId id)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
return new XCBFrameBuffer(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
XCBFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
~XCBFrameBufferPlugin() override;
|
||||
|
||||
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
|
||||
FrameBuffer *frameBuffer(WId id) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(XCBFrameBufferPlugin)
|
||||
|
||||
@@ -78,7 +78,7 @@ kconfig_add_kcfg_files (krfb_SRCS
|
||||
krfbconfig.kcfgc
|
||||
)
|
||||
|
||||
ki18n_wrap_ui (krfb_UI_SRCS
|
||||
ki18n_wrap_ui (krfb_SRCS
|
||||
ui/configtcp.ui
|
||||
ui/configsecurity.ui
|
||||
ui/configframebuffer.ui
|
||||
@@ -92,7 +92,6 @@ qt5_add_resources(krfb_SRCS
|
||||
|
||||
add_executable (krfb
|
||||
${krfb_SRCS}
|
||||
${krfb_UI_SRCS}
|
||||
)
|
||||
|
||||
target_link_libraries (krfb
|
||||
@@ -124,41 +123,6 @@ install (TARGETS krfb
|
||||
${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
|
||||
)
|
||||
|
||||
#################################
|
||||
kconfig_add_kcfg_files (krfbvm_SRCS
|
||||
krfbconfig.kcfgc
|
||||
)
|
||||
|
||||
ecm_qt_declare_logging_category(krfbvm_SRCS
|
||||
HEADER krfbdebug.h
|
||||
IDENTIFIER KRFB
|
||||
CATEGORY_NAME krfb.krfb
|
||||
DESCRIPTION "KRFB Application"
|
||||
EXPORT KRFB
|
||||
)
|
||||
|
||||
add_executable(krfb-virtualmonitor main-virtualmonitor.cpp ${krfbvm_SRCS} ${krfb_UI_SRCS}
|
||||
rfbserver.cpp rfbclient.cpp rfbservermanager.cpp eventsmanager.cpp framebuffermanager.cpp sockethelpers.cpp)
|
||||
target_link_libraries(krfb-virtualmonitor
|
||||
krfbprivate
|
||||
Qt5::Gui
|
||||
Qt5::Network
|
||||
KF5::ConfigGui
|
||||
KF5::CoreAddons
|
||||
KF5::I18n
|
||||
KF5::Notifications
|
||||
KF5::WindowSystem
|
||||
)
|
||||
|
||||
install (TARGETS krfb-virtualmonitor
|
||||
${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
|
||||
)
|
||||
|
||||
configure_file(org.kde.krfb.virtualmonitor.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/org.kde.krfb.virtualmonitor.desktop @ONLY)
|
||||
install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.krfb.virtualmonitor.desktop
|
||||
DESTINATION ${KDE_INSTALL_APPDIR}
|
||||
)
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install (PROGRAMS org.kde.krfb.desktop
|
||||
|
||||
@@ -37,9 +37,9 @@ ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle(i18n("New Connection"));
|
||||
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||
auto mainWidget = new QWidget(this);
|
||||
auto mainLayout = new QVBoxLayout;
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||
QWidget *mainWidget = new QWidget(this);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
setLayout(mainLayout);
|
||||
mainLayout->addWidget(mainWidget);
|
||||
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
|
||||
|
||||
@@ -36,7 +36,7 @@ class KRFBPRIVATE_EXPORT EventHandler : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EventHandler(QObject *parent = nullptr);
|
||||
~EventHandler() override = default;
|
||||
virtual ~EventHandler() = default;
|
||||
virtual void handleKeyboard(bool down, rfbKeySym key) = 0;
|
||||
virtual void handlePointer(int buttonMask, int x, int y) = 0;
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ void EventsManager::loadPlugins()
|
||||
{
|
||||
//qDebug();
|
||||
|
||||
const QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins(QStringLiteral("krfb/events"));
|
||||
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb/events"));
|
||||
|
||||
QVectorIterator<KPluginMetaData> i(plugins);
|
||||
i.toBack();
|
||||
|
||||
@@ -43,7 +43,7 @@ class KRFBPRIVATE_EXPORT EventsManager : public QObject
|
||||
public:
|
||||
static EventsManager *instance();
|
||||
|
||||
~EventsManager() override;
|
||||
virtual ~EventsManager();
|
||||
|
||||
QSharedPointer<EventHandler> eventHandler();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class KRFBPRIVATE_EXPORT EventsPlugin : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
EventsPlugin(QObject *parent, const QVariantList &args);
|
||||
~EventsPlugin() override;
|
||||
virtual ~EventsPlugin();
|
||||
|
||||
virtual EventHandler *eventHandler() = 0;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
#include "framebuffer.h"
|
||||
|
||||
#include <config-krfb.h>
|
||||
#include <QCursor>
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
|
||||
FrameBuffer::FrameBuffer(WId id, QObject *parent)
|
||||
@@ -72,8 +73,3 @@ void FrameBuffer::startMonitor()
|
||||
void FrameBuffer::stopMonitor()
|
||||
{
|
||||
}
|
||||
|
||||
QPoint FrameBuffer::cursorPosition()
|
||||
{
|
||||
return QCursor::pos();
|
||||
}
|
||||
|
||||
@@ -42,12 +42,10 @@ public:
|
||||
virtual int depth();
|
||||
virtual void startMonitor();
|
||||
virtual void stopMonitor();
|
||||
virtual QPoint cursorPosition();
|
||||
|
||||
virtual void getServerFormat(rfbPixelFormat &format);
|
||||
|
||||
virtual QVariant customProperty(const QString &property) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void frameBufferChanged();
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ void FrameBufferManager::loadPlugins()
|
||||
}
|
||||
}
|
||||
|
||||
QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id, const QVariantMap &args)
|
||||
QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
|
||||
{
|
||||
//qDebug();
|
||||
|
||||
@@ -118,7 +118,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id, const QVaria
|
||||
if (iter.key() == KrfbConfig::preferredFrameBufferPlugin()) {
|
||||
qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
||||
|
||||
QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id, args));
|
||||
QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id));
|
||||
|
||||
if (frameBuffer) {
|
||||
m_frameBuffers.insert(id, frameBuffer.toWeakRef());
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
~FrameBufferManager() override;
|
||||
|
||||
QSharedPointer<FrameBuffer> frameBuffer(WId id, const QVariantMap &args);
|
||||
QSharedPointer<FrameBuffer> frameBuffer(WId id);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(FrameBufferManager)
|
||||
|
||||
@@ -34,10 +34,10 @@ class KRFBPRIVATE_EXPORT FrameBufferPlugin : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
FrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
~FrameBufferPlugin() override;
|
||||
|
||||
virtual FrameBuffer *frameBuffer(WId id, const QVariantMap &args) = 0;
|
||||
virtual FrameBuffer *frameBuffer(WId id) = 0;
|
||||
};
|
||||
|
||||
#endif // Header guard
|
||||
|
||||
@@ -52,6 +52,10 @@ PendingInvitationsRfbClient::PendingInvitationsRfbClient(rfbClientPtr client, QO
|
||||
d(new Private(client))
|
||||
{
|
||||
d->client->clientGoneHook = clientGoneHookNoop;
|
||||
d->notifier = new QSocketNotifier(client->sock, QSocketNotifier::Read, this);
|
||||
d->notifier->setEnabled(true);
|
||||
connect(d->notifier, &QSocketNotifier::activated,
|
||||
this, &PendingInvitationsRfbClient::onSocketActivated);
|
||||
}
|
||||
|
||||
PendingInvitationsRfbClient::~PendingInvitationsRfbClient()
|
||||
@@ -86,6 +90,39 @@ void PendingInvitationsRfbClient::processNewClient()
|
||||
}
|
||||
}
|
||||
|
||||
void PendingInvitationsRfbClient::onSocketActivated()
|
||||
{
|
||||
//Process not only one, but all pending messages.
|
||||
//poll() idea/code copied from vino:
|
||||
// Copyright (C) 2003 Sun Microsystems, Inc.
|
||||
// License: GPL v2 or later
|
||||
struct pollfd pollfd = { d->client->sock, POLLIN|POLLPRI, 0 };
|
||||
|
||||
while(poll(&pollfd, 1, 0) == 1) {
|
||||
|
||||
if(d->client->state == rfbClientRec::RFB_INITIALISATION) {
|
||||
d->notifier->setEnabled(false);
|
||||
//Client is Authenticated
|
||||
processNewClient();
|
||||
break;
|
||||
}
|
||||
rfbProcessClientMessage(d->client);
|
||||
|
||||
//This is how we handle disconnection.
|
||||
//if rfbProcessClientMessage() finds out that it can't read the socket,
|
||||
//it closes it and sets it to -1. So, we just have to check this here
|
||||
//and call rfbClientConnectionGone() if necessary. This will call
|
||||
//the clientGoneHook which in turn will remove this RfbClient instance
|
||||
//from the server manager and will call deleteLater() to delete it
|
||||
if (d->client->sock == -1) {
|
||||
qCDebug(KRFB) << "disconnected from socket signal";
|
||||
d->notifier->setEnabled(false);
|
||||
rfbClientConnectionGone(d->client);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool PendingInvitationsRfbClient::checkPassword(const QByteArray & encryptedPassword)
|
||||
{
|
||||
qCDebug(KRFB) << "about to start authentication";
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
|
||||
protected Q_SLOTS:
|
||||
void processNewClient() override;
|
||||
virtual void onSocketActivated();
|
||||
bool checkPassword(const QByteArray & encryptedPassword) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "invitationsrfbserver.h"
|
||||
#include "invitationsrfbclient.h"
|
||||
#include "krfbconfig.h"
|
||||
#include "rfbservermanager.h"
|
||||
#include "krfbdebug.h"
|
||||
#include <QTimer>
|
||||
#include <QApplication>
|
||||
@@ -32,13 +33,7 @@
|
||||
#include <KStringHandler>
|
||||
#include <KWallet/KWallet>
|
||||
|
||||
#include <kdnssd_version.h>
|
||||
#if KDNSSD_VERSION >= QT_VERSION_CHECK(5, 84, 0)
|
||||
#include <KDNSSD/PublicService>
|
||||
#else
|
||||
#include <DNSSD/PublicService>
|
||||
#endif
|
||||
|
||||
#include <dnssd/publicservice.h>
|
||||
using KWallet::Wallet;
|
||||
|
||||
// used for KWallet folder name
|
||||
@@ -177,7 +172,7 @@ void InvitationsRfbServer::walletOpened(bool opened)
|
||||
if (m_wallet->readPassword(QStringLiteral("desktopSharingPassword"), desktopPassword) == 0 &&
|
||||
!desktopPassword.isEmpty()) {
|
||||
m_desktopPassword = desktopPassword;
|
||||
Q_EMIT passwordChanged(m_desktopPassword);
|
||||
emit passwordChanged(m_desktopPassword);
|
||||
}
|
||||
|
||||
if(m_wallet->readPassword(QStringLiteral("unattendedAccessPassword"), unattendedPassword) == 0 &&
|
||||
@@ -194,7 +189,7 @@ void InvitationsRfbServer::walletOpened(bool opened)
|
||||
"desktopPassword", QString()));
|
||||
if(!desktopPassword.isEmpty()) {
|
||||
m_desktopPassword = desktopPassword;
|
||||
Q_EMIT passwordChanged(m_desktopPassword);
|
||||
emit passwordChanged(m_desktopPassword);
|
||||
}
|
||||
|
||||
unattendedPassword = KStringHandler::obscure(krfbConfig.readEntry(
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -518,7 +518,7 @@ Name[nds]=Leeg Passwoort
|
||||
Name[nl]=Ongeldig wachtwoord
|
||||
Name[nn]=Ugyldig passord
|
||||
Name[pa]=ਗਲਤ ਪਾਸਵਰਡ
|
||||
Name[pl]=Nieprawidłowe hasło
|
||||
Name[pl]=Błędne hasło
|
||||
Name[pt]=Senha Inválida
|
||||
Name[pt_BR]=Senha inválida
|
||||
Name[ro]=Parolă nevalidă
|
||||
@@ -589,7 +589,7 @@ Comment[nl]=Ongeldig wachtwoord
|
||||
Comment[nn]=Passordet var ugyldig
|
||||
Comment[oc]=Mot de pas invalid
|
||||
Comment[pa]=ਗਲਤ ਪਾਸਵਰਡ
|
||||
Comment[pl]=Nieprawidłowe hasło
|
||||
Comment[pl]=Błędne hasło
|
||||
Comment[pt]=A senha é inválida
|
||||
Comment[pt_BR]=Senha inválida
|
||||
Comment[ro]=Parolă nevalidă
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <KNotification>
|
||||
#include <KLocalizedString>
|
||||
#include <KWindowSystem>
|
||||
#include <KAboutData>
|
||||
#include "sockethelpers.h"
|
||||
#include "krfb_version.h"
|
||||
#include "rfbserver.h"
|
||||
#include <signal.h>
|
||||
#include "rfbservermanager.h"
|
||||
|
||||
class VirtualMonitorRfbClient : public RfbClient
|
||||
{
|
||||
public:
|
||||
explicit VirtualMonitorRfbClient(rfbClientPtr client, QObject *parent = nullptr)
|
||||
: RfbClient(client, parent)
|
||||
{}
|
||||
};
|
||||
|
||||
class PendingVirtualMonitorRfbClient : public PendingRfbClient
|
||||
{
|
||||
public:
|
||||
explicit PendingVirtualMonitorRfbClient(rfbClientPtr client, QObject *parent = nullptr)
|
||||
: PendingRfbClient(client, parent)
|
||||
{}
|
||||
~PendingVirtualMonitorRfbClient() override {}
|
||||
|
||||
static QByteArray password;
|
||||
|
||||
protected:
|
||||
void processNewClient() override {
|
||||
qDebug() << "new client!";
|
||||
const QString host = peerAddress(m_rfbClient->sock) + QLatin1Char(':') + QString::number(peerPort(m_rfbClient->sock));
|
||||
|
||||
KNotification::event(QStringLiteral("NewConnectionAutoAccepted"),
|
||||
i18n("Creating a Virtual Monitor from %1", host));
|
||||
}
|
||||
bool checkPassword(const QByteArray & encryptedPassword) override {
|
||||
bool b = vncAuthCheckPassword(password, encryptedPassword);
|
||||
if (b) {
|
||||
QTimer::singleShot(0, this, [this] {
|
||||
accept(new VirtualMonitorRfbClient(m_rfbClient, parent()));
|
||||
});
|
||||
}
|
||||
return b;
|
||||
}
|
||||
};
|
||||
|
||||
QByteArray PendingVirtualMonitorRfbClient::password;
|
||||
|
||||
class VirtualMonitorRfbServer : public RfbServer
|
||||
{
|
||||
public:
|
||||
PendingRfbClient *newClient(rfbClientPtr client) {
|
||||
qDebug() << "new client request";
|
||||
return new PendingVirtualMonitorRfbClient(client, this);
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
KLocalizedString::setApplicationDomain("krfb");
|
||||
|
||||
KAboutData aboutData(QStringLiteral("krfb-virtualmonitor"),
|
||||
i18n("Remote Virtual Monitor"),
|
||||
QStringLiteral(KRFB_VERSION_STRING),
|
||||
i18n("Offer a Virtual Monitor that can be accessed remotely"),
|
||||
KAboutLicense::GPL,
|
||||
i18n("(c) 2009-2010, Collabora Ltd.\n"
|
||||
"(c) 2007, Alessandro Praduroux\n"
|
||||
"(c) 2001-2003, Tim Jansen\n"
|
||||
"(c) 2001, Johannes E. Schindelin\n"
|
||||
"(c) 2000-2001, Const Kaplinsky\n"
|
||||
"(c) 2000, Tridia Corporation\n"
|
||||
"(c) 1999, AT&T Laboratories Boston\n"));
|
||||
aboutData.addAuthor(QStringLiteral("Aleix Pol i Gonzalez"), i18n("Virtual Monitor implementation"), QStringLiteral("aleixpol@kde.org"));
|
||||
aboutData.addAuthor(i18n("George Kiagiadakis"), QString(), QStringLiteral("george.kiagiadakis@collabora.co.uk"));
|
||||
aboutData.addAuthor(i18n("Alessandro Praduroux"), i18n("KDE4 porting"), QStringLiteral("pradu@pradu.it"));
|
||||
aboutData.addAuthor(i18n("Tim Jansen"), i18n("Original author"), QStringLiteral("tim@tjansen.de"));
|
||||
aboutData.addCredit(i18n("Johannes E. Schindelin"),
|
||||
i18n("libvncserver"));
|
||||
aboutData.addCredit(i18n("Const Kaplinsky"),
|
||||
i18n("TightVNC encoder"));
|
||||
aboutData.addCredit(i18n("Tridia Corporation"),
|
||||
i18n("ZLib encoder"));
|
||||
aboutData.addCredit(i18n("AT&T Laboratories Boston"),
|
||||
i18n("original VNC encoders and "
|
||||
"protocol design"));
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
|
||||
QCommandLineParser parser;
|
||||
aboutData.setupCommandLine(&parser);
|
||||
const QCommandLineOption resolutionOption({ QStringLiteral("resolution") }, i18n("Logical resolution of the new monitor"), i18n("resolution"));
|
||||
parser.addOption(resolutionOption);
|
||||
const QCommandLineOption nameOption({ QStringLiteral("name") }, i18n("Name of the monitor"), i18n("name"));
|
||||
parser.addOption(nameOption);
|
||||
const QCommandLineOption passwordOption({ QStringLiteral("password") }, i18n("Password for the client to connect to it"), i18n("password"));
|
||||
parser.addOption(passwordOption);
|
||||
const QCommandLineOption scaleOption({ QStringLiteral("scale") }, i18n("The device-pixel-ratio of the device, the scaling factor"), i18n("dpr"), QStringLiteral("1"));
|
||||
parser.addOption(scaleOption);
|
||||
const QCommandLineOption portOption({ QStringLiteral("port") }, i18n("The port we will be listening to"), i18n("number"), QStringLiteral("9999"));
|
||||
parser.addOption(portOption);
|
||||
|
||||
parser.process(app);
|
||||
aboutData.processCommandLine(&parser);
|
||||
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
|
||||
if (!KWindowSystem::isPlatformWayland()) {
|
||||
qCritical() << "Virtual Monitors are only supported on Wayland";
|
||||
return 1;
|
||||
}
|
||||
if (!parser.isSet(nameOption)) {
|
||||
qCritical() << "error: please define --name";
|
||||
return 2;
|
||||
} else {
|
||||
if (!parser.isSet(passwordOption)) {
|
||||
qCritical() << "error: please define --password";
|
||||
return 3;
|
||||
}
|
||||
if (!parser.isSet(resolutionOption)) {
|
||||
qCritical() << "error: please define --resolution";
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
if (!parser.isSet(portOption)) {
|
||||
qCritical() << "error: please define --port";
|
||||
return 5;
|
||||
}
|
||||
const QString res = parser.value(resolutionOption);
|
||||
const auto resSplit = res.split(QLatin1Char('x'));
|
||||
if (resSplit.size() != 2) {
|
||||
qCritical() << "error: the resolution should be formatted as WIDTHxHEIGHT (e.g. --resolution 1920x1080)";
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
if (parser.isSet(nameOption)) {
|
||||
RfbServerManager::s_pluginArgs = {
|
||||
{ QStringLiteral("name"), parser.value(nameOption) },
|
||||
{ QStringLiteral("resolution"), QSize(resSplit[0].toInt(), resSplit[1].toInt()) },
|
||||
{ QStringLiteral("scale"), parser.value(scaleOption).toDouble() },
|
||||
};
|
||||
}
|
||||
|
||||
VirtualMonitorRfbServer server;
|
||||
server.setPasswordRequired(true);
|
||||
server.setListeningPort(parser.value(portOption).toInt());
|
||||
PendingVirtualMonitorRfbClient::password = parser.value(passwordOption).toUtf8();
|
||||
|
||||
sigset_t sigs;
|
||||
sigemptyset(&sigs);
|
||||
sigaddset(&sigs, SIGPIPE);
|
||||
sigprocmask(SIG_BLOCK, &sigs, nullptr);
|
||||
server.start();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
@@ -39,7 +39,7 @@
|
||||
class TCP: public QWidget, public Ui::TCP
|
||||
{
|
||||
public:
|
||||
explicit TCP(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
TCP(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
}
|
||||
};
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
class Security: public QWidget, public Ui::Security
|
||||
{
|
||||
public:
|
||||
explicit Security(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
Security(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
walletWarning = new KMessageWidget(this);
|
||||
walletWarning->setText(i18n("Storing passwords in config file is insecure!"));
|
||||
@@ -107,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
m_passwordLineEdit->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
auto mainWidget = new QWidget;
|
||||
QWidget *mainWidget = new QWidget;
|
||||
m_ui.setupUi(mainWidget);
|
||||
m_ui.krfbIconLabel->setPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(128));
|
||||
m_ui.enableUnattendedCheckBox->setChecked(
|
||||
@@ -252,7 +252,7 @@ void MainWindow::showConfiguration()
|
||||
return;
|
||||
}
|
||||
|
||||
auto dialog = new KConfigDialog(this, QStringLiteral("settings"), KrfbConfig::self());
|
||||
KConfigDialog *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 = nullptr;
|
||||
QLineEdit *m_passwordLineEdit;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,14 +43,11 @@
|
||||
<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>
|
||||
@@ -148,9 +145,9 @@
|
||||
</provides>
|
||||
<project_group>KDE</project_group>
|
||||
<releases>
|
||||
<release version="21.12.2" date="2022-02-03"/>
|
||||
<release version="21.12.1" date="2022-01-06"/>
|
||||
<release version="21.12.0" date="2021-12-09"/>
|
||||
<release version="21.08.3" date="2021-11-04"/>
|
||||
<release version="21.04.1" date="2021-05-13"/>
|
||||
<release version="21.04.0" date="2021-04-22"/>
|
||||
<release version="20.12.3" date="2021-03-04"/>
|
||||
<release version="20.12.2" date="2021-02-04"/>
|
||||
</releases>
|
||||
</component>
|
||||
|
||||
@@ -84,8 +84,6 @@ 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)
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
# KDE Config File
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Exec=@CMAKE_INSTALL_PREFIX@/bin/krfb-virtualmonitor
|
||||
Icon=krfb
|
||||
Terminal=false
|
||||
Name=KRFBs Virtual Monitor
|
||||
Name[ca]=Monitor virtual del Krfb
|
||||
Name[ca@valencia]=Monitor virtual del Krfb
|
||||
Name[el]=Εικονική οθόνη του KRFB
|
||||
Name[en_GB]=KRFBs Virtual Monitor
|
||||
Name[es]=Monitor virtual de KRFB
|
||||
Name[fi]=KRFB:n virtuaalinäyttö
|
||||
Name[fr]=Moniteur virtuel « Krfb »
|
||||
Name[ia]=Virtual Monitor de KRFB
|
||||
Name[it]=Monitor virtuale di KRFB
|
||||
Name[ko]=KRFBs 가상 모니터
|
||||
Name[nl]=Virtuele monitor van KRFB
|
||||
Name[pl]=Monitor wirtualny KRFB
|
||||
Name[pt]=Monitor Virtual do KRFB
|
||||
Name[pt_BR]=Monitor virtual do KRFB
|
||||
Name[sl]=Navidezni monitor KRFB
|
||||
Name[sv]=Krfb:s virtuella bildskärm
|
||||
Name[uk]=Віртуальний монітор KRFB
|
||||
Name[x-test]=xxKRFBs Virtual Monitorxx
|
||||
Comment=Remote Virtual Monitor
|
||||
Comment[ca]=Monitor virtual remot
|
||||
Comment[ca@valencia]=Monitor virtual remot
|
||||
Comment[el]=Απομακρυσμένη εικονική οθόνη
|
||||
Comment[en_GB]=Remote Virtual Monitor
|
||||
Comment[es]=Monitor virtual remoto
|
||||
Comment[fi]=Virtuaalinen etänäyttö
|
||||
Comment[fr]=Moniteur virtuel distant
|
||||
Comment[ia]=Monitor Virtual Remote
|
||||
Comment[it]=Monitor virtuale remoto
|
||||
Comment[ko]=원격 가상 모니터
|
||||
Comment[nl]=Virtual Monitor op afstand
|
||||
Comment[pl]=Zdalny monitor wirtualny
|
||||
Comment[pt]=Monitor Virtual Remoto
|
||||
Comment[pt_BR]=Monitor virtual remoto
|
||||
Comment[sl]=Oddaljeni navidezni monitor
|
||||
Comment[sv]=Virtuell fjärrbildskärm
|
||||
Comment[uk]=Віддалений віртуальний монітор
|
||||
Comment[x-test]=xxRemote Virtual Monitorxx
|
||||
NoDisplay=true
|
||||
X-KDE-Wayland-Interfaces=zkde_screencast_unstable_v1
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <QSocketNotifier>
|
||||
#include <poll.h>
|
||||
#include <strings.h> //for bzero()
|
||||
#include "krfbdebug.h"
|
||||
|
||||
struct RfbClient::Private
|
||||
{
|
||||
@@ -171,13 +170,8 @@ void RfbClient::update()
|
||||
|
||||
PendingRfbClient::PendingRfbClient(rfbClientPtr client, QObject *parent)
|
||||
: QObject(parent), m_rfbClient(client)
|
||||
, m_notifier(new QSocketNotifier(client->sock, QSocketNotifier::Read, this))
|
||||
{
|
||||
m_rfbClient->clientData = this;
|
||||
|
||||
m_notifier->setEnabled(true);
|
||||
connect(m_notifier, &QSocketNotifier::activated,
|
||||
this, &PendingRfbClient::onSocketActivated);
|
||||
}
|
||||
|
||||
PendingRfbClient::~PendingRfbClient()
|
||||
@@ -236,35 +230,3 @@ bool PendingRfbClient::vncAuthCheckPassword(const QByteArray& password, const QB
|
||||
rfbEncryptBytes(challenge, passwd);
|
||||
return memcmp(challenge, encryptedPassword.constData(), encryptedPassword.size()) == 0;
|
||||
}
|
||||
|
||||
void PendingRfbClient::onSocketActivated()
|
||||
{
|
||||
//Process not only one, but all pending messages.
|
||||
//poll() idea/code copied from vino:
|
||||
// Copyright (C) 2003 Sun Microsystems, Inc.
|
||||
// License: GPL v2 or later
|
||||
struct pollfd pollfd = { m_rfbClient->sock, POLLIN|POLLPRI, 0 };
|
||||
|
||||
while(poll(&pollfd, 1, 0) == 1) {
|
||||
if(m_rfbClient->state == rfbClientRec::RFB_INITIALISATION) {
|
||||
m_notifier->setEnabled(false);
|
||||
//Client is Authenticated
|
||||
processNewClient();
|
||||
break;
|
||||
}
|
||||
rfbProcessClientMessage(m_rfbClient);
|
||||
|
||||
//This is how we handle disconnection.
|
||||
//if rfbProcessClientMessage() finds out that it can't read the socket,
|
||||
//it closes it and sets it to -1. So, we just have to check this here
|
||||
//and call rfbClientConnectionGone() if necessary. This will call
|
||||
//the clientGoneHook which in turn will remove this RfbClient instance
|
||||
//from the server manager and will call deleteLater() to delete it
|
||||
if (m_rfbClient->sock == -1) {
|
||||
qCDebug(KRFB) << "disconnected from socket signal";
|
||||
m_notifier->setEnabled(false);
|
||||
rfbClientConnectionGone(m_rfbClient);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include "rfb.h"
|
||||
#include <QObject>
|
||||
|
||||
class QSocketNotifier;
|
||||
|
||||
class RfbClient : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -106,11 +104,6 @@ protected:
|
||||
bool vncAuthCheckPassword(const QByteArray & password, const QByteArray & encryptedPassword) const;
|
||||
|
||||
rfbClientPtr m_rfbClient;
|
||||
|
||||
private:
|
||||
void onSocketActivated();
|
||||
|
||||
QSocketNotifier *const m_notifier;
|
||||
};
|
||||
|
||||
#endif // RFBCLIENT_H
|
||||
|
||||
@@ -117,7 +117,6 @@ bool RfbServer::start()
|
||||
}
|
||||
|
||||
d->screen->port = listeningPort();
|
||||
d->screen->ipv6port = listeningPort();
|
||||
|
||||
// Disable/Enable password checking
|
||||
if (passwordRequired()) {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "framebuffermanager.h"
|
||||
#include "sockethelpers.h"
|
||||
#include "krfbconfig.h"
|
||||
#include "krfbdebug.h"
|
||||
#include <QTimer>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
@@ -34,9 +33,6 @@
|
||||
#include <KLocalizedString>
|
||||
#include <KUser>
|
||||
#include <KNotification>
|
||||
#include <chrono>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
static const char *cur =
|
||||
" "
|
||||
@@ -120,12 +116,11 @@ QSharedPointer<FrameBuffer> RfbServerManager::framebuffer() const
|
||||
return d->fb;
|
||||
}
|
||||
|
||||
QVariantMap RfbServerManager::s_pluginArgs;
|
||||
|
||||
void RfbServerManager::init()
|
||||
{
|
||||
//qDebug();
|
||||
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId(), s_pluginArgs);
|
||||
|
||||
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId());
|
||||
d->myCursor = rfbMakeXCursor(19, 19, (char *) cur, (char *) mask);
|
||||
d->myCursor->cleanup = false;
|
||||
d->desktopName = QStringLiteral("%1@%2 (shared desktop)") //FIXME check if we can use utf8
|
||||
@@ -138,7 +133,7 @@ void RfbServerManager::init()
|
||||
|
||||
void RfbServerManager::updateFrameBuffer()
|
||||
{
|
||||
for (RfbServer *server : std::as_const(d->servers)) {
|
||||
Q_FOREACH(RfbServer *server, d->servers) {
|
||||
server->updateFrameBuffer(d->fb->data(), d->fb->width(), d->fb->height(), d->fb->depth());
|
||||
}
|
||||
}
|
||||
@@ -146,9 +141,9 @@ void RfbServerManager::updateFrameBuffer()
|
||||
void RfbServerManager::updateScreens()
|
||||
{
|
||||
QList<QRect> rects = d->fb->modifiedTiles();
|
||||
const QPoint currentCursorPos = d->fb->cursorPosition();
|
||||
QPoint currentCursorPos = QCursor::pos();
|
||||
|
||||
for (RfbServer* server : std::as_const(d->servers)) {
|
||||
for (RfbServer* server : qAsConst(d->servers)) {
|
||||
server->updateScreen(rects);
|
||||
server->updateCursorPosition(currentCursorPos);
|
||||
}
|
||||
@@ -204,7 +199,7 @@ rfbScreenInfoPtr RfbServerManager::newScreen()
|
||||
|
||||
//qDebug() << "bpp: " << bpp;
|
||||
|
||||
rfbLogEnable(KRFB().isDebugEnabled());
|
||||
rfbLogEnable(0);
|
||||
|
||||
screen = rfbGetScreen(nullptr, nullptr, w, h, 8, 3, bpp);
|
||||
screen->paddedWidthInBytes = d->fb->paddedWidth();
|
||||
@@ -222,7 +217,7 @@ void RfbServerManager::addClient(RfbClient* cc)
|
||||
if (d->clients.size() == 0) {
|
||||
//qDebug() << "Starting framebuffer monitor";
|
||||
d->fb->startMonitor();
|
||||
d->rfbUpdateTimer.start(50ms);
|
||||
d->rfbUpdateTimer.start(50);
|
||||
}
|
||||
d->clients.insert(cc);
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "rfb.h"
|
||||
#include "framebuffer.h"
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
class RfbClient;
|
||||
struct RfbServerManagerStatic;
|
||||
@@ -36,7 +35,6 @@ public:
|
||||
static RfbServerManager *instance();
|
||||
|
||||
QSharedPointer<FrameBuffer> framebuffer() const;
|
||||
static QVariantMap s_pluginArgs;
|
||||
Q_SIGNALS:
|
||||
void clientConnected(RfbClient *cc);
|
||||
void clientDisconnected(RfbClient *cc);
|
||||
|
||||
@@ -41,11 +41,11 @@ public:
|
||||
virtual ~ClientActions();
|
||||
|
||||
private:
|
||||
QMenu *m_menu = nullptr;
|
||||
QAction *m_title = nullptr;
|
||||
QAction *m_disconnectAction = nullptr;
|
||||
QAction *m_enableControlAction = nullptr;
|
||||
QAction *m_separator = nullptr;
|
||||
QMenu *m_menu;
|
||||
QAction *m_title;
|
||||
QAction *m_disconnectAction;
|
||||
QAction *m_enableControlAction;
|
||||
QAction *m_separator;
|
||||
};
|
||||
|
||||
ClientActions::ClientActions(RfbClient* client, QMenu* menu, QAction* before)
|
||||
|
||||
Reference in New Issue
Block a user