Compare commits

..

5 Commits

Author SHA1 Message Date
l10n daemon script
3897e48e87 GIT_SILENT made messages (after extraction) 2020-11-01 08:37:09 +01:00
Christoph Feck
4b3caa10f2 GIT_SILENT Update Appstream for new release 2020-10-31 18:29:34 +01:00
Christoph Feck
9483c5ab18 GIT_SILENT Upgrade release service version to 20.08.3. 2020-10-31 17:36:41 +01:00
l10n daemon script
38332f8134 GIT_SILENT made messages (after extraction) 2020-10-31 08:22:21 +01:00
l10n daemon script
9037a2e8c2 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-10-29 09:54:15 +01:00
33 changed files with 316 additions and 292 deletions

View File

@@ -1,15 +1,15 @@
cmake_minimum_required(VERSION 3.0)
# KDE Application Version, managed by release script
set (RELEASE_SERVICE_VERSION_MAJOR "21")
set (RELEASE_SERVICE_VERSION_MINOR "03")
set (RELEASE_SERVICE_VERSION_MICRO "80")
set (RELEASE_SERVICE_VERSION_MAJOR "20")
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.10.0)
set(KF5_MIN_VERSION 5.31.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})
@@ -20,7 +20,6 @@ include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMInstallIcons)
include(ECMAddAppIcon)
include(ECMSetupVersion)
include(ECMQtDeclareLoggingCategory)
include(FeatureSummary)
include(CheckIncludeFile)
@@ -30,6 +29,7 @@ find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core DBus Widgets X11Extr
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
I18n
Completion
Config
CoreAddons
Crash
@@ -104,10 +104,4 @@ add_subdirectory(framebuffers)
add_subdirectory(doc)
add_subdirectory(icons)
ecm_qt_install_logging_categories(
EXPORT KRFB
FILE krfb.categories
DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@@ -1,2 +1,2 @@
########### install files ###############
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR krfb)
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR krfb)

View File

@@ -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 ${PLUGIN_INSTALL_DIR}/krfb)

View File

@@ -13,7 +13,6 @@ 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
@@ -41,7 +40,6 @@ 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

View File

@@ -14,7 +14,6 @@
"Description[fi]": "KRfb:n X11 XFakeInput -pohjainen tapahtumakäsittelijä",
"Description[fr]": "Gestionnaire d'évènements utilisant XFakeInput de X11 pour KRfb",
"Description[gl]": "Xestor de eventos para KRfb baseado no XFakeInput de X11",
"Description[ia]": "Maneator de evento de X11 basate sur XFakeInput per KRfb",
"Description[it]": "Gestore eventi basato su XFakeInput di X11 per KRfb",
"Description[ko]": "X11 XFakeInput 기반 KRfb 이벤트 핸들러",
"Description[nl]": "Op X11 XFakeInput gebaseerde behandelaar van gebeurtenis voor KRfb",

View File

@@ -44,18 +44,18 @@ public:
EventData();
//keyboard
Display *dpy = nullptr;
signed char modifiers[0x100] = {};
KeyCode keycodes[0x100] = {};
KeyCode leftShiftCode = 0;
KeyCode rightShiftCode = 0;
KeyCode altGrCode = 0;
char modifierState = 0;
Display *dpy;
signed char modifiers[0x100];
KeyCode keycodes[0x100];
KeyCode leftShiftCode;
KeyCode rightShiftCode;
KeyCode altGrCode;
char modifierState;
//mouse
int buttonMask = 0;
int x = 0;
int y = 0;
int buttonMask;
int x;
int y;
private:
void init();

View File

@@ -23,5 +23,5 @@ target_link_libraries (krfb_events_xdp
)
install (TARGETS krfb_events_xdp
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
DESTINATION ${PLUGIN_INSTALL_DIR}/krfb
)

View File

@@ -13,7 +13,6 @@ 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
@@ -41,7 +40,6 @@ 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

View File

@@ -14,7 +14,6 @@
"Description[fi]": "KRfb:n XDG-desktop-portal-pohjainen tapahtumakäsittelijä",
"Description[fr]": "Gestionnaire d'évènements utilisant Xdg-desktop-portal pour KRfb",
"Description[gl]": "Xestor de eventos para KRfb baseado en Xdg-desktop-portal",
"Description[ia]": "Maneator de evento basate sur Xdg-desktop-portal per KRfb",
"Description[it]": "Gestore eventi basato su xdg-desktop-portal per KRfb",
"Description[ko]": "Xdg-desktop-portal 기반 KRfb 이벤트 핸들러",
"Description[nl]": "Op Xdg-desktop-portal gebaseerde behandelaar van gebeurtenis voor KRfb",
@@ -45,7 +44,6 @@
"Name[fi]": "KRfb:n XDG-desktop-portal-pohjainen tapahtumakäsittelijä",
"Name[fr]": "Gestionnaire d'évènements Xdg-desktop-portal pour KRfb",
"Name[gl]": "Xestor de eventos de Xdg-desktop-portal para KRfb",
"Name[ia]": "Maneator de evento basate sur Xdg-desktop-portal per KRfb",
"Name[it]": "Gestore eventi xdg-desktop-portal per KRfb",
"Name[ko]": "KRfb Xdg-desktop-portal 이벤트 핸들러",
"Name[nl]": "Op Xdg-desktop-portal behandelaar van gebeurtenis voor KRfb",

View File

@@ -36,9 +36,9 @@ public:
EventData();
//mouse
int buttonMask = 0;
int x = 0;
int y = 0;
int buttonMask;
int x;
int y;
QScopedPointer<OrgFreedesktopPortalRemoteDesktopInterface> dbusXdpRemoteDesktopService;
@@ -55,8 +55,10 @@ EventData::EventData()
void EventData::init()
{
dbusXdpRemoteDesktopService.reset(new OrgFreedesktopPortalRemoteDesktopInterface(QStringLiteral("org.freedesktop.portal.Desktop"),
QStringLiteral("/org/freedesktop/portal/desktop"), QDBusConnection::sessionBus()));
buttonMask = 0;
dbusXdpRemoteDesktopService.reset(new OrgFreedesktopPortalRemoteDesktopInterface(QLatin1String("org.freedesktop.portal.Desktop"),
QLatin1String("/org/freedesktop/portal/desktop"), QDBusConnection::sessionBus()));
}
void XdpEventHandler::handleKeyboard(bool down, rfbKeySym keySym)
@@ -69,8 +71,8 @@ void XdpEventHandler::handleKeyboard(bool down, rfbKeySym keySym)
void XdpEventHandler::handlePointer(int buttonMask, int x, int y)
{
const uint streamNodeId = frameBuffer()->customProperty(QStringLiteral("stream_node_id")).toUInt();
const QDBusObjectPath sessionHandle = frameBuffer()->customProperty(QStringLiteral("session_handle")).value<QDBusObjectPath>();
const uint streamNodeId = frameBuffer()->customProperty(QLatin1String("stream_node_id")).toUInt();
const QDBusObjectPath sessionHandle = frameBuffer()->customProperty(QLatin1String("session_handle")).value<QDBusObjectPath>();
if (streamNodeId == 0 || sessionHandle.path().isEmpty()) {
return;

View File

@@ -7,15 +7,6 @@ set (krfb_framebuffer_pw_SRCS
pw_framebufferplugin.cpp
)
ecm_qt_declare_logging_category(krfb_framebuffer_pw_SRCS
HEADER krfb_fb_pipewire_debug.h
IDENTIFIER KRFB_FB_PIPEWIRE
CATEGORY_NAME krfb.framebuffer.pipewire
DESCRIPTION "KRFB PipeWire framebuffer plugin"
EXPORT KRFB
)
qt5_add_dbus_interface(
krfb_framebuffer_pw_SRCS
${CMAKE_SOURCE_DIR}/dbus/xdp_dbus_screencast_interface.xml
@@ -49,5 +40,5 @@ target_link_libraries (krfb_framebuffer_pw
)
install (TARGETS krfb_framebuffer_pw
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
DESTINATION ${PLUGIN_INSTALL_DIR}/krfb
)

View File

@@ -13,6 +13,7 @@
#include <cstring>
// Qt
#include <QX11Info>
#include <QCoreApplication>
#include <QGuiApplication>
#include <QScreen>
@@ -39,12 +40,11 @@
#include <pipewire/pipewire.h>
#include <climits>
#include <limits.h>
#include "pw_framebuffer.h"
#include "xdp_dbus_screencast_interface.h"
#include "xdp_dbus_remotedesktop_interface.h"
#include "krfb_fb_pipewire_debug.h"
static const uint MIN_SUPPORTED_XDP_KDE_SC_VERSION = 1;
@@ -176,10 +176,10 @@ private:
struct {
quint32 width;
quint32 height;
} screenGeometry = {};
} screenGeometry;
// Allowed devices
uint devices = 0;
uint devices;
// sanity indicator
bool isValid = true;
@@ -215,15 +215,15 @@ PWFrameBuffer::Private::Private(PWFrameBuffer *q) : q(q)
void PWFrameBuffer::Private::initDbus()
{
qInfo() << "Initializing D-Bus connectivity with XDG Desktop Portal";
dbusXdpScreenCastService.reset(new OrgFreedesktopPortalScreenCastInterface(QStringLiteral("org.freedesktop.portal.Desktop"),
QStringLiteral("/org/freedesktop/portal/desktop"),
dbusXdpScreenCastService.reset(new OrgFreedesktopPortalScreenCastInterface(QLatin1String("org.freedesktop.portal.Desktop"),
QLatin1String("/org/freedesktop/portal/desktop"),
QDBusConnection::sessionBus()));
dbusXdpRemoteDesktopService.reset(new OrgFreedesktopPortalRemoteDesktopInterface(QStringLiteral("org.freedesktop.portal.Desktop"),
QStringLiteral("/org/freedesktop/portal/desktop"),
dbusXdpRemoteDesktopService.reset(new OrgFreedesktopPortalRemoteDesktopInterface(QLatin1String("org.freedesktop.portal.Desktop"),
QLatin1String("/org/freedesktop/portal/desktop"),
QDBusConnection::sessionBus()));
auto version = dbusXdpScreenCastService->version();
if (version < MIN_SUPPORTED_XDP_KDE_SC_VERSION) {
qCWarning(KRFB_FB_PIPEWIRE) << "Unsupported XDG Portal screencast interface version:" << version;
qWarning() << "Unsupported XDG Portal screencast interface version:" << version;
isValid = false;
return;
}
@@ -231,11 +231,11 @@ 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()) }
{ QLatin1String("session_handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) },
{ QLatin1String("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()) }
{ QLatin1String("session_handle_token"), QStringLiteral("krfb%1").arg(qrand()) },
{ QLatin1String("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
#endif
};
auto sessionReply = dbusXdpRemoteDesktopService->CreateSession(sessionParameters);
@@ -249,8 +249,8 @@ void PWFrameBuffer::Private::initDbus()
qInfo() << "DBus session created: " << sessionReply.value().path();
QDBusConnection::sessionBus().connect(QString(),
sessionReply.value().path(),
QStringLiteral("org.freedesktop.portal.Request"),
QStringLiteral("Response"),
QLatin1String("org.freedesktop.portal.Request"),
QLatin1String("Response"),
this->q,
SLOT(handleXdpSessionCreated(uint, QVariantMap)));
}
@@ -270,34 +270,34 @@ void PWFrameBuffer::handleXdpSessionCreated(quint32 code, QVariantMap results)
void PWFrameBuffer::Private::handleSessionCreated(quint32 &code, QVariantMap &results)
{
if (code != 0) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to create session: " << code;
qWarning() << "Failed to create session: " << code;
isValid = false;
return;
}
sessionPath = QDBusObjectPath(results.value(QStringLiteral("session_handle")).toString());
sessionPath = QDBusObjectPath(results.value(QLatin1String("session_handle")).toString());
// select sources for the session
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)
{ QLatin1String("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()) }
{ QLatin1String("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
#else
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
{ QLatin1String("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
#endif
};
auto selectorReply = dbusXdpRemoteDesktopService->SelectDevices(sessionPath, selectionOptions);
selectorReply.waitForFinished();
if (!selectorReply.isValid()) {
qCWarning(KRFB_FB_PIPEWIRE) << "Couldn't select devices for the remote-desktop session";
qWarning() << "Couldn't select devices for the remote-desktop session";
isValid = false;
return;
}
QDBusConnection::sessionBus().connect(QString(),
selectorReply.value().path(),
QStringLiteral("org.freedesktop.portal.Request"),
QStringLiteral("Response"),
QLatin1String("org.freedesktop.portal.Request"),
QLatin1String("Response"),
this->q,
SLOT(handleXdpDevicesSelected(uint, QVariantMap)));
}
@@ -317,32 +317,32 @@ void PWFrameBuffer::Private::handleDevicesSelected(quint32 &code, QVariantMap &r
{
Q_UNUSED(results)
if (code != 0) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to select devices: " << code;
qWarning() << "Failed to select devices: " << code;
isValid = false;
return;
}
// select sources for the session
auto selectionOptions = QVariantMap {
{ QStringLiteral("types"), QVariant::fromValue<uint>(1) }, // only MONITOR is supported
{ QStringLiteral("multiple"), false },
{ QLatin1String("types"), QVariant::fromValue<uint>(1) }, // only MONITOR is supported
{ QLatin1String("multiple"), false },
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
{ QLatin1String("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
#else
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
{ QLatin1String("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
#endif
};
auto selectorReply = dbusXdpScreenCastService->SelectSources(sessionPath, selectionOptions);
selectorReply.waitForFinished();
if (!selectorReply.isValid()) {
qCWarning(KRFB_FB_PIPEWIRE) << "Couldn't select sources for the screen-casting session";
qWarning() << "Couldn't select sources for the screen-casting session";
isValid = false;
return;
}
QDBusConnection::sessionBus().connect(QString(),
selectorReply.value().path(),
QStringLiteral("org.freedesktop.portal.Request"),
QStringLiteral("Response"),
QLatin1String("org.freedesktop.portal.Request"),
QLatin1String("Response"),
this->q,
SLOT(handleXdpSourcesSelected(uint, QVariantMap)));
}
@@ -363,7 +363,7 @@ void PWFrameBuffer::handleXdpSourcesSelected(quint32 code, QVariantMap results)
void PWFrameBuffer::Private::handleSourcesSelected(quint32 &code, QVariantMap &)
{
if (code != 0) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to select sources: " << code;
qWarning() << "Failed to select sources: " << code;
isValid = false;
return;
}
@@ -371,17 +371,17 @@ 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()) }
{ QLatin1String("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
#else
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
{ QLatin1String("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
#endif
};
auto startReply = dbusXdpRemoteDesktopService->Start(sessionPath, QString(), startParameters);
startReply.waitForFinished();
QDBusConnection::sessionBus().connect(QString(),
startReply.value().path(),
QStringLiteral("org.freedesktop.portal.Request"),
QStringLiteral("Response"),
QLatin1String("org.freedesktop.portal.Request"),
QLatin1String("Response"),
this->q,
SLOT(handleXdpRemoteDesktopStarted(uint, QVariantMap)));
}
@@ -402,16 +402,16 @@ void PWFrameBuffer::handleXdpRemoteDesktopStarted(quint32 code, QVariantMap resu
void PWFrameBuffer::Private::handleRemoteDesktopStarted(quint32 &code, QVariantMap &results)
{
if (code != 0) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to start screencast: " << code;
qWarning() << "Failed to start screencast: " << code;
isValid = false;
return;
}
// there should be only one stream
Streams streams = qdbus_cast<Streams>(results.value(QStringLiteral("streams")));
Streams streams = qdbus_cast<Streams>(results.value(QLatin1String("streams")));
if (streams.isEmpty()) {
// maybe we should check deeper with qdbus_cast but this suffices for now
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to get screencast streams";
qWarning() << "Failed to get screencast streams";
isValid = false;
return;
}
@@ -419,23 +419,23 @@ void PWFrameBuffer::Private::handleRemoteDesktopStarted(quint32 &code, QVariantM
auto streamReply = dbusXdpScreenCastService->OpenPipeWireRemote(sessionPath, QVariantMap());
streamReply.waitForFinished();
if (!streamReply.isValid()) {
qCWarning(KRFB_FB_PIPEWIRE) << "Couldn't open pipewire remote for the screen-casting session";
qWarning() << "Couldn't open pipewire remote for the screen-casting session";
isValid = false;
return;
}
pipewireFd = streamReply.value();
if (!pipewireFd.isValid()) {
qCWarning(KRFB_FB_PIPEWIRE) << "Couldn't get pipewire connection file descriptor";
qWarning() << "Couldn't get pipewire connection file descriptor";
isValid = false;
return;
}
QSize streamResolution = qdbus_cast<QSize>(streams.first().map.value(QStringLiteral("size")));
QSize streamResolution = qdbus_cast<QSize>(streams.first().map.value(QLatin1String("size")));
screenGeometry.width = streamResolution.width();
screenGeometry.height = streamResolution.height();
devices = results.value(QStringLiteral("types")).toUInt();
devices = results.value(QLatin1String("types")).toUInt();
pwStreamNodeId = streams.first().nodeId;
@@ -443,7 +443,7 @@ void PWFrameBuffer::Private::handleRemoteDesktopStarted(quint32 &code, QVariantM
q->fb = static_cast<char*>(malloc(screenGeometry.width * screenGeometry.height * 4));
if (!q->fb) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to allocate buffer";
qWarning() << "Failed to allocate buffer";
isValid = false;
return;
}
@@ -467,13 +467,13 @@ void PWFrameBuffer::Private::initPw() {
pwMainLoop = pw_thread_loop_new("pipewire-main-loop", nullptr);
pwContext = pw_context_new(pw_thread_loop_get_loop(pwMainLoop), nullptr, 0);
if (!pwContext) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to create PipeWire context";
qWarning() << "Failed to create PipeWire context";
return;
}
pwCore = pw_context_connect(pwContext, nullptr, 0);
if (!pwCore) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to connect PipeWire context";
qWarning() << "Failed to connect PipeWire context";
return;
}
@@ -481,7 +481,7 @@ void PWFrameBuffer::Private::initPw() {
pwStream = createReceivingStream();
if (!pwStream) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to create PipeWire stream";
qWarning() << "Failed to create PipeWire stream";
return;
}
#else
@@ -502,12 +502,12 @@ void PWFrameBuffer::Private::initPw() {
#endif
if (pw_thread_loop_start(pwMainLoop) < 0) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to start main PipeWire loop";
qWarning() << "Failed to start main PipeWire loop";
isValid = false;
}
}
#if !PW_CHECK_VERSION(0, 2, 90)
#if !PW_CHECK_VERSION(0, 2, 9)
/**
* @brief PWFrameBuffer::Private::initializePwTypes - helper method to initialize and map all needed
* Pipewire types from core to type structure.
@@ -547,11 +547,11 @@ void PWFrameBuffer::Private::onStateChanged(void *data, pw_remote_state /*old*/,
{
qInfo() << "remote state: " << pw_remote_state_as_string(state);
auto d = static_cast<PWFrameBuffer::Private*>(data);
PWFrameBuffer::Private *d = static_cast<PWFrameBuffer::Private*>(data);
switch (state) {
case PW_REMOTE_STATE_ERROR:
qCWarning(KRFB_FB_PIPEWIRE) << "remote error: " << error;
qWarning() << "remote error: " << error;
break;
case PW_REMOTE_STATE_CONNECTED:
d->pwStream = d->createReceivingStream();
@@ -578,7 +578,7 @@ void PWFrameBuffer::Private::onStreamStateChanged(void *data, pw_stream_state /*
#if PW_CHECK_VERSION(0, 2, 90)
switch (state) {
case PW_STREAM_STATE_ERROR:
qCWarning(KRFB_FB_PIPEWIRE) << "pipewire stream error: " << error_message;
qWarning() << "pipewire stream error: " << error_message;
break;
case PW_STREAM_STATE_PAUSED:
pw_stream_set_active(d->pwStream, true);
@@ -591,7 +591,7 @@ void PWFrameBuffer::Private::onStreamStateChanged(void *data, pw_stream_state /*
#else
switch (state) {
case PW_STREAM_STATE_ERROR:
qCWarning(KRFB_FB_PIPEWIRE) << "pipewire stream error: " << error_message;
qWarning() << "pipewire stream error: " << error_message;
break;
case PW_STREAM_STATE_CONFIGURE:
pw_stream_set_active(d->pwStream, true);
@@ -704,7 +704,7 @@ static void syncDmaBuf(int fd, uint64_t start_or_end)
if (ret == -1 && errno == EINTR) {
continue;
} else if (ret == -1) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to synchronize DMA buffer: " << strerror(errno);
qWarning() << "Failed to synchronize DMA buffer: " << strerror(errno);
break;
} else {
break;
@@ -717,10 +717,14 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
{
auto *spaBuffer = pwBuffer->buffer;
void *src = spaBuffer->datas[0].data;
if (!src) {
qDebug() << "discarding null buffer";
return;
}
#if PW_CHECK_VERSION(0, 2, 90)
if (!src && spaBuffer->datas->type != SPA_DATA_DmaBuf) {
qCDebug(KRFB_FB_PIPEWIRE) << "discarding null buffer";
if (spaBuffer->datas->type != SPA_DATA_DmaBuf) {
qDebug() << "discarding null buffer";
return;
}
#endif
@@ -736,7 +740,7 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
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);
qWarning() << "Failed to mmap the dmabuf: " << strerror(errno);
return;
}
@@ -755,7 +759,7 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
PROT_READ, MAP_PRIVATE, spaBuffer->datas->fd, 0));
if (map == MAP_FAILED) {
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to mmap the memory: " << strerror(errno);
qWarning() << "Failed to mmap the memory: " << strerror(errno);
return;
}
src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
@@ -768,7 +772,7 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
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();
qWarning() << "Got buffer with stride different from screen stride" << srcStride << "!=" << q->paddedWidth();
return;
}
@@ -777,14 +781,7 @@ void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
cleanup();
#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]);
}
}
} else if (videoFormat->format != SPA_VIDEO_FORMAT_RGB) {
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;
@@ -854,7 +851,7 @@ pw_stream *PWFrameBuffer::Private::createReceivingStream()
#else
if (pw_stream_connect(stream, PW_DIRECTION_INPUT, nullptr, flags, params, 1) != 0) {
#endif
qCWarning(KRFB_FB_PIPEWIRE) << "Could not connect receiving stream";
qWarning() << "Could not connect receiving stream";
isValid = false;
}

View File

@@ -7,14 +7,6 @@ set (krfb_framebuffer_qt_SRCS
qtframebufferplugin.cpp
)
ecm_qt_declare_logging_category(krfb_framebuffer_qt_SRCS
HEADER krfb_fb_qt_debug.h
IDENTIFIER KRFB_FB_QT
CATEGORY_NAME krfb.framebuffer.qt
DESCRIPTION "KRFB Qt framebuffer plugin"
EXPORT KRFB
)
add_library(krfb_framebuffer_qt
MODULE
${krfb_framebuffer_qt_SRCS}
@@ -28,5 +20,5 @@ target_link_libraries (krfb_framebuffer_qt
)
install (TARGETS krfb_framebuffer_qt
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
DESTINATION ${PLUGIN_INSTALL_DIR}/krfb
)

View File

@@ -7,14 +7,6 @@ set (krfb_framebuffer_xcb_SRCS
xcb_framebuffer.cpp
)
ecm_qt_declare_logging_category(krfb_framebuffer_xcb_SRCS
HEADER krfb_fb_xcb_debug.h
IDENTIFIER KRFB_FB_XCB
CATEGORY_NAME krfb.framebuffer.xcb
DESCRIPTION "KRFB XCB framebuffer plugin"
EXPORT KRFB
)
add_library(krfb_framebuffer_xcb MODULE ${krfb_framebuffer_xcb_SRCS})
target_link_libraries (krfb_framebuffer_xcb
@@ -32,5 +24,5 @@ target_link_libraries (krfb_framebuffer_xcb
)
install (TARGETS krfb_framebuffer_xcb
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
DESTINATION ${PLUGIN_INSTALL_DIR}/krfb
)

View File

@@ -8,7 +8,6 @@
*/
#include "xcb_framebuffer.h"
#include "krfb_fb_xcb_debug.h"
#include <xcb/xcb.h>
#include <xcb/xproto.h>
@@ -24,6 +23,7 @@
#include <QGuiApplication>
#include <QScreen>
#include <QAbstractNativeEventFilter>
#include <QDebug>
class KrfbXCBEventFilter: public QAbstractNativeEventFilter
@@ -68,7 +68,7 @@ KrfbXCBEventFilter::KrfbXCBEventFilter(XCBFrameBuffer *owner):
}
#ifdef _DEBUG
qCDebug(KRFB_FB_XCB) << "xcb framebuffer: XDamage extension version:" <<
qDebug() << "xcb framebuffer: XDamage extension version:" <<
xdamage_version->major_version << "." << xdamage_version->minor_version;
#endif
@@ -105,7 +105,7 @@ bool KrfbXCBEventFilter::nativeEventFilter(const QByteArray &eventType,
if (xdamageBaseEvent == 0) return false; // no xdamage extension
if (eventType == "xcb_generic_event_t") {
auto ev = static_cast<xcb_generic_event_t *>(message);
xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
if ((ev->response_type & 0x7F) == (xdamageBaseEvent + XCB_DAMAGE_NOTIFY)) {
// this is xdamage notification
this->fb_owner->handleXDamageNotify(ev);
@@ -166,8 +166,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
qreal scaleFactor = primaryScreen->devicePixelRatio();
d->area = { primaryScreen->geometry().topLeft() * scaleFactor,
primaryScreen->geometry().bottomRight() * scaleFactor };
qCDebug(KRFB_FB_XCB) << "xcb framebuffer: Primary screen: " << primaryScreen->name()
qDebug() << "xcb framebuffer: Primary screen: " << primaryScreen->name()
<< ", geometry: " << primaryScreen->geometry()
<< ", device scaling: " << scaleFactor
<< ", native size: " << d->area
@@ -187,7 +186,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
XCB_IMAGE_FORMAT_Z_PIXMAP);
if (d->framebufferImage) {
#ifdef _DEBUG
qCDebug(KRFB_FB_XCB) << "xcb framebuffer: Got primary screen image. bpp: " << d->framebufferImage->bpp
qDebug() << "xcb framebuffer: Got primary screen image. bpp: " << d->framebufferImage->bpp
<< ", size (" << d->framebufferImage->width << d->framebufferImage->height << ")"
<< ", depth: " << d->framebufferImage->depth
<< ", padded width: " << d->framebufferImage->stride;
@@ -215,15 +214,15 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
nullptr); // data = 0
if (d->updateTile) {
#ifdef _DEBUG
qCDebug(KRFB_FB_XCB) << "xcb framebuffer: Successfully created new empty image in native format"
<< "\n size: " << d->updateTile->width << "x" << d->updateTile->height
<< "(stride: " << d->updateTile->stride << ")"
<< "\n bpp, depth: " << d->updateTile->bpp << d->updateTile->depth // 32, 24
<< "\n addr of base, data: " << d->updateTile->base << (void *)d->updateTile->data
<< "\n size: " << d->updateTile->size
<< "\n image byte order = " << d->updateTile->byte_order // == 0 .._LSB_FIRST
<< "\n image bit order = " << d->updateTile->bit_order // == 1 .._MSB_FIRST
<< "\n image plane_mask = " << d->updateTile->plane_mask; // == 16777215 == 0x00FFFFFF
qDebug() << "xcb framebuffer: Successfully created new empty image in native format";
qDebug() << " size: " << d->updateTile->width << "x" << d->updateTile->height
<< "(stride: " << d->updateTile->stride << ")";
qDebug() << " bpp, depth: " << d->updateTile->bpp << d->updateTile->depth; // 32, 24
qDebug() << " addr of base, data: " << d->updateTile->base << (void *)d->updateTile->data;
qDebug() << " size: " << d->updateTile->size;
qDebug() << " image byte order = " << d->updateTile->byte_order; // == 0 .._LSB_FIRST
qDebug() << " image bit order = " << d->updateTile->bit_order; // == 1 .._MSB_FIRST
qDebug() << " image plane_mask = " << d->updateTile->plane_mask; // == 16777215 == 0x00FFFFFF
#endif
// allocate shared memory block only once, make its size large enough
@@ -241,7 +240,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
xcb_shm_attach(QX11Info::connection(), d->shminfo.shmseg, d->shminfo.shmid, 0);
#ifdef _DEBUG
qCDebug(KRFB_FB_XCB) << " shm id: " << d->shminfo.shmseg << ", addr: " << (void *)d->shminfo.shmaddr;
qDebug() << " shm id: " << d->shminfo.shmseg << ", addr: " << (void *)d->shminfo.shmaddr;
#endif
// will return 1 on success (yes!)
@@ -277,7 +276,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
}
#ifdef _DEBUG
qCDebug(KRFB_FB_XCB) << "xcb framebuffer: XCBFrameBuffer(), xshm base event = " << d->x11EvtFilter->xshmBaseEvent
qDebug() << "xcb framebuffer: XCBFrameBuffer(), xshm base event = " << d->x11EvtFilter->xshmBaseEvent
<< ", xshm base error = " << d->x11EvtFilter->xdamageBaseError
<< ", xdamage base event = " << d->x11EvtFilter->xdamageBaseEvent
<< ", xdamage base error = " << d->x11EvtFilter->xdamageBaseError;
@@ -424,12 +423,10 @@ void XCBFrameBuffer::getServerFormat(rfbPixelFormat &format) {
format.blueMax = root_visualtype->blue_mask >> format.blueShift;
#ifdef _DEBUG
qCDebug(KRFB_FB_XCB,
" Calculated redShift = %d\n"
" Calculated greenShift = %d\n"
" Calculated blueShift = %d\n"
" Calculated max values: R%d G%d B%d",
format.redShift, format.greenShift, format.blueShift
qDebug() << " Calculated redShift =" << (int)format.redShift;
qDebug() << " Calculated greenShift =" << (int)format.greenShift;
qDebug() << " Calculated blueShift =" << (int)format.blueShift;
qDebug( " Calculated max values: R%d G%d B%d",
format.redMax, format.greenMax, format.blueMax);
#endif
} else {
@@ -483,10 +480,10 @@ void XCBFrameBuffer::cleanupRects() {
QRect ri = r.intersected(d->area);
if (tiles.size() > 0) {
for (auto &tile : tiles) {
// if current rect has intersection with tile, unite them
if (ri.intersects(tile)) {
tile |= ri;
for (int i = 0; i < tiles.size(); i++) {
// if current rect has intersection with tiles[i], unite them
if (ri.intersects(tiles[i])) {
tiles[i] |= ri;
inserted = true;
break;
}
@@ -504,25 +501,25 @@ void XCBFrameBuffer::cleanupRects() {
// increase all rectangles size by 30 pixels each side.
// limit coordinates to primary monitor boundaries.
for (auto &tile : tiles) {
tile.adjust(-30, -30, 30, 30);
if (tile.top() < d->area.top()) {
tile.setTop(d->area.top());
for (int i = 0; i < tiles.size(); i++) {
tiles[i].adjust(-30, -30, 30, 30);
if (tiles[i].top() < d->area.top()) {
tiles[i].setTop(d->area.top());
}
if (tile.bottom() > d->area.bottom()) {
tile.setBottom(d->area.bottom());
if (tiles[i].bottom() > d->area.bottom()) {
tiles[i].setBottom(d->area.bottom());
}
//
if (tile.left() < d->area.left()) {
tile.setLeft(d->area.left());
if (tiles[i].left() < d->area.left()) {
tiles[i].setLeft(d->area.left());
}
if (tile.right() > d->area.right()) {
tile.setRight(d->area.right());
if (tiles[i].right() > d->area.right()) {
tiles[i].setRight(d->area.right());
}
// move update rects so that they are positioned relative to
// framebuffer image, not whole screen
tile.moveTo(tile.left() - d->area.left(),
tile.top() - d->area.top());
tiles[i].moveTo(tiles[i].left() - d->area.left(),
tiles[i].top() - d->area.top());
}
}
@@ -682,7 +679,7 @@ void XCBFrameBuffer::stopMonitor() {
void XCBFrameBuffer::handleXDamageNotify(xcb_generic_event_t *xevent) {
auto xdevt = (xcb_damage_notify_event_t *)xevent;
xcb_damage_notify_event_t *xdevt = (xcb_damage_notify_event_t *)xevent;
QRect r((int)xdevt->area.x, (int)xdevt->area.y,
(int)xdevt->area.width, (int)xdevt->area.height);

View File

@@ -36,14 +36,14 @@ set_target_properties (krfbprivate PROPERTIES
)
install (TARGETS krfbprivate
${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
${INSTALL_TARGETS_DEFAULT_ARGS}
LIBRARY NAMELINK_SKIP
)
install (FILES
krfb-framebuffer.desktop
krfb-events.desktop
DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}
DESTINATION ${SERVICETYPES_INSTALL_DIR}
)
#####################################
@@ -66,14 +66,6 @@ set (krfb_SRCS
invitationsrfbclient.cpp
)
ecm_qt_declare_logging_category(krfb_SRCS
HEADER krfbdebug.h
IDENTIFIER KRFB
CATEGORY_NAME krfb.krfb
DESCRIPTION "KRFB Application"
EXPORT KRFB
)
kconfig_add_kcfg_files (krfb_SRCS
krfbconfig.kcfgc
)
@@ -101,6 +93,7 @@ target_link_libraries (krfb
${X11_X11_LIB}
${X11_Xdamage_LIB}
Qt5::Network
KF5::Completion
KF5::CoreAddons
KF5::DBusAddons
KF5::DNSSD
@@ -120,13 +113,13 @@ if (X11_XTest_FOUND)
endif (X11_XTest_FOUND)
install (TARGETS krfb
${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
${INSTALL_TARGETS_DEFAULT_ARGS}
)
########### install files ###############
install (PROGRAMS org.kde.krfb.desktop
DESTINATION ${KDE_INSTALL_APPDIR}
DESTINATION ${XDG_APPS_INSTALL_DIR}
)
install(FILES org.kde.krfb.appdata.xml
@@ -134,6 +127,6 @@ install(FILES org.kde.krfb.appdata.xml
)
install (FILES krfb.notifyrc
DESTINATION ${KDE_INSTALL_DATADIR}/krfb
DESTINATION ${DATA_INSTALL_DIR}/krfb
)

View File

@@ -23,8 +23,8 @@
#include "eventsplugin.h"
#include "krfbconfig.h"
#include "rfbservermanager.h"
#include "krfbdebug.h"
#include <QDebug>
#include <QGlobalStatic>
#include <KPluginFactory>
@@ -79,18 +79,18 @@ void EventsManager::loadPlugins()
KPluginFactory *factory = KPluginLoader(data.fileName()).factory();
if (!factory) {
qCDebug(KRFB) << "KPluginFactory could not load the plugin:" << data.fileName();
qDebug() << "KPluginFactory could not load the plugin:" << data.fileName();
continue;
} else {
qCDebug(KRFB) << "found plugin at " << data.fileName();
qDebug() << "found plugin at " << data.fileName();
}
auto plugin = factory->create<EventsPlugin>(this);
EventsPlugin *plugin = factory->create<EventsPlugin>(this);
if (plugin) {
m_plugins.insert(data.pluginId(), plugin);
qCDebug(KRFB) << "Loaded plugin with name " << data.pluginId();
qDebug() << "Loaded plugin with name " << data.pluginId();
} else {
qCDebug(KRFB) << "unable to load plugin for " << data.fileName();
qDebug() << "unable to load plugin for " << data.fileName();
}
unique.insert (data.name());
}
@@ -113,6 +113,6 @@ QSharedPointer<EventHandler> EventsManager::eventHandler()
}
// No valid events plugin found.
qCDebug(KRFB) << "No valid event handlers found. returning null.";
qDebug() << "No valid event handlers found. returning null.";
return QSharedPointer<EventHandler>();
}

View File

@@ -51,7 +51,7 @@ Q_SIGNALS:
protected:
WId win;
char *fb = nullptr;
char *fb;
QList<QRect> tiles;
private:

View File

@@ -22,8 +22,8 @@
#include "framebufferplugin.h"
#include "krfbconfig.h"
#include "krfbdebug.h"
#include <QDebug>
#include <QGlobalStatic>
#include <KPluginFactory>
@@ -78,18 +78,18 @@ void FrameBufferManager::loadPlugins()
KPluginFactory *factory = KPluginLoader(data.fileName()).factory();
if (!factory) {
qCDebug(KRFB) << "KPluginFactory could not load the plugin:" << data.fileName();
qDebug() << "KPluginFactory could not load the plugin:" << data.fileName();
continue;
} else {
qCDebug(KRFB) << "found plugin at " << data.fileName();
qDebug() << "found plugin at " << data.fileName();
}
auto plugin = factory->create<FrameBufferPlugin>(this);
FrameBufferPlugin *plugin = factory->create<FrameBufferPlugin>(this);
if (plugin) {
m_plugins.insert(data.pluginId(), plugin);
qCDebug(KRFB) << "Loaded plugin with name " << data.pluginId();
qDebug() << "Loaded plugin with name " << data.pluginId();
} else {
qCDebug(KRFB) << "unable to load plugin for " << data.fileName();
qDebug() << "unable to load plugin for " << data.fileName();
}
unique.insert (data.name());
}
@@ -118,7 +118,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
while (iter != m_plugins.constEnd()) {
if (iter.key() == KrfbConfig::preferredFrameBufferPlugin()) {
qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
qDebug() << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id));
@@ -133,6 +133,6 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
}
// No valid framebuffer plugin found.
qCDebug(KRFB) << "No valid framebuffer found. returning null.";
qDebug() << "No valid framebuffer found. returning null.";
return QSharedPointer<FrameBuffer>();
}

View File

@@ -24,11 +24,11 @@
#include "krfbconfig.h"
#include "sockethelpers.h"
#include "connectiondialog.h"
#include "krfbdebug.h"
#include <KNotification>
#include <KLocalizedString>
#include <QDebug>
#include <QSocketNotifier>
#include <poll.h>
#include <KConfigGroup>
@@ -41,7 +41,7 @@ struct PendingInvitationsRfbClient::Private
{}
rfbClientPtr client;
QSocketNotifier *notifier = nullptr;
QSocketNotifier *notifier;
bool askOnConnect;
};
@@ -79,7 +79,7 @@ void PendingInvitationsRfbClient::processNewClient()
i18n("Received connection from %1, on hold (waiting for confirmation)",
host));
auto dialog = new InvitationsConnectionDialog(nullptr);
InvitationsConnectionDialog *dialog = new InvitationsConnectionDialog(nullptr);
dialog->setRemoteHost(host);
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
@@ -115,7 +115,7 @@ void PendingInvitationsRfbClient::onSocketActivated()
//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";
qDebug() << "disconnected from socket signal";
d->notifier->setEnabled(false);
rfbClientConnectionGone(d->client);
break;
@@ -125,7 +125,7 @@ void PendingInvitationsRfbClient::onSocketActivated()
bool PendingInvitationsRfbClient::checkPassword(const QByteArray & encryptedPassword)
{
qCDebug(KRFB) << "about to start authentication";
qDebug() << "about to start authentication";
if(InvitationsRfbServer::instance->allowUnattendedAccess() && vncAuthCheckPassword(
InvitationsRfbServer::instance->unattendedPassword().toLocal8Bit(),
@@ -141,10 +141,10 @@ bool PendingInvitationsRfbClient::checkPassword(const QByteArray & encryptedPass
void PendingInvitationsRfbClient::dialogAccepted()
{
auto dialog = qobject_cast<InvitationsConnectionDialog *>(sender());
InvitationsConnectionDialog *dialog = qobject_cast<InvitationsConnectionDialog *>(sender());
Q_ASSERT(dialog);
auto client = new InvitationsRfbClient(m_rfbClient, parent());
InvitationsRfbClient *client = new InvitationsRfbClient(m_rfbClient, parent());
client->setControlEnabled(dialog->allowRemoteControl());
accept(client);
}

View File

@@ -22,10 +22,10 @@
#include "invitationsrfbclient.h"
#include "krfbconfig.h"
#include "rfbservermanager.h"
#include "krfbdebug.h"
#include <QTimer>
#include <QApplication>
#include <QHostInfo>
#include <QDebug>
#include <QRandomGenerator>
#include <KLocalizedString>
@@ -182,7 +182,7 @@ void InvitationsRfbServer::walletOpened(bool opened)
} else {
qCDebug(KRFB) << "Could not open KWallet, Falling back to config file";
qDebug() << "Could not open KWallet, Falling back to config file";
KConfigGroup krfbConfig(KSharedConfig::openConfig(),"Security");
desktopPassword = KStringHandler::obscure(krfbConfig.readEntry(

View File

@@ -63,11 +63,11 @@ private Q_SLOTS:
void walletOpened(bool);
private:
KDNSSD::PublicService *m_publicService = nullptr;
KDNSSD::PublicService *m_publicService;
bool m_allowUnattendedAccess;
QString m_desktopPassword;
QString m_unattendedPassword;
KWallet::Wallet *m_wallet = nullptr;
KWallet::Wallet *m_wallet;
QString readableRandomString(int);
Q_DISABLE_COPY(InvitationsRfbServer)

View File

@@ -14,7 +14,7 @@ Comment[es]=Complementos de eventos para KRfb
Comment[et]=KRfb sündmuste pluginad
Comment[eu]=KRfb-rako gertaeren pluginak
Comment[fi]=KRfb:n tapahtumaliitännäinen
Comment[fr]=Modules externes d'évènements pour Krfb
Comment[fr]=Modules externes d'événements pour Krfb
Comment[gl]=Complementos de eventos para KRfb
Comment[ia]=Plug-ins de evento per KRfb
Comment[it]=Estensioni degli eventi per KRfb

View File

@@ -0,0 +1,7 @@
[org.freedesktop.Telepathy.Client]
Interfaces=org.freedesktop.Telepathy.Client.Handler;
[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0]
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.StreamTube
org.freedesktop.Telepathy.Channel.Type.StreamTube.Service s=rfb
org.freedesktop.Telepathy.Channel.Requested b=true

View File

@@ -20,7 +20,6 @@
#include "invitationsrfbserver.h"
#include "krfbconfig.h"
#include "krfb_version.h"
#include "krfbdebug.h"
#include <KAboutData>
#include <KDBusService>
@@ -28,11 +27,12 @@
#include <KMessageBox>
#include <KWindowSystem>
#include <QDebug>
#include <QPixmap>
#include <qwindowdefs.h>
#include <QX11Info>
#include <csignal>
#include <signal.h>
#include <X11/extensions/XTest.h>
#include <QCommandLineParser>
#include <QCommandLineOption>
@@ -59,13 +59,13 @@ static bool checkX11Capabilities()
static void checkOldX11PluginConfig() {
if (KrfbConfig::preferredFrameBufferPlugin() == QStringLiteral("x11")) {
qCDebug(KRFB) << "Detected deprecated configuration: preferredFrameBufferPlugin = x11";
qDebug() << "Detected deprecated configuration: preferredFrameBufferPlugin = x11";
KConfigSkeletonItem *config_item = KrfbConfig::self()->findItem(
QStringLiteral("preferredFrameBufferPlugin"));
if (config_item) {
config_item->setProperty(QStringLiteral("xcb"));
KrfbConfig::self()->save();
qCDebug(KRFB) << " Fixed preferredFrameBufferPlugin from x11 to xcb.";
qDebug() << " Fixed preferredFrameBufferPlugin from x11 to xcb.";
}
}
}
@@ -81,7 +81,7 @@ static void checkWaylandPluginConfig()
if (config_item) {
config_item->setProperty(QStringLiteral("pw"));
KrfbConfig::self()->save();
qCDebug(KRFB) << "Wayland: Fixed preferredFrameBufferPlugin to \"pw\".";
qDebug() << "Wayland: Fixed preferredFrameBufferPlugin to \"pw\".";
}
}
}

View File

@@ -21,6 +21,7 @@
#include <KMessageWidget>
#include <KStandardAction>
#include <KActionCollection>
#include <KLineEdit>
#include <KNewPasswordDialog>
#include <KPluginLoader>
#include <KPluginMetaData>
@@ -106,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent)
setAttribute(Qt::WA_DeleteOnClose, false);
m_passwordEditable = false;
m_passwordLineEdit = new QLineEdit(this);
m_passwordLineEdit = new KLineEdit(this);
m_passwordLineEdit->setVisible(false);
m_passwordLineEdit->setAlignment(Qt::AlignHCenter);

View File

@@ -15,7 +15,7 @@
#include <KXmlGuiWindow>
class QLineEdit;
class KLineEdit;
class MainWindow : public KXmlGuiWindow
{
@@ -43,7 +43,7 @@ class MainWindow : public KXmlGuiWindow
private:
Ui::MainWidget m_ui;
bool m_passwordEditable;
QLineEdit *m_passwordLineEdit;
KLineEdit *m_passwordLineEdit;
};
#endif

View File

@@ -39,29 +39,42 @@
<name xml:lang="x-test">xxKrfbxx</name>
<name xml:lang="zh-CN">Krfb</name>
<name xml:lang="zh-TW">Krfb</name>
<summary>Share your desktop to another computer via VNC</summary>
<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="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="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>
<summary xml:lang="it">Condividi il desktop con un altro computer tramite VNC</summary>
<summary xml:lang="ko">내 데스크톱을 VNC로 다른 컴퓨터와 공유</summary>
<summary xml:lang="nl">Uw bureaublad delen naar een andere computer via VNC</summary>
<summary xml:lang="nn">Del skrivebordet med ei anna maskin via VNC</summary>
<summary xml:lang="pl">Udostępnij swój pulpit innemu komputerowi przez VNC</summary>
<summary xml:lang="pt">Partilhar o seu ecrã com outro computador por VNC</summary>
<summary xml:lang="pt-BR">Compartilhar sua área de trabalho com outro computador via VNC</summary>
<summary xml:lang="sl">Deli namizje z drugim računalnikom prek VNC</summary>
<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>Desktop sharing</summary>
<summary xml:lang="ca">Compartició de l'escriptori</summary>
<summary xml:lang="ca-valencia">Compartició de l'escriptori</summary>
<summary xml:lang="cs">Sdíle pracovní plochy</summary>
<summary xml:lang="da">Skrivebordsdeling</summary>
<summary xml:lang="de">Freigabe der Arbeitsfläche</summary>
<summary xml:lang="el">Κοινή χρήση επιφάνειας εργασίας</summary>
<summary xml:lang="en-GB">Desktop sharing</summary>
<summary xml:lang="es">Compartir el escritorio</summary>
<summary xml:lang="et">Töölaua jagamine</summary>
<summary xml:lang="eu">Mahaigaina partekatzea</summary>
<summary xml:lang="fi">Työpöydän jako</summary>
<summary xml:lang="fr">Partage de bureau</summary>
<summary xml:lang="gl">Compartición do escritorio</summary>
<summary xml:lang="ia">Compartir de scriptorio</summary>
<summary xml:lang="id">Desktop sharing</summary>
<summary xml:lang="it">Condivisione del desktop</summary>
<summary xml:lang="ko">데스크톱 공유</summary>
<summary xml:lang="nl">Bureaublad delen</summary>
<summary xml:lang="nn">Skrivebordsdeling</summary>
<summary xml:lang="pl">Współdzielenie pulpitu</summary>
<summary xml:lang="pt">Partilha do ecrã</summary>
<summary xml:lang="pt-BR">Compartilhamento de tela</summary>
<summary xml:lang="ru">Общий рабочий стол</summary>
<summary xml:lang="sk">Zdieľanie pracovnej plochy</summary>
<summary xml:lang="sl">Souporaba namizja</summary>
<summary xml:lang="sr">Дељење површи</summary>
<summary xml:lang="sr-Latn">Deljenje površi</summary>
<summary xml:lang="sr-ijekavian">Дељење површи</summary>
<summary xml:lang="sr-ijekavianlatin">Deljenje površi</summary>
<summary xml:lang="sv">Skrivbordsdelning</summary>
<summary xml:lang="tr">Masaüstü paylaşımı</summary>
<summary xml:lang="uk">Спільне користування стільницею</summary>
<summary xml:lang="x-test">xxDesktop sharingxx</summary>
<summary xml:lang="zh-CN">桌面共享</summary>
<summary xml:lang="zh-TW">桌面分享</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>
@@ -118,7 +131,6 @@
<caption xml:lang="fi">Työpöydän jakaminen Krfb:llä</caption>
<caption xml:lang="fr">Partage de bureau grâce à Krfb</caption>
<caption xml:lang="gl">Compartindo o escritorio con Krfb</caption>
<caption xml:lang="ia">Compartir scriptorio con Krfb</caption>
<caption xml:lang="id">Berbagi desktop dengan Krfb</caption>
<caption xml:lang="it">Condivisone del desktop con Krfb</caption>
<caption xml:lang="ko">Krfb로 데스크톱 공유</caption>
@@ -143,9 +155,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="20.08.3" date="2020-11-05"/>
<release version="20.08.2" date="2020-10-08"/>
<release version="20.08.1" date="2020-09-03"/>
<release version="20.08.0" date="2020-08-13"/>
</releases>
</component>

View File

@@ -74,29 +74,76 @@ Name[x-test]=xxKrfbxx
Name[zh_CN]=Krfb
Name[zh_HK]=Krfb
Name[zh_TW]=桌面分享_Krfb
GenericName=Desktop Sharing (VNC)
GenericName[ca]=Compartició de l'escriptori (VNC)
GenericName[ca@valencia]=Compartició de l'escriptori (VNC)
GenericName[cs]=Sdílení pracovní plochy (VNC)
GenericName[da]=Skrivebordsdeling (VNC)
GenericName[de]=Arbeitsflächen-Freigabe (VNC)
GenericName[el]=Κοινή χρήση επιφάνειας εργασίας (VNC)
GenericName[en_GB]=Desktop Sharing (VNC)
GenericName[es]=Escritorio compartido (VNC)
GenericName[et]=Töölaua jagamine (VNC)
GenericName[fr]=Partage de bureaux (VNC)
GenericName[ia]=Compartir de scriptorio (VNC)
GenericName[it]=Condivisione del desktop (VNC)
GenericName[ko]=데스크톱 공유(VNC)
GenericName[nl]=Bureaublad delen (VNC)
GenericName[nn]=Skrivebordsdeling (VNC)
GenericName[pl]=Współdzielenie pulpitu (VNC)
GenericName[pt]=Partilha do Ecrã (VNC)
GenericName[pt_BR]=Compartilhamento de ambiente de trabalho (VNC)
GenericName[sl]=Souporaba namizja (VNC)
GenericName[sv]=Skrivbordsdelning (VNC)
GenericName[uk]=Спільні стільниці (VNC)
GenericName[x-test]=xxDesktop Sharing (VNC)xx
GenericName=Desktop Sharing
GenericName[ar]=مشاركة سطح المكتب
GenericName[bg]=Споделяне на работния плот
GenericName[bn]=ডেস্কটপ ভাগাভাগি
GenericName[br]=Rannañ ar vurev
GenericName[bs]=Dijeljenje radne površine
GenericName[ca]=Compartir l'escriptori
GenericName[ca@valencia]=Compartir l'escriptori
GenericName[cs]=Sdílení pracovní plochy
GenericName[cy]=Rhannu Penbwrdd
GenericName[da]=Skrivebordsdeling
GenericName[de]=Arbeitsfläche freigeben
GenericName[el]=Κοινή χρήση επιφάνειας εργασίας
GenericName[en_GB]=Desktop Sharing
GenericName[eo]=Tabula komunigado
GenericName[es]=Escritorio compartido
GenericName[et]=Töölaua jagamine
GenericName[eu]=Mahaigaina partekatzea
GenericName[fa]=اشتراک رومیزی
GenericName[fi]=Työpöydän jakaminen
GenericName[fr]=Partage de bureaux
GenericName[ga]=Roinnt Deisce
GenericName[gl]=Compartimento de escritorio
GenericName[he]=שיתוף שולחנות עבודה
GenericName[hi]=डेस्कटॉप साझेदारी
GenericName[hne]=डेस्कटाप साझेदारी
GenericName[hr]=Dijeljenje radne površine
GenericName[hu]=Munkaasztal-megosztás
GenericName[ia]=Compartir de scriptorio
GenericName[id]=Desktop Sharing
GenericName[is]=Skjáborðsmiðlun
GenericName[it]=Condivisione del desktop
GenericName[ja]=デスクトップ共有
GenericName[kk]=Үстелді ортақтастыру
GenericName[km]=ការ​ចែក​រំលែក​ផ្ទៃ​តុ
GenericName[ko]=데스크톱 공유
GenericName[lt]=Dalinimasis darbalaukiu
GenericName[lv]=Darbvirsmas koplietošana
GenericName[ml]=പണിയിടം പങ്കുവെക്കല്‍
GenericName[mr]=डेस्कटॉप शेअरींग
GenericName[nb]=Delte skrivebord
GenericName[nds]=Schriefdisch-Freegaav
GenericName[ne]=डेस्कटप साझेदारी
GenericName[nl]=Bureaublad delen
GenericName[nn]=Skrivebordsdeling
GenericName[pa]=ਡੈਸਕਟਾਪ ਸ਼ੇਅਰਿੰਗ
GenericName[pl]=Współdzielenie pulpitu
GenericName[pt]=Partilha do Ecrã
GenericName[pt_BR]=Compartilhamento de ambiente de trabalho
GenericName[ro]=Partajare birou
GenericName[ru]=Общий рабочий стол
GenericName[si]=වැඩතල හවුල්
GenericName[sk]=Zdieľanie pracovnej plochy
GenericName[sl]=Souporaba namizja
GenericName[sr]=Дељење површи
GenericName[sr@ijekavian]=Дијељење површи
GenericName[sr@ijekavianlatin]=Dijeljenje površi
GenericName[sr@latin]=Deljenje površi
GenericName[sv]=Dela ut skrivbordet
GenericName[th]=ใช้งานพื้นที่ทำงานร่วมกัน
GenericName[tr]=Masaüstü Paylaşımı
GenericName[ug]=ئۈستەلئۈستىنى ھەمبەھىرلەش
GenericName[uk]=Спільні стільниці
GenericName[uz]=Ish stoli bilan boʻlishish
GenericName[uz@cyrillic]=Иш столи билан бўлишиш
GenericName[vi]=Chia sẻ màn hình nền
GenericName[x-test]=xxDesktop Sharingxx
GenericName[zh_CN]=桌面共享
GenericName[zh_HK]=桌面分享
GenericName[zh_TW]=桌面分享
Comment=Desktop Sharing
Comment[af]=Werkskerm Deeling
Comment[ar]=مشاركة سطح المكتب

View File

@@ -23,6 +23,7 @@
#include "sockethelpers.h"
#include "eventsmanager.h"
#include <QSocketNotifier>
#include <QDebug>
#include <poll.h>
#include <strings.h> //for bzero()

View File

@@ -19,11 +19,11 @@
*/
#include "rfbserver.h"
#include "rfbservermanager.h"
#include "krfbdebug.h"
#include <QSocketNotifier>
#include <QApplication>
#include <QClipboard>
#include <QPointer>
#include <QDebug>
#include <QX11Info>
struct RfbServer::Private
@@ -92,7 +92,7 @@ bool RfbServer::start()
if (!d->screen) {
d->screen = RfbServerManager::instance()->newScreen();
if (!d->screen) {
qCDebug(KRFB) << "Unable to get rbfserver screen";
qDebug() << "Unable to get rbfserver screen";
return false;
}
@@ -125,14 +125,14 @@ bool RfbServer::start()
d->screen->authPasswdData = (void *)nullptr;
}
qCDebug(KRFB) << "Starting server. Listen port:" << listeningPort()
qDebug() << "Starting server. Listen port:" << listeningPort()
<< "Listen Address:" << listeningAddress()
<< "Password enabled:" << passwordRequired();
rfbInitServer(d->screen);
if (!rfbIsActive(d->screen)) {
qCDebug(KRFB) << "Failed to start server";
qDebug() << "Failed to start server";
rfbShutdownServer(d->screen, false);
return false;
};
@@ -253,7 +253,7 @@ void RfbServer::pendingClientFinished(RfbClient *client)
rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
{
//qDebug() << "New client";
auto server = static_cast<RfbServer*>(cl->screen->screenData);
RfbServer *server = static_cast<RfbServer*>(cl->screen->screenData);
PendingRfbClient *pendingClient = server->newClient(cl);
connect(pendingClient, &PendingRfbClient::finished,
@@ -266,7 +266,7 @@ rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
void RfbServer::clientGoneHook(rfbClientPtr cl)
{
//qDebug() << "client gone";
auto client = static_cast<RfbClient*>(cl->clientData);
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
RfbServerManager::instance()->removeClient(client);
client->deleteLater();
@@ -275,7 +275,7 @@ void RfbServer::clientGoneHook(rfbClientPtr cl)
//static
rfbBool RfbServer::passwordCheck(rfbClientPtr cl, const char *encryptedPassword, int len)
{
auto client = static_cast<PendingRfbClient*>(cl->clientData);
PendingRfbClient *client = static_cast<PendingRfbClient*>(cl->clientData);
Q_ASSERT(client);
return client->checkPassword(QByteArray::fromRawData(encryptedPassword, len));
}
@@ -283,14 +283,14 @@ rfbBool RfbServer::passwordCheck(rfbClientPtr cl, const char *encryptedPassword,
//static
void RfbServer::keyboardHook(rfbBool down, rfbKeySym keySym, rfbClientPtr cl)
{
auto client = static_cast<RfbClient*>(cl->clientData);
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
client->handleKeyboardEvent(down ? true : false, keySym);
}
//static
void RfbServer::pointerHook(int bm, int x, int y, rfbClientPtr cl)
{
auto client = static_cast<RfbClient*>(cl->clientData);
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
client->handleMouseEvent(bm, x, y);
}

View File

@@ -29,6 +29,7 @@
#include <QDesktopWidget>
#include <QGlobalStatic>
#include <QHostInfo>
#include <QDebug>
#include <KLocalizedString>
#include <KUser>

View File

@@ -28,13 +28,14 @@
QString peerAddress(int sock)
{
const int ADDR_SIZE = 50;
struct sockaddr sa = {};
struct sockaddr sa;
socklen_t salen = sizeof(struct sockaddr);
if (getpeername(sock, &sa, &salen) == 0) {
if (sa.sa_family == AF_INET) {
auto si = (struct sockaddr_in *)&sa;
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
return QString::fromLatin1(inet_ntoa(si->sin_addr));
}
@@ -52,11 +53,12 @@ QString peerAddress(int sock)
unsigned short peerPort(int sock)
{
struct sockaddr sa = {};
struct sockaddr sa;
socklen_t salen = sizeof(struct sockaddr);
if (getpeername(sock, &sa, &salen) == 0) {
auto si = (struct sockaddr_in *)&sa;
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
return ntohs(si->sin_port);
}
@@ -65,13 +67,14 @@ unsigned short peerPort(int sock)
QString localAddress(int sock)
{
const int ADDR_SIZE = 50;
struct sockaddr sa = {};
struct sockaddr sa;
socklen_t salen = sizeof(struct sockaddr);
if (getsockname(sock, &sa, &salen) == 0) {
if (sa.sa_family == AF_INET) {
auto si = (struct sockaddr_in *)&sa;
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
return QString::fromLatin1(inet_ntoa(si->sin_addr));
}
@@ -89,11 +92,12 @@ QString localAddress(int sock)
unsigned short localPort(int sock)
{
struct sockaddr sa = {};
struct sockaddr sa;
socklen_t salen = sizeof(struct sockaddr);
if (getsockname(sock, &sa, &salen) == 0) {
auto si = (struct sockaddr_in *)&sa;
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
return ntohs(si->sin_port);
}