mirror of
https://github.com/KDE/krfb
synced 2026-07-01 15:51:18 -07:00
Compare commits
8 Commits
v22.08.0
...
work/nodes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8cd48fd5d | ||
|
|
04494dfeb0 | ||
|
|
4169a9f50a | ||
|
|
5173e7ff29 | ||
|
|
745a5d53f2 | ||
|
|
ce0d6fe648 | ||
|
|
42ed3c5707 | ||
|
|
2cd15b6313 |
@@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# KDE Application Version, managed by release script
|
||||
set (RELEASE_SERVICE_VERSION_MAJOR "22")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "07")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "11")
|
||||
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(QT_MIN_VERSION 5.15.2)
|
||||
set(KF5_MIN_VERSION 5.91.0)
|
||||
|
||||
find_package(ECM ${KF5_MIN_VERSION} NO_MODULE REQUIRED)
|
||||
@@ -21,6 +21,7 @@ include(ECMInstallIcons)
|
||||
include(ECMAddAppIcon)
|
||||
include(ECMSetupVersion)
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
include(ECMDeprecationSettings)
|
||||
include(FeatureSummary)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
@@ -60,22 +61,11 @@ if(WIN32)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES})
|
||||
endif(WIN32)
|
||||
|
||||
add_definitions(
|
||||
-DQT_DEPRECATED_WARNINGS
|
||||
-DQT_USE_QSTRINGBUILDER
|
||||
-DQT_NO_CAST_TO_ASCII
|
||||
-DQT_NO_CAST_FROM_ASCII
|
||||
-DQT_NO_CAST_FROM_BYTEARRAY
|
||||
-DQT_STRICT_ITERATORS
|
||||
-DQT_NO_URL_CAST_FROM_STRING
|
||||
-DQT_NO_SIGNALS_SLOTS_KEYWORDS
|
||||
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
|
||||
ecm_set_disabled_deprecation_versions(
|
||||
QT 5.15.2
|
||||
KF 5.91
|
||||
)
|
||||
|
||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f02)
|
||||
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055A00)
|
||||
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} )
|
||||
|
||||
find_package(LibVNCServer REQUIRED)
|
||||
|
||||
@@ -961,8 +961,8 @@ PWFrameBuffer::Private::~Private()
|
||||
}
|
||||
}
|
||||
|
||||
PWFrameBuffer::PWFrameBuffer(WId winid, QObject *parent)
|
||||
: FrameBuffer (winid, parent),
|
||||
PWFrameBuffer::PWFrameBuffer(QObject *parent)
|
||||
: FrameBuffer (parent),
|
||||
d(new Private(this))
|
||||
{
|
||||
fb = nullptr;
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
};
|
||||
using Streams = QList<Stream>;
|
||||
|
||||
PWFrameBuffer(WId winid, QObject *parent = nullptr);
|
||||
PWFrameBuffer(QObject *parent = nullptr);
|
||||
virtual ~PWFrameBuffer() override;
|
||||
|
||||
void initDBus();
|
||||
|
||||
@@ -30,11 +30,9 @@ PWFrameBufferPlugin::PWFrameBufferPlugin(QObject *parent, const QVariantList &ar
|
||||
}
|
||||
|
||||
|
||||
FrameBuffer *PWFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
|
||||
FrameBuffer *PWFrameBufferPlugin::frameBuffer(const QVariantMap &args)
|
||||
{
|
||||
//NOTE WId is irrelevant in Wayland
|
||||
|
||||
auto pwfb = new PWFrameBuffer(id);
|
||||
auto pwfb = new PWFrameBuffer;
|
||||
if (args.contains(QLatin1String("name"))) {
|
||||
pwfb->startVirtualMonitor(args[QStringLiteral("name")].toString(), args[QStringLiteral("resolution")].toSize(), args[QStringLiteral("scale")].toDouble());
|
||||
} else {
|
||||
|
||||
@@ -34,7 +34,7 @@ class PWFrameBufferPlugin: public FrameBufferPlugin
|
||||
public:
|
||||
PWFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
|
||||
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
|
||||
FrameBuffer *frameBuffer(const QVariantMap &args) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(PWFrameBufferPlugin)
|
||||
|
||||
@@ -24,6 +24,7 @@ target_link_libraries (krfb_framebuffer_qt
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
KF5::CoreAddons
|
||||
Qt::GuiPrivate
|
||||
krfbprivate
|
||||
)
|
||||
|
||||
|
||||
@@ -13,17 +13,20 @@
|
||||
#include <QRegion>
|
||||
#include <QPixmap>
|
||||
#include <QBitmap>
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
#include <QScreen>
|
||||
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
|
||||
const int UPDATE_TIME = 500;
|
||||
|
||||
QtFrameBuffer::QtFrameBuffer(WId id, QObject *parent)
|
||||
: FrameBuffer(id, parent)
|
||||
QtFrameBuffer::QtFrameBuffer(QObject *parent)
|
||||
: FrameBuffer(parent)
|
||||
{
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
QPlatformNativeInterface* native = qApp->platformNativeInterface();
|
||||
|
||||
if (screen) {
|
||||
win = reinterpret_cast<WId>(native->nativeResourceForScreen(QByteArrayLiteral("rootwindow"), screen));
|
||||
primaryScreen = screen;
|
||||
fbImage = screen->grabWindow(win).toImage();
|
||||
fb = new char[fbImage.sizeInBytes()];
|
||||
|
||||
@@ -22,7 +22,7 @@ class QtFrameBuffer : public FrameBuffer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QtFrameBuffer(WId id, QObject *parent = nullptr);
|
||||
explicit QtFrameBuffer(QObject *parent = nullptr);
|
||||
|
||||
~QtFrameBuffer() override;
|
||||
|
||||
@@ -38,6 +38,7 @@ public Q_SLOTS:
|
||||
void updateFrameBuffer();
|
||||
|
||||
private:
|
||||
WId win;
|
||||
QImage fbImage;
|
||||
QTimer *t;
|
||||
QScreen *primaryScreen;
|
||||
|
||||
@@ -31,10 +31,10 @@ QtFrameBufferPlugin::QtFrameBufferPlugin(QObject *parent, const QVariantList &ar
|
||||
{
|
||||
}
|
||||
|
||||
FrameBuffer *QtFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
|
||||
FrameBuffer *QtFrameBufferPlugin::frameBuffer(const QVariantMap &args)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
return new QtFrameBuffer(id);
|
||||
return new QtFrameBuffer;
|
||||
}
|
||||
|
||||
#include "qtframebufferplugin.moc"
|
||||
|
||||
@@ -34,7 +34,7 @@ class QtFrameBufferPlugin : public FrameBufferPlugin
|
||||
public:
|
||||
QtFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
|
||||
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
|
||||
FrameBuffer *frameBuffer(const QVariantMap &args) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QtFrameBufferPlugin)
|
||||
|
||||
@@ -20,6 +20,7 @@ add_library(krfb_framebuffer_xcb MODULE ${krfb_framebuffer_xcb_SRCS})
|
||||
target_link_libraries (krfb_framebuffer_xcb
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt::GuiPrivate
|
||||
XCB::XCB
|
||||
XCB::RENDER
|
||||
XCB::SHAPE
|
||||
|
||||
@@ -19,10 +19,11 @@
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include <QX11Info>
|
||||
#include <QCoreApplication>
|
||||
#include <QApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
|
||||
|
||||
class KrfbXCBEventFilter: public QAbstractNativeEventFilter
|
||||
@@ -130,6 +131,7 @@ public:
|
||||
bool running;
|
||||
|
||||
QRect area; // capture area, primary monitor coordinates
|
||||
WId win;
|
||||
};
|
||||
|
||||
|
||||
@@ -144,8 +146,8 @@ static xcb_screen_t *get_xcb_screen(xcb_connection_t *conn, int screen_num) {
|
||||
|
||||
|
||||
|
||||
XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
FrameBuffer(winid, parent), d(new XCBFrameBuffer::P)
|
||||
XCBFrameBuffer::XCBFrameBuffer(QObject *parent):
|
||||
FrameBuffer(parent), d(new XCBFrameBuffer::P)
|
||||
{
|
||||
d->running = false;
|
||||
d->damage = XCB_NONE;
|
||||
@@ -162,6 +164,8 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
|
||||
QScreen *primaryScreen = QGuiApplication::primaryScreen();
|
||||
if (primaryScreen) {
|
||||
QPlatformNativeInterface* native = qApp->platformNativeInterface();
|
||||
d->win = reinterpret_cast<WId>(native->nativeResourceForScreen(QByteArrayLiteral("rootwindow"), primaryScreen));
|
||||
qreal scaleFactor = primaryScreen->devicePixelRatio();
|
||||
d->area = { primaryScreen->geometry().topLeft() * scaleFactor,
|
||||
primaryScreen->geometry().bottomRight() * scaleFactor };
|
||||
@@ -177,7 +181,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
}
|
||||
|
||||
d->framebufferImage = xcb_image_get(QX11Info::connection(),
|
||||
this->win,
|
||||
d->win,
|
||||
d->area.left(),
|
||||
d->area.top(),
|
||||
d->area.width(),
|
||||
@@ -246,7 +250,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
// will return 1 on success (yes!)
|
||||
int shmget_res = xcb_image_shm_get(
|
||||
QX11Info::connection(),
|
||||
this->win,
|
||||
d->win,
|
||||
d->updateTile,
|
||||
d->shminfo,
|
||||
d->area.left(), // x
|
||||
@@ -554,7 +558,7 @@ QList<QRect> XCBFrameBuffer::modifiedTiles() {
|
||||
// translate whe coordinates
|
||||
xcb_shm_get_image_cookie_t sgi_cookie = xcb_shm_get_image(
|
||||
QX11Info::connection(),
|
||||
this->win,
|
||||
d->win,
|
||||
d->area.left() + r.left(),
|
||||
d->area.top() + r.top(),
|
||||
r.width(),
|
||||
@@ -609,7 +613,7 @@ QList<QRect> XCBFrameBuffer::modifiedTiles() {
|
||||
// need function that copies pixels from one image to another
|
||||
xcb_image_t *damagedImage = xcb_image_get(
|
||||
QX11Info::connection(),
|
||||
this->win,
|
||||
d->win,
|
||||
r.left(),
|
||||
r.top(),
|
||||
r.width(),
|
||||
@@ -649,7 +653,7 @@ void XCBFrameBuffer::startMonitor() {
|
||||
|
||||
d->running = true;
|
||||
d->damage = xcb_generate_id(QX11Info::connection());
|
||||
xcb_damage_create(QX11Info::connection(), d->damage, this->win,
|
||||
xcb_damage_create(QX11Info::connection(), d->damage, d->win,
|
||||
XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES);
|
||||
|
||||
// (currently) we do not call xcb_damage_subtract() EVER, because
|
||||
|
||||
@@ -22,7 +22,7 @@ class XCBFrameBuffer: public FrameBuffer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit XCBFrameBuffer(WId winid, QObject *parent = nullptr);
|
||||
explicit XCBFrameBuffer(QObject *parent = nullptr);
|
||||
~XCBFrameBuffer() override;
|
||||
|
||||
public:
|
||||
|
||||
@@ -29,10 +29,10 @@ XCBFrameBufferPlugin::XCBFrameBufferPlugin(QObject *parent, const QVariantList &
|
||||
{
|
||||
}
|
||||
|
||||
FrameBuffer *XCBFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
|
||||
FrameBuffer *XCBFrameBufferPlugin::frameBuffer(const QVariantMap &args)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
return new XCBFrameBuffer(id);
|
||||
return new XCBFrameBuffer;
|
||||
}
|
||||
|
||||
#include "xcb_framebufferplugin.moc"
|
||||
|
||||
@@ -34,7 +34,7 @@ class XCBFrameBufferPlugin: public FrameBufferPlugin
|
||||
public:
|
||||
XCBFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
|
||||
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
|
||||
FrameBuffer *frameBuffer(const QVariantMap &args) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(XCBFrameBufferPlugin)
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include <QCursor>
|
||||
|
||||
|
||||
FrameBuffer::FrameBuffer(WId id, QObject *parent)
|
||||
: QObject(parent), win(id)
|
||||
FrameBuffer::FrameBuffer(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class KRFBPRIVATE_EXPORT FrameBuffer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrameBuffer(WId id, QObject *parent = nullptr);
|
||||
explicit FrameBuffer(QObject *parent = nullptr);
|
||||
|
||||
~FrameBuffer() override;
|
||||
|
||||
@@ -52,7 +52,6 @@ Q_SIGNALS:
|
||||
void frameBufferChanged();
|
||||
|
||||
protected:
|
||||
WId win;
|
||||
char *fb = nullptr;
|
||||
QList<QRect> tiles;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id, const QVaria
|
||||
if (it.key() == KrfbConfig::preferredFrameBufferPlugin()) {
|
||||
qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
||||
|
||||
QSharedPointer<FrameBuffer> frameBuffer(it.value()->frameBuffer(id, args));
|
||||
QSharedPointer<FrameBuffer> frameBuffer(it.value()->frameBuffer(args));
|
||||
if (frameBuffer) {
|
||||
m_frameBuffers.insert(id, frameBuffer.toWeakRef());
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
explicit FrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
~FrameBufferPlugin() override;
|
||||
|
||||
virtual FrameBuffer *frameBuffer(WId id, const QVariantMap &args) = 0;
|
||||
virtual FrameBuffer *frameBuffer(const QVariantMap &args) = 0;
|
||||
};
|
||||
|
||||
#endif // Header guard
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <QSet>
|
||||
#include <QNetworkInterface>
|
||||
#include <QHostInfo>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
class TCP: public QWidget, public Ui::TCP
|
||||
{
|
||||
@@ -219,16 +219,16 @@ void MainWindow::passwordChanged(const QString& password)
|
||||
|
||||
void MainWindow::aboutConnectionAddress()
|
||||
{
|
||||
KMessageBox::about(this,
|
||||
i18n("This field contains the address of your computer and the port number, separated by a colon.\n\nThe address is just a hint - you can use any address that can reach your computer.\n\nDesktop Sharing tries to guess your address from your network configuration, but does not always succeed in doing so.\n\nIf your computer is behind a firewall it may have a different address or be unreachable for other computers."),
|
||||
i18n("KDE Desktop Sharing"));
|
||||
QMessageBox::about(this,
|
||||
i18n("KDE Desktop Sharing"),
|
||||
i18n("This field contains the address of your computer and the port number, separated by a colon.\n\nThe address is just a hint - you can use any address that can reach your computer.\n\nDesktop Sharing tries to guess your address from your network configuration, but does not always succeed in doing so.\n\nIf your computer is behind a firewall it may have a different address or be unreachable for other computers."));
|
||||
}
|
||||
|
||||
void MainWindow::aboutUnattendedMode()
|
||||
{
|
||||
KMessageBox::about(this,
|
||||
i18n("Any remote user with normal desktop sharing password will have to be authenticated.\n\nIf unattended access is on, and the remote user provides unattended mode password, desktop sharing access will be granted without explicit confirmation."),
|
||||
i18n("KDE Desktop Sharing"));
|
||||
QMessageBox::about(this,
|
||||
i18n("KDE Desktop Sharing"),
|
||||
i18n("Any remote user with normal desktop sharing password will have to be authenticated.\n\nIf unattended access is on, and the remote user provides unattended mode password, desktop sharing access will be granted without explicit confirmation."));
|
||||
}
|
||||
|
||||
void MainWindow::showConfiguration()
|
||||
|
||||
Reference in New Issue
Block a user