mirror of
https://github.com/KDE/krfb
synced 2026-07-02 16:01:17 -07:00
Compare commits
299 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d04a36023a | ||
|
|
f717ae06ce | ||
|
|
4660f86dfe | ||
|
|
4a36c727c2 | ||
|
|
c1a0a4cb38 | ||
|
|
aa5bf7273c | ||
|
|
0bcaf89886 | ||
|
|
5959b4690d | ||
|
|
c5ab3aab87 | ||
|
|
5d94a58da0 | ||
|
|
e3cb606713 | ||
|
|
d533b76f9b | ||
|
|
34a0e0c361 | ||
|
|
e1fdba3014 | ||
|
|
73500f837e | ||
|
|
f9a062ffa9 | ||
|
|
a4177eac39 | ||
|
|
15068b250c | ||
|
|
326d58a439 | ||
|
|
1a7f3a8517 | ||
|
|
3625b0cee3 | ||
|
|
7ef0dce382 | ||
|
|
72270006ca | ||
|
|
938f98cef5 | ||
|
|
93eb2d78d4 | ||
|
|
f041cdf095 | ||
|
|
e1e359fa7b | ||
|
|
50b72f26a8 | ||
|
|
2c184a22bf | ||
|
|
bb35068a1d | ||
|
|
706d4853b2 | ||
|
|
f03b829814 | ||
|
|
4335f83dab | ||
|
|
08d967af66 | ||
|
|
f0c1bc787e | ||
|
|
230040c5a9 | ||
|
|
dad7f0184b | ||
|
|
74070d3baa | ||
|
|
cceab8c12a | ||
|
|
b5a328b905 | ||
|
|
513b717fac | ||
|
|
a5f3009530 | ||
|
|
2b1f48b92a | ||
|
|
617f237d4e | ||
|
|
dcc1bb2de5 | ||
|
|
14aa98ccca | ||
|
|
717607b1c6 | ||
|
|
4e0aa9c78b | ||
|
|
e34043d514 | ||
|
|
8010c34bf1 | ||
|
|
5610c0a292 | ||
|
|
280c852a4e | ||
|
|
6518c17362 | ||
|
|
fcad3620db | ||
|
|
de7050d8b7 | ||
|
|
60c5d93f20 | ||
|
|
3a83ce6279 | ||
|
|
a109e3d6c9 | ||
|
|
4993e65d59 | ||
|
|
d91bbdcb05 | ||
|
|
1d429a9bc6 | ||
|
|
2b9cb5c58c | ||
|
|
6d9226c8d9 | ||
|
|
f67f629899 | ||
|
|
0e3733c327 | ||
|
|
fd362fd642 | ||
|
|
b14b7cc3a8 | ||
|
|
b71652061a | ||
|
|
9d02f073bd | ||
|
|
05f36df893 | ||
|
|
251d8f2e0e | ||
|
|
5aa1acd96b | ||
|
|
da2f51de6a | ||
|
|
47fbb3f316 | ||
|
|
7ba81f52df | ||
|
|
b9efda5956 | ||
|
|
f83d5102b6 | ||
|
|
8afd5c8df2 | ||
|
|
ef6b3a6093 | ||
|
|
9e1680d122 | ||
|
|
f3587b224f | ||
|
|
d4175c0f22 | ||
|
|
481972a129 | ||
|
|
e432a4ee7c | ||
|
|
f5768411e6 | ||
|
|
c5d6abab58 | ||
|
|
c5e157fa82 | ||
|
|
3e00ff22f9 | ||
|
|
068ce93465 | ||
|
|
9bb6fd224b | ||
|
|
024ce87b3a | ||
|
|
97951fc296 | ||
|
|
52fded8831 | ||
|
|
740f5c1449 | ||
|
|
1e9a91e83e | ||
|
|
933169b4c0 | ||
|
|
6f58476dbe | ||
|
|
f839da9ba2 | ||
|
|
76c2f08c9e | ||
|
|
b135370c5c | ||
|
|
b5adcd23c6 | ||
|
|
13f5de2518 | ||
|
|
cb83a9d539 | ||
|
|
c4f012a919 | ||
|
|
04c3f3e01e | ||
|
|
0cdc848844 | ||
|
|
e2daae290b | ||
|
|
c73c58b55d | ||
|
|
d983ed6869 | ||
|
|
b948d90c84 | ||
|
|
287919dbe2 | ||
|
|
b561ec1415 | ||
|
|
04d050a685 | ||
|
|
4f3e2f8bd9 | ||
|
|
f284736978 | ||
|
|
bdb4e9efbf | ||
|
|
425783b825 | ||
|
|
3cc2af7e18 | ||
|
|
49add727b0 | ||
|
|
10923d2e01 | ||
|
|
ebbedab547 | ||
|
|
e824ea5534 | ||
|
|
3462004357 | ||
|
|
d57a7e5aef | ||
|
|
60f8a418cd | ||
|
|
ed56b1b8f7 | ||
|
|
3f0f6e9efb | ||
|
|
3e2a8b0ce2 | ||
|
|
f178121c54 | ||
|
|
3f5dabf76b | ||
|
|
bb403a310f | ||
|
|
f32dde2af7 | ||
|
|
4e6062e9af | ||
|
|
8ea2ca9afb | ||
|
|
081d1222b6 | ||
|
|
55d749ce9a | ||
|
|
07b48fe44f | ||
|
|
1da8e3c84a | ||
|
|
92c9905f36 | ||
|
|
a62ef07e9d | ||
|
|
a20cc6963a | ||
|
|
024f02a70f | ||
|
|
f473c88aff | ||
|
|
4acb23aa5e | ||
|
|
f162574aba | ||
|
|
5f53df2e76 | ||
|
|
ba87204070 | ||
|
|
8df008137a | ||
|
|
9b422f1338 | ||
|
|
92b6f2fe68 | ||
|
|
bb59ce2776 | ||
|
|
6c78a2f98d | ||
|
|
8a7965fa6f | ||
|
|
c136ef0681 | ||
|
|
afc1fb6b88 | ||
|
|
e4362a655e | ||
|
|
e2ebae3b19 | ||
|
|
f3648d11a3 | ||
|
|
e897ce9b49 | ||
|
|
8ff1f8fb21 | ||
|
|
f139985c99 | ||
|
|
45d4a9cad7 | ||
|
|
dd7f1af0bc | ||
|
|
b8861cd229 | ||
|
|
80db244c7d | ||
|
|
439bacb527 | ||
|
|
28f2cca952 | ||
|
|
f2b1e60106 | ||
|
|
08c8bd84b1 | ||
|
|
7a42bd3b65 | ||
|
|
7190908aa3 | ||
|
|
28fbf6c89c | ||
|
|
853eeaa050 | ||
|
|
8848a11ba4 | ||
|
|
0234025013 | ||
|
|
5498ce6390 | ||
|
|
46560f2f6a | ||
|
|
1c8afa165b | ||
|
|
4ffe2ce140 | ||
|
|
e472644e10 | ||
|
|
1a23694b32 | ||
|
|
210b1cfac9 | ||
|
|
49c9dc2311 | ||
|
|
1b5daefe54 | ||
|
|
62be4e43fd | ||
|
|
1190610710 | ||
|
|
69c492a54b | ||
|
|
06d711dd79 | ||
|
|
f417d230d7 | ||
|
|
6b7a17a327 | ||
|
|
13f6082465 | ||
|
|
0c1aaa62c1 | ||
|
|
826904c4ca | ||
|
|
eb1b74d90b | ||
|
|
fad81c061a | ||
|
|
a360e5c8ae | ||
|
|
9e9acb4833 | ||
|
|
d22dca0833 | ||
|
|
b0712e1874 | ||
|
|
142a652b25 | ||
|
|
87ad1774a2 | ||
|
|
388aa12a96 | ||
|
|
ed9fe37985 | ||
|
|
bd9e576684 | ||
|
|
bfeba242ea | ||
|
|
be4ec5fe7a | ||
|
|
8e51ddfb45 | ||
|
|
445cb49e16 | ||
|
|
a4c4dd29a5 | ||
|
|
078a05e368 | ||
|
|
f1ec721e47 | ||
|
|
f8e02290a3 | ||
|
|
0e5ac2d9aa | ||
|
|
9828143609 | ||
|
|
0cc47b9a06 | ||
|
|
656c90916c | ||
|
|
296f5db567 | ||
|
|
e15c5d634d | ||
|
|
22b017e0b0 | ||
|
|
05b96c0bd0 | ||
|
|
fa7c32fbb9 | ||
|
|
acf4f7393e | ||
|
|
43aeee4c3e | ||
|
|
aab2869883 | ||
|
|
306a094540 | ||
|
|
a774e678bb | ||
|
|
718b0ac000 | ||
|
|
4230b2234b | ||
|
|
f5467f826c | ||
|
|
0a0a7f096a | ||
|
|
94ea33aaa4 | ||
|
|
3f471e6fd1 | ||
|
|
e018e1a7c5 | ||
|
|
576cef1a12 | ||
|
|
77f5ae8230 | ||
|
|
c05707884c | ||
|
|
7624aee8e2 | ||
|
|
6ecb4248b8 | ||
|
|
61cedda6b3 | ||
|
|
895ec578c6 | ||
|
|
aa189daffd | ||
|
|
9797ff196e | ||
|
|
7519e7918c | ||
|
|
6ef393ba1c | ||
|
|
c47ee269f0 | ||
|
|
a0992f7fea | ||
|
|
ef6491a5c9 | ||
|
|
63d6314b1b | ||
|
|
78ed74ec1e | ||
|
|
1cf5785007 | ||
|
|
0f506011d0 | ||
|
|
d5aff98912 | ||
|
|
d77506c4c2 | ||
|
|
c3d0313280 | ||
|
|
1fc7238699 | ||
|
|
e4a82e3a52 | ||
|
|
c57e9bc5f4 | ||
|
|
2916395ea9 | ||
|
|
3c63cf9563 | ||
|
|
554f2994cc | ||
|
|
313b4bbc67 | ||
|
|
ff5ae6a885 | ||
|
|
f8dfbee9ed | ||
|
|
d6bc236426 | ||
|
|
015518cb9f | ||
|
|
b2fcfeb7f5 | ||
|
|
77c6c35d3e | ||
|
|
d7380a93a3 | ||
|
|
8df92c41c4 | ||
|
|
546a588c18 | ||
|
|
e4fed2991a | ||
|
|
349b99ab47 | ||
|
|
927016cd85 | ||
|
|
abd7bf04ae | ||
|
|
8d19229593 | ||
|
|
c8e4869c8a | ||
|
|
91c62af9bd | ||
|
|
bb9bf0bfc7 | ||
|
|
258e8bd22b | ||
|
|
c5fc5fc68e | ||
|
|
54fd606e82 | ||
|
|
9d44beac84 | ||
|
|
438bddcb27 | ||
|
|
68dafe3f24 | ||
|
|
d1273a8f56 | ||
|
|
6373c44b8d | ||
|
|
6368bdf25b | ||
|
|
b72e478df0 | ||
|
|
b1df09d2bf | ||
|
|
da36f0a7fb | ||
|
|
be70800a74 | ||
|
|
798fc5c2e6 | ||
|
|
26a70c411a | ||
|
|
0945680770 | ||
|
|
39a99107ce | ||
|
|
fc3e3951a4 | ||
|
|
6fc934b0ef | ||
|
|
788d64927d | ||
|
|
d0b0740066 |
@@ -1,20 +1,18 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
# KDE Application Version, managed by release script
|
||||
set (KDE_APPLICATIONS_VERSION_MAJOR "18")
|
||||
set (KDE_APPLICATIONS_VERSION_MINOR "03")
|
||||
set (KDE_APPLICATIONS_VERSION_MICRO "70")
|
||||
set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
|
||||
set (RELEASE_SERVICE_VERSION_MAJOR "21")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "04")
|
||||
set (RELEASE_SERVICE_VERSION_MICRO "2")
|
||||
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
|
||||
|
||||
project(krfb VERSION ${KDE_APPLICATIONS_VERSION})
|
||||
project(krfb VERSION ${RELEASE_SERVICE_VERSION})
|
||||
|
||||
set(QT_MIN_VERSION 5.6.0)
|
||||
set(KF5_MIN_VERSION 5.31.0)
|
||||
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core DBus Widgets X11Extras)
|
||||
set(QT_MIN_VERSION 5.12.0)
|
||||
set(KF5_MIN_VERSION 5.68.0)
|
||||
|
||||
find_package(ECM ${KF5_MIN_VERSION} NO_MODULE REQUIRED)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${ECM_MODULE_PATH})
|
||||
|
||||
include(KDEInstallDirs)
|
||||
include(KDECMakeSettings)
|
||||
@@ -22,15 +20,16 @@ include(KDECompilerSettings NO_POLICY_SCOPE)
|
||||
include(ECMInstallIcons)
|
||||
include(ECMAddAppIcon)
|
||||
include(ECMSetupVersion)
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
include(FeatureSummary)
|
||||
include(CheckIncludeFile)
|
||||
|
||||
ecm_setup_version(PROJECT
|
||||
VARIABLE_PREFIX KRFB
|
||||
VERSION_HEADER "krfb_version.h")
|
||||
check_include_file("linux/input.h" HAVE_LINUX_INPUT_H)
|
||||
|
||||
find_package(KF5 REQUIRED COMPONENTS
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core DBus Widgets X11Extras)
|
||||
|
||||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
|
||||
I18n
|
||||
Completion
|
||||
Config
|
||||
CoreAddons
|
||||
Crash
|
||||
@@ -40,6 +39,7 @@ find_package(KF5 REQUIRED COMPONENTS
|
||||
Notifications
|
||||
Wallet
|
||||
WidgetsAddons
|
||||
WindowSystem
|
||||
XmlGui
|
||||
)
|
||||
|
||||
@@ -60,17 +60,32 @@ if(WIN32)
|
||||
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(CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
|
||||
${CMAKE_MODULE_PATH}
|
||||
add_definitions(
|
||||
-DQT_DEPRECATED_WARNINGS
|
||||
-DQT_DISABLE_DEPRECATED_BEFORE=0x050600
|
||||
-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
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} )
|
||||
|
||||
find_package(LibVNCServer REQUIRED)
|
||||
|
||||
find_package(PipeWire)
|
||||
set_package_properties(PipeWire PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required for pipewire screencast plugin"
|
||||
)
|
||||
|
||||
ecm_setup_version(PROJECT
|
||||
VARIABLE_PREFIX KRFB
|
||||
VERSION_HEADER "krfb_version.h")
|
||||
|
||||
include_directories ("${CMAKE_CURRENT_BINARY_DIR}/krfb"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/krfb"
|
||||
@@ -79,13 +94,20 @@ include_directories ("${CMAKE_CURRENT_BINARY_DIR}/krfb"
|
||||
|
||||
if(Q_WS_X11)
|
||||
if(NOT X11_XTest_FOUND)
|
||||
message(FATAL_ERROR "krfb requires the libXtst (http://xorg.freedesktop.org) to be built")
|
||||
message(FATAL_ERROR "krfb requires the libXtst (https://xorg.freedesktop.org) to be built")
|
||||
endif(NOT X11_XTest_FOUND)
|
||||
endif(Q_WS_X11)
|
||||
|
||||
add_subdirectory(events)
|
||||
add_subdirectory(krfb)
|
||||
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)
|
||||
|
||||
@@ -38,4 +38,4 @@ ELSE (LIBVNCSERVER_FOUND)
|
||||
ENDIF (LIBVNCSERVER_FIND_REQUIRED)
|
||||
ENDIF (LIBVNCSERVER_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(LIBVNCSERVER_INCLUDE_DIR LIBVNCSERVER_LIBRARIES)
|
||||
MARK_AS_ADVANCED(LIBVNCSERVER_INCLUDE_DIR LIBVNCSERVER_LIBRARIES)
|
||||
|
||||
122
cmake/modules/FindPipeWire.cmake
Normal file
122
cmake/modules/FindPipeWire.cmake
Normal file
@@ -0,0 +1,122 @@
|
||||
#.rst:
|
||||
# FindPipeWire
|
||||
# -------
|
||||
#
|
||||
# Try to find PipeWire on a Unix system.
|
||||
#
|
||||
# This will define the following variables:
|
||||
#
|
||||
# ``PipeWire_FOUND``
|
||||
# True if (the requested version of) PipeWire is available
|
||||
# ``PipeWire_VERSION``
|
||||
# The version of PipeWire
|
||||
# ``PipeWire_LIBRARIES``
|
||||
# This can be passed to target_link_libraries() instead of the ``PipeWire::PipeWire``
|
||||
# target
|
||||
# ``PipeWire_INCLUDE_DIRS``
|
||||
# This should be passed to target_include_directories() if the target is not
|
||||
# used for linking
|
||||
# ``PipeWire_DEFINITIONS``
|
||||
# This should be passed to target_compile_options() if the target is not
|
||||
# used for linking
|
||||
#
|
||||
# If ``PipeWire_FOUND`` is TRUE, it will also define the following imported target:
|
||||
#
|
||||
# ``PipeWire::PipeWire``
|
||||
# The PipeWire library
|
||||
#
|
||||
# In general we recommend using the imported target, as it is easier to use.
|
||||
# Bear in mind, however, that if the target is in the link interface of an
|
||||
# exported library, it must be made available by the package config file.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2014 Alex Merry <alex.merry@kde.org>
|
||||
# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
# Copyright 2018-2020 Jan Grulich <jgrulich@redhat.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
# Use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
pkg_search_module(PKG_PipeWire QUIET libpipewire-0.3 libpipewire-0.2)
|
||||
pkg_search_module(PKG_Spa QUIET libspa-0.2 libspa-0.1)
|
||||
|
||||
set(PipeWire_DEFINITIONS "${PKG_PipeWire_CFLAGS}" "${PKG_Spa_CFLAGS}")
|
||||
set(PipeWire_VERSION "${PKG_PipeWire_VERSION}")
|
||||
|
||||
find_path(PipeWire_INCLUDE_DIRS
|
||||
NAMES
|
||||
pipewire/pipewire.h
|
||||
HINTS
|
||||
${PKG_PipeWire_INCLUDE_DIRS}
|
||||
${PKG_PipeWire_INCLUDE_DIRS}/pipewire-0.3
|
||||
)
|
||||
|
||||
find_path(Spa_INCLUDE_DIRS
|
||||
NAMES
|
||||
spa/param/props.h
|
||||
HINTS
|
||||
${PKG_Spa_INCLUDE_DIRS}
|
||||
${PKG_Spa_INCLUDE_DIRS}/spa-0.2
|
||||
)
|
||||
|
||||
find_library(PipeWire_LIBRARIES
|
||||
NAMES
|
||||
pipewire-0.3
|
||||
pipewire-0.2
|
||||
HINTS
|
||||
${PKG_PipeWire_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PipeWire
|
||||
FOUND_VAR
|
||||
PipeWire_FOUND
|
||||
REQUIRED_VARS
|
||||
PipeWire_LIBRARIES
|
||||
PipeWire_INCLUDE_DIRS
|
||||
Spa_INCLUDE_DIRS
|
||||
VERSION_VAR
|
||||
PipeWire_VERSION
|
||||
)
|
||||
|
||||
if(PipeWire_FOUND AND NOT TARGET PipeWire::PipeWire)
|
||||
add_library(PipeWire::PipeWire UNKNOWN IMPORTED)
|
||||
set_target_properties(PipeWire::PipeWire PROPERTIES
|
||||
IMPORTED_LOCATION "${PipeWire_LIBRARIES}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PipeWire_DEFINITIONS}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PipeWire_INCLUDE_DIRS};${Spa_INCLUDE_DIRS}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(PipeWire_LIBRARIES PipeWire_INCLUDE_DIRS)
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(PipeWire PROPERTIES
|
||||
URL "https://www.pipewire.org"
|
||||
DESCRIPTION "PipeWire - multimedia processing"
|
||||
)
|
||||
374
dbus/xdp_dbus_remotedesktop_interface.xml
Normal file
374
dbus/xdp_dbus_remotedesktop_interface.xml
Normal file
@@ -0,0 +1,374 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Copyright (C) 2017-2018 Red Hat, Inc.
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
|
||||
<!--
|
||||
org.freedesktop.portal.RemoteDesktop:
|
||||
@short_description: Remote desktop portal
|
||||
The Remote desktop portal allows to create remote desktop sessions.
|
||||
This documentation describes version 1 of this interface.
|
||||
-->
|
||||
<interface name="org.freedesktop.portal.RemoteDesktop">
|
||||
<!--
|
||||
CreateSession:
|
||||
@options: Vardict with optional further information
|
||||
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
||||
Create a remote desktop session.
|
||||
A remote desktop session is used to allow remote controlling a desktop
|
||||
session. It can also be used together with a screen cast session (see
|
||||
org.freedesktop.portal.ScreenCast), but may only be started and stopped
|
||||
with this interface.
|
||||
To also get a screen content, call the
|
||||
#org.freedesktop.ScreenCast.SelectSources with the
|
||||
#org.freedesktop.Session object created with this method.
|
||||
Supported keys in the @options vardict include:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>handle_token s</term>
|
||||
<listitem><para>
|
||||
A string that will be used as the last element of the @handle. Must be a valid
|
||||
object path element. See the #org.freedesktop.portal.Request documentation for
|
||||
more information about the @handle.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>session_handle_token s</term>
|
||||
<listitem><para>
|
||||
A string that will be used as the last element of the session handle. Must be a valid
|
||||
object path element. See the #org.freedesktop.portal.Session documentation for
|
||||
more information about the session handle.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
The following results get returned via the #org.freedesktop.portal.Request::Response signal:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>session_handle o</term>
|
||||
<listitem><para>
|
||||
The session handle. An object path for the
|
||||
#org.freedesktop.portal.Session object representing the created
|
||||
session.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
-->
|
||||
<method name="CreateSession">
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
|
||||
<arg type="o" name="handle" direction="out"/>
|
||||
</method>
|
||||
<!--
|
||||
SelectDevices:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
||||
Select input devices to remote control.
|
||||
Supported keys in the @options vardict include:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>handle_token s</term>
|
||||
<listitem><para>
|
||||
A string that will be used as the last element of the @handle. Must be a valid
|
||||
object path element. See the #org.freedesktop.portal.Request documentation for
|
||||
more information about the @handle.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>type u</term>
|
||||
<listitem><para>
|
||||
Bitmask of what device types to request remote controlling of.
|
||||
Default is all.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
For available source types, see the AvailableDeviceTypes property.
|
||||
-->
|
||||
<method name="SelectDevices">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="o" name="handle" direction="out"/>
|
||||
</method>
|
||||
<!--
|
||||
Start:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@parent_window: Identifier for the application window, see <link linkend="parent_window">Common Conventions</link>
|
||||
@options: Vardict with optional further information
|
||||
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
||||
Start the remote desktop session. This will typically result in the portal
|
||||
presenting a dialog letting the user select what to share, including
|
||||
devices and optionally screen content if screen cast sources was
|
||||
selected.
|
||||
Supported keys in the @options vardict include:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>handle_token s</term>
|
||||
<listitem><para>
|
||||
A string that will be used as the last element of the @handle. Must be a valid
|
||||
object path element. See the #org.freedesktop.portal.Request documentation for
|
||||
more information about the @handle.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
The following results get returned via the
|
||||
#org.freedesktop.portal.Request::Response signal:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>devices u</term>
|
||||
<listitem><para>
|
||||
A bitmask of the devices selected by the user.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
If a screen cast source was selected, the results of the
|
||||
#org.freedesktop.portal.ScreenCast.Start response signal may be
|
||||
included.
|
||||
-->
|
||||
<method name="Start">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="s" name="parent_window" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
|
||||
<arg type="o" name="handle" direction="out"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyPointerMotion:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@dx: Relative movement on the x axis
|
||||
@dy: Relative movement on the y axis
|
||||
Notify about a new relative pointer motion event. The (dx, dy) vector
|
||||
represents the new pointer position in the streams logical coordinate
|
||||
space.
|
||||
-->
|
||||
<method name="NotifyPointerMotion">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="d" name="dx" direction="in"/>
|
||||
<arg type="d" name="dy" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyPointerMotionAbsolute:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@stream: The PipeWire stream node the coordinate is relative to
|
||||
@x: Pointer motion x coordinate
|
||||
@y: Pointer motion y coordinate
|
||||
Notify about a new absolute pointer motion event. The (x, y) position
|
||||
represents the new pointer position in the streams logical coordinate
|
||||
space (see the logical_size stream property in
|
||||
#org.freedesktop.portal.ScreenCast).
|
||||
-->
|
||||
<method name="NotifyPointerMotionAbsolute">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="u" name="stream" direction="in"/>
|
||||
<arg type="d" name="x" direction="in"/>
|
||||
<arg type="d" name="y" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyPointerButton:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@button: The pointer button was pressed or released
|
||||
@state: The new state of the button
|
||||
The pointer button is encoded according to Linux Evdev button codes.
|
||||
May only be called if POINTER access was provided after starting the
|
||||
session.
|
||||
Available button states:
|
||||
<simplelist>
|
||||
<member>0: Released</member>
|
||||
<member>1: Pressed</member>
|
||||
</simplelist>
|
||||
-->
|
||||
<method name="NotifyPointerButton">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="i" name="button" direction="in"/>
|
||||
<arg type="u" name="state" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyPointerAxis:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@dx: Relative axis movement on the x axis
|
||||
@dy: Relative axis movement on the y axis
|
||||
The axis movement from a 'smooth scroll' device, such as a touchpad.
|
||||
When applicable, the size of the motion delta should be equivalent to
|
||||
the motion vector of a pointer motion done using the same advice.
|
||||
May only be called if POINTER access was provided after starting the
|
||||
session.
|
||||
Supported keys in the @options vardict include:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>finish b</term>
|
||||
<listitem><para>
|
||||
If set to true, this is the last axis event in a series, for
|
||||
example as a result of the fingers being lifted from a touchpad
|
||||
after a two-finger scroll. Default is false.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
-->
|
||||
<method name="NotifyPointerAxis">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="d" name="dx" direction="in"/>
|
||||
<arg type="d" name="dy" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyPointerAxisDiscrete:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@axis: The axis that was scrolled
|
||||
@steps: The number of steps scrolled
|
||||
May only be called if POINTER access was provided after starting the
|
||||
session.
|
||||
Available axes:
|
||||
<simplelist>
|
||||
<member>0: Vertical scroll</member>
|
||||
<member>1: Horizontal scroll</member>
|
||||
</simplelist>
|
||||
-->
|
||||
<method name="NotifyPointerAxisDiscrete">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="u" name="axis" direction="in"/>
|
||||
<arg type="i" name="steps" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyKeyboardKeycode:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@keycode: Keyboard code that was pressed or released
|
||||
@state: New state of keyboard keysym
|
||||
May only be called if KEYBOARD access was provided after starting the
|
||||
session.
|
||||
Available keyboard keysym states:
|
||||
<simplelist>
|
||||
<member>0: Released</member>
|
||||
<member>1: Pressed</member>
|
||||
</simplelist>
|
||||
-->
|
||||
<method name="NotifyKeyboardKeycode">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="i" name="keycode" direction="in"/>
|
||||
<arg type="u" name="state" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyKeyboardKeysym:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@keysym: Keyboard symbol that was pressed or released
|
||||
@state: New state of keyboard keysym
|
||||
May only be called if KEYBOARD access was provided after starting the
|
||||
session.
|
||||
Available keyboard keysym states:
|
||||
<simplelist>
|
||||
<member>0: Released</member>
|
||||
<member>1: Pressed</member>
|
||||
</simplelist>
|
||||
-->
|
||||
<method name="NotifyKeyboardKeysym">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="i" name="keysym" direction="in"/>
|
||||
<arg type="u" name="state" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyTouchDown:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@stream: The PipeWire stream node the coordinate is relative to
|
||||
@slot: Touch slot where touch point appeared
|
||||
@x: Touch down x coordinate
|
||||
@y: Touch down y coordinate
|
||||
May only be called if TOUCHSCREEN access was provided after starting the
|
||||
session.
|
||||
Notify about a new touch down event. The (x, y) position
|
||||
represents the new touch point position in the streams logical
|
||||
coordinate space (see the logical_size stream property in
|
||||
#org.freedesktop.portal.ScreenCast).
|
||||
-->
|
||||
<method name="NotifyTouchDown">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="u" name="stream" direction="in"/>
|
||||
<arg type="u" name="slot" direction="in"/>
|
||||
<arg type="d" name="x" direction="in"/>
|
||||
<arg type="d" name="y" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyTouchMotion:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@stream: The PipeWire stream node the coordinate is relative to
|
||||
@slot: Touch slot where touch point appeared
|
||||
@x: Touch motion x coordinate
|
||||
@y: Touch motion y coordinate
|
||||
May only be called if TOUCHSCREEN access was provided after starting the
|
||||
session.
|
||||
Notify about a new touch motion event. The (x, y) position
|
||||
represents where the touch point position in the streams logical
|
||||
coordinate space moved (see the logical_size stream property in
|
||||
#org.freedesktop.portal.ScreenCast).
|
||||
-->
|
||||
<method name="NotifyTouchMotion">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="u" name="stream" direction="in"/>
|
||||
<arg type="u" name="slot" direction="in"/>
|
||||
<arg type="d" name="x" direction="in"/>
|
||||
<arg type="d" name="y" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
NotifyTouchUp:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@slot: Touch slot where touch point appeared
|
||||
May only be called if TOUCHSCREEN access was provided after starting the
|
||||
session.
|
||||
Notify about a new touch up event.
|
||||
-->
|
||||
<method name="NotifyTouchUp">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="u" name="slot" direction="in"/>
|
||||
</method>
|
||||
<!--
|
||||
AvailableDeviceTypes:
|
||||
A bitmask of available source types. Currently defined types are:
|
||||
<simplelist>
|
||||
<member>1: KEYBOARD</member>
|
||||
<member>2: POINTER</member>
|
||||
<member>4: TOUCHSCREEN</member>
|
||||
</simplelist>
|
||||
-->
|
||||
<property name="AvailableDeviceTypes" type="u" access="read"/>
|
||||
<property name="version" type="u" access="read"/>
|
||||
</interface>
|
||||
</node>
|
||||
186
dbus/xdp_dbus_screencast_interface.xml
Normal file
186
dbus/xdp_dbus_screencast_interface.xml
Normal file
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Copyright (C) 2017-2018 Red Hat, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
|
||||
<!--
|
||||
org.freedesktop.portal.ScreenCast:
|
||||
@short_description: Screen cast portal
|
||||
-->
|
||||
<interface name="org.freedesktop.portal.ScreenCast">
|
||||
<!--
|
||||
CreateSession:
|
||||
@options: Vardict with optional further information
|
||||
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
||||
|
||||
Create a screen cast session. A successfully created session can at
|
||||
any time be closed using org.freedesktop.portal.Session::Close, or may
|
||||
at any time be closed by the portal implementation, which will be
|
||||
signalled via org.freedesktop.portal.Session::Closed.
|
||||
|
||||
The following results get returned via the #org.freedesktop.portal.Request::Response signal:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>session_handle o</term>
|
||||
<listitem><para>
|
||||
The session handle. An object path for the
|
||||
#org.freedesktop.portal.Session object representing the created
|
||||
session.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
-->
|
||||
<method name="CreateSession">
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
|
||||
<arg type="o" name="handle" direction="out"/>
|
||||
</method>
|
||||
<!--
|
||||
SelectSources:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
||||
|
||||
Configure what the screen cast session should record. This method must
|
||||
be called before starting the session.
|
||||
|
||||
Passing invalid input to this method will cause the session to be
|
||||
closed. An application may only attempt to select sources once per
|
||||
session.
|
||||
|
||||
Supported keys in the @options vardict include:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>types u</term>
|
||||
<listitem><para>
|
||||
Bitmask of what types of content to record. Default is MONITOR.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>multiple b</term>
|
||||
<listitem><para>
|
||||
Whether to allow selecting multiple sources. Default is no.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
For available source types, see the AvailableSourceTypes property.
|
||||
-->
|
||||
<method name="SelectSources">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="o" name="handle" direction="out"/>
|
||||
</method>
|
||||
<!--
|
||||
Start:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@parent_window: Identifier for the application window
|
||||
@options: Vardict with optional further information
|
||||
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
||||
|
||||
Start the screen cast session. This will typically result the portal
|
||||
presenting a dialog letting the user do the selection set up by
|
||||
SelectSources. An application can only attempt start a session once.
|
||||
|
||||
A screen cast session may only be started after having selected sources
|
||||
using org.freedesktop.portal.ScreenCast::SelectSources.
|
||||
|
||||
The @parent_window identifier must be of the form "x11:$XID" for an X11
|
||||
window. Support for other window systems may be added in the future.
|
||||
|
||||
The following results get returned via the
|
||||
#org.freedesktop.portal.Request::Response signal:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>streams a(ua{sv})</term>
|
||||
<listitem><para>
|
||||
An array of PipeWire streams. Each stream consists of a PipeWire
|
||||
node ID (the first element in the tuple, and a Vardict of
|
||||
properties.
|
||||
|
||||
The array will contain a single stream if 'multiple' (see
|
||||
SelectSources) was set to 'false', or at least one stream if
|
||||
'multiple' was set to 'true' as part of the SelectSources method.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
Stream properties include:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>position (ii)</term>
|
||||
<listitem><para>
|
||||
A tuple consisting of the position (x, y) in the compositor
|
||||
coordinate space. Note that the position may not be equivalent to a
|
||||
position in a pixel coordinate space. Only available for monitor
|
||||
streams.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>size (ii)</term>
|
||||
<listitem><para>
|
||||
A tuple consisting of (width, height). The size represents the size
|
||||
of the stream as it is displayed in the compositor coordinate
|
||||
space. Note that this size may not be equivalent to a size in a
|
||||
pixel coordinate space. The size may differ from the size of the
|
||||
stream.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
-->
|
||||
<method name="Start">
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="s" name="parent_window" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
|
||||
<arg type="o" name="handle" direction="out"/>
|
||||
</method>
|
||||
<!--
|
||||
OpenPipeWireRemote:
|
||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||
@options: Vardict with optional further information
|
||||
@fd: File descriptor of an open PipeWire remote.
|
||||
|
||||
Open a file descriptor to the PipeWire remote where the screen cast
|
||||
streams are available. The file descriptor should be used to create a
|
||||
<classname>pw_remote</classname> object, by using
|
||||
<function>pw_remote_connect_fd</function>. Only the screen cast stream
|
||||
nodes will be available from this PipeWire node.
|
||||
-->
|
||||
<method name="OpenPipeWireRemote">
|
||||
<annotation name="org.gtk.GDBus.C.Name" value="open_pipewire_remote"/>
|
||||
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
|
||||
<arg type="o" name="session_handle" direction="in"/>
|
||||
<arg type="a{sv}" name="options" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||
<arg type="h" name="fd" direction="out"/>
|
||||
</method>
|
||||
<!--
|
||||
AvailableSourceTypes:
|
||||
|
||||
A bitmask of available source types. Currently defined types are:
|
||||
|
||||
<simplelist>
|
||||
<member>1: MONITOR</member>
|
||||
<member>2: WINDOW</member>
|
||||
</simplelist>
|
||||
-->
|
||||
<property name="AvailableSourceTypes" type="u" access="read"/>
|
||||
<property name="version" type="u" access="read"/>
|
||||
</interface>
|
||||
</node>
|
||||
@@ -1,2 +1,2 @@
|
||||
########### install files ###############
|
||||
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR krfb)
|
||||
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR krfb)
|
||||
|
||||
@@ -73,7 +73,7 @@ to help you perform a task.
|
||||
<para>
|
||||
Please report any problems or feature requests to the &kde; mailing
|
||||
lists or file a bug at <ulink
|
||||
url="http://bugs.kde.org">http://bugs.kde.org</ulink>.
|
||||
url="https://bugs.kde.org">https://bugs.kde.org</ulink>.
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
|
||||
6
events/CMakeLists.txt
Normal file
6
events/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
add_subdirectory(x11)
|
||||
|
||||
# Makes sense to use only when PW framebuffer is used
|
||||
if (${PipeWire_FOUND})
|
||||
add_subdirectory(xdp)
|
||||
endif()
|
||||
18
events/x11/CMakeLists.txt
Normal file
18
events/x11/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
include_directories (${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
set (krfb_events_x11_SRCS
|
||||
x11events.cpp
|
||||
x11eventsplugin.cpp
|
||||
)
|
||||
|
||||
add_library (krfb_events_x11 MODULE ${krfb_events_x11_SRCS})
|
||||
|
||||
target_link_libraries (krfb_events_x11
|
||||
${X11_XTest_LIB}
|
||||
KF5::CoreAddons
|
||||
krfbprivate
|
||||
)
|
||||
|
||||
install (TARGETS krfb_events_x11 DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb)
|
||||
67
events/x11/krfb_events_x11.desktop
Normal file
67
events/x11/krfb_events_x11.desktop
Normal file
@@ -0,0 +1,67 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Comment=X11 XFakeInput based event handler for KRfb
|
||||
Comment[ca]=Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb
|
||||
Comment[ca@valencia]=Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb
|
||||
Comment[da]=X11 XFakeInput baseret hændelseshåndtering til KRfb
|
||||
Comment[de]=Ereignis-Modul basierend auf X11 XFakeInput für KRfb
|
||||
Comment[el]=Χειριστής γεγονότων με βάση το X11 XFakeInput για το KRfb
|
||||
Comment[en_GB]=X11 XFakeInput based event handler for KRfb
|
||||
Comment[es]=Gestor de eventos basado en XFakeInput de X11 para KRfb
|
||||
Comment[et]=KRfb X11 XFakeInput'i põhine sündmuste käitleja
|
||||
Comment[eu]=KRfb-rako «X11 XFakeInput»en oinarritutako gertaera maneiatzailea
|
||||
Comment[fi]=KRfb:n X11 XFakeInput -pohjainen tapahtumakäsittelijä
|
||||
Comment[fr]=Gestionnaire d'évènements utilisant XFakeInput de X11 pour KRfb
|
||||
Comment[gl]=Xestor de eventos para KRfb baseado no XFakeInput de X11
|
||||
Comment[ia]=Maneator de evento de X11 basate sur XFakeInput per KRfb
|
||||
Comment[it]=Gestore eventi basato su XFakeInput di X11 per KRfb
|
||||
Comment[ko]=X11 XFakeInput 기반 KRfb 이벤트 핸들러
|
||||
Comment[nl]=Op X11 XFakeInput gebaseerde behandelaar van gebeurtenis voor KRfb
|
||||
Comment[nn]=X11 XFakeInput-basert hendingshandtering for KRfb
|
||||
Comment[pl]=Obsługa wydarzeń X11 oparta na XFakeInput dla KRfb
|
||||
Comment[pt]=Tratamento de eventos baseado no XFakeInput do X11 para o KRfb
|
||||
Comment[pt_BR]=Manipulador de eventos baseado no XFakeInput do X11 para o KRfb
|
||||
Comment[sk]=X11 Spracovateľ udalostí založený na XFakeInput pre KRfb
|
||||
Comment[sl]=Upravljalnik dogodkov za KRfb na podlagi X11 XFakeInput
|
||||
Comment[sv]=Händelsehanterare för Krfb baserad på X11 XFakeInput
|
||||
Comment[uk]=Обробник подій для KRfb на основі XFakeInput X11
|
||||
Comment[x-test]=xxX11 XFakeInput based event handler for KRfbxx
|
||||
Comment[zh_CN]=基于 X11 XFakeInput 的 KRfb 事件处理器
|
||||
Comment[zh_TW]=KRfb 基於 X11 XFakeInput 的事件處理器
|
||||
Name=X11 XFakeInput based event handler for KRfb
|
||||
Name[ca]=Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb
|
||||
Name[ca@valencia]=Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb
|
||||
Name[da]=X11 XFakeInput baseret hændelseshåndtering til KRfb
|
||||
Name[de]=Ereignis-Modul basierend auf X11 XFakeInput für KRfb
|
||||
Name[el]=Χειριστής γεγονότων με βάση το X11 XFakeInput για το KRfb
|
||||
Name[en_GB]=X11 XFakeInput based event handler for KRfb
|
||||
Name[es]=Gestor de eventos basado en XFakeInput de X11 para KRfb
|
||||
Name[et]=KRfb X11 XFakeInput'i põhine sündmuste käitleja
|
||||
Name[eu]=KRfb-rako «X11 XFakeInput»en oinarritutako gertaera maneiatzailea
|
||||
Name[fi]=KRfb:n X11 XFakeInput -pohjainen tapahtumakäsittelijä
|
||||
Name[fr]=Gestionnaire d'évènements utilisant XFakeInput de X11 pour KRfb
|
||||
Name[gl]=Xestor de eventos para KRfb baseado no XFakeInput de X11
|
||||
Name[ia]=Maneator de evento de X11 basate sur XFakeInput per KRfb
|
||||
Name[it]=Gestore eventi basato su XFakeInput di X11 per KRfb
|
||||
Name[ko]=X11 XFakeInput 기반 KRfb 이벤트 핸들러
|
||||
Name[nl]=Op X11 XFakeInput gebaseerde behandelaar van gebeurtenis voor KRfb
|
||||
Name[nn]=X11 XFakeInput-basert hendingshandtering for KRfb
|
||||
Name[pl]=Obsługa wydarzeń X11 oparta na XFakeInput dla KRfb
|
||||
Name[pt]=Tratamento de eventos baseado no XFakeInput do X11 para o KRfb
|
||||
Name[pt_BR]=Manipulador de eventos baseado no XFakeInput do X11 para o KRfb
|
||||
Name[sk]=X11 Spracovateľ udalostí založený na XFakeInput pre KRfb
|
||||
Name[sl]=Upravljalnik dogodkov za KRfb na podlagi X11 XFakeInput
|
||||
Name[sv]=Händelsehanterare för Krfb baserad på X11 XFakeInput
|
||||
Name[uk]=Обробник подій для KRfb на основі XFakeInput X11
|
||||
Name[x-test]=xxX11 XFakeInput based event handler for KRfbxx
|
||||
Name[zh_CN]=基于 X11 XFakeInput 的 KRfb 事件处理器
|
||||
Name[zh_TW]=KRfb 基於 X11 XFakeInput 的事件處理器
|
||||
Type=Service
|
||||
ServiceTypes=krfb/events
|
||||
|
||||
X-KDE-Library=krfb_events_x11
|
||||
X-KDE-PluginInfo-Name=x11
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=https://www.kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
69
events/x11/krfb_events_x11.json
Normal file
69
events/x11/krfb_events_x11.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"Encoding": "UTF-8",
|
||||
"KPlugin": {
|
||||
"Description": "X11 XFakeInput based event handler for KRfb",
|
||||
"Description[ca@valencia]": "Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb",
|
||||
"Description[ca]": "Gestor d'esdeveniments basat en «XFakeInput» de l'X11 per al KRfb",
|
||||
"Description[da]": "X11 XFakeInput baseret hændelseshåndtering til KRfb",
|
||||
"Description[de]": "Ereignis-Modul basierend auf X11 XFakeInput für KRfb",
|
||||
"Description[el]": "Χειριστής γεγονότων με βάση το X11 XFakeInput για το KRfb",
|
||||
"Description[en_GB]": "X11 XFakeInput based event handler for KRfb",
|
||||
"Description[es]": "Gestor de eventos basado en XFakeInput de X11 para KRfb",
|
||||
"Description[et]": "KRfb X11 XFakeInput'i põhine sündmuste käitleja",
|
||||
"Description[eu]": "KRfb-rako «X11 XFakeInput»en oinarritutako gertaera maneiatzailea",
|
||||
"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",
|
||||
"Description[nn]": "X11 XFakeInput-basert hendingshandtering for KRfb",
|
||||
"Description[pl]": "Obsługa wydarzeń X11 oparta na XFakeInput dla KRfb",
|
||||
"Description[pt]": "Tratamento de eventos baseado no XFakeInput do X11 para o KRfb",
|
||||
"Description[pt_BR]": "Manipulador de eventos baseado no XFakeInput do X11 para o KRfb",
|
||||
"Description[sk]": "X11 Spracovateľ udalostí založený na XFakeInput pre KRfb",
|
||||
"Description[sl]": "Upravljavec dogodkov za KRfb na osnovi X11 XFakeInput",
|
||||
"Description[sv]": "Händelsehanterare för KRfb baserad på X11 XFakeInput",
|
||||
"Description[uk]": "Обробник подій для KRfb на основі XFakeInput X11",
|
||||
"Description[x-test]": "xxX11 XFakeInput based event handler for KRfbxx",
|
||||
"Description[zh_CN]": "基于 X11 XFakeInput 的 KRfb 事件处理器",
|
||||
"Description[zh_TW]": "KRfb 基於 X11 XFakeInput 的事件處理器",
|
||||
"EnabledByDefault": true,
|
||||
"Id": "x11",
|
||||
"License": "GPL",
|
||||
"Name": "X11 Event handler for KRfb",
|
||||
"Name[ca@valencia]": "Gestor d'esdeveniments de l'X11 per al KRfb",
|
||||
"Name[ca]": "Gestor d'esdeveniments de l'X11 per al KRfb",
|
||||
"Name[da]": "X11 hændelseshåndtering til KRfb",
|
||||
"Name[de]": "Ereignis-Modul basierend auf X11 für KRfb",
|
||||
"Name[el]": "Χειριστής γεγονότων X11 για το KRfb",
|
||||
"Name[en_GB]": "X11 Event handler for KRfb",
|
||||
"Name[es]": "Gestor de eventos de X11 para KRfb",
|
||||
"Name[et]": "KRfb X11 sündmuste käitleja",
|
||||
"Name[eu]": "KRfb-rako X11 gertaera maneiatzailea",
|
||||
"Name[fi]": "KRfb:n X11-tapahtumakäsittelijä",
|
||||
"Name[fr]": "Gestionnaire d'évènements X11 pour KRfb",
|
||||
"Name[gl]": "Xestor de eventos de X11 para KRfb",
|
||||
"Name[ia]": "Manipulator de evento de X11 per KRfb",
|
||||
"Name[it]": "Gestore eventi X11 per KRfb",
|
||||
"Name[ko]": "KRfb X11 이벤트 핸들러",
|
||||
"Name[nl]": "Op X11 behandelaar van gebeurtenis voor KRfb",
|
||||
"Name[nn]": "X11-hendingshandsamar for KRfb",
|
||||
"Name[pl]": "Obsługa wydarzeń X11 dla KRfb",
|
||||
"Name[pt]": "Tratamento de eventos do X11 para o KRfb",
|
||||
"Name[pt_BR]": "Manipulador de eventos do X11 para o KRfb",
|
||||
"Name[sk]": "X11 Obsluha udalostí pre KRfb",
|
||||
"Name[sl]": "Upravljavec dogodkov za KRfb na osnovi X11",
|
||||
"Name[sv]": "X11-händelsehanterare för Krfb",
|
||||
"Name[uk]": "Обробник подій для KRfb на основі X11",
|
||||
"Name[x-test]": "xxX11 Event handler for KRfbxx",
|
||||
"Name[zh_CN]": "X11 KRfb 事件处理器",
|
||||
"Name[zh_TW]": "KRfb 的 X11 事件處理器",
|
||||
"ServiceTypes": [
|
||||
"krfb/events"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "http://www.kde.org"
|
||||
}
|
||||
}
|
||||
210
events/x11/x11events.cpp
Normal file
210
events/x11/x11events.cpp
Normal file
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2016 by Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "x11events.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QX11Info>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/extensions/XTest.h>
|
||||
|
||||
#include <QX11Info>
|
||||
|
||||
enum {
|
||||
LEFTSHIFT = 1,
|
||||
RIGHTSHIFT = 2,
|
||||
ALTGR = 4
|
||||
};
|
||||
|
||||
class EventData
|
||||
{
|
||||
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;
|
||||
|
||||
//mouse
|
||||
int buttonMask = 0;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
private:
|
||||
void init();
|
||||
};
|
||||
|
||||
Q_GLOBAL_STATIC(EventData, data)
|
||||
|
||||
EventData::EventData()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void EventData::init()
|
||||
{
|
||||
buttonMask = 0;
|
||||
|
||||
dpy = QX11Info::display();
|
||||
//initialize keycodes
|
||||
KeySym key, *keymap;
|
||||
int i, j, minkey, maxkey, syms_per_keycode;
|
||||
|
||||
memset(modifiers, -1, sizeof(modifiers));
|
||||
|
||||
XDisplayKeycodes(dpy, &minkey, &maxkey);
|
||||
Q_ASSERT(minkey >= 8);
|
||||
Q_ASSERT(maxkey < 256);
|
||||
keymap = (KeySym *) XGetKeyboardMapping(dpy, minkey,
|
||||
(maxkey - minkey + 1),
|
||||
&syms_per_keycode);
|
||||
Q_ASSERT(keymap);
|
||||
|
||||
for (i = minkey; i <= maxkey; i++) {
|
||||
for (j = 0; j < syms_per_keycode; j++) {
|
||||
key = keymap[(i-minkey)*syms_per_keycode+j];
|
||||
|
||||
if (key >= ' ' && key < 0x100 && i == XKeysymToKeycode(dpy, key)) {
|
||||
keycodes[key] = i;
|
||||
modifiers[key] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
leftShiftCode = XKeysymToKeycode(dpy, XK_Shift_L);
|
||||
rightShiftCode = XKeysymToKeycode(dpy, XK_Shift_R);
|
||||
altGrCode = XKeysymToKeycode(dpy, XK_Mode_switch);
|
||||
|
||||
XFree((char *)keymap);
|
||||
}
|
||||
|
||||
/* this function adjusts the modifiers according to mod (as from modifiers) and data->modifierState */
|
||||
static void tweakModifiers(signed char mod, bool down)
|
||||
{
|
||||
bool isShift = data->modifierState & (LEFTSHIFT | RIGHTSHIFT);
|
||||
|
||||
if (mod < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isShift && mod != 1) {
|
||||
if (data->modifierState & LEFTSHIFT) {
|
||||
XTestFakeKeyEvent(data->dpy, data->leftShiftCode,
|
||||
down, CurrentTime);
|
||||
}
|
||||
|
||||
if (data->modifierState & RIGHTSHIFT) {
|
||||
XTestFakeKeyEvent(data->dpy, data->rightShiftCode,
|
||||
down, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isShift && mod == 1) {
|
||||
XTestFakeKeyEvent(data->dpy, data->leftShiftCode,
|
||||
down, CurrentTime);
|
||||
}
|
||||
|
||||
if ((data->modifierState & ALTGR) && mod != 2) {
|
||||
XTestFakeKeyEvent(data->dpy, data->altGrCode,
|
||||
!down, CurrentTime);
|
||||
}
|
||||
|
||||
if (!(data->modifierState & ALTGR) && mod == 2) {
|
||||
XTestFakeKeyEvent(data->dpy, data->altGrCode,
|
||||
down, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
void X11EventHandler::handleKeyboard(bool down, rfbKeySym keySym)
|
||||
{
|
||||
#define ADJUSTMOD(sym,state) \
|
||||
if(keySym==sym) { if(down) data->modifierState|=state; else data->modifierState&=~state; }
|
||||
|
||||
if (QX11Info::isPlatformX11()) {
|
||||
ADJUSTMOD(XK_Shift_L, LEFTSHIFT);
|
||||
ADJUSTMOD(XK_Shift_R, RIGHTSHIFT);
|
||||
ADJUSTMOD(XK_Mode_switch, ALTGR);
|
||||
|
||||
if (keySym >= ' ' && keySym < 0x100) {
|
||||
KeyCode k;
|
||||
|
||||
if (down) {
|
||||
tweakModifiers(data->modifiers[keySym], True);
|
||||
}
|
||||
|
||||
k = data->keycodes[keySym];
|
||||
|
||||
if (k != NoSymbol) {
|
||||
XTestFakeKeyEvent(data->dpy, k, down, CurrentTime);
|
||||
}
|
||||
|
||||
if (down) {
|
||||
tweakModifiers(data->modifiers[keySym], False);
|
||||
}
|
||||
} else {
|
||||
KeyCode k = XKeysymToKeycode(data->dpy, keySym);
|
||||
|
||||
if (k != NoSymbol) {
|
||||
XTestFakeKeyEvent(data->dpy, k, down, CurrentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
// Wayland platform and pipweire plugin in use
|
||||
if (KrfbConfig::preferredFrameBufferPlugin() == QStringLiteral("pw")) {
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
void X11EventHandler::handlePointer(int buttonMask, int x, int y)
|
||||
{
|
||||
if (QX11Info::isPlatformX11()) {
|
||||
QDesktopWidget *desktopWidget = QApplication::desktop();
|
||||
|
||||
int screen = desktopWidget->screenNumber();
|
||||
|
||||
if (screen < 0) {
|
||||
screen = 0;
|
||||
}
|
||||
|
||||
XTestFakeMotionEvent(data->dpy, screen, x, y, CurrentTime);
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if ((data->buttonMask&(1 << i)) != (buttonMask&(1 << i))) {
|
||||
XTestFakeButtonEvent(data->dpy,
|
||||
i + 1,
|
||||
(buttonMask&(1 << i)) ? True : False,
|
||||
CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
data->buttonMask = buttonMask;
|
||||
}
|
||||
}
|
||||
41
events/x11/x11events.h
Normal file
41
events/x11/x11events.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2016 by Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef EVENTS_X11EVENTS_H
|
||||
#define EVENTS_X11EVENTS_H
|
||||
|
||||
#include "../../krfb/events.h"
|
||||
|
||||
class X11EventHandler : public EventHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit X11EventHandler(QObject *parent = nullptr)
|
||||
: EventHandler(parent)
|
||||
{
|
||||
};
|
||||
|
||||
void handleKeyboard(bool down, rfbKeySym key) override;
|
||||
void handlePointer(int buttonMask, int x, int y) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
45
events/x11/x11eventsplugin.cpp
Normal file
45
events/x11/x11eventsplugin.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2016 Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "x11eventsplugin.h"
|
||||
|
||||
#include "x11events.h"
|
||||
|
||||
#include <KPluginFactory>
|
||||
#include <QX11Info>
|
||||
|
||||
K_PLUGIN_FACTORY_WITH_JSON(X11EventsPluginFactory, "krfb_events_x11.json",
|
||||
registerPlugin<X11EventsPlugin>();)
|
||||
|
||||
X11EventsPlugin::X11EventsPlugin(QObject *parent, const QVariantList &args)
|
||||
: EventsPlugin(parent, args)
|
||||
{
|
||||
}
|
||||
|
||||
EventHandler *X11EventsPlugin::eventHandler()
|
||||
{
|
||||
// works only under X11
|
||||
if(!QX11Info::isPlatformX11())
|
||||
return nullptr;
|
||||
|
||||
return new X11EventHandler();
|
||||
}
|
||||
|
||||
#include "x11eventsplugin.moc"
|
||||
|
||||
43
events/x11/x11eventsplugin.h
Normal file
43
events/x11/x11eventsplugin.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2016 Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KRFB_EVENTS_X11_X11EVENTSPLUGIN_H
|
||||
#define KRFB_EVENTS_X11_X11EVENTSPLUGIN_H
|
||||
|
||||
#include "eventsplugin.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class EventHandler;
|
||||
|
||||
class X11EventsPlugin : public EventsPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
X11EventsPlugin(QObject *parent, const QVariantList &args);
|
||||
virtual ~X11EventsPlugin() = default;
|
||||
|
||||
EventHandler *eventHandler() override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(X11EventsPlugin)
|
||||
};
|
||||
|
||||
|
||||
#endif // Header guard
|
||||
27
events/xdp/CMakeLists.txt
Normal file
27
events/xdp/CMakeLists.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
include_directories (${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
set (krfb_events_xdp_SRCS
|
||||
xdpevents.cpp
|
||||
xdpeventsplugin.cpp
|
||||
)
|
||||
|
||||
qt5_add_dbus_interface(
|
||||
krfb_events_xdp_SRCS
|
||||
${CMAKE_SOURCE_DIR}/dbus/xdp_dbus_remotedesktop_interface.xml
|
||||
xdp_dbus_remotedesktop_interface
|
||||
)
|
||||
|
||||
add_library (krfb_events_xdp MODULE ${krfb_events_xdp_SRCS})
|
||||
|
||||
target_link_libraries (krfb_events_xdp
|
||||
KF5::CoreAddons
|
||||
KF5::I18n
|
||||
Qt5::DBus
|
||||
krfbprivate
|
||||
)
|
||||
|
||||
install (TARGETS krfb_events_xdp
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
|
||||
)
|
||||
68
events/xdp/krfb_events_xdp.desktop
Normal file
68
events/xdp/krfb_events_xdp.desktop
Normal file
@@ -0,0 +1,68 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Comment=Xdg-desktop-portal based event handler for KRfb
|
||||
Comment[ca]=Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb
|
||||
Comment[ca@valencia]=Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb
|
||||
Comment[da]=Xdg-desktop-portal baseret hændelseshåndtering til KRfb
|
||||
Comment[de]=Ereignis-Modul basierend auf Xdg-desktop-portal für KRfb
|
||||
Comment[el]=Χειριστής γεγονότων με βάση το xdg-desktop-portal για το KRfb
|
||||
Comment[en_GB]=Xdg-desktop-portal based event handler for KRfb
|
||||
Comment[es]=Gestor de eventos basado en Xdg-desktop-portal para KRfb
|
||||
Comment[et]=KRfb Xdg-desktop-portal'i põhine sündmuste käitleja
|
||||
Comment[eu]=KRfb-rako «xdg-desktop-portal»en oinarritutako maneiatzailea
|
||||
Comment[fi]=KRfb:n XDG-desktop-portal-pohjainen tapahtumakäsittelijä
|
||||
Comment[fr]=Gestionnaire d'évènements utilisant Xdg-desktop-portal pour KRfb
|
||||
Comment[gl]=Xestor de eventos para KRfb baseado en Xdg-desktop-portal
|
||||
Comment[ia]=Maneator de evento basate sur Xdg-desktop-portal per KRfb
|
||||
Comment[it]=Gestore eventi basato su xdg-desktop-portal per KRfb
|
||||
Comment[ko]=Xdg-desktop-portal 기반 KRfb 이벤트 핸들러
|
||||
Comment[nl]=Op Xdg-desktop-portal gebaseerde behandelaar van gebeurtenis voor KRfb
|
||||
Comment[nn]=Xdg-desktop-portal-basert hendingshandtering for KRfb
|
||||
Comment[pl]=Obsługa wydarzeń oparta na Xdg-desktop-portal dla KRfb
|
||||
Comment[pt]=Tratamento de eventos baseado no Xdg-desktop-portal para o KRfb
|
||||
Comment[pt_BR]=Manipulador de eventos baseado no xdg-desktop-portal para o KRfb
|
||||
Comment[sk]=Obsluha udalostí založená na Xdg-desktop-portal pre KRfb
|
||||
Comment[sl]=Upravljalnik dogodkov za KRfb na podlagi namiznega portala Xdg
|
||||
Comment[sv]=Händelsehanterare för Krfb baserad på xdg-desktop-portal
|
||||
Comment[uk]=Обробник подій для KRfb на основі Xdg-desktop-portal
|
||||
Comment[x-test]=xxXdg-desktop-portal based event handler for KRfbxx
|
||||
Comment[zh_CN]=基于 xdg-desktop-portal 的 KRfb 事件处理器
|
||||
Comment[zh_TW]=KRfb 基於 Xdg-desktop-portal 的事件處理器
|
||||
Name=Xdg-desktop-portal based event handler for KRfb
|
||||
Name[ca]=Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb
|
||||
Name[ca@valencia]=Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb
|
||||
Name[da]=Xdg-desktop-portal baseret hændelseshåndtering til KRfb
|
||||
Name[de]=Ereignis-Modul basierend auf Xdg-desktop-portal für KRfb
|
||||
Name[el]=Χειριστής γεγονότων με βάση το xdg-desktop-portal για το KRfb
|
||||
Name[en_GB]=Xdg-desktop-portal based event handler for KRfb
|
||||
Name[es]=Gestor de eventos basado en Xdg-desktop-portal para KRfb
|
||||
Name[et]=KRfb Xdg-desktop-portal'i põhine sündmuste käitleja
|
||||
Name[eu]=KRfb-rako «xdg-desktop-portal»en oinarritutako maneiatzailea
|
||||
Name[fi]=KRfb:n XDG-desktop-portal-pohjainen tapahtumakäsittelijä
|
||||
Name[fr]=Gestionnaire d'évènements utilisant Xdg-desktop-portal pour KRfb
|
||||
Name[gl]=Xestor de eventos para KRfb baseado en Xdg-desktop-portal
|
||||
Name[ia]=Mneator de evento basate sur Xdg-desktop-portal per KRfb
|
||||
Name[it]=Gestore eventi basato su xdg-desktop-portal per KRfb
|
||||
Name[ko]=Xdg-desktop-portal 기반 KRfb 이벤트 핸들러
|
||||
Name[nl]=Op Xdg-desktop-portal gebaseerde behandelaar van gebeurtenis voor KRfb
|
||||
Name[nn]=Xdg-desktop-portal-basert hendingshandtering for KRfb
|
||||
Name[pl]=Obsługa wydarzeń oparta na Xdg-desktop-portal dla KRfb
|
||||
Name[pt]=Tratamento de eventos baseado no Xdg-desktop-portal para o KRfb
|
||||
Name[pt_BR]=Manipulador de eventos baseado no xdg-desktop-portal para o KRfb
|
||||
Name[sk]=Obsluha udalostí založená na Xdg-desktop-portal pre KRfb
|
||||
Name[sl]=Upravljalnik dogodkov za KRfb na podlagi namiznega portala Xdg
|
||||
Name[sv]=Händelsehanterare för Krfb baserad på xdg-desktop-portal
|
||||
Name[uk]=Обробник подій для KRfb на основі Xdg-desktop-portal
|
||||
Name[x-test]=xxXdg-desktop-portal based event handler for KRfbxx
|
||||
Name[zh_CN]=基于 xdg-desktop-portal 的 KRfb 事件处理器
|
||||
Name[zh_TW]=KRfb 基於 Xdg-desktop-portal 的事件處理器
|
||||
Type=Service
|
||||
ServiceTypes=krfb/events
|
||||
|
||||
X-KDE-Library=krfb_events_xdp
|
||||
X-KDE-PluginInfo-Name=xdp
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=https://www.kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
|
||||
69
events/xdp/krfb_events_xdp.json
Normal file
69
events/xdp/krfb_events_xdp.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"Encoding": "UTF-8",
|
||||
"KPlugin": {
|
||||
"Description": "Xdg-desktop-portal based event handler for KRfb",
|
||||
"Description[ca@valencia]": "Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb",
|
||||
"Description[ca]": "Gestor d'esdeveniments basat en «Xdg-desktop-portal» per al KRfb",
|
||||
"Description[da]": "Xdg-desktop-portal baseret hændelseshåndtering til KRfb",
|
||||
"Description[de]": "Ereignis-Modul basierend auf Xdg-desktop-portal für KRfb",
|
||||
"Description[el]": "Χειριστής γεγονότων με βάση το xdg-desktop-portal για το KRfb",
|
||||
"Description[en_GB]": "Xdg-desktop-portal based event handler for KRfb",
|
||||
"Description[es]": "Gestor de eventos basado en Xdg-desktop-portal para KRfb",
|
||||
"Description[et]": "KRfb Xdg-desktop-portal'i põhine sündmuste käitleja",
|
||||
"Description[eu]": "KRfb-rako «xdg-desktop-portal»en oinarritutako maneiatzailea",
|
||||
"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",
|
||||
"Description[nn]": "Xdg-desktop-portal-basert hendingshandtering for KRfb",
|
||||
"Description[pl]": "Obsługa wydarzeń oparta na Xdg-desktop-portal dla KRfb",
|
||||
"Description[pt]": "Tratamento de eventos baseado no Xdg-desktop-portal para o KRfb",
|
||||
"Description[pt_BR]": "Manipulador de eventos baseado no xdg-desktop-portal para o KRfb",
|
||||
"Description[sk]": "Obsluha udalostí založená na Xdg-desktop-portal pre KRfb",
|
||||
"Description[sl]": "Upravljavec dogodkov, na osnovi portala Xdg-desktop za KRfb",
|
||||
"Description[sv]": "Händelsehanterare för KRfb baserad på xdg-desktop-portal",
|
||||
"Description[uk]": "Обробник подій для KRfb на основі Xdg-desktop-portal",
|
||||
"Description[x-test]": "xxXdg-desktop-portal based event handler for KRfbxx",
|
||||
"Description[zh_CN]": "基于 xdg-desktop-portal 的 KRfb 事件处理器",
|
||||
"Description[zh_TW]": "KRfb 基於 Xdg-desktop-portal 的事件處理器",
|
||||
"EnabledByDefault": true,
|
||||
"Id": "xdp",
|
||||
"License": "GPL",
|
||||
"Name": "Xdg-desktop-portal Event handler for KRfb",
|
||||
"Name[ca@valencia]": "Gestor d'esdeveniments «Xdg-desktop-portal» per al KRfb",
|
||||
"Name[ca]": "Gestor d'esdeveniments «Xdg-desktop-portal» per al KRfb",
|
||||
"Name[da]": "Xdg-desktop-portal hændelseshåndtering til KRfb",
|
||||
"Name[de]": "Ereignis-Modul basierend auf Xdg-desktop-portal für KRfb",
|
||||
"Name[el]": "Χειριστής γεγονότων xdg-desktop-portal για το KRfb",
|
||||
"Name[en_GB]": "Xdg-desktop-portal Event handler for KRfb",
|
||||
"Name[es]": "Gestor de eventos de Xdg-desktop-portal para KRfb",
|
||||
"Name[et]": "KRfb Xdg-desktop-portal'i sündmuste käitleja",
|
||||
"Name[eu]": "KRfb-rako «xdg-desktop-portal» gertaera maneiatzailea",
|
||||
"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",
|
||||
"Name[nn]": "Xdg-desktop-portal-hendingshandtering for KRfb",
|
||||
"Name[pl]": "Obsługa wydarzeń Xdg-desktop-portal dla KRfb",
|
||||
"Name[pt]": "Tratamento de eventos do Xdg-desktop-portal para o KRfb",
|
||||
"Name[pt_BR]": "Manipulador de eventos xdg-desktop-portal para o KRfb",
|
||||
"Name[sk]": "Xdg-desktop-portal Obsluha udalostí pre KRfb",
|
||||
"Name[sl]": "Upravljavec dogodkov za KRfb na osnovi portala Xdg-desktop",
|
||||
"Name[sv]": "Xdg-desktop-portal händelsehanterare för Krfb",
|
||||
"Name[uk]": "Обробник подій для KRfb на основі Xdg-desktop-portal",
|
||||
"Name[x-test]": "xxXdg-desktop-portal Event handler for KRfbxx",
|
||||
"Name[zh_CN]": "xdg-desktop-portal KRfb 事件处理器",
|
||||
"Name[zh_TW]": "KRfb 的 Xdg-desktop-portal 事件處理器",
|
||||
"ServiceTypes": [
|
||||
"krfb/events"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "http://www.kde.org"
|
||||
}
|
||||
}
|
||||
124
events/xdp/xdpevents.cpp
Normal file
124
events/xdp/xdpevents.cpp
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2018-2019 Jan Grulich <jgrulich@redhat.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "xdpevents.h"
|
||||
|
||||
#include "rfbservermanager.h"
|
||||
#include "xdp_dbus_remotedesktop_interface.h"
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
class EventData
|
||||
{
|
||||
public:
|
||||
EventData();
|
||||
|
||||
//mouse
|
||||
int buttonMask = 0;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
QScopedPointer<OrgFreedesktopPortalRemoteDesktopInterface> dbusXdpRemoteDesktopService;
|
||||
|
||||
private:
|
||||
void init();
|
||||
};
|
||||
|
||||
Q_GLOBAL_STATIC(EventData, data)
|
||||
|
||||
EventData::EventData()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void EventData::init()
|
||||
{
|
||||
dbusXdpRemoteDesktopService.reset(new OrgFreedesktopPortalRemoteDesktopInterface(QStringLiteral("org.freedesktop.portal.Desktop"),
|
||||
QStringLiteral("/org/freedesktop/portal/desktop"), QDBusConnection::sessionBus()));
|
||||
}
|
||||
|
||||
void XdpEventHandler::handleKeyboard(bool down, rfbKeySym keySym)
|
||||
{
|
||||
// TODO: implement button handling
|
||||
// both in FakeInput interface and here
|
||||
Q_UNUSED(down)
|
||||
Q_UNUSED(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>();
|
||||
|
||||
if (streamNodeId == 0 || sessionHandle.path().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (x != data->x || y != data->y) {
|
||||
data->dbusXdpRemoteDesktopService->NotifyPointerMotionAbsolute(sessionHandle, QVariantMap(), streamNodeId, x, y);
|
||||
data->x = x;
|
||||
data->y = y;
|
||||
}
|
||||
|
||||
if (buttonMask != data->buttonMask) {
|
||||
int i = 0;
|
||||
QVector<int> buttons = { BTN_LEFT, BTN_MIDDLE, BTN_RIGHT, 0, 0, 0, 0, BTN_SIDE, BTN_EXTRA };
|
||||
for (auto it = buttons.constBegin(); it != buttons.constEnd(); ++it) {
|
||||
int prevButtonState = (data->buttonMask >> i) & 0x01;
|
||||
int currentButtonState = (buttonMask >> i) & 0x01;
|
||||
|
||||
if (prevButtonState != currentButtonState) {
|
||||
if (*it) {
|
||||
data->dbusXdpRemoteDesktopService->NotifyPointerButton(sessionHandle, QVariantMap(), *it, buttonMask);
|
||||
} else {
|
||||
int axis = 0;
|
||||
int steps = 0;
|
||||
switch (i) {
|
||||
case 3:
|
||||
axis = 0; // Vertical
|
||||
steps = -1;
|
||||
break;
|
||||
case 4:
|
||||
axis = 0; // Vertical
|
||||
steps = 1;
|
||||
break;
|
||||
case 5:
|
||||
axis = 1; // Horizontal
|
||||
steps = -1;
|
||||
break;
|
||||
case 6:
|
||||
axis = 1; // Horizontal
|
||||
steps = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
data->dbusXdpRemoteDesktopService->NotifyPointerAxisDiscrete(sessionHandle, QVariantMap(), axis, steps);
|
||||
}
|
||||
}
|
||||
++i;
|
||||
}
|
||||
data->buttonMask = buttonMask;
|
||||
}
|
||||
}
|
||||
37
events/xdp/xdpevents.h
Normal file
37
events/xdp/xdpevents.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2018-2019 Jan Grulich <jgrulich@redhat.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef EVENTS_XDPEVENTS_H
|
||||
#define EVENTS_XDPEVENTS_H
|
||||
|
||||
#include "../../krfb/events.h"
|
||||
|
||||
class XdpEventHandler : public EventHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
void handleKeyboard(bool down, rfbKeySym key) override;
|
||||
void handlePointer(int buttonMask, int x, int y) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
43
events/xdp/xdpeventsplugin.cpp
Normal file
43
events/xdp/xdpeventsplugin.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2018-2019 Jan Grulich <jgrulich@redhat.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "xdpeventsplugin.h"
|
||||
|
||||
#include "xdpevents.h"
|
||||
|
||||
#include <KPluginFactory>
|
||||
|
||||
K_PLUGIN_FACTORY_WITH_JSON(XdpEventsPluginFactory, "krfb_events_xdp.json",
|
||||
registerPlugin<XdpEventsPlugin>();)
|
||||
|
||||
XdpEventsPlugin::XdpEventsPlugin(QObject *parent, const QVariantList &args)
|
||||
: EventsPlugin(parent, args)
|
||||
{
|
||||
}
|
||||
|
||||
EventHandler *XdpEventsPlugin::eventHandler()
|
||||
{
|
||||
// works only under Wayland
|
||||
return new XdpEventHandler();
|
||||
}
|
||||
|
||||
#include "xdpeventsplugin.moc"
|
||||
|
||||
46
events/xdp/xdpeventsplugin.h
Normal file
46
events/xdp/xdpeventsplugin.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2018-2019 Jan Grulich <jgrulich@redhat.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KRFB_EVENTS_XDP_XDPEVENTSPLUGIN_H
|
||||
#define KRFB_EVENTS_XDP_XDPEVENTSPLUGIN_H
|
||||
|
||||
#include "eventsplugin.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class EventHandler;
|
||||
|
||||
class XdpEventsPlugin : public EventsPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
XdpEventsPlugin(QObject *parent, const QVariantList &args);
|
||||
virtual ~XdpEventsPlugin() = default;
|
||||
|
||||
EventHandler *eventHandler() override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(XdpEventsPlugin)
|
||||
};
|
||||
|
||||
|
||||
#endif // Header guard
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
add_subdirectory (qt)
|
||||
|
||||
if (${XCB_DAMAGE_FOUND} AND ${XCB_SHM_FOUND} AND ${XCB_IMAGE_FOUND})
|
||||
add_subdirectory (xcb)
|
||||
add_subdirectory (xcb)
|
||||
endif()
|
||||
|
||||
if (${PipeWire_FOUND})
|
||||
add_subdirectory(pipewire)
|
||||
endif()
|
||||
|
||||
53
framebuffers/pipewire/CMakeLists.txt
Normal file
53
framebuffers/pipewire/CMakeLists.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
include_directories (${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
set (krfb_framebuffer_pw_SRCS
|
||||
pw_framebuffer.cpp
|
||||
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
|
||||
xdp_dbus_screencast_interface
|
||||
)
|
||||
|
||||
qt5_add_dbus_interface(
|
||||
krfb_framebuffer_pw_SRCS
|
||||
${CMAKE_SOURCE_DIR}/dbus/xdp_dbus_remotedesktop_interface.xml
|
||||
xdp_dbus_remotedesktop_interface
|
||||
)
|
||||
|
||||
add_library(krfb_framebuffer_pw
|
||||
MODULE
|
||||
${krfb_framebuffer_pw_SRCS}
|
||||
)
|
||||
|
||||
|
||||
check_include_file("linux/dma-buf.h" HAVE_LINUX_DMABUF_H)
|
||||
if (HAVE_LINUX_DMABUF_H)
|
||||
target_compile_definitions(krfb_framebuffer_pw PRIVATE -DHAVE_LINUX_DMABUF_H)
|
||||
endif ()
|
||||
|
||||
target_link_libraries (krfb_framebuffer_pw
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::DBus
|
||||
KF5::CoreAddons
|
||||
krfbprivate
|
||||
PipeWire::PipeWire
|
||||
)
|
||||
|
||||
install (TARGETS krfb_framebuffer_pw
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
|
||||
)
|
||||
73
framebuffers/pipewire/krfb_framebuffer_pw.json
Normal file
73
framebuffers/pipewire/krfb_framebuffer_pw.json
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"Encoding": "UTF-8",
|
||||
"KPlugin": {
|
||||
"Description": "PipeWire based Framebuffer for KRfb.",
|
||||
"Description[ca@valencia]": "«Framebuffer» basat en «PipeWire» per al KRfb.",
|
||||
"Description[ca]": "«Framebuffer» basat en «PipeWire» per al KRfb.",
|
||||
"Description[cs]": "Framebuffer založený na Pipe pro KRfb.",
|
||||
"Description[da]": "PipeWire baseret framebuffer til KRfb.",
|
||||
"Description[de]": "PipeWire-basierter Framebuffer für KRfb.",
|
||||
"Description[el]": "Μνήμη ανανέωσης με βάση το pipewire για το KRfb.",
|
||||
"Description[en_GB]": "PipeWire based Framebuffer for KRfb.",
|
||||
"Description[es]": "Framebuffer basado en PipeWire para KRfb.",
|
||||
"Description[et]": "KRfb PipeWire põhine kaadripuhver",
|
||||
"Description[eu]": "KRfb-rako «PipeWire»n oinarritutako «Framebuffer».",
|
||||
"Description[fi]": "KRfb:n PipeWire-pohjainen kehyspuskuri.",
|
||||
"Description[fr]": "Tampon d'images utilisant PipeWire pour KRfb.",
|
||||
"Description[gl]": "Búfer de fotograma para KRfb baseado en PipeWire.",
|
||||
"Description[ia]": "Framebuffer basate sur PipeWire per KRfb.",
|
||||
"Description[it]": "Framebuffer basato su PipeWire per KRfb.",
|
||||
"Description[ko]": "KRfb용 PipeWire 기반 프레임버퍼입니다.",
|
||||
"Description[nl]": "Op PipeWire gebaseerd framebuffer voor KRfb.",
|
||||
"Description[nn]": "PipeWire-basert biletbuffer for KRfb.",
|
||||
"Description[pl]": "Bufor ramki oparty na PipeWire dla KRfb.",
|
||||
"Description[pt]": "'Framebuffer' baseado no PipeWire para o KRfb.",
|
||||
"Description[pt_BR]": "Framebuffer baseado no PipeWire para o KRfb.",
|
||||
"Description[ru]": "Буфер кадров для KRfb на базе Framebuffer",
|
||||
"Description[sk]": "Framebuffer založený na PipeWire pre KRfb.",
|
||||
"Description[sl]": "Slikovni medpomnilnik na osnovi PipeWire za KRfb.",
|
||||
"Description[sv]": "Rambuffert för Krfb baserad på PipeWire",
|
||||
"Description[uk]": "Буфер кадрів на основі PipeWire для KRfb.",
|
||||
"Description[x-test]": "xxPipeWire based Framebuffer for KRfb.xx",
|
||||
"Description[zh_CN]": "基于 PipeWire 的 KRfb 帧缓冲机制。",
|
||||
"Description[zh_TW]": "KRfb 基於 PipeWire 的 Framebuffer。",
|
||||
"EnabledByDefault": true,
|
||||
"Id": "pw",
|
||||
"License": "GPL3",
|
||||
"Name": "PipeWire Framebuffer for KRfb",
|
||||
"Name[ca@valencia]": "«Framebuffer» del «PipeWire» per al KRfb",
|
||||
"Name[ca]": "«Framebuffer» del «PipeWire» per al KRfb",
|
||||
"Name[cs]": "PipeWire Framebuffer pro KRfb",
|
||||
"Name[da]": "PipeWire framebuffer til KRfb",
|
||||
"Name[de]": "PipeWire-Framebuffer für KRfb",
|
||||
"Name[el]": "Μνήμη ανανέωσης pipewire για το KRfb",
|
||||
"Name[en_GB]": "PipeWire Framebuffer for KRfb",
|
||||
"Name[es]": "Framebuffer de PipeWire para KRfb",
|
||||
"Name[et]": "KRfb PipeWire kaadripuhver",
|
||||
"Name[eu]": "KRfb-rako «PipeWire Framebuffer»",
|
||||
"Name[fi]": "KRfb:n PipeWire-kehyspuskuri",
|
||||
"Name[fr]": "Tampon d'images PipeWire pour KRfb",
|
||||
"Name[gl]": "Búfer de fotograma de PipeWire para KRfb",
|
||||
"Name[ia]": "Framebuffer de PipeWire per KRfb",
|
||||
"Name[it]": "Framebuffer PipeWire per KRfb",
|
||||
"Name[ko]": "KRfb용 PipeWire 프레임버퍼",
|
||||
"Name[nl]": "PipeWire-framebuffer voor KRfb",
|
||||
"Name[nn]": "PipeWire-biletbuffer for KRfb",
|
||||
"Name[pl]": "Wtyczki buforów ramek PipeWire dla KRfb",
|
||||
"Name[pt]": "'Framebuffer' do PipeWire para o KRfb",
|
||||
"Name[pt_BR]": "Framebuffer PipeWire para o KRfb",
|
||||
"Name[ru]": "Буфер кадров PipeWire для KRfb",
|
||||
"Name[sk]": "PipeWire Framebuffer pre KRfb",
|
||||
"Name[sl]": "Slikovni medpomnilnik za KRfb na osnovi PipeWire",
|
||||
"Name[sv]": "PipeWire-rambuffert för Krfb",
|
||||
"Name[uk]": "Буфер кадрів PipeWire для KRfb",
|
||||
"Name[x-test]": "xxPipeWire Framebuffer for KRfbxx",
|
||||
"Name[zh_CN]": "KRfb 的 PipeWire 帧缓冲机制",
|
||||
"Name[zh_TW]": "KRfb 的 PipeWire Framebuffer",
|
||||
"ServiceTypes": [
|
||||
"krfb/framebuffer"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "http://www.kde.org"
|
||||
}
|
||||
}
|
||||
984
framebuffers/pipewire/pw_framebuffer.cpp
Normal file
984
framebuffers/pipewire/pw_framebuffer.cpp
Normal file
@@ -0,0 +1,984 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2018 Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
Copyright (C) 2018 Jan Grulich <jgrulich@redhat.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
// system
|
||||
#include <sys/mman.h>
|
||||
#include <cstring>
|
||||
|
||||
// Qt
|
||||
#include <QCoreApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QSocketNotifier>
|
||||
#include <QDebug>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
// pipewire
|
||||
#include <pipewire/version.h>
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
#include <spa/utils/result.h>
|
||||
#ifdef HAVE_LINUX_DMABUF_H
|
||||
#include <linux/dma-buf.h>
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <spa/param/format-utils.h>
|
||||
#include <spa/param/video/format-utils.h>
|
||||
#include <spa/param/props.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
#include <climits>
|
||||
|
||||
#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;
|
||||
|
||||
Q_DECLARE_METATYPE(PWFrameBuffer::Stream);
|
||||
Q_DECLARE_METATYPE(PWFrameBuffer::Streams);
|
||||
|
||||
const QDBusArgument &operator >> (const QDBusArgument &arg, PWFrameBuffer::Stream &stream)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg >> stream.nodeId;
|
||||
|
||||
arg.beginMap();
|
||||
while (!arg.atEnd()) {
|
||||
QString key;
|
||||
QVariant map;
|
||||
arg.beginMapEntry();
|
||||
arg >> key >> map;
|
||||
arg.endMapEntry();
|
||||
stream.map.insert(key, map);
|
||||
}
|
||||
arg.endMap();
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
/**
|
||||
* @brief The PwType class - helper class to contain pointers to raw C pipewire media mappings
|
||||
*/
|
||||
class PwType {
|
||||
public:
|
||||
spa_type_media_type media_type;
|
||||
spa_type_media_subtype media_subtype;
|
||||
spa_type_format_video format_video;
|
||||
spa_type_video_format video_format;
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The PWFrameBuffer::Private class - private counterpart of PWFramebuffer class. This is the entity where
|
||||
* whole logic resides, for more info search for "d-pointer pattern" information.
|
||||
*/
|
||||
class PWFrameBuffer::Private {
|
||||
public:
|
||||
Private(PWFrameBuffer *q);
|
||||
~Private();
|
||||
|
||||
private:
|
||||
friend class PWFrameBuffer;
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
static void onCoreError(void *data, uint32_t id, int seq, int res, const char *message);
|
||||
static void onStreamParamChanged(void *data, uint32_t id, const struct spa_pod *format);
|
||||
#else
|
||||
static void onStateChanged(void *data, pw_remote_state old, pw_remote_state state, const char *error);
|
||||
static void onStreamFormatChanged(void *data, const struct spa_pod *format);
|
||||
#endif
|
||||
static void onStreamStateChanged(void *data, pw_stream_state old, pw_stream_state state, const char *error_message);
|
||||
static void onStreamProcess(void *data);
|
||||
|
||||
void initDbus();
|
||||
void initPw();
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
void initializePwTypes();
|
||||
#endif
|
||||
|
||||
// dbus handling
|
||||
void handleSessionCreated(quint32 &code, QVariantMap &results);
|
||||
void handleDevicesSelected(quint32 &code, QVariantMap &results);
|
||||
void handleSourcesSelected(quint32 &code, QVariantMap &results);
|
||||
void handleRemoteDesktopStarted(quint32 &code, QVariantMap &results);
|
||||
|
||||
// pw handling
|
||||
pw_stream *createReceivingStream();
|
||||
void handleFrame(pw_buffer *pwBuffer);
|
||||
|
||||
// link to public interface
|
||||
PWFrameBuffer *q;
|
||||
|
||||
// pipewire stuff
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
struct pw_context *pwContext = nullptr;
|
||||
struct pw_core *pwCore = nullptr;
|
||||
struct pw_stream *pwStream = nullptr;
|
||||
struct pw_thread_loop *pwMainLoop = nullptr;
|
||||
|
||||
// wayland-like listeners
|
||||
// ...of events that happen in pipewire server
|
||||
spa_hook coreListener = {};
|
||||
spa_hook streamListener = {};
|
||||
|
||||
// event handlers
|
||||
pw_core_events pwCoreEvents = {};
|
||||
pw_stream_events pwStreamEvents = {};
|
||||
#else
|
||||
pw_core *pwCore = nullptr;
|
||||
pw_loop *pwLoop = nullptr;
|
||||
pw_thread_loop *pwMainLoop = nullptr;
|
||||
pw_stream *pwStream = nullptr;
|
||||
pw_remote *pwRemote = nullptr;
|
||||
pw_type *pwCoreType = nullptr;
|
||||
PwType *pwType = nullptr;
|
||||
|
||||
spa_hook remoteListener = {};
|
||||
spa_hook streamListener = {};
|
||||
|
||||
// event handlers
|
||||
pw_remote_events pwRemoteEvents = {};
|
||||
pw_stream_events pwStreamEvents = {};
|
||||
#endif
|
||||
|
||||
uint pwStreamNodeId = 0;
|
||||
|
||||
// negotiated video format
|
||||
spa_video_info_raw *videoFormat = nullptr;
|
||||
|
||||
// requests a session from XDG Desktop Portal
|
||||
// auto-generated and compiled from xdp_dbus_interface.xml file
|
||||
QScopedPointer<OrgFreedesktopPortalScreenCastInterface> dbusXdpScreenCastService;
|
||||
QScopedPointer<OrgFreedesktopPortalRemoteDesktopInterface> dbusXdpRemoteDesktopService;
|
||||
|
||||
// XDP screencast session handle
|
||||
QDBusObjectPath sessionPath;
|
||||
// Pipewire file descriptor
|
||||
QDBusUnixFileDescriptor pipewireFd;
|
||||
|
||||
// screen geometry holder
|
||||
struct {
|
||||
quint32 width;
|
||||
quint32 height;
|
||||
} screenGeometry = {};
|
||||
|
||||
// Allowed devices
|
||||
uint devices = 0;
|
||||
|
||||
// sanity indicator
|
||||
bool isValid = true;
|
||||
};
|
||||
|
||||
PWFrameBuffer::Private::Private(PWFrameBuffer *q) : q(q)
|
||||
{
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
pwCoreEvents.version = PW_VERSION_CORE_EVENTS;
|
||||
pwCoreEvents.error = &onCoreError;
|
||||
|
||||
pwStreamEvents.version = PW_VERSION_STREAM_EVENTS;
|
||||
pwStreamEvents.state_changed = &onStreamStateChanged;
|
||||
pwStreamEvents.param_changed = &onStreamParamChanged;
|
||||
pwStreamEvents.process = &onStreamProcess;
|
||||
#else
|
||||
// initialize event handlers, remote end and stream-related
|
||||
pwRemoteEvents.version = PW_VERSION_REMOTE_EVENTS;
|
||||
pwRemoteEvents.state_changed = &onStateChanged;
|
||||
|
||||
pwStreamEvents.version = PW_VERSION_STREAM_EVENTS;
|
||||
pwStreamEvents.state_changed = &onStreamStateChanged;
|
||||
pwStreamEvents.format_changed = &onStreamFormatChanged;
|
||||
pwStreamEvents.process = &onStreamProcess;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::initDbus - initialize D-Bus connectivity with XDG Desktop Portal.
|
||||
* Based on XDG_CURRENT_DESKTOP environment variable it will give us implementation that we need,
|
||||
* in case of KDE it is xdg-desktop-portal-kde binary.
|
||||
*/
|
||||
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"),
|
||||
QDBusConnection::sessionBus()));
|
||||
dbusXdpRemoteDesktopService.reset(new OrgFreedesktopPortalRemoteDesktopInterface(QStringLiteral("org.freedesktop.portal.Desktop"),
|
||||
QStringLiteral("/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;
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// create session
|
||||
auto sessionParameters = QVariantMap {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
{ QStringLiteral("session_handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) },
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
|
||||
#else
|
||||
{ QStringLiteral("session_handle_token"), QStringLiteral("krfb%1").arg(qrand()) },
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
|
||||
#endif
|
||||
};
|
||||
auto sessionReply = dbusXdpRemoteDesktopService->CreateSession(sessionParameters);
|
||||
sessionReply.waitForFinished();
|
||||
if (!sessionReply.isValid()) {
|
||||
qWarning("Couldn't initialize XDP-KDE screencast session");
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo() << "DBus session created: " << sessionReply.value().path();
|
||||
QDBusConnection::sessionBus().connect(QString(),
|
||||
sessionReply.value().path(),
|
||||
QStringLiteral("org.freedesktop.portal.Request"),
|
||||
QStringLiteral("Response"),
|
||||
this->q,
|
||||
SLOT(handleXdpSessionCreated(uint, QVariantMap)));
|
||||
}
|
||||
|
||||
void PWFrameBuffer::handleXdpSessionCreated(quint32 code, QVariantMap results)
|
||||
{
|
||||
d->handleSessionCreated(code, results);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::handleSessionCreated - handle creation of ScreenCast session.
|
||||
* XDG Portal answers with session path if it was able to successfully create the screencast.
|
||||
*
|
||||
* @param code return code for dbus call. Zero is success, non-zero means error
|
||||
* @param results map with results of call.
|
||||
*/
|
||||
void PWFrameBuffer::Private::handleSessionCreated(quint32 &code, QVariantMap &results)
|
||||
{
|
||||
if (code != 0) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to create session: " << code;
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
sessionPath = QDBusObjectPath(results.value(QStringLiteral("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)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
|
||||
#else
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
|
||||
#endif
|
||||
};
|
||||
auto selectorReply = dbusXdpRemoteDesktopService->SelectDevices(sessionPath, selectionOptions);
|
||||
selectorReply.waitForFinished();
|
||||
if (!selectorReply.isValid()) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "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"),
|
||||
this->q,
|
||||
SLOT(handleXdpDevicesSelected(uint, QVariantMap)));
|
||||
}
|
||||
|
||||
void PWFrameBuffer::handleXdpDevicesSelected(quint32 code, QVariantMap results)
|
||||
{
|
||||
d->handleDevicesSelected(code, results);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::handleDevicesCreated - handle selection of devices we want to use for remote desktop
|
||||
*
|
||||
* @param code return code for dbus call. Zero is success, non-zero means error
|
||||
* @param results map with results of call.
|
||||
*/
|
||||
void PWFrameBuffer::Private::handleDevicesSelected(quint32 &code, QVariantMap &results)
|
||||
{
|
||||
Q_UNUSED(results)
|
||||
if (code != 0) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "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 },
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
|
||||
#else
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
|
||||
#endif
|
||||
};
|
||||
auto selectorReply = dbusXdpScreenCastService->SelectSources(sessionPath, selectionOptions);
|
||||
selectorReply.waitForFinished();
|
||||
if (!selectorReply.isValid()) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "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"),
|
||||
this->q,
|
||||
SLOT(handleXdpSourcesSelected(uint, QVariantMap)));
|
||||
}
|
||||
|
||||
void PWFrameBuffer::handleXdpSourcesSelected(quint32 code, QVariantMap results)
|
||||
{
|
||||
d->handleSourcesSelected(code, results);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::handleSourcesSelected - handle Screencast sources selection.
|
||||
* XDG Portal shows a dialog at this point which allows you to select monitor from the list.
|
||||
* This function is called after you make a selection.
|
||||
*
|
||||
* @param code return code for dbus call. Zero is success, non-zero means error
|
||||
* @param results map with results of call.
|
||||
*/
|
||||
void PWFrameBuffer::Private::handleSourcesSelected(quint32 &code, QVariantMap &)
|
||||
{
|
||||
if (code != 0) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to select sources: " << code;
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// start session
|
||||
auto startParameters = QVariantMap {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
|
||||
#else
|
||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(qrand()) }
|
||||
#endif
|
||||
};
|
||||
auto startReply = dbusXdpRemoteDesktopService->Start(sessionPath, QString(), startParameters);
|
||||
startReply.waitForFinished();
|
||||
QDBusConnection::sessionBus().connect(QString(),
|
||||
startReply.value().path(),
|
||||
QStringLiteral("org.freedesktop.portal.Request"),
|
||||
QStringLiteral("Response"),
|
||||
this->q,
|
||||
SLOT(handleXdpRemoteDesktopStarted(uint, QVariantMap)));
|
||||
}
|
||||
|
||||
|
||||
void PWFrameBuffer::handleXdpRemoteDesktopStarted(quint32 code, QVariantMap results)
|
||||
{
|
||||
d->handleRemoteDesktopStarted(code, results);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::handleScreencastStarted - handle Screencast start.
|
||||
* At this point there shall be ready pipewire stream to consume.
|
||||
*
|
||||
* @param code return code for dbus call. Zero is success, non-zero means error
|
||||
* @param results map with results of call.
|
||||
*/
|
||||
void PWFrameBuffer::Private::handleRemoteDesktopStarted(quint32 &code, QVariantMap &results)
|
||||
{
|
||||
if (code != 0) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to start screencast: " << code;
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// there should be only one stream
|
||||
Streams streams = qdbus_cast<Streams>(results.value(QStringLiteral("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";
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
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";
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
pipewireFd = streamReply.value();
|
||||
if (!pipewireFd.isValid()) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Couldn't get pipewire connection file descriptor";
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
QSize streamResolution = qdbus_cast<QSize>(streams.first().map.value(QStringLiteral("size")));
|
||||
screenGeometry.width = streamResolution.width();
|
||||
screenGeometry.height = streamResolution.height();
|
||||
|
||||
devices = results.value(QStringLiteral("types")).toUInt();
|
||||
|
||||
pwStreamNodeId = streams.first().nodeId;
|
||||
|
||||
// Reallocate our buffer with actual needed size
|
||||
q->fb = static_cast<char*>(malloc(screenGeometry.width * screenGeometry.height * 4));
|
||||
|
||||
if (!q->fb) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to allocate buffer";
|
||||
isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Q_EMIT q->frameBufferChanged();
|
||||
|
||||
initPw();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::initPw - initialize Pipewire socket connectivity.
|
||||
* pipewireFd should be pointing to existing file descriptor that was passed by D-Bus at this point.
|
||||
*/
|
||||
void PWFrameBuffer::Private::initPw() {
|
||||
qInfo() << "Initializing Pipewire connectivity";
|
||||
|
||||
// init pipewire (required)
|
||||
pw_init(nullptr, nullptr); // args are not used anyways
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
pwMainLoop = pw_thread_loop_new("pipewire-main-loop", nullptr);
|
||||
pwContext = pw_context_new(pw_thread_loop_get_loop(pwMainLoop), nullptr, 0);
|
||||
if (!pwContext) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to create PipeWire context";
|
||||
return;
|
||||
}
|
||||
|
||||
pwCore = pw_context_connect(pwContext, nullptr, 0);
|
||||
if (!pwCore) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to connect PipeWire context";
|
||||
return;
|
||||
}
|
||||
|
||||
pw_core_add_listener(pwCore, &coreListener, &pwCoreEvents, this);
|
||||
|
||||
pwStream = createReceivingStream();
|
||||
if (!pwStream) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to create PipeWire stream";
|
||||
return;
|
||||
}
|
||||
#else
|
||||
// initialize our source
|
||||
pwLoop = pw_loop_new(nullptr);
|
||||
pwMainLoop = pw_thread_loop_new(pwLoop, "pipewire-main-loop");
|
||||
// create PipeWire core object (required)
|
||||
pwCore = pw_core_new(pwLoop, nullptr);
|
||||
pwCoreType = pw_core_get_type(pwCore);
|
||||
|
||||
initializePwTypes();
|
||||
|
||||
// pw_remote should be initialized before type maps or connection error will happen
|
||||
pwRemote = pw_remote_new(pwCore, nullptr, 0);
|
||||
// init PipeWire remote, add listener to handle events
|
||||
pw_remote_add_listener(pwRemote, &remoteListener, &pwRemoteEvents, this);
|
||||
pw_remote_connect_fd(pwRemote, pipewireFd.fileDescriptor());
|
||||
#endif
|
||||
|
||||
if (pw_thread_loop_start(pwMainLoop) < 0) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to start main PipeWire loop";
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::initializePwTypes - helper method to initialize and map all needed
|
||||
* Pipewire types from core to type structure.
|
||||
*/
|
||||
void PWFrameBuffer::Private::initializePwTypes()
|
||||
{
|
||||
// raw C-like PipeWire type map
|
||||
spa_type_map *map = pwCoreType->map;
|
||||
pwType = new PwType();
|
||||
|
||||
spa_type_media_type_map(map, &pwType->media_type);
|
||||
spa_type_media_subtype_map(map, &pwType->media_subtype);
|
||||
spa_type_format_video_map(map, &pwType->format_video);
|
||||
spa_type_video_format_map(map, &pwType->video_format);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
void PWFrameBuffer::Private::onCoreError(void *data, uint32_t id, int seq, int res, const char *message)
|
||||
{
|
||||
Q_UNUSED(data);
|
||||
Q_UNUSED(id);
|
||||
Q_UNUSED(seq);
|
||||
Q_UNUSED(res);
|
||||
|
||||
qInfo() << "core error: " << message;
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::onStateChanged - global state tracking for pipewire connection
|
||||
* @param data pointer that you have set in pw_remote_add_listener call's last argument
|
||||
* @param state new state that connection has changed to
|
||||
* @param error optional error message, is set to non-null if state is error
|
||||
*/
|
||||
void PWFrameBuffer::Private::onStateChanged(void *data, pw_remote_state /*old*/, pw_remote_state state, const char *error)
|
||||
{
|
||||
qInfo() << "remote state: " << pw_remote_state_as_string(state);
|
||||
|
||||
auto d = static_cast<PWFrameBuffer::Private*>(data);
|
||||
|
||||
switch (state) {
|
||||
case PW_REMOTE_STATE_ERROR:
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "remote error: " << error;
|
||||
break;
|
||||
case PW_REMOTE_STATE_CONNECTED:
|
||||
d->pwStream = d->createReceivingStream();
|
||||
break;
|
||||
default:
|
||||
qInfo() << "remote state: " << pw_remote_state_as_string(state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::onStreamStateChanged - called whenever stream state changes on pipewire server
|
||||
* @param data pointer that you have set in pw_stream_add_listener call's last argument
|
||||
* @param state new state that stream has changed to
|
||||
* @param error_message optional error message, is set to non-null if state is error
|
||||
*/
|
||||
void PWFrameBuffer::Private::onStreamStateChanged(void *data, pw_stream_state /*old*/, pw_stream_state state, const char *error_message)
|
||||
{
|
||||
qInfo() << "Stream state changed: " << pw_stream_state_as_string(state);
|
||||
|
||||
auto *d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
switch (state) {
|
||||
case PW_STREAM_STATE_ERROR:
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "pipewire stream error: " << error_message;
|
||||
break;
|
||||
case PW_STREAM_STATE_PAUSED:
|
||||
pw_stream_set_active(d->pwStream, true);
|
||||
break;
|
||||
case PW_STREAM_STATE_STREAMING:
|
||||
case PW_STREAM_STATE_UNCONNECTED:
|
||||
case PW_STREAM_STATE_CONNECTING:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
switch (state) {
|
||||
case PW_STREAM_STATE_ERROR:
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "pipewire stream error: " << error_message;
|
||||
break;
|
||||
case PW_STREAM_STATE_CONFIGURE:
|
||||
pw_stream_set_active(d->pwStream, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::onStreamFormatChanged - being executed after stream is set to active
|
||||
* and after setup has been requested to connect to it. The actual video format is being negotiated here.
|
||||
* @param data pointer that you have set in pw_stream_add_listener call's last argument
|
||||
* @param format format that's being proposed
|
||||
*/
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
void PWFrameBuffer::Private::onStreamParamChanged(void *data, uint32_t id, const struct spa_pod *format)
|
||||
#else
|
||||
void PWFrameBuffer::Private::onStreamFormatChanged(void *data, const struct spa_pod *format)
|
||||
#endif
|
||||
{
|
||||
qInfo() << "Stream format changed";
|
||||
auto *d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
|
||||
const int bpp = 4;
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
if (!format || id != SPA_PARAM_Format) {
|
||||
#else
|
||||
if (!format) {
|
||||
pw_stream_finish_format(d->pwStream, 0, nullptr, 0);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
d->videoFormat = new spa_video_info_raw();
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
spa_format_video_raw_parse(format, d->videoFormat);
|
||||
#else
|
||||
spa_format_video_raw_parse(format, d->videoFormat, &d->pwType->format_video);
|
||||
#endif
|
||||
auto width = d->videoFormat->size.width;
|
||||
auto height = d->videoFormat->size.height;
|
||||
auto stride = SPA_ROUND_UP_N(width * bpp, 4);
|
||||
auto size = height * stride;
|
||||
|
||||
uint8_t buffer[1024];
|
||||
auto builder = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
|
||||
// setup buffers and meta header for new format
|
||||
const struct spa_pod *params[2];
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(size),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
|
||||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 1, 32),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16)));
|
||||
params[1] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
|
||||
SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
|
||||
SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header))));
|
||||
pw_stream_update_params(d->pwStream, params, 2);
|
||||
#else
|
||||
params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_object(&builder,
|
||||
d->pwCoreType->param.idBuffers, d->pwCoreType->param_buffers.Buffers,
|
||||
":", d->pwCoreType->param_buffers.size, "i", size,
|
||||
":", d->pwCoreType->param_buffers.stride, "i", stride,
|
||||
":", d->pwCoreType->param_buffers.buffers, "iru", 8, SPA_POD_PROP_MIN_MAX(1, 32),
|
||||
":", d->pwCoreType->param_buffers.align, "i", 16));
|
||||
params[1] = reinterpret_cast<spa_pod *>(spa_pod_builder_object(&builder,
|
||||
d->pwCoreType->param.idMeta, d->pwCoreType->param_meta.Meta,
|
||||
":", d->pwCoreType->param_meta.type, "I", d->pwCoreType->meta.Header,
|
||||
":", d->pwCoreType->param_meta.size, "i", sizeof(struct spa_meta_header)));
|
||||
pw_stream_finish_format(d->pwStream, 0, params, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::onNewBuffer - called when new buffer is available in pipewire stream
|
||||
* @param data pointer that you have set in pw_stream_add_listener call's last argument
|
||||
* @param id
|
||||
*/
|
||||
void PWFrameBuffer::Private::onStreamProcess(void *data)
|
||||
{
|
||||
auto *d = static_cast<PWFrameBuffer::Private *>(data);
|
||||
|
||||
pw_buffer *buf;
|
||||
if (!(buf = pw_stream_dequeue_buffer(d->pwStream))) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->handleFrame(buf);
|
||||
|
||||
pw_stream_queue_buffer(d->pwStream, buf);
|
||||
}
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90) && defined(HAVE_LINUX_DMABUF_H)
|
||||
static void syncDmaBuf(int fd, uint64_t start_or_end)
|
||||
{
|
||||
struct dma_buf_sync sync = { 0 };
|
||||
sync.flags = start_or_end | DMA_BUF_SYNC_READ;
|
||||
|
||||
while(true) {
|
||||
int ret;
|
||||
ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync);
|
||||
if (ret == -1 && errno == EINTR) {
|
||||
continue;
|
||||
} else if (ret == -1) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to synchronize DMA buffer: " << strerror(errno);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PWFrameBuffer::Private::handleFrame(pw_buffer *pwBuffer)
|
||||
{
|
||||
auto *spaBuffer = pwBuffer->buffer;
|
||||
void *src = spaBuffer->datas[0].data;
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
if (!src && spaBuffer->datas->type != SPA_DATA_DmaBuf) {
|
||||
qCDebug(KRFB_FB_PIPEWIRE) << "discarding null buffer";
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
const quint32 maxSize = spaBuffer->datas[0].maxsize;
|
||||
|
||||
std::function<void()> cleanup;
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
#ifdef HAVE_LINUX_DMABUF_H
|
||||
if (spaBuffer->datas->type == SPA_DATA_DmaBuf) {
|
||||
const int fd = spaBuffer->datas[0].fd;
|
||||
auto map = mmap(
|
||||
nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
||||
PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (map == MAP_FAILED) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to mmap the dmabuf: " << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
syncDmaBuf(fd, DMA_BUF_SYNC_START);
|
||||
src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
|
||||
|
||||
cleanup = [map, spaBuffer, fd] {
|
||||
syncDmaBuf(fd, DMA_BUF_SYNC_END);
|
||||
munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset);
|
||||
};
|
||||
} else
|
||||
#endif
|
||||
if (spaBuffer->datas->type == SPA_DATA_MemFd) {
|
||||
uint8_t *map = static_cast<uint8_t*>(mmap(
|
||||
nullptr, spaBuffer->datas->maxsize + spaBuffer->datas->mapoffset,
|
||||
PROT_READ, MAP_PRIVATE, spaBuffer->datas->fd, 0));
|
||||
|
||||
if (map == MAP_FAILED) {
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Failed to mmap the memory: " << strerror(errno);
|
||||
return;
|
||||
}
|
||||
src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
|
||||
|
||||
cleanup = [map, spaBuffer] {
|
||||
munmap(map, spaBuffer->datas->maxsize + spaBuffer->datas->mapoffset);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
||||
q->tiles.append(QRect(0, 0, q->width(), q->height()));
|
||||
std::memcpy(q->fb, src, maxSize);
|
||||
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) {
|
||||
const QImage::Format format = videoFormat->format == SPA_VIDEO_FORMAT_BGR ? QImage::Format_BGR888
|
||||
: videoFormat->format == SPA_VIDEO_FORMAT_RGBx ? QImage::Format_RGBX8888
|
||||
: QImage::Format_RGB32;
|
||||
|
||||
QImage img((uchar*) q->fb, videoFormat->size.width, videoFormat->size.height, spaBuffer->datas->chunk->stride, format);
|
||||
img.convertTo(QImage::Format_RGB888);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PWFrameBuffer::Private::createReceivingStream - create a stream that will consume Pipewire buffers
|
||||
* and copy the framebuffer to the existing image that we track. The state of the stream and configuration
|
||||
* are later handled by the corresponding listener.
|
||||
*/
|
||||
pw_stream *PWFrameBuffer::Private::createReceivingStream()
|
||||
{
|
||||
spa_rectangle pwMinScreenBounds = SPA_RECTANGLE(1, 1);
|
||||
spa_rectangle pwMaxScreenBounds = SPA_RECTANGLE(screenGeometry.width, screenGeometry.height);
|
||||
|
||||
spa_fraction pwFramerateMin = SPA_FRACTION(0, 1);
|
||||
spa_fraction pwFramerateMax = SPA_FRACTION(60, 1);
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
auto stream = pw_stream_new_simple(pw_thread_loop_get_loop(pwMainLoop), "krfb-fb-consume-stream",
|
||||
pw_properties_new(PW_KEY_MEDIA_TYPE, "Video",
|
||||
PW_KEY_MEDIA_CATEGORY, "Capture",
|
||||
PW_KEY_MEDIA_ROLE, "Screen",
|
||||
nullptr),
|
||||
&pwStreamEvents, this);
|
||||
|
||||
#else
|
||||
auto reuseProps = pw_properties_new("pipewire.client.reuse", "1", nullptr); // null marks end of varargs
|
||||
auto stream = pw_stream_new(pwRemote, "krfb-fb-consume-stream", reuseProps);
|
||||
#endif
|
||||
uint8_t buffer[1024] = {};
|
||||
const spa_pod *params[1];
|
||||
auto builder = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
||||
SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
|
||||
SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
|
||||
SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
|
||||
SPA_FORMAT_VIDEO_format, SPA_POD_CHOICE_ENUM_Id(6,
|
||||
SPA_VIDEO_FORMAT_RGBx, SPA_VIDEO_FORMAT_RGBA,
|
||||
SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_BGRA,
|
||||
SPA_VIDEO_FORMAT_RGB, SPA_VIDEO_FORMAT_BGR),
|
||||
SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle(&pwMaxScreenBounds, &pwMinScreenBounds, &pwMaxScreenBounds),
|
||||
SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&pwFramerateMin),
|
||||
SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&pwFramerateMax, &pwFramerateMin, &pwFramerateMax)));
|
||||
#else
|
||||
params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_object(&builder,
|
||||
pwCoreType->param.idEnumFormat, pwCoreType->spa_format,
|
||||
"I", pwType->media_type.video,
|
||||
"I", pwType->media_subtype.raw,
|
||||
":", pwType->format_video.format, "I", pwType->video_format.RGBx,
|
||||
":", pwType->format_video.size, "Rru", &pwMaxScreenBounds, SPA_POD_PROP_MIN_MAX(&pwMinScreenBounds, &pwMaxScreenBounds),
|
||||
":", pwType->format_video.framerate, "F", &pwFramerateMin,
|
||||
":", pwType->format_video.max_framerate, "Fru", &pwFramerateMax, 2, &pwFramerateMin, &pwFramerateMax));
|
||||
pw_stream_add_listener(stream, &streamListener, &pwStreamEvents, this);
|
||||
#endif
|
||||
|
||||
auto flags = static_cast<pw_stream_flags>(PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE | PW_STREAM_FLAG_MAP_BUFFERS);
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
if (pw_stream_connect(stream, PW_DIRECTION_INPUT, PW_ID_ANY, flags, params, 1) != 0) {
|
||||
#else
|
||||
if (pw_stream_connect(stream, PW_DIRECTION_INPUT, nullptr, flags, params, 1) != 0) {
|
||||
#endif
|
||||
qCWarning(KRFB_FB_PIPEWIRE) << "Could not connect receiving stream";
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
PWFrameBuffer::Private::~Private()
|
||||
{
|
||||
if (pwMainLoop) {
|
||||
pw_thread_loop_stop(pwMainLoop);
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 9)
|
||||
if (pwType) {
|
||||
delete pwType;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pwStream) {
|
||||
pw_stream_destroy(pwStream);
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
if (pwRemote) {
|
||||
pw_remote_destroy(pwRemote);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PW_CHECK_VERSION(0, 2, 90)
|
||||
if (pwCore) {
|
||||
pw_core_disconnect(pwCore);
|
||||
}
|
||||
|
||||
if (pwContext) {
|
||||
pw_context_destroy(pwContext);
|
||||
}
|
||||
#else
|
||||
if (pwCore) {
|
||||
pw_core_destroy(pwCore);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pwMainLoop) {
|
||||
pw_thread_loop_destroy(pwMainLoop);
|
||||
}
|
||||
|
||||
#if !PW_CHECK_VERSION(0, 2, 90)
|
||||
if (pwLoop) {
|
||||
pw_loop_leave(pwLoop);
|
||||
pw_loop_destroy(pwLoop);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PWFrameBuffer::PWFrameBuffer(WId winid, QObject *parent)
|
||||
: FrameBuffer (winid, parent),
|
||||
d(new Private(this))
|
||||
{
|
||||
// D-Bus is most important in init chain, no toys for us if something is wrong with XDP
|
||||
// PipeWire connectivity is initialized after D-Bus session is started
|
||||
d->initDbus();
|
||||
|
||||
// FIXME: for now use some initial size, later on we will reallocate this with the actual size we get from portal
|
||||
d->screenGeometry.width = 800;
|
||||
d->screenGeometry.height = 600;
|
||||
fb = nullptr;
|
||||
}
|
||||
|
||||
PWFrameBuffer::~PWFrameBuffer()
|
||||
{
|
||||
free(fb);
|
||||
fb = nullptr;
|
||||
}
|
||||
|
||||
int PWFrameBuffer::depth()
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
int PWFrameBuffer::height()
|
||||
{
|
||||
return static_cast<qint32>(d->screenGeometry.height);
|
||||
}
|
||||
|
||||
int PWFrameBuffer::width()
|
||||
{
|
||||
return static_cast<qint32>(d->screenGeometry.width);
|
||||
}
|
||||
|
||||
int PWFrameBuffer::paddedWidth()
|
||||
{
|
||||
return width() * 4;
|
||||
}
|
||||
|
||||
void PWFrameBuffer::getServerFormat(rfbPixelFormat &format)
|
||||
{
|
||||
format.bitsPerPixel = 32;
|
||||
format.depth = 32;
|
||||
format.trueColour = true;
|
||||
format.bigEndian = false;
|
||||
}
|
||||
|
||||
void PWFrameBuffer::startMonitor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PWFrameBuffer::stopMonitor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QVariant PWFrameBuffer::customProperty(const QString &property) const
|
||||
{
|
||||
if (property == QLatin1String("stream_node_id")) {
|
||||
return QVariant::fromValue<uint>(d->pwStreamNodeId);
|
||||
} if (property == QLatin1String("session_handle")) {
|
||||
return QVariant::fromValue<QDBusObjectPath>(d->sessionPath);
|
||||
}
|
||||
|
||||
return FrameBuffer::customProperty(property);
|
||||
}
|
||||
|
||||
bool PWFrameBuffer::isValid() const
|
||||
{
|
||||
return d->isValid;
|
||||
}
|
||||
59
framebuffers/pipewire/pw_framebuffer.h
Normal file
59
framebuffers/pipewire/pw_framebuffer.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2018 Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
Copyright (C) 2018-2020 Jan Grulich <jgrulich@redhat.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
*/
|
||||
#ifndef KRFB_FRAMEBUFFER_XCB_XCB_FRAMEBUFFER_H
|
||||
#define KRFB_FRAMEBUFFER_XCB_XCB_FRAMEBUFFER_H
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include <QWidget>
|
||||
#include <QVariantMap>
|
||||
|
||||
/**
|
||||
* @brief The PWFrameBuffer class - framebuffer implementation based on XDG Desktop Portal ScreenCast interface.
|
||||
* The design relies heavily on a presence of XDG D-Bus service and PipeWire daemon.
|
||||
*
|
||||
* @author Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
*/
|
||||
class PWFrameBuffer: public FrameBuffer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef struct {
|
||||
uint nodeId;
|
||||
QVariantMap map;
|
||||
} Stream;
|
||||
typedef QList<Stream> Streams;
|
||||
|
||||
PWFrameBuffer(WId winid, QObject *parent = nullptr);
|
||||
virtual ~PWFrameBuffer() override;
|
||||
|
||||
int depth() override;
|
||||
int height() override;
|
||||
int width() override;
|
||||
int paddedWidth() override;
|
||||
void getServerFormat(rfbPixelFormat &format) override;
|
||||
void startMonitor() override;
|
||||
void stopMonitor() override;
|
||||
|
||||
QVariant customProperty(const QString &property) const override;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void handleXdpSessionCreated(quint32 code, QVariantMap results);
|
||||
void handleXdpDevicesSelected(quint32 code, QVariantMap results);
|
||||
void handleXdpSourcesSelected(quint32 code, QVariantMap results);
|
||||
void handleXdpRemoteDesktopStarted(quint32 code, QVariantMap results);
|
||||
|
||||
private:
|
||||
class Private;
|
||||
const QScopedPointer<Private> d;
|
||||
};
|
||||
|
||||
#endif
|
||||
53
framebuffers/pipewire/pw_framebufferplugin.cpp
Normal file
53
framebuffers/pipewire/pw_framebufferplugin.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2018 Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "pw_framebufferplugin.h"
|
||||
#include "pw_framebuffer.h"
|
||||
#include <KPluginFactory>
|
||||
|
||||
|
||||
K_PLUGIN_FACTORY_WITH_JSON(PWFrameBufferPluginFactory, "krfb_framebuffer_pw.json",
|
||||
registerPlugin<PWFrameBufferPlugin>();)
|
||||
|
||||
PWFrameBufferPlugin::PWFrameBufferPlugin(QObject *parent, const QVariantList &args)
|
||||
: FrameBufferPlugin(parent, args)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PWFrameBufferPlugin::~PWFrameBufferPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FrameBuffer *PWFrameBufferPlugin::frameBuffer(WId id)
|
||||
{
|
||||
auto pwfb = new PWFrameBuffer(id);
|
||||
|
||||
// sanity check for dbus/wayland/pipewire errors
|
||||
if (!pwfb->isValid()) {
|
||||
delete pwfb;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pwfb;
|
||||
}
|
||||
|
||||
#include "pw_framebufferplugin.moc"
|
||||
45
framebuffers/pipewire/pw_framebufferplugin.h
Normal file
45
framebuffers/pipewire/pw_framebufferplugin.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2018 Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KRFB_FRAMEBUFFER_PW_PWFRAMEBUFFERPLUGIN_H
|
||||
#define KRFB_FRAMEBUFFER_PW_PWFRAMEBUFFERPLUGIN_H
|
||||
|
||||
|
||||
#include "framebufferplugin.h"
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
class FrameBuffer;
|
||||
|
||||
class PWFrameBufferPlugin: public FrameBufferPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PWFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
virtual ~PWFrameBufferPlugin() override;
|
||||
|
||||
FrameBuffer *frameBuffer(WId id) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(PWFrameBufferPlugin)
|
||||
};
|
||||
|
||||
|
||||
#endif // Header guard
|
||||
@@ -7,6 +7,14 @@ 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}
|
||||
@@ -20,5 +28,5 @@ target_link_libraries (krfb_framebuffer_qt
|
||||
)
|
||||
|
||||
install (TARGETS krfb_framebuffer_qt
|
||||
DESTINATION ${PLUGIN_INSTALL_DIR}/krfb
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
|
||||
)
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Comment=Qt based Framebuffer for KRfb.
|
||||
Comment[ast]=Búfer de cuadros basáu en Qt pa KRfb.
|
||||
Comment[bg]=Основан на Qt фреймбуфер за KRfb.
|
||||
Comment[bs]=Kadrobafer za KRfb na osnovu Qt.
|
||||
Comment[ca]=«Framebuffer» basat en les Qt per al KRfb.
|
||||
Comment[ca@valencia]=«Framebuffer» basat en les Qt per al KRfb.
|
||||
Comment[cs]=Framebuffer založený na Qt pro KRfb.
|
||||
Comment[da]=Qt-baseret framebuffer til KRfb.
|
||||
Comment[de]=Qt-basierter Framebuffer für KRfb
|
||||
Comment[el]=Μνήμη εξόδου βίντεο καρέ με βάση το Qt για το KRfb.
|
||||
Comment[en_GB]=Qt based Framebuffer for KRfb.
|
||||
Comment[es]=Memoria intermedia de vídeo basada en Qt para KRfb.
|
||||
Comment[et]=KRfb Qt põhine kaadripuhver
|
||||
Comment[eu]=Qt-n oinarritutako KRfb-ren irteerako bideoa
|
||||
Comment[fi]=QT-perustainen Kehyspuskuri KRfb:lle
|
||||
Comment[fr]=Sortie vidéo fondée sur Qt pour Krfb.
|
||||
Comment[ga]=Maolán fráma le haghaidh KRfb, bunaithe ar Qt.
|
||||
Comment[gl]=Framebuffer baseado en Qt para KRfb.
|
||||
Comment[hr]=Međuspremnik okvira baziran na Qt-u za KRfb.
|
||||
Comment[hu]=Qt-alapú framebuffer a Krfb-hez.
|
||||
Comment[ia]=Framebuffer basate sur Qt per KRfb
|
||||
Comment[id]=Framebuffer berbasiskan Qt untuk KRfb.
|
||||
Comment[it]=Framebuffer basato su Qt per KRfb.
|
||||
Comment[kk]=Qt негіздеген KRfb-нің кадр буфері.
|
||||
Comment[km]=Framebuffer មានមូលដ្ឋានលើ Qt សម្រាប់ KRfb ។
|
||||
Comment[ko]=KRfb를 위한 Qt 기반 프레임버퍼.
|
||||
Comment[lt]=Qt pagrindu veikiantis Framebuffer skirtas KRfb.
|
||||
Comment[lv]=Qt balstīts kadrbuferis priekš KRfb.
|
||||
Comment[nb]=Qt-basert rammebuffer for KRfb.
|
||||
Comment[nds]=Op Qt opbuut Bildpuffer för KRfb
|
||||
Comment[nl]=Op Qt gebaseerd framebuffer voor KRfb.
|
||||
Comment[nn]=Qt basert framebuffer for KRfb.
|
||||
Comment[pl]=Bufor ramki na podstawie Qt dla KRfb.
|
||||
Comment[pt]='Framebuffer' baseado no Qt para o KRfb.
|
||||
Comment[pt_BR]=Framebuffer baseado no Qt para o KRfb.
|
||||
Comment[ru]=Буфер экрана для KRfb на базе Qt.
|
||||
Comment[si]=KRfb සඳහා Qt මත පදනම් වූ රාමු බෆරය
|
||||
Comment[sk]=Framebuffer založený na Qt pre KRfb.
|
||||
Comment[sl]=Slikovni medpomnilnik za KRFB, ki temelji na Qt
|
||||
Comment[sr]=Кадробафер за КРФБ на основу КуТ‑у
|
||||
Comment[sr@ijekavian]=Кадробафер за КРФБ на основу КуТ‑у
|
||||
Comment[sr@ijekavianlatin]=Kadrobafer za KRFB na osnovu Qt‑u
|
||||
Comment[sr@latin]=Kadrobafer za KRFB na osnovu Qt‑u
|
||||
Comment[sv]=Qt-baserad rambuffert för Krfb.
|
||||
Comment[tr]=KRfb için Qt temelli Çerçeve tamponu.
|
||||
Comment[uk]=Заснований на Qt буфер кадрів для KRfb.
|
||||
Comment[x-test]=xxQt based Framebuffer for KRfb.xx
|
||||
Comment[zh_CN]=基于 Qt 的 KRfb 帧缓冲机制
|
||||
Comment[zh_TW]=KRfb 的 Qt-based Framebuffer
|
||||
Name=Qt Framebuffer for KRfb
|
||||
Name[ast]=Búfer de cuadros Qt pa KRfb
|
||||
Name[bg]=Qt фреймбуфер за KRfb
|
||||
Name[bs]=Qt-ov kadrobafer za KRFB
|
||||
Name[ca]=«Framebuffer» de les Qt per al KRfb.
|
||||
Name[ca@valencia]=«Framebuffer» de les Qt per al KRfb.
|
||||
Name[cs]=Qt Framebuffer pro KRfb
|
||||
Name[da]=Qt-framebuffer til KRfb
|
||||
Name[de]=Qt-Framebuffer für KRfb
|
||||
Name[el]=Qt Framebuffer for KRfb
|
||||
Name[en_GB]=Qt Framebuffer for KRfb
|
||||
Name[es]=Memoria intermedia de vídeo Qt para KRfb
|
||||
Name[et]=KRfb Qt kaadripuhver
|
||||
Name[eu]=KRfb-ren Qt-ko irteerako bideoa
|
||||
Name[fi]=QT-kehyspuskuri KRfb:lle
|
||||
Name[fr]=Sortie vidéo Qt pour Krfb
|
||||
Name[ga]=Maolán fráma Qt le haghaidh KRfb
|
||||
Name[gl]=Framebuffer de Qt para KRfb
|
||||
Name[hr]=Qt Framebuffer za KRfb
|
||||
Name[hu]=Qt framebuffer a Krfb-hez
|
||||
Name[ia]=Framebuffer Qt per KRfb
|
||||
Name[id]=Qt Framebuffer untuk KRfb
|
||||
Name[it]=Framebuffer Qt per KRfb
|
||||
Name[kk]=Qt KRfb кадр буфері
|
||||
Name[km]=Qt Framebuffer សម្រាប់for KRfb
|
||||
Name[ko]=KRfb를 위한 Qt 프레임버퍼
|
||||
Name[lt]=Qt Framebufferis skirtas KRfb
|
||||
Name[lv]=Qt kadrbuferis priekš KRfb.
|
||||
Name[nb]=Qt rammebuffer for KRfb
|
||||
Name[nds]=Qt-Bildpuffer för KRfb
|
||||
Name[nl]=Qt-framebuffer voor KRfb
|
||||
Name[nn]=Qt-framebuffer for KRfb
|
||||
Name[pl]=Bufor ramki Qt dla KRfb
|
||||
Name[pt]='Framebuffer' do Qt para o KRfb
|
||||
Name[pt_BR]=Framebuffer do Qt para o KRfb
|
||||
Name[ru]=Буфер экрана Qt для KRfb
|
||||
Name[si]=KRfb සඳහා වන Qt රාමුබෆරය
|
||||
Name[sk]=Qt Framebuffer pre KRfb
|
||||
Name[sl]=Slikovni medpomnilnik Qt za KRFB
|
||||
Name[sr]=КуТ‑ов кадробафер за КРФБ
|
||||
Name[sr@ijekavian]=КуТ‑ов кадробафер за КРФБ
|
||||
Name[sr@ijekavianlatin]=Qt‑ov kadrobafer za KRFB
|
||||
Name[sr@latin]=Qt‑ov kadrobafer za KRFB
|
||||
Name[sv]=Qt-rambuffert för Krfb
|
||||
Name[tr]=KRfb için Qt Çerçeve tamponu
|
||||
Name[uk]=Буфер кадрів на Qt для KRfb
|
||||
Name[x-test]=xxQt Framebuffer for KRfbxx
|
||||
Name[zh_CN]=KRfb 的 Qt 帧缓冲机制
|
||||
Name[zh_TW]=Krfb 的 Qt Framebuffer
|
||||
Type=Service
|
||||
ServiceTypes=krfb/framebuffer
|
||||
|
||||
X-KDE-Library=krfb_framebuffer_qt
|
||||
X-KDE-PluginInfo-Name=qt
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=http://www.kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"Encoding": "UTF-8",
|
||||
"KPlugin": {
|
||||
"Description": "Qt based Framebuffer for KRfb.",
|
||||
"Description[ast]": "Búfer de cuadros basáu en Qt pa KRfb.",
|
||||
"Description[ca@valencia]": "«Framebuffer» basat en les Qt per al KRfb.",
|
||||
"Description[ca]": "«Framebuffer» basat en les Qt per al KRfb.",
|
||||
"Description[cs]": "Framebuffer založený na Qt pro KRfb.",
|
||||
"Description[da]": "Qt-baseret framebuffer til KRfb.",
|
||||
"Description[de]": "Qt-basierter Framebuffer für KRfb",
|
||||
"Description[de]": "Qt-basierter Framebuffer für KRfb.",
|
||||
"Description[el]": "Μνήμη ανανέωσης βίντεο με βάση τhn Qt για το KRfb.",
|
||||
"Description[en_GB]": "Qt based Framebuffer for KRfb.",
|
||||
"Description[es]": "Framebuffer basado en Qt para KRfb.",
|
||||
"Description[et]": "KRfb Qt põhine kaadripuhver",
|
||||
"Description[fi]": "QT-perustainen Kehyspuskuri KRfb:lle",
|
||||
"Description[eu]": "KRfb-rako Qt-n oinarritutako «Framebuffer».",
|
||||
"Description[fi]": "KRfb:n Qt-pohjainen kehyspuskuri.",
|
||||
"Description[fr]": "Tampon d'images utilisant Qt pour KRfb.",
|
||||
"Description[gl]": "Framebuffer baseado en Qt para KRfb.",
|
||||
"Description[ia]": "Framebuffer basate sur Qt per KRfb",
|
||||
@@ -20,12 +20,12 @@
|
||||
"Description[ko]": "KRfb용 Qt 기반 프레임버퍼입니다.",
|
||||
"Description[nl]": "Op Qt gebaseerd framebuffer voor KRfb.",
|
||||
"Description[nn]": "Qt-basert biletbuffer for KRfb.",
|
||||
"Description[pl]": "Bufor ramki na podstawie Qt dla KRfb.",
|
||||
"Description[pl]": "Bufor ramki oparty na Qt dla KRfb.",
|
||||
"Description[pt]": "'Framebuffer' baseado no Qt para o KRfb.",
|
||||
"Description[pt_BR]": "Framebuffer baseado no Qt para o KRfb.",
|
||||
"Description[ru]": "Буфер кадров для KRfb на базе Qt",
|
||||
"Description[sk]": "Framebuffer založený na Qt pre KRfb.",
|
||||
"Description[sl]": "Slikovni medpomnilnik za KRfb, ki temelji na Qt",
|
||||
"Description[sl]": "Slikovni medpomnilnik za KRfb na osnovi Qt.",
|
||||
"Description[sr@ijekavian]": "Кадробафер за КРФБ на основу КуТ‑у",
|
||||
"Description[sr@ijekavianlatin]": "Kadrobafer za KRFB na osnovu Qt‑u",
|
||||
"Description[sr@latin]": "Kadrobafer za KRFB na osnovu Qt‑u",
|
||||
@@ -40,16 +40,17 @@
|
||||
"Id": "qt",
|
||||
"License": "GPL",
|
||||
"Name": "Qt Framebuffer for KRfb",
|
||||
"Name[ast]": "Búfer de cuadros Qt pa KRfb",
|
||||
"Name[ca@valencia]": "«Framebuffer» de les Qt per al KRfb.",
|
||||
"Name[ca]": "«Framebuffer» de les Qt per al KRfb.",
|
||||
"Name[cs]": "Qt Framebuffer pro KRfb",
|
||||
"Name[da]": "Qt-framebuffer til KRfb",
|
||||
"Name[de]": "Qt-Framebuffer für KRfb",
|
||||
"Name[el]": "Μνήμη ανανέωσης βίντεο Qt για το KRfb",
|
||||
"Name[en_GB]": "Qt Framebuffer for KRfb",
|
||||
"Name[es]": "Framebuffer de Qt para KRfb",
|
||||
"Name[et]": "KRfb Qt kaadripuhver",
|
||||
"Name[fi]": "QT-kehyspuskuri KRfb:lle",
|
||||
"Name[eu]": "KRfb-rako Qt «Framebuffer»",
|
||||
"Name[fi]": "KRfb:n Qt-kehyspuskuri",
|
||||
"Name[fr]": "Tampon d'images Qt pour KRfb",
|
||||
"Name[gl]": "Framebuffer de Qt para KRfb",
|
||||
"Name[ia]": "Framebuffer Qt per KRfb",
|
||||
@@ -63,12 +64,12 @@
|
||||
"Name[pt_BR]": "Framebuffer do Qt para o KRfb",
|
||||
"Name[ru]": "Буфер кадров Qt для KRfb",
|
||||
"Name[sk]": "Qt Framebuffer pre KRfb",
|
||||
"Name[sl]": "Slikovni medpomnilnik Qt za KRfb",
|
||||
"Name[sl]": "Slikovni medpomnilnik za KRfb na osnovi Qt",
|
||||
"Name[sr@ijekavian]": "КуТ‑ов кадробафер за КРФБ",
|
||||
"Name[sr@ijekavianlatin]": "Qt‑ov kadrobafer za KRFB",
|
||||
"Name[sr@latin]": "Qt‑ov kadrobafer za KRFB",
|
||||
"Name[sr]": "КуТ‑ов кадробафер за КРФБ",
|
||||
"Name[sv]": "X11-rambuffert för Krfb",
|
||||
"Name[sv]": "QT-rambuffert för Krfb",
|
||||
"Name[tr]": "KRfb için Qt Çerçeve tamponu",
|
||||
"Name[uk]": "Буфер кадрів на Qt для KRfb",
|
||||
"Name[x-test]": "xxQt Framebuffer for KRfbxx",
|
||||
@@ -78,6 +79,6 @@
|
||||
"krfb/framebuffer"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "http://www.kde.org"
|
||||
"Website": "https://www.kde.org"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
#include "qtframebuffer.h"
|
||||
#include "qtframebuffer.moc"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QRegion>
|
||||
@@ -27,10 +26,14 @@ QtFrameBuffer::QtFrameBuffer(WId id, QObject *parent)
|
||||
if (screen) {
|
||||
primaryScreen = screen;
|
||||
fbImage = screen->grabWindow(win).toImage();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
fb = new char[fbImage.sizeInBytes()];
|
||||
#else
|
||||
fb = new char[fbImage.byteCount()];
|
||||
#endif
|
||||
} else {
|
||||
fb = Q_NULLPTR;
|
||||
primaryScreen = Q_NULLPTR;
|
||||
fb = nullptr;
|
||||
primaryScreen = nullptr;
|
||||
}
|
||||
|
||||
t = new QTimer(this);
|
||||
@@ -42,7 +45,7 @@ QtFrameBuffer::~QtFrameBuffer()
|
||||
{
|
||||
if (fb)
|
||||
delete [] fb;
|
||||
fb = 0;
|
||||
fb = nullptr;
|
||||
}
|
||||
|
||||
int QtFrameBuffer::depth()
|
||||
@@ -105,7 +108,11 @@ void QtFrameBuffer::updateFrameBuffer()
|
||||
tiles.append(img.rect());
|
||||
#endif
|
||||
|
||||
memcpy(fb, (const char *)img.bits(), img.byteCount());
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
memcpy(fb, img.bits(), static_cast<size_t>(img.sizeInBytes()));
|
||||
#else
|
||||
memcpy(fb, img.bits(), img.byteCount());
|
||||
#endif
|
||||
fbImage = img;
|
||||
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ class QtFrameBuffer : public FrameBuffer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QtFrameBuffer(WId id, QObject *parent = 0);
|
||||
explicit QtFrameBuffer(WId id, QObject *parent = nullptr);
|
||||
|
||||
~QtFrameBuffer();
|
||||
~QtFrameBuffer() override;
|
||||
|
||||
int depth() override;
|
||||
int height() override;
|
||||
|
||||
@@ -33,7 +33,7 @@ class QtFrameBufferPlugin : public FrameBufferPlugin
|
||||
|
||||
public:
|
||||
QtFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
virtual ~QtFrameBufferPlugin();
|
||||
~QtFrameBufferPlugin() override;
|
||||
|
||||
FrameBuffer *frameBuffer(WId id) override;
|
||||
|
||||
|
||||
@@ -7,6 +7,14 @@ 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
|
||||
@@ -24,5 +32,5 @@ target_link_libraries (krfb_framebuffer_xcb
|
||||
)
|
||||
|
||||
install (TARGETS krfb_framebuffer_xcb
|
||||
DESTINATION ${PLUGIN_INSTALL_DIR}/krfb
|
||||
DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb
|
||||
)
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Comment=X11 XDamage/XShm based Framebuffer for KRfb.
|
||||
Comment[ast]=Búfer de cuadros basáu en XDamage/XShm de X11 pa KRfb.
|
||||
Comment[bg]=Основан на X11 XDamage/XShm фреймбуфер за KRfb.
|
||||
Comment[bs]=X11 XDamage/XShm baziran framebafer za KRfb.
|
||||
Comment[ca]=«Framebuffer» basat en XDamage/XShmQt del X11 per al KRfb.
|
||||
Comment[ca@valencia]=«Framebuffer» basat en XDamage/XShmQt del X11 per al KRfb.
|
||||
Comment[cs]=Framebuffer založený na X11 XDamage/XShm pro KRfb.
|
||||
Comment[da]=X11 XDamage/XShm-baseret framebuffer til KRfb.
|
||||
Comment[de]=X11 XDamage/XShm-basierter Framebuffer für KRfb.
|
||||
Comment[el]=Μνήμη εξόδου βίντεο καρέ με βάση το X11 XDamage/XShm για το KRfb.
|
||||
Comment[en_GB]=X11 XDamage/XShm based Framebuffer for KRfb.
|
||||
Comment[es]=Memoria intermedia de vídeo basada en X11 Damage/XShm para KRfb.
|
||||
Comment[et]=KRfb X11 XDamage/XShm põhine kaadripuhver
|
||||
Comment[eu]=X11 XDamage/XShm oinarritutako KRfb-ren irteerako bideoa.
|
||||
Comment[fi]=X11 XDamage/XShm-perustainen kehyspuskui KRfb:lle.
|
||||
Comment[fr]=Sortie vidéo fondée sur X11 « XDamage / XShm » pour Krfb.
|
||||
Comment[ga]=Maolán fráma le haghaidh KRfb, bunaithe ar X11 XDamage/XShm
|
||||
Comment[gl]=Framebuffer baseado en X11 XDamage/Xshm para XRfb.
|
||||
Comment[hr]=Međuspreminik okvira baziran na X11 XDamage/XShm za KRfb.
|
||||
Comment[hu]=X11 XDamage/XShm-alapú framebuffer a Krfb-hez.
|
||||
Comment[ia]=Framebuffer basate sur X11 XDamage/XShm per KRfb.
|
||||
Comment[id]=Framebuffer berbasiskan X11 XDamage/XShm untuk KRfb.
|
||||
Comment[it]=Framebuffer basato su XDamage/XShm di X11 per KRfb.
|
||||
Comment[kk]=X11 XDamage/XShm негіздеген KRfb кадр буфері.
|
||||
Comment[km]=X11 XDamage/XShm based Framebuffer សម្រាប់ KRfb ។
|
||||
Comment[ko]=KRfb를 위한 X11 XDamage/XShm 기반 프레임버퍼.
|
||||
Comment[lt]=X11 XDamage/XShm paremtas Framebuffer skirtas KRfb.
|
||||
Comment[lv]=X11 XDamage/XShm balstīts kadrbuferis priekš KRfb.
|
||||
Comment[nb]=Rammebuffer for KRfb basert på X11 XDamage/XShm.
|
||||
Comment[nds]=Op X11-XDamage/-XShm opbuut Bildpuffer för KRfb
|
||||
Comment[nl]=Op X11 XDamage/XShm gebaseerd framebuffer voor KRfb.
|
||||
Comment[nn]=X11 XDamage/XShm basert framebuffer for KRfb.
|
||||
Comment[pl]=Bufor ramki na podstawie X11 XDamage/XShm dla KRfb.
|
||||
Comment[pt]='Framebuffer' baseado no XDamage/XShm do X11 para o KRfb.
|
||||
Comment[pt_BR]=Framebuffer baseado no XDamage/XShm do X11 para o KRfb.
|
||||
Comment[ru]=Буфер экрана для KRfb на базе X11 XDamage/XShm
|
||||
Comment[si]=KRfb සඳහා වන රාමු බෆරය මත පදනම් වූ X11 XDamage/XShm.
|
||||
Comment[sk]=Framebuffer založený na X11 XDamage/XShm pre KRfb.
|
||||
Comment[sl]=Slikovni medpomnilnik za KRFB, ki temelji na X11 XDamage/XShm
|
||||
Comment[sr]=Кадробафер за КРФБ на основу Икс‑демиџа/Икс‑схма у Иксу11.
|
||||
Comment[sr@ijekavian]=Кадробафер за КРФБ на основу Икс‑демиџа/Икс‑схма у Иксу11.
|
||||
Comment[sr@ijekavianlatin]=Kadrobafer za KRFB na osnovu XDamagea/XShma u X11.
|
||||
Comment[sr@latin]=Kadrobafer za KRFB na osnovu XDamagea/XShma u X11.
|
||||
Comment[sv]=X11 XDamage/XShm-baserad rambuffert för Krfb.
|
||||
Comment[tr]=KRfb için X11 XDamage/XShm temelli Çerçeve Tamponu.
|
||||
Comment[uk]=Заснований на XDamage/XShm X11 буфер кадрів для KRfb.
|
||||
Comment[x-test]=xxX11 XDamage/XShm based Framebuffer for KRfb.xx
|
||||
Comment[zh_CN]=基于 X11 XDamage/XShm 扩展的 KRfb 帧缓冲机制。
|
||||
Comment[zh_TW]=KRfb 的 X11 XDamage/XShm based Framebuffer
|
||||
Name=X11 Framebuffer for KRfb
|
||||
Name[ast]=Búfer de cuadros de X11 pa KRfb
|
||||
Name[bg]=X11 фреймбуфер за KRfb
|
||||
Name[bs]=X11 frame bafer za KRfb
|
||||
Name[ca]=«Framebuffer» del X11 per al KRfb.
|
||||
Name[ca@valencia]=«Framebuffer» del X11 per al KRfb.
|
||||
Name[cs]=X11 Framebuffer pro KRfb
|
||||
Name[da]=X11-framebuffer til KRfb
|
||||
Name[de]=X11-Framebuffer für KRfb
|
||||
Name[el]=X11 Framebuffer for KRfb
|
||||
Name[en_GB]=X11 Framebuffer for KRfb
|
||||
Name[es]=Memoria intermedia de vídeo X11 para KRfb
|
||||
Name[et]=KRfb X11 kaadripuhver
|
||||
Name[eu]=KRfb-ren X11-ko irteerako bideoa
|
||||
Name[fi]=X11-kehyspuskuri KRfb:lle
|
||||
Name[fr]=Sortie vidéo X11 pour Krfb
|
||||
Name[ga]=Maolán fráma X11 le haghaidh KRfb
|
||||
Name[gl]=Framebuffer de X11 para KRfb
|
||||
Name[hr]=Međuspremnik okvira X11 za KRfb
|
||||
Name[hu]=X11 framebuffer a Krfb-hez
|
||||
Name[ia]=Framebuffer X11 per KRfb
|
||||
Name[id]=Framebuffer X11 untuk KRfb
|
||||
Name[it]=Framebuffer X11 per KRfb
|
||||
Name[kk]=X11 KRfb кадр буфері
|
||||
Name[km]=X11 Framebuffer សម្រាប់ KRfb
|
||||
Name[ko]=KRfb를 위한 X11 프레임버퍼
|
||||
Name[lt]=X11 Framebuffer skirtas KRfb
|
||||
Name[lv]=X11 kadrbuferis priekš KRfb
|
||||
Name[nb]=X11 rammebuffer for KRfb
|
||||
Name[nds]=X11-Bildpuffer för KRfb
|
||||
Name[nl]=X11 framebuffer voor KRfb
|
||||
Name[nn]=X11-framebuffer for KRfb
|
||||
Name[pl]=Bufor ramki X11 dla KRfb
|
||||
Name[pt]='Framebuffer' do X11 para o KRfb
|
||||
Name[pt_BR]=Framebuffer do X11 para o KRfb
|
||||
Name[ru]=Буфер экрана X11 для KRfb
|
||||
Name[si]=KRfb සඳහා X11 රාමු බෆරය
|
||||
Name[sk]=X11 Framebuffer pre KRfb
|
||||
Name[sl]=Slikovni medpomnilnik X11 za KRFB
|
||||
Name[sr]=Икс11 кадробафер за КРФБ.
|
||||
Name[sr@ijekavian]=Икс11 кадробафер за КРФБ.
|
||||
Name[sr@ijekavianlatin]=X11 kadrobafer za KRFB.
|
||||
Name[sr@latin]=X11 kadrobafer za KRFB.
|
||||
Name[sv]=X11-rambuffert för Krfb
|
||||
Name[tr]=KRfb için X11 Çerçeve Tamponu
|
||||
Name[uk]=Буфер кадрів X11 для KRfb
|
||||
Name[x-test]=xxX11 Framebuffer for KRfbxx
|
||||
Name[zh_CN]=KRfb 的 X11 帧缓冲机制
|
||||
Name[zh_TW]=KRfb 的 X11 Framebuffer
|
||||
Type=Service
|
||||
ServiceTypes=krfb/framebuffer
|
||||
|
||||
X-KDE-Library=krfb_framebuffer_xcb
|
||||
X-KDE-PluginInfo-Name=xcb
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=http://www.kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"Encoding": "UTF-8",
|
||||
"KPlugin": {
|
||||
"Description": "X11 XDamage/XShm based Framebuffer for KRfb.",
|
||||
"Description[ast]": "Búfer de cuadros basáu en XDamage/XShm de X11 pa KRfb.",
|
||||
"Description[ca@valencia]": "«Framebuffer» basat en XDamage/XShmQt del X11 per al KRfb.",
|
||||
"Description[ca]": "«Framebuffer» basat en XDamage/XShmQt del X11 per al KRfb.",
|
||||
"Description[ca@valencia]": "«Framebuffer» basat en «XDamage/XShm» de l'X11 per al KRfb.",
|
||||
"Description[ca]": "«Framebuffer» basat en «XDamage/XShm» de l'X11 per al KRfb.",
|
||||
"Description[cs]": "Framebuffer založený na X11 XDamage/XShm pro KRfb.",
|
||||
"Description[da]": "X11 XDamage/XShm-baseret framebuffer til KRfb.",
|
||||
"Description[de]": "X11 XDamage/XShm-basierter Framebuffer für KRfb.",
|
||||
"Description[el]": "Μνήμη ανανέωσης βίντεο με βάση το X11 XDamage/XShm για το KRfb.",
|
||||
"Description[en_GB]": "X11 XDamage/XShm based Framebuffer for KRfb.",
|
||||
"Description[es]": "Framebuffer basado en XDamage/XShm de X11 para KRfb.",
|
||||
"Description[et]": "KRfb X11 XDamage/XShm põhine kaadripuhver",
|
||||
"Description[fi]": "X11 XDamage/XShm-perustainen kehyspuskui KRfb:lle.",
|
||||
"Description[eu]": "KRfb-rako «X11 XDamage/XShm»en oinarritutako «Framebuffer».",
|
||||
"Description[fi]": "KRfb:n X11 XDamage/XShm -pohjainen kehyspuskuri.",
|
||||
"Description[fr]": "Tampon d'images utilisant XDamage/XShm de X11 pour KRfb.",
|
||||
"Description[gl]": "Framebuffer baseado en X11 XDamage/Xshm para XRfb.",
|
||||
"Description[ia]": "Framebuffer basate sur X11 XDamage/XShm per KRfb.",
|
||||
@@ -25,7 +25,7 @@
|
||||
"Description[pt_BR]": "Framebuffer baseado no XDamage/XShm do X11 para o KRfb.",
|
||||
"Description[ru]": "Буфер кадров для KRfb на базе X11 XDamage/XShm",
|
||||
"Description[sk]": "Framebuffer založený na X11 XDamage/XShm pre KRfb.",
|
||||
"Description[sl]": "Slikovni medpomnilnik za KRfb, ki temelji na X11 XDamage/XShm",
|
||||
"Description[sl]": "Slikovni medpomnilnik za KRfb, na osnovi X11 XDamage/XShm.",
|
||||
"Description[sr@ijekavian]": "Кадробафер за КРФБ на основу Икс‑демиџа/Икс‑схма у Иксу11.",
|
||||
"Description[sr@ijekavianlatin]": "Kadrobafer za KRFB na osnovu XDamagea/XShma u X11.",
|
||||
"Description[sr@latin]": "Kadrobafer za KRFB na osnovu XDamagea/XShma u X11.",
|
||||
@@ -40,16 +40,17 @@
|
||||
"Id": "xcb",
|
||||
"License": "GPL",
|
||||
"Name": "X11 Framebuffer for KRfb",
|
||||
"Name[ast]": "Búfer de cuadros de X11 pa KRfb",
|
||||
"Name[ca@valencia]": "«Framebuffer» del X11 per al KRfb.",
|
||||
"Name[ca]": "«Framebuffer» del X11 per al KRfb.",
|
||||
"Name[ca@valencia]": "«Framebuffer» de l'X11 per al KRfb.",
|
||||
"Name[ca]": "«Framebuffer» de l'X11 per al KRfb.",
|
||||
"Name[cs]": "X11 Framebuffer pro KRfb",
|
||||
"Name[da]": "X11-framebuffer til KRfb",
|
||||
"Name[de]": "X11-Framebuffer für KRfb",
|
||||
"Name[el]": "Μνήμη ανανέωσης βίντεο X11 για το KRfb.",
|
||||
"Name[en_GB]": "X11 Framebuffer for KRfb",
|
||||
"Name[es]": "Framebuffer X11 para KRfb",
|
||||
"Name[et]": "KRfb X11 kaadripuhver",
|
||||
"Name[fi]": "X11-kehyspuskuri KRfb:lle",
|
||||
"Name[eu]": "KRfb-rako «X11 Framebuffer»",
|
||||
"Name[fi]": "KRfb:n X11-kehyspuskuri",
|
||||
"Name[fr]": "Tampon d'images X11 pour KRfb",
|
||||
"Name[gl]": "Framebuffer de X11 para KRfb",
|
||||
"Name[ia]": "Framebuffer X11 per KRfb",
|
||||
@@ -63,7 +64,7 @@
|
||||
"Name[pt_BR]": "Framebuffer do X11 para o KRfb",
|
||||
"Name[ru]": "Буфер кадров X11 для KRfb",
|
||||
"Name[sk]": "X11 Framebuffer pre KRfb",
|
||||
"Name[sl]": "Slikovni medpomnilnik X11 za KRfb",
|
||||
"Name[sl]": "Slikovni medpomnilnik za KRfb na osnovi X11",
|
||||
"Name[sr@ijekavian]": "Икс11 кадробафер за КРФБ.",
|
||||
"Name[sr@ijekavianlatin]": "X11 kadrobafer za KRFB.",
|
||||
"Name[sr@latin]": "X11 kadrobafer za KRFB.",
|
||||
@@ -78,6 +79,6 @@
|
||||
"krfb/framebuffer"
|
||||
],
|
||||
"Version": "0.1",
|
||||
"Website": "http://www.kde.org"
|
||||
"Website": "https://www.kde.org"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "xcb_framebuffer.h"
|
||||
#include "xcb_framebuffer.moc"
|
||||
#include "krfb_fb_xcb_debug.h"
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xproto.h>
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
class KrfbXCBEventFilter: public QAbstractNativeEventFilter
|
||||
@@ -33,7 +32,7 @@ public:
|
||||
KrfbXCBEventFilter(XCBFrameBuffer *owner);
|
||||
|
||||
public:
|
||||
virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
|
||||
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
|
||||
|
||||
public:
|
||||
int xdamageBaseEvent;
|
||||
@@ -62,14 +61,14 @@ KrfbXCBEventFilter::KrfbXCBEventFilter(XCBFrameBuffer *owner):
|
||||
QX11Info::connection(),
|
||||
XCB_DAMAGE_MAJOR_VERSION,
|
||||
XCB_DAMAGE_MINOR_VERSION),
|
||||
NULL);
|
||||
nullptr);
|
||||
if (!xdamage_version) {
|
||||
qWarning() << "xcb framebuffer: ERROR: Failed to get XDamage extension version!\n";
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
qDebug() << "xcb framebuffer: XDamage extension version:" <<
|
||||
qCDebug(KRFB_FB_XCB) << "xcb framebuffer: XDamage extension version:" <<
|
||||
xdamage_version->major_version << "." << xdamage_version->minor_version;
|
||||
#endif
|
||||
|
||||
@@ -106,7 +105,7 @@ bool KrfbXCBEventFilter::nativeEventFilter(const QByteArray &eventType,
|
||||
if (xdamageBaseEvent == 0) return false; // no xdamage extension
|
||||
|
||||
if (eventType == "xcb_generic_event_t") {
|
||||
xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
|
||||
auto 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);
|
||||
@@ -136,7 +135,7 @@ public:
|
||||
|
||||
|
||||
static xcb_screen_t *get_xcb_screen(xcb_connection_t *conn, int screen_num) {
|
||||
xcb_screen_t *screen = NULL;
|
||||
xcb_screen_t *screen = nullptr;
|
||||
xcb_screen_iterator_t screens_iter = xcb_setup_roots_iterator(xcb_get_setup(conn));
|
||||
for (; screens_iter.rem; --screen_num, xcb_screen_next(&screens_iter))
|
||||
if (screen_num == 0)
|
||||
@@ -151,24 +150,28 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
{
|
||||
d->running = false;
|
||||
d->damage = XCB_NONE;
|
||||
d->framebufferImage = Q_NULLPTR;
|
||||
d->shminfo.shmaddr = Q_NULLPTR;
|
||||
d->framebufferImage = nullptr;
|
||||
d->shminfo.shmaddr = nullptr;
|
||||
d->shminfo.shmid = XCB_NONE;
|
||||
d->shminfo.shmseg = XCB_NONE;
|
||||
d->updateTile = Q_NULLPTR;
|
||||
d->updateTile = nullptr;
|
||||
d->area.setRect(0, 0, 0, 0);
|
||||
d->x11EvtFilter = new KrfbXCBEventFilter(this);
|
||||
d->rootScreen = get_xcb_screen(QX11Info::connection(), QX11Info::appScreen());
|
||||
|
||||
this->fb = Q_NULLPTR;
|
||||
this->fb = nullptr;
|
||||
|
||||
QScreen *primaryScreen = QGuiApplication::primaryScreen();
|
||||
if (primaryScreen) {
|
||||
qDebug() << "xcb framebuffer: Primary screen: " << primaryScreen->name()
|
||||
qreal scaleFactor = primaryScreen->devicePixelRatio();
|
||||
d->area = { primaryScreen->geometry().topLeft() * scaleFactor,
|
||||
primaryScreen->geometry().bottomRight() * scaleFactor };
|
||||
|
||||
qCDebug(KRFB_FB_XCB) << "xcb framebuffer: Primary screen: " << primaryScreen->name()
|
||||
<< ", geometry: " << primaryScreen->geometry()
|
||||
<< ", device scaling: " << scaleFactor
|
||||
<< ", native size: " << d->area
|
||||
<< ", depth: " << primaryScreen->depth();
|
||||
//
|
||||
d->area = primaryScreen->geometry();
|
||||
} else {
|
||||
qWarning() << "xcb framebuffer: ERROR: Failed to get application's primary screen info!";
|
||||
return;
|
||||
@@ -184,7 +187,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
XCB_IMAGE_FORMAT_Z_PIXMAP);
|
||||
if (d->framebufferImage) {
|
||||
#ifdef _DEBUG
|
||||
qDebug() << "xcb framebuffer: Got primary screen image. bpp: " << d->framebufferImage->bpp
|
||||
qCDebug(KRFB_FB_XCB) << "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;
|
||||
@@ -207,20 +210,20 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
d->area.height(), // height
|
||||
XCB_IMAGE_FORMAT_Z_PIXMAP, // image format
|
||||
d->rootScreen->root_depth, // depth
|
||||
NULL, // base address = 0
|
||||
nullptr, // base address = 0
|
||||
(uint32_t)~0, // bytes = 0xffffffff
|
||||
NULL); // data = 0
|
||||
nullptr); // data = 0
|
||||
if (d->updateTile) {
|
||||
#ifdef _DEBUG
|
||||
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
|
||||
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
|
||||
#endif
|
||||
|
||||
// allocate shared memory block only once, make its size large enough
|
||||
@@ -228,7 +231,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
// so, we get as many bytes as needed for image (updateTile->size)
|
||||
d->shminfo.shmid = shmget(IPC_PRIVATE, d->updateTile->size, IPC_CREAT | 0777);
|
||||
// attached shared memory address is stored both in shminfo structure and in xcb_image_t->data
|
||||
d->shminfo.shmaddr = (uint8_t *)shmat(d->shminfo.shmid, NULL, 0);
|
||||
d->shminfo.shmaddr = (uint8_t *)shmat(d->shminfo.shmid, nullptr, 0);
|
||||
d->updateTile->data = d->shminfo.shmaddr;
|
||||
// we keep updateTile->base == NULL here, so xcb_image_destroy() will not attempt
|
||||
// to free this block, just in case.
|
||||
@@ -238,7 +241,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
xcb_shm_attach(QX11Info::connection(), d->shminfo.shmseg, d->shminfo.shmid, 0);
|
||||
|
||||
#ifdef _DEBUG
|
||||
qDebug() << " shm id: " << d->shminfo.shmseg << ", addr: " << (void *)d->shminfo.shmaddr;
|
||||
qCDebug(KRFB_FB_XCB) << " shm id: " << d->shminfo.shmseg << ", addr: " << (void *)d->shminfo.shmaddr;
|
||||
#endif
|
||||
|
||||
// will return 1 on success (yes!)
|
||||
@@ -256,9 +259,9 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
// will not use shared mem! detach and cleanup
|
||||
xcb_shm_detach(QX11Info::connection(), d->shminfo.shmseg);
|
||||
shmdt(d->shminfo.shmaddr);
|
||||
shmctl(d->shminfo.shmid, IPC_RMID, 0); // mark shm segment as removed
|
||||
shmctl(d->shminfo.shmid, IPC_RMID, nullptr); // mark shm segment as removed
|
||||
d->x11EvtFilter->xshmAvail = false;
|
||||
d->shminfo.shmaddr = Q_NULLPTR;
|
||||
d->shminfo.shmaddr = nullptr;
|
||||
d->shminfo.shmid = XCB_NONE;
|
||||
d->shminfo.shmseg = XCB_NONE;
|
||||
qWarning() << "xcb framebuffer: ERROR: xcb_image_shm_get() result: " << shmget_res;
|
||||
@@ -267,14 +270,14 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
// image is freed, and recreated again for every new damage rectangle
|
||||
// data was allocated manually and points to shared mem;
|
||||
// tell xcb_image_destroy() do not free image data
|
||||
d->updateTile->data = NULL;
|
||||
d->updateTile->data = nullptr;
|
||||
xcb_image_destroy(d->updateTile);
|
||||
d->updateTile = NULL;
|
||||
d->updateTile = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
qDebug() << "xcb framebuffer: XCBFrameBuffer(), xshm base event = " << d->x11EvtFilter->xshmBaseEvent
|
||||
qCDebug(KRFB_FB_XCB) << "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;
|
||||
@@ -290,7 +293,7 @@ XCBFrameBuffer::~XCBFrameBuffer() {
|
||||
//
|
||||
if (d->framebufferImage) {
|
||||
xcb_image_destroy(d->framebufferImage);
|
||||
fb = Q_NULLPTR; // image data was already destroyed by above call
|
||||
fb = nullptr; // image data was already destroyed by above call
|
||||
}
|
||||
if (d->x11EvtFilter->xshmAvail) {
|
||||
// detach shared memory
|
||||
@@ -299,12 +302,12 @@ XCBFrameBuffer::~XCBFrameBuffer() {
|
||||
if (d->shminfo.shmaddr)
|
||||
shmdt(d->shminfo.shmaddr); // detach addr from our address space
|
||||
if (d->shminfo.shmid != XCB_NONE)
|
||||
shmctl(d->shminfo.shmid, IPC_RMID, 0); // mark shm segment as removed
|
||||
shmctl(d->shminfo.shmid, IPC_RMID, nullptr); // mark shm segment as removed
|
||||
}
|
||||
// and delete image used for shared mem
|
||||
if (d->updateTile) {
|
||||
d->updateTile->base = NULL;
|
||||
d->updateTile->data = NULL;
|
||||
d->updateTile->base = nullptr;
|
||||
d->updateTile->data = nullptr;
|
||||
xcb_image_destroy(d->updateTile);
|
||||
}
|
||||
// we don't use d->x11EvtFilter anymore, can delete it now
|
||||
@@ -350,7 +353,7 @@ void XCBFrameBuffer::getServerFormat(rfbPixelFormat &format) {
|
||||
if (!d->framebufferImage) return;
|
||||
|
||||
// get information about XCB visual params
|
||||
xcb_visualtype_t *root_visualtype = NULL; // visual info
|
||||
xcb_visualtype_t *root_visualtype = nullptr; // visual info
|
||||
if (d->rootScreen) {
|
||||
xcb_visualid_t root_visual = d->rootScreen->root_visual;
|
||||
xcb_depth_iterator_t depth_iter;
|
||||
@@ -382,49 +385,52 @@ void XCBFrameBuffer::getServerFormat(rfbPixelFormat &format) {
|
||||
// information about pixels layout
|
||||
|
||||
if (root_visualtype) {
|
||||
uint16_t pixelmaxValue = (1 << root_visualtype->bits_per_rgb_value) - 1;
|
||||
|
||||
#ifdef _DEBUG
|
||||
qDebug("xcb framebuffer: Got info about root visual:\n"
|
||||
" bits per rgb value: %d\n"
|
||||
" red mask: %08x\n"
|
||||
" green mask: %08x\n"
|
||||
" blue mask: %08x\n"
|
||||
" pixelMaxValue = %d\n",
|
||||
" blue mask: %08x\n",
|
||||
(int)root_visualtype->bits_per_rgb_value,
|
||||
root_visualtype->red_mask,
|
||||
root_visualtype->green_mask,
|
||||
root_visualtype->blue_mask,
|
||||
(int)pixelmaxValue);
|
||||
root_visualtype->blue_mask);
|
||||
#endif
|
||||
|
||||
// calculate shifts
|
||||
format.redShift = 0;
|
||||
format.redMax = pixelmaxValue;
|
||||
if (root_visualtype->red_mask) {
|
||||
while (!(root_visualtype->red_mask & (1 << format.redShift))) {
|
||||
format.redShift++;
|
||||
}
|
||||
}
|
||||
format.greenShift = 0;
|
||||
format.greenMax = pixelmaxValue;
|
||||
if (root_visualtype->green_mask) {
|
||||
while (!(root_visualtype->green_mask & (1 << format.greenShift))) {
|
||||
format.greenShift++;
|
||||
}
|
||||
}
|
||||
format.blueShift = 0;
|
||||
format.blueMax = pixelmaxValue;
|
||||
if (root_visualtype->blue_mask) {
|
||||
while (!(root_visualtype->blue_mask & (1 << format.blueShift))) {
|
||||
format.blueShift++;
|
||||
}
|
||||
}
|
||||
|
||||
// calculate pixel max value.
|
||||
// NOTE: bits_per_rgb_value is unreliable, thus should be avoided.
|
||||
format.redMax = root_visualtype->red_mask >> format.redShift;
|
||||
format.greenMax = root_visualtype->green_mask >> format.greenShift;
|
||||
format.blueMax = root_visualtype->blue_mask >> format.blueShift;
|
||||
|
||||
#ifdef _DEBUG
|
||||
qDebug() << " Calculated redShift =" << (int)format.redShift;
|
||||
qDebug() << " Calculated greenShift =" << (int)format.greenShift;
|
||||
qDebug() << " Calculated blueShift =" << (int)format.blueShift;
|
||||
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
|
||||
format.redMax, format.greenMax, format.blueMax);
|
||||
#endif
|
||||
} else {
|
||||
// some kind of fallback (unlikely code execution will go this way)
|
||||
@@ -477,10 +483,10 @@ void XCBFrameBuffer::cleanupRects() {
|
||||
QRect ri = r.intersected(d->area);
|
||||
|
||||
if (tiles.size() > 0) {
|
||||
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;
|
||||
for (auto &tile : tiles) {
|
||||
// if current rect has intersection with tile, unite them
|
||||
if (ri.intersects(tile)) {
|
||||
tile |= ri;
|
||||
inserted = true;
|
||||
break;
|
||||
}
|
||||
@@ -498,25 +504,25 @@ void XCBFrameBuffer::cleanupRects() {
|
||||
|
||||
// increase all rectangles size by 30 pixels each side.
|
||||
// limit coordinates to primary monitor boundaries.
|
||||
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());
|
||||
for (auto &tile : tiles) {
|
||||
tile.adjust(-30, -30, 30, 30);
|
||||
if (tile.top() < d->area.top()) {
|
||||
tile.setTop(d->area.top());
|
||||
}
|
||||
if (tiles[i].bottom() > d->area.bottom()) {
|
||||
tiles[i].setBottom(d->area.bottom());
|
||||
if (tile.bottom() > d->area.bottom()) {
|
||||
tile.setBottom(d->area.bottom());
|
||||
}
|
||||
//
|
||||
if (tiles[i].left() < d->area.left()) {
|
||||
tiles[i].setLeft(d->area.left());
|
||||
if (tile.left() < d->area.left()) {
|
||||
tile.setLeft(d->area.left());
|
||||
}
|
||||
if (tiles[i].right() > d->area.right()) {
|
||||
tiles[i].setRight(d->area.right());
|
||||
if (tile.right() > d->area.right()) {
|
||||
tile.setRight(d->area.right());
|
||||
}
|
||||
// move update rects so that they are positioned relative to
|
||||
// framebuffer image, not whole screen
|
||||
tiles[i].moveTo(tiles[i].left() - d->area.left(),
|
||||
tiles[i].top() - d->area.top());
|
||||
tile.moveTo(tile.left() - d->area.left(),
|
||||
tile.top() - d->area.top());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,7 +566,7 @@ QList<QRect> XCBFrameBuffer::modifiedTiles() {
|
||||
0);
|
||||
|
||||
xcb_shm_get_image_reply_t *sgi_reply = xcb_shm_get_image_reply(
|
||||
QX11Info::connection(), sgi_cookie, NULL);
|
||||
QX11Info::connection(), sgi_cookie, nullptr);
|
||||
if (sgi_reply) {
|
||||
// create temporary image to get update rect contents into
|
||||
d->updateTile = xcb_image_create_native(
|
||||
@@ -569,9 +575,9 @@ QList<QRect> XCBFrameBuffer::modifiedTiles() {
|
||||
r.height(),
|
||||
XCB_IMAGE_FORMAT_Z_PIXMAP,
|
||||
d->rootScreen->root_depth,
|
||||
NULL, // base == 0
|
||||
nullptr, // base == 0
|
||||
(uint32_t)~0, // bytes == ~0
|
||||
NULL);
|
||||
nullptr);
|
||||
|
||||
if (d->updateTile) {
|
||||
d->updateTile->data = d->shminfo.shmaddr;
|
||||
@@ -588,9 +594,9 @@ QList<QRect> XCBFrameBuffer::modifiedTiles() {
|
||||
}
|
||||
|
||||
// delete temporary image
|
||||
d->updateTile->data = NULL;
|
||||
d->updateTile->data = nullptr;
|
||||
xcb_image_destroy(d->updateTile);
|
||||
d->updateTile = NULL;
|
||||
d->updateTile = nullptr;
|
||||
}
|
||||
|
||||
free(sgi_reply);
|
||||
@@ -599,7 +605,7 @@ QList<QRect> XCBFrameBuffer::modifiedTiles() {
|
||||
} else {
|
||||
// not using shared memory
|
||||
// will use just xcb_image_get() and copy pixels
|
||||
foreach(const QRect &r, tiles) {
|
||||
for (const QRect& r : qAsConst(tiles)) {
|
||||
// I did not find XGetSubImage() analog in XCB!!
|
||||
// need function that copies pixels from one image to another
|
||||
xcb_image_t *damagedImage = xcb_image_get(
|
||||
@@ -676,7 +682,7 @@ void XCBFrameBuffer::stopMonitor() {
|
||||
|
||||
|
||||
void XCBFrameBuffer::handleXDamageNotify(xcb_generic_event_t *xevent) {
|
||||
xcb_damage_notify_event_t *xdevt = (xcb_damage_notify_event_t *)xevent;
|
||||
auto 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);
|
||||
|
||||
@@ -22,18 +22,18 @@ class XCBFrameBuffer: public FrameBuffer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
XCBFrameBuffer(WId winid, QObject *parent = 0);
|
||||
~XCBFrameBuffer();
|
||||
explicit XCBFrameBuffer(WId winid, QObject *parent = nullptr);
|
||||
~XCBFrameBuffer() override;
|
||||
|
||||
public:
|
||||
QList<QRect> modifiedTiles() Q_DECL_OVERRIDE;
|
||||
int depth() Q_DECL_OVERRIDE;
|
||||
int height() Q_DECL_OVERRIDE;
|
||||
int width() Q_DECL_OVERRIDE;
|
||||
int paddedWidth() Q_DECL_OVERRIDE;
|
||||
void getServerFormat(rfbPixelFormat &format) Q_DECL_OVERRIDE;
|
||||
void startMonitor() Q_DECL_OVERRIDE;
|
||||
void stopMonitor() Q_DECL_OVERRIDE;
|
||||
QList<QRect> modifiedTiles() override;
|
||||
int depth() override;
|
||||
int height() override;
|
||||
int width() override;
|
||||
int paddedWidth() override;
|
||||
void getServerFormat(rfbPixelFormat &format) override;
|
||||
void startMonitor() override;
|
||||
void stopMonitor() override;
|
||||
|
||||
public:
|
||||
void handleXDamageNotify(xcb_generic_event_t *xevent);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This file is part of the KDE project
|
||||
@author Alexey Min <alexey.min@gmail.com>
|
||||
Copyright (C) 2017 Alexey Min <alexey.min@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
|
||||
@@ -33,7 +33,7 @@ class XCBFrameBufferPlugin: public FrameBufferPlugin
|
||||
|
||||
public:
|
||||
XCBFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
virtual ~XCBFrameBufferPlugin();
|
||||
~XCBFrameBufferPlugin() override;
|
||||
|
||||
FrameBuffer *frameBuffer(WId id) override;
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
[Project]
|
||||
Manager=KDevCMakeManager
|
||||
Name=krfb
|
||||
@@ -11,6 +11,8 @@ include(GenerateExportHeader)
|
||||
set (krfbprivate_SRCS
|
||||
framebuffer.cpp
|
||||
framebufferplugin.cpp
|
||||
events.cpp
|
||||
eventsplugin.cpp
|
||||
)
|
||||
|
||||
add_library (krfbprivate
|
||||
@@ -19,6 +21,7 @@ add_library (krfbprivate
|
||||
)
|
||||
generate_export_header(krfbprivate BASE_NAME krfbprivate)
|
||||
|
||||
|
||||
target_link_libraries (krfbprivate
|
||||
Qt5::Core
|
||||
Qt5::Widgets
|
||||
@@ -33,13 +36,14 @@ set_target_properties (krfbprivate PROPERTIES
|
||||
)
|
||||
|
||||
install (TARGETS krfbprivate
|
||||
${INSTALL_TARGETS_DEFAULT_ARGS}
|
||||
${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
|
||||
LIBRARY NAMELINK_SKIP
|
||||
)
|
||||
|
||||
install (FILES
|
||||
krfb-framebuffer.desktop
|
||||
DESTINATION ${SERVICETYPES_INSTALL_DIR}
|
||||
krfb-events.desktop
|
||||
DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}
|
||||
)
|
||||
|
||||
#####################################
|
||||
@@ -48,8 +52,9 @@ install (FILES
|
||||
|
||||
set (krfb_SRCS
|
||||
connectiondialog.cpp
|
||||
events.cpp
|
||||
framebuffermanager.cpp
|
||||
events.cpp
|
||||
eventsmanager.cpp
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
sockethelpers.cpp
|
||||
@@ -61,6 +66,14 @@ 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
|
||||
)
|
||||
@@ -73,6 +86,10 @@ ki18n_wrap_ui (krfb_SRCS
|
||||
ui/mainwidget.ui
|
||||
)
|
||||
|
||||
qt5_add_resources(krfb_SRCS
|
||||
krfb.qrc
|
||||
)
|
||||
|
||||
add_executable (krfb
|
||||
${krfb_SRCS}
|
||||
)
|
||||
@@ -84,7 +101,6 @@ target_link_libraries (krfb
|
||||
${X11_X11_LIB}
|
||||
${X11_Xdamage_LIB}
|
||||
Qt5::Network
|
||||
KF5::Completion
|
||||
KF5::CoreAddons
|
||||
KF5::DBusAddons
|
||||
KF5::DNSSD
|
||||
@@ -92,6 +108,7 @@ target_link_libraries (krfb
|
||||
KF5::Notifications
|
||||
KF5::Wallet
|
||||
KF5::WidgetsAddons
|
||||
KF5::WindowSystem
|
||||
KF5::XmlGui
|
||||
${LIBVNCSERVER_LIBRARIES}
|
||||
)
|
||||
@@ -103,13 +120,13 @@ if (X11_XTest_FOUND)
|
||||
endif (X11_XTest_FOUND)
|
||||
|
||||
install (TARGETS krfb
|
||||
${INSTALL_TARGETS_DEFAULT_ARGS}
|
||||
${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
|
||||
)
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install (PROGRAMS org.kde.krfb.desktop
|
||||
DESTINATION ${XDG_APPS_INSTALL_DIR}
|
||||
DESTINATION ${KDE_INSTALL_APPDIR}
|
||||
)
|
||||
|
||||
install(FILES org.kde.krfb.appdata.xml
|
||||
@@ -117,6 +134,6 @@ install(FILES org.kde.krfb.appdata.xml
|
||||
)
|
||||
|
||||
install (FILES krfb.notifyrc
|
||||
DESTINATION ${DATA_INSTALL_DIR}/krfb
|
||||
DESTINATION ${KDE_INSTALL_DATADIR}/krfb
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
|
||||
m_connectWidget = new QWidget(this);
|
||||
m_ui.setupUi(m_connectWidget);
|
||||
|
||||
m_ui.pixmapLabel->setPixmap(QIcon::fromTheme("krfb").pixmap(128));
|
||||
m_ui.pixmapLabel->setPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(128));
|
||||
|
||||
KGuiItem accept = KStandardGuiItem::ok();
|
||||
accept.setText(i18n("Accept Connection"));
|
||||
@@ -80,7 +80,3 @@ void InvitationsConnectionDialog::setRemoteHost(const QString &host)
|
||||
{
|
||||
m_ui.remoteHost->setText(host);
|
||||
}
|
||||
|
||||
//**********
|
||||
|
||||
#include "connectiondialog.moc"
|
||||
|
||||
@@ -29,8 +29,8 @@ template <typename UI>
|
||||
class ConnectionDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
ConnectionDialog(QWidget *parent);
|
||||
~ConnectionDialog() {};
|
||||
explicit ConnectionDialog(QWidget *parent);
|
||||
~ConnectionDialog() override {};
|
||||
|
||||
void setAllowRemoteControl(bool b);
|
||||
bool allowRemoteControl();
|
||||
@@ -59,7 +59,7 @@ class InvitationsConnectionDialog : public ConnectionDialog<Ui::ConnectionWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
InvitationsConnectionDialog(QWidget *parent);
|
||||
explicit InvitationsConnectionDialog(QWidget *parent);
|
||||
void setRemoteHost(const QString & host);
|
||||
};
|
||||
|
||||
|
||||
172
krfb/events.cpp
172
krfb/events.cpp
@@ -24,177 +24,17 @@
|
||||
|
||||
#include "events.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QX11Info>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/extensions/XTest.h>
|
||||
|
||||
enum {
|
||||
LEFTSHIFT = 1,
|
||||
RIGHTSHIFT = 2,
|
||||
ALTGR = 4
|
||||
};
|
||||
|
||||
class EventData
|
||||
EventHandler::EventHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
public:
|
||||
EventData();
|
||||
|
||||
//keyboard
|
||||
Display *dpy;
|
||||
signed char modifiers[0x100];
|
||||
KeyCode keycodes[0x100];
|
||||
KeyCode leftShiftCode;
|
||||
KeyCode rightShiftCode;
|
||||
KeyCode altGrCode;
|
||||
char modifierState;
|
||||
|
||||
//mouse
|
||||
int buttonMask;
|
||||
|
||||
private:
|
||||
void init();
|
||||
};
|
||||
|
||||
Q_GLOBAL_STATIC(EventData, data)
|
||||
|
||||
EventData::EventData()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void EventData::init()
|
||||
void EventHandler::setFrameBufferPlugin(const QSharedPointer<FrameBuffer> &frameBuffer)
|
||||
{
|
||||
dpy = QX11Info::display();
|
||||
buttonMask = 0;
|
||||
|
||||
//initialize keycodes
|
||||
KeySym key, *keymap;
|
||||
int i, j, minkey, maxkey, syms_per_keycode;
|
||||
|
||||
memset(modifiers, -1, sizeof(modifiers));
|
||||
|
||||
XDisplayKeycodes(dpy, &minkey, &maxkey);
|
||||
Q_ASSERT(minkey >= 8);
|
||||
Q_ASSERT(maxkey < 256);
|
||||
keymap = (KeySym *) XGetKeyboardMapping(dpy, minkey,
|
||||
(maxkey - minkey + 1),
|
||||
&syms_per_keycode);
|
||||
Q_ASSERT(keymap);
|
||||
|
||||
for (i = minkey; i <= maxkey; i++) {
|
||||
for (j = 0; j < syms_per_keycode; j++) {
|
||||
key = keymap[(i-minkey)*syms_per_keycode+j];
|
||||
|
||||
if (key >= ' ' && key < 0x100 && i == XKeysymToKeycode(dpy, key)) {
|
||||
keycodes[key] = i;
|
||||
modifiers[key] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
leftShiftCode = XKeysymToKeycode(dpy, XK_Shift_L);
|
||||
rightShiftCode = XKeysymToKeycode(dpy, XK_Shift_R);
|
||||
altGrCode = XKeysymToKeycode(dpy, XK_Mode_switch);
|
||||
|
||||
XFree((char *)keymap);
|
||||
fb = frameBuffer;
|
||||
}
|
||||
|
||||
/* this function adjusts the modifiers according to mod (as from modifiers) and data->modifierState */
|
||||
static void tweakModifiers(signed char mod, bool down)
|
||||
QSharedPointer<FrameBuffer> EventHandler::frameBuffer()
|
||||
{
|
||||
bool isShift = data->modifierState & (LEFTSHIFT | RIGHTSHIFT);
|
||||
|
||||
if (mod < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isShift && mod != 1) {
|
||||
if (data->modifierState & LEFTSHIFT) {
|
||||
XTestFakeKeyEvent(data->dpy, data->leftShiftCode,
|
||||
down, CurrentTime);
|
||||
}
|
||||
|
||||
if (data->modifierState & RIGHTSHIFT) {
|
||||
XTestFakeKeyEvent(data->dpy, data->rightShiftCode,
|
||||
down, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isShift && mod == 1) {
|
||||
XTestFakeKeyEvent(data->dpy, data->leftShiftCode,
|
||||
down, CurrentTime);
|
||||
}
|
||||
|
||||
if ((data->modifierState & ALTGR) && mod != 2) {
|
||||
XTestFakeKeyEvent(data->dpy, data->altGrCode,
|
||||
!down, CurrentTime);
|
||||
}
|
||||
|
||||
if (!(data->modifierState & ALTGR) && mod == 2) {
|
||||
XTestFakeKeyEvent(data->dpy, data->altGrCode,
|
||||
down, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
void EventHandler::handleKeyboard(bool down, rfbKeySym keySym)
|
||||
{
|
||||
#define ADJUSTMOD(sym,state) \
|
||||
if(keySym==sym) { if(down) data->modifierState|=state; else data->modifierState&=~state; }
|
||||
|
||||
ADJUSTMOD(XK_Shift_L, LEFTSHIFT);
|
||||
ADJUSTMOD(XK_Shift_R, RIGHTSHIFT);
|
||||
ADJUSTMOD(XK_Mode_switch, ALTGR);
|
||||
|
||||
if (keySym >= ' ' && keySym < 0x100) {
|
||||
KeyCode k;
|
||||
|
||||
if (down) {
|
||||
tweakModifiers(data->modifiers[keySym], True);
|
||||
}
|
||||
|
||||
k = data->keycodes[keySym];
|
||||
|
||||
if (k != NoSymbol) {
|
||||
XTestFakeKeyEvent(data->dpy, k, down, CurrentTime);
|
||||
}
|
||||
|
||||
if (down) {
|
||||
tweakModifiers(data->modifiers[keySym], False);
|
||||
}
|
||||
} else {
|
||||
KeyCode k = XKeysymToKeycode(data->dpy, keySym);
|
||||
|
||||
if (k != NoSymbol) {
|
||||
XTestFakeKeyEvent(data->dpy, k, down, CurrentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EventHandler::handlePointer(int buttonMask, int x, int y)
|
||||
{
|
||||
QDesktopWidget *desktopWidget = QApplication::desktop();
|
||||
|
||||
int screen = desktopWidget->screenNumber();
|
||||
|
||||
if (screen < 0) {
|
||||
screen = 0;
|
||||
}
|
||||
|
||||
XTestFakeMotionEvent(data->dpy, screen, x, y, CurrentTime);
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if ((data->buttonMask&(1 << i)) != (buttonMask&(1 << i))) {
|
||||
XTestFakeButtonEvent(data->dpy,
|
||||
i + 1,
|
||||
(buttonMask&(1 << i)) ? True : False,
|
||||
CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
data->buttonMask = buttonMask;
|
||||
return fb;
|
||||
}
|
||||
|
||||
@@ -25,13 +25,26 @@
|
||||
#ifndef EVENTS_H
|
||||
#define EVENTS_H
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include "rfb.h"
|
||||
#include "krfbprivate_export.h"
|
||||
|
||||
class EventHandler
|
||||
#include <QObject>
|
||||
|
||||
class KRFBPRIVATE_EXPORT EventHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void handleKeyboard(bool down, rfbKeySym key);
|
||||
static void handlePointer(int buttonMask, int x, int y);
|
||||
explicit EventHandler(QObject *parent = nullptr);
|
||||
virtual ~EventHandler() = default;
|
||||
virtual void handleKeyboard(bool down, rfbKeySym key) = 0;
|
||||
virtual void handlePointer(int buttonMask, int x, int y) = 0;
|
||||
|
||||
void setFrameBufferPlugin(const QSharedPointer<FrameBuffer> &frameBuffer);
|
||||
QSharedPointer<FrameBuffer> frameBuffer();
|
||||
private:
|
||||
// Used to track framebuffer plugin which we need for xdp event plugin
|
||||
QSharedPointer<FrameBuffer> fb;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
118
krfb/eventsmanager.cpp
Normal file
118
krfb/eventsmanager.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
|
||||
@author George Goldberg <george.goldberg@collabora.co.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "eventsmanager.h"
|
||||
|
||||
#include "eventsplugin.h"
|
||||
#include "krfbconfig.h"
|
||||
#include "rfbservermanager.h"
|
||||
#include "krfbdebug.h"
|
||||
|
||||
#include <QGlobalStatic>
|
||||
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
#include <KPluginMetaData>
|
||||
|
||||
#include <QtCore/QSharedPointer>
|
||||
|
||||
class EventsManagerStatic
|
||||
{
|
||||
public:
|
||||
EventsManager instance;
|
||||
};
|
||||
|
||||
Q_GLOBAL_STATIC(EventsManagerStatic, eventsManagerStatic)
|
||||
|
||||
EventsManager::EventsManager()
|
||||
{
|
||||
//qDebug();
|
||||
|
||||
loadPlugins();
|
||||
}
|
||||
|
||||
EventsManager::~EventsManager()
|
||||
{
|
||||
//qDebug();
|
||||
}
|
||||
|
||||
EventsManager *EventsManager::instance()
|
||||
{
|
||||
//qDebug();
|
||||
|
||||
return &eventsManagerStatic->instance;
|
||||
}
|
||||
|
||||
void EventsManager::loadPlugins()
|
||||
{
|
||||
//qDebug();
|
||||
|
||||
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb"), [](const KPluginMetaData & md) {
|
||||
return md.serviceTypes().contains(QStringLiteral("krfb/events"));
|
||||
});
|
||||
|
||||
QVectorIterator<KPluginMetaData> i(plugins);
|
||||
i.toBack();
|
||||
QSet<QString> unique;
|
||||
while (i.hasPrevious()) {
|
||||
KPluginMetaData data = i.previous();
|
||||
// only load plugins once, even if found multiple times!
|
||||
if (unique.contains(data.name()))
|
||||
continue;
|
||||
KPluginFactory *factory = KPluginLoader(data.fileName()).factory();
|
||||
|
||||
if (!factory) {
|
||||
qCDebug(KRFB) << "KPluginFactory could not load the plugin:" << data.fileName();
|
||||
continue;
|
||||
} else {
|
||||
qCDebug(KRFB) << "found plugin at " << data.fileName();
|
||||
}
|
||||
|
||||
auto plugin = factory->create<EventsPlugin>(this);
|
||||
if (plugin) {
|
||||
m_plugins.insert(data.pluginId(), plugin);
|
||||
qCDebug(KRFB) << "Loaded plugin with name " << data.pluginId();
|
||||
} else {
|
||||
qCDebug(KRFB) << "unable to load plugin for " << data.fileName();
|
||||
}
|
||||
unique.insert (data.name());
|
||||
}
|
||||
}
|
||||
|
||||
QSharedPointer<EventHandler> EventsManager::eventHandler()
|
||||
{
|
||||
QMap<QString, EventsPlugin *>::const_iterator iter = m_plugins.constBegin();
|
||||
|
||||
while (iter != m_plugins.constEnd()) {
|
||||
|
||||
QSharedPointer<EventHandler> eventHandler(iter.value()->eventHandler());
|
||||
|
||||
if (eventHandler) {
|
||||
eventHandler->setFrameBufferPlugin(RfbServerManager::instance()->framebuffer());
|
||||
return eventHandler;
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
|
||||
// No valid events plugin found.
|
||||
qCDebug(KRFB) << "No valid event handlers found. returning null.";
|
||||
return QSharedPointer<EventHandler>();
|
||||
}
|
||||
62
krfb/eventsmanager.h
Normal file
62
krfb/eventsmanager.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
|
||||
@author George Goldberg <george.goldberg@collabora.co.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KRFB_EVENTSMANAGER_H
|
||||
#define KRFB_EVENTSMANAGER_H
|
||||
|
||||
#include "events.h"
|
||||
|
||||
#include "krfbprivate_export.h"
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QWeakPointer>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class EventsPlugin;
|
||||
class KPluginFactory;
|
||||
|
||||
class KRFBPRIVATE_EXPORT EventsManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class EventsManagerStatic;
|
||||
|
||||
public:
|
||||
static EventsManager *instance();
|
||||
|
||||
virtual ~EventsManager();
|
||||
|
||||
QSharedPointer<EventHandler> eventHandler();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(EventsManager)
|
||||
|
||||
EventsManager();
|
||||
|
||||
void loadPlugins();
|
||||
|
||||
QMap<QString, EventsPlugin *> m_plugins;
|
||||
QList<QWeakPointer<EventHandler> > m_eventHandlers;
|
||||
};
|
||||
|
||||
|
||||
#endif // Header guard
|
||||
32
krfb/eventsplugin.cpp
Normal file
32
krfb/eventsplugin.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2016 Oleg Chernovskiy <kanedias@xaker.ru>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "eventsplugin.h"
|
||||
|
||||
#include "events.h"
|
||||
|
||||
EventsPlugin::EventsPlugin(QObject *parent, const QVariantList &)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
EventsPlugin::~EventsPlugin()
|
||||
{
|
||||
}
|
||||
42
krfb/eventsplugin.h
Normal file
42
krfb/eventsplugin.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
|
||||
@author George Goldberg <george.goldberg@collabora.co.uk>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef LIB_KRFB_EVENTSPLUGIN_H
|
||||
#define LIB_KRFB_EVENTSPLUGIN_H
|
||||
|
||||
#include "krfbprivate_export.h"
|
||||
|
||||
#include <QtCore/QVariantList>
|
||||
#include <QWidget>
|
||||
|
||||
class EventHandler;
|
||||
|
||||
class KRFBPRIVATE_EXPORT EventsPlugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EventsPlugin(QObject *parent, const QVariantList &args);
|
||||
virtual ~EventsPlugin();
|
||||
|
||||
virtual EventHandler *eventHandler() = 0;
|
||||
};
|
||||
|
||||
#endif // Header guard
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "framebuffer.h"
|
||||
|
||||
#include "config-krfb.h"
|
||||
#include <config-krfb.h>
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
@@ -50,6 +50,12 @@ void FrameBuffer::getServerFormat(rfbPixelFormat &)
|
||||
{
|
||||
}
|
||||
|
||||
QVariant FrameBuffer::customProperty(const QString &property) const
|
||||
{
|
||||
Q_UNUSED(property)
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
int FrameBuffer::depth()
|
||||
{
|
||||
return 32;
|
||||
@@ -67,7 +73,3 @@ void FrameBuffer::startMonitor()
|
||||
void FrameBuffer::stopMonitor()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#include "framebuffer.moc"
|
||||
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
|
||||
#include "krfbprivate_export.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QRect>
|
||||
#include <QtCore/QList>
|
||||
#include <QObject>
|
||||
#include <QRect>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
@@ -28,9 +29,9 @@ class KRFBPRIVATE_EXPORT FrameBuffer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrameBuffer(WId id, QObject *parent = 0);
|
||||
explicit FrameBuffer(WId id, QObject *parent = nullptr);
|
||||
|
||||
virtual ~FrameBuffer();
|
||||
~FrameBuffer() override;
|
||||
|
||||
char *data();
|
||||
|
||||
@@ -44,9 +45,13 @@ public:
|
||||
|
||||
virtual void getServerFormat(rfbPixelFormat &format);
|
||||
|
||||
virtual QVariant customProperty(const QString &property) const;
|
||||
Q_SIGNALS:
|
||||
void frameBufferChanged();
|
||||
|
||||
protected:
|
||||
WId win;
|
||||
char *fb;
|
||||
char *fb = nullptr;
|
||||
QList<QRect> tiles;
|
||||
|
||||
private:
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
|
||||
#include "framebufferplugin.h"
|
||||
#include "krfbconfig.h"
|
||||
#include "krfbdebug.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
#include <KPluginMetaData>
|
||||
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QSharedPointer>
|
||||
|
||||
class FrameBufferManagerStatic
|
||||
{
|
||||
@@ -78,17 +78,18 @@ void FrameBufferManager::loadPlugins()
|
||||
KPluginFactory *factory = KPluginLoader(data.fileName()).factory();
|
||||
|
||||
if (!factory) {
|
||||
qDebug() << "KPluginFactory could not load the plugin:" << data.fileName();
|
||||
qCDebug(KRFB) << "KPluginFactory could not load the plugin:" << data.fileName();
|
||||
continue;
|
||||
} else {
|
||||
qDebug() << "found plugin at " << data.fileName();
|
||||
qCDebug(KRFB) << "found plugin at " << data.fileName();
|
||||
}
|
||||
|
||||
FrameBufferPlugin *plugin = factory->create<FrameBufferPlugin>(this);
|
||||
auto plugin = factory->create<FrameBufferPlugin>(this);
|
||||
if (plugin) {
|
||||
m_plugins.insert(data.pluginId(), plugin);
|
||||
qDebug() << "Loaded plugin with name " << data.pluginId();
|
||||
qCDebug(KRFB) << "Loaded plugin with name " << data.pluginId();
|
||||
} else {
|
||||
qDebug() << "unable to load pluign for " << data.fileName();
|
||||
qCDebug(KRFB) << "unable to load plugin for " << data.fileName();
|
||||
}
|
||||
unique.insert (data.name());
|
||||
}
|
||||
@@ -117,7 +118,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
|
||||
while (iter != m_plugins.constEnd()) {
|
||||
|
||||
if (iter.key() == KrfbConfig::preferredFrameBufferPlugin()) {
|
||||
qDebug() << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
||||
qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
||||
|
||||
QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id));
|
||||
|
||||
@@ -132,10 +133,6 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
|
||||
}
|
||||
|
||||
// No valid framebuffer plugin found.
|
||||
qDebug() << "No valid framebuffer found. returning null.";
|
||||
qCDebug(KRFB) << "No valid framebuffer found. returning null.";
|
||||
return QSharedPointer<FrameBuffer>();
|
||||
}
|
||||
|
||||
|
||||
#include "framebuffermanager.moc"
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
|
||||
#include "krfbprivate_export.h"
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QWeakPointer>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QWeakPointer>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
@@ -43,7 +43,7 @@ class KRFBPRIVATE_EXPORT FrameBufferManager : public QObject
|
||||
public:
|
||||
static FrameBufferManager *instance();
|
||||
|
||||
virtual ~FrameBufferManager();
|
||||
~FrameBufferManager() override;
|
||||
|
||||
QSharedPointer<FrameBuffer> frameBuffer(WId id);
|
||||
|
||||
|
||||
@@ -30,7 +30,3 @@ FrameBufferPlugin::FrameBufferPlugin(QObject *parent, const QVariantList &)
|
||||
FrameBufferPlugin::~FrameBufferPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#include "framebufferplugin.moc"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "krfbprivate_export.h"
|
||||
|
||||
#include <QtCore/QVariantList>
|
||||
#include <QVariantList>
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class KRFBPRIVATE_EXPORT FrameBufferPlugin : public QObject
|
||||
|
||||
public:
|
||||
FrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
virtual ~FrameBufferPlugin();
|
||||
~FrameBufferPlugin() override;
|
||||
|
||||
virtual FrameBuffer *frameBuffer(WId id) = 0;
|
||||
};
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
#include "krfbconfig.h"
|
||||
#include "sockethelpers.h"
|
||||
#include "connectiondialog.h"
|
||||
#include "krfbdebug.h"
|
||||
|
||||
#include <KNotification>
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtCore/QSocketNotifier>
|
||||
#include <QSocketNotifier>
|
||||
#include <poll.h>
|
||||
#include <KConfigGroup>
|
||||
|
||||
@@ -41,7 +41,7 @@ struct PendingInvitationsRfbClient::Private
|
||||
{}
|
||||
|
||||
rfbClientPtr client;
|
||||
QSocketNotifier *notifier;
|
||||
QSocketNotifier *notifier = nullptr;
|
||||
bool askOnConnect;
|
||||
};
|
||||
|
||||
@@ -65,21 +65,21 @@ PendingInvitationsRfbClient::~PendingInvitationsRfbClient()
|
||||
|
||||
void PendingInvitationsRfbClient::processNewClient()
|
||||
{
|
||||
QString host = peerAddress(m_rfbClient->sock) + ":" + QString::number(peerPort(m_rfbClient->sock));
|
||||
QString host = peerAddress(m_rfbClient->sock) + QLatin1Char(':') + QString::number(peerPort(m_rfbClient->sock));
|
||||
|
||||
if (d->askOnConnect == false) {
|
||||
|
||||
KNotification::event("NewConnectionAutoAccepted",
|
||||
KNotification::event(QStringLiteral("NewConnectionAutoAccepted"),
|
||||
i18n("Accepted connection from %1", host));
|
||||
accept(new InvitationsRfbClient(m_rfbClient, parent()));
|
||||
|
||||
} else {
|
||||
|
||||
KNotification::event("NewConnectionOnHold",
|
||||
KNotification::event(QStringLiteral("NewConnectionOnHold"),
|
||||
i18n("Received connection from %1, on hold (waiting for confirmation)",
|
||||
host));
|
||||
|
||||
InvitationsConnectionDialog *dialog = new InvitationsConnectionDialog(0);
|
||||
auto 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) {
|
||||
qDebug() << "disconnected from socket signal";
|
||||
qCDebug(KRFB) << "disconnected from socket signal";
|
||||
d->notifier->setEnabled(false);
|
||||
rfbClientConnectionGone(d->client);
|
||||
break;
|
||||
@@ -125,8 +125,7 @@ void PendingInvitationsRfbClient::onSocketActivated()
|
||||
|
||||
bool PendingInvitationsRfbClient::checkPassword(const QByteArray & encryptedPassword)
|
||||
{
|
||||
QByteArray password ;
|
||||
qDebug() << "about to start autentication";
|
||||
qCDebug(KRFB) << "about to start authentication";
|
||||
|
||||
if(InvitationsRfbServer::instance->allowUnattendedAccess() && vncAuthCheckPassword(
|
||||
InvitationsRfbServer::instance->unattendedPassword().toLocal8Bit(),
|
||||
@@ -142,12 +141,10 @@ bool PendingInvitationsRfbClient::checkPassword(const QByteArray & encryptedPass
|
||||
|
||||
void PendingInvitationsRfbClient::dialogAccepted()
|
||||
{
|
||||
InvitationsConnectionDialog *dialog = qobject_cast<InvitationsConnectionDialog *>(sender());
|
||||
auto dialog = qobject_cast<InvitationsConnectionDialog *>(sender());
|
||||
Q_ASSERT(dialog);
|
||||
|
||||
InvitationsRfbClient *client = new InvitationsRfbClient(m_rfbClient, parent());
|
||||
auto client = new InvitationsRfbClient(m_rfbClient, parent());
|
||||
client->setControlEnabled(dialog->allowRemoteControl());
|
||||
accept(client);
|
||||
}
|
||||
|
||||
#include "invitationsrfbclient.moc"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
class InvitationsRfbClient : public RfbClient
|
||||
{
|
||||
public:
|
||||
InvitationsRfbClient(rfbClientPtr client, QObject* parent = 0)
|
||||
explicit InvitationsRfbClient(rfbClientPtr client, QObject* parent = nullptr)
|
||||
: RfbClient(client, parent) {}
|
||||
};
|
||||
|
||||
@@ -32,8 +32,8 @@ class PendingInvitationsRfbClient : public PendingRfbClient
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PendingInvitationsRfbClient(rfbClientPtr client, QObject *parent = 0);
|
||||
virtual ~PendingInvitationsRfbClient();
|
||||
explicit PendingInvitationsRfbClient(rfbClientPtr client, QObject *parent = nullptr);
|
||||
~PendingInvitationsRfbClient() override;
|
||||
|
||||
protected Q_SLOTS:
|
||||
void processNewClient() override;
|
||||
|
||||
@@ -22,20 +22,23 @@
|
||||
#include "invitationsrfbclient.h"
|
||||
#include "krfbconfig.h"
|
||||
#include "rfbservermanager.h"
|
||||
#include <QtCore/QTimer>
|
||||
#include "krfbdebug.h"
|
||||
#include <QTimer>
|
||||
#include <QApplication>
|
||||
#include <QtNetwork/QHostInfo>
|
||||
#include <QDebug>
|
||||
#include <QHostInfo>
|
||||
#include <QRandomGenerator>
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <KUser>
|
||||
#include <KRandom>
|
||||
#include <KStringHandler>
|
||||
#include <KWallet/KWallet>
|
||||
|
||||
#include <dnssd/publicservice.h>
|
||||
using KWallet::Wallet;
|
||||
|
||||
// used for KWallet folder name
|
||||
static const QString s_krfbFolderName(QStringLiteral("krfb"));
|
||||
|
||||
//static
|
||||
InvitationsRfbServer *InvitationsRfbServer::instance;
|
||||
|
||||
@@ -47,22 +50,17 @@ void InvitationsRfbServer::init()
|
||||
i18n("%1@%2 (shared desktop)",
|
||||
KUser().loginName(),
|
||||
QHostInfo::localHostName()),
|
||||
"_rfb._tcp",
|
||||
QStringLiteral("_rfb._tcp"),
|
||||
KrfbConfig::port());
|
||||
instance->setListeningAddress("0.0.0.0");
|
||||
instance->setListeningPort(KrfbConfig::port());
|
||||
instance->setPasswordRequired(true);
|
||||
|
||||
instance->m_wallet = nullptr;
|
||||
if (KrfbConfig::noWallet()) {
|
||||
instance->walletOpened(false);
|
||||
}
|
||||
else {
|
||||
instance->m_wallet = Wallet::openWallet(
|
||||
Wallet::NetworkWallet(), 0, Wallet::Asynchronous);
|
||||
if(instance->m_wallet) {
|
||||
connect(instance->m_wallet, &KWallet::Wallet::walletOpened,
|
||||
instance, &InvitationsRfbServer::walletOpened);
|
||||
}
|
||||
instance->walletOpened(false);
|
||||
} else {
|
||||
instance->openKWallet();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +72,9 @@ const QString& InvitationsRfbServer::desktopPassword() const
|
||||
void InvitationsRfbServer::setDesktopPassword(const QString& password)
|
||||
{
|
||||
m_desktopPassword = password;
|
||||
// this is called from GUI every time desktop password is edited.
|
||||
// make sure we save settings immediately each time
|
||||
saveSecuritySettings();
|
||||
}
|
||||
|
||||
const QString& InvitationsRfbServer::unattendedPassword() const
|
||||
@@ -84,6 +85,9 @@ const QString& InvitationsRfbServer::unattendedPassword() const
|
||||
void InvitationsRfbServer::setUnattendedPassword(const QString& password)
|
||||
{
|
||||
m_unattendedPassword = password;
|
||||
// this is called from GUI every time unattended password is edited.
|
||||
// make sure we save settings immediately each time
|
||||
saveSecuritySettings();
|
||||
}
|
||||
|
||||
bool InvitationsRfbServer::allowUnattendedAccess() const
|
||||
@@ -111,12 +115,15 @@ void InvitationsRfbServer::stop()
|
||||
void InvitationsRfbServer::toggleUnattendedAccess(bool allow)
|
||||
{
|
||||
m_allowUnattendedAccess = allow;
|
||||
// this is called from GUI every time unattended access is toggled.
|
||||
// make sure we save settings immediately each time
|
||||
saveSecuritySettings();
|
||||
}
|
||||
|
||||
InvitationsRfbServer::InvitationsRfbServer()
|
||||
{
|
||||
m_desktopPassword = readableRandomString(4)+"-"+readableRandomString(3);
|
||||
m_unattendedPassword = readableRandomString(4)+"-"+readableRandomString(3);
|
||||
m_desktopPassword = readableRandomString(4) + QLatin1Char('-') + readableRandomString(3);
|
||||
m_unattendedPassword = readableRandomString(4) + QLatin1Char('-') + readableRandomString(3);
|
||||
KConfigGroup krfbConfig(KSharedConfig::openConfig(),"Security");
|
||||
m_allowUnattendedAccess = krfbConfig.readEntry(
|
||||
"allowUnattendedAccess", QVariant(false)).toBool();
|
||||
@@ -124,27 +131,12 @@ InvitationsRfbServer::InvitationsRfbServer()
|
||||
|
||||
InvitationsRfbServer::~InvitationsRfbServer()
|
||||
{
|
||||
stop();
|
||||
KConfigGroup krfbConfig(KSharedConfig::openConfig(),"Security");
|
||||
krfbConfig.writeEntry("allowUnattendedAccess",m_allowUnattendedAccess);
|
||||
if(!KrfbConfig::noWallet()) {
|
||||
if (m_wallet && m_wallet->isOpen()) {
|
||||
if( (m_wallet->currentFolder()=="krfb") ||
|
||||
((m_wallet->hasFolder("krfb") || m_wallet->createFolder("krfb")) &&
|
||||
m_wallet->setFolder("krfb")) ) {
|
||||
|
||||
m_wallet->writePassword("desktopSharingPassword",m_desktopPassword);
|
||||
m_wallet->writePassword("unattendedAccessPassword",m_unattendedPassword);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
krfbConfig.writeEntry("desktopPassword",
|
||||
KStringHandler::obscure(m_desktopPassword));
|
||||
krfbConfig.writeEntry("unattendedPassword",
|
||||
KStringHandler::obscure(m_unattendedPassword));
|
||||
krfbConfig.writeEntry("allowUnattendedAccess",
|
||||
m_allowUnattendedAccess);
|
||||
InvitationsRfbServer::stop(); // calling virtual funcs in destructor is bad
|
||||
saveSecuritySettings();
|
||||
// ^^ also saves passwords in kwallet,
|
||||
// do it before closing kwallet
|
||||
if (!KrfbConfig::noWallet() && m_wallet) {
|
||||
closeKWallet();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,29 +145,44 @@ PendingRfbClient* InvitationsRfbServer::newClient(rfbClientPtr client)
|
||||
return new PendingInvitationsRfbClient(client, this);
|
||||
}
|
||||
|
||||
void InvitationsRfbServer::openKWallet()
|
||||
{
|
||||
m_wallet = Wallet::openWallet(Wallet::NetworkWallet(), 0, Wallet::Asynchronous);
|
||||
if (m_wallet) {
|
||||
connect(instance->m_wallet, &KWallet::Wallet::walletOpened,
|
||||
this, &InvitationsRfbServer::walletOpened);
|
||||
}
|
||||
}
|
||||
|
||||
void InvitationsRfbServer::closeKWallet()
|
||||
{
|
||||
if (m_wallet && m_wallet->isOpen()) {
|
||||
delete m_wallet; // closes the wallet
|
||||
m_wallet = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void InvitationsRfbServer::walletOpened(bool opened)
|
||||
{
|
||||
QString desktopPassword;
|
||||
QString unattendedPassword;
|
||||
Q_ASSERT(m_wallet);
|
||||
if( opened &&
|
||||
( m_wallet->hasFolder("krfb") || m_wallet->createFolder("krfb") ) &&
|
||||
m_wallet->setFolder("krfb") ) {
|
||||
|
||||
if(m_wallet->readPassword("desktopSharingPassword", desktopPassword)==0 &&
|
||||
if (opened && m_wallet->hasFolder(s_krfbFolderName) && m_wallet->setFolder(s_krfbFolderName) ) {
|
||||
if (m_wallet->readPassword(QStringLiteral("desktopSharingPassword"), desktopPassword) == 0 &&
|
||||
!desktopPassword.isEmpty()) {
|
||||
m_desktopPassword = desktopPassword;
|
||||
emit passwordChanged(m_desktopPassword);
|
||||
}
|
||||
|
||||
if(m_wallet->readPassword("unattendedAccessPassword", unattendedPassword)==0 &&
|
||||
if(m_wallet->readPassword(QStringLiteral("unattendedAccessPassword"), unattendedPassword) == 0 &&
|
||||
!unattendedPassword.isEmpty()) {
|
||||
m_unattendedPassword = unattendedPassword;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
qDebug() << "Could not open KWallet, Falling back to config file";
|
||||
qCDebug(KRFB) << "Could not open KWallet, Falling back to config file";
|
||||
KConfigGroup krfbConfig(KSharedConfig::openConfig(),"Security");
|
||||
|
||||
desktopPassword = KStringHandler::obscure(krfbConfig.readEntry(
|
||||
@@ -200,7 +207,7 @@ QString InvitationsRfbServer::readableRandomString(int length)
|
||||
{
|
||||
QString str;
|
||||
while (length) {
|
||||
int r = KRandom::random() % 62;
|
||||
int r = QRandomGenerator::global()->bounded(62);
|
||||
r += 48;
|
||||
if (r > 57) {
|
||||
r += 7;
|
||||
@@ -218,10 +225,36 @@ QString InvitationsRfbServer::readableRandomString(int length)
|
||||
(c == '0')) {
|
||||
continue;
|
||||
}
|
||||
str += c;
|
||||
str += QLatin1Char(c);
|
||||
length--;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
#include "invitationsrfbserver.moc"
|
||||
// one place to deal with all security configuration
|
||||
void InvitationsRfbServer::saveSecuritySettings()
|
||||
{
|
||||
KConfigGroup secConfigGroup(KSharedConfig::openConfig(), "Security");
|
||||
secConfigGroup.writeEntry("allowUnattendedAccess", m_allowUnattendedAccess);
|
||||
if (KrfbConfig::noWallet()) {
|
||||
// save passwords in config file only if not using kwallet integration
|
||||
secConfigGroup.writeEntry("desktopPassword", KStringHandler::obscure(m_desktopPassword));
|
||||
secConfigGroup.writeEntry("unattendedPassword", KStringHandler::obscure(m_unattendedPassword));
|
||||
} else {
|
||||
// using KWallet, erase possibly stored passwords from krfbrc file
|
||||
secConfigGroup.deleteEntry("desktopPassword");
|
||||
secConfigGroup.deleteEntry("unattendedPassword");
|
||||
// update passwords in kwallet
|
||||
if (m_wallet && m_wallet->isOpen()) {
|
||||
if (!m_wallet->hasFolder(s_krfbFolderName)) {
|
||||
m_wallet->createFolder(s_krfbFolderName);
|
||||
}
|
||||
if (m_wallet->currentFolder() != s_krfbFolderName) {
|
||||
m_wallet->setFolder(s_krfbFolderName);
|
||||
}
|
||||
m_wallet->writePassword(QStringLiteral("desktopSharingPassword"), m_desktopPassword);
|
||||
m_wallet->writePassword(QStringLiteral("unattendedAccessPassword"), m_unattendedPassword);
|
||||
}
|
||||
}
|
||||
KrfbConfig::self()->save();
|
||||
}
|
||||
|
||||
@@ -50,21 +50,24 @@ public Q_SLOTS:
|
||||
bool start() override;
|
||||
void stop() override;
|
||||
void toggleUnattendedAccess(bool allow);
|
||||
void openKWallet();
|
||||
void closeKWallet();
|
||||
void saveSecuritySettings();
|
||||
|
||||
protected:
|
||||
InvitationsRfbServer();
|
||||
virtual ~InvitationsRfbServer();
|
||||
~InvitationsRfbServer() override;
|
||||
PendingRfbClient* newClient(rfbClientPtr client) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void walletOpened(bool);
|
||||
|
||||
private:
|
||||
KDNSSD::PublicService *m_publicService;
|
||||
KDNSSD::PublicService *m_publicService = nullptr;
|
||||
bool m_allowUnattendedAccess;
|
||||
QString m_desktopPassword;
|
||||
QString m_unattendedPassword;
|
||||
KWallet::Wallet *m_wallet;
|
||||
KWallet::Wallet *m_wallet = nullptr;
|
||||
|
||||
QString readableRandomString(int);
|
||||
Q_DISABLE_COPY(InvitationsRfbServer)
|
||||
|
||||
34
krfb/krfb-events.desktop
Normal file
34
krfb/krfb-events.desktop
Normal file
@@ -0,0 +1,34 @@
|
||||
[Desktop Entry]
|
||||
Type=ServiceType
|
||||
X-KDE-ServiceType=krfb/events
|
||||
|
||||
Comment=Event plugins for KRfb
|
||||
Comment[ca]=Connectors d'esdeveniments per al KRfb.
|
||||
Comment[ca@valencia]=Connectors d'esdeveniments per al KRfb.
|
||||
Comment[cs]=Moduly událostí pro KRfb
|
||||
Comment[da]=Hændelses-plugins til KRfb
|
||||
Comment[de]=Ereignis-Module für KRfb
|
||||
Comment[el]=Πρόσθετα γεγονότων για το KRfb
|
||||
Comment[en_GB]=Event plugins for KRfb
|
||||
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[gl]=Complementos de eventos para KRfb
|
||||
Comment[ia]=Plug-ins de evento per KRfb
|
||||
Comment[it]=Estensioni degli eventi per KRfb
|
||||
Comment[ko]=KRfb 이벤트 플러그인
|
||||
Comment[nl]=Plug-ins voor gebeurtenis voor KRfb
|
||||
Comment[nn]=Hendingstillegg for KRfb
|
||||
Comment[pl]=Wtyczki wydarzeń dla KRfb
|
||||
Comment[pt]='Plugins' de eventos para o KRfb
|
||||
Comment[pt_BR]=Plugins de evento para o KRfb
|
||||
Comment[sk]=Doplnky udalostí pre KRfb
|
||||
Comment[sl]=Vstavki dogodkov za KRFB
|
||||
Comment[sv]=Händelseinsticksprogram för Krfb
|
||||
Comment[uk]=Додатки обробки подій для KRfb
|
||||
Comment[x-test]=xxEvent plugins for KRfbxx
|
||||
Comment[zh_CN]=KRfb 事件插件
|
||||
Comment[zh_TW]=KRfb 的事件外掛程式
|
||||
|
||||
34
krfb/krfb-events.json
Normal file
34
krfb/krfb-events.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"KPlugin": {
|
||||
"Description": "Events plugins for KRfb",
|
||||
"Description[ca@valencia]": "Connectors d'esdeveniments per al KRfb.",
|
||||
"Description[ca]": "Connectors d'esdeveniments per al KRfb.",
|
||||
"Description[cs]": "Moduly událostí pro KRfb",
|
||||
"Description[da]": "Hændelses-plugins til KRfb",
|
||||
"Description[de]": "Ereignis-Module für KRfb",
|
||||
"Description[el]": "Πρόσθετα γεγονότων για το KRfb",
|
||||
"Description[en_GB]": "Events plugins for KRfb",
|
||||
"Description[es]": "Complementos de eventos para KRfb",
|
||||
"Description[et]": "KRfb sündmuste pluginad",
|
||||
"Description[eu]": "KRfb-rako gertaeren pluginak",
|
||||
"Description[fi]": "KRfb:n tapahtumaliitännäinen",
|
||||
"Description[fr]": "Modules externes d'évènements pour KRfb",
|
||||
"Description[gl]": "Complementos de eventos para KRfb",
|
||||
"Description[ia]": "Plug-ins de eventos per KRfb",
|
||||
"Description[it]": "Estensioni degli eventi per KRfb",
|
||||
"Description[ko]": "KRfb 이벤트 플러그인",
|
||||
"Description[nl]": "Plug-ins voor gebeurtenis voor KRfb",
|
||||
"Description[nn]": "Hendingstillegg for KRfb",
|
||||
"Description[pl]": "Wtyczki wydarzeń dla KRfb",
|
||||
"Description[pt]": "'Plugins' de eventos para o KRfb",
|
||||
"Description[pt_BR]": "Plugins de evento para o KRfb",
|
||||
"Description[sk]": "Doplnky udalostí pre KRfb",
|
||||
"Description[sl]": "Vtičniki za dogodke za KRfb",
|
||||
"Description[sv]": "Händelseinsticksprogram för Krfb",
|
||||
"Description[uk]": "Додатки обробки подій для KRfb",
|
||||
"Description[x-test]": "xxEvents plugins for KRfbxx",
|
||||
"Description[zh_CN]": "KRfb 事件插件",
|
||||
"Description[zh_TW]": "KRfb 的事件外掛程式"
|
||||
},
|
||||
"X-KDE-ServiceType": "krfb/events"
|
||||
}
|
||||
@@ -3,7 +3,6 @@ Type=ServiceType
|
||||
X-KDE-ServiceType=krfb/framebuffer
|
||||
|
||||
Comment=Frame Buffer plugins for KRfb
|
||||
Comment[ast]=Complementos del búfer de cuadros pa KRfb
|
||||
Comment[bg]=Приставки за фреймбуфер за KRfb
|
||||
Comment[bs]=Priključci framebafera za KRfb
|
||||
Comment[ca]=Connectors de «framebuffer» per al KRfb.
|
||||
@@ -37,7 +36,7 @@ Comment[nl]=Framebuffer-plugins voor KRfb
|
||||
Comment[nn]=Framebuffer-tillegg KRfb
|
||||
Comment[pa]=KRfb ਲਈ ਫਰੇਮ ਬਫ਼ਰ ਪਲੱਗਇਨ
|
||||
Comment[pl]=Wtyczki buforów ramek dla KRfb
|
||||
Comment[pt]='Plugins' de 'framebuffers' para o KRfb
|
||||
Comment[pt]='Plugins' do 'Framebuffer' para o KRfb
|
||||
Comment[pt_BR]=Plugins de framebuffers para o KRfb
|
||||
Comment[ru]=Модуль буфера кадров для KRfb
|
||||
Comment[si]=KRfb සඳහා රාමු බෆර ප්ලගින
|
||||
@@ -52,5 +51,5 @@ Comment[th]=ส่วนเสริมของ KRfb สำหรับจั
|
||||
Comment[tr]=KRfb için Çerçeve Tamponu eklentileri
|
||||
Comment[uk]=Додатки буфера кадрів для KRfb
|
||||
Comment[x-test]=xxFrame Buffer plugins for KRfbxx
|
||||
Comment[zh_CN]=KRfb 帧缓冲插件
|
||||
Comment[zh_CN]=KRfb 的帧缓冲插件
|
||||
Comment[zh_TW]=KRfb 的 Frame Buffer 外掛程式
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
{
|
||||
"KPlugin": {
|
||||
"Description": "Frame Buffer plugins for KRfb",
|
||||
"Description[ast]": "Complementos del búfer de cuadros pa KRfb",
|
||||
"Description[ca@valencia]": "Connectors de «framebuffer» per al KRfb.",
|
||||
"Description[ca]": "Connectors de «framebuffer» per al KRfb.",
|
||||
"Description[ca@valencia]": "Connectors de «Frame Buffer» per al KRfb.",
|
||||
"Description[ca]": "Connectors de «Frame Buffer» per al KRfb.",
|
||||
"Description[cs]": "Moduly Frame bufferu pro KRfb",
|
||||
"Description[da]": "Framebuffer-plugins til KRfb",
|
||||
"Description[de]": "Framebuffer-Module für KRfb",
|
||||
"Description[el]": "Πρόσθετα μνήμης ανανέωσης βίντεο καρέ για το KRfb",
|
||||
"Description[en_GB]": "Frame Buffer plugins for KRfb",
|
||||
"Description[es]": "Complementos de framebuffer para KRfb",
|
||||
"Description[et]": "KRfb kaadripuhvri pluginad",
|
||||
"Description[fi]": "Kehyspuskuriliitännäinen kohteelle KRfb",
|
||||
"Description[eu]": "KRfb-rako «Frame Buffer» pluginak",
|
||||
"Description[fi]": "KRfb:n kehyspuskuriliitännäinen",
|
||||
"Description[fr]": "Modules de tampons d'image pour KRfb",
|
||||
"Description[gl]": "Complemento de búfer de fotograma para KRfb",
|
||||
"Description[ia]": "Plug-ins de Frame Buffer per KRfb",
|
||||
@@ -24,7 +25,7 @@
|
||||
"Description[pt_BR]": "Plugins de framebuffers para o KRfb",
|
||||
"Description[ru]": "Модули буфера кадров для KRfb",
|
||||
"Description[sk]": "Frame Buffer modul pre KRfb",
|
||||
"Description[sl]": "Vstavki slikovnih medpomnilnikov za KRfb",
|
||||
"Description[sl]": "Vtičniki vmesnika medpomnilnika za KRfb",
|
||||
"Description[sr@ijekavian]": "Прикључци кадробафера за КРФБ",
|
||||
"Description[sr@ijekavianlatin]": "Priključci kadrobafera za KRFB",
|
||||
"Description[sr@latin]": "Priključci kadrobafera za KRFB",
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE kcfg SYSTEM
|
||||
"http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
|
||||
<kcfg>
|
||||
<kcfgfile />
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<kcfgfile name="krfbrc"/>
|
||||
<group name="MainWindow">
|
||||
<entry name="startMinimized" type="Bool">
|
||||
<label>Start minimized</label>
|
||||
|
||||
@@ -3,7 +3,6 @@ IconName=krfb
|
||||
Comment=Desktop Sharing
|
||||
Comment[af]=Werkskerm Deeling
|
||||
Comment[ar]=مشاركة سطح المكتب
|
||||
Comment[ast]=Compartición d'escritoriu
|
||||
Comment[bg]=Споделяне на работния плот
|
||||
Comment[bn]=ডেস্কটপ ভাগাভাগি
|
||||
Comment[br]=Rannañ ar vurev
|
||||
@@ -76,7 +75,6 @@ Comment[zh_TW]=桌面分享
|
||||
[Event/UserAcceptsConnection]
|
||||
Name=User Accepts Connection
|
||||
Name[ar]=المستخدم يقبل الاتصال
|
||||
Name[ast]=L'usuariu aceuta la conexón
|
||||
Name[bg]=Потребителят приема връзката
|
||||
Name[bs]=Korisnik prihvata vezu
|
||||
Name[ca]=L'usuari accepta la connexió
|
||||
@@ -99,7 +97,7 @@ Name[hne]=कमइया हर कनेक्सन स्वीकारा
|
||||
Name[hr]=Korisnik prihvaća vezu
|
||||
Name[hu]=A felhasználó engedélyezi a csatlakozást
|
||||
Name[ia]=Usator da acceptation a connexion
|
||||
Name[id]=Pengguna Menyetujui Sambungan
|
||||
Name[id]=Pengguna Menyetujui Koneksi
|
||||
Name[is]=Notandi samþykkir tengingar
|
||||
Name[it]=L'utente accetta la connessione
|
||||
Name[ja]=ユーザが接続を許可
|
||||
@@ -138,7 +136,6 @@ Name[zh_TW]=使用者接受連線
|
||||
Comment=User accepts connection
|
||||
Comment[af]=Gebruiker aanvaar verbinding
|
||||
Comment[ar]=المستخدم يقبل الاتصال
|
||||
Comment[ast]=L'usuariu aceuta la conexón
|
||||
Comment[bg]=Потребителят приема връзката
|
||||
Comment[bn]=ব্যবহারকারী সংযোগ গ্রহণ করে
|
||||
Comment[bs]=Korisnik prihvata vezu
|
||||
@@ -164,7 +161,7 @@ Comment[hne]=कमइया हर कनेक्सन स्वीकार
|
||||
Comment[hr]=Korisnik prihvaća vezu
|
||||
Comment[hu]=A felhasználó engedélyezi a csatlakozást
|
||||
Comment[ia]=Usator da acceptation a connexion
|
||||
Comment[id]=Pengguna menyetujui sambungan
|
||||
Comment[id]=Pengguna menyetujui koneksi
|
||||
Comment[is]=Notandi samþykkir tengingu
|
||||
Comment[it]=L'utente accetta la connessione
|
||||
Comment[ja]=ユーザが接続を許可
|
||||
@@ -211,7 +208,6 @@ Action=Popup
|
||||
[Event/UserRefusesConnection]
|
||||
Name=User Refuses Connection
|
||||
Name[ar]=المستخدم يرفض الاتصال
|
||||
Name[ast]=L'usuariu refuga la conexón
|
||||
Name[bg]=Потребителят отказва връзката
|
||||
Name[bs]=Korisnik odbija vezu
|
||||
Name[ca]=L'usuari refusa la connexió
|
||||
@@ -234,7 +230,7 @@ Name[hne]=कमइया हर कनेक्सन अस्वीकार
|
||||
Name[hr]=Korisnik odbija vezu
|
||||
Name[hu]=A felhasználó elutasítja a csatlakozást
|
||||
Name[ia]=Usator refuta connexion
|
||||
Name[id]=Pengguna Menampik Sambungan
|
||||
Name[id]=Pengguna Menampik Koneksi
|
||||
Name[is]=Notandi hafnar tengingum
|
||||
Name[it]=L'utente rifiuta la connessione
|
||||
Name[ja]=ユーザが接続を拒否
|
||||
@@ -273,7 +269,6 @@ Name[zh_TW]=使用者拒絕連線
|
||||
Comment=User refuses connection
|
||||
Comment[af]=Gebruiker weier verbinding
|
||||
Comment[ar]=المستخدم يرفض الاتصال
|
||||
Comment[ast]=L'usuariu refuga la conexón
|
||||
Comment[bg]=Потребителят отказва връзката
|
||||
Comment[bn]=ব্যবহারকারী সংযোগ অস্বীকার করে
|
||||
Comment[bs]=Korisnik odbija vezu
|
||||
@@ -299,7 +294,7 @@ Comment[hne]=कमइया हर कनेक्सन अस्वीका
|
||||
Comment[hr]=Korisnik odbija vezu
|
||||
Comment[hu]=A felhasználó elutasítja a csatlakozást
|
||||
Comment[ia]=Usator refuta connexion
|
||||
Comment[id]=Pengguna menampik sambungan
|
||||
Comment[id]=Pengguna menampik koneksi
|
||||
Comment[is]=Notandi hafnar tengingu
|
||||
Comment[it]=L'utente rifiuta la connessione
|
||||
Comment[ja]=ユーザが接続を拒否
|
||||
@@ -346,7 +341,6 @@ Action=Popup
|
||||
[Event/ConnectionClosed]
|
||||
Name=Connection Closed
|
||||
Name[ar]=الاتصال أغلق
|
||||
Name[ast]=Conexón zarrada
|
||||
Name[bg]=Връзката е прекъсната
|
||||
Name[bs]=Konekcija zatvorena
|
||||
Name[ca]=Connexió tancada
|
||||
@@ -369,7 +363,7 @@ Name[hne]=कनेक्सन बन्द
|
||||
Name[hr]=Veza prekinuta
|
||||
Name[hu]=A kapcsolat megszűnt
|
||||
Name[ia]=Connexion claudite
|
||||
Name[id]=Sambungan Ditutup
|
||||
Name[id]=Koneksi Ditutup
|
||||
Name[is]=Tengingu lokað
|
||||
Name[it]=Connessione chiusa
|
||||
Name[ja]=接続切断
|
||||
@@ -410,7 +404,6 @@ Name[zh_TW]=連線已關閉
|
||||
Comment=Connection closed
|
||||
Comment[af]=Verbinding gesluit
|
||||
Comment[ar]=تمّ غلق الاتصال
|
||||
Comment[ast]=Zarróse la conexón
|
||||
Comment[bg]=Връзката е прекъсната
|
||||
Comment[bn]=সংযোগ বন্ধ করা হল
|
||||
Comment[br]=Serret eo ar gevreadenn
|
||||
@@ -437,7 +430,7 @@ Comment[hne]=कनेक्सन बन्द
|
||||
Comment[hr]=Veza prekinuta
|
||||
Comment[hu]=A kapcsolat megszűnt
|
||||
Comment[ia]=Connexion claudite
|
||||
Comment[id]=Sambungan ditutup
|
||||
Comment[id]=Koneksi ditutup
|
||||
Comment[is]=Tengingu lokað
|
||||
Comment[it]=Connessione chiusa
|
||||
Comment[ja]=接続が閉じられました
|
||||
@@ -487,7 +480,6 @@ Action=Popup
|
||||
[Event/InvalidPassword]
|
||||
Name=Invalid Password
|
||||
Name[ar]=كلمة المرور غير صحيحة
|
||||
Name[ast]=Contraseña non válida
|
||||
Name[bg]=Неправилна парола
|
||||
Name[bs]=Neispravna šifra
|
||||
Name[ca]=Contrasenya no vàlida
|
||||
@@ -510,7 +502,7 @@ Name[hne]=अवैध पासवर्ड
|
||||
Name[hr]=Nevažeća zaporka
|
||||
Name[hu]=Érvénytelen jelszó
|
||||
Name[ia]=Contrasigno invalide
|
||||
Name[id]=Sandi Tidak Sah
|
||||
Name[id]=Sandi Tidak Absah
|
||||
Name[is]=Ógilt lykilorð
|
||||
Name[it]=Password non valida
|
||||
Name[ja]=無効なパスワード
|
||||
@@ -551,7 +543,6 @@ Name[zh_TW]=不正確的密碼
|
||||
Comment=Invalid password
|
||||
Comment[af]=Ongeldige wagwoord
|
||||
Comment[ar]=كلمة المرور غير صحيحة
|
||||
Comment[ast]=La contraseña nun ye válida
|
||||
Comment[bg]=Неправилна парола
|
||||
Comment[bn]=অবৈধ পাসওয়ার্ড
|
||||
Comment[br]=Tremenger siek
|
||||
@@ -578,7 +569,7 @@ Comment[hne]=अवैध पासवर्ड
|
||||
Comment[hr]=Nevažeća šifra
|
||||
Comment[hu]=Érvénytelen jelszó
|
||||
Comment[ia]=Contrasigno invalide
|
||||
Comment[id]=Sandi tidak sah
|
||||
Comment[id]=Sandi tidak absah
|
||||
Comment[is]=Lykilorð ógilt
|
||||
Comment[it]=Password non valida
|
||||
Comment[ja]=無効なパスワード
|
||||
@@ -633,8 +624,8 @@ Name=Invalid Password Invitations
|
||||
Name[ar]=كلمة المرور الدعوات غير صحيحة
|
||||
Name[bg]=Неправилна парола за покана
|
||||
Name[bs]=Neispravna šifra pozivnice
|
||||
Name[ca]=Contrasenya de les invitacions no vàlides
|
||||
Name[ca@valencia]=Contrasenya de les invitacions no vàlides
|
||||
Name[ca]=Contrasenya no vàlida de les invitacions
|
||||
Name[ca@valencia]=Contrasenya no vàlida de les invitacions
|
||||
Name[cs]=Neplatné hesla výzev
|
||||
Name[da]=Ugyldige adgangskodeinvitationer
|
||||
Name[de]=Ungültiges Einladungs-Passwort
|
||||
@@ -653,7 +644,7 @@ Name[hne]=अवैध पासवर्ड निमंत्रन
|
||||
Name[hr]=Pozivnice s nevažećim zaporkama
|
||||
Name[hu]=Érvénytelen jelszavas meghívó
|
||||
Name[ia]=Invitationes de contrasigno invalide
|
||||
Name[id]=Undangan Sandi Tidak Sah
|
||||
Name[id]=Undangan Sandi Tidak Absah
|
||||
Name[is]=Ógild lykilorðsboð
|
||||
Name[it]=Password di invito non valida
|
||||
Name[ja]=招待に対する無効なパスワード
|
||||
@@ -692,7 +683,6 @@ Name[zh_TW]=不合法的密碼邀請
|
||||
Comment=The invited party sent an invalid password. Connection refused.
|
||||
Comment[af]=Die uitgenooi party gestuur 'n ongeldige wagwoord. Verbinding geweier.
|
||||
Comment[ar]=المدعو أرسل كلمة مرور غير صحيحة. رفض الإتصال.
|
||||
Comment[ast]=La parte invitada unvió una contraseña non válida. Refugóse la conexón.
|
||||
Comment[bg]=Поканената страна изпрати неправилна парола. Връзката е отказана.
|
||||
Comment[bn]=আমন্ত্রিত দল একটি অবৈধ পাসওয়ার্ড পাঠাল। সংযোগ অস্বীকার করা হল।
|
||||
Comment[bs]=Pozvana strana je poslala pogrešnu šifru. Veza je odbijena.
|
||||
@@ -711,14 +701,14 @@ Comment[eu]=Gonbidatutako parekoak baliogabeko pasahitza bidali du. Konexioa uka
|
||||
Comment[fi]=Kutsuttu taho lähetti virheellisen salasanan. Yhteys hylättiin.
|
||||
Comment[fr]=La partie invitée a envoyé un mot de passe non valable. Connexion refusée.
|
||||
Comment[ga]=Sheol an duine le cuireadh focal faire neamhbhailí. Diúltaíodh an ceangal.
|
||||
Comment[gl]=A parte convidada envioulle un contrasinal incorrecto. A conexión foi rexeitada.
|
||||
Comment[gl]=A parte convidada envioulle un contrasinal incorrecto. Rexeitouse a conexión.
|
||||
Comment[he]=הצד המוזמן שלח סיסמה שגויה. החיבור נדחה.
|
||||
Comment[hi]=निमंत्रित पार्टी ने अवैध पासवर्ड भेजा. कनेक्शन अस्वीकृत.
|
||||
Comment[hne]=निमंत्रित पार्टी हर अवैध पासवर्ड भेजिस. कनेक्सन अस्वीकृत.
|
||||
Comment[hr]=Stranka koju ste pozvali je poslala nevažeću šifru. Veza odbijena.
|
||||
Comment[hu]=A meghívott fél érvénytelen jelszót küldött. A csatlakozási kérés elutasítva.
|
||||
Comment[ia]=Le partita invitate inviava un contrasigno invalide. Connexion refusate.
|
||||
Comment[id]=Undangan mengirimkan sebuah sandi tidak sah. Sambungan ditampik.
|
||||
Comment[id]=Undangan mengirimkan sebuah sandi tidak absah. Koneksi ditampik.
|
||||
Comment[is]=Boðinn aðili sendi ógilt lykilorð. Tengingu hafnað
|
||||
Comment[it]=La parte invitata ha inviato una password non valida. Connessione rifiutata.
|
||||
Comment[ja]=招待された人が無効なパスワードを送ってきました。接続を拒否しました。
|
||||
@@ -763,7 +753,6 @@ Action=Popup
|
||||
[Event/NewConnectionOnHold]
|
||||
Name=New Connection on Hold
|
||||
Name[ar]=اتصال جديد على التوقف
|
||||
Name[ast]=Conexón nueva n'espera
|
||||
Name[bg]=Изчакване на новата връзка
|
||||
Name[bs]=Nova veza je na čekanju
|
||||
Name[ca]=Connexió nova en espera
|
||||
@@ -786,7 +775,7 @@ Name[hne]=नवा कनेक्सन होल्ड मं रखा
|
||||
Name[hr]=Nova veza na čekanju
|
||||
Name[hu]=Új kapcsolat tartva
|
||||
Name[ia]=Nove connexion in pausa
|
||||
Name[id]=Sambungan Baru sedang Tertahan
|
||||
Name[id]=Koneksi Baru sedang Tertahan
|
||||
Name[is]=Ný tenging á bið
|
||||
Name[it]=Nuova connessione in attesa
|
||||
Name[ja]=保留中の新しい接続
|
||||
@@ -824,7 +813,6 @@ Name[zh_TW]=新連線等待處理
|
||||
Comment=Connection requested, user must accept
|
||||
Comment[af]=Verbinding versoekte, gebruiker moet aanvaar
|
||||
Comment[ar]=الاتصال طلب، يجب موافقة المستخدم
|
||||
Comment[ast]=Solicitóse la conexón, l'usuariu ha aceutar
|
||||
Comment[bg]=Поискана е връзка, следва потребителят да приеме
|
||||
Comment[bn]=সংযোগ অনুরোধ করা হল, ব্যবহারকারীকে অবশ্যই স্বীকার করতে হবে
|
||||
Comment[bs]=Veza je zahtijevana, korinik mora da je prihvati
|
||||
@@ -850,7 +838,7 @@ Comment[hne]=कनेक्सन निवेदित. कमइया ल
|
||||
Comment[hr]=Veza je zatražena, korisnik mora prihvatiti
|
||||
Comment[hu]=Csatlakozási kérés, a felhasználónak el kell fogadnia
|
||||
Comment[ia]=Connexion requirite, usator debe dar acceptation
|
||||
Comment[id]=Sambungan diminta, pengguna harus menyetujui
|
||||
Comment[id]=Koneksi diminta, pengguna harus menyetujui
|
||||
Comment[is]=Beiðni um tengingu, notandi verður að samþykkja
|
||||
Comment[it]=Connessione richiesta, l'utente deve accettare
|
||||
Comment[ja]=接続が要求されています。ユーザが許可しなければなりません。
|
||||
@@ -896,7 +884,6 @@ Action=Popup
|
||||
[Event/NewConnectionAutoAccepted]
|
||||
Name=New Connection Auto Accepted
|
||||
Name[ar]=اتصال جديد مقبول تلقائيا
|
||||
Name[ast]=Conexón nueva auto-aceutada
|
||||
Name[bg]=Автоматично приемане на новата връзка
|
||||
Name[bs]=Nova veza je automatski prihvaćena
|
||||
Name[ca]=Connexió nova acceptada automàticament
|
||||
@@ -919,7 +906,7 @@ Name[hne]=नय कनेक्सन अपने अपन स्वीका
|
||||
Name[hr]=Nova veza automatski prihvaćena
|
||||
Name[hu]=Új kapcsolat automatikusan engedélyezve
|
||||
Name[ia]=Nove connexion con acceptation automatic
|
||||
Name[id]=Sambungan Baru Tersetujui Otomatis
|
||||
Name[id]=Koneksi Baru Tersetujui Otomatis
|
||||
Name[is]=Ný tenging sjálfvirkt samþykkt
|
||||
Name[it]=Nuova connessione accettata automaticamente
|
||||
Name[ja]=新しい接続の自動受け入れ
|
||||
@@ -957,7 +944,6 @@ Name[zh_TW]=新連線自動接受
|
||||
Comment=New connection automatically established
|
||||
Comment[af]=Nuwe verbinding automaties vasgestel
|
||||
Comment[ar]=اتصال جديد مفعل تلقائيا
|
||||
Comment[ast]=Afitóse automáticamente la conexón nueva
|
||||
Comment[bg]=Новата връзка е автоматично приета
|
||||
Comment[bn]=নতুন সংযোগ স্বয়ংক্রীয়ভাবে স্থাপন করা হল
|
||||
Comment[bs]=Nova veza je automatski uspostavljena
|
||||
@@ -983,7 +969,7 @@ Comment[hne]=नवा कनेक्सन अपने अपन स्था
|
||||
Comment[hr]=Nova veza automatski prihvaćena
|
||||
Comment[hu]=Automatikusan létrejött egy új kapcsolat
|
||||
Comment[ia]=Nove connexion establite automaticamente
|
||||
Comment[id]=Sambungan baru secara otomatis terpancang
|
||||
Comment[id]=Koneksi baru secara otomatis terpancang
|
||||
Comment[is]=Nýjar tengingar sjálfkrafa samþykktar
|
||||
Comment[it]=Nuova connessione stabilita automaticamente
|
||||
Comment[ja]=新しい接続を自動的に確立しました
|
||||
@@ -1029,7 +1015,6 @@ Action=Popup
|
||||
[Event/TooManyConnections]
|
||||
Name=Too Many Connections
|
||||
Name[ar]=اتصالات عديدة
|
||||
Name[ast]=Milenta conexones
|
||||
Name[bg]=Твърде много връзки
|
||||
Name[bs]=Previše veza
|
||||
Name[ca]=Massa connexions
|
||||
@@ -1052,7 +1037,7 @@ Name[hne]=बहुत अकन कनेक्सन
|
||||
Name[hr]=Previše veza
|
||||
Name[hu]=Túl sok kapcsolat
|
||||
Name[ia]=Nimie connexiones
|
||||
Name[id]=Terlalu Banyak Sambungan
|
||||
Name[id]=Terlalu Banyak Koneksi
|
||||
Name[is]=Of margar tengingar
|
||||
Name[it]=Troppe connessioni
|
||||
Name[ja]=多すぎる接続
|
||||
@@ -1090,7 +1075,6 @@ Name[zh_TW]=太多連線
|
||||
Comment=Busy, connection refused
|
||||
Comment[af]=Besig, verbinding geweier
|
||||
Comment[ar]=مشغول، الإتصال رفض
|
||||
Comment[ast]=Ocupáu, refugóse la conexón
|
||||
Comment[bg]=Заето. Връзката е отказана.
|
||||
Comment[bn]=ব্যস্ত, সংযোগ অস্বীকার করল
|
||||
Comment[br]=Dalc'het, kevreadenn disteuleret
|
||||
@@ -1110,14 +1094,14 @@ Comment[eu]=Lanpetuta, konexioa ukatu da
|
||||
Comment[fi]=Varattu, yhteys hylättiin
|
||||
Comment[fr]=Occupé. Connexion refusée
|
||||
Comment[ga]=Gnóthach; ceangal diúltaithe
|
||||
Comment[gl]=Ocupado; a conexión foi rexeitada
|
||||
Comment[gl]=Ocupado, rexeitouse a conexión.
|
||||
Comment[he]=תפוס, החיבור נדחה
|
||||
Comment[hi]=व्यस्त, कनेक्शन अस्वीकृत
|
||||
Comment[hne]=व्यस्त, कनेक्सन अस्वीकृत
|
||||
Comment[hr]=Zauzeto, veza odbijena
|
||||
Comment[hu]=A csatlakozási kérés elutasítva túlterhelés miatt
|
||||
Comment[ia]=Occupate, connexion refusate
|
||||
Comment[id]=Sibuk, sambungan ditampik
|
||||
Comment[id]=Sibuk, koneksi ditampik
|
||||
Comment[is]=Uptekinn, tengingu hafnað
|
||||
Comment[it]=Occupato, connessione rifiutata
|
||||
Comment[ja]=ビジーです、接続を拒否しました
|
||||
@@ -1165,7 +1149,6 @@ Action=Popup
|
||||
[Event/UnexpectedConnection]
|
||||
Name=Unexpected Connection
|
||||
Name[ar]=الاتصال غير متوقّع
|
||||
Name[ast]=Conexón inesperada
|
||||
Name[bg]=Неочаквана връзка
|
||||
Name[bs]=Neočekivana veza
|
||||
Name[ca]=Connexió inesperada
|
||||
@@ -1188,7 +1171,7 @@ Name[hne]=अप्रत्यासित कनेक्सन
|
||||
Name[hr]=Neočekivana veza
|
||||
Name[hu]=Nem várt kapcsolat
|
||||
Name[ia]=Connexion impreviste
|
||||
Name[id]=Sambungan Tak Terduga
|
||||
Name[id]=Koneksi Tak Terduga
|
||||
Name[is]=Óvænt Tenging
|
||||
Name[it]=Connessione inattesa
|
||||
Name[ja]=予期しない接続
|
||||
@@ -1227,12 +1210,11 @@ Name[zh_TW]=未知的連線
|
||||
Comment=Received unexpected connection, abort
|
||||
Comment[af]=Ontvang onverwagte verbinding, staak
|
||||
Comment[ar]=استقبال اتصال غير متوقع، إنهاء
|
||||
Comment[ast]=Recibióse una conexón inesperada, albortando
|
||||
Comment[bg]=Получена е неочаквана връзка. Прекъсване.
|
||||
Comment[bn]=অপ্রত্যাশিত সংযোগ গ্রহণ করল, বাতিল করুন
|
||||
Comment[bs]=Primljena je neočekivana veza, prekini
|
||||
Comment[ca]=S'ha rebut una connexió inesperada, avortant
|
||||
Comment[ca@valencia]=S'ha rebut una connexió inesperada, avortant
|
||||
Comment[ca]=S'ha rebut una connexió inesperada, s'està interrompent
|
||||
Comment[ca@valencia]=S'ha rebut una connexió inesperada, s'està interrompent
|
||||
Comment[cs]=Obdrženo neočekávané spojení, přerušeno
|
||||
Comment[cy]=Derbynwyd cysylltiad annisgwyl,terfynu
|
||||
Comment[da]=Modtog uventet forbindelse, afbrød
|
||||
@@ -1246,14 +1228,14 @@ Comment[eu]=Ustekabeko konexioa jaso da, abortatzen
|
||||
Comment[fi]=Vastaanotettiin odottamaton yhteys, lopeta
|
||||
Comment[fr]=Connexion inattendue reçue. Annulation
|
||||
Comment[ga]=Fuarthas ceangal gan choinne, á thobscor
|
||||
Comment[gl]=Recibiuse unha conexión non agardada; cancélase
|
||||
Comment[gl]=Recibiuse unha conexión non agardada; interrómpese
|
||||
Comment[he]=נתקבל חיבור בלתי צפוי, בוטל
|
||||
Comment[hi]=अप्रत्याशित कनेक्शन प्राप्त. छोड़ा
|
||||
Comment[hne]=अप्रत्यासित कनेक्सन प्राप्त. छोड़ा
|
||||
Comment[hr]=Primio sam neočekivanu vezu, prekid
|
||||
Comment[hu]=Nem várt csatlakozási kérés érkezett, megszakítás
|
||||
Comment[ia]=On recipeva connexion impreviste, aborta
|
||||
Comment[id]=Diperoleh sambungan tak terduga, gugurkan
|
||||
Comment[id]=Diperoleh koneksi tak terduga, gugurkan
|
||||
Comment[is]=Tók á móti óvæntri tengingu, hætti
|
||||
Comment[it]=Ricevuta connessione inattesa, terminata
|
||||
Comment[ja]=予期しない接続を受信しました。廃棄します。
|
||||
@@ -1271,7 +1253,7 @@ Comment[nl]=Ontving een onverwachte verbinding, afgebroken
|
||||
Comment[nn]=Fekk ei uventa tilkopling, så avbryt no
|
||||
Comment[pl]=Otrzymano niespodziewane połączenie. Przerwane.
|
||||
Comment[pt]=Foi recebida uma ligação inesperada, pelo que foi interrompida
|
||||
Comment[pt_BR]=Conexão recebida inesperadamente; abortar
|
||||
Comment[pt_BR]=Conexão recebida inesperadamente; cancelar
|
||||
Comment[ro]=Conexiune neașteptată recepționată, abandonare
|
||||
Comment[ru]=Получено неожиданное соединение. Отключение
|
||||
Comment[si]=බලාපොරොත්තු රහිත සබඳතාවක් ලැබිනි, පිටවෙමින්
|
||||
|
||||
6
krfb/krfb.qrc
Normal file
6
krfb/krfb.qrc
Normal file
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE RCC>
|
||||
<RCC version="1.0">
|
||||
<qresource prefix="/kxmlgui5/krfb">
|
||||
<file>krfbui.rc</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,7 +0,0 @@
|
||||
[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
|
||||
7
krfb/krfbui.rc
Normal file
7
krfb/krfbui.rc
Normal file
@@ -0,0 +1,7 @@
|
||||
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
|
||||
<gui name="krfb" version="0">
|
||||
|
||||
<MenuBar>
|
||||
</MenuBar>
|
||||
|
||||
</gui>
|
||||
@@ -20,18 +20,19 @@
|
||||
#include "invitationsrfbserver.h"
|
||||
#include "krfbconfig.h"
|
||||
#include "krfb_version.h"
|
||||
#include "krfbdebug.h"
|
||||
|
||||
#include <KAboutData>
|
||||
#include <KDBusService>
|
||||
#include <KLocalizedString>
|
||||
#include <KMessageBox>
|
||||
#include <KWindowSystem>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPixmap>
|
||||
#include <qwindowdefs.h>
|
||||
#include <QX11Info>
|
||||
|
||||
#include <signal.h>
|
||||
#include <csignal>
|
||||
#include <X11/extensions/XTest.h>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
@@ -39,7 +40,6 @@
|
||||
|
||||
static const char description[] = I18N_NOOP("VNC-compatible server to share "
|
||||
"desktops");
|
||||
|
||||
static bool checkX11Capabilities()
|
||||
{
|
||||
int bp1, bp2, majorv, minorv;
|
||||
@@ -47,7 +47,7 @@ static bool checkX11Capabilities()
|
||||
&majorv, &minorv);
|
||||
|
||||
if ((!r) || (((majorv * 1000) + minorv) < 2002)) {
|
||||
KMessageBox::error(0,
|
||||
KMessageBox::error(nullptr,
|
||||
i18n("Your X11 Server does not support the required XTest extension "
|
||||
"version 2.2. Sharing your desktop is not possible."),
|
||||
i18n("Desktop Sharing Error"));
|
||||
@@ -57,20 +57,34 @@ static bool checkX11Capabilities()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static void checkOldX11PluginConfig() {
|
||||
if (KrfbConfig::preferredFrameBufferPlugin() == QStringLiteral("x11")) {
|
||||
qDebug() << "Detected deprecated configuration: preferredFrameBufferPlugin = x11";
|
||||
qCDebug(KRFB) << "Detected deprecated configuration: preferredFrameBufferPlugin = x11";
|
||||
KConfigSkeletonItem *config_item = KrfbConfig::self()->findItem(
|
||||
QStringLiteral("preferredFrameBufferPlugin"));
|
||||
if (config_item) {
|
||||
config_item->setProperty(QStringLiteral("xcb"));
|
||||
KrfbConfig::self()->save();
|
||||
qDebug() << " Fixed preferredFrameBufferPlugin from x11 to xcb.";
|
||||
qCDebug(KRFB) << " Fixed preferredFrameBufferPlugin from x11 to xcb.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void checkWaylandPluginConfig()
|
||||
{
|
||||
if (KrfbConfig::preferredFrameBufferPlugin() != QStringLiteral("pw")) {
|
||||
qWarning() << "Wayland: Detected invalid configuration: "
|
||||
"preferredFrameBufferPlugin is not pipewire: "
|
||||
<< KrfbConfig::preferredFrameBufferPlugin();
|
||||
KConfigSkeletonItem *config_item = KrfbConfig::self()->findItem(
|
||||
QStringLiteral("preferredFrameBufferPlugin"));
|
||||
if (config_item) {
|
||||
config_item->setProperty(QStringLiteral("pw"));
|
||||
KrfbConfig::self()->save();
|
||||
qCDebug(KRFB) << "Wayland: Fixed preferredFrameBufferPlugin to \"pw\".";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -78,7 +92,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
KLocalizedString::setApplicationDomain("krfb");
|
||||
|
||||
KAboutData aboutData("krfb",
|
||||
KAboutData aboutData(QStringLiteral("krfb"),
|
||||
i18n("Desktop Sharing"),
|
||||
QStringLiteral(KRFB_VERSION_STRING),
|
||||
i18n(description),
|
||||
@@ -92,12 +106,12 @@ int main(int argc, char *argv[])
|
||||
"(c) 1999, AT&T Laboratories Boston\n"));
|
||||
aboutData.addAuthor(i18n("George Goldberg"),
|
||||
i18n("Telepathy tubes support"),
|
||||
"george.goldberg@collabora.co.uk");
|
||||
QStringLiteral("george.goldberg@collabora.co.uk"));
|
||||
aboutData.addAuthor(i18n("George Kiagiadakis"),
|
||||
QString(),
|
||||
"george.kiagiadakis@collabora.co.uk");
|
||||
aboutData.addAuthor(i18n("Alessandro Praduroux"), i18n("KDE4 porting"), "pradu@pradu.it");
|
||||
aboutData.addAuthor(i18n("Tim Jansen"), i18n("Original author"), "tim@tjansen.de");
|
||||
QStringLiteral("george.kiagiadakis@collabora.co.uk"));
|
||||
aboutData.addAuthor(i18n("Alessandro Praduroux"), i18n("KDE4 porting"), QStringLiteral("pradu@pradu.it"));
|
||||
aboutData.addAuthor(i18n("Tim Jansen"), i18n("Original author"), QStringLiteral("tim@tjansen.de"));
|
||||
aboutData.addCredit(i18n("Johannes E. Schindelin"),
|
||||
i18n("libvncserver"));
|
||||
aboutData.addCredit(i18n("Const Kaplinsky"),
|
||||
@@ -107,27 +121,38 @@ int main(int argc, char *argv[])
|
||||
aboutData.addCredit(i18n("AT&T Laboratories Boston"),
|
||||
i18n("original VNC encoders and "
|
||||
"protocol design"));
|
||||
QCommandLineParser parser;
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
parser.addVersionOption();
|
||||
parser.addHelpOption();
|
||||
|
||||
QCommandLineParser parser;
|
||||
aboutData.setupCommandLine(&parser);
|
||||
const QCommandLineOption nodialogOption(QStringList{ QStringLiteral("nodialog") }, i18n("Do not show the invitations management dialog at startup"));
|
||||
parser.addOption(nodialogOption);
|
||||
|
||||
parser.process(app);
|
||||
aboutData.processCommandLine(&parser);
|
||||
|
||||
KDBusService service(KDBusService::Unique, &app);
|
||||
|
||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("nodialog"), i18n("Do not show the invitations management dialog at startup")));
|
||||
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
|
||||
if (!checkX11Capabilities()) {
|
||||
if (KWindowSystem::isPlatformX11()) {
|
||||
if (!checkX11Capabilities()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// upgrade the configuration
|
||||
checkOldX11PluginConfig();
|
||||
} else if (KWindowSystem::isPlatformWayland()) {
|
||||
// check that default plugin in Wayland is PipeWire
|
||||
checkWaylandPluginConfig();
|
||||
} else {
|
||||
KMessageBox::error(nullptr,
|
||||
i18n("Desktop Sharing is not running under an X11 Server or Wayland.\n"
|
||||
"Other display servers are currently not supported."),
|
||||
i18n("Desktop Sharing Error"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// upgrade the configuration
|
||||
checkOldX11PluginConfig();
|
||||
|
||||
//init the core
|
||||
InvitationsRfbServer::init();
|
||||
|
||||
@@ -139,14 +164,14 @@ int main(int argc, char *argv[])
|
||||
mainWindow.hide();
|
||||
} else if (app.isSessionRestored() && KMainWindow::canBeRestored(1)) {
|
||||
mainWindow.restore(1, false);
|
||||
} else if (!parser.isSet("nodialog")) {
|
||||
} else if (!parser.isSet(nodialogOption)) {
|
||||
mainWindow.show();
|
||||
}
|
||||
|
||||
sigset_t sigs;
|
||||
sigemptyset(&sigs);
|
||||
sigaddset(&sigs, SIGPIPE);
|
||||
sigprocmask(SIG_BLOCK, &sigs, 0);
|
||||
sigprocmask(SIG_BLOCK, &sigs, nullptr);
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include <KConfigDialog>
|
||||
#include <KLocalizedString>
|
||||
#include <KMessageBox>
|
||||
#include <KMessageWidget>
|
||||
#include <KStandardAction>
|
||||
#include <KActionCollection>
|
||||
#include <KLineEdit>
|
||||
#include <KNewPasswordDialog>
|
||||
#include <KPluginLoader>
|
||||
#include <KPluginMetaData>
|
||||
@@ -32,13 +32,14 @@
|
||||
#include <QSizePolicy>
|
||||
#include <QVector>
|
||||
#include <QSet>
|
||||
#include <QtNetwork/QNetworkInterface>
|
||||
#include <QNetworkInterface>
|
||||
#include <QHostInfo>
|
||||
|
||||
|
||||
class TCP: public QWidget, public Ui::TCP
|
||||
{
|
||||
public:
|
||||
TCP(QWidget *parent = 0) : QWidget(parent) {
|
||||
TCP(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
}
|
||||
};
|
||||
@@ -46,15 +47,28 @@ public:
|
||||
class Security: public QWidget, public Ui::Security
|
||||
{
|
||||
public:
|
||||
Security(QWidget *parent = 0) : QWidget(parent) {
|
||||
Security(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
walletWarning = new KMessageWidget(this);
|
||||
walletWarning->setText(i18n("Storing passwords in config file is insecure!"));
|
||||
walletWarning->setCloseButtonVisible(false);
|
||||
walletWarning->setMessageType(KMessageWidget::Warning);
|
||||
walletWarning->hide();
|
||||
vboxLayout->addWidget(walletWarning);
|
||||
|
||||
// show warning when "noWallet" checkbox is checked
|
||||
QObject::connect(kcfg_noWallet, &QCheckBox::toggled, this, [this] (bool checked) {
|
||||
walletWarning->setVisible(checked);
|
||||
});
|
||||
}
|
||||
|
||||
KMessageWidget *walletWarning = nullptr;
|
||||
};
|
||||
|
||||
class ConfigFramebuffer: public QWidget, public Ui::Framebuffer
|
||||
{
|
||||
public:
|
||||
ConfigFramebuffer(QWidget *parent = 0) : QWidget(parent) {
|
||||
ConfigFramebuffer(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
// hide the line edit with framebuffer string
|
||||
kcfg_preferredFrameBufferPlugin->hide();
|
||||
@@ -92,13 +106,13 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
|
||||
m_passwordEditable = false;
|
||||
m_passwordLineEdit = new KLineEdit(this);
|
||||
m_passwordLineEdit = new QLineEdit(this);
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
m_passwordLineEdit->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
QWidget *mainWidget = new QWidget;
|
||||
m_ui.setupUi(mainWidget);
|
||||
m_ui.krfbIconLabel->setPixmap(QIcon::fromTheme("krfb").pixmap(128));
|
||||
m_ui.krfbIconLabel->setPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(128));
|
||||
m_ui.enableUnattendedCheckBox->setChecked(
|
||||
InvitationsRfbServer::instance->allowUnattendedAccess());
|
||||
|
||||
@@ -121,16 +135,20 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
// Figure out the address
|
||||
int port = KrfbConfig::port();
|
||||
QList<QNetworkInterface> interfaceList = QNetworkInterface::allInterfaces();
|
||||
foreach(const QNetworkInterface & interface, interfaceList) {
|
||||
const QList<QNetworkInterface> interfaceList = QNetworkInterface::allInterfaces();
|
||||
for (const QNetworkInterface& interface : interfaceList) {
|
||||
if(interface.flags() & QNetworkInterface::IsLoopBack)
|
||||
continue;
|
||||
|
||||
if(interface.flags() & QNetworkInterface::IsRunning &&
|
||||
!interface.addressEntries().isEmpty())
|
||||
m_ui.addressDisplayLabel->setText(QString("%1 : %2")
|
||||
.arg(interface.addressEntries().first().ip().toString())
|
||||
.arg(port));
|
||||
!interface.addressEntries().isEmpty()) {
|
||||
const QString hostName = QHostInfo::localHostName();
|
||||
const QString ipAddress = interface.addressEntries().constFirst().ip().toString();
|
||||
const QString addressLabelText = hostName.isEmpty()
|
||||
? QStringLiteral("%1 : %2").arg(ipAddress).arg(port)
|
||||
: QStringLiteral("%1 (%2) : %3").arg(hostName, ipAddress).arg(port);
|
||||
m_ui.addressDisplayLabel->setText(addressLabelText);
|
||||
}
|
||||
}
|
||||
|
||||
//Figure out the password
|
||||
@@ -157,7 +175,7 @@ void MainWindow::editPassword()
|
||||
{
|
||||
if(m_passwordEditable) {
|
||||
m_passwordEditable = false;
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme("document-properties"));
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
|
||||
m_ui.passwordGridLayout->removeWidget(m_passwordLineEdit);
|
||||
InvitationsRfbServer::instance->setDesktopPassword(
|
||||
m_passwordLineEdit->text());
|
||||
@@ -166,7 +184,7 @@ void MainWindow::editPassword()
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
} else {
|
||||
m_passwordEditable = true;
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme("document-save"));
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
|
||||
m_ui.passwordGridLayout->addWidget(m_passwordLineEdit,0,0);
|
||||
m_passwordLineEdit->setText(
|
||||
InvitationsRfbServer::instance->desktopPassword());
|
||||
@@ -198,7 +216,7 @@ void MainWindow::toggleDesktopSharing(bool enable)
|
||||
if(m_passwordEditable) {
|
||||
m_passwordEditable = false;
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme("document-properties"));
|
||||
m_ui.passwordEditButton->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,26 +244,41 @@ void MainWindow::aboutUnattendedMode()
|
||||
void MainWindow::showConfiguration()
|
||||
{
|
||||
static QString s_prevFramebufferPlugin;
|
||||
static bool s_prevNoWallet;
|
||||
// ^^ needs to be static, because lambda will be called long time
|
||||
// after showConfiguration() ends, so auto variable would go out of scope
|
||||
// save previously selected framebuffer plugin config
|
||||
s_prevFramebufferPlugin = KrfbConfig::preferredFrameBufferPlugin();
|
||||
s_prevNoWallet = KrfbConfig::noWallet();
|
||||
|
||||
if (KConfigDialog::showDialog("settings")) {
|
||||
if (KConfigDialog::showDialog(QStringLiteral("settings"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self());
|
||||
dialog->addPage(new TCP, i18n("Network"), "network-wired");
|
||||
dialog->addPage(new Security, i18n("Security"), "security-high");
|
||||
dialog->addPage(new ConfigFramebuffer, i18n("Screen capture"), "video-display");
|
||||
KConfigDialog *dialog = new KConfigDialog(this, QStringLiteral("settings"), KrfbConfig::self());
|
||||
dialog->addPage(new TCP, i18n("Network"), QStringLiteral("network-wired"));
|
||||
dialog->addPage(new Security, i18n("Security"), QStringLiteral("security-high"));
|
||||
dialog->addPage(new ConfigFramebuffer, i18n("Screen capture"), QStringLiteral("video-display"));
|
||||
dialog->show();
|
||||
connect(dialog, &KConfigDialog::settingsChanged, [this] () {
|
||||
connect(dialog, &KConfigDialog::settingsChanged, this, [this] () {
|
||||
// check if framebuffer plugin config has changed
|
||||
if (s_prevFramebufferPlugin != KrfbConfig::preferredFrameBufferPlugin()) {
|
||||
KMessageBox::information(this, i18n("To apply framebuffer plugin setting, "
|
||||
"you need to restart the program."));
|
||||
}
|
||||
// check if kwallet config has changed
|
||||
if (s_prevNoWallet != KrfbConfig::noWallet()) {
|
||||
// try to apply settings immediately
|
||||
if (KrfbConfig::noWallet()) {
|
||||
InvitationsRfbServer::instance->closeKWallet();
|
||||
} else {
|
||||
InvitationsRfbServer::instance->openKWallet();
|
||||
// erase stored passwords from krfbconfig file
|
||||
KConfigGroup securityConfigGroup(KSharedConfig::openConfig(), "Security");
|
||||
securityConfigGroup.deleteEntry("desktopPassword");
|
||||
securityConfigGroup.deleteEntry("unattendedPassword");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -262,5 +295,3 @@ void MainWindow::saveProperties(KConfigGroup& group)
|
||||
group.writeEntry("Visible", isVisible());
|
||||
KMainWindow::saveProperties(group);
|
||||
}
|
||||
|
||||
#include "mainwindow.moc"
|
||||
|
||||
@@ -8,22 +8,22 @@
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef MANAGEINVITATIONSDIALOG_H
|
||||
#define MANAGEINVITATIONSDIALOG_H
|
||||
#ifndef KRFB_MAINWINDOW_H
|
||||
#define KRFB_MAINWINDOW_H
|
||||
|
||||
#include "ui_mainwidget.h"
|
||||
|
||||
#include <KXmlGuiWindow>
|
||||
|
||||
class KLineEdit;
|
||||
class QLineEdit;
|
||||
|
||||
class MainWindow : public KXmlGuiWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow() override;
|
||||
|
||||
public Q_SLOTS:
|
||||
void showConfiguration();
|
||||
@@ -43,7 +43,7 @@ class MainWindow : public KXmlGuiWindow
|
||||
private:
|
||||
Ui::MainWidget m_ui;
|
||||
bool m_passwordEditable;
|
||||
KLineEdit *m_passwordLineEdit;
|
||||
QLineEdit *m_passwordLineEdit;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-2.0+</project_license>
|
||||
<name>Krfb</name>
|
||||
<name xml:lang="ast">Krfb</name>
|
||||
<name xml:lang="ca">Krfb</name>
|
||||
<name xml:lang="ca-valencia">Krfb</name>
|
||||
<name xml:lang="cs">Krfb</name>
|
||||
@@ -13,13 +12,17 @@
|
||||
<name xml:lang="el">Krfb</name>
|
||||
<name xml:lang="en-GB">Krfb</name>
|
||||
<name xml:lang="es">Krfb</name>
|
||||
<name xml:lang="et">Krfb</name>
|
||||
<name xml:lang="eu">Krfb</name>
|
||||
<name xml:lang="fi">Krfb</name>
|
||||
<name xml:lang="fr">Krfb</name>
|
||||
<name xml:lang="gl">Krfb</name>
|
||||
<name xml:lang="ia">Krfb</name>
|
||||
<name xml:lang="id">Krfb</name>
|
||||
<name xml:lang="it">Krfb</name>
|
||||
<name xml:lang="ko">Krfb</name>
|
||||
<name xml:lang="nl">Krfb</name>
|
||||
<name xml:lang="nn">Krfb</name>
|
||||
<name xml:lang="pl">Krfb</name>
|
||||
<name xml:lang="pt">Krfb</name>
|
||||
<name xml:lang="pt-BR">Krfb</name>
|
||||
@@ -35,57 +38,54 @@
|
||||
<name xml:lang="uk">Krfb</name>
|
||||
<name xml:lang="x-test">xxKrfbxx</name>
|
||||
<name xml:lang="zh-CN">Krfb</name>
|
||||
<summary>Desktop sharing</summary>
|
||||
<summary xml:lang="ast">Compartición d'escritoriu</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ílení 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="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="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="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>
|
||||
<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 xml:lang="zh-CN">通过 VNC 分享您的桌面到另一台电脑</summary>
|
||||
<description>
|
||||
<p>Krfb Desktop Sharing is a server application that allows you to share your current session with a user on another machine, who can use a VNC client to view or even control the desktop.</p>
|
||||
<p xml:lang="ast">Krfb ye una aplicación sirvidora que te permite compartir la to sesión actual con un usuariu n'otra máquina que puea usar un veceru VNC pa ver o controlar l'escritoriu.</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 veure o controlar l'escriptori.</p>
|
||||
<p xml:lang="ca-valencia">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 veure o controlar l'escriptori.</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>
|
||||
<p xml:lang="ca-valencia">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>
|
||||
<p xml:lang="da">Krfb-skrivebordsdeling er et serverprogram der giver dig mulighed for at dele din nuværende session med en bruger på en anden maskine som kan bruge en VNC-klient til at vise eller endda styrer skrivebordet.</p>
|
||||
<p xml:lang="de">Krfb ist eine Serveranwendung, welche die gemeinsame Benutzung der aktuellen Sitzung mit einem Benutzer auf einem anderen Rechner ermöglicht, der mit Hilfe eines VNC-Programms den Bildschirminhalt sehen oder sogar die Arbeitsfläche bedienen kann.</p>
|
||||
<p xml:lang="el">Η κοινή χρήση επιφάνειας εργασίας Krfb είναι μια εφαρμογή εξυπηρετητή που σας επιτρέπει να μοιράζεστε την τρέχουσα συνεδρία σας με έναν χρήστη σε άλλο μηχάνημα, ο οποίος μπορεί να χρησιμοποιεί έναν πελάτη VNC για να παρακολουθεί ή και να ελέγχει την επιφάνεια εργασίας σας.</p>
|
||||
<p xml:lang="en-GB">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="es">Krfb para compartir el escritorio es una aplicación de servidor que le permite compartir su sesión actual con un usuario de otra máquina, que puede usar un cliente VNC para ver e incluso controlar su escritorio.</p>
|
||||
<p xml:lang="et">Krfb töölaua jagamine on serverirakendus, mis võimaldab jagada aktiivset seanssi mõne teise masina taga istuva kasutajaga, kes saab VNC kliendi kaudu töölauda näha või isegi juhtida.</p>
|
||||
<p xml:lang="eu">Krfb Mahaigaina Partekatzea zerbitzari aplikazio bat da zure uneko saioa beste makina batean dagoen erabiltzaile batekin partekatzen uzten dizuna. Beste makinan VNC bezeroa erabil dezake zure mahaigaina ikusi edo baita kontrolatzeko ere.</p>
|
||||
<p xml:lang="fi">Krfb-työpöytäjako on palvelinsovellus, jolla voit jakaa nykyisen istuntosi toisen koneen käyttäjälle, joka voi VNC-asiakkaalla nähdä tai jopa hallita työpöytääsi.</p>
|
||||
<p xml:lang="fr">Le partage de bureau Krfb est une application de serveur qui vous permet de partager votre session courante avec un utilisateur sur une autre machine, qui peut utiliser un client VNC pour afficher et même contrôler le bureau.</p>
|
||||
<p xml:lang="gl">Krfb é un aplicativo de servidor que permite compartir a sesión actual cun usuario que está noutro equipo, que pode usar un cliente VNC para ver ou mesmo controlar o escritorio.</p>
|
||||
<p xml:lang="id">Krfb Desktop Sharing adalah aplikasi server yang membolehkan Anda untuk berbagi sesi Anda saat ini dengan pengguna di mesin lain, yang bisa menggunakan klien VNC untuk menampilkan atau bahkan mengendalikan desktop.</p>
|
||||
<p xml:lang="gl">Krfb é unha aplicación de servidor que permite compartir a sesión actual cun usuario que está noutro equipo, que pode usar un cliente VNC para ver ou mesmo controlar o escritorio.</p>
|
||||
<p xml:lang="ia">Krfb Desktop Sharing es un application de servitor que te permitte compartir tu session currente con un usator sur un altere machina,le qual pote usar un cliente VNC per vider o anque controlar le scriptorio.</p>
|
||||
<p xml:lang="id">Krfb Desktop Sharing adalah aplikasi server yang memungkinkan kamu untuk berbagi sesimu saat ini dengan pengguna di mesin lain, yang bisa menggunakan klien VNC untuk menampilkan atau bahkan mengendalikan desktop.</p>
|
||||
<p xml:lang="it">Condivisione del desktop Krfb è un'applicazione server che permette di condividere la sessione attuale con un utente su un'altra macchina, che potrà usare un client VNC per visualizzare ed anche controllare il desktop.</p>
|
||||
<p xml:lang="ko">Krfb 데스크톱 공유는 현재 세션을 다른 머신의 사용자와 VNC를 통해서 공유하거나 원격 제어를 요청할 수 있는 서버 프로그램입니다.</p>
|
||||
<p xml:lang="nl">Bureaublad delen is een server-applicatie die u in staat stelt uw huidige sessie te delen met een gebruiker op een andere machine, die een VNC-client kan gebruiken om uw bureaublad te bekijken of zelfs te besturen.</p>
|
||||
<p xml:lang="nn">Krfb skrivebordsdeling er eit tenarprogram som lèt deg dela skrivebordsøkta di med ein brukar på ei anna maskin. Vedkommande kan så bruka ein VNC-klient for å sjå og eventuelt òg styra økta.</p>
|
||||
<p xml:lang="pl">Współdzielenie pulpitu Krfb jest aplikacją serwerową, która umożliwia współdzielenie twojej bieżącej sesji z użytkownikiem na innym komputerze, który może użyć klienta VNC do oglądania,a a nawet sterowania twoim pulpitem.</p>
|
||||
<p xml:lang="pt">A Partilha de Ecrã Krfb é uma aplicação de servidor que lhe permite partilhar a sua sessão actual com um utilizador noutra máquina, o qual poderá usar um cliente de VNC para ver ou mesmo controlar o ambiente de trabalho.</p>
|
||||
<p xml:lang="pt-BR">Krfb Desktop Sharing é um aplicativo de servidor que lhe permite compartilhar a sua sessão atual com um usuário em outra máquina, que poderá usar um cliente de VNC para ver ou mesmo controlar a máquina.</p>
|
||||
<p xml:lang="ru">Krfb является сервером, который позволяет вам предоставлять доступ к своему текущему сеансу пользователю на другом компьютере, который использует клиент VNC для просмотра или управления вашим рабочим столом.</p>
|
||||
<p xml:lang="sk">Krfb je serverová aplikácia, ktorá vám umožní zdieľať vaše aktuálne sedenie s používateľom na inom stroji, ktorý môže používať VNC klienta na pripojenie alebo ovládanie stanice.</p>
|
||||
<p xml:lang="sl">Souporaba namizja Krfb je strežniški program, ki vam dovoli, da delite vašo trenutno sejo z uporabnikom na drugem računalniku, ki ima odjemalec VNC. Uporabnik lahko gleda ali celo nadzira namizje.</p>
|
||||
@@ -98,19 +98,56 @@
|
||||
<p xml:lang="uk">Програма для спільного використання стільниці Krfb — це серверна програма, яка надає вам змогу розділити ваш поточний сеанс роботи з користувачем, який працює на іншому комп’ютері, так, щоб цей користувач зміг скористатися клієнтом VNC для перегляду або навіть керування вашою стільницею.</p>
|
||||
<p xml:lang="x-test">xxKrfb 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.xx</p>
|
||||
<p xml:lang="zh-CN">Krfb 桌面共享是一个可以让您与另一个在其他机器上的用户共享当前会话的服务器程序,他可以使用 VNC 客户端来查看甚至控制桌面。</p>
|
||||
<p xml:lang="zh-TW">Krfb 桌面分享是款伺服器應用程式,它可以將您目前的桌面階段分享給一位於其他主機上的使用者,以讓他能使用 VNC 用戶端檢視、甚至控制您的桌面。</p>
|
||||
</description>
|
||||
<url type="homepage">https://www.kde.org</url>
|
||||
<url type="bugtracker">https://bugs.kde.org</url>
|
||||
<url type="homepage">https://userbase.kde.org/Krfb</url>
|
||||
<url type="bugtracker">https://bugs.kde.org/enter_bug.cgi?format=guided&product=krfb</url>
|
||||
<url type="donation">https://www.kde.org/community/donations</url>
|
||||
<url type="help">https://docs.kde.org/?application=krfb</url>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>
|
||||
https://cdn.kde.org/screenshots/krfb/krfb.png
|
||||
</image>
|
||||
<caption>Sharing desktop with Krfb</caption>
|
||||
<caption xml:lang="ca">Compartint l'escriptori amb el Krfb</caption>
|
||||
<caption xml:lang="ca-valencia">Compartint l'escriptori amb el Krfb</caption>
|
||||
<caption xml:lang="cs">Sdílím pracovní plochu pomocí Krfb</caption>
|
||||
<caption xml:lang="da">Deler skrivebord med Krfb</caption>
|
||||
<caption xml:lang="de">Freigabe der Arbeitsfläche mit Krfb</caption>
|
||||
<caption xml:lang="el">Κοινή χρήση επιφάνειας εργασίας με το Krfb</caption>
|
||||
<caption xml:lang="en-GB">Sharing desktop with Krfb</caption>
|
||||
<caption xml:lang="es">Compartiendo el escritorio con Krfb</caption>
|
||||
<caption xml:lang="et">Töölaua jagamine Krfb abil</caption>
|
||||
<caption xml:lang="eu">Mahaigaina Krfb-ren bidez partekatzea</caption>
|
||||
<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>
|
||||
<caption xml:lang="nl">Bureaublad delen met Krfb</caption>
|
||||
<caption xml:lang="nn">Skrivebordsdeling med Krfb</caption>
|
||||
<caption xml:lang="pl">Udostępnienie pulpitu przy użyciu Krfb</caption>
|
||||
<caption xml:lang="pt">Partilha do ecrã com o Krfb</caption>
|
||||
<caption xml:lang="pt-BR">Compartilhando a área de trabalho com o Krfb</caption>
|
||||
<caption xml:lang="ru">Общий доступ к рабочему столу с использованием Krfb</caption>
|
||||
<caption xml:lang="sk">Zdieľanie pracovnej plochy s Krfb</caption>
|
||||
<caption xml:lang="sl">Deljenje namizij s Krfb</caption>
|
||||
<caption xml:lang="sv">Dela skrivbord med Krfb</caption>
|
||||
<caption xml:lang="uk">Спільне використання стільниці за допомогою Krfb</caption>
|
||||
<caption xml:lang="x-test">xxSharing desktop with Krfbxx</caption>
|
||||
<caption xml:lang="zh-CN">使用 Krfb 共享桌面</caption>
|
||||
<caption xml:lang="zh-TW">使用 Krfb 分享桌面</caption>
|
||||
<image>https://cdn.kde.org/screenshots/krfb/krfb.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<provides>
|
||||
<binary>krfb</binary>
|
||||
</provides>
|
||||
<project_group>KDE</project_group>
|
||||
<releases>
|
||||
<release version="21.04.2" date="2021-06-10"/>
|
||||
<release version="21.04.1" date="2021-05-13"/>
|
||||
<release version="21.04.0" date="2021-04-22"/>
|
||||
<release version="20.12.3" date="2021-03-04"/>
|
||||
</releases>
|
||||
</component>
|
||||
|
||||
@@ -8,7 +8,6 @@ X-DocPath=krfb/index.html
|
||||
Terminal=false
|
||||
Name=Krfb
|
||||
Name[ar]=Krfb
|
||||
Name[ast]=Krfb
|
||||
Name[bg]=Krfb
|
||||
Name[bn]=কে-আর-এফ-বি
|
||||
Name[br]=Krfb
|
||||
@@ -75,81 +74,33 @@ Name[x-test]=xxKrfbxx
|
||||
Name[zh_CN]=Krfb
|
||||
Name[zh_HK]=Krfb
|
||||
Name[zh_TW]=桌面分享_Krfb
|
||||
GenericName=Desktop Sharing
|
||||
GenericName[ar]=مشاركة سطح المكتب
|
||||
GenericName[ast]=Compartición d'escritoriu
|
||||
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]=桌面分享
|
||||
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[zh_CN]=桌面共享 (VNC)
|
||||
Comment=Desktop Sharing
|
||||
Comment[af]=Werkskerm Deeling
|
||||
Comment[ar]=مشاركة سطح المكتب
|
||||
Comment[ast]=Compartición d'escritoriu
|
||||
Comment[bg]=Споделяне на работния плот
|
||||
Comment[bn]=ডেস্কটপ ভাগাভাগি
|
||||
Comment[br]=Rannañ ar vurev
|
||||
@@ -218,5 +169,6 @@ Comment[x-test]=xxDesktop Sharingxx
|
||||
Comment[zh_CN]=桌面共享
|
||||
Comment[zh_HK]=桌面分享
|
||||
Comment[zh_TW]=桌面分享
|
||||
Categories=Qt;KDE;System;Network;RemoteAccess;
|
||||
Categories=Qt;KDE;Network;RemoteAccess;
|
||||
X-DBUS-ServiceName=org.kde.krfb
|
||||
X-KDE-Wayland-Interfaces=org_kde_kwin_fake_input,org_kde_kwin_remote_access_manager
|
||||
|
||||
@@ -21,9 +21,8 @@
|
||||
#include "connectiondialog.h"
|
||||
#include "krfbconfig.h"
|
||||
#include "sockethelpers.h"
|
||||
#include "events.h"
|
||||
#include <QtCore/QSocketNotifier>
|
||||
#include <QDebug>
|
||||
#include "eventsmanager.h"
|
||||
#include <QSocketNotifier>
|
||||
#include <poll.h>
|
||||
#include <strings.h> //for bzero()
|
||||
|
||||
@@ -37,18 +36,21 @@ struct RfbClient::Private
|
||||
bool controlEnabled;
|
||||
rfbClientPtr client;
|
||||
QSocketNotifier *notifier;
|
||||
QSharedPointer<EventHandler> eventHandler;
|
||||
QString remoteAddressString;
|
||||
};
|
||||
|
||||
RfbClient::RfbClient(rfbClientPtr client, QObject* parent)
|
||||
: QObject(parent), d(new Private(client))
|
||||
{
|
||||
d->remoteAddressString = peerAddress(d->client->sock) + ":" +
|
||||
d->remoteAddressString = peerAddress(d->client->sock) + QLatin1Char(':') +
|
||||
QString::number(peerPort(d->client->sock));
|
||||
|
||||
d->notifier = new QSocketNotifier(client->sock, QSocketNotifier::Read, this);
|
||||
d->notifier->setEnabled(false);
|
||||
connect(d->notifier, &QSocketNotifier::activated, this, &RfbClient::onSocketActivated);
|
||||
|
||||
d->eventHandler = EventsManager::instance()->eventHandler();
|
||||
}
|
||||
|
||||
RfbClient::~RfbClient()
|
||||
@@ -110,14 +112,14 @@ rfbClientPtr RfbClient::getRfbClientPtr()
|
||||
void RfbClient::handleKeyboardEvent(bool down, rfbKeySym keySym)
|
||||
{
|
||||
if (d->controlEnabled) {
|
||||
EventHandler::handleKeyboard(down, keySym);
|
||||
d->eventHandler->handleKeyboard(down, keySym);
|
||||
}
|
||||
}
|
||||
|
||||
void RfbClient::handleMouseEvent(int buttonMask, int x, int y)
|
||||
{
|
||||
if (d->controlEnabled) {
|
||||
EventHandler::handlePointer(buttonMask, x, y);
|
||||
d->eventHandler->handlePointer(buttonMask, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +199,7 @@ void PendingRfbClient::reject()
|
||||
rfbCloseClient(m_rfbClient);
|
||||
rfbClientConnectionGone(m_rfbClient);
|
||||
|
||||
Q_EMIT finished(NULL);
|
||||
Q_EMIT finished(nullptr);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
@@ -205,7 +207,7 @@ bool PendingRfbClient::checkPassword(const QByteArray & encryptedPassword)
|
||||
{
|
||||
Q_UNUSED(encryptedPassword);
|
||||
|
||||
return m_rfbClient->screen->authPasswdData == (void*)0;
|
||||
return m_rfbClient->screen->authPasswdData == (void*)nullptr;
|
||||
}
|
||||
|
||||
bool PendingRfbClient::vncAuthCheckPassword(const QByteArray& password, const QByteArray& encryptedPassword) const
|
||||
@@ -214,19 +216,17 @@ bool PendingRfbClient::vncAuthCheckPassword(const QByteArray& password, const QB
|
||||
return true;
|
||||
}
|
||||
|
||||
char passwd[MAXPWLEN];
|
||||
char passwd[MAXPWLEN+1]; // +1 to make sure there's a nullptr at the end
|
||||
unsigned char challenge[CHALLENGESIZE];
|
||||
|
||||
memcpy(challenge, m_rfbClient->authChallenge, CHALLENGESIZE);
|
||||
bzero(passwd, MAXPWLEN);
|
||||
memset(passwd, 0, sizeof(passwd));
|
||||
|
||||
if (!password.isEmpty()) {
|
||||
strncpy(passwd, password,
|
||||
strncpy(passwd, password.constData(),
|
||||
(MAXPWLEN <= password.size()) ? MAXPWLEN : password.size());
|
||||
}
|
||||
|
||||
rfbEncryptBytes(challenge, passwd);
|
||||
return memcmp(challenge, encryptedPassword, encryptedPassword.size()) == 0;
|
||||
return memcmp(challenge, encryptedPassword.constData(), encryptedPassword.size()) == 0;
|
||||
}
|
||||
|
||||
#include "rfbclient.moc"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define RFBCLIENT_H
|
||||
|
||||
#include "rfb.h"
|
||||
#include <QtCore/QObject>
|
||||
#include <QObject>
|
||||
|
||||
class RfbClient : public QObject
|
||||
{
|
||||
@@ -29,8 +29,8 @@ class RfbClient : public QObject
|
||||
Q_PROPERTY(bool controlEnabled READ controlEnabled WRITE setControlEnabled NOTIFY controlEnabledChanged)
|
||||
Q_PROPERTY(bool onHold READ isOnHold WRITE setOnHold NOTIFY holdStatusChanged)
|
||||
public:
|
||||
RfbClient(rfbClientPtr client, QObject *parent = 0);
|
||||
virtual ~RfbClient();
|
||||
explicit RfbClient(rfbClientPtr client, QObject *parent = nullptr);
|
||||
~RfbClient() override;
|
||||
|
||||
/** Returns a name for the client, to be shown to the user */
|
||||
virtual QString name() const;
|
||||
@@ -73,8 +73,8 @@ class PendingRfbClient : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PendingRfbClient(rfbClientPtr client, QObject *parent = 0);
|
||||
virtual ~PendingRfbClient();
|
||||
explicit PendingRfbClient(rfbClientPtr client, QObject *parent = nullptr);
|
||||
~PendingRfbClient() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void finished(RfbClient *client);
|
||||
@@ -97,7 +97,7 @@ protected:
|
||||
virtual bool checkPassword(const QByteArray & encryptedPassword);
|
||||
|
||||
/** This method checks if the \a encryptedPassword that was sent from the remote
|
||||
* user matches the \a password that you have specified localy to be the password
|
||||
* user matches the \a password that you have specified locally to be the password
|
||||
* for this connection. This assumes that the standard VNC authentication mechanism
|
||||
* is used. Returns true if the password matches or false otherwise.
|
||||
*/
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
*/
|
||||
#include "rfbserver.h"
|
||||
#include "rfbservermanager.h"
|
||||
#include <QtCore/QSocketNotifier>
|
||||
#include "krfbdebug.h"
|
||||
#include <QSocketNotifier>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QDebug>
|
||||
#include <QPointer>
|
||||
#include <QX11Info>
|
||||
|
||||
struct RfbServer::Private
|
||||
{
|
||||
@@ -30,7 +32,8 @@ struct RfbServer::Private
|
||||
int listeningPort;
|
||||
bool passwordRequired;
|
||||
rfbScreenInfoPtr screen;
|
||||
QSocketNotifier *notifier;
|
||||
QPointer<QSocketNotifier> ipv4notifier;
|
||||
QPointer<QSocketNotifier> ipv6notifier;
|
||||
};
|
||||
|
||||
RfbServer::RfbServer(QObject *parent)
|
||||
@@ -39,8 +42,7 @@ RfbServer::RfbServer(QObject *parent)
|
||||
d->listeningAddress = "0.0.0.0";
|
||||
d->listeningPort = 0;
|
||||
d->passwordRequired = true;
|
||||
d->screen = NULL;
|
||||
d->notifier = NULL;
|
||||
d->screen = nullptr;
|
||||
|
||||
RfbServerManager::instance()->registerServer(this);
|
||||
}
|
||||
@@ -90,7 +92,7 @@ bool RfbServer::start()
|
||||
if (!d->screen) {
|
||||
d->screen = RfbServerManager::instance()->newScreen();
|
||||
if (!d->screen) {
|
||||
qDebug() << "Unable to get rbfserver screen";
|
||||
qCDebug(KRFB) << "Unable to get rbfserver screen";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -107,7 +109,7 @@ bool RfbServer::start()
|
||||
}
|
||||
|
||||
if (listeningAddress() != "0.0.0.0") {
|
||||
strncpy(d->screen->thisHost, listeningAddress().data(), 254);
|
||||
strncpy(d->screen->thisHost, listeningAddress().constData(), 254);
|
||||
}
|
||||
|
||||
if (listeningPort() == 0) {
|
||||
@@ -120,26 +122,33 @@ bool RfbServer::start()
|
||||
if (passwordRequired()) {
|
||||
d->screen->authPasswdData = (void *)1;
|
||||
} else {
|
||||
d->screen->authPasswdData = (void *)0;
|
||||
d->screen->authPasswdData = (void *)nullptr;
|
||||
}
|
||||
|
||||
qDebug() << "Starting server. Listen port:" << listeningPort()
|
||||
qCDebug(KRFB) << "Starting server. Listen port:" << listeningPort()
|
||||
<< "Listen Address:" << listeningAddress()
|
||||
<< "Password enabled:" << passwordRequired();
|
||||
|
||||
rfbInitServer(d->screen);
|
||||
|
||||
if (!rfbIsActive(d->screen)) {
|
||||
qDebug() << "Failed to start server";
|
||||
qCDebug(KRFB) << "Failed to start server";
|
||||
rfbShutdownServer(d->screen, false);
|
||||
return false;
|
||||
};
|
||||
|
||||
d->notifier = new QSocketNotifier(d->screen->listenSock, QSocketNotifier::Read, this);
|
||||
d->notifier->setEnabled(true);
|
||||
connect(d->notifier, &QSocketNotifier::activated, this, &RfbServer::onListenSocketActivated);
|
||||
connect(QApplication::clipboard(), &QClipboard::dataChanged,
|
||||
this, &RfbServer::krfbSendServerCutText);
|
||||
d->ipv4notifier = new QSocketNotifier(d->screen->listenSock, QSocketNotifier::Read, this);
|
||||
connect(d->ipv4notifier, &QSocketNotifier::activated, this, &RfbServer::onListenSocketActivated);
|
||||
if (d->screen->listen6Sock > 0) {
|
||||
// we're also listening on additional IPv6 socket, get events from there
|
||||
d->ipv6notifier = new QSocketNotifier(d->screen->listen6Sock, QSocketNotifier::Read, this);
|
||||
connect(d->ipv6notifier, &QSocketNotifier::activated, this, &RfbServer::onListenSocketActivated);
|
||||
}
|
||||
|
||||
if (QX11Info::isPlatformX11()) {
|
||||
connect(QApplication::clipboard(), &QClipboard::dataChanged,
|
||||
this, &RfbServer::krfbSendServerCutText);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -148,14 +157,26 @@ void RfbServer::stop()
|
||||
{
|
||||
if (d->screen) {
|
||||
rfbShutdownServer(d->screen, true);
|
||||
if (d->notifier) {
|
||||
d->notifier->setEnabled(false);
|
||||
d->notifier->deleteLater();
|
||||
d->notifier = NULL;
|
||||
for (auto notifier : {d->ipv4notifier, d->ipv6notifier}) {
|
||||
if (notifier) {
|
||||
notifier->setEnabled(false);
|
||||
notifier->deleteLater();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RfbServer::updateFrameBuffer(char *fb, int width, int height, int depth)
|
||||
{
|
||||
int bpp = depth >> 3;
|
||||
|
||||
if (bpp != 1 && bpp != 2 && bpp != 4) {
|
||||
bpp = 4;
|
||||
}
|
||||
|
||||
rfbNewFramebuffer(d->screen, fb, width, height, 8, 3, bpp);
|
||||
}
|
||||
|
||||
void RfbServer::updateScreen(const QList<QRect> & modifiedTiles)
|
||||
{
|
||||
if (d->screen) {
|
||||
@@ -187,7 +208,7 @@ void krfb_rfbSetCursorPosition(rfbScreenInfoPtr screen, rfbClientPtr client, int
|
||||
|
||||
/* Inform all clients about this cursor movement. */
|
||||
iterator = rfbGetClientIterator(screen);
|
||||
while ((cl = rfbClientIteratorNext(iterator)) != NULL) {
|
||||
while ((cl = rfbClientIteratorNext(iterator)) != nullptr) {
|
||||
cl->cursorWasMoved = true;
|
||||
}
|
||||
rfbReleaseClientIterator(iterator);
|
||||
@@ -201,7 +222,7 @@ void krfb_rfbSetCursorPosition(rfbScreenInfoPtr screen, rfbClientPtr client, int
|
||||
void RfbServer::updateCursorPosition(const QPoint & position)
|
||||
{
|
||||
if (d->screen) {
|
||||
krfb_rfbSetCursorPosition(d->screen, NULL, position.x(), position.y());
|
||||
krfb_rfbSetCursorPosition(d->screen, nullptr, position.x(), position.y());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +253,7 @@ void RfbServer::pendingClientFinished(RfbClient *client)
|
||||
rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
|
||||
{
|
||||
//qDebug() << "New client";
|
||||
RfbServer *server = static_cast<RfbServer*>(cl->screen->screenData);
|
||||
auto server = static_cast<RfbServer*>(cl->screen->screenData);
|
||||
|
||||
PendingRfbClient *pendingClient = server->newClient(cl);
|
||||
connect(pendingClient, &PendingRfbClient::finished,
|
||||
@@ -245,7 +266,7 @@ rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
|
||||
void RfbServer::clientGoneHook(rfbClientPtr cl)
|
||||
{
|
||||
//qDebug() << "client gone";
|
||||
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
|
||||
auto client = static_cast<RfbClient*>(cl->clientData);
|
||||
|
||||
RfbServerManager::instance()->removeClient(client);
|
||||
client->deleteLater();
|
||||
@@ -254,7 +275,7 @@ void RfbServer::clientGoneHook(rfbClientPtr cl)
|
||||
//static
|
||||
rfbBool RfbServer::passwordCheck(rfbClientPtr cl, const char *encryptedPassword, int len)
|
||||
{
|
||||
PendingRfbClient *client = static_cast<PendingRfbClient*>(cl->clientData);
|
||||
auto client = static_cast<PendingRfbClient*>(cl->clientData);
|
||||
Q_ASSERT(client);
|
||||
return client->checkPassword(QByteArray::fromRawData(encryptedPassword, len));
|
||||
}
|
||||
@@ -262,14 +283,14 @@ rfbBool RfbServer::passwordCheck(rfbClientPtr cl, const char *encryptedPassword,
|
||||
//static
|
||||
void RfbServer::keyboardHook(rfbBool down, rfbKeySym keySym, rfbClientPtr cl)
|
||||
{
|
||||
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
|
||||
auto client = static_cast<RfbClient*>(cl->clientData);
|
||||
client->handleKeyboardEvent(down ? true : false, keySym);
|
||||
}
|
||||
|
||||
//static
|
||||
void RfbServer::pointerHook(int bm, int x, int y, rfbClientPtr cl)
|
||||
{
|
||||
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
|
||||
auto client = static_cast<RfbClient*>(cl->clientData);
|
||||
client->handleMouseEvent(bm, x, y);
|
||||
}
|
||||
|
||||
@@ -278,5 +299,3 @@ void RfbServer::clipboardHook(char *str, int len, rfbClientPtr /*cl*/)
|
||||
{
|
||||
QApplication::clipboard()->setText(QString::fromLocal8Bit(str,len));
|
||||
}
|
||||
|
||||
#include "rfbserver.moc"
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
|
||||
#include "rfb.h"
|
||||
#include "rfbclient.h"
|
||||
#include <QtCore/QRect>
|
||||
#include <QRect>
|
||||
|
||||
class RfbServer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RfbServer(QObject *parent = 0);
|
||||
virtual ~RfbServer();
|
||||
explicit RfbServer(QObject *parent = nullptr);
|
||||
~RfbServer() override;
|
||||
|
||||
QByteArray listeningAddress() const;
|
||||
int listeningPort() const;
|
||||
@@ -43,6 +43,7 @@ public Q_SLOTS:
|
||||
virtual bool start();
|
||||
virtual void stop();
|
||||
|
||||
void updateFrameBuffer(char *fb, int width, int height, int depth);
|
||||
void updateScreen(const QList<QRect> & modifiedTiles);
|
||||
void updateCursorPosition(const QPoint & position);
|
||||
|
||||
|
||||
@@ -24,12 +24,11 @@
|
||||
#include "framebuffermanager.h"
|
||||
#include "sockethelpers.h"
|
||||
#include "krfbconfig.h"
|
||||
#include <QtCore/QTimer>
|
||||
#include <QTimer>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGlobalStatic>
|
||||
#include <QtNetwork/QHostInfo>
|
||||
#include <QDebug>
|
||||
#include <QHostInfo>
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <KUser>
|
||||
@@ -90,7 +89,6 @@ RfbServerManager* RfbServerManager::instance()
|
||||
return &s_instance->server;
|
||||
}
|
||||
|
||||
|
||||
struct RfbServerManager::Private
|
||||
{
|
||||
QSharedPointer<FrameBuffer> fb;
|
||||
@@ -113,6 +111,11 @@ RfbServerManager::~RfbServerManager()
|
||||
delete d;
|
||||
}
|
||||
|
||||
QSharedPointer<FrameBuffer> RfbServerManager::framebuffer() const
|
||||
{
|
||||
return d->fb;
|
||||
}
|
||||
|
||||
void RfbServerManager::init()
|
||||
{
|
||||
//qDebug();
|
||||
@@ -120,19 +123,27 @@ void RfbServerManager::init()
|
||||
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId());
|
||||
d->myCursor = rfbMakeXCursor(19, 19, (char *) cur, (char *) mask);
|
||||
d->myCursor->cleanup = false;
|
||||
d->desktopName = QString("%1@%2 (shared desktop)") //FIXME check if we can use utf8
|
||||
d->desktopName = QStringLiteral("%1@%2 (shared desktop)") //FIXME check if we can use utf8
|
||||
.arg(KUser().loginName(),QHostInfo::localHostName()).toLatin1();
|
||||
|
||||
connect(d->fb.data(), &FrameBuffer::frameBufferChanged, this, &RfbServerManager::updateFrameBuffer);
|
||||
connect(&d->rfbUpdateTimer, &QTimer::timeout, this, &RfbServerManager::updateScreens);
|
||||
connect(qApp, &QApplication::aboutToQuit, this, &RfbServerManager::cleanup);
|
||||
}
|
||||
|
||||
void RfbServerManager::updateFrameBuffer()
|
||||
{
|
||||
Q_FOREACH(RfbServer *server, d->servers) {
|
||||
server->updateFrameBuffer(d->fb->data(), d->fb->width(), d->fb->height(), d->fb->depth());
|
||||
}
|
||||
}
|
||||
|
||||
void RfbServerManager::updateScreens()
|
||||
{
|
||||
QList<QRect> rects = d->fb->modifiedTiles();
|
||||
QPoint currentCursorPos = QCursor::pos();
|
||||
|
||||
Q_FOREACH(RfbServer *server, d->servers) {
|
||||
for (RfbServer* server : qAsConst(d->servers)) {
|
||||
server->updateScreen(rects);
|
||||
server->updateCursorPosition(currentCursorPos);
|
||||
}
|
||||
@@ -140,8 +151,8 @@ void RfbServerManager::updateScreens()
|
||||
//update() might disconnect some of the clients, which will synchronously
|
||||
//call the removeClient() method and will change d->clients, so we need
|
||||
//to copy the set here to avoid problems.
|
||||
QSet<RfbClient*> clients = d->clients;
|
||||
Q_FOREACH(RfbClient *client, clients) {
|
||||
const QSet<RfbClient*> clients = d->clients;
|
||||
for (RfbClient* client : clients) {
|
||||
client->update();
|
||||
}
|
||||
}
|
||||
@@ -151,10 +162,8 @@ void RfbServerManager::cleanup()
|
||||
//qDebug();
|
||||
|
||||
//copy because d->servers is going to be modified while we delete the servers
|
||||
QSet<RfbServer*> servers = d->servers;
|
||||
Q_FOREACH(RfbServer *server, servers) {
|
||||
delete server;
|
||||
}
|
||||
const QSet<RfbServer*> servers = d->servers;
|
||||
qDeleteAll(servers);
|
||||
|
||||
Q_ASSERT(d->servers.isEmpty());
|
||||
Q_ASSERT(d->clients.isEmpty());
|
||||
@@ -176,7 +185,7 @@ void RfbServerManager::unregisterServer(RfbServer* server)
|
||||
|
||||
rfbScreenInfoPtr RfbServerManager::newScreen()
|
||||
{
|
||||
rfbScreenInfoPtr screen = NULL;
|
||||
rfbScreenInfoPtr screen = nullptr;
|
||||
|
||||
if (!d->fb.isNull()) {
|
||||
int w = d->fb->width();
|
||||
@@ -192,11 +201,10 @@ rfbScreenInfoPtr RfbServerManager::newScreen()
|
||||
|
||||
rfbLogEnable(0);
|
||||
|
||||
screen = rfbGetScreen(0, 0, w, h, 8, 3, bpp);
|
||||
screen = rfbGetScreen(nullptr, nullptr, w, h, 8, 3, bpp);
|
||||
screen->paddedWidthInBytes = d->fb->paddedWidth();
|
||||
d->fb->getServerFormat(screen->serverFormat);
|
||||
screen->frameBuffer = d->fb->data();
|
||||
|
||||
screen->desktopName = d->desktopName.constData();
|
||||
screen->cursor = d->myCursor;
|
||||
}
|
||||
@@ -213,7 +221,7 @@ void RfbServerManager::addClient(RfbClient* cc)
|
||||
}
|
||||
d->clients.insert(cc);
|
||||
|
||||
KNotification::event("UserAcceptsConnection",
|
||||
KNotification::event(QStringLiteral("UserAcceptsConnection"),
|
||||
i18n("The remote user %1 is now connected.", cc->name()));
|
||||
|
||||
Q_EMIT clientConnected(cc);
|
||||
@@ -228,9 +236,7 @@ void RfbServerManager::removeClient(RfbClient* cc)
|
||||
d->rfbUpdateTimer.stop();
|
||||
}
|
||||
|
||||
KNotification::event("ConnectionClosed", i18n("The remote user %1 disconnected.", cc->name()));
|
||||
KNotification::event(QStringLiteral("ConnectionClosed"), i18n("The remote user %1 disconnected.", cc->name()));
|
||||
|
||||
Q_EMIT clientDisconnected(cc);
|
||||
}
|
||||
|
||||
#include "rfbservermanager.moc"
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#define RFBSERVERMANAGER_H
|
||||
|
||||
#include "rfb.h"
|
||||
#include <QtCore/QObject>
|
||||
#include "framebuffer.h"
|
||||
#include <QObject>
|
||||
|
||||
class RfbClient;
|
||||
struct RfbServerManagerStatic;
|
||||
@@ -33,12 +34,14 @@ class RfbServerManager : public QObject
|
||||
public:
|
||||
static RfbServerManager *instance();
|
||||
|
||||
QSharedPointer<FrameBuffer> framebuffer() const;
|
||||
Q_SIGNALS:
|
||||
void clientConnected(RfbClient *cc);
|
||||
void clientDisconnected(RfbClient *cc);
|
||||
|
||||
private Q_SLOTS:
|
||||
void init();
|
||||
void updateFrameBuffer();
|
||||
void updateScreens();
|
||||
void cleanup();
|
||||
|
||||
@@ -52,7 +55,7 @@ private:
|
||||
void removeClient(RfbClient *cc);
|
||||
|
||||
RfbServerManager();
|
||||
virtual ~RfbServerManager();
|
||||
~RfbServerManager() override;
|
||||
Q_DISABLE_COPY(RfbServerManager)
|
||||
|
||||
friend class RfbServer;
|
||||
|
||||
@@ -28,37 +28,35 @@
|
||||
|
||||
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) {
|
||||
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
|
||||
return QString(inet_ntoa(si->sin_addr));
|
||||
auto si = (struct sockaddr_in *)&sa;
|
||||
return QString::fromLatin1(inet_ntoa(si->sin_addr));
|
||||
}
|
||||
|
||||
if (sa.sa_family == AF_INET6) {
|
||||
char inetbuf[ADDR_SIZE];
|
||||
inet_ntop(sa.sa_family, &sa, inetbuf, ADDR_SIZE);
|
||||
return QString(inetbuf);
|
||||
return QString::fromLatin1(inetbuf);
|
||||
}
|
||||
|
||||
return QString("not a network address");
|
||||
return QStringLiteral("not a network address");
|
||||
}
|
||||
|
||||
return QString("unable to determine...");
|
||||
return QStringLiteral("unable to determine...");
|
||||
}
|
||||
|
||||
unsigned short peerPort(int sock)
|
||||
{
|
||||
|
||||
struct sockaddr sa;
|
||||
struct sockaddr sa = {};
|
||||
socklen_t salen = sizeof(struct sockaddr);
|
||||
|
||||
if (getpeername(sock, &sa, &salen) == 0) {
|
||||
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
|
||||
auto si = (struct sockaddr_in *)&sa;
|
||||
return ntohs(si->sin_port);
|
||||
}
|
||||
|
||||
@@ -67,37 +65,35 @@ 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) {
|
||||
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
|
||||
return QString(inet_ntoa(si->sin_addr));
|
||||
auto si = (struct sockaddr_in *)&sa;
|
||||
return QString::fromLatin1(inet_ntoa(si->sin_addr));
|
||||
}
|
||||
|
||||
if (sa.sa_family == AF_INET6) {
|
||||
char inetbuf[ADDR_SIZE];
|
||||
inet_ntop(sa.sa_family, &sa, inetbuf, ADDR_SIZE);
|
||||
return QString(inetbuf);
|
||||
return QString::fromLatin1(inetbuf);
|
||||
}
|
||||
|
||||
return QString("not a network address");
|
||||
return QStringLiteral("not a network address");
|
||||
}
|
||||
|
||||
return QString("unable to determine...");
|
||||
return QStringLiteral("unable to determine...");
|
||||
}
|
||||
|
||||
unsigned short localPort(int sock)
|
||||
{
|
||||
|
||||
struct sockaddr sa;
|
||||
struct sockaddr sa = {};
|
||||
socklen_t salen = sizeof(struct sockaddr);
|
||||
|
||||
if (getsockname(sock, &sa, &salen) == 0) {
|
||||
struct sockaddr_in *si = (struct sockaddr_in *)&sa;
|
||||
auto si = (struct sockaddr_in *)&sa;
|
||||
return ntohs(si->sin_port);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <QtCore/QString>
|
||||
#ifndef SOCKETHELPERS_H
|
||||
#define SOCKETHELPERS_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
QString peerAddress(int sock);
|
||||
unsigned short peerPort(int sock);
|
||||
@@ -28,3 +31,4 @@ unsigned short peerPort(int sock);
|
||||
QString localAddress(int sock);
|
||||
unsigned short localPort(int sock);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -68,7 +68,7 @@ ClientActions::ClientActions(RfbClient* client, QMenu* menu, QAction* before)
|
||||
QObject::connect(client, &RfbClient::controlEnabledChanged,
|
||||
m_enableControlAction, &KToggleAction::setChecked);
|
||||
} else {
|
||||
m_enableControlAction = NULL;
|
||||
m_enableControlAction = nullptr;
|
||||
}
|
||||
|
||||
m_separator = m_menu->insertSeparator(before);
|
||||
@@ -96,7 +96,7 @@ ClientActions::~ClientActions()
|
||||
TrayIcon::TrayIcon(QWidget *mainWindow)
|
||||
: KStatusNotifierItem(mainWindow)
|
||||
{
|
||||
setIconByPixmap(QIcon::fromTheme("krfb").pixmap(22, 22, QIcon::Disabled));
|
||||
setIconByPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(22, 22, QIcon::Disabled));
|
||||
|
||||
setToolTipTitle(i18n("Desktop Sharing - disconnected"));
|
||||
setCategory(KStatusNotifierItem::ApplicationStatus);
|
||||
@@ -113,7 +113,7 @@ TrayIcon::TrayIcon(QWidget *mainWindow)
|
||||
void TrayIcon::onClientConnected(RfbClient* client)
|
||||
{
|
||||
if (m_clientActions.isEmpty()) { //first client connected
|
||||
setIconByName("krfb");
|
||||
setIconByName(QStringLiteral("krfb"));
|
||||
setToolTipTitle(i18n("Desktop Sharing - connected with %1", client->name()));
|
||||
setStatus(KStatusNotifierItem::Active);
|
||||
} else { //Nth client connected, N != 1
|
||||
@@ -129,7 +129,7 @@ void TrayIcon::onClientDisconnected(RfbClient* client)
|
||||
delete actions;
|
||||
|
||||
if (m_clientActions.isEmpty()) {
|
||||
setIconByPixmap(QIcon::fromTheme("krfb").pixmap(22, 22, QIcon::Disabled));
|
||||
setIconByPixmap(QIcon::fromTheme(QStringLiteral("krfb")).pixmap(22, 22, QIcon::Disabled));
|
||||
setToolTipTitle(i18n("Desktop Sharing - disconnected"));
|
||||
setStatus(KStatusNotifierItem::Passive);
|
||||
} else if (m_clientActions.size() == 1) { //clients number dropped back to 1
|
||||
@@ -143,5 +143,3 @@ void TrayIcon::showAbout()
|
||||
KHelpMenu menu;
|
||||
menu.aboutApplication();
|
||||
}
|
||||
|
||||
#include "trayicon.moc"
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef TRAYICON_H
|
||||
#define TRAYICON_H
|
||||
|
||||
#include <QHash>
|
||||
|
||||
#include <KStatusNotifierItem>
|
||||
|
||||
class RfbClient;
|
||||
@@ -32,7 +34,7 @@ class TrayIcon : public KStatusNotifierItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrayIcon(QWidget *mainWindow);
|
||||
explicit TrayIcon(QWidget *mainWindow);
|
||||
|
||||
public Q_SLOTS:
|
||||
void onClientConnected(RfbClient *client);
|
||||
|
||||
@@ -21,6 +21,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_noWallet">
|
||||
<property name="text">
|
||||
<string>Do not store passwords using KDE wallet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
|
||||
@@ -10,12 +10,6 @@
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_publishService" >
|
||||
<property name="text" >
|
||||
@@ -37,14 +31,20 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<layout class="QFormLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Listening port:</string>
|
||||
@@ -54,7 +54,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="kcfg_port" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
@@ -66,6 +66,19 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
||||
Reference in New Issue
Block a user