Skip to content

Commit 19a85d2

Browse files
committed
Merge branch 'master' into multicastvnc
2 parents 2771ce3 + 2a23c44 commit 19a85d2

File tree

21 files changed

+405
-1201
lines changed

21 files changed

+405
-1201
lines changed

.clang-format

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4

AUTHORS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ Fabrice Fontaine, Cédric Georges, Stefan Weil, Rolf Eike Beer, Andreas Weigel,
4848
Gaurav Ujjwal, Tobias Junghans, Efim Bushmanov, Jonas Ådahl, Andri Yngvason,
4949
Tim Gates, Dinglan Peng, Ryo Ota, Kyle Evans, Kang Lin, Derek Schrock,
5050
Alex Converse, Thorsten Scherer, Marco Fortina, Antenore Gatta, Maxim Devaev
51-
and Maksym Sobolyev.
51+
Maksym Sobolyev, Huben Chang, Peter Vicman, Johann Obermayr, Nicolas Morais,
52+
Volodymyr Samokhatko, Mingjie Shen, Joris Hans Meijer, Sérgio Basto,
53+
Jeffrey Knockel and Christian Hitz.
5254

5355
Probably we forgot quite a few people sending a patch here and there, which
5456
really made a difference. Without those, some obscure bugs still would

CMakeLists.txt

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
cmake_minimum_required(VERSION 3.4)
22

3-
project(LibVNCServer VERSION 0.9.14 LANGUAGES C)
3+
set(PROJECT_LANGUAGES C)
4+
5+
if(DEFINED CMAKE_CXX_COMPILER)
6+
set(CMAKE_CXX_STANDARD 17)
7+
list(APPEND PROJECT_LANGUAGES CXX)
8+
endif(DEFINED CMAKE_CXX_COMPILER)
9+
10+
project(LibVNCServer VERSION 0.9.15 LANGUAGES ${PROJECT_LANGUAGES})
411
include(CheckFunctionExists)
512
include(CheckSymbolExists)
613
include(CheckIncludeFile)
@@ -25,6 +32,7 @@ set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test)
2532
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
2633
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
2734
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
35+
2836
if(CMAKE_GENERATOR MATCHES "Unix Makefiles|Ninja")
2937
# some LSP servers expect compile_commands.json in the project root
3038
add_custom_target(
@@ -51,7 +59,7 @@ option(WITH_JPEG "Search for the libjpeg compression library to support addition
5159
option(WITH_PNG "Search for the PNG compression library to support additional encodings" ON)
5260
option(WITH_SDL "Search for the Simple Direct Media Layer library to build an example SDL vnc client" ON)
5361
option(WITH_GTK "Search for the GTK library to build an example GTK vnc client" ON)
54-
option(WITH_LIBSSH2 "Search for libssh2 to build an example ssh-tunneled client" ON)
62+
option(WITH_LIBSSHTUNNEL "Search for libsshtunnel to build an example ssh-tunneled client" ON)
5563
option(WITH_THREADS "Search for a threading library to build with multithreading support" ON)
5664
option(PREFER_WIN32THREADS "When searching for a threading library, prefer win32 threads if they are found" OFF)
5765
option(WITH_GNUTLS "Search for the GnuTLS secure communications library to support TLS" ON)
@@ -67,7 +75,7 @@ option(WITH_SASL "Build with SASL support" ON)
6775
option(WITH_XCB "Build with XCB support" ON)
6876
option(WITH_EXAMPLES "Build examples" ON)
6977
option(WITH_TESTS "Build tests" ON)
70-
78+
option(WITH_QT "Build the Qt client example" ON)
7179

7280
if(WITH_ZLIB)
7381
find_package(ZLIB)
@@ -125,6 +133,8 @@ if(WITH_JPEG)
125133
file(STRINGS ${JPEGLIB_H_PATH} FOUND_LIBJPEG_TURBO REGEX "JCS_EXT_RGB")
126134
if(NOT FOUND_LIBJPEG_TURBO)
127135
message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***")
136+
else()
137+
message(STATUS "Detected libjpeg-turbo via ${JPEGLIB_H_PATH}")
128138
endif()
129139
endif()
130140
endif(JPEG_FOUND)
@@ -144,9 +154,18 @@ if(WITH_GTK)
144154
find_package(GTK2)
145155
endif(WITH_GTK)
146156

147-
if(WITH_LIBSSH2)
148-
find_package(LibSSH2)
149-
endif(WITH_LIBSSH2)
157+
if(WITH_QT)
158+
find_package(Qt5 COMPONENTS Core Widgets QUIET)
159+
endif(WITH_QT)
160+
161+
if(WITH_LIBSSHTUNNEL)
162+
find_path(LIBSSHTUNNEL_INCLUDE_DIR libsshtunnel.h)
163+
find_library(LIBSSHTUNNEL_LIBRARY sshtunnel)
164+
if("${LIBSSHTUNNEL_LIBRARY}" MATCHES ".*NOTFOUND.*")
165+
# would otherwise contain -NOTFOUND, confusing target_link_libraries()
166+
set(LIBSSHTUNNEL_LIBRARY "")
167+
endif()
168+
endif(WITH_LIBSSHTUNNEL)
150169

151170
if(WITH_THREADS)
152171
find_package(Threads)
@@ -580,16 +599,6 @@ if(WITH_THREADS AND WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT)
580599
)
581600
endif(WITH_THREADS AND WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT)
582601

583-
if(APPLE AND NOT IOS AND WITH_THREADS AND CMAKE_USE_PTHREADS_INIT)
584-
set(LIBVNCSERVER_EXAMPLES
585-
${LIBVNCSERVER_EXAMPLES}
586-
mac
587-
)
588-
find_library(CARBON_LIBRARY Carbon)
589-
find_library(IOKIT_LIBRARY IOKit)
590-
find_library(IOSURFACE_LIBRARY IOSurface)
591-
endif(APPLE AND NOT IOS AND WITH_THREADS AND CMAKE_USE_PTHREADS_INIT)
592-
593602
if(ANDROID)
594603
set(LIBVNCSERVER_EXAMPLES
595604
${LIBVNCSERVER_EXAMPLES}
@@ -630,19 +639,17 @@ if(GTK2_FOUND)
630639
)
631640
endif(GTK2_FOUND)
632641

633-
if(LIBSSH2_FOUND AND (CMAKE_USE_PTHREADS_INIT OR CMAKE_USE_WIN32_THREADS_INIT))
634-
include_directories(${LIBSSH2_INCLUDE_DIR})
642+
if(WITH_LIBSSHTUNNEL AND LIBSSHTUNNEL_LIBRARY AND LIBSSHTUNNEL_INCLUDE_DIR)
643+
message(STATUS "Building with libsshtunnel: ${LIBSSHTUNNEL_LIBRARY} and ${LIBSSHTUNNEL_INCLUDE_DIR}")
644+
include_directories(${LIBSSHTUNNEL_INCLUDE_DIR})
635645
set(LIBVNCCLIENT_EXAMPLES
636646
${LIBVNCCLIENT_EXAMPLES}
637647
sshtunnel
638648
)
639649
endif()
640-
# if not found, set lib var to empty, otherwise CMake complains
641-
if(NOT LIBSSH2_FOUND)
642-
set(LIBSSH2_LIBRARY "")
643-
endif()
644650

645651
if(FFMPEG_FOUND)
652+
include_directories(${FFMPEG_INCLUDE_DIRS})
646653
set(LIBVNCCLIENT_EXAMPLES
647654
${LIBVNCCLIENT_EXAMPLES}
648655
vnc2mpg
@@ -654,15 +661,26 @@ if(WITH_EXAMPLES)
654661
add_executable(examples_${e} ${LIBVNCSRVEXAMPLE_DIR}/${e}.c)
655662
set_target_properties(examples_${e} PROPERTIES OUTPUT_NAME ${e})
656663
set_target_properties(examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/server)
657-
target_link_libraries(examples_${e} vncserver ${CMAKE_THREAD_LIBS_INIT} ${CARBON_LIBRARY} ${IOKIT_LIBRARY} ${IOSURFACE_LIBRARY} ${X11_xcb_LIB} ${X11_xcb_xtest_LIB} ${X11_xcb_keysyms_LIB})
664+
target_link_libraries(examples_${e} vncserver ${CMAKE_THREAD_LIBS_INIT} ${X11_xcb_LIB} ${X11_xcb_xtest_LIB} ${X11_xcb_keysyms_LIB})
658665
endforeach(e ${LIBVNCSERVER_EXAMPLES})
659666

660667
foreach(e ${LIBVNCCLIENT_EXAMPLES})
661668
add_executable(client_examples_${e} ${LIBVNCCLIEXAMPLE_DIR}/${e}.c ${LIBVNCCLIEXAMPLE_DIR}/${${e}_EXTRA_SOURCES} )
662669
set_target_properties(client_examples_${e} PROPERTIES OUTPUT_NAME ${e})
663670
set_target_properties(client_examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/client)
664-
target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARY} ${GTK2_LIBRARIES} ${FFMPEG_LIBRARIES} ${LIBSSH2_LIBRARY})
671+
target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARY} ${GTK2_LIBRARIES} ${FFMPEG_LIBRARIES} ${LIBSSHTUNNEL_LIBRARY})
665672
endforeach(e ${LIBVNCCLIENT_EXAMPLES})
673+
674+
#This example must have its own building instructions,
675+
#apart from the other examples because it is written in
676+
#C++, so it has a distinct file extension and depends on
677+
#a C++ compiler
678+
if(Qt5Widgets_FOUND AND WITH_QT AND DEFINED CMAKE_CXX_COMPILER)
679+
add_executable(client_examples_qt5client ${LIBVNCCLIEXAMPLE_DIR}/qt5client.cpp ${LIBVNCCLIEXAMPLE_DIR}/${qt5client_EXTRA_SOURCES})
680+
set_target_properties(client_examples_qt5client PROPERTIES OUTPUT_NAME qt5client)
681+
set_target_properties(client_examples_qt5client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/client)
682+
target_link_libraries(client_examples_qt5client vncclient ${CMAKE_THREAD_LIBS_INIT} ${Qt5Widgets_LIBRARIES})
683+
endif(Qt5Widgets_FOUND AND WITH_QT AND DEFINED CMAKE_CXX_COMPILER)
666684
endif(WITH_EXAMPLES)
667685

668686
#
@@ -674,7 +692,7 @@ if(WITH_TESTS)
674692
# First fuzzing
675693
if(DEFINED ENV{LIB_FUZZING_ENGINE})
676694
add_executable(fuzz_server ${TESTS_DIR}/fuzz_server.c)
677-
target_link_libraries(fuzz_server vncserver ${CMAKE_THREAD_LIBS_INIT} ${CARBON_LIBRARY} ${IOKIT_LIBRARY} ${IOSURFACE_LIBRARY} $ENV{LIB_FUZZING_ENGINE})
695+
target_link_libraries(fuzz_server vncserver ${CMAKE_THREAD_LIBS_INIT} $ENV{LIB_FUZZING_ENGINE})
678696
endif()
679697

680698
if(UNIX)

NEWS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
## Overall changes:
44

55
* Added fuzzing with OSS-Fuzz thanks to Catena Cyber.
6+
* Improved build system to have files where they are expected in contemporary open source projects.
7+
Also split out Mac OS server example to own repo at https://github.com/LibVNC/macVNC
8+
* Added Windows CI on GitHub.
69

710
## LibVNCServer/LibVNCClient:
811

@@ -12,10 +15,15 @@
1215

1316
* Fixed LibVNCClient handling of UltraVNC MSLogonII when built with OpenSSL.
1417
* Added UTF8 clipboard handling.
18+
* Added API to allow the client to specify a subregion of the server's framebuffer and
19+
have LibVNCClient only ask for this, not the whole framebuffer.
20+
* Fixed Tight decoding endianness issues.
21+
* Added a Qt-based client example.
1522

1623
## LibVNCServer:
1724

1825
* Added a proof-of-concept X11 example server.
26+
* Improved SSH example by having it use [libsshtunnel](https://github.com/bk138/libsshtunnel/) instead of custom code.
1927

2028

2129
# 2022-12-18: Version 0.9.14

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
LibVNCServer: A library for easy implementation of a VNC server.
66
Copyright (C) 2001-2003 Johannes E. Schindelin
77

8+
If you have a general question, it's best to [ask in the community chat](https://gitter.im/LibVNC/libvncserver). If your concern is about a bug or feature request instead, please use [the issue tracker](https://github.com/LibVNC/libvncserver/issues).
9+
810
If you already used LibVNCServer, you probably want to read [NEWS](NEWS.md).
911

1012
What is it?
@@ -53,7 +55,6 @@ RFB Protocol Support Status
5355
| Hextile | 5 |||
5456
| Zlib | 6 |||
5557
| Tight | 7 |||
56-
| Zlibhex | 8 || |
5758
| Ultra | 9 |||
5859
| TRLE | 15 | ||
5960
| ZRLE | 16 |||
@@ -123,7 +124,9 @@ Tested with MinGW-w64 on Debian, which you should install via `sudo apt install
123124
You can make use of the [provided toolchainfile](cmake/Toolchain-cross-mingw32-linux.cmake).
124125
It sets CMake to expect (optional) win32 dependencies like libjpeg and friends
125126
in the `deps` directory. Note that you need (probably self-built) development packages for
126-
win32, the `-dev` packages coming with your distribution won't work.
127+
win32, the `-dev` packages coming with your distribution won't work. Also note that you'll
128+
need to put `libwinpthread-1.dll` in the build dir to run the examples. You can find this DLL
129+
on your Linux build machine via `locate libwinpthread-1.dll`.
127130

128131

129132
mkdir build
@@ -228,10 +231,10 @@ high latency or both.
228231

229232
On a high-latency link, try asking for framebuffer updates continously, as
230233
RFB is client-pull per default, not server-push. One example implementation
231-
can be found [here](https://github.com/bk138/multivnc/blob/master/src/VNCConn.cpp#L1112)
234+
can be found [here](https://github.com/bk138/multivnc/blob/6251169ed11835ed709c0c191599937759856dda/src/VNCConn.cpp#L1112)
232235
and it definitely improves responsiveness.
233236

234-
There also is the [ContinuousUpdates RFB extension](https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#continuousupdates-pseudo-encoding),
237+
There also is the [ContinuousUpdates RFB extension](https://github.com/rfbproto/rfbproto/blob/513c651fff1b213188daa5069444145a63e71617/rfbproto.rst#L4052),
235238
but that one is not supported by LibVNC (yet).
236239

237240
### Tackling Low Throughput
@@ -250,7 +253,7 @@ bytes that get sent per framebuffer update:
250253
* Send a scaled-down version of your framebuffer. You can do the scaling in your
251254
application feeding data into LibVNCServer's framebuffer (would affect all clients)
252255
or let LibVNCServer do the work for you if your client requests a scaled screen
253-
via a [SetScale or SetScaleFactor message](https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#74client-to-server-messages)
256+
via a [SetScale or SetScaleFactor message](https://github.com/rfbproto/rfbproto/blob/513c651fff1b213188daa5069444145a63e71617/rfbproto.rst#L1344)
254257
(this is per-client scaling - UltraVNC viewers can request this).
255258

256259

cmake/Modules/FindLibSSH2.cmake

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)