mirror of
https://invent.kde.org/network/krfb
synced 2024-07-05 09:28:35 +00:00
Initial port to Qt5/KF5.
Fixed FindLibVNCServer to use CheckStructHasMember. Ported from kDebug to qDebug Runs and seems to work, but probably missed some things.
This commit is contained in:
parent
cb43be430c
commit
6306bf85cf
|
@ -1,33 +1,41 @@
|
||||||
cmake_minimum_required(VERSION 2.8.9)
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
|
||||||
project(krfb)
|
project(krfb)
|
||||||
|
|
||||||
if(NOT INSIDE_KDENETWORK)
|
include(FeatureSummary)
|
||||||
message("Not building inside KDENetwork, loading KDE CMake Macros.")
|
find_package(Qt5 REQUIRED COMPONENTS Core DBus Widgets X11Extras)
|
||||||
|
|
||||||
find_package(KDE4 REQUIRED)
|
find_package(ECM 1.7.0 NO_MODULE REQUIRED)
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
||||||
include(KDE4Defaults)
|
include(KDEInstallDirs)
|
||||||
include(MacroLibrary)
|
include(KDECMakeSettings)
|
||||||
|
include(KDECompilerSettings)
|
||||||
|
include(ECMInstallIcons)
|
||||||
|
include(ECMAddAppIcon)
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
find_package(KF5 REQUIRED COMPONENTS
|
||||||
include(CheckIncludeFiles)
|
I18n
|
||||||
include(CheckSymbolExists)
|
Crash
|
||||||
include(CheckFunctionExists)
|
CoreAddons
|
||||||
include(CheckLibraryExists)
|
DNSSD
|
||||||
include(CheckPrototypeExists)
|
DocTools
|
||||||
include(CheckTypeSize)
|
KDELibs4Support
|
||||||
|
Wallet
|
||||||
|
WidgetsAddons
|
||||||
|
)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
|
find_package(X11 REQUIRED)
|
||||||
if(WIN32)
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES})
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES})
|
|
||||||
endif(WIN32)
|
|
||||||
add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
|
|
||||||
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
|
|
||||||
endif(NOT INSIDE_KDENETWORK)
|
|
||||||
|
|
||||||
set(IS_KTP_INTERNAL_MODULE TRUE)
|
if(WIN32)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES})
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES})
|
||||||
|
endif(WIN32)
|
||||||
|
add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS})
|
||||||
|
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
|
||||||
|
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} )
|
||||||
|
|
||||||
|
# set(IS_KTP_INTERNAL_MODULE TRUE)
|
||||||
set(CMAKE_MODULE_PATH
|
set(CMAKE_MODULE_PATH
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
|
||||||
${CMAKE_MODULE_PATH}
|
${CMAKE_MODULE_PATH}
|
||||||
|
@ -35,14 +43,22 @@ set(CMAKE_MODULE_PATH
|
||||||
|
|
||||||
find_package(LibVNCServer REQUIRED)
|
find_package(LibVNCServer REQUIRED)
|
||||||
|
|
||||||
macro_optional_find_package(TelepathyQt4)
|
# macro_optional_find_package(TelepathyQt4)
|
||||||
macro_log_feature(TelepathyQt4_FOUND "telepathy-qt" "Telepathy Qt Bindings" "http://telepathy.freedesktop.org" FALSE "0.9" "Needed to build Telepathy Tubes support.")
|
# macro_log_feature(TelepathyQt4_FOUND "telepathy-qt" "Telepathy Qt Bindings" "http://telepathy.freedesktop.org" FALSE "0.9" "Needed to build Telepathy Tubes support.")
|
||||||
|
|
||||||
macro_optional_find_package(KTp)
|
# macro_optional_find_package(KTp)
|
||||||
macro_log_feature(KTP_FOUND "KTP" "KDE Telepathy" "https://projects.kde.org/projects/extragear/network/telepathy" FALSE "" "Needed to build KDE IM Contacts Display in KRFB.")
|
# macro_log_feature(KTP_FOUND "KTP" "KDE Telepathy" "https://projects.kde.org/projects/extragear/network/telepathy" FALSE "" "Needed to build KDE IM Contacts Display in KRFB.")
|
||||||
|
|
||||||
macro_bool_to_01(X11_Xdamage_FOUND HAVE_XDAMAGE)
|
if (HAVE_XDAMAGE)
|
||||||
macro_bool_to_01(X11_XShm_FOUND HAVE_XSHM)
|
set(X11_Xdamage_FOUND 1)
|
||||||
|
else()
|
||||||
|
set(X11_Xdamage_FOUND 0)
|
||||||
|
endif()
|
||||||
|
if (HAVE_XSHM)
|
||||||
|
set(X11_XShm_FOUND 1)
|
||||||
|
else()
|
||||||
|
set(X11_XShm_FOUND 0)
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories ("${CMAKE_CURRENT_BINARY_DIR}/krfb"
|
include_directories ("${CMAKE_CURRENT_BINARY_DIR}/krfb"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/krfb"
|
"${CMAKE_CURRENT_SOURCE_DIR}/krfb"
|
||||||
|
@ -58,7 +74,3 @@ endif(Q_WS_X11)
|
||||||
add_subdirectory(krfb)
|
add_subdirectory(krfb)
|
||||||
add_subdirectory(framebuffers)
|
add_subdirectory(framebuffers)
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
|
|
||||||
if (NOT INSIDE_KDENETWORK)
|
|
||||||
macro_display_feature_log()
|
|
||||||
endif ()
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
INCLUDE(CheckPointerMember)
|
INCLUDE(CheckStructHasMember)
|
||||||
|
|
||||||
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
||||||
# Already in cache, be silent
|
# Already in cache, be silent
|
||||||
|
@ -25,7 +25,7 @@ FIND_LIBRARY(LIBVNCCLIENT_LIBRARIES NAMES vncclient libvncclient)
|
||||||
|
|
||||||
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
||||||
SET(CMAKE_REQUIRED_INCLUDES "${LIBVNCSERVER_INCLUDE_DIR}" "${CMAKE_REQUIRED_INCLUDES}")
|
SET(CMAKE_REQUIRED_INCLUDES "${LIBVNCSERVER_INCLUDE_DIR}" "${CMAKE_REQUIRED_INCLUDES}")
|
||||||
CHECK_POINTER_MEMBER(rfbClient* GotXCutText rfb/rfbclient.h LIBVNCSERVER_FOUND)
|
CHECK_STRUCT_HAS_MEMBER("struct _rfbClient" GotXCutText rfb/rfbclient.h LIBVNCSERVER_FOUND)
|
||||||
ENDIF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
ENDIF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
||||||
|
|
||||||
IF (LIBVNCSERVER_FOUND)
|
IF (LIBVNCSERVER_FOUND)
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
########### install files ###############
|
########### install files ###############
|
||||||
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR krfb)
|
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR krfb)
|
||||||
|
|
|
@ -7,14 +7,15 @@ set (krfb_framebuffer_qt_SRCS
|
||||||
qtframebufferplugin.cpp
|
qtframebufferplugin.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
kde4_add_plugin (krfb_framebuffer_qt
|
add_library(krfb_framebuffer_qt
|
||||||
|
MODULE
|
||||||
${krfb_framebuffer_qt_SRCS}
|
${krfb_framebuffer_qt_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries (krfb_framebuffer_qt
|
target_link_libraries (krfb_framebuffer_qt
|
||||||
${QT_QTCORE_LIBRARY}
|
Qt5::Core
|
||||||
${QT_QTGUI_LIBRARY}
|
Qt5::Gui
|
||||||
${KDE4_KDEUI_LIBS}
|
KF5::KDELibs4Support
|
||||||
krfbprivate
|
krfbprivate
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <kdemacros.h>
|
#include <kdemacros.h>
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class FrameBuffer;
|
class FrameBuffer;
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,19 @@ set (krfb_framebuffer_x11_SRCS
|
||||||
x11framebufferplugin.cpp
|
x11framebufferplugin.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
kde4_add_plugin (krfb_framebuffer_x11
|
add_library(krfb_framebuffer_x11
|
||||||
|
MODULE
|
||||||
${krfb_framebuffer_x11_SRCS}
|
${krfb_framebuffer_x11_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries (krfb_framebuffer_x11
|
target_link_libraries (krfb_framebuffer_x11
|
||||||
${KDE4_KDEUI_LIBS}
|
|
||||||
${QT_QTCORE_LIBRARY}
|
Qt5::Core
|
||||||
${QT_QTGUI_LIBRARY}
|
Qt5::Gui
|
||||||
${X11_X11_LIB}
|
${X11_X11_LIB}
|
||||||
${X11_Xdamage_LIB}
|
${X11_Xdamage_LIB}
|
||||||
${X11_Xext_LIB}
|
${X11_Xext_LIB}
|
||||||
|
KF5::KDELibs4Support
|
||||||
krfbprivate
|
krfbprivate
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
#include <KApplication>
|
#include <KApplication>
|
||||||
#include <KDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
@ -56,7 +56,7 @@ X11FrameBuffer::X11FrameBuffer(WId id, QObject *parent)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_XSHM
|
#ifdef HAVE_XSHM
|
||||||
d->useShm = XShmQueryExtension(QX11Info::display());
|
d->useShm = XShmQueryExtension(QX11Info::display());
|
||||||
kDebug() << "shm: " << d->useShm;
|
//qDebug() << "shm: " << d->useShm;
|
||||||
#else
|
#else
|
||||||
d->useShm = false;
|
d->useShm = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -94,7 +94,7 @@ X11FrameBuffer::X11FrameBuffer(WId id, QObject *parent)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
kDebug() << "Got image. bpp: " << d->framebufferImage->bits_per_pixel
|
qDebug() << "Got image. bpp: " << d->framebufferImage->bits_per_pixel
|
||||||
<< ", depth: " << d->framebufferImage->depth
|
<< ", depth: " << d->framebufferImage->depth
|
||||||
<< ", padded width: " << d->framebufferImage->bytes_per_line
|
<< ", padded width: " << d->framebufferImage->bytes_per_line
|
||||||
<< " (sent: " << d->framebufferImage->width * 4 << ")"
|
<< " (sent: " << d->framebufferImage->width * 4 << ")"
|
||||||
|
@ -207,25 +207,25 @@ void X11FrameBuffer::cleanupRects()
|
||||||
QList<QRect> cpy = tiles;
|
QList<QRect> cpy = tiles;
|
||||||
bool inserted = false;
|
bool inserted = false;
|
||||||
tiles.clear();
|
tiles.clear();
|
||||||
// kDebug() << "before cleanup: " << cpy.size();
|
// //qDebug() << "before cleanup: " << cpy.size();
|
||||||
foreach(const QRect & r, cpy) {
|
foreach(const QRect & r, cpy) {
|
||||||
if (tiles.size() > 0) {
|
if (tiles.size() > 0) {
|
||||||
for (int i = 0; i < tiles.size(); i++) {
|
for (int i = 0; i < tiles.size(); i++) {
|
||||||
// kDebug() << r << tiles[i];
|
// //qDebug() << r << tiles[i];
|
||||||
if (r.intersects(tiles[i])) {
|
if (r.intersects(tiles[i])) {
|
||||||
tiles[i] |= r;
|
tiles[i] |= r;
|
||||||
inserted = true;
|
inserted = true;
|
||||||
break;
|
break;
|
||||||
// kDebug() << "merged into " << tiles[i];
|
// //qDebug() << "merged into " << tiles[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inserted) {
|
if (!inserted) {
|
||||||
tiles.append(r);
|
tiles.append(r);
|
||||||
// kDebug() << "appended " << r;
|
// //qDebug() << "appended " << r;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// kDebug() << "appended " << r;
|
// //qDebug() << "appended " << r;
|
||||||
tiles.append(r);
|
tiles.append(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ void X11FrameBuffer::cleanupRects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// kDebug() << "after cleanup: " << tiles.size();
|
// //qDebug() << "after cleanup: " << tiles.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void X11FrameBuffer::acquireEvents()
|
void X11FrameBuffer::acquireEvents()
|
||||||
|
@ -258,11 +258,13 @@ void X11FrameBuffer::acquireEvents()
|
||||||
|
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
|
#ifdef HAVE_XDAMAGE
|
||||||
while (XCheckTypedEvent(QX11Info::display(), d->xdamageBaseEvent + XDamageNotify, &ev)) {
|
while (XCheckTypedEvent(QX11Info::display(), d->xdamageBaseEvent + XDamageNotify, &ev)) {
|
||||||
handleXDamage(&ev);
|
handleXDamage(&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
XDamageSubtract(QX11Info::display(), d->damage, None, None);
|
XDamageSubtract(QX11Info::display(), d->damage, None, None);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QList< QRect > X11FrameBuffer::modifiedTiles()
|
QList< QRect > X11FrameBuffer::modifiedTiles()
|
||||||
|
@ -283,7 +285,7 @@ QList< QRect > X11FrameBuffer::modifiedTiles()
|
||||||
#ifdef HAVE_XSHM
|
#ifdef HAVE_XSHM
|
||||||
|
|
||||||
foreach(const QRect & r, tiles) {
|
foreach(const QRect & r, tiles) {
|
||||||
// kDebug() << r;
|
// //qDebug() << r;
|
||||||
gl |= r;
|
gl |= r;
|
||||||
int y = r.y();
|
int y = r.y();
|
||||||
int x = r.x();
|
int x = r.x();
|
||||||
|
@ -298,7 +300,7 @@ QList< QRect > X11FrameBuffer::modifiedTiles()
|
||||||
x = d->framebufferImage->width - d->updateTile->width;
|
x = d->framebufferImage->width - d->updateTile->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// kDebug() << "x: " << x << " (" << r.x() << ") y: " << y << " (" << r.y() << ") " << r;
|
// //qDebug() << "x: " << x << " (" << r.x() << ") y: " << y << " (" << r.y() << ") " << r;
|
||||||
XShmGetImage(QX11Info::display(), win, d->updateTile, x, y, AllPlanes);
|
XShmGetImage(QX11Info::display(), win, d->updateTile, x, y, AllPlanes);
|
||||||
int pxsize = d->framebufferImage->bits_per_pixel / 8;
|
int pxsize = d->framebufferImage->bits_per_pixel / 8;
|
||||||
char *dest = fb + ((d->framebufferImage->bytes_per_line * y) + (x * pxsize));
|
char *dest = fb + ((d->framebufferImage->bytes_per_line * y) + (x * pxsize));
|
||||||
|
@ -336,8 +338,8 @@ QList< QRect > X11FrameBuffer::modifiedTiles()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// kDebug() << "tot: " << gl;
|
// //qDebug() << "tot: " << gl;
|
||||||
// kDebug() << tiles.size();
|
// //qDebug() << tiles.size();
|
||||||
ret = tiles;
|
ret = tiles;
|
||||||
tiles.clear();
|
tiles.clear();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class X11FrameBuffer;
|
class X11FrameBuffer;
|
||||||
|
typedef union _XEvent XEvent;
|
||||||
|
|
||||||
class EvWidget: public QWidget
|
class EvWidget: public QWidget
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <kdemacros.h>
|
#include <kdemacros.h>
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class FrameBuffer;
|
class FrameBuffer;
|
||||||
|
|
||||||
|
|
3
krfb.kdev4
Normal file
3
krfb.kdev4
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[Project]
|
||||||
|
Manager=KDevCMakeManager
|
||||||
|
Name=krfb
|
|
@ -2,6 +2,8 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config-krfb.h.cmake
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/config-krfb.h
|
${CMAKE_CURRENT_BINARY_DIR}/config-krfb.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include(GenerateExportHeader)
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# First target: libkrfbprivate - a library
|
# First target: libkrfbprivate - a library
|
||||||
# for linking plugins against.
|
# for linking plugins against.
|
||||||
|
@ -11,21 +13,23 @@ set (krfbprivate_SRCS
|
||||||
framebufferplugin.cpp
|
framebufferplugin.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
kde4_add_library (krfbprivate
|
add_library (krfbprivate
|
||||||
SHARED
|
SHARED
|
||||||
${krfbprivate_SRCS}
|
${krfbprivate_SRCS}
|
||||||
)
|
)
|
||||||
|
generate_export_header(krfbprivate BASE_NAME krfbprivate)
|
||||||
|
|
||||||
target_link_libraries (krfbprivate
|
target_link_libraries (krfbprivate
|
||||||
${QT_QTCORE_LIBRARY}
|
Qt5::Core
|
||||||
${QT_QTGUI_LIBRARY}
|
Qt5::Widgets
|
||||||
|
Qt5::X11Extras
|
||||||
${X11_X11_LIB}
|
${X11_X11_LIB}
|
||||||
${LIBVNCSERVER_LIBRARIES}
|
${LIBVNCSERVER_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties (krfbprivate PROPERTIES
|
set_target_properties (krfbprivate PROPERTIES
|
||||||
VERSION ${GENERIC_LIB_VERSION}
|
VERSION 5
|
||||||
SOVERSION ${GENERIC_LIB_VERSION}
|
SOVERSION 5.0
|
||||||
)
|
)
|
||||||
|
|
||||||
install (TARGETS krfbprivate
|
install (TARGETS krfbprivate
|
||||||
|
@ -75,11 +79,11 @@ if(TelepathyQt4_FOUND)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
kde4_add_kcfg_files (krfb_SRCS
|
kconfig_add_kcfg_files (krfb_SRCS
|
||||||
krfbconfig.kcfgc
|
krfbconfig.kcfgc
|
||||||
)
|
)
|
||||||
|
|
||||||
kde4_add_ui_files (krfb_SRCS
|
ki18n_wrap_ui (krfb_SRCS
|
||||||
ui/configtcp.ui
|
ui/configtcp.ui
|
||||||
ui/configsecurity.ui
|
ui/configsecurity.ui
|
||||||
ui/connectionwidget.ui
|
ui/connectionwidget.ui
|
||||||
|
@ -87,10 +91,10 @@ kde4_add_ui_files (krfb_SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TelepathyQt4_FOUND)
|
if(TelepathyQt4_FOUND)
|
||||||
kde4_add_ui_files(krfb_SRCS ui/tubesconnectionwidget.ui)
|
ki18n_wrap_ui(krfb_SRCS ui/tubesconnectionwidget.ui)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
kde4_add_executable (krfb
|
add_executable (krfb
|
||||||
${krfb_SRCS}
|
${krfb_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -101,9 +105,11 @@ target_link_libraries (krfb
|
||||||
${X11_Xext_LIB}
|
${X11_Xext_LIB}
|
||||||
${X11_X11_LIB}
|
${X11_X11_LIB}
|
||||||
${X11_Xdamage_LIB}
|
${X11_Xdamage_LIB}
|
||||||
${QT_QTNETWORK_LIBRARY}
|
Qt5::Network
|
||||||
${KDE4_KDNSSD_LIBS}
|
KF5::DNSSD
|
||||||
${KDE4_KDEUI_LIBS}
|
KF5::KDELibs4Support
|
||||||
|
KF5::Wallet
|
||||||
|
KF5::WidgetsAddons
|
||||||
${LIBVNCSERVER_LIBRARIES}
|
${LIBVNCSERVER_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,11 @@
|
||||||
|
|
||||||
#include "connectiondialog.h"
|
#include "connectiondialog.h"
|
||||||
|
|
||||||
#include <KIconLoader>
|
#include <KIcon>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KStandardGuiItem>
|
#include <KStandardGuiItem>
|
||||||
|
|
||||||
#include <QtGui/QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QtGui/QLabel>
|
|
||||||
|
|
||||||
template <typename UI>
|
template <typename UI>
|
||||||
ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
|
ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
|
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
|
|
||||||
#include <QtGui/QApplication>
|
#include <QApplication>
|
||||||
#include <QtGui/QX11Info>
|
#include <QX11Info>
|
||||||
#include <QtGui/QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <KGlobal>
|
#include <KGlobal>
|
||||||
|
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
|
@ -12,19 +12,19 @@
|
||||||
|
|
||||||
#include "rfb.h"
|
#include "rfb.h"
|
||||||
|
|
||||||
#include <kdemacros.h>
|
#include "krfbprivate_export.h"
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QRect>
|
#include <QtCore/QRect>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
class FrameBuffer;
|
class FrameBuffer;
|
||||||
/**
|
/**
|
||||||
@author Alessandro Praduroux <pradu@pradu.it>
|
@author Alessandro Praduroux <pradu@pradu.it>
|
||||||
*/
|
*/
|
||||||
class KDE_EXPORT FrameBuffer : public QObject
|
class KRFBPRIVATE_EXPORT FrameBuffer : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "framebufferplugin.h"
|
#include "framebufferplugin.h"
|
||||||
#include "krfbconfig.h"
|
#include "krfbconfig.h"
|
||||||
|
|
||||||
#include <KDebug>
|
#include <QDebug>
|
||||||
#include <KGlobal>
|
#include <KGlobal>
|
||||||
#include <KServiceTypeTrader>
|
#include <KServiceTypeTrader>
|
||||||
|
|
||||||
|
@ -39,26 +39,26 @@ K_GLOBAL_STATIC(FrameBufferManagerStatic, frameBufferManagerStatic)
|
||||||
|
|
||||||
FrameBufferManager::FrameBufferManager()
|
FrameBufferManager::FrameBufferManager()
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
|
|
||||||
loadPlugins();
|
loadPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameBufferManager::~FrameBufferManager()
|
FrameBufferManager::~FrameBufferManager()
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameBufferManager *FrameBufferManager::instance()
|
FrameBufferManager *FrameBufferManager::instance()
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
|
|
||||||
return &frameBufferManagerStatic->instance;
|
return &frameBufferManagerStatic->instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBufferManager::loadPlugins()
|
void FrameBufferManager::loadPlugins()
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
|
|
||||||
// Load the all the plugin factories here, for use later.
|
// Load the all the plugin factories here, for use later.
|
||||||
KService::List offers = KServiceTypeTrader::self()->query("krfb/framebuffer");
|
KService::List offers = KServiceTypeTrader::self()->query("krfb/framebuffer");
|
||||||
|
@ -72,34 +72,34 @@ void FrameBufferManager::loadPlugins()
|
||||||
KPluginFactory *factory = KPluginLoader(service->library()).factory();
|
KPluginFactory *factory = KPluginLoader(service->library()).factory();
|
||||||
|
|
||||||
if (!factory) {
|
if (!factory) {
|
||||||
kWarning() << "KPluginFactory could not load the plugin:" << service->library();
|
qWarning() << "KPluginFactory could not load the plugin:" << service->library();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameBufferPlugin *plugin = factory->create<FrameBufferPlugin>(this);
|
FrameBufferPlugin *plugin = factory->create<FrameBufferPlugin>(this);
|
||||||
|
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
kDebug() << "Loaded plugin:" << service->name();
|
//qDebug() << "Loaded plugin:" << service->name();
|
||||||
m_plugins.insert(service->library(), plugin);
|
m_plugins.insert(service->library(), plugin);
|
||||||
} else {
|
} else {
|
||||||
kDebug() << error;
|
//qDebug() << error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
|
QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
|
|
||||||
// See if there is still an existing framebuffer to this WId.
|
// See if there is still an existing framebuffer to this WId.
|
||||||
if (m_frameBuffers.contains(id)) {
|
if (m_frameBuffers.contains(id)) {
|
||||||
QWeakPointer<FrameBuffer> weakFrameBuffer = m_frameBuffers.value(id);
|
QWeakPointer<FrameBuffer> weakFrameBuffer = m_frameBuffers.value(id);
|
||||||
|
|
||||||
if (weakFrameBuffer) {
|
if (weakFrameBuffer) {
|
||||||
kDebug() << "Found cached frame buffer.";
|
//qDebug() << "Found cached frame buffer.";
|
||||||
return weakFrameBuffer.toStrongRef();
|
return weakFrameBuffer.toStrongRef();
|
||||||
} else {
|
} else {
|
||||||
kDebug() << "Found deleted cached frame buffer. Don't use.";
|
//qDebug() << "Found deleted cached frame buffer. Don't use.";
|
||||||
m_frameBuffers.remove(id);
|
m_frameBuffers.remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
|
||||||
while (iter != m_plugins.constEnd()) {
|
while (iter != m_plugins.constEnd()) {
|
||||||
|
|
||||||
if (iter.key() == KrfbConfig::preferredFrameBufferPlugin()) {
|
if (iter.key() == KrfbConfig::preferredFrameBufferPlugin()) {
|
||||||
kDebug() << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
//qDebug() << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
||||||
|
|
||||||
QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id));
|
QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id));
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// No valid framebuffer plugin found.
|
// No valid framebuffer plugin found.
|
||||||
kDebug() << "No valid framebuffer found. returning null.";
|
//qDebug() << "No valid framebuffer found. returning null.";
|
||||||
return QSharedPointer<FrameBuffer>();
|
return QSharedPointer<FrameBuffer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
|
|
||||||
#include "framebuffer.h"
|
#include "framebuffer.h"
|
||||||
|
|
||||||
#include <kdemacros.h>
|
#include "krfbprivate_export.h"
|
||||||
|
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
#include <QtCore/QWeakPointer>
|
#include <QtCore/QWeakPointer>
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class FrameBufferPlugin;
|
class FrameBufferPlugin;
|
||||||
class KPluginFactory;
|
class KPluginFactory;
|
||||||
|
|
||||||
class KDE_EXPORT FrameBufferManager : public QObject
|
class KRFBPRIVATE_EXPORT FrameBufferManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class FrameBufferManagerStatic;
|
friend class FrameBufferManagerStatic;
|
||||||
|
|
|
@ -21,15 +21,15 @@
|
||||||
#ifndef LIB_KRFB_FRAMEBUFFERPLUGIN_H
|
#ifndef LIB_KRFB_FRAMEBUFFERPLUGIN_H
|
||||||
#define LIB_KRFB_FRAMEBUFFERPLUGIN_H
|
#define LIB_KRFB_FRAMEBUFFERPLUGIN_H
|
||||||
|
|
||||||
#include <kdemacros.h>
|
#include "krfbprivate_export.h"
|
||||||
|
|
||||||
#include <QtCore/QVariantList>
|
#include <QtCore/QVariantList>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
class FrameBuffer;
|
class FrameBuffer;
|
||||||
|
|
||||||
class KDE_EXPORT FrameBufferPlugin : public QObject
|
class KRFBPRIVATE_EXPORT FrameBufferPlugin : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include "connectiondialog.h"
|
#include "connectiondialog.h"
|
||||||
#include <KNotification>
|
#include <KNotification>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include <QtCore/QSocketNotifier>
|
#include <QtCore/QSocketNotifier>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
|
||||||
|
@ -111,7 +113,7 @@ void PendingInvitationsRfbClient::onSocketActivated()
|
||||||
//the clientGoneHook which in turn will remove this RfbClient instance
|
//the clientGoneHook which in turn will remove this RfbClient instance
|
||||||
//from the server manager and will call deleteLater() to delete it
|
//from the server manager and will call deleteLater() to delete it
|
||||||
if (d->client->sock == -1) {
|
if (d->client->sock == -1) {
|
||||||
kDebug() << "disconnected from socket signal";
|
qDebug() << "disconnected from socket signal";
|
||||||
d->notifier->setEnabled(false);
|
d->notifier->setEnabled(false);
|
||||||
rfbClientConnectionGone(d->client);
|
rfbClientConnectionGone(d->client);
|
||||||
break;
|
break;
|
||||||
|
@ -122,7 +124,7 @@ void PendingInvitationsRfbClient::onSocketActivated()
|
||||||
bool PendingInvitationsRfbClient::checkPassword(const QByteArray & encryptedPassword)
|
bool PendingInvitationsRfbClient::checkPassword(const QByteArray & encryptedPassword)
|
||||||
{
|
{
|
||||||
QByteArray password ;
|
QByteArray password ;
|
||||||
kDebug() << "about to start autentication";
|
qDebug() << "about to start autentication";
|
||||||
|
|
||||||
if(InvitationsRfbServer::instance->allowUnattendedAccess() && vncAuthCheckPassword(
|
if(InvitationsRfbServer::instance->allowUnattendedAccess() && vncAuthCheckPassword(
|
||||||
InvitationsRfbServer::instance->unattendedPassword().toLocal8Bit(),
|
InvitationsRfbServer::instance->unattendedPassword().toLocal8Bit(),
|
||||||
|
|
|
@ -23,16 +23,18 @@
|
||||||
#include "krfbconfig.h"
|
#include "krfbconfig.h"
|
||||||
#include "rfbservermanager.h"
|
#include "rfbservermanager.h"
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtGui/QApplication>
|
#include <QApplication>
|
||||||
#include <QtNetwork/QHostInfo>
|
#include <QtNetwork/QHostInfo>
|
||||||
#include <KNotification>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KMessageBox>
|
|
||||||
#include <KUser>
|
#include <KUser>
|
||||||
#include <KRandom>
|
#include <KRandom>
|
||||||
#include <KStringHandler>
|
#include <KStringHandler>
|
||||||
#include <KWallet/Wallet>
|
#include <KWallet/Wallet>
|
||||||
#include <DNSSD/PublicService>
|
#include <KGlobal>
|
||||||
|
|
||||||
|
#include <dnssd/publicservice.h>
|
||||||
using KWallet::Wallet;
|
using KWallet::Wallet;
|
||||||
|
|
||||||
//static
|
//static
|
||||||
|
@ -42,7 +44,7 @@ InvitationsRfbServer *InvitationsRfbServer::instance;
|
||||||
void InvitationsRfbServer::init()
|
void InvitationsRfbServer::init()
|
||||||
{
|
{
|
||||||
instance = new InvitationsRfbServer;
|
instance = new InvitationsRfbServer;
|
||||||
instance->m_publicService = new DNSSD::PublicService(
|
instance->m_publicService = new KDNSSD::PublicService(
|
||||||
i18n("%1@%2 (shared desktop)",
|
i18n("%1@%2 (shared desktop)",
|
||||||
KUser().loginName(),
|
KUser().loginName(),
|
||||||
QHostInfo::localHostName()),
|
QHostInfo::localHostName()),
|
||||||
|
@ -170,7 +172,7 @@ void InvitationsRfbServer::walletOpened(bool opened)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
kDebug() << "Could not open KWallet, Falling back to config file";
|
qDebug() << "Could not open KWallet, Falling back to config file";
|
||||||
KSharedConfigPtr config = KGlobal::config();
|
KSharedConfigPtr config = KGlobal::config();
|
||||||
KConfigGroup krfbConfig(config,"Security");
|
KConfigGroup krfbConfig(config,"Security");
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace KWallet {
|
||||||
class Wallet;
|
class Wallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace DNSSD {
|
namespace KDNSSD {
|
||||||
class PublicService;
|
class PublicService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ private Q_SLOTS:
|
||||||
void walletOpened(bool);
|
void walletOpened(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DNSSD::PublicService *m_publicService;
|
KDNSSD::PublicService *m_publicService;
|
||||||
bool m_allowUnattendedAccess;
|
bool m_allowUnattendedAccess;
|
||||||
QString m_desktopPassword;
|
QString m_desktopPassword;
|
||||||
QString m_unattendedPassword;
|
QString m_unattendedPassword;
|
||||||
|
|
|
@ -19,18 +19,16 @@
|
||||||
#include "trayicon.h"
|
#include "trayicon.h"
|
||||||
#include "invitationsrfbserver.h"
|
#include "invitationsrfbserver.h"
|
||||||
|
|
||||||
#include <KAboutApplicationDialog>
|
#include <K4AboutData>
|
||||||
#include <KAboutData>
|
|
||||||
#include <KAction>
|
|
||||||
#include <KUniqueApplication>
|
#include <KUniqueApplication>
|
||||||
#include <KCmdLineArgs>
|
#include <KCmdLineArgs>
|
||||||
#include <KDebug>
|
#include <QDebug>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KMessageBox>
|
#include <KMessageBox>
|
||||||
#include <KNotification>
|
|
||||||
|
|
||||||
#include <QtGui/QPixmap>
|
#include <QPixmap>
|
||||||
#include <QtGui/qwindowdefs.h>
|
#include <qwindowdefs.h>
|
||||||
|
#include <QX11Info>
|
||||||
|
|
||||||
#ifdef KRFB_WITH_TELEPATHY_TUBES
|
#ifdef KRFB_WITH_TELEPATHY_TUBES
|
||||||
# include "tubesrfbserver.h"
|
# include "tubesrfbserver.h"
|
||||||
|
@ -39,6 +37,7 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <X11/extensions/XTest.h>
|
#include <X11/extensions/XTest.h>
|
||||||
|
|
||||||
|
static const char KRFB_VERSION[] = I18N_NOOP("5.0");
|
||||||
static const char description[] = I18N_NOOP("VNC-compatible server to share "
|
static const char description[] = I18N_NOOP("VNC-compatible server to share "
|
||||||
"KDE desktops");
|
"KDE desktops");
|
||||||
|
|
||||||
|
@ -61,8 +60,8 @@ static bool checkX11Capabilities()
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
KAboutData aboutData("krfb", 0, ki18n("Desktop Sharing"), KDE_VERSION_STRING,
|
K4AboutData aboutData("krfb", 0, ki18n("Desktop Sharing"), KRFB_VERSION,
|
||||||
ki18n(description), KAboutData::License_GPL,
|
ki18n(description), K4AboutData::License_GPL,
|
||||||
ki18n("(c) 2009-2010, Collabora Ltd.\n"
|
ki18n("(c) 2009-2010, Collabora Ltd.\n"
|
||||||
"(c) 2007, Alessandro Praduroux\n"
|
"(c) 2007, Alessandro Praduroux\n"
|
||||||
"(c) 2001-2003, Tim Jansen\n"
|
"(c) 2001-2003, Tim Jansen\n"
|
||||||
|
|
|
@ -18,16 +18,13 @@
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KMessageBox>
|
#include <KMessageBox>
|
||||||
#include <KStandardGuiItem>
|
|
||||||
#include <KSystemTimeZone>
|
|
||||||
#include <KToolInvocation>
|
|
||||||
#include <KStandardAction>
|
#include <KStandardAction>
|
||||||
#include <KActionCollection>
|
#include <KActionCollection>
|
||||||
#include <KLineEdit>
|
#include <KLineEdit>
|
||||||
#include <KNewPasswordDialog>
|
#include <KNewPasswordDialog>
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QWidget>
|
||||||
#include <QtGui/QSizePolicy>
|
#include <QSizePolicy>
|
||||||
#include <QtNetwork/QNetworkInterface>
|
#include <QtNetwork/QNetworkInterface>
|
||||||
|
|
||||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||||
|
@ -243,7 +240,8 @@ void MainWindow::showConfiguration()
|
||||||
KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self());
|
KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self());
|
||||||
dialog->addPage(new TCP, i18n("Network"), "network-workgroup");
|
dialog->addPage(new TCP, i18n("Network"), "network-workgroup");
|
||||||
dialog->addPage(new Security, i18n("Security"), "security-high");
|
dialog->addPage(new Security, i18n("Security"), "security-high");
|
||||||
dialog->setHelp(QString(), "krfb");
|
// TODO: Fix for KF5 release
|
||||||
|
// dialog->setHelp(QString(), "krfb");
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
#include "sockethelpers.h"
|
#include "sockethelpers.h"
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include <QtCore/QSocketNotifier>
|
#include <QtCore/QSocketNotifier>
|
||||||
#include <KDebug>
|
#include <QDebug>
|
||||||
#include <KNotification>
|
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <strings.h> //for bzero()
|
#include <strings.h> //for bzero()
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ RfbClient::RfbClient(rfbClientPtr client, QObject* parent)
|
||||||
|
|
||||||
RfbClient::~RfbClient()
|
RfbClient::~RfbClient()
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +139,7 @@ void RfbClient::onSocketActivated()
|
||||||
//the clientGoneHook which in turn will remove this RfbClient instance
|
//the clientGoneHook which in turn will remove this RfbClient instance
|
||||||
//from the server manager and will call deleteLater() to delete it
|
//from the server manager and will call deleteLater() to delete it
|
||||||
if (d->client->sock == -1) {
|
if (d->client->sock == -1) {
|
||||||
kDebug() << "disconnected from socket signal";
|
//qDebug() << "disconnected from socket signal";
|
||||||
d->notifier->setEnabled(false);
|
d->notifier->setEnabled(false);
|
||||||
rfbClientConnectionGone(d->client);
|
rfbClientConnectionGone(d->client);
|
||||||
break;
|
break;
|
||||||
|
@ -159,7 +158,7 @@ void RfbClient::update()
|
||||||
//the clientGoneHook which in turn will remove this RfbClient instance
|
//the clientGoneHook which in turn will remove this RfbClient instance
|
||||||
//from the server manager and will call deleteLater() to delete it
|
//from the server manager and will call deleteLater() to delete it
|
||||||
if (d->client->sock == -1) {
|
if (d->client->sock == -1) {
|
||||||
kDebug() << "disconnected during update";
|
//qDebug() << "disconnected during update";
|
||||||
d->notifier->setEnabled(false);
|
d->notifier->setEnabled(false);
|
||||||
rfbClientConnectionGone(d->client);
|
rfbClientConnectionGone(d->client);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +177,7 @@ PendingRfbClient::~PendingRfbClient()
|
||||||
|
|
||||||
void PendingRfbClient::accept(RfbClient *newClient)
|
void PendingRfbClient::accept(RfbClient *newClient)
|
||||||
{
|
{
|
||||||
kDebug() << "accepted connection";
|
//qDebug() << "accepted connection";
|
||||||
|
|
||||||
m_rfbClient->clientData = newClient;
|
m_rfbClient->clientData = newClient;
|
||||||
newClient->setOnHold(false);
|
newClient->setOnHold(false);
|
||||||
|
@ -191,7 +190,7 @@ static void clientGoneHookNoop(rfbClientPtr cl) { Q_UNUSED(cl); }
|
||||||
|
|
||||||
void PendingRfbClient::reject()
|
void PendingRfbClient::reject()
|
||||||
{
|
{
|
||||||
kDebug() << "refused connection";
|
//qDebug() << "refused connection";
|
||||||
|
|
||||||
//override the clientGoneHook that was previously set by RfbServer
|
//override the clientGoneHook that was previously set by RfbServer
|
||||||
m_rfbClient->clientGoneHook = clientGoneHookNoop;
|
m_rfbClient->clientGoneHook = clientGoneHookNoop;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <QtCore/QSocketNotifier>
|
#include <QtCore/QSocketNotifier>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <KDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
struct RfbServer::Private
|
struct RfbServer::Private
|
||||||
{
|
{
|
||||||
|
@ -122,14 +122,14 @@ bool RfbServer::start()
|
||||||
d->screen->authPasswdData = (void *)0;
|
d->screen->authPasswdData = (void *)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
kDebug() << "Starting server. Listen port:" << listeningPort()
|
qDebug() << "Starting server. Listen port:" << listeningPort()
|
||||||
<< "Listen Address:" << listeningAddress()
|
<< "Listen Address:" << listeningAddress()
|
||||||
<< "Password enabled:" << passwordRequired();
|
<< "Password enabled:" << passwordRequired();
|
||||||
|
|
||||||
rfbInitServer(d->screen);
|
rfbInitServer(d->screen);
|
||||||
|
|
||||||
if (!rfbIsActive(d->screen)) {
|
if (!rfbIsActive(d->screen)) {
|
||||||
kDebug() << "Failed to start server";
|
//qDebug() << "Failed to start server";
|
||||||
rfbShutdownServer(d->screen, false);
|
rfbShutdownServer(d->screen, false);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
@ -187,13 +187,13 @@ void krfb_rfbSetCursorPosition(rfbScreenInfoPtr screen, rfbClientPtr client, int
|
||||||
/* Inform all clients about this cursor movement. */
|
/* Inform all clients about this cursor movement. */
|
||||||
iterator = rfbGetClientIterator(screen);
|
iterator = rfbGetClientIterator(screen);
|
||||||
while ((cl = rfbClientIteratorNext(iterator)) != NULL) {
|
while ((cl = rfbClientIteratorNext(iterator)) != NULL) {
|
||||||
cl->cursorWasMoved = TRUE;
|
cl->cursorWasMoved = true;
|
||||||
}
|
}
|
||||||
rfbReleaseClientIterator(iterator);
|
rfbReleaseClientIterator(iterator);
|
||||||
|
|
||||||
/* The cursor was moved by this client, so don't send CursorPos. */
|
/* The cursor was moved by this client, so don't send CursorPos. */
|
||||||
if (client) {
|
if (client) {
|
||||||
client->cursorWasMoved = FALSE;
|
client->cursorWasMoved = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ void RfbServer::onListenSocketActivated()
|
||||||
|
|
||||||
void RfbServer::pendingClientFinished(RfbClient *client)
|
void RfbServer::pendingClientFinished(RfbClient *client)
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
if (client) {
|
if (client) {
|
||||||
RfbServerManager::instance()->addClient(client);
|
RfbServerManager::instance()->addClient(client);
|
||||||
client->getRfbClientPtr()->clientGoneHook = clientGoneHook;
|
client->getRfbClientPtr()->clientGoneHook = clientGoneHook;
|
||||||
|
@ -230,7 +230,7 @@ void RfbServer::pendingClientFinished(RfbClient *client)
|
||||||
//static
|
//static
|
||||||
rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
|
rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
|
||||||
{
|
{
|
||||||
kDebug() << "New client";
|
//qDebug() << "New client";
|
||||||
RfbServer *server = static_cast<RfbServer*>(cl->screen->screenData);
|
RfbServer *server = static_cast<RfbServer*>(cl->screen->screenData);
|
||||||
|
|
||||||
PendingRfbClient *pendingClient = server->newClient(cl);
|
PendingRfbClient *pendingClient = server->newClient(cl);
|
||||||
|
@ -243,7 +243,7 @@ rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
|
||||||
//static
|
//static
|
||||||
void RfbServer::clientGoneHook(rfbClientPtr cl)
|
void RfbServer::clientGoneHook(rfbClientPtr cl)
|
||||||
{
|
{
|
||||||
kDebug() << "client gone";
|
//qDebug() << "client gone";
|
||||||
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
|
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
|
||||||
|
|
||||||
RfbServerManager::instance()->removeClient(client);
|
RfbServerManager::instance()->removeClient(client);
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
#include "sockethelpers.h"
|
#include "sockethelpers.h"
|
||||||
#include "krfbconfig.h"
|
#include "krfbconfig.h"
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtGui/QApplication>
|
#include <QApplication>
|
||||||
#include <QtGui/QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QtNetwork/QHostInfo>
|
#include <QtNetwork/QHostInfo>
|
||||||
#include <KGlobal>
|
#include <KGlobal>
|
||||||
#include <KDebug>
|
#include <QDebug>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KUser>
|
#include <KUser>
|
||||||
#include <KNotification>
|
#include <KNotification>
|
||||||
|
@ -114,7 +114,7 @@ RfbServerManager::~RfbServerManager()
|
||||||
|
|
||||||
void RfbServerManager::init()
|
void RfbServerManager::init()
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
|
|
||||||
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId());
|
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId());
|
||||||
d->myCursor = rfbMakeXCursor(19, 19, (char *) cur, (char *) mask);
|
d->myCursor = rfbMakeXCursor(19, 19, (char *) cur, (char *) mask);
|
||||||
|
@ -147,7 +147,7 @@ void RfbServerManager::updateScreens()
|
||||||
|
|
||||||
void RfbServerManager::cleanup()
|
void RfbServerManager::cleanup()
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
|
|
||||||
//copy because d->servers is going to be modified while we delete the servers
|
//copy because d->servers is going to be modified while we delete the servers
|
||||||
QSet<RfbServer*> servers = d->servers;
|
QSet<RfbServer*> servers = d->servers;
|
||||||
|
@ -187,7 +187,7 @@ rfbScreenInfoPtr RfbServerManager::newScreen()
|
||||||
bpp = 4;
|
bpp = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
kDebug() << "bpp: " << bpp;
|
//qDebug() << "bpp: " << bpp;
|
||||||
|
|
||||||
rfbLogEnable(0);
|
rfbLogEnable(0);
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ rfbScreenInfoPtr RfbServerManager::newScreen()
|
||||||
void RfbServerManager::addClient(RfbClient* cc)
|
void RfbServerManager::addClient(RfbClient* cc)
|
||||||
{
|
{
|
||||||
if (d->clients.size() == 0) {
|
if (d->clients.size() == 0) {
|
||||||
kDebug() << "Starting framebuffer monitor";
|
//qDebug() << "Starting framebuffer monitor";
|
||||||
d->fb->startMonitor();
|
d->fb->startMonitor();
|
||||||
d->rfbUpdateTimer.start(50);
|
d->rfbUpdateTimer.start(50);
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ void RfbServerManager::removeClient(RfbClient* cc)
|
||||||
{
|
{
|
||||||
d->clients.remove(cc);
|
d->clients.remove(cc);
|
||||||
if (d->clients.size() == 0) {
|
if (d->clients.size() == 0) {
|
||||||
kDebug() << "Stopping framebuffer monitor";
|
//qDebug() << "Stopping framebuffer monitor";
|
||||||
d->fb->stopMonitor();
|
d->fb->stopMonitor();
|
||||||
d->rfbUpdateTimer.stop();
|
d->rfbUpdateTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,32 +26,32 @@
|
||||||
#include <KActionCollection>
|
#include <KActionCollection>
|
||||||
#include <KDialog>
|
#include <KDialog>
|
||||||
#include <KGlobal>
|
#include <KGlobal>
|
||||||
|
#include <KIcon>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KMenu>
|
#include <QMenu>
|
||||||
#include <KStandardAction>
|
#include <KStandardAction>
|
||||||
#include <KDebug>
|
#include <KToggleAction>
|
||||||
|
|
||||||
|
|
||||||
class ClientActions
|
class ClientActions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClientActions(RfbClient *client, KMenu *menu, QAction *before);
|
ClientActions(RfbClient *client, QMenu *menu, QAction *before);
|
||||||
virtual ~ClientActions();
|
virtual ~ClientActions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KMenu *m_menu;
|
QMenu *m_menu;
|
||||||
QAction *m_title;
|
QAction *m_title;
|
||||||
QAction *m_disconnectAction;
|
QAction *m_disconnectAction;
|
||||||
QAction *m_enableControlAction;
|
QAction *m_enableControlAction;
|
||||||
QAction *m_separator;
|
QAction *m_separator;
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientActions::ClientActions(RfbClient* client, KMenu* menu, QAction* before)
|
ClientActions::ClientActions(RfbClient* client, QMenu* menu, QAction* before)
|
||||||
: m_menu(menu)
|
: m_menu(menu)
|
||||||
{
|
{
|
||||||
m_title = m_menu->addTitle(client->name(), before);
|
m_title = m_menu->insertSection(before, client->name());
|
||||||
|
|
||||||
m_disconnectAction = new KAction(i18n("Disconnect"), m_menu);
|
m_disconnectAction = new QAction(i18n("Disconnect"), m_menu);
|
||||||
m_menu->insertAction(before, m_disconnectAction);
|
m_menu->insertAction(before, m_disconnectAction);
|
||||||
|
|
||||||
QObject::connect(m_disconnectAction, SIGNAL(triggered()), client, SLOT(closeConnection()));
|
QObject::connect(m_disconnectAction, SIGNAL(triggered()), client, SLOT(closeConnection()));
|
||||||
|
@ -74,8 +74,6 @@ ClientActions::ClientActions(RfbClient* client, KMenu* menu, QAction* before)
|
||||||
|
|
||||||
ClientActions::~ClientActions()
|
ClientActions::~ClientActions()
|
||||||
{
|
{
|
||||||
kDebug();
|
|
||||||
|
|
||||||
m_menu->removeAction(m_title);
|
m_menu->removeAction(m_title);
|
||||||
delete m_title;
|
delete m_title;
|
||||||
|
|
||||||
|
@ -106,14 +104,12 @@ TrayIcon::TrayIcon(QWidget *mainWindow)
|
||||||
connect(RfbServerManager::instance(), SIGNAL(clientDisconnected(RfbClient*)),
|
connect(RfbServerManager::instance(), SIGNAL(clientDisconnected(RfbClient*)),
|
||||||
this, SLOT(onClientDisconnected(RfbClient*)));
|
this, SLOT(onClientDisconnected(RfbClient*)));
|
||||||
|
|
||||||
m_aboutAction = KStandardAction::aboutApp(this, SLOT(showAbout()), actionCollection());
|
m_aboutAction = KStandardAction::aboutApp(this, SLOT(showAbout()), this);
|
||||||
contextMenu()->addAction(m_aboutAction);
|
contextMenu()->addAction(m_aboutAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrayIcon::onClientConnected(RfbClient* client)
|
void TrayIcon::onClientConnected(RfbClient* client)
|
||||||
{
|
{
|
||||||
kDebug();
|
|
||||||
|
|
||||||
if (m_clientActions.isEmpty()) { //first client connected
|
if (m_clientActions.isEmpty()) { //first client connected
|
||||||
setIconByName("krfb");
|
setIconByName("krfb");
|
||||||
setToolTipTitle(i18n("Desktop Sharing - connected with %1", client->name()));
|
setToolTipTitle(i18n("Desktop Sharing - connected with %1", client->name()));
|
||||||
|
@ -127,8 +123,6 @@ void TrayIcon::onClientConnected(RfbClient* client)
|
||||||
|
|
||||||
void TrayIcon::onClientDisconnected(RfbClient* client)
|
void TrayIcon::onClientDisconnected(RfbClient* client)
|
||||||
{
|
{
|
||||||
kDebug();
|
|
||||||
|
|
||||||
ClientActions *actions = m_clientActions.take(client);
|
ClientActions *actions = m_clientActions.take(client);
|
||||||
delete actions;
|
delete actions;
|
||||||
|
|
||||||
|
@ -144,9 +138,10 @@ void TrayIcon::onClientDisconnected(RfbClient* client)
|
||||||
|
|
||||||
void TrayIcon::showAbout()
|
void TrayIcon::showAbout()
|
||||||
{
|
{
|
||||||
KDialog *dlg = new KAboutApplicationDialog(KGlobal::mainComponent().aboutData());
|
// TODO: Port to KF5 equivalent
|
||||||
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
|
// KDialog *dlg = new KAboutApplicationDialog(KGlobal::mainComponent().aboutData());
|
||||||
dlg->show();
|
// dlg->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
// dlg->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "trayicon.moc"
|
#include "trayicon.moc"
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#define TRAYICON_H
|
#define TRAYICON_H
|
||||||
|
|
||||||
#include <KStatusNotifierItem>
|
#include <KStatusNotifierItem>
|
||||||
#include <KToggleAction>
|
|
||||||
|
|
||||||
class KDialog;
|
class KDialog;
|
||||||
class RfbClient;
|
class RfbClient;
|
||||||
|
@ -42,7 +41,7 @@ public Q_SLOTS:
|
||||||
void showAbout();
|
void showAbout();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KAction *m_aboutAction;
|
QAction *m_aboutAction;
|
||||||
QHash<RfbClient*, ClientActions*> m_clientActions;
|
QHash<RfbClient*, ClientActions*> m_clientActions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "tubesrfbclient.h"
|
#include "tubesrfbclient.h"
|
||||||
#include "sockethelpers.h"
|
#include "sockethelpers.h"
|
||||||
|
|
||||||
#include <KDebug>
|
#include <QDebug>
|
||||||
#include <KRandom>
|
#include <KRandom>
|
||||||
|
|
||||||
#include <TelepathyQt/Debug>
|
#include <TelepathyQt/Debug>
|
||||||
|
@ -62,7 +62,7 @@ void TubesRfbServer::init()
|
||||||
TubesRfbServer::TubesRfbServer(QObject *parent)
|
TubesRfbServer::TubesRfbServer(QObject *parent)
|
||||||
: RfbServer(parent), d(new Private)
|
: RfbServer(parent), d(new Private)
|
||||||
{
|
{
|
||||||
kDebug() << "starting";
|
//qDebug() << "starting";
|
||||||
|
|
||||||
Tp::enableDebug(true);
|
Tp::enableDebug(true);
|
||||||
Tp::enableWarnings(true);
|
Tp::enableWarnings(true);
|
||||||
|
@ -156,7 +156,7 @@ TubesRfbServer::TubesRfbServer(QObject *parent)
|
||||||
|
|
||||||
TubesRfbServer::~TubesRfbServer()
|
TubesRfbServer::~TubesRfbServer()
|
||||||
{
|
{
|
||||||
kDebug();
|
//qDebug();
|
||||||
stop();
|
stop();
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ void TubesRfbServer::startAndCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
kError() << "Failed to start tubes rfb server";
|
qCritical() << "Failed to start tubes rfb server";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,12 +191,12 @@ void TubesRfbServer::startAndCheck()
|
||||||
|
|
||||||
void TubesRfbServer::onTubeRequested()
|
void TubesRfbServer::onTubeRequested()
|
||||||
{
|
{
|
||||||
kDebug() << "Got a tube";
|
//qDebug() << "Got a tube";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TubesRfbServer::onTubeClosed()
|
void TubesRfbServer::onTubeClosed()
|
||||||
{
|
{
|
||||||
kDebug() << "tube closed";
|
//qDebug() << "tube closed";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TubesRfbServer::onNewTcpConnection(const QHostAddress & sourceAddress,
|
void TubesRfbServer::onNewTcpConnection(const QHostAddress & sourceAddress,
|
||||||
|
@ -208,11 +208,11 @@ void TubesRfbServer::onNewTcpConnection(const QHostAddress & sourceAddress,
|
||||||
Q_UNUSED(account);
|
Q_UNUSED(account);
|
||||||
Q_UNUSED(tube);
|
Q_UNUSED(tube);
|
||||||
|
|
||||||
kDebug() << "CM signaled tube connection from" << sourceAddress << ":" << sourcePort;
|
//qDebug() << "CM signaled tube connection from" << sourceAddress << ":" << sourcePort;
|
||||||
|
|
||||||
d->contactsPerPort[sourcePort] = contact;
|
d->contactsPerPort[sourcePort] = contact;
|
||||||
if (d->clientsPerPort.contains(sourcePort)) {
|
if (d->clientsPerPort.contains(sourcePort)) {
|
||||||
kDebug() << "client already exists";
|
//qDebug() << "client already exists";
|
||||||
d->clientsPerPort[sourcePort]->setContact(contact);
|
d->clientsPerPort[sourcePort]->setContact(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ void TubesRfbServer::onTcpConnectionClosed(const QHostAddress& sourceAddress,
|
||||||
Q_UNUSED(contact);
|
Q_UNUSED(contact);
|
||||||
Q_UNUSED(tube);
|
Q_UNUSED(tube);
|
||||||
|
|
||||||
kDebug() << "Connection from" << sourceAddress << ":" << sourcePort << "closed."
|
//qDebug() << "Connection from" << sourceAddress << ":" << sourcePort << "closed."
|
||||||
<< error << message;
|
<< error << message;
|
||||||
|
|
||||||
d->clientsPerPort.remove(sourcePort);
|
d->clientsPerPort.remove(sourcePort);
|
||||||
|
@ -241,11 +241,11 @@ PendingRfbClient* TubesRfbServer::newClient(rfbClientPtr client)
|
||||||
PendingTubesRfbClient *c = new PendingTubesRfbClient(client, this);
|
PendingTubesRfbClient *c = new PendingTubesRfbClient(client, this);
|
||||||
quint16 port = peerPort(client->sock);
|
quint16 port = peerPort(client->sock);
|
||||||
|
|
||||||
kDebug() << "new tube client on port" << port;
|
//qDebug() << "new tube client on port" << port;
|
||||||
|
|
||||||
d->clientsPerPort[port] = c;
|
d->clientsPerPort[port] = c;
|
||||||
if (d->contactsPerPort.contains(port)) {
|
if (d->contactsPerPort.contains(port)) {
|
||||||
kDebug() << "already have a contact";
|
//qDebug() << "already have a contact";
|
||||||
c->setContact(d->contactsPerPort[port]);
|
c->setContact(d->contactsPerPort[port]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user