diff -Nru barrier-2.3.2+dfsg/azure-pipelines.yml barrier-2.3.3+dfsg/azure-pipelines.yml --- barrier-2.3.2+dfsg/azure-pipelines.yml 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/azure-pipelines.yml 2020-07-14 17:37:45.000000000 +0000 @@ -82,11 +82,16 @@ Release: B_BUILD_TYPE: Release BARRIER_VERSION_STAGE: Release + variables: + VERBOSE: 1 + TERM: xterm-256color steps: - - script: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aac86fc018c48d7b6f23a2e7535276899774567a/Formula/qt.rb - displayName: Installed Pinned Qt - - script: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aac86fc018c48d7b6f23a2e7535276899774567a/Formula/openssl.rb - displayName: Installed Pinned OpenSSL + - script: rm -rf /usr/local/opt/openssl + displayName: Remove incompatible OpenSSL 1.0.2t from macOS-10.14 vmImage + - script: brew reinstall openssl + displayName: Installed newer OpenSSL 1.1.x + - script: brew install pkg-config qt5 + displayName: Install Qt5 and pkg-config prereqs - script: sh -x ./clean_build.sh displayName: Clean Build - task: PublishBuildArtifacts@1 diff -Nru barrier-2.3.2+dfsg/clean_build.bat barrier-2.3.3+dfsg/clean_build.bat --- barrier-2.3.2+dfsg/clean_build.bat 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/clean_build.bat 2020-07-14 17:37:45.000000000 +0000 @@ -33,6 +33,8 @@ echo Bonjour: %BONJOUR_SDK_HOME% echo Qt: %B_QT_FULLPATH% +git submodule update --init --recursive + rmdir /q /s build mkdir build if ERRORLEVEL 1 goto failed @@ -67,9 +69,11 @@ ) echo Build completed successfully +set BUILD_FAILED=0 goto done :failed +set BUILD_FAILED=%ERRORLEVEL% echo Build failed :done @@ -84,3 +88,5 @@ set B_QT_FULLPATH= set savedir= set cmake_gen= + +EXIT /B %BUILD_FAILED% diff -Nru barrier-2.3.2+dfsg/clean_build.sh barrier-2.3.3+dfsg/clean_build.sh --- barrier-2.3.2+dfsg/clean_build.sh 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/clean_build.sh 2020-07-14 17:37:45.000000000 +0000 @@ -18,6 +18,10 @@ fi # allow local customizations to build environment [ -r ./build_env.sh ] && . ./build_env.sh + +# Initialise Git submodules +git submodule update --init --recursive + B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" rm -rf build mkdir build || exit 1 diff -Nru barrier-2.3.2+dfsg/cmake/Version.cmake barrier-2.3.3+dfsg/cmake/Version.cmake --- barrier-2.3.2+dfsg/cmake/Version.cmake 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/cmake/Version.cmake 2020-07-14 17:37:45.000000000 +0000 @@ -2,7 +2,8 @@ set (BARRIER_VERSION_MAJOR 2) set (BARRIER_VERSION_MINOR 3) -set (BARRIER_VERSION_PATCH 2) +set (BARRIER_VERSION_PATCH 3) +set (BARRIER_VERSION_STAGE "release") # # Barrier Version diff -Nru barrier-2.3.2+dfsg/CMakeLists.txt barrier-2.3.3+dfsg/CMakeLists.txt --- barrier-2.3.2+dfsg/CMakeLists.txt 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/CMakeLists.txt 2020-07-14 17:37:45.000000000 +0000 @@ -123,12 +123,10 @@ check_type_size (short SIZEOF_SHORT) # pthread is used on both Linux and Mac - check_library_exists ("pthread" pthread_create "" HAVE_PTHREAD) - if (HAVE_PTHREAD) - list (APPEND libs pthread) - else() - message (FATAL_ERROR "Missing library: pthread") - endif() + set (CMAKE_THREAD_PREFER_PTHREAD TRUE) + set (THREADS_PREFER_PTHREAD_FLAG TRUE) + find_package (Threads REQUIRED) + list (APPEND libs Threads::Threads) # curl is used on both Linux and Mac find_package (CURL) @@ -167,7 +165,15 @@ link_directories("/usr/local/lib") endif() - if (${PKG_CONFIG_FOUND}) + if (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") + set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};/usr/X11R6/include;/usr/local/include;/usr/local/include/avahi-compat-libdns_sd") + set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L/usr/local/lib -L/usr/X11R6/lib") + include_directories("/usr/local/include" "/usr/X11R6/include" "/usr/local/include/avahi-compat-libdns_sd") + link_directories("/usr/local/lib") + link_directories("/usr/X11R6/lib") + endif() + + if (BARRIER_BUILD_GUI AND ${PKG_CONFIG_FOUND}) pkg_check_modules (AVAHI_COMPAT REQUIRED avahi-compat-libdns_sd) include_directories (BEFORE SYSTEM ${AVAHI_COMPAT_INCLUDE_DIRS}) set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${AVAHI_COMPAT_INCLUDE_DIRS}") @@ -261,7 +267,6 @@ set (HAVE_CXX_EXCEPTIONS 1) set (HAVE_CXX_MUTABLE 1) set (HAVE_CXX_STDLIB 1) - set (HAVE_PTHREAD_SIGNAL 1) set (SELECT_TYPE_ARG1 int) set (SELECT_TYPE_ARG234 " (fd_set *)") set (SELECT_TYPE_ARG5 " (struct timeval *)") @@ -349,12 +354,6 @@ set (OPENSSL_LIBS ${lib_ssl} ${lib_crypto}) endif() - -# Check we have the *required* Qt5 libs. -find_package(Qt5Core REQUIRED) -find_package(Qt5Network REQUIRED) -find_package(Qt5Widgets REQUIRED) - # # Configure_file... but for directories, recursively. # @@ -398,12 +397,10 @@ configure_files (${BARRIER_BUNDLE_SOURCE_DIR} ${BARRIER_BUNDLE_DIR}) - if (CMAKE_BUILD_TYPE STREQUAL "Release") - add_custom_target(Barrier_dmg ALL - bash build_installer.sh - DEPENDS barrier barriers barrierc - WORKING_DIRECTORY ${BARRIER_BUNDLE_DIR}) - endif() + add_custom_target(Barrier_MacOS ALL + bash build_dist.sh + DEPENDS barrier barriers barrierc + WORKING_DIRECTORY ${BARRIER_BUNDLE_DIR}) endif() # diff -Nru barrier-2.3.2+dfsg/debian/changelog barrier-2.3.3+dfsg/debian/changelog --- barrier-2.3.2+dfsg/debian/changelog 2020-03-23 06:10:34.000000000 +0000 +++ barrier-2.3.3+dfsg/debian/changelog 2020-12-06 15:48:34.000000000 +0000 @@ -1,8 +1,29 @@ -barrier (2.3.2+dfsg-1build1) focal; urgency=medium +barrier (2.3.3+dfsg-1.1~20.04.york0) focal; urgency=medium - * No-change rebuild for libgcc-s1 package name change. + * Lower to debhelper-compat 12 - -- Matthias Klose Mon, 23 Mar 2020 07:10:34 +0100 + -- Jonathon Fernyhough Sun, 06 Dec 2020 15:48:34 +0000 + +barrier (2.3.3+dfsg-1.1) unstable; urgency=medium + + * Non maintainer upload. + * lib/ipc: Introduce writef_void(void*, ...) to fix ambiguity with + writef(barrier::IStream*, ...) and thus fix FTBFS + (Closes: #970611) + + -- Balint Reczey Thu, 22 Oct 2020 22:09:11 +0200 + +barrier (2.3.3+dfsg-1) unstable; urgency=medium + + * New upstream version 2.3.3+dfsg. + - Fix infinite loop on fast TCP disconnection (Closes: #948214) + - Fix incorrect name of user conf file in barriers.1 (Closes: #939195) + * d/p/use-system-gtest.patch: Update paths to use system gmock and gtest. + * d/control, d/copyright: Update my email address. + * d/control: Bump DH compat to 13. + * Update Standards-Version to 4.5.0. + + -- Unit 193 Tue, 21 Jul 2020 06:18:52 -0400 barrier (2.3.2+dfsg-1) unstable; urgency=medium diff -Nru barrier-2.3.2+dfsg/debian/control barrier-2.3.3+dfsg/debian/control --- barrier-2.3.2+dfsg/debian/control 2019-10-06 01:17:20.000000000 +0000 +++ barrier-2.3.3+dfsg/debian/control 2020-12-06 15:48:34.000000000 +0000 @@ -1,7 +1,7 @@ Source: barrier Section: x11 Priority: optional -Maintainer: Unit 193 +Maintainer: Unit 193 Build-Depends: debhelper-compat (= 12), cmake, libavahi-compat-libdnssd-dev, @@ -16,7 +16,7 @@ libxtst-dev, qtbase5-dev Rules-Requires-Root: no -Standards-Version: 4.4.1 +Standards-Version: 4.5.0 Homepage: https://github.com/debauchee/barrier/ Vcs-Browser: https://git.unit193.net/cgit/users/unit193/barrier.git Vcs-Git: https://git.unit193.net/cgit/users/unit193/barrier.git diff -Nru barrier-2.3.2+dfsg/debian/copyright barrier-2.3.3+dfsg/debian/copyright --- barrier-2.3.2+dfsg/debian/copyright 2018-10-10 06:48:08.000000000 +0000 +++ barrier-2.3.3+dfsg/debian/copyright 2020-10-22 20:09:11.000000000 +0000 @@ -37,7 +37,7 @@ License: GPL-2 with OpenSSL exception Files: debian/* -Copyright: 2018 Unit 193 +Copyright: 2018-2020 Unit 193 License: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff -Nru barrier-2.3.2+dfsg/debian/patches/0002-lib-ipc-Introduce-writef_void-void.patch barrier-2.3.3+dfsg/debian/patches/0002-lib-ipc-Introduce-writef_void-void.patch --- barrier-2.3.2+dfsg/debian/patches/0002-lib-ipc-Introduce-writef_void-void.patch 1970-01-01 00:00:00.000000000 +0000 +++ barrier-2.3.3+dfsg/debian/patches/0002-lib-ipc-Introduce-writef_void-void.patch 2020-10-22 20:09:11.000000000 +0000 @@ -0,0 +1,49 @@ +From bd0c671fcc9732c9d1ccf5216f34f4629640b9fb Mon Sep 17 00:00:00 2001 +From: Balint Reczey +Date: Thu, 22 Oct 2020 22:00:18 +0200 +Subject: [PATCH] lib/ipc: Introduce writef_void(void*, ...) + +to fix ambiguity with writef(barrier::IStream*, ...) +--- + src/lib/barrier/ProtocolUtil.cpp | 4 ++-- + src/lib/barrier/ProtocolUtil.h | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/lib/barrier/ProtocolUtil.cpp b/src/lib/barrier/ProtocolUtil.cpp +index e742687f..21ba38fc 100644 +--- a/src/lib/barrier/ProtocolUtil.cpp ++++ b/src/lib/barrier/ProtocolUtil.cpp +@@ -80,7 +80,7 @@ ProtocolUtil::vwritef(barrier::IStream* stream, + + // fill buffer + UInt8* buffer = new UInt8[size]; +- writef(buffer, fmt, args); ++ writef_void(buffer, fmt, args); + + try { + // write buffer +@@ -339,7 +339,7 @@ ProtocolUtil::getLength(const char* fmt, va_list args) + } + + void +-ProtocolUtil::writef(void* buffer, const char* fmt, va_list args) ++ProtocolUtil::writef_void(void* buffer, const char* fmt, va_list args) + { + UInt8* dst = static_cast(buffer); + +diff --git a/src/lib/barrier/ProtocolUtil.h b/src/lib/barrier/ProtocolUtil.h +index 9930cfc0..e01a6e60 100644 +--- a/src/lib/barrier/ProtocolUtil.h ++++ b/src/lib/barrier/ProtocolUtil.h +@@ -79,7 +79,7 @@ private: + const char* fmt, va_list); + + static UInt32 getLength(const char* fmt, va_list); +- static void writef(void*, const char* fmt, va_list); ++ static void writef_void(void*, const char* fmt, va_list); + static UInt32 eatLength(const char** fmt); + static void read(barrier::IStream*, void*, UInt32); + }; +-- +2.25.1 + diff -Nru barrier-2.3.2+dfsg/debian/patches/series barrier-2.3.3+dfsg/debian/patches/series --- barrier-2.3.2+dfsg/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ barrier-2.3.3+dfsg/debian/patches/series 2020-10-22 20:09:11.000000000 +0000 @@ -0,0 +1,2 @@ +use-system-gtest.patch +0002-lib-ipc-Introduce-writef_void-void.patch diff -Nru barrier-2.3.2+dfsg/debian/patches/use-system-gtest.patch barrier-2.3.3+dfsg/debian/patches/use-system-gtest.patch --- barrier-2.3.2+dfsg/debian/patches/use-system-gtest.patch 1970-01-01 00:00:00.000000000 +0000 +++ barrier-2.3.3+dfsg/debian/patches/use-system-gtest.patch 2020-10-22 20:09:11.000000000 +0000 @@ -0,0 +1,55 @@ +Description: Update paths to use system gmock and gtest. +Author: Unit 193 +Forwarded: no + +--- barrier-2.3.3+dfsg.orig/src/test/CMakeLists.txt ++++ barrier-2.3.3+dfsg/src/test/CMakeLists.txt +@@ -15,13 +15,14 @@ + # along with this program. If not, see . + + include_directories( +- ../../ext/gtest +- ../../ext/gtest/include +- ../../ext/gmock +- ../../ext/gmock/include) +- +-add_library(gtest STATIC ../../ext/gtest/src/gtest-all.cc) +-add_library(gmock STATIC ../../ext/gmock/src/gmock-all.cc) ++ /usr/src/googletest/googletest ++ /usr/src/googletest/googletest/include ++ /usr/src/googletest/googlemock ++ /usr/src/googletest/googlemock/include ++) ++ ++add_library(gtest STATIC /usr/src/googletest/googletest/src/gtest-all.cc) ++add_library(gmock STATIC /usr/src/googletest/googlemock/src/gmock-all.cc) + + if (UNIX) + # ignore warnings in gtest and gmock +--- barrier-2.3.3+dfsg.orig/src/test/integtests/CMakeLists.txt ++++ barrier-2.3.3+dfsg/src/test/integtests/CMakeLists.txt +@@ -68,8 +68,8 @@ endif() + + include_directories( + ../../ +- ../../../ext/gtest/include +- ../../../ext/gmock/include ++ /usr/src/googletest/googletest/include ++ /usr/src/googletest/googlemock/include + ) + + if (UNIX) +--- barrier-2.3.3+dfsg.orig/src/test/unittests/CMakeLists.txt ++++ barrier-2.3.3+dfsg/src/test/unittests/CMakeLists.txt +@@ -50,9 +50,8 @@ list(APPEND headers ${platform_sources}) + + include_directories( + ../../ +- ../../../ext/gtest/include +- ../../../ext/gmock/include +- ../../../ext ++ /usr/src/googletest/googletest/include ++ /usr/src/googletest/googlemock/include + ) + + if (UNIX) diff -Nru barrier-2.3.2+dfsg/doc/barrierc.1 barrier-2.3.3+dfsg/doc/barrierc.1 --- barrier-2.3.2+dfsg/doc/barrierc.1 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/doc/barrierc.1 2020-07-14 17:37:45.000000000 +0000 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH BARRIERC "1" "May 2018" "barrierc 2.1.0-snapshot" "User Commands" +.\" See UpdateManpages.txt about modification of this file. Most of it was generated by help2man 1.47.8. +.TH BARRIERC "1" "November 2019" "barrierc 2.3.3-release" "User Commands" .SH NAME barrierc \- Barrier Keyboard/Mouse Client .SH SYNOPSIS diff -Nru barrier-2.3.2+dfsg/doc/barriers.1 barrier-2.3.3+dfsg/doc/barriers.1 --- barrier-2.3.2+dfsg/doc/barriers.1 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/doc/barriers.1 2020-07-14 17:37:45.000000000 +0000 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH BARRIERS "1" "May 2018" "barriers 2.1.0-snapshot" "User Commands" +.\" See UpdateManpages.txt about modification of this file. Most of it was generated by help2man 1.47.8. +.TH BARRIERS "1" "November 2019" "barriers 2.3.3-release" "User Commands" .SH NAME barriers \- Barrier Keyboard/Mouse Server .SH SYNOPSIS @@ -47,6 +47,10 @@ \fB\-\-no\-xinitthreads\fR do not call XInitThreads() .TP +\fB\-\-screen\-change\-script\fR +full path to script to run on screen change +first argument is the new screen name +.TP \fB\-f\fR, \fB\-\-no\-daemon\fR run in the foreground. .TP @@ -66,12 +70,13 @@ Placing brackets around an IPv6 address is required when also specifying a port number and optional otherwise. The default is to listen on all interfaces using port number 24800. -.PP +.SH FILES If no configuration file pathname is provided then the first of the following to load successfully sets the configuration: .IP -$HOME/.local/share/barrier/barrier.conf -\fI\,/etc/barrier.conf\/\fP +.I $HOME/.local/share/barrier/.barrier.conf +.br +.I /etc/barrier.conf .SH COPYRIGHT Copyright \(co 2018 Debauchee Open Source Group .br diff -Nru barrier-2.3.2+dfsg/doc/UpdateManpages.txt barrier-2.3.3+dfsg/doc/UpdateManpages.txt --- barrier-2.3.2+dfsg/doc/UpdateManpages.txt 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/doc/UpdateManpages.txt 2020-07-14 17:37:45.000000000 +0000 @@ -1,5 +1,10 @@ -To recreate the barrierc manpage use a command like: +To recreate the generated part of barrierc manpage use a command like: help2man -N --output=barrierc.1 --name='Barrier Keyboard/Mouse Client' /path/to/barrierc And for barriers: help2man -N --output=barriers.1 --name='Barrier Keyboard/Mouse Server' /path/to/barriers + +After that manually fixup: + * replace your home directory with $HOME in barriers.1 + * revert formatting of FILES and COPYRIGHT sections to match formatting of existing version. + * add note referencing this file for instructions to the first line. diff -Nru barrier-2.3.2+dfsg/.gitmodules barrier-2.3.3+dfsg/.gitmodules --- barrier-2.3.2+dfsg/.gitmodules 1970-01-01 00:00:00.000000000 +0000 +++ barrier-2.3.3+dfsg/.gitmodules 2020-07-14 17:37:45.000000000 +0000 @@ -0,0 +1,6 @@ +[submodule "ext/gtest"] + path = ext/gtest + url = https://github.com/google/googletest.git +[submodule "ext/gmock"] + path = ext/gmock + url = https://github.com/google/googlemock.git diff -Nru barrier-2.3.2+dfsg/README.md barrier-2.3.3+dfsg/README.md --- barrier-2.3.2+dfsg/README.md 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/README.md 2020-07-14 17:37:45.000000000 +0000 @@ -3,7 +3,8 @@ Eliminate the barrier between your machines. Find [releases for windows and macOS here](https://github.com/debauchee/barrier/releases). Your distro probably already has barrier packaged for it, see [distro specific packages](#distro-specific-packages) -below for a list. Alternatively, we also provide a [flatpak](https://github.com/flathub/com.github.debauchee.barrier). +below for a list. Alternatively, we also provide a [flatpak](https://github.com/flathub/com.github.debauchee.barrier) +and a [snap](https://snapcraft.io/barrier). ### Contact info: @@ -12,21 +13,26 @@ #### CI Build Status Master branch overall build status: [![Build Status](https://dev.azure.com/debauchee/Barrier/_apis/build/status/debauchee.barrier?branchName=master)](https://dev.azure.com/debauchee/Barrier/_build/latest?definitionId=1&branchName=master) -* Linux Build Status: [![Build Status](https://dev.azure.com/debauchee/Barrier/_apis/build/status/debauchee.barrier?branchName=master&jobName=Linux%20Build)](https://dev.azure.com/debauchee/Barrier/_build/latest?definitionId=1&branchName=master) -* Mac Build Status: [![Build Status](https://dev.azure.com/debauchee/Barrier/_apis/build/status/debauchee.barrier?branchName=master&jobName=Mac%20Build)](https://dev.azure.com/debauchee/Barrier/_build/latest?definitionId=1&branchName=master) -* Windows Debug Build Status: [![Build Status](https://dev.azure.com/debauchee/Barrier/_apis/build/status/debauchee.barrier?branchName=master&jobName=Windows%20Build&configuration=Windows%20Build%20Debug)](https://dev.azure.com/debauchee/Barrier/_build/latest?definitionId=1&branchName=master) -* Windows Release Build Status: [![Build Status](https://dev.azure.com/debauchee/Barrier/_apis/build/status/debauchee.barrier?branchName=master&jobName=Windows%20Build&configuration=Windows%20Build%20Release%20with%20Release%20Installer)](https://dev.azure.com/debauchee/Barrier/_build/latest?definitionId=1&branchName=master) -* Snap: [![Snap Status](https://build.snapcraft.io/badge/debauchee/barrier.svg)](https://build.snapcraft.io/user/debauchee/barrier) + +|Platform |Build Status| +| --:|:-- | +|Linux |[![Build Status](https://dev.azure.com/debauchee/Barrier/_apis/build/status/debauchee.barrier?branchName=master&jobName=Linux%20Build)](https://dev.azure.com/debauchee/Barrier/_build/latest?definitionId=1&branchName=master)| +|Mac |[![Build Status](https://dev.azure.com/debauchee/Barrier/_apis/build/status/debauchee.barrier?branchName=master&jobName=Mac%20Build)](https://dev.azure.com/debauchee/Barrier/_build/latest?definitionId=1&branchName=master)| +|Windows Debug |[![Build Status](https://dev.azure.com/debauchee/Barrier/_apis/build/status/debauchee.barrier?branchName=master&jobName=Windows%20Build&configuration=Windows%20Build%20Debug)](https://dev.azure.com/debauchee/Barrier/_build/latest?definitionId=1&branchName=master)| +|Windows Release|[![Build Status](https://dev.azure.com/debauchee/Barrier/_apis/build/status/debauchee.barrier?branchName=master&jobName=Windows%20Build&configuration=Windows%20Build%20Release%20with%20Release%20Installer)](https://dev.azure.com/debauchee/Barrier/_build/latest?definitionId=1&branchName=master)| +|Snap |[![Snap Status](https://build.snapcraft.io/badge/debauchee/barrier.svg)](https://build.snapcraft.io/user/debauchee/barrier)| Our CI Builds are provided by Microsoft Azure Pipelines, Flathub, and Canonical. ### What is it? -Barrier is KVM software forked from Symless's synergy 1.9 codebase. Synergy was a commercialized reimplementation of the original CosmoSynergy written by Chris Schoeneman. +Barrier is software that mimics the functionality of a KVM switch, which historically would allow you to use a single keyboard and mouse to control multiple computers by physically turning a dial on the box to switch the machine you're controlling at any given moment. Barrier does this in software, allowing you to tell it which machine to control by moving your mouse to the edge of the screen, or by using a keypress to switch focus to a different system. + +Barrier was forked from Symless's Synergy 1.9 codebase. Synergy was a commercialized reimplementation of the original CosmoSynergy written by Chris Schoeneman. ### What's different? -Whereas synergy has moved beyond its goals from the 1.x era, Barrier aims to maintain that simplicity. Barrier will let you use your keyboard and mouse from machine A to control machine B (or more). It's that simple. +Whereas Synergy has moved beyond its goals from the 1.x era, Barrier aims to maintain that simplicity. Barrier will let you use your keyboard and mouse from machine A to control machine B (or more). It's that simple. ### Project goals @@ -38,7 +44,7 @@ ### Contact & support -Please be aware that the *only* way to draw our attention to a bug is to create a new PR in the issue tracker. Write a clear, concise, detailed report and you will get a clear, concise, detailed response. Priority is always given to issues that affect a wider range of users. +Please be aware that the *only* way to draw our attention to a bug is to create a new issue in [the issue tracker](https://github.com/debauchee/barrier/issues). Write a clear, concise, detailed report and you will get a clear, concise, detailed response. Priority is always given to issues that affect a wider range of users. For short and simple questions or to just say hello find us on the Freenode IRC network in the #barrier channel. @@ -66,6 +72,7 @@ - MacOS/OS X - Linux - FreeBSD + - OpenBSD Q: Are 32-bit versions of Windows supported? diff -Nru barrier-2.3.2+dfsg/res/barrier.desktop barrier-2.3.3+dfsg/res/barrier.desktop --- barrier-2.3.2+dfsg/res/barrier.desktop 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/res/barrier.desktop 2020-07-14 17:37:45.000000000 +0000 @@ -5,6 +5,6 @@ Exec=barrier Icon=barrier Terminal=false -Categories=Utility; +Categories=Utility;DesktopUtility; Keywords=keyboard;mouse;sharing;network;share; diff -Nru barrier-2.3.2+dfsg/res/config.h.in barrier-2.3.3+dfsg/res/config.h.in --- barrier-2.3.2+dfsg/res/config.h.in 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/res/config.h.in 2020-07-14 17:37:45.000000000 +0000 @@ -55,12 +55,6 @@ /* Define if you have a POSIX `sigwait` function. */ #cmakedefine HAVE_POSIX_SIGWAIT ${HAVE_POSIX_SIGWAIT} -/* Define if you have POSIX threads libraries and header files. */ -#cmakedefine HAVE_PTHREAD ${HAVE_PTHREAD} - -/* Define if you have `pthread_sigmask` and `pthread_kill` functions. */ -#cmakedefine HAVE_PTHREAD_SIGNAL ${HAVE_PTHREAD_SIGNAL} - /* Define if your compiler defines socklen_t. */ #cmakedefine HAVE_SOCKLEN_T ${HAVE_SOCKLEN_T} diff -Nru barrier-2.3.2+dfsg/snap/snapcraft.yaml barrier-2.3.3+dfsg/snap/snapcraft.yaml --- barrier-2.3.2+dfsg/snap/snapcraft.yaml 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/snap/snapcraft.yaml 2020-07-14 17:37:45.000000000 +0000 @@ -11,6 +11,9 @@ apps: barrier: command: desktop-launch barrier #first run might take longer + environment: + # Fallback to XWayland if running in a Wayland session. + DISABLE_WAYLAND: 1 desktop: usr/share/applications/barrier.desktop common-id: com.github.debauchee.barrier plugs: &plugs @@ -40,11 +43,13 @@ barrier: source: . + source-type: git plugin: cmake configflags: - "-DCMAKE_INSTALL_PREFIX=/usr" - "-DCMAKE_BUILD_TYPE=Release" build-packages: + - build-essential - xorg-dev - libcurl4-openssl-dev - libavahi-compat-libdnssd-dev diff -Nru barrier-2.3.2+dfsg/src/CMakeLists.txt barrier-2.3.3+dfsg/src/CMakeLists.txt --- barrier-2.3.2+dfsg/src/CMakeLists.txt 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/CMakeLists.txt 2020-07-14 17:37:45.000000000 +0000 @@ -19,6 +19,7 @@ add_subdirectory(lib) add_subdirectory(cmd) +add_subdirectory(test) if (BARRIER_BUILD_GUI) add_subdirectory(gui) diff -Nru barrier-2.3.2+dfsg/src/cmd/barriers/barriers.cpp barrier-2.3.3+dfsg/src/cmd/barriers/barriers.cpp --- barrier-2.3.2+dfsg/src/cmd/barriers/barriers.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/cmd/barriers/barriers.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -38,6 +38,13 @@ // record window instance for tray icon, etc ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); #endif + +#ifdef __APPLE__ + /* Silence "is calling TIS/TSM in non-main thread environment" as it is a red + herring that causes a lot of issues to be filed for the MacOS client/server. + */ + setenv("OS_ACTIVITY_DT_MODE", "NO", true); +#endif Arch arch; arch.init(); diff -Nru barrier-2.3.2+dfsg/src/gui/CMakeLists.txt barrier-2.3.3+dfsg/src/gui/CMakeLists.txt --- barrier-2.3.2+dfsg/src/gui/CMakeLists.txt 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/CMakeLists.txt 2020-07-14 17:37:45.000000000 +0000 @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.4) -find_package (Qt5 COMPONENTS Core Widgets Network) +find_package (Qt5 REQUIRED COMPONENTS Core Widgets Network) set (CMAKE_AUTOMOC ON) set (CMAKE_AUTORCC ON) set (CMAKE_AUTOUIC ON) @@ -48,6 +48,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") install (TARGETS barrier DESTINATION ${BARRIER_BUNDLE_BINARY_DIR}) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") +elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "BSD") install (TARGETS barrier DESTINATION bin) endif() diff -Nru barrier-2.3.2+dfsg/src/gui/res/Barrier.qrc barrier-2.3.3+dfsg/src/gui/res/Barrier.qrc --- barrier-2.3.2+dfsg/src/gui/res/Barrier.qrc 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/res/Barrier.qrc 2020-07-14 17:37:45.000000000 +0000 @@ -54,5 +54,8 @@ image/spinning-wheel.gif icons/16x16/padlock.png icons/16x16/barrier-transfering.png + icons/32x32/barrier-connected-mask.png + icons/32x32/barrier-disconnected-mask.png + icons/32x32/barrier-transfering-mask.png Binary files /tmp/tmpkN_7jp/q7266O3FYw/barrier-2.3.2+dfsg/src/gui/res/icons/32x32/barrier-connected-mask.png and /tmp/tmpkN_7jp/c2kREQT7Ly/barrier-2.3.3+dfsg/src/gui/res/icons/32x32/barrier-connected-mask.png differ diff -Nru barrier-2.3.2+dfsg/src/gui/res/icons/32x32/barrier-connected-mask.svg barrier-2.3.3+dfsg/src/gui/res/icons/32x32/barrier-connected-mask.svg --- barrier-2.3.2+dfsg/src/gui/res/icons/32x32/barrier-connected-mask.svg 1970-01-01 00:00:00.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/res/icons/32x32/barrier-connected-mask.svg 2020-07-14 17:37:45.000000000 +0000 @@ -0,0 +1,114 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Binary files /tmp/tmpkN_7jp/q7266O3FYw/barrier-2.3.2+dfsg/src/gui/res/icons/32x32/barrier-disconnected-mask.png and /tmp/tmpkN_7jp/c2kREQT7Ly/barrier-2.3.3+dfsg/src/gui/res/icons/32x32/barrier-disconnected-mask.png differ diff -Nru barrier-2.3.2+dfsg/src/gui/res/icons/32x32/barrier-disconnected-mask.svg barrier-2.3.3+dfsg/src/gui/res/icons/32x32/barrier-disconnected-mask.svg --- barrier-2.3.2+dfsg/src/gui/res/icons/32x32/barrier-disconnected-mask.svg 1970-01-01 00:00:00.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/res/icons/32x32/barrier-disconnected-mask.svg 2020-07-14 17:37:45.000000000 +0000 @@ -0,0 +1,102 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + Binary files /tmp/tmpkN_7jp/q7266O3FYw/barrier-2.3.2+dfsg/src/gui/res/icons/32x32/barrier-transfering-mask.png and /tmp/tmpkN_7jp/c2kREQT7Ly/barrier-2.3.3+dfsg/src/gui/res/icons/32x32/barrier-transfering-mask.png differ diff -Nru barrier-2.3.2+dfsg/src/gui/res/icons/32x32/barrier-transfering-mask.svg barrier-2.3.3+dfsg/src/gui/res/icons/32x32/barrier-transfering-mask.svg --- barrier-2.3.2+dfsg/src/gui/res/icons/32x32/barrier-transfering-mask.svg 1970-01-01 00:00:00.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/res/icons/32x32/barrier-transfering-mask.svg 2020-07-14 17:37:45.000000000 +0000 @@ -0,0 +1,148 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru barrier-2.3.2+dfsg/src/gui/res/lang/gui_sv.ts barrier-2.3.3+dfsg/src/gui/res/lang/gui_sv.ts --- barrier-2.3.2+dfsg/src/gui/res/lang/gui_sv.ts 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/res/lang/gui_sv.ts 2020-07-14 17:37:45.000000000 +0000 @@ -1,12 +1,14 @@ - + + + AboutDialogBase About Barrier - Om Barrier + Om Barrier - + <p> Keyboard and mouse sharing application. Cross platform and open source.<br /><br /> @@ -26,22 +28,30 @@ The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> - + <p> +Program för att dela tangentbord och mus. Plattformsöverskridande och öppen källkod.<br /><br /> +Copyright © 2012-2016 Symless Ltd.<br /> +Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> +Barrier är släppt under GNU General Public License (GPLv2).<br /><br /> +Barrier baseras på CosmoSynergy av Richard Lee and Adam Feder.<br /> +Barrier GUI baseras på QSynergy av Volker Lanz.<br /><br /> +Besök vår webbplats för hjälp och information (symless.com). +</p> Unknown - Okänd + Okänd Version: - Version: + Version: &Ok - &Ok + &OK @@ -49,97 +59,97 @@ Configure Action - Konfigurera + Konfigurera åtgärd Choose the action to perform - Välj funktion som skall utföras + Välj den åtgärd som skall utföras Press a hotkey - Tryck ned en snabbtangent + Tryck ner en snabbtangent Release a hotkey - Släpp en snabbtangent + Släpp en snabbtangent Press and release a hotkey - Tryck ned och släpp en snabbtangent + Tryck ner och släpp en snabbtangent only on these screens - endast på dessa skärmar + endast på dessa skärmar Switch to screen - Växla till skärm + Växla till skärm Switch in direction - Växla i riktning + Växla i riktning left - vänster + vänster right - höger + höger up - upp + upp down - ner + ner Lock cursor to screen - Lås muspekaren till skärm + Lås muspekaren till skärm toggle - skifta + växla on - + off - Av + av This action is performed when - Detta utförs när + Denna åtgärd utförs när the hotkey is pressed - snabbtangenten trycks in + snabbtangenten trycks ner the hotkey is released - snabbtangenten släpps + snabbtangenten släpps @@ -147,17 +157,17 @@ Dialog - + Dialog TextLabel - + Textetikett Ignore auto connect clients - + Ignorera klienter med automatisk anslutning @@ -165,12 +175,12 @@ Hotkey - Snabbtangent + Snabbtangent Enter the specification for the hotkey: - Beskriv snabbtangenten: + Beskriv snabbtangenten: @@ -178,189 +188,193 @@ &Start - Start + &Starta &File - Arkiv + &Arkiv &Edit - &Redigera + &Redigera &Window - Fönster + &Fönster &Help - Hjälp + &Hjälp <p>Your version of Barrier is out of date. Version <b>%1</b> is now available to <a href="%2">download</a>.</p> <p>Version %1 is now available, <a href="%2">visit website</a>.</p> - <p>Du kör inte den senaste versionen av Barrier. Version <b>%1</b> finns tillgänglig för <a href="%2">nedladdning</a>.</p> + <p>Din version av Barrier är utdaterad. Version <b>%1</b> finns nu tillgänglig för <a href="%2">nerladdning</a>.</p> Program can not be started - Programmet kan inte startas + Programmet kan inte startas The executable<br><br>%1<br><br>could not be successfully started, although it does exist. Please check if you have sufficient permissions to run this program. - Programmet<br><br>%1<br><br>kunde inte startas, men det finns. Var vänlig och kontrollera att du har tillräckliga rättigheter för att köra detta program. + Programmet<br><br>%1<br><br>kunde inte startas, men det finns tillgängligt. Kontrollera att du har tillräckliga rättigheter för att köra detta program. Barrier client not found - Barrierklienten hittades inte + Barrier-klienten hittades inte The executable for the barrier client does not exist. - Den exekverbara filen för Barrierklienten existerar inte. + Barrier-klientens körbara fil saknas. Hostname is empty - Värddatornamnet är inte satt + Värdnamnet är tomt Please fill in a hostname for the barrier client to connect to. - Fyll i det värddatornamn som Barrierklienten skall ansluta till. + Fyll i det värdnamn som Barrier-klienten skall ansluta till. Cannot write configuration file - Kan inte spara konfigurationsfilen + Kan inte skriva konfigurationsfilen The temporary configuration file required to start barrier can not be written. - Den tillfälliga konfigurationsfilen som krävs för att kunna starta Barrier kan inte skapas. + Den tillfälliga konfigurationsfil som krävs för att starta Barrier, kan inte skrivas. Configuration filename invalid - Namnet på konfigurationsfilen är inte giltigt + Ogiltigt namn på konfigurationsfilen You have not filled in a valid configuration file for the barrier server. Do you want to browse for the configuration file now? - Du har inte fyllt i en giltig konfigurationsfil för Barrierservern. Vill du bläddra efter konfigurationsfilen nu? + Du har inte fyllt i en giltig konfigurationsfil för Barrier-servern. Vill du bläddra efter konfigurationsfilen nu? Barrier server not found - Barrierservern hittades inte + Barrier-servern hittades inte The executable for the barrier server does not exist. - Den körbara filen för Barrierservern existerar inte. + Barrier-serverns körbara fil finns inte. Barrier terminated with an error - Barrier avslutades med ett fel + Barrier avslutades med ett fel Barrier terminated unexpectedly with an exit code of %1.<br><br>Please see the log output for details. - Barrierterminalen avslutades oväntat med avbrottskoden %1.<br><br>Kontrollera loggdatan för detaljer. + Barrier avslutades oväntat med avbrottskoden %1.<br><br>Se loggdata för detaljerad info. &Stop - Stopp + &Stopp Please add the server (%1) to the grid. - + Lägg till servern (%1) i rutfältet. Please drag the new client screen (%1) to the desired position on the grid. - + Dra den nya klientskämen (%1) till önskad position i rutfältet. Failed to detect system architecture. - + Kunde inte identifiera systemarkitektur. Cancel - + Avbryt Failed to download Bonjour installer to location: %1 - + Kunde inte ladda ner Bonjour-installerare till platsen: %1 Do you want to enable auto config and install Bonjour? This feature helps you establish the connection. - + Vill du aktivera automatisk konfiguration och installation av Bonjour? + +Denna funktion hjälper dig att etablera anslutningen. Auto config feature requires Bonjour. Do you want to install Bonjour? - + Automatisk konfiguration kräver Bonjour. + +Vill du installera Bonjour? Barrier is starting. - Barrier startas. + Barrier startar. Barrier is running. - Barrier körs. + Barrier körs. Barrier is not running. - Barrier körs inte. + Barrier körs inte. Unknown - Okänd + Okänd Barrier - Barrier + Barrier Browse for a barriers config file - Bläddra efter Barriers konfigurationsfil. + Bläddra efter Barriers konfigurationsfil Barrier is now connected, You can close the config window. Barrier will remain connected in the background. - + Barrier är nu ansluten, du kan stänga konfigurationsfönstret. Barrier kommer att fortsätta vara ansluten i bakgrunden. Security question - + Säkerhetsfråga @@ -368,25 +382,31 @@ %1 -This is a server fingerprint. You should compare this fingerprint to the one on your server's screen. If the two don't match exactly, then it's probably not the server you're expecting (it could be a malicious user). +This is a server fingerprint. You should compare this fingerprint to the one on your server's screen. If the two don't match exactly, then it's probably not the server you're expecting (it could be a malicious user). To automatically trust this fingerprint for future connections, click Yes. To reject this fingerprint and disconnect from the server, click No. - + Litar du på fingeravtrycket? + +%1 + +Detta är en servers fingeravtryck. Du bör jämföra det här fingeravtrycket med det på serverns skärm. Om de två inte stämmer exakt, så är det förmodligen inte den server du förväntar dig (det kan vara en skadlig användare). + +Klicka "Ja" för att automatiskt lita på fingeravtrycket i framtida anslutningar. Klicka "Nej" för att avvisa det här fingeravtrycket och koppla från servern. Save configuration as... - Spara konfiguration som... + Spara konfigurationen som... Save failed - Sparades inte + Kunde inte spara Could not save configuration to file. - Kunde inte spara konfiguration till fil. + Kunde inte spara konfigurationen till fil. @@ -394,168 +414,168 @@ Barrier - Barrier + Barrier - Ser&ver (share this computer's mouse and keyboard): - + Ser&ver (share this computer's mouse and keyboard): + Ser&ver (dela den här datorns mus och tangentbord): Screen name: - Skärmnamn: + Skärmnamn: &Server IP: - Serverns IP: + &Serverns IP: &Start - Start + &Starta Use existing configuration: - Använd befintlig konfiguration: + Använd befintlig konfiguration: &Configuration file: - Konfigurationsfil: + &Konfigurationsfil: &Browse... - Bläddra... + &Bläddra... Configure interactively: - Konfigurera interaktivt: + Konfigurera interaktivt: &Configure Server... - Konfigurera server... + &Konfigurera server... Ready - Klar + Klar Log - Logg + Logg &Reload - Verkställ + &Uppdatera IP addresses: - IP-adresser: + IP-adresser: Fingerprint: - + Fingeravtryck: - &Client (use another computer's mouse and keyboard): - + &Client (use another computer's mouse and keyboard): + &Klient (använd en annan dators mus och tangenbord): Auto config - + Konfigurera automatiskt &About Barrier... - Om Barrier... + &Om Barrier... &Quit - Avsluta + A&vsluta Quit - Avsluta + Avsluta Run - Kör + Kör S&top - S&topp + S&topp Stop - Stopp + Stopp S&how Status - Visa Status + V&isa status &Hide - Dölj + &Dölj Hide - Dölj + Dölj &Show - Visa + &Visa Show - Visa + Visa Save configuration &as... - Spara konfiguration som... + S&para konfigurationen som... Save the interactively generated server configuration to a file. - Spara den interaktivt genererade serverkonfigurationen till en fil. + Spara den interaktivt skapade serverkonfigurationen till en fil. Settings - Inställningar + Inställningar Edit settings - Ändra inställningar + Ändra inställningar Run Wizard - Kör guiden + Kör guiden @@ -563,7 +583,7 @@ Unnamed - Namnlös + Namnlös @@ -571,28 +591,29 @@ Failed to get plugin directory. - + Kunde inte hämta mappen för insticksmoduler. Failed to get profile directory. - + Kunde inte hämta profilmappen. - Failed to download plugin '%1' to: %2 + Failed to download plugin '%1' to: %2 %3 - + Kunde inte ladda ner insticksmodulen "%1" till: %2 +%3 Could not get Windows architecture type. - + Kunde inte hämta Windows arkitekturtyp. Could not get Linux architecture type. - + Kunde inte hämta Linux arkitekturtyp. @@ -600,48 +621,48 @@ Setup Barrier - Ställ in Barrier + Ställ in Barrier Please wait... - + Vänta... Error: %1 - + Fel: %1 Setup complete. - + Inställning slutförd. - Downloading '%1' plugin (%2/%3)... - + Downloading '%1' plugin (%2/%3)... + Laddar ner "%1" (%2/%3)... Plugins installed successfully. - + Insticksmoduler korrekt installerade. Generating SSL certificate... - + Genererar SSL-certifikat... Downloading plugin: %1 (1/%2) - + Laddar ner insticksmodul: %1 (1/%2) Getting plugin list... - + Hämtar instickslista... @@ -649,17 +670,17 @@ Barrier Configurations (*.sgc);;All files (*.*) - Barrier-konfigurationer (*.sgc);;Alla filer (*.*) + Barrier-konfigurationer (*.sgc);;Alla filer (*.*) Barrier Configurations (*.conf);;All files (*.*) - Barrier-konfigurationer (*.conf);;Alla filer (*.*) + Barrier-konfigurationer (*.conf);;Alla filer (*.*) System tray is unavailable, quitting. - Systemfältet otillgängligt, avslutar. + Systemfältet otillgängligt, avslutar. @@ -667,22 +688,22 @@ Screen name is empty - Skärmnamnet är tomt + Skärmnamnet är tomt The screen name cannot be empty. Please either fill in a name or cancel the dialog. - Skärmnamnet kan inte vara tomt. Fyll i ett namn eller avbryt dialogrutan. + Skärmnamnet kan inte vara tomt. Fyll i ett namn eller avbryt. Screen name matches alias - Skärmnamn matchar alias + Skärmnamnet är samma som alias The screen name cannot be the same as an alias. Please either remove the alias or change the screen name. - Skärmnamnet kan inte vara samma som en alias. Var vänlig att antingen ta bort alias eller ändra skärmnamnet. + Skärmnamnet kan inte vara samma som alias. Ta antingen bort alias eller ändra skärmnamnet. @@ -690,37 +711,37 @@ Screen Settings - Skärminställningar + Skärminställningar Screen &name: - Skärmnamn: + Skärm&namn: A&liases - Alias + A&lias &Add - Lägg till + &Lägg till &Remove - Ta bort + &Ta bort &Modifier keys - Modifieringstangenter + &Modifieringstangenter &Shift: - Shift: + &Shift: @@ -729,7 +750,7 @@ Shift - Shift + Shift @@ -738,7 +759,7 @@ Ctrl - Ctrl + Ctrl @@ -747,7 +768,7 @@ Alt - Alt + Alt @@ -756,7 +777,7 @@ Meta - Meta + Meta @@ -765,7 +786,7 @@ Super - Super + Super @@ -774,82 +795,82 @@ None - Ingen + Ingen &Ctrl: - &Ctrl: + &Ctrl: Al&t: - Alt: + Al&t: M&eta: - Meta: + M%eta: S&uper: - Super: + S&uper: &Dead corners - Döda hörn + &Döda hörn Top-left - Över vänster + Vänster överkant Top-right - Över höger + Höger överkant Bottom-left - Nedre vänstra hörnet + Vänster underkant Bottom-right - Nedre höger + Höger underkant Corner Si&ze: - Hörnets storlek: + H&örnstorlek: &Fixes - Korrigeringar + &Korrigeringar Fix CAPS LOCK key - Korrigera CAPS LOCK + Korrigera CAPS LOCK Fix NUM LOCK key - Korrigera NUM LOCK + Korrigera NUM LOCK Fix SCROLL LOCK key - Korrigera SCROLL LOCK + Korrigera SCROLL LOCK Fix XTest for Xinerama - Korrigera XTest för Xinerama + Korrigera XTest för Xinerama @@ -857,7 +878,7 @@ <center>Screen: <b>%1</b></center><br>Double click to edit settings<br>Drag screen to the trashcan to remove it - <center>Skärm:<b>%1</b></center><br>Dubbelklicka för att ändra inställningar<br>Dra skärmen till papperskorgen för att ta bort den + <center>Skärm:<b>%1</b></center><br>Dubbelklicka för att ändra inställningar<br>Dra skärmen till papperskorgen för att ta bort den @@ -865,7 +886,7 @@ Configure server - + Konfigurera server @@ -873,168 +894,168 @@ Server Configuration - Serverkonfiguration + Serverkonfiguration Screens and links - Skärmar och länkar + Skärmar och länkar Drag a screen from the grid to the trashcan to remove it. - Dra en skärm från rutnätet till papperskorgen för att ta bort den. + Dra en skärm från rutfältet till papperskorgen för att ta bort den. Configure the layout of your barrier server configuration. - Konfigurera layouten på din Barrier-konfiguration. + Konfigurera layouten på din Barrier serverkonfiguration. Drag this button to the grid to add a new screen. - Dra den här knappen till rutnätet för att lägga till en ny skärm. + Dra den här knappen till rutfältet för att lägga till en ny skärm. Drag new screens to the grid or move existing ones around. Drag a screen to the trashcan to delete it. Double click on a screen to edit its settings. - Dra nya skärmar till rutnätet eller flytta runt existerande. + Dra nya skärmar till rutfältet eller flytta runt befintliga. Dra en skärm till papperskorgen för att ta bort den. Dubbelklicka på en skärm för att ändra dess inställningar. Hotkeys - Snabbtangenter + Snabbtangenter &Hotkeys - Snabbtangenter + &Snabbtangenter &New - Ny + &Nytt &Edit - &Redigera + &Redigera &Remove - Ta bort + &Ta bort A&ctions - Åtgärder + &Åtgärder Ne&w - Ny + N&ytt E&dit - Ändra + Re&digera Re&move - Ta bort + Ta &bort Advanced server settings - Avancerade serverinställningar + Avancerade serverinställningar &Switch - Växla + &Växla Switch &after waiting - Växla efter väntan + V&äxla efter väntan ms - ms + ms Switch on double &tap within - Växla eller dubbelklicka inuti + Växla vid &dubbelklick inom &Options - Alternativ + &Alternativ &Check clients every - Kontrollera klienter varje + &Kontrollera klienter varje Use &relative mouse moves - Använd relativa musrörelser + Använd &relativa musrörelser S&ynchronize screen savers - Synkronisera skärmsläckare + Synkr&onisera skärmsläckare - Don't take &foreground window on Windows servers - Använd inte förgrundsfönster på Windowsservrar + Don't take &foreground window on Windows servers + Använd inte &förgrundsfönster på Windowsservrar Ignore auto config clients - + Ignorera automatiskt konfigurerade klienter &Dead corners - Döda hörn + &Döda hörn To&p-left - Övre vänstra hörnet + V&änster överkant Top-rig&ht - Övre högra hörnet + H&öger överkant &Bottom-left - Nedre vänstra hörnet + Vänster &underkant Bottom-ri&ght - Nedre högra hörnet + Höger u&nderkant Cor&ner Size: - Hörnstorlek: + Hö&rnstorlek: @@ -1042,20 +1063,20 @@ Save log file to... - Spara loggfil till... + Spara loggfil till... Elevate Barrier - Förhöj Barriers behörighet + Höj Barriers behörighet Are you sure you want to elevate Barrier? This allows Barrier to interact with elevated processes and the UAC dialog, but can cause problems with non-elevated processes. Elevate Barrier only if you really need to. - Är du säker på att du vill förhöja Barriers behörighet? -Detta låter Barrier interagera med förhöjda processer och UAC-dialogen, men kan skapa program med processer som inte är förhöjda. Förhöj Barriers behörighet enbart om du verkligen måste. + Vill du verkligen höja Barriers behörighet? +Detta låter Barrier interagera med förhöjda processer och UAC-dialogen, men kan skapa program med processer som inte är förhöjda. Höj Barriers behörighet enbart om du verkligen måste. @@ -1063,107 +1084,107 @@ Settings - Inställningar + Inställningar Sc&reen name: - Skärmnamn: + Sk&ärmnamn: P&ort: - Port: + P&ort: &Interface: - Gränssnitt: + G&ränssnitt: Elevate mode - + Rättighetsläge &Hide on startup - + &Dölj vid programstart &Network Security - + &Nätverkssäkerhet Use &SSL encryption (unique certificate) - + Använd &SSL-kryptering (unikt certifikat) Logging - Loggning + Loggning &Logging level: - Loggningsnivå: + &Loggningsnivå: Log to file: - Logga till fil: + Logga till fil: Browse... - Bläddra: + Bläddra... Error - Fel + Fel &Language: - Språk: + &Språk: &Miscellaneous - &Övrigt + &Diverse Warning - Varning + Varning Note - Notering + Anteckning Info - Info + Information Debug - Felsök + Felsök Debug1 - Felsök1 + Felsök1 Debug2 - Felsök2 + Felsök2 @@ -1171,17 +1192,17 @@ Setup Barrier - Ställ in Barrier + Ställ in Barrier Please select an option. - Välj ett alternativ. + Välj ett alternativ. Please enter your email address and password. - Var vänlig skriv din e-postaddress och lösenord. + Ange din e-postadress och lösenord. @@ -1189,85 +1210,93 @@ Setup Barrier - Ställ in Barrier + Installera Barrier Welcome - Välkommen + Välkommen Thanks for installing Barrier! - Tack för att du installerar Barrier! + Tack för att du installerar Barrier! - Barrier lets you easily share your mouse and keyboard between multiple computers on your desk, and it's Free and Open Source. Just move your mouse off the edge of one computer's screen on to another. You can even share all of your clipboards. All you need is a network connection. Barrier is cross-platform (works on Windows, Mac OS X and Linux). - Med Barrier kan du enkelt dela din mus och ditt tangentbord med flera datorer på ditt skrivbord, och det är Fri och Öppen mjukvara. För bara muspekaren över kanten på en datorskärm för att den skall dyka upp på nästa. Du kan till och med dela utklipp. Allt du behöver är en nätverksanslutning. Barrier är multiplattform (fungerar på både Windows, Mac OS X och Linux). + Barrier lets you easily share your mouse and keyboard between multiple computers on your desk, and it's Free and Open Source. Just move your mouse off the edge of one computer's screen on to another. You can even share all of your clipboards. All you need is a network connection. Barrier is cross-platform (works on Windows, Mac OS X and Linux). + Med Barrier kan du enkelt dela din mus och ditt tangentbord mellan flera datorer på ditt skrivbord, och det är fri och öppen källkod. För bara muspekaren över kanten på en datorskärm till en annan. Du kan till och med dela urklipp. Allt du behöver är en nätverksanslutning. Barrier är multiplattform (fungerar på både Windows, OSX och Linux). Activate - + Aktivera &Activate now... - + &Aktivera nu... Email: - + E-post: Password: - + Lösenord: <a href="https://symless.com/account/reset/">Forgot password</a> - + <a href="https://symless.com/account/reset/">Glömt lösenord</a> &Skip activation - + &Skippa aktivering - &Server (share this computer's mouse and keyboard) - + &Server (share this computer's mouse and keyboard) + &Server (dela denna dators mus och tangentbord) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">My main mouse and keyboard are connected to this computer. This will allow you to move your mouse over to another computer's screen. There can only be one server in your setup.</span></p></body></html> - +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">My main mouse and keyboard are connected to this computer. This will allow you to move your mouse over to another computer's screen. There can only be one server in your setup.</span></p></body></html> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Min primära mus och tangentbord är anslutna till den här datorn. Detta låter dig flytta musen över till en annan dators skärm. Det kan bara finnas en server i din installation.</span></p></body></html> - &Client (use another computer's mouse and keyboard) - + &Client (use another computer's mouse and keyboard) + &Klient (använd en annan dators mus och tangentbord) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You have already set up a server. This computer will be controlled using the server's mouse and keyboard. There can be many clients in your setup.</span></p></body></html> - +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You have already set up a server. This computer will be controlled using the server's mouse and keyboard. There can be many clients in your setup.</span></p></body></html> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Du har redan installerat en server. Den här datorn styrs med hjälp av serverns mus och tangentbord. Det kan finnas många klienter i din installation.</span></p></body></html> Server or Client? - Server eller klient? + Server eller klient? @@ -1275,22 +1304,22 @@ Failed to get profile directory. - + Kunde inte hämta profilmappen. SSL certificate generated. - + SSL-certifikat genererat. SSL fingerprint generated. - + SSL-fingeravtryck genererat. Failed to find SSL fingerprint. - + Kunde inte hitta SSL-fingeravtryck. @@ -1298,7 +1327,7 @@ Unknown - Okänd + Okänd @@ -1308,19 +1337,22 @@ An error occurred while trying to sign in. Please contact the helpdesk, and provide the following details. %1 - + Ett fel uppstod när du försökte logga in. Kontakta supporten och ange följande uppgifter. + +%1 Login failed, invalid email or password. - Inloggning misslyckades, ogiltig e-postaddress eller lösenord. + Inloggning misslyckades. Ogiltig e-postaddress eller lösenord. Login failed, an error occurred. %1 - Inloggning misslyckades, ett problem inträffade. + Inloggning misslyckades. Ett fel uppstod. + %1 @@ -1330,8 +1362,10 @@ Server response: %1 - Inloggning misslyckades, ett problem inträffade. -Server svar: + Inloggning misslyckades. Ett fel uppstod. + +Serversvar: + %1 @@ -1339,19 +1373,23 @@ An error occurred while trying to query the plugin list. Please contact the help desk, and provide the following details. %1 - + Ett fel uppstod när instickslistan anropades. Kontakta supporten och ange följande uppgifter. + +%1 Get plugin list failed, invalid user email or password. - + Kunde inte hämta instickslistan. Ogiltig e-postadress eller lösenord. Get plugin list failed, an error occurred. %1 - + Kunde inte hämta instickslistan. Ett fel uppstod. + +%1 @@ -1360,7 +1398,11 @@ Server response: %1 - + Kunde inte hämta instickslistan. Ett fel uppstod. + +Serversvar: + +%1 @@ -1368,44 +1410,44 @@ zeroconf server detected: %1 - + zeroconf-server identifierad: %1 zeroconf client detected: %1 - + zeroconf-klient identifierad: %1 Zero configuration service - + Zero konfigurationstjänst Error code: %1. - + Felkod:%1. Unable to start the zeroconf: %1. - + Kunde inte starta zeroconf: %1. Barrier - Barrier + Barrier Failed to get local IP address. Please manually type in server address on your clients - + Kunde inte inhämta lokal IP-adress. Skriv in serveradressen manuellt, på dina klienter. %1 - + %1 - \ No newline at end of file + diff -Nru barrier-2.3.2+dfsg/src/gui/src/Action.cpp barrier-2.3.3+dfsg/src/gui/src/Action.cpp --- barrier-2.3.2+dfsg/src/gui/src/Action.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/Action.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -24,7 +24,8 @@ const char* Action::m_ActionTypeNames[] = { "keyDown", "keyUp", "keystroke", - "switchToScreen", "switchInDirection", "lockCursorToScreen", + "switchToScreen", "toggleScreen", + "switchInDirection", "lockCursorToScreen", "mouseDown", "mouseUp", "mousebutton" }; @@ -45,7 +46,13 @@ QString Action::text() const { - QString text = QString(m_ActionTypeNames[keySequence().isMouseButton() ? type() + 6 : type() ]) + "("; + /* This function is used to save to config file which is for barriers to + * read. However the server config parse does not support functions with () + * in the end but now argument inside. If you need a function with no + * argument, it can not have () in the end. + */ + QString text = QString(m_ActionTypeNames[keySequence().isMouseButton() ? + type() + int(mouseDown) : type()]); switch (type()) { @@ -53,6 +60,7 @@ case keyUp: case keystroke: { + text += "("; text += keySequence().toString(); if (!keySequence().isMouseButton()) @@ -72,19 +80,29 @@ else text += ",*"; } + text += ")"; } break; case switchToScreen: + text += "("; text += switchScreenName(); + text += ")"; + break; + + case toggleScreen: break; case switchInDirection: + text += "("; text += m_SwitchDirectionNames[m_SwitchDirection]; + text += ")"; break; case lockCursorToScreen: + text += "("; text += m_LockCursorModeNames[m_LockCursorMode]; + text += ")"; break; default: @@ -92,7 +110,6 @@ break; } - text += ")"; return text; } diff -Nru barrier-2.3.2+dfsg/src/gui/src/ActionDialogBase.ui barrier-2.3.3+dfsg/src/gui/src/ActionDialogBase.ui --- barrier-2.3.2+dfsg/src/gui/src/ActionDialogBase.ui 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/ActionDialogBase.ui 2020-07-14 17:37:45.000000000 +0000 @@ -145,6 +145,17 @@ + + + Toggle screen + + + + + + + + Switch in direction diff -Nru barrier-2.3.2+dfsg/src/gui/src/ActionDialog.cpp barrier-2.3.3+dfsg/src/gui/src/ActionDialog.cpp --- barrier-2.3.2+dfsg/src/gui/src/ActionDialog.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/ActionDialog.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -39,7 +39,7 @@ // work around Qt Designer's lack of a QButtonGroup; we need it to get // at the button id of the checked radio button - QRadioButton* const typeButtons[] = { m_pRadioPress, m_pRadioRelease, m_pRadioPressAndRelease, m_pRadioSwitchToScreen, m_pRadioSwitchInDirection, m_pRadioLockCursorToScreen }; + QRadioButton* const typeButtons[] = { m_pRadioPress, m_pRadioRelease, m_pRadioPressAndRelease, m_pRadioSwitchToScreen, m_pRadioToggleScreen, m_pRadioSwitchInDirection, m_pRadioLockCursorToScreen }; for (unsigned int i = 0; i < sizeof(typeButtons) / sizeof(typeButtons[0]); i++) m_pButtonGroupType->addButton(typeButtons[i], i); diff -Nru barrier-2.3.2+dfsg/src/gui/src/Action.h barrier-2.3.3+dfsg/src/gui/src/Action.h --- barrier-2.3.2+dfsg/src/gui/src/Action.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/Action.h 2020-07-14 17:37:45.000000000 +0000 @@ -36,7 +36,9 @@ friend QTextStream& operator<<(QTextStream& outStream, const Action& action); public: - enum ActionType { keyDown, keyUp, keystroke, switchToScreen, switchInDirection, lockCursorToScreen, mouseDown, mouseUp, mousebutton }; + enum ActionType { keyDown, keyUp, keystroke, + switchToScreen, toggleScreen, switchInDirection, + lockCursorToScreen, mouseDown, mouseUp, mousebutton }; enum SwitchDirection { switchLeft, switchRight, switchUp, switchDown }; enum LockCursorMode { lockCursorToggle, lockCursonOn, lockCursorOff }; diff -Nru barrier-2.3.2+dfsg/src/gui/src/BaseConfig.h barrier-2.3.3+dfsg/src/gui/src/BaseConfig.h --- barrier-2.3.2+dfsg/src/gui/src/BaseConfig.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/BaseConfig.h 2020-07-14 17:37:45.000000000 +0000 @@ -26,61 +26,97 @@ class BaseConfig { - public: - enum Modifier { DefaultMod = -1, Shift, Ctrl, Alt, Meta, Super, None, NumModifiers }; - enum SwitchCorner { TopLeft, TopRight, BottomLeft, BottomRight, NumSwitchCorners }; - enum Fix { CapsLock, NumLock, ScrollLock, XTest, PreserveFocus, NumFixes }; +public: + enum class Modifier { + DefaultMod = -1, + Shift, + Ctrl, + Alt, + Meta, + Super, + None, + Count + }; + + enum class SwitchCorner { + TopLeft, + TopRight, + BottomLeft, + BottomRight, + Count + }; + + enum class Fix { + CapsLock, + NumLock, + ScrollLock, + XTest, + PreserveFocus, + Count + }; protected: BaseConfig() {} virtual ~BaseConfig() {} protected: - template - void readSettings(QSettings& settings, T1& array, const QString& arrayName, const T2& deflt) + template + void readSettings(QSettings& settings, QList& array, const QString& arrayName, + const T& deflt) { int entries = settings.beginReadArray(arrayName + "Array"); array.clear(); for (int i = 0; i < entries; i++) { settings.setArrayIndex(i); - QVariant v = settings.value(arrayName, deflt); - array.append(v.value()); + QVariant v = settings.value(arrayName, static_cast(deflt)); + array.append(static_cast(v.value())); } settings.endArray(); } - template - void readSettings(QSettings& settings, T1& array, const QString& arrayName, const T2& deflt, int entries) + template + void readSettings(QSettings& settings, QList& array, const QString& arrayName, + const T& deflt, int entries) { Q_ASSERT(array.size() >= entries); settings.beginReadArray(arrayName + "Array"); for (int i = 0; i < entries; i++) { settings.setArrayIndex(i); - QVariant v = settings.value(arrayName, deflt); - array[i] = v.value(); + QVariant v = settings.value(arrayName, static_cast(deflt)); + array[i] = static_cast(v.value()); } settings.endArray(); } - template - void writeSettings(QSettings& settings, const T& array, const QString& arrayName) const + template + void writeSettings(QSettings& settings, const QList& array, + const QString& arrayName) const { settings.beginWriteArray(arrayName + "Array"); for (int i = 0; i < array.size(); i++) { settings.setArrayIndex(i); - settings.setValue(arrayName, array[i]); + settings.setValue(arrayName, static_cast(array[i])); } settings.endArray(); } public: - static const char* modifierName(int idx) { return m_ModifierNames[idx]; } - static const char* fixName(int idx) { return m_FixNames[idx]; } - static const char* switchCornerName(int idx) { return m_SwitchCornerNames[idx]; } + static const char* modifierName(Modifier idx) + { + return m_ModifierNames[static_cast(idx)]; + } + static const char* fixName(Fix idx) + { + return m_FixNames[static_cast(idx)]; + } + static const char* switchCornerName(SwitchCorner idx) + { + return m_SwitchCornerNames[static_cast(idx)]; + } private: static const char* m_ModifierNames[]; diff -Nru barrier-2.3.2+dfsg/src/gui/src/MainWindow.cpp barrier-2.3.3+dfsg/src/gui/src/MainWindow.cpp --- barrier-2.3.2+dfsg/src/gui/src/MainWindow.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/MainWindow.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -67,10 +67,17 @@ static const char* barrierIconFiles[] = { +#if defined(Q_OS_MAC) + ":/res/icons/32x32/barrier-disconnected-mask.png", + ":/res/icons/32x32/barrier-disconnected-mask.png", + ":/res/icons/32x32/barrier-connected-mask.png", + ":/res/icons/32x32/barrier-transfering-mask.png" +#else ":/res/icons/16x16/barrier-disconnected.png", ":/res/icons/16x16/barrier-disconnected.png", ":/res/icons/16x16/barrier-connected.png", ":/res/icons/16x16/barrier-transfering.png" +#endif }; static const char* barrierLargeIcon = ":/res/icons/256x256/barrier.ico"; @@ -288,8 +295,13 @@ void MainWindow::setIcon(qBarrierState state) { - if (m_pTrayIcon) - m_pTrayIcon->setIcon(QIcon(barrierIconFiles[state])); + if (m_pTrayIcon) { + QIcon icon = QIcon(barrierIconFiles[state]); +#if defined(Q_OS_MAC) + icon.setIsMask(true); +#endif + m_pTrayIcon->setIcon(icon); + } } void MainWindow::trayActivated(QSystemTrayIcon::ActivationReason reason) @@ -333,7 +345,9 @@ void MainWindow::appendLogInfo(const QString& text) { - m_pLogWindow->appendInfo(text); + if (appConfig().logLevel() >= 3) { + m_pLogWindow->appendInfo(text); + } } void MainWindow::appendLogDebug(const QString& text) { @@ -524,10 +538,7 @@ qDebug() << args; - // show command if debug log level... - if (appConfig().logLevel() >= 4) { - appendLogInfo(QString("command: %1 %2").arg(app, args.join(" "))); - } + appendLogDebug(QString("command: %1 %2").arg(app, args.join(" "))); appendLogInfo("config file: " + configFilename()); appendLogInfo("log level: " + appConfig().logLevelText()); @@ -584,9 +595,7 @@ args << "[" + serverIp + "]:" + QString::number(appConfig().port()); return true; } - } - - if (m_pLineEditHostname->text().isEmpty()) { + } else if (m_pLineEditHostname->text().isEmpty()) { show(); if (!m_SuppressEmptyServerWarning) { QMessageBox::warning(this, tr("Hostname is empty"), @@ -944,6 +953,7 @@ } if (m_AppConfig->getCryptoEnabled() && Fingerprint::local().fileExists()) { m_pLabelLocalFingerprint->setText(Fingerprint::local().readFirst()); + m_pLabelLocalFingerprint->setTextInteractionFlags(Qt::TextSelectableByMouse); } else { m_pLabelLocalFingerprint->setText("Disabled"); } diff -Nru barrier-2.3.2+dfsg/src/gui/src/Screen.cpp barrier-2.3.3+dfsg/src/gui/src/Screen.cpp --- barrier-2.3.2+dfsg/src/gui/src/Screen.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/Screen.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -47,13 +47,13 @@ // m_Modifiers, m_SwitchCorners and m_Fixes are QLists we use like fixed-size arrays, // thus we need to make sure to fill them with the required number of elements. - for (int i = 0; i < NumModifiers; i++) - modifiers() << i; + for (int i = 0; i < static_cast(Modifier::Count); i++) + modifiers() << static_cast(i); - for (int i = 0; i < NumSwitchCorners; i++) + for (int i = 0; i < static_cast(SwitchCorner::Count); i++) switchCorners() << false; - for (int i = 0; i < NumFixes; i++) + for (int i = 0; i < static_cast(Fix::Count); i++) fixes() << false; } @@ -66,10 +66,12 @@ setSwitchCornerSize(settings.value("switchCornerSize").toInt()); - readSettings(settings, aliases(), "alias", QString("")); - readSettings(settings, modifiers(), "modifier", static_cast(DefaultMod), NumModifiers); - readSettings(settings, switchCorners(), "switchCorner", false, NumSwitchCorners); - readSettings(settings, fixes(), "fix", false, NumFixes); + readSettings(settings, aliases(), "alias", QString("")); + readSettings(settings, modifiers(), "modifier", Modifier::DefaultMod, + static_cast(Modifier::Count)); + readSettings(settings, switchCorners(), "switchCorner", false, + static_cast(SwitchCorner::Count)); + readSettings(settings, fixes(), "fix", false, static_cast(Fix::Count)); } void Screen::saveSettings(QSettings& settings) const @@ -81,27 +83,35 @@ settings.setValue("switchCornerSize", switchCornerSize()); - writeSettings(settings, aliases(), "alias"); - writeSettings(settings, modifiers(), "modifier"); - writeSettings(settings, switchCorners(), "switchCorner"); - writeSettings(settings, fixes(), "fix"); + writeSettings(settings, aliases(), "alias"); + writeSettings(settings, modifiers(), "modifier"); + writeSettings(settings, switchCorners(), "switchCorner"); + writeSettings(settings, fixes(), "fix"); } QTextStream& Screen::writeScreensSection(QTextStream& outStream) const { outStream << "\t" << name() << ":" << endl; - for (int i = 0; i < modifiers().size(); i++) - if (modifier(i) != i) - outStream << "\t\t" << modifierName(i) << " = " << modifierName(modifier(i)) << endl; + for (int i = 0; i < modifiers().size(); i++) { + auto mod = static_cast(i); + if (modifier(mod) != mod) { + outStream << "\t\t" << modifierName(mod) << " = " << modifierName(modifier(mod)) + << endl; + } + } - for (int i = 0; i < fixes().size(); i++) - outStream << "\t\t" << fixName(i) << " = " << (fixes()[i] ? "true" : "false") << endl; + for (int i = 0; i < fixes().size(); i++) { + auto fix = static_cast(i); + outStream << "\t\t" << fixName(fix) << " = " << (fixes()[i] ? "true" : "false") << endl; + } outStream << "\t\t" << "switchCorners = none "; - for (int i = 0; i < switchCorners().size(); i++) - if (switchCorners()[i]) - outStream << "+" << switchCornerName(i) << " "; + for (int i = 0; i < switchCorners().size(); i++) { + if (switchCorners()[i]) { + outStream << "+" << switchCornerName(static_cast(i)) << " "; + } + } outStream << endl; outStream << "\t\t" << "switchCornerSize = " << switchCornerSize() << endl; @@ -124,11 +134,16 @@ QDataStream& operator<<(QDataStream& outStream, const Screen& screen) { + QList modifiers; + for (auto mod : screen.modifiers()) { + modifiers.push_back(static_cast(mod)); + } + return outStream << screen.name() << screen.switchCornerSize() << screen.aliases() - << screen.modifiers() + << modifiers << screen.switchCorners() << screen.fixes() ; @@ -136,12 +151,18 @@ QDataStream& operator>>(QDataStream& inStream, Screen& screen) { + QList modifiers; return inStream >> screen.m_Name >> screen.m_SwitchCornerSize >> screen.m_Aliases - >> screen.m_Modifiers + >> modifiers >> screen.m_SwitchCorners >> screen.m_Fixes ; + + screen.m_Modifiers.clear(); + for (auto mod : modifiers) { + screen.m_Modifiers.push_back(static_cast(mod)); + } } diff -Nru barrier-2.3.2+dfsg/src/gui/src/Screen.h barrier-2.3.3+dfsg/src/gui/src/Screen.h --- barrier-2.3.2+dfsg/src/gui/src/Screen.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/Screen.h 2020-07-14 17:37:45.000000000 +0000 @@ -50,12 +50,17 @@ const QStringList& aliases() const { return m_Aliases; } bool isNull() const { return m_Name.isEmpty(); } - int modifier(int m) const { return m_Modifiers[m] == DefaultMod ? m : m_Modifiers[m]; } - const QList& modifiers() const { return m_Modifiers; } - bool switchCorner(int c) const { return m_SwitchCorners[c]; } + Modifier modifier(Modifier m) const + { + Modifier overriddenModifier = m_Modifiers[static_cast(m)]; + return overriddenModifier == Modifier::DefaultMod ? m : overriddenModifier; + } + + const QList& modifiers() const { return m_Modifiers; } + bool switchCorner(SwitchCorner c) const { return m_SwitchCorners[static_cast(c)]; } const QList& switchCorners() const { return m_SwitchCorners; } int switchCornerSize() const { return m_SwitchCornerSize; } - bool fix(Fix f) const { return m_Fixes[f]; } + bool fix(Fix f) const { return m_Fixes[static_cast(f)]; } const QList& fixes() const { return m_Fixes; } void loadSettings(QSettings& settings); @@ -73,13 +78,13 @@ void setPixmap(const QPixmap& pixmap) { m_Pixmap = pixmap; } QStringList& aliases() { return m_Aliases; } - void setModifier(int m, int n) { m_Modifiers[m] = n; } - QList& modifiers() { return m_Modifiers; } + void setModifier(Modifier m, Modifier n) { m_Modifiers[static_cast(m)] = n; } + QList& modifiers() { return m_Modifiers; } void addAlias(const QString& alias) { m_Aliases.append(alias); } - void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; } + void setSwitchCorner(SwitchCorner c, bool on) { m_SwitchCorners[static_cast(c)] = on; } QList& switchCorners() { return m_SwitchCorners; } void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; } - void setFix(int f, bool on) { m_Fixes[f] = on; } + void setFix(Fix f, bool on) { m_Fixes[static_cast(f)] = on; } QList& fixes() { return m_Fixes; } void setSwapped(bool on) { m_Swapped = on; } @@ -88,7 +93,7 @@ QString m_Name; QStringList m_Aliases; - QList m_Modifiers; + QList m_Modifiers; QList m_SwitchCorners; int m_SwitchCornerSize; QList m_Fixes; diff -Nru barrier-2.3.2+dfsg/src/gui/src/ScreenSettingsDialog.cpp barrier-2.3.3+dfsg/src/gui/src/ScreenSettingsDialog.cpp --- barrier-2.3.2+dfsg/src/gui/src/ScreenSettingsDialog.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/ScreenSettingsDialog.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -52,23 +52,23 @@ for (int i = 0; i < m_pScreen->aliases().count(); i++) new QListWidgetItem(m_pScreen->aliases()[i], m_pListAliases); - m_pComboBoxShift->setCurrentIndex(m_pScreen->modifier(Screen::Shift)); - m_pComboBoxCtrl->setCurrentIndex(m_pScreen->modifier(Screen::Ctrl)); - m_pComboBoxAlt->setCurrentIndex(m_pScreen->modifier(Screen::Alt)); - m_pComboBoxMeta->setCurrentIndex(m_pScreen->modifier(Screen::Meta)); - m_pComboBoxSuper->setCurrentIndex(m_pScreen->modifier(Screen::Super)); - - m_pCheckBoxCornerTopLeft->setChecked(m_pScreen->switchCorner(Screen::TopLeft)); - m_pCheckBoxCornerTopRight->setChecked(m_pScreen->switchCorner(Screen::TopRight)); - m_pCheckBoxCornerBottomLeft->setChecked(m_pScreen->switchCorner(Screen::BottomLeft)); - m_pCheckBoxCornerBottomRight->setChecked(m_pScreen->switchCorner(Screen::BottomRight)); + m_pComboBoxShift->setCurrentIndex(static_cast(m_pScreen->modifier(Screen::Modifier::Shift))); + m_pComboBoxCtrl->setCurrentIndex(static_cast(m_pScreen->modifier(Screen::Modifier::Ctrl))); + m_pComboBoxAlt->setCurrentIndex(static_cast(m_pScreen->modifier(Screen::Modifier::Alt))); + m_pComboBoxMeta->setCurrentIndex(static_cast(m_pScreen->modifier(Screen::Modifier::Meta))); + m_pComboBoxSuper->setCurrentIndex(static_cast(m_pScreen->modifier(Screen::Modifier::Super))); + + m_pCheckBoxCornerTopLeft->setChecked(m_pScreen->switchCorner(Screen::SwitchCorner::TopLeft)); + m_pCheckBoxCornerTopRight->setChecked(m_pScreen->switchCorner(Screen::SwitchCorner::TopRight)); + m_pCheckBoxCornerBottomLeft->setChecked(m_pScreen->switchCorner(Screen::SwitchCorner::BottomLeft)); + m_pCheckBoxCornerBottomRight->setChecked(m_pScreen->switchCorner(Screen::SwitchCorner::BottomRight)); m_pSpinBoxSwitchCornerSize->setValue(m_pScreen->switchCornerSize()); - m_pCheckBoxCapsLock->setChecked(m_pScreen->fix(Screen::CapsLock)); - m_pCheckBoxNumLock->setChecked(m_pScreen->fix(Screen::NumLock)); - m_pCheckBoxScrollLock->setChecked(m_pScreen->fix(Screen::ScrollLock)); - m_pCheckBoxXTest->setChecked(m_pScreen->fix(Screen::XTest)); - m_pCheckBoxPreserveFocus->setChecked(m_pScreen->fix(Screen::PreserveFocus)); + m_pCheckBoxCapsLock->setChecked(m_pScreen->fix(Screen::Fix::CapsLock)); + m_pCheckBoxNumLock->setChecked(m_pScreen->fix(Screen::Fix::NumLock)); + m_pCheckBoxScrollLock->setChecked(m_pScreen->fix(Screen::Fix::ScrollLock)); + m_pCheckBoxXTest->setChecked(m_pScreen->fix(Screen::Fix::XTest)); + m_pCheckBoxPreserveFocus->setChecked(m_pScreen->fix(Screen::Fix::PreserveFocus)); } void ScreenSettingsDialog::accept() @@ -100,23 +100,28 @@ m_pScreen->addAlias(alias); } - m_pScreen->setModifier(Screen::Shift, m_pComboBoxShift->currentIndex()); - m_pScreen->setModifier(Screen::Ctrl, m_pComboBoxCtrl->currentIndex()); - m_pScreen->setModifier(Screen::Alt, m_pComboBoxAlt->currentIndex()); - m_pScreen->setModifier(Screen::Meta, m_pComboBoxMeta->currentIndex()); - m_pScreen->setModifier(Screen::Super, m_pComboBoxSuper->currentIndex()); - - m_pScreen->setSwitchCorner(Screen::TopLeft, m_pCheckBoxCornerTopLeft->isChecked()); - m_pScreen->setSwitchCorner(Screen::TopRight, m_pCheckBoxCornerTopRight->isChecked()); - m_pScreen->setSwitchCorner(Screen::BottomLeft, m_pCheckBoxCornerBottomLeft->isChecked()); - m_pScreen->setSwitchCorner(Screen::BottomRight, m_pCheckBoxCornerBottomRight->isChecked()); + m_pScreen->setModifier(Screen::Modifier::Shift, + static_cast(m_pComboBoxShift->currentIndex())); + m_pScreen->setModifier(Screen::Modifier::Ctrl, + static_cast(m_pComboBoxCtrl->currentIndex())); + m_pScreen->setModifier(Screen::Modifier::Alt, + static_cast(m_pComboBoxAlt->currentIndex())); + m_pScreen->setModifier(Screen::Modifier::Meta, + static_cast(m_pComboBoxMeta->currentIndex())); + m_pScreen->setModifier(Screen::Modifier::Super, + static_cast(m_pComboBoxSuper->currentIndex())); + + m_pScreen->setSwitchCorner(Screen::SwitchCorner::TopLeft, m_pCheckBoxCornerTopLeft->isChecked()); + m_pScreen->setSwitchCorner(Screen::SwitchCorner::TopRight, m_pCheckBoxCornerTopRight->isChecked()); + m_pScreen->setSwitchCorner(Screen::SwitchCorner::BottomLeft, m_pCheckBoxCornerBottomLeft->isChecked()); + m_pScreen->setSwitchCorner(Screen::SwitchCorner::BottomRight, m_pCheckBoxCornerBottomRight->isChecked()); m_pScreen->setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value()); - m_pScreen->setFix(Screen::CapsLock, m_pCheckBoxCapsLock->isChecked()); - m_pScreen->setFix(Screen::NumLock, m_pCheckBoxNumLock->isChecked()); - m_pScreen->setFix(Screen::ScrollLock, m_pCheckBoxScrollLock->isChecked()); - m_pScreen->setFix(Screen::XTest, m_pCheckBoxXTest->isChecked()); - m_pScreen->setFix(Screen::PreserveFocus, m_pCheckBoxPreserveFocus->isChecked()); + m_pScreen->setFix(Screen::Fix::CapsLock, m_pCheckBoxCapsLock->isChecked()); + m_pScreen->setFix(Screen::Fix::NumLock, m_pCheckBoxNumLock->isChecked()); + m_pScreen->setFix(Screen::Fix::ScrollLock, m_pCheckBoxScrollLock->isChecked()); + m_pScreen->setFix(Screen::Fix::XTest, m_pCheckBoxXTest->isChecked()); + m_pScreen->setFix(Screen::Fix::PreserveFocus, m_pCheckBoxPreserveFocus->isChecked()); QDialog::accept(); } diff -Nru barrier-2.3.2+dfsg/src/gui/src/ServerConfig.cpp barrier-2.3.3+dfsg/src/gui/src/ServerConfig.cpp --- barrier-2.3.2+dfsg/src/gui/src/ServerConfig.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/ServerConfig.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -88,8 +88,9 @@ screens().clear(); // m_NumSwitchCorners is used as a fixed size array. See Screen::init() - for (int i = 0; i < NumSwitchCorners; i++) + for (int i = 0; i < static_cast(SwitchCorner::Count); i++) { switchCorners() << false; + } // There must always be screen objects for each cell in the screens QList. Unused screens // are identified by having an empty name. @@ -119,7 +120,7 @@ settings().setValue("enableDragAndDrop", enableDragAndDrop()); settings().setValue("clipboardSharing", clipboardSharing()); - writeSettings(settings(), switchCorners(), "switchCorner"); + writeSettings(settings(), switchCorners(), "switchCorner"); settings().beginWriteArray("screens"); for (int i = 0; i < screens().size(); i++) @@ -164,7 +165,8 @@ setEnableDragAndDrop(settings().value("enableDragAndDrop", true).toBool()); setClipboardSharing(settings().value("clipboardSharing", true).toBool()); - readSettings(settings(), switchCorners(), "switchCorner", false, NumSwitchCorners); + readSettings(settings(), switchCorners(), "switchCorner", false, + static_cast(SwitchCorner::Count)); int numScreens = settings().beginReadArray("screens"); Q_ASSERT(numScreens <= screens().size()); @@ -258,9 +260,12 @@ outStream << "\t" << "switchDoubleTap = " << config.switchDoubleTap() << endl; outStream << "\t" << "switchCorners = none "; - for (int i = 0; i < config.switchCorners().size(); i++) - if (config.switchCorners()[i]) - outStream << "+" << config.switchCornerName(i) << " "; + for (int i = 0; i < config.switchCorners().size(); i++) { + auto corner = static_cast(i); + if (config.switchCorners()[i]) { + outStream << "+" << config.switchCornerName(corner) << " "; + } + } outStream << endl; outStream << "\t" << "switchCornerSize = " << config.switchCornerSize() << endl; diff -Nru barrier-2.3.2+dfsg/src/gui/src/ServerConfigDialogBase.ui barrier-2.3.3+dfsg/src/gui/src/ServerConfigDialogBase.ui --- barrier-2.3.2+dfsg/src/gui/src/ServerConfigDialogBase.ui 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/ServerConfigDialogBase.ui 2020-07-14 17:37:45.000000000 +0000 @@ -334,53 +334,67 @@ - + - - - true - - - Switch on double &tap within - - + + + + + true + + + Switch on double &tap within + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + 10 + + + 10000 + + + 10 + + + 250 + + + + + + + ms + + + + - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - 10 - - - 10000 - - - 10 - - - 250 - - - - - + - ms + Bump against the screen edge with the mouse pointer twice in quick succession. + + + true diff -Nru barrier-2.3.2+dfsg/src/gui/src/ServerConfigDialog.cpp barrier-2.3.3+dfsg/src/gui/src/ServerConfigDialog.cpp --- barrier-2.3.2+dfsg/src/gui/src/ServerConfigDialog.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/ServerConfigDialog.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -48,10 +48,10 @@ m_pCheckBoxSwitchDoubleTap->setChecked(serverConfig().hasSwitchDoubleTap()); m_pSpinBoxSwitchDoubleTap->setValue(serverConfig().switchDoubleTap()); - m_pCheckBoxCornerTopLeft->setChecked(serverConfig().switchCorner(BaseConfig::TopLeft)); - m_pCheckBoxCornerTopRight->setChecked(serverConfig().switchCorner(BaseConfig::TopRight)); - m_pCheckBoxCornerBottomLeft->setChecked(serverConfig().switchCorner(BaseConfig::BottomLeft)); - m_pCheckBoxCornerBottomRight->setChecked(serverConfig().switchCorner(BaseConfig::BottomRight)); + m_pCheckBoxCornerTopLeft->setChecked(serverConfig().switchCorner(BaseConfig::SwitchCorner::TopLeft)); + m_pCheckBoxCornerTopRight->setChecked(serverConfig().switchCorner(BaseConfig::SwitchCorner::TopRight)); + m_pCheckBoxCornerBottomLeft->setChecked(serverConfig().switchCorner(BaseConfig::SwitchCorner::BottomLeft)); + m_pCheckBoxCornerBottomRight->setChecked(serverConfig().switchCorner(BaseConfig::SwitchCorner::BottomRight)); m_pSpinBoxSwitchCornerSize->setValue(serverConfig().switchCornerSize()); m_pCheckBoxIgnoreAutoConfigClient->setChecked(serverConfig().ignoreAutoConfigClient()); @@ -95,10 +95,14 @@ serverConfig().haveSwitchDoubleTap(m_pCheckBoxSwitchDoubleTap->isChecked()); serverConfig().setSwitchDoubleTap(m_pSpinBoxSwitchDoubleTap->value()); - serverConfig().setSwitchCorner(BaseConfig::TopLeft, m_pCheckBoxCornerTopLeft->isChecked()); - serverConfig().setSwitchCorner(BaseConfig::TopRight, m_pCheckBoxCornerTopRight->isChecked()); - serverConfig().setSwitchCorner(BaseConfig::BottomLeft, m_pCheckBoxCornerBottomLeft->isChecked()); - serverConfig().setSwitchCorner(BaseConfig::BottomRight, m_pCheckBoxCornerBottomRight->isChecked()); + serverConfig().setSwitchCorner(BaseConfig::SwitchCorner::TopLeft, + m_pCheckBoxCornerTopLeft->isChecked()); + serverConfig().setSwitchCorner(BaseConfig::SwitchCorner::TopRight, + m_pCheckBoxCornerTopRight->isChecked()); + serverConfig().setSwitchCorner(BaseConfig::SwitchCorner::BottomLeft, + m_pCheckBoxCornerBottomLeft->isChecked()); + serverConfig().setSwitchCorner(BaseConfig::SwitchCorner::BottomRight, + m_pCheckBoxCornerBottomRight->isChecked()); serverConfig().setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value()); serverConfig().setIgnoreAutoConfigClient(m_pCheckBoxIgnoreAutoConfigClient->isChecked()); serverConfig().setEnableDragAndDrop(m_pCheckBoxEnableDragAndDrop->isChecked()); diff -Nru barrier-2.3.2+dfsg/src/gui/src/ServerConfig.h barrier-2.3.3+dfsg/src/gui/src/ServerConfig.h --- barrier-2.3.2+dfsg/src/gui/src/ServerConfig.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/ServerConfig.h 2020-07-14 17:37:45.000000000 +0000 @@ -56,7 +56,7 @@ int switchDelay() const { return m_SwitchDelay; } bool hasSwitchDoubleTap() const { return m_HasSwitchDoubleTap; } int switchDoubleTap() const { return m_SwitchDoubleTap; } - bool switchCorner(int c) const { return m_SwitchCorners[c]; } + bool switchCorner(SwitchCorner c) const { return m_SwitchCorners[static_cast(c)]; } int switchCornerSize() const { return m_SwitchCornerSize; } const QList& switchCorners() const { return m_SwitchCorners; } const HotkeyList& hotkeys() const { return m_Hotkeys; } @@ -87,7 +87,7 @@ void setSwitchDelay(int val) { m_SwitchDelay = val; } void haveSwitchDoubleTap(bool on) { m_HasSwitchDoubleTap = on; } void setSwitchDoubleTap(int val) { m_SwitchDoubleTap = val; } - void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; } + void setSwitchCorner(SwitchCorner c, bool on) { m_SwitchCorners[static_cast(c)] = on; } void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; } void setIgnoreAutoConfigClient(bool on) { m_IgnoreAutoConfigClient = on; } void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; } diff -Nru barrier-2.3.2+dfsg/src/gui/src/SettingsDialog.cpp barrier-2.3.3+dfsg/src/gui/src/SettingsDialog.cpp --- barrier-2.3.2+dfsg/src/gui/src/SettingsDialog.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/gui/src/SettingsDialog.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -31,8 +31,6 @@ #include #include -static const char networkSecurity[] = "ns"; - SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), Ui::SettingsDialogBase(), @@ -136,4 +134,4 @@ { QString ietfCode = m_pComboLanguage->itemData(index).toString(); QBarrierApplication::getInstance()->switchTranslator(ietfCode); -} \ No newline at end of file +} diff -Nru barrier-2.3.2+dfsg/src/lib/arch/ArchDaemonNone.h barrier-2.3.3+dfsg/src/lib/arch/ArchDaemonNone.h --- barrier-2.3.2+dfsg/src/lib/arch/ArchDaemonNone.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/ArchDaemonNone.h 2020-07-14 17:37:45.000000000 +0000 @@ -19,6 +19,7 @@ #pragma once #include "arch/IArchDaemon.h" +#include #define ARCH_DAEMON ArchDaemonNone @@ -46,5 +47,5 @@ virtual bool isDaemonInstalled(const char* name); virtual void installDaemon(); virtual void uninstallDaemon(); - virtual std::string commandLine() const; + virtual std::string commandLine() const; }; diff -Nru barrier-2.3.2+dfsg/src/lib/arch/Arch.h barrier-2.3.3+dfsg/src/lib/arch/Arch.h --- barrier-2.3.2+dfsg/src/lib/arch/Arch.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/Arch.h 2020-07-14 17:37:45.000000000 +0000 @@ -54,9 +54,7 @@ # include "arch/unix/ArchConsoleUnix.h" # include "arch/unix/ArchDaemonUnix.h" # include "arch/unix/ArchLogUnix.h" -# if HAVE_PTHREAD -# include "arch/unix/ArchMultithreadPosix.h" -# endif +# include "arch/unix/ArchMultithreadPosix.h" # include "arch/unix/ArchNetworkBSD.h" # include "arch/unix/ArchSleepUnix.h" # include "arch/unix/ArchStringUnix.h" diff -Nru barrier-2.3.2+dfsg/src/lib/arch/IArchDaemon.h barrier-2.3.3+dfsg/src/lib/arch/IArchDaemon.h --- barrier-2.3.2+dfsg/src/lib/arch/IArchDaemon.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/IArchDaemon.h 2020-07-14 17:37:45.000000000 +0000 @@ -19,7 +19,7 @@ #pragma once #include "common/IInterface.h" -#include "base/String.h" +#include //! Interface for architecture dependent daemonizing /*! @@ -122,7 +122,7 @@ /*! Gets the command line with which the application was started. */ - virtual std::string commandLine() const = 0; + virtual std::string commandLine() const = 0; //@} }; diff -Nru barrier-2.3.2+dfsg/src/lib/arch/IArchTaskBarReceiver.h barrier-2.3.3+dfsg/src/lib/arch/IArchTaskBarReceiver.h --- barrier-2.3.2+dfsg/src/lib/arch/IArchTaskBarReceiver.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/IArchTaskBarReceiver.h 2020-07-14 17:37:45.000000000 +0000 @@ -18,8 +18,8 @@ #pragma once -#include "base/String.h" #include "common/IInterface.h" +#include class IScreen; class INode; @@ -88,9 +88,9 @@ to set the tooltip is left to sublclasses. Getting and setting the icon must be thread safe. */ - virtual std::string getToolTip() const = 0; + virtual std::string getToolTip() const = 0; - virtual void updateStatus(INode*, const String& errorMsg) = 0; + virtual void updateStatus(INode*, const std::string& errorMsg) = 0; virtual void cleanup() {} diff -Nru barrier-2.3.2+dfsg/src/lib/arch/unix/ArchInternetUnix.cpp barrier-2.3.3+dfsg/src/lib/arch/unix/ArchInternetUnix.cpp --- barrier-2.3.2+dfsg/src/lib/arch/unix/ArchInternetUnix.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/unix/ArchInternetUnix.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -28,8 +28,8 @@ public: CurlFacade(); ~CurlFacade(); - String get(const String& url); - String urlEncode(const String& url); + std::string get(const std::string& url); + std::string urlEncode(const std::string& url); private: CURL* m_curl; @@ -39,15 +39,13 @@ // ArchInternetUnix // -String -ArchInternetUnix::get(const String& url) +std::string ArchInternetUnix::get(const std::string& url) { CurlFacade curl; return curl.get(url); } -String -ArchInternetUnix::urlEncode(const String& url) +std::string ArchInternetUnix::urlEncode(const std::string& url) { CurlFacade curl; return curl.urlEncode(url); @@ -87,8 +85,7 @@ curl_global_cleanup(); } -String -CurlFacade::get(const String& url) +std::string CurlFacade::get(const std::string& url) { curl_easy_setopt(m_curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, curlWriteCallback); @@ -110,8 +107,7 @@ return result; } -String -CurlFacade::urlEncode(const String& url) +std::string CurlFacade::urlEncode(const std::string& url) { char* resultCStr = curl_easy_escape(m_curl, url.c_str(), 0); diff -Nru barrier-2.3.2+dfsg/src/lib/arch/unix/ArchInternetUnix.h barrier-2.3.3+dfsg/src/lib/arch/unix/ArchInternetUnix.h --- barrier-2.3.2+dfsg/src/lib/arch/unix/ArchInternetUnix.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/unix/ArchInternetUnix.h 2020-07-14 17:37:45.000000000 +0000 @@ -19,10 +19,10 @@ #define ARCH_INTERNET ArchInternetUnix -#include "base/String.h" +#include class ArchInternetUnix { public: - String get(const String& url); - String urlEncode(const String& url); + std::string get(const std::string& url); + std::string urlEncode(const std::string& url); }; diff -Nru barrier-2.3.2+dfsg/src/lib/arch/unix/ArchMultithreadPosix.cpp barrier-2.3.3+dfsg/src/lib/arch/unix/ArchMultithreadPosix.cpp --- barrier-2.3.2+dfsg/src/lib/arch/unix/ArchMultithreadPosix.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/unix/ArchMultithreadPosix.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -36,17 +36,6 @@ #define SIGWAKEUP SIGUSR1 -#if !HAVE_PTHREAD_SIGNAL - // boy, is this platform broken. forget about pthread signal - // handling and let signals through to every process. barrier - // will not terminate cleanly when it gets SIGTERM or SIGINT. -# define pthread_sigmask sigprocmask -# define pthread_kill(tid_, sig_) kill(0, (sig_)) -# define sigwait(set_, sig_) -# undef HAVE_POSIX_SIGWAIT -# define HAVE_POSIX_SIGWAIT 1 -#endif - static void setSignalSet(sigset_t* sigset) @@ -344,9 +333,7 @@ // can't tell the difference. if (!m_newThreadCalled) { m_newThreadCalled = true; -#if HAVE_PTHREAD_SIGNAL startSignalHandler(); -#endif } // note that the child thread will wait until we release this mutex diff -Nru barrier-2.3.2+dfsg/src/lib/arch/unix/ArchNetworkBSD.cpp barrier-2.3.3+dfsg/src/lib/arch/unix/ArchNetworkBSD.cpp --- barrier-2.3.2+dfsg/src/lib/arch/unix/ArchNetworkBSD.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/unix/ArchNetworkBSD.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -690,7 +690,6 @@ // allocate address ArchNetAddressImpl* addr = new ArchNetAddressImpl; - char ipstr[INET6_ADDRSTRLEN]; struct addrinfo hints; struct addrinfo *p; int ret; diff -Nru barrier-2.3.2+dfsg/src/lib/arch/unix/XArchUnix.h barrier-2.3.3+dfsg/src/lib/arch/unix/XArchUnix.h --- barrier-2.3.2+dfsg/src/lib/arch/unix/XArchUnix.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/unix/XArchUnix.h 2020-07-14 17:37:45.000000000 +0000 @@ -24,7 +24,7 @@ class XArchEvalUnix : public XArchEval { public: XArchEvalUnix(int error) : m_error(error) { } - virtual ~XArchEvalUnix() _NOEXCEPT { } + virtual ~XArchEvalUnix() noexcept { } virtual std::string eval() const; diff -Nru barrier-2.3.2+dfsg/src/lib/arch/win32/ArchInternetWindows.cpp barrier-2.3.3+dfsg/src/lib/arch/win32/ArchInternetWindows.cpp --- barrier-2.3.2+dfsg/src/lib/arch/win32/ArchInternetWindows.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/win32/ArchInternetWindows.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -18,6 +18,7 @@ #include "arch/win32/ArchInternetWindows.h" #include "arch/win32/XArchWindows.h" #include "arch/Arch.h" +#include "base/String.h" #include "common/Version.h" #include @@ -25,19 +26,19 @@ #include struct WinINetUrl { - String m_scheme; - String m_host; - String m_path; + std::string m_scheme; + std::string m_host; + std::string m_path; INTERNET_PORT m_port; DWORD m_flags; }; class WinINetRequest { public: - WinINetRequest(const String& url); + WinINetRequest(const std::string& url); ~WinINetRequest(); - String send(); + std::string send(); void openSession(); void connect(); void openRequest(); @@ -54,15 +55,13 @@ // ArchInternetWindows // -String -ArchInternetWindows::get(const String& url) +std::string ArchInternetWindows::get(const std::string& url) { WinINetRequest request(url); return request.send(); } -String -ArchInternetWindows::urlEncode(const String& url) +std::string ArchInternetWindows::urlEncode(const std::string& url) { TCHAR buffer[1024]; DWORD bufferSize = sizeof(buffer); @@ -71,7 +70,7 @@ throw XArch(new XArchEvalWindows()); } - String result(buffer); + std::string result(buffer); // the win32 url encoding funcitons are pretty useless (to us) and only // escape "unsafe" chars, but not + or =, so we need to replace these @@ -86,9 +85,9 @@ // WinINetRequest // -static WinINetUrl parseUrl(const String& url); +static WinINetUrl parseUrl(const std::string& url); -WinINetRequest::WinINetRequest(const String& url) : +WinINetRequest::WinINetRequest(const std::string& url) : m_session(NULL), m_connect(NULL), m_request(NULL), @@ -112,8 +111,7 @@ } } -String -WinINetRequest::send() +std::string WinINetRequest::send() { if (m_used) { throw XArch("class is one time use."); @@ -124,7 +122,7 @@ connect(); openRequest(); - String headers("Content-Type: text/html"); + std::string headers("Content-Type: text/html"); if (!HttpSendRequest(m_request, headers.c_str(), (DWORD)headers.length(), NULL, NULL)) { throw XArch(new XArchEvalWindows()); } @@ -142,8 +140,7 @@ return result.str(); } -void -WinINetRequest::openSession() +void WinINetRequest::openSession() { std::stringstream userAgent; userAgent << "Barrier "; @@ -200,8 +197,7 @@ // nb: i tried to use InternetCrackUrl here, but couldn't quite get that to // work. here's some (less robust) code to split the url into components. // this works fine with simple urls, but doesn't consider the full url spec. -static WinINetUrl -parseUrl(const String& url) +static WinINetUrl parseUrl(const std::string& url) { WinINetUrl parsed; @@ -215,7 +211,7 @@ parsed.m_port = INTERNET_DEFAULT_HTTP_PORT; parsed.m_flags = 0; - if (parsed.m_scheme.find("https") != String::npos) { + if (parsed.m_scheme.find("https") != std::string::npos) { parsed.m_port = INTERNET_DEFAULT_HTTPS_PORT; parsed.m_flags = INTERNET_FLAG_SECURE; } diff -Nru barrier-2.3.2+dfsg/src/lib/arch/win32/ArchInternetWindows.h barrier-2.3.3+dfsg/src/lib/arch/win32/ArchInternetWindows.h --- barrier-2.3.2+dfsg/src/lib/arch/win32/ArchInternetWindows.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/win32/ArchInternetWindows.h 2020-07-14 17:37:45.000000000 +0000 @@ -19,10 +19,10 @@ #define ARCH_INTERNET ArchInternetWindows -#include "base/String.h" +#include class ArchInternetWindows { public: - String get(const String& url); - String urlEncode(const String& url); + std::string get(const std::string& url); + std::string urlEncode(const std::string& url); }; diff -Nru barrier-2.3.2+dfsg/src/lib/arch/win32/ArchMiscWindows.cpp barrier-2.3.3+dfsg/src/lib/arch/win32/ArchMiscWindows.cpp --- barrier-2.3.2+dfsg/src/lib/arch/win32/ArchMiscWindows.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/win32/ArchMiscWindows.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -431,7 +431,7 @@ bool ArchMiscWindows::wasLaunchedAsService() { - String name; + std::string name; if (!getParentProcessName(name)) { LOG((CLOG_ERR "cannot determine if process was launched as service")); return false; @@ -440,8 +440,7 @@ return (name == SERVICE_LAUNCHER); } -bool -ArchMiscWindows::getParentProcessName(String &name) +bool ArchMiscWindows::getParentProcessName(std::string &name) { PROCESSENTRY32 parentEntry; if (!getParentProcessEntry(parentEntry)){ @@ -521,4 +520,4 @@ { assert(instance != NULL); s_instanceWin32 = instance; -} \ No newline at end of file +} diff -Nru barrier-2.3.2+dfsg/src/lib/arch/win32/ArchMiscWindows.h barrier-2.3.3+dfsg/src/lib/arch/win32/ArchMiscWindows.h --- barrier-2.3.2+dfsg/src/lib/arch/win32/ArchMiscWindows.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/win32/ArchMiscWindows.h 2020-07-14 17:37:45.000000000 +0000 @@ -21,7 +21,6 @@ #include "common/common.h" #include "common/stdstring.h" #include "common/stdset.h" -#include "base/String.h" #define WIN32_LEAN_AND_MEAN #include @@ -163,7 +162,7 @@ static bool wasLaunchedAsService(); //! Returns true if we got the parent process name. - static bool getParentProcessName(String &name); + static bool getParentProcessName(std::string &name); static HINSTANCE instanceWin32(); diff -Nru barrier-2.3.2+dfsg/src/lib/arch/win32/XArchWindows.cpp barrier-2.3.3+dfsg/src/lib/arch/win32/XArchWindows.cpp --- barrier-2.3.2+dfsg/src/lib/arch/win32/XArchWindows.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/win32/XArchWindows.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -25,7 +25,7 @@ // std::string -XArchEvalWindows::eval() const throw() +XArchEvalWindows::eval() const noexcept { char* cmsg; if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | @@ -51,7 +51,7 @@ // std::string -XArchEvalWinsock::eval() const throw() +XArchEvalWinsock::eval() const noexcept { // built-in windows function for looking up error message strings // may not look up network error messages correctly. we'll have diff -Nru barrier-2.3.2+dfsg/src/lib/arch/win32/XArchWindows.h barrier-2.3.3+dfsg/src/lib/arch/win32/XArchWindows.h --- barrier-2.3.2+dfsg/src/lib/arch/win32/XArchWindows.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/win32/XArchWindows.h 2020-07-14 17:37:45.000000000 +0000 @@ -30,7 +30,7 @@ XArchEvalWindows(DWORD error) : m_error(error) { } virtual ~XArchEvalWindows() { } - virtual std::string eval() const; + virtual std::string eval() const noexcept; private: DWORD m_error; @@ -42,7 +42,7 @@ XArchEvalWinsock(int error) : m_error(error) { } virtual ~XArchEvalWinsock() { } - virtual std::string eval() const; + virtual std::string eval() const noexcept; private: int m_error; diff -Nru barrier-2.3.2+dfsg/src/lib/arch/XArch.h barrier-2.3.3+dfsg/src/lib/arch/XArch.h --- barrier-2.3.2+dfsg/src/lib/arch/XArch.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/arch/XArch.h 2020-07-14 17:37:45.000000000 +0000 @@ -20,7 +20,7 @@ #include "common/common.h" #include "common/stdstring.h" -#include "common/stdexcept.h" +#include //! Generic thread exception /*! @@ -56,7 +56,7 @@ class XArchEval { public: XArchEval() { } - virtual ~XArchEval() _NOEXCEPT { } + virtual ~XArchEval() noexcept { } virtual std::string eval() const = 0; }; @@ -66,7 +66,7 @@ public: XArch(XArchEval* adopted) : std::runtime_error(adopted->eval()) { delete adopted; } XArch(const std::string& msg) : std::runtime_error(msg) { } - virtual ~XArch() _NOEXCEPT { } + virtual ~XArch() noexcept { } }; // Macro to declare XArch derived types diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/ClientApp.cpp barrier-2.3.3+dfsg/src/lib/barrier/ClientApp.cpp --- barrier-2.3.2+dfsg/src/lib/barrier/ClientApp.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/ClientApp.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -282,7 +282,9 @@ void ClientApp::handleClientConnected(const Event&, void*) { - LOG((CLOG_NOTE "connected to server")); + // using CLOG_PRINT here allows the GUI to see that the client is connected + // regardless of which log level is set + LOG((CLOG_PRINT "connected to server")); resetRestartTimeout(); updateStatus(); } diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/PlatformScreen.h barrier-2.3.3+dfsg/src/lib/barrier/PlatformScreen.h --- barrier-2.3.2+dfsg/src/lib/barrier/PlatformScreen.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/PlatformScreen.h 2020-07-14 17:37:45.000000000 +0000 @@ -20,7 +20,7 @@ #include "barrier/IPlatformScreen.h" #include "barrier/DragInformation.h" -#include "common/stdexcept.h" +#include //! Base screen implementation /*! diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/ProtocolUtil.cpp barrier-2.3.3+dfsg/src/lib/barrier/ProtocolUtil.cpp --- barrier-2.3.2+dfsg/src/lib/barrier/ProtocolUtil.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/ProtocolUtil.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -20,6 +20,7 @@ #include "io/IStream.h" #include "base/Log.h" #include "common/stdvector.h" +#include "base/String.h" #include #include @@ -538,7 +539,7 @@ // String -XIOReadMismatch::getWhat() const throw() +XIOReadMismatch::getWhat() const noexcept { return format("XIOReadMismatch", "ProtocolUtil::readf() mismatch"); } diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/ProtocolUtil.h barrier-2.3.3+dfsg/src/lib/barrier/ProtocolUtil.h --- barrier-2.3.2+dfsg/src/lib/barrier/ProtocolUtil.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/ProtocolUtil.h 2020-07-14 17:37:45.000000000 +0000 @@ -47,7 +47,7 @@ - \%1I -- converts std::vector* to 1 byte integers - \%2I -- converts std::vector* to 2 byte integers in NBO - \%4I -- converts std::vector* to 4 byte integers in NBO - - \%s -- converts String* to stream of bytes + - \%s -- converts std::string* to stream of bytes - \%S -- converts integer N and const UInt8* to stream of N bytes */ static void writef(barrier::IStream*, @@ -67,7 +67,7 @@ - \%1I -- reads 1 byte integers; arg is std::vector* - \%2I -- reads NBO 2 byte integers; arg is std::vector* - \%4I -- reads NBO 4 byte integers; arg is std::vector* - - \%s -- reads bytes; argument must be a String*, \b not a char* + - \%s -- reads bytes; argument must be a std::string*, \b not a char* */ static bool readf(barrier::IStream*, const char* fmt, ...); @@ -92,5 +92,5 @@ class XIOReadMismatch : public XIO { public: // XBase overrides - virtual String getWhat() const throw(); + virtual std::string getWhat() const noexcept; }; diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/ServerApp.cpp barrier-2.3.3+dfsg/src/lib/barrier/ServerApp.cpp --- barrier-2.3.2+dfsg/src/lib/barrier/ServerApp.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/ServerApp.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -555,15 +555,18 @@ m_server->setListener(listener); m_listener = listener; updateStatus(); - LOG((CLOG_NOTE "started server (%s), waiting for clients", family)); + + // using CLOG_PRINT here allows the GUI to see that the server is started + // regardless of which log level is set + LOG((CLOG_PRINT "started server (%s), waiting for clients", family)); m_serverState = kStarted; return true; } catch (XSocketAddressInUse& e) { - LOG((CLOG_WARN "cannot listen for clients: %s", e.what())); + LOG((CLOG_ERR "cannot listen for clients: %s", e.what())); closeClientListener(listener); updateStatus(String("cannot listen for clients: ") + e.what()); - retryTime = 10.0; + retryTime = 1.0; } catch (XBase& e) { LOG((CLOG_CRIT "failed to start server: %s", e.what())); @@ -684,9 +687,9 @@ void ServerApp::handleScreenSwitched(const Event& e, void*) { - Server::SwitchToScreenInfo* info = (Server::SwitchToScreenInfo*)(e.getData()); - #ifdef WINAPI_XWINDOWS + Server::SwitchToScreenInfo* info = (Server::SwitchToScreenInfo*)(e.getData()); + if (!args().m_screenChangeScript.empty()) { LOG((CLOG_INFO "Running shell script for screen \"%s\"", info->m_screen)); diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/StreamChunker.cpp barrier-2.3.3+dfsg/src/lib/barrier/StreamChunker.cpp --- barrier-2.3.2+dfsg/src/lib/barrier/StreamChunker.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/StreamChunker.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -29,9 +29,9 @@ #include "base/Log.h" #include "base/Stopwatch.h" #include "base/String.h" -#include "common/stdexcept.h" #include +#include using namespace std; diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/win32/DaemonApp.cpp barrier-2.3.3+dfsg/src/lib/barrier/win32/DaemonApp.cpp --- barrier-2.3.2+dfsg/src/lib/barrier/win32/DaemonApp.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/win32/DaemonApp.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -353,7 +353,10 @@ LOG((CLOG_DEBUG "ipc hello, type=%s", type.c_str())); const char * serverstatus = m_watchdog->isProcessActive() ? "active" : "not active"; - LOG((CLOG_INFO "server status: %s", serverstatus)); + + // using CLOG_PRINT here allows the GUI to see that the server status + // regardless of which log level is set + LOG((CLOG_PRINT "server status: %s", serverstatus)); m_ipcLogOutputter->notifyBuffer(); break; diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/XBarrier.cpp barrier-2.3.3+dfsg/src/lib/barrier/XBarrier.cpp --- barrier-2.3.2+dfsg/src/lib/barrier/XBarrier.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/XBarrier.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -23,8 +23,7 @@ // XBadClient // -String -XBadClient::getWhat() const throw() +String XBadClient::getWhat() const noexcept { return "XBadClient"; } @@ -41,20 +40,17 @@ // do nothing } -int -XIncompatibleClient::getMajor() const throw() +int XIncompatibleClient::getMajor() const noexcept { return m_major; } -int -XIncompatibleClient::getMinor() const throw() +int XIncompatibleClient::getMinor() const noexcept { return m_minor; } -String -XIncompatibleClient::getWhat() const throw() +String XIncompatibleClient::getWhat() const noexcept { return format("XIncompatibleClient", "incompatible client %{1}.%{2}", barrier::string::sprintf("%d", m_major).c_str(), @@ -72,14 +68,12 @@ // do nothing } -const String& -XDuplicateClient::getName() const throw() +const String& XDuplicateClient::getName() const noexcept { return m_name; } -String -XDuplicateClient::getWhat() const throw() +String XDuplicateClient::getWhat() const noexcept { return format("XDuplicateClient", "duplicate client %{1}", m_name.c_str()); } @@ -95,14 +89,12 @@ // do nothing } -const String& -XUnknownClient::getName() const throw() +const String& XUnknownClient::getName() const noexcept { return m_name; } -String -XUnknownClient::getWhat() const throw() +String XUnknownClient::getWhat() const noexcept { return format("XUnknownClient", "unknown client %{1}", m_name.c_str()); } @@ -118,14 +110,12 @@ // do nothing } -int -XExitApp::getCode() const throw() +int XExitApp::getCode() const noexcept { return m_code; } -String -XExitApp::getWhat() const throw() +String XExitApp::getWhat() const noexcept { return format( "XExitApp", "exiting with code %{1}", diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/XBarrier.h barrier-2.3.3+dfsg/src/lib/barrier/XBarrier.h --- barrier-2.3.2+dfsg/src/lib/barrier/XBarrier.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/XBarrier.h 2020-07-14 17:37:45.000000000 +0000 @@ -47,14 +47,14 @@ //@{ //! Get client's major version number - int getMajor() const throw(); + int getMajor() const noexcept; //! Get client's minor version number - int getMinor() const throw(); + int getMinor() const noexcept; //@} protected: - virtual String getWhat() const throw(); + virtual std::string getWhat() const noexcept; private: int m_major; @@ -68,23 +68,22 @@ */ class XDuplicateClient : public XBarrier { public: - XDuplicateClient(const String& name); - virtual ~XDuplicateClient() _NOEXCEPT { } + XDuplicateClient(const std::string& name); + virtual ~XDuplicateClient() noexcept { } //! @name accessors //@{ //! Get client's name - virtual const String& - getName() const throw(); + virtual const std::string& getName() const noexcept; //@} protected: - virtual String getWhat() const throw(); + virtual std::string getWhat() const noexcept; private: - String m_name; + std::string m_name; }; //! Client not in map exception @@ -94,23 +93,22 @@ */ class XUnknownClient : public XBarrier { public: - XUnknownClient(const String& name); - virtual ~XUnknownClient() _NOEXCEPT { } + XUnknownClient(const std::string& name); + virtual ~XUnknownClient() noexcept { } //! @name accessors //@{ //! Get the client's name - virtual const String& - getName() const throw(); + virtual const std::string& getName() const noexcept; //@} protected: - virtual String getWhat() const throw(); + virtual std::string getWhat() const noexcept; private: - String m_name; + std::string m_name; }; //! Generic exit eception @@ -122,13 +120,13 @@ class XExitApp : public XBarrier { public: XExitApp(int code); - virtual ~XExitApp() _NOEXCEPT { } + virtual ~XExitApp() noexcept { } //! Get the exit code - int getCode() const throw(); + int getCode() const noexcept; protected: - virtual String getWhat() const throw(); + virtual std::string getWhat() const noexcept; private: int m_code; diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/XScreen.cpp barrier-2.3.3+dfsg/src/lib/barrier/XScreen.cpp --- barrier-2.3.2+dfsg/src/lib/barrier/XScreen.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/XScreen.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -22,8 +22,7 @@ // XScreenOpenFailure // -String -XScreenOpenFailure::getWhat() const throw() +std::string XScreenOpenFailure::getWhat() const noexcept { return format("XScreenOpenFailure", "unable to open screen"); } @@ -33,8 +32,7 @@ // XScreenXInputFailure // -String -XScreenXInputFailure::getWhat() const throw() +std::string XScreenXInputFailure::getWhat() const noexcept { return ""; } @@ -50,7 +48,7 @@ // do nothing } -XScreenUnavailable::~XScreenUnavailable() _NOEXCEPT +XScreenUnavailable::~XScreenUnavailable() noexcept { // do nothing } @@ -61,8 +59,7 @@ return m_timeUntilRetry; } -String -XScreenUnavailable::getWhat() const throw() +std::string XScreenUnavailable::getWhat() const noexcept { return format("XScreenUnavailable", "unable to open screen"); } diff -Nru barrier-2.3.2+dfsg/src/lib/barrier/XScreen.h barrier-2.3.3+dfsg/src/lib/barrier/XScreen.h --- barrier-2.3.2+dfsg/src/lib/barrier/XScreen.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/barrier/XScreen.h 2020-07-14 17:37:45.000000000 +0000 @@ -47,7 +47,7 @@ trying to open the screen again. */ XScreenUnavailable(double timeUntilRetry); - virtual ~XScreenUnavailable() _NOEXCEPT; + virtual ~XScreenUnavailable() noexcept; //! @name manipulators //@{ @@ -61,7 +61,7 @@ //@} protected: - virtual String getWhat() const throw(); + virtual std::string getWhat() const noexcept; private: double m_timeUntilRetry; diff -Nru barrier-2.3.2+dfsg/src/lib/base/EventQueue.cpp barrier-2.3.3+dfsg/src/lib/base/EventQueue.cpp --- barrier-2.3.2+dfsg/src/lib/base/EventQueue.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/EventQueue.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -436,12 +436,6 @@ } } -bool -EventQueue::isEmpty() const -{ - return (m_buffer->isEmpty() && getNextTimerTimeout() != 0.0); -} - IEventJob* EventQueue::getHandler(Event::Type type, void* target) const { @@ -553,8 +547,7 @@ return m_timerQueue.top(); } -Event::Type -EventQueue::getRegisteredType(const String& name) const +Event::Type EventQueue::getRegisteredType(const std::string& name) const { NameMap::const_iterator found = m_nameMap.find(name); if (found != m_nameMap.end()) diff -Nru barrier-2.3.2+dfsg/src/lib/base/EventQueue.h barrier-2.3.3+dfsg/src/lib/base/EventQueue.h --- barrier-2.3.2+dfsg/src/lib/base/EventQueue.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/EventQueue.h 2020-07-14 17:37:45.000000000 +0000 @@ -58,11 +58,9 @@ virtual void removeHandlers(void* target); virtual Event::Type registerTypeOnce(Event::Type& type, const char* name); - virtual bool isEmpty() const; virtual IEventJob* getHandler(Event::Type type, void* target) const; virtual const char* getTypeName(Event::Type type); - virtual Event::Type - getRegisteredType(const String& name) const; + virtual Event::Type getRegisteredType(const std::string& name) const; void* getSystemTarget(); virtual void waitForReady() const; @@ -108,7 +106,7 @@ typedef std::map EventTable; typedef std::vector EventIDList; typedef std::map TypeMap; - typedef std::map NameMap; + typedef std::map NameMap; typedef std::map TypeHandlerTable; typedef std::map HandlerTable; diff -Nru barrier-2.3.2+dfsg/src/lib/base/EventTypes.cpp barrier-2.3.3+dfsg/src/lib/base/EventTypes.cpp --- barrier-2.3.2+dfsg/src/lib/base/EventTypes.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/EventTypes.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -133,6 +133,7 @@ REGISTER_EVENT(Server, connected) REGISTER_EVENT(Server, disconnected) REGISTER_EVENT(Server, switchToScreen) +REGISTER_EVENT(Server, toggleScreen) REGISTER_EVENT(Server, switchInDirection) REGISTER_EVENT(Server, keyboardBroadcast) REGISTER_EVENT(Server, lockCursorToScreen) diff -Nru barrier-2.3.2+dfsg/src/lib/base/EventTypes.h barrier-2.3.3+dfsg/src/lib/base/EventTypes.h --- barrier-2.3.2+dfsg/src/lib/base/EventTypes.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/EventTypes.h 2020-07-14 17:37:45.000000000 +0000 @@ -432,6 +432,7 @@ m_connected(Event::kUnknown), m_disconnected(Event::kUnknown), m_switchToScreen(Event::kUnknown), + m_toggleScreen(Event::kUnknown), m_switchInDirection(Event::kUnknown), m_keyboardBroadcast(Event::kUnknown), m_lockCursorToScreen(Event::kUnknown), @@ -470,6 +471,13 @@ */ Event::Type switchToScreen(); + //! Get toggle screen event type + /*! + Returns the toggle screen event type. The server responds to this + by toggling screens. These is no event data. + */ + Event::Type toggleScreen(); + //! Get switch in direction event type /*! Returns the switch in direction event type. The server responds to this @@ -508,6 +516,7 @@ Event::Type m_connected; Event::Type m_disconnected; Event::Type m_switchToScreen; + Event::Type m_toggleScreen; Event::Type m_switchInDirection; Event::Type m_keyboardBroadcast; Event::Type m_lockCursorToScreen; diff -Nru barrier-2.3.2+dfsg/src/lib/base/IEventQueue.h barrier-2.3.3+dfsg/src/lib/base/IEventQueue.h --- barrier-2.3.2+dfsg/src/lib/base/IEventQueue.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/IEventQueue.h 2020-07-14 17:37:45.000000000 +0000 @@ -20,7 +20,7 @@ #include "common/IInterface.h" #include "base/Event.h" -#include "base/String.h" +#include class IEventJob; class IEventQueueBuffer; @@ -189,13 +189,6 @@ //! @name accessors //@{ - //! Test if queue is empty - /*! - Returns true iff the queue has no events in it, including timer - events. - */ - virtual bool isEmpty() const = 0; - //! Get an event handler /*! Finds and returns the event handler for the \p type, \p target pair @@ -214,7 +207,7 @@ /*! Returns the registered type for an event for a given name. */ - virtual Event::Type getRegisteredType(const String& name) const = 0; + virtual Event::Type getRegisteredType(const std::string& name) const = 0; //! Get the system event type target /*! diff -Nru barrier-2.3.2+dfsg/src/lib/base/Log.cpp barrier-2.3.3+dfsg/src/lib/base/Log.cpp --- barrier-2.3.2+dfsg/src/lib/base/Log.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/Log.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -19,7 +19,6 @@ #include "arch/Arch.h" #include "arch/XArch.h" #include "base/Log.h" -#include "base/String.h" #include "base/log_outputters.h" #include "common/Version.h" diff -Nru barrier-2.3.2+dfsg/src/lib/base/log_outputters.cpp barrier-2.3.3+dfsg/src/lib/base/log_outputters.cpp --- barrier-2.3.2+dfsg/src/lib/base/log_outputters.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/log_outputters.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -19,6 +19,7 @@ #include "base/log_outputters.h" #include "base/TMethodJob.h" #include "arch/Arch.h" +#include "base/String.h" #include @@ -228,7 +229,7 @@ while (m_buffer.size() >= m_maxBufferSize) { m_buffer.pop_front(); } - m_buffer.push_back(String(message)); + m_buffer.push_back(std::string(message)); return true; } @@ -272,7 +273,7 @@ m_handle.close(); if (moveFile) { - String oldLogFilename = barrier::string::sprintf("%s.1", m_fileName.c_str()); + std::string oldLogFilename = barrier::string::sprintf("%s.1", m_fileName.c_str()); remove(oldLogFilename.c_str()); rename(m_fileName.c_str(), oldLogFilename.c_str()); } diff -Nru barrier-2.3.2+dfsg/src/lib/base/log_outputters.h barrier-2.3.3+dfsg/src/lib/base/log_outputters.h --- barrier-2.3.2+dfsg/src/lib/base/log_outputters.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/log_outputters.h 2020-07-14 17:37:45.000000000 +0000 @@ -20,12 +20,12 @@ #include "mt/Thread.h" #include "base/ILogOutputter.h" -#include "base/String.h" #include "common/basic_types.h" #include "common/stddeque.h" #include #include +#include //! Stop traversing log chain outputter /*! @@ -126,7 +126,7 @@ */ class BufferedLogOutputter : public ILogOutputter { private: - typedef std::deque Buffer; + typedef std::deque Buffer; public: typedef Buffer::const_iterator const_iterator; diff -Nru barrier-2.3.2+dfsg/src/lib/base/String.cpp barrier-2.3.3+dfsg/src/lib/base/String.cpp --- barrier-2.3.2+dfsg/src/lib/base/String.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/String.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -35,17 +35,17 @@ namespace barrier { namespace string { -String +std::string format(const char* fmt, ...) { va_list args; va_start(args, fmt); - String result = vformat(fmt, args); + std::string result = vformat(fmt, args); va_end(args); return result; } -String +std::string vformat(const char* fmt, va_list args) { // find highest indexed substitution and the locations of substitutions @@ -111,7 +111,7 @@ } // substitute - String result; + std::string result; result.reserve(resultLength); size_t src = 0; for (int i = 0; i < n; ++i) { @@ -124,13 +124,13 @@ return result; } -String +std::string sprintf(const char* fmt, ...) { char tmp[1024]; char* buffer = tmp; int len = (int)(sizeof(tmp) / sizeof(tmp[0])); - String result; + std::string result; while (buffer != NULL) { // try printing into the buffer va_list args; @@ -162,23 +162,23 @@ void findReplaceAll( - String& subject, - const String& find, - const String& replace) + std::string& subject, + const std::string& find, + const std::string& replace) { size_t pos = 0; - while ((pos = subject.find(find, pos)) != String::npos) { + while ((pos = subject.find(find, pos)) != std::string::npos) { subject.replace(pos, find.length(), replace); pos += replace.length(); } } -String -removeFileExt(String filename) +std::string +removeFileExt(std::string filename) { size_t dot = filename.find_last_of('.'); - if (dot == String::npos) { + if (dot == std::string::npos) { return filename; } @@ -186,7 +186,7 @@ } void -toHex(String& subject, int width, const char fill) +toHex(std::string& subject, int width, const char fill) { std::stringstream ss; ss << std::hex; @@ -198,18 +198,18 @@ } void -uppercase(String& subject) +uppercase(std::string& subject) { std::transform(subject.begin(), subject.end(), subject.begin(), ::toupper); } void -removeChar(String& subject, const char c) +removeChar(std::string& subject, const char c) { subject.erase(std::remove(subject.begin(), subject.end(), c), subject.end()); } -String +std::string sizeTypeToString(size_t n) { std::stringstream ss; @@ -218,7 +218,7 @@ } size_t -stringToSizeType(String string) +stringToSizeType(std::string string) { std::istringstream iss(string); size_t value; @@ -226,14 +226,14 @@ return value; } -std::vector -splitString(String string, const char c) +std::vector +splitString(std::string string, const char c) { - std::vector results; + std::vector results; size_t head = 0; size_t separator = string.find(c); - while (separator != String::npos) { + while (separator != std::string::npos) { if (head!=separator) { results.push_back(string.substr(head, separator - head)); } @@ -252,26 +252,22 @@ // CaselessCmp // -bool -CaselessCmp::cmpEqual( - const String::value_type& a, - const String::value_type& b) +bool CaselessCmp::cmpEqual(const std::string::value_type& a, + const std::string::value_type& b) { // should use std::tolower but not in all versions of libstdc++ have it return tolower(a) == tolower(b); } -bool -CaselessCmp::cmpLess( - const String::value_type& a, - const String::value_type& b) +bool CaselessCmp::cmpLess(const std::string::value_type& a, + const std::string::value_type& b) { // should use std::tolower but not in all versions of libstdc++ have it return tolower(a) < tolower(b); } bool -CaselessCmp::less(const String& a, const String& b) +CaselessCmp::less(const std::string& a, const std::string& b) { return std::lexicographical_compare( a.begin(), a.end(), @@ -280,13 +276,13 @@ } bool -CaselessCmp::equal(const String& a, const String& b) +CaselessCmp::equal(const std::string& a, const std::string& b) { return !(less(a, b) || less(b, a)); } bool -CaselessCmp::operator()(const String& a, const String& b) const +CaselessCmp::operator()(const std::string& a, const std::string& b) const { return less(a, b); } diff -Nru barrier-2.3.2+dfsg/src/lib/base/String.h barrier-2.3.3+dfsg/src/lib/base/String.h --- barrier-2.3.2+dfsg/src/lib/base/String.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/String.h 2020-07-14 17:37:45.000000000 +0000 @@ -29,7 +29,7 @@ namespace barrier { -//! String utilities +//! std::string utilities /*! Provides functions for string manipulation. */ @@ -45,67 +45,67 @@ All arguments in the variable list are const char*. Positional elements are indexed from 1. */ -String format(const char* fmt, ...); +std::string format(const char* fmt, ...); //! Format positional arguments /*! Same as format() except takes va_list. */ -String vformat(const char* fmt, va_list); +std::string vformat(const char* fmt, va_list); //! Print a string using sprintf-style formatting /*! -Equivalent to sprintf() except the result is returned as a String. +Equivalent to sprintf() except the result is returned as a std::string. */ -String sprintf(const char* fmt, ...); +std::string sprintf(const char* fmt, ...); //! Find and replace all /*! Finds \c find inside \c subject and replaces it with \c replace */ -void findReplaceAll(String& subject, const String& find, const String& replace); +void findReplaceAll(std::string& subject, const std::string& find, const std::string& replace); //! Remove file extension /*! Finds the last dot and remove all characters from the dot to the end */ -String removeFileExt(String filename); +std::string removeFileExt(std::string filename); //! Convert into hexdecimal /*! Convert each character in \c subject into hexdecimal form with \c width */ -void toHex(String& subject, int width, const char fill = '0'); +void toHex(std::string& subject, int width, const char fill = '0'); //! Convert to all uppercase /*! Convert each character in \c subject to uppercase */ -void uppercase(String& subject); +void uppercase(std::string& subject); //! Remove all specific char in suject /*! Remove all specific \c c in \c suject */ -void removeChar(String& subject, const char c); +void removeChar(std::string& subject, const char c); //! Convert a size type to a string /*! Convert an size type to a string */ -String sizeTypeToString(size_t n); +std::string sizeTypeToString(size_t n); //! Convert a string to a size type /*! Convert an a \c string to an size type */ -size_t stringToSizeType(String string); +size_t stringToSizeType(std::string string); //! Split a string into substrings /*! Split a \c string that separated by a \c c into substrings */ -std::vector splitString(String string, const char c); +std::vector splitString(std::string string, const char c); //! Case-insensitive comparisons /*! @@ -114,21 +114,21 @@ class CaselessCmp { public: //! Same as less() - bool operator()(const String& a, const String& b) const; + bool operator()(const std::string& a, const std::string& b) const; //! Returns true iff \c a is lexicographically less than \c b - static bool less(const String& a, const String& b); + static bool less(const std::string& a, const std::string& b); //! Returns true iff \c a is lexicographically equal to \c b - static bool equal(const String& a, const String& b); + static bool equal(const std::string& a, const std::string& b); //! Returns true iff \c a is lexicographically less than \c b - static bool cmpLess(const String::value_type& a, - const String::value_type& b); + static bool cmpLess(const std::string::value_type& a, + const std::string::value_type& b); //! Returns true iff \c a is lexicographically equal to \c b - static bool cmpEqual(const String::value_type& a, - const String::value_type& b); + static bool cmpEqual(const std::string::value_type& a, + const std::string::value_type& b); }; } diff -Nru barrier-2.3.2+dfsg/src/lib/base/Unicode.cpp barrier-2.3.3+dfsg/src/lib/base/Unicode.cpp --- barrier-2.3.2+dfsg/src/lib/base/Unicode.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/Unicode.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -98,7 +98,7 @@ UInt32 Unicode::s_replacement = 0x0000fffd; bool -Unicode::isUTF8(const String& src) +Unicode::isUTF8(const std::string& src) { // convert and test each character const UInt8* data = reinterpret_cast(src.c_str()); @@ -110,15 +110,14 @@ return true; } -String -Unicode::UTF8ToUCS2(const String& src, bool* errors) +std::string Unicode::UTF8ToUCS2(const std::string& src, bool* errors) { // default to success resetError(errors); // get size of input string and reserve some space in output UInt32 n = (UInt32)src.size(); - String dst; + std::string dst; dst.reserve(2 * n); // convert each character @@ -139,15 +138,15 @@ return dst; } -String -Unicode::UTF8ToUCS4(const String& src, bool* errors) +std::string +Unicode::UTF8ToUCS4(const std::string& src, bool* errors) { // default to success resetError(errors); // get size of input string and reserve some space in output UInt32 n = (UInt32)src.size(); - String dst; + std::string dst; dst.reserve(4 * n); // convert each character @@ -163,15 +162,15 @@ return dst; } -String -Unicode::UTF8ToUTF16(const String& src, bool* errors) +std::string +Unicode::UTF8ToUTF16(const std::string& src, bool* errors) { // default to success resetError(errors); // get size of input string and reserve some space in output UInt32 n = (UInt32)src.size(); - String dst; + std::string dst; dst.reserve(2 * n); // convert each character @@ -201,15 +200,15 @@ return dst; } -String -Unicode::UTF8ToUTF32(const String& src, bool* errors) +std::string +Unicode::UTF8ToUTF32(const std::string& src, bool* errors) { // default to success resetError(errors); // get size of input string and reserve some space in output UInt32 n = (UInt32)src.size(); - String dst; + std::string dst; dst.reserve(4 * n); // convert each character @@ -229,8 +228,8 @@ return dst; } -String -Unicode::UTF8ToText(const String& src, bool* errors) +std::string +Unicode::UTF8ToText(const std::string& src, bool* errors) { // default to success resetError(errors); @@ -243,7 +242,7 @@ int len = ARCH->convStringWCToMB(NULL, tmp, size, errors); char* mbs = new char[len + 1]; ARCH->convStringWCToMB(mbs, tmp, size, errors); - String text(mbs, len); + std::string text(mbs, len); // clean up delete[] mbs; @@ -252,8 +251,8 @@ return text; } -String -Unicode::UCS2ToUTF8(const String& src, bool* errors) +std::string +Unicode::UCS2ToUTF8(const std::string& src, bool* errors) { // default to success resetError(errors); @@ -263,8 +262,8 @@ return doUCS2ToUTF8(reinterpret_cast(src.data()), n, errors); } -String -Unicode::UCS4ToUTF8(const String& src, bool* errors) +std::string +Unicode::UCS4ToUTF8(const std::string& src, bool* errors) { // default to success resetError(errors); @@ -274,8 +273,8 @@ return doUCS4ToUTF8(reinterpret_cast(src.data()), n, errors); } -String -Unicode::UTF16ToUTF8(const String& src, bool* errors) +std::string +Unicode::UTF16ToUTF8(const std::string& src, bool* errors) { // default to success resetError(errors); @@ -285,8 +284,8 @@ return doUTF16ToUTF8(reinterpret_cast(src.data()), n, errors); } -String -Unicode::UTF32ToUTF8(const String& src, bool* errors) +std::string +Unicode::UTF32ToUTF8(const std::string& src, bool* errors) { // default to success resetError(errors); @@ -296,8 +295,8 @@ return doUTF32ToUTF8(reinterpret_cast(src.data()), n, errors); } -String -Unicode::textToUTF8(const String& src, bool* errors) +std::string +Unicode::textToUTF8(const std::string& src, bool* errors) { // default to success resetError(errors); @@ -309,7 +308,7 @@ ARCH->convStringMBToWC(wcs, src.c_str(), n, errors); // convert to UTF8 - String utf8 = wideCharToUTF8(wcs, len, errors); + std::string utf8 = wideCharToUTF8(wcs, len, errors); // clean up delete[] wcs; @@ -318,10 +317,10 @@ } wchar_t* -Unicode::UTF8ToWideChar(const String& src, UInt32& size, bool* errors) +Unicode::UTF8ToWideChar(const std::string& src, UInt32& size, bool* errors) { // convert to platform's wide character encoding - String tmp; + std::string tmp; switch (ARCH->getWideCharEncoding()) { case IArchString::kUCS2: tmp = UTF8ToUCS2(src, errors); @@ -353,12 +352,12 @@ return dst; } -String +std::string Unicode::wideCharToUTF8(const wchar_t* src, UInt32 size, bool* errors) { // convert from platform's wide character encoding. // note -- this must include a wide nul character (independent of - // the String's nul character). + // the std::string's nul character). switch (ARCH->getWideCharEncoding()) { case IArchString::kUCS2: return doUCS2ToUTF8(reinterpret_cast(src), size, errors); @@ -374,15 +373,15 @@ default: assert(0 && "unknown wide character encoding"); - return String(); + return std::string(); } } -String +std::string Unicode::doUCS2ToUTF8(const UInt8* data, UInt32 n, bool* errors) { // make some space - String dst; + std::string dst; dst.reserve(n); // check if first character is 0xfffe or 0xfeff @@ -414,11 +413,11 @@ return dst; } -String +std::string Unicode::doUCS4ToUTF8(const UInt8* data, UInt32 n, bool* errors) { // make some space - String dst; + std::string dst; dst.reserve(n); // check if first character is 0xfffe or 0xfeff @@ -450,11 +449,11 @@ return dst; } -String +std::string Unicode::doUTF16ToUTF8(const UInt8* data, UInt32 n, bool* errors) { // make some space - String dst; + std::string dst; dst.reserve(n); // check if first character is 0xfffe or 0xfeff @@ -512,11 +511,11 @@ return dst; } -String +std::string Unicode::doUTF32ToUTF8(const UInt8* data, UInt32 n, bool* errors) { // make some space - String dst; + std::string dst; dst.reserve(n); // check if first character is 0xfffe or 0xfeff @@ -728,7 +727,7 @@ } void -Unicode::toUTF8(String& dst, UInt32 c, bool* errors) +Unicode::toUTF8(std::string& dst, UInt32 c, bool* errors) { UInt8 data[6]; diff -Nru barrier-2.3.2+dfsg/src/lib/base/Unicode.h barrier-2.3.3+dfsg/src/lib/base/Unicode.h --- barrier-2.3.2+dfsg/src/lib/base/Unicode.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/Unicode.h 2020-07-14 17:37:45.000000000 +0000 @@ -18,8 +18,8 @@ #pragma once -#include "base/String.h" #include "common/basic_types.h" +#include //! Unicode utility functions /*! @@ -36,7 +36,7 @@ Returns true iff the string contains a valid sequence of UTF-8 encoded characters. */ - static bool isUTF8(const String&); + static bool isUTF8(const std::string&); //! Convert from UTF-8 to UCS-2 encoding /*! @@ -44,7 +44,7 @@ is set to true iff any character could not be encoded in UCS-2. Decoding errors do not set *errors. */ - static String UTF8ToUCS2(const String&, bool* errors = NULL); + static std::string UTF8ToUCS2(const std::string&, bool* errors = NULL); //! Convert from UTF-8 to UCS-4 encoding /*! @@ -52,7 +52,7 @@ is set to true iff any character could not be encoded in UCS-4. Decoding errors do not set *errors. */ - static String UTF8ToUCS4(const String&, bool* errors = NULL); + static std::string UTF8ToUCS4(const std::string&, bool* errors = NULL); //! Convert from UTF-8 to UTF-16 encoding /*! @@ -60,7 +60,7 @@ is set to true iff any character could not be encoded in UTF-16. Decoding errors do not set *errors. */ - static String UTF8ToUTF16(const String&, bool* errors = NULL); + static std::string UTF8ToUTF16(const std::string&, bool* errors = NULL); //! Convert from UTF-8 to UTF-32 encoding /*! @@ -68,7 +68,7 @@ is set to true iff any character could not be encoded in UTF-32. Decoding errors do not set *errors. */ - static String UTF8ToUTF32(const String&, bool* errors = NULL); + static std::string UTF8ToUTF32(const std::string&, bool* errors = NULL); //! Convert from UTF-8 to the current locale encoding /*! @@ -76,42 +76,42 @@ NULL then *errors is set to true iff any character could not be encoded. Decoding errors do not set *errors. */ - static String UTF8ToText(const String&, bool* errors = NULL); + static std::string UTF8ToText(const std::string&, bool* errors = NULL); //! Convert from UCS-2 to UTF-8 /*! Convert from UCS-2 to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static String UCS2ToUTF8(const String&, bool* errors = NULL); + static std::string UCS2ToUTF8(const std::string&, bool* errors = NULL); //! Convert from UCS-4 to UTF-8 /*! Convert from UCS-4 to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static String UCS4ToUTF8(const String&, bool* errors = NULL); + static std::string UCS4ToUTF8(const std::string&, bool* errors = NULL); //! Convert from UTF-16 to UTF-8 /*! Convert from UTF-16 to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static String UTF16ToUTF8(const String&, bool* errors = NULL); + static std::string UTF16ToUTF8(const std::string&, bool* errors = NULL); //! Convert from UTF-32 to UTF-8 /*! Convert from UTF-32 to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static String UTF32ToUTF8(const String&, bool* errors = NULL); + static std::string UTF32ToUTF8(const std::string&, bool* errors = NULL); //! Convert from the current locale encoding to UTF-8 /*! Convert from the current locale encoding to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static String textToUTF8(const String&, bool* errors = NULL); + static std::string textToUTF8(const std::string&, bool* errors = NULL); //@} @@ -120,23 +120,21 @@ // to the platform). caller must delete[] the returned string. the // string is *not* nul terminated; the length (in characters) is // returned in size. - static wchar_t* UTF8ToWideChar(const String&, - UInt32& size, bool* errors); + static wchar_t* UTF8ToWideChar(const std::string&, UInt32& size, bool* errors); // convert nul terminated wchar_t string (in platform's native // encoding) to UTF8. - static String wideCharToUTF8(const wchar_t*, - UInt32 size, bool* errors); + static std::string wideCharToUTF8(const wchar_t*, UInt32 size, bool* errors); // internal conversion to UTF8 - static String doUCS2ToUTF8(const UInt8* src, UInt32 n, bool* errors); - static String doUCS4ToUTF8(const UInt8* src, UInt32 n, bool* errors); - static String doUTF16ToUTF8(const UInt8* src, UInt32 n, bool* errors); - static String doUTF32ToUTF8(const UInt8* src, UInt32 n, bool* errors); + static std::string doUCS2ToUTF8(const UInt8* src, UInt32 n, bool* errors); + static std::string doUCS4ToUTF8(const UInt8* src, UInt32 n, bool* errors); + static std::string doUTF16ToUTF8(const UInt8* src, UInt32 n, bool* errors); + static std::string doUTF32ToUTF8(const UInt8* src, UInt32 n, bool* errors); // convert characters to/from UTF8 - static UInt32 fromUTF8(const UInt8*& src, UInt32& size); - static void toUTF8(String& dst, UInt32 c, bool* errors); + static UInt32 fromUTF8(const UInt8*& src, UInt32& size); + static void toUTF8(std::string& dst, UInt32 c, bool* errors); private: static UInt32 s_invalid; diff -Nru barrier-2.3.2+dfsg/src/lib/base/XBase.cpp barrier-2.3.3+dfsg/src/lib/base/XBase.cpp --- barrier-2.3.2+dfsg/src/lib/base/XBase.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/XBase.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -32,19 +32,19 @@ // do nothing } -XBase::XBase(const String& msg) : +XBase::XBase(const std::string& msg) : std::runtime_error(msg) { // do nothing } -XBase::~XBase() _NOEXCEPT +XBase::~XBase() noexcept { // do nothing } const char* -XBase::what() const _NOEXCEPT +XBase::what() const noexcept { const char* what = std::runtime_error::what(); if (strlen(what) == 0) { @@ -54,14 +54,13 @@ return what; } -String -XBase::format(const char* /*id*/, const char* fmt, ...) const throw() +std::string XBase::format(const char* /*id*/, const char* fmt, ...) const noexcept { // FIXME -- lookup message string using id as an index. set // fmt to that string if it exists. // format - String result; + std::string result; va_list args; va_start(args, fmt); try { diff -Nru barrier-2.3.2+dfsg/src/lib/base/XBase.h barrier-2.3.3+dfsg/src/lib/base/XBase.h --- barrier-2.3.2+dfsg/src/lib/base/XBase.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/base/XBase.h 2020-07-14 17:37:45.000000000 +0000 @@ -18,8 +18,8 @@ #pragma once -#include "base/String.h" -#include "common/stdexcept.h" +#include +#include //! Exception base class /*! @@ -30,15 +30,15 @@ //! Use getWhat() as the result of what() XBase(); //! Use \c msg as the result of what() - XBase(const String& msg); - virtual ~XBase() _NOEXCEPT; + XBase(const std::string& msg); + virtual ~XBase() noexcept; //! Reason for exception - virtual const char* what() const _NOEXCEPT; + virtual const char* what() const noexcept; protected: //! Get a human readable string describing the exception - virtual String getWhat() const throw() { return ""; } + virtual std::string getWhat() const noexcept { return ""; } //! Format a string /*! @@ -46,47 +46,46 @@ no format can be found, then replaces positional parameters in the format string and returns the result. */ - virtual String format(const char* id, - const char* defaultFormat, ...) const throw(); + virtual std::string format(const char* id, const char* defaultFormat, ...) const noexcept; private: - mutable String m_what; + mutable std::string m_what; }; /*! \def XBASE_SUBCLASS Convenience macro to subclass from XBase (or a subclass of it), -providing the c'tor taking a const String&. getWhat() is not +providing the c'tor taking a const std::string&. getWhat() is not declared. */ #define XBASE_SUBCLASS(name_, super_) \ class name_ : public super_ { \ public: \ name_() : super_() { } \ - name_(const String& msg) : super_(msg) { } \ - virtual ~name_() _NOEXCEPT { } \ + name_(const std::string& msg) : super_(msg) { } \ + virtual ~name_() noexcept { } \ } /*! \def XBASE_SUBCLASS Convenience macro to subclass from XBase (or a subclass of it), -providing the c'tor taking a const String&. getWhat() must be +providing the c'tor taking a const std::string&. getWhat() must be implemented. */ #define XBASE_SUBCLASS_WHAT(name_, super_) \ class name_ : public super_ { \ public: \ name_() : super_() { } \ - name_(const String& msg) : super_(msg) { } \ - virtual ~name_() _NOEXCEPT { } \ + name_(const std::string& msg) : super_(msg) { } \ + virtual ~name_() noexcept { } \ \ protected: \ - virtual String getWhat() const throw(); \ + virtual std::string getWhat() const noexcept; \ } /*! \def XBASE_SUBCLASS_FORMAT Convenience macro to subclass from XBase (or a subclass of it), -providing the c'tor taking a const String&. what() is overridden +providing the c'tor taking a const std::string&. what() is overridden to call getWhat() when first called; getWhat() can format the error message and can call what() to get the message passed to the c'tor. @@ -98,10 +97,10 @@ \ public: \ name_() : super_(), m_state(kDone) { } \ - name_(const String& msg) : super_(msg), m_state(kFirst) { } \ - virtual ~name_() _NOEXCEPT { } \ + name_(const std::string& msg) : super_(msg), m_state(kFirst) { } \ + virtual ~name_() noexcept { } \ \ - virtual const char* what() const _NOEXCEPT \ + virtual const char* what() const noexcept \ { \ if (m_state == kFirst) { \ m_state = kFormat; \ @@ -117,7 +116,7 @@ } \ \ protected: \ - virtual String getWhat() const throw(); \ + virtual std::string getWhat() const noexcept; \ \ private: \ mutable EState m_state; \ diff -Nru barrier-2.3.2+dfsg/src/lib/client/Client.cpp barrier-2.3.3+dfsg/src/lib/client/Client.cpp --- barrier-2.3.2+dfsg/src/lib/client/Client.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/client/Client.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -38,23 +38,21 @@ #include "base/IEventQueue.h" #include "base/TMethodEventJob.h" #include "base/TMethodJob.h" -#include "common/stdexcept.h" #include #include #include +#include #include // // Client // -Client::Client( - IEventQueue* events, - const String& name, const NetworkAddress& address, - ISocketFactory* socketFactory, - barrier::Screen* screen, - ClientArgs const& args) : +Client::Client(IEventQueue* events, const std::string& name, const NetworkAddress& address, + ISocketFactory* socketFactory, + barrier::Screen* screen, + ClientArgs const& args) : m_mock(false), m_name(name), m_serverAddress(address), @@ -373,7 +371,7 @@ m_screen->setOptions(options); } -String +std::string Client::getName() const { return m_name; @@ -403,7 +401,7 @@ m_timeClipboard[id] = clipboard.getTime(); // marshall the data - String data = clipboard.marshall(); + std::string data = clipboard.marshall(); // save and send data if different or not yet sent if (!m_sentClipboard[id] || data != m_dataClipboard[id]) { @@ -783,7 +781,7 @@ } void -Client::dragInfoReceived(UInt32 fileNum, String data) +Client::dragInfoReceived(UInt32 fileNum, std::string data) { // TODO: fix duplicate function from CServer if (!m_args.m_enableDragDrop) { @@ -830,7 +828,7 @@ } void -Client::sendDragInfo(UInt32 fileCount, String& info, size_t size) +Client::sendDragInfo(UInt32 fileCount, std::string& info, size_t size) { m_server->sendDragInfo(fileCount, info.c_str(), size); } diff -Nru barrier-2.3.2+dfsg/src/lib/client/Client.h barrier-2.3.3+dfsg/src/lib/client/Client.h --- barrier-2.3.2+dfsg/src/lib/client/Client.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/client/Client.h 2020-07-14 17:37:45.000000000 +0000 @@ -48,7 +48,7 @@ public: FailInfo(const char* what) : m_retry(false), m_what(what) { } bool m_retry; - String m_what; + std::string m_what; }; public: @@ -57,7 +57,7 @@ as its name and \p address as the server's address and \p factory to create the socket. \p screen is the local screen. */ - Client(IEventQueue* events, const String& name, + Client(IEventQueue* events, const std::string& name, const NetworkAddress& address, ISocketFactory* socketFactory, barrier::Screen* screen, ClientArgs const& args); @@ -86,13 +86,13 @@ virtual void handshakeComplete(); //! Received drag information - void dragInfoReceived(UInt32 fileNum, String data); + void dragInfoReceived(UInt32 fileNum, std::string data); //! Create a new thread and use it to send file to Server void sendFileToServer(const char* filename); //! Send dragging file information back to server - void sendDragInfo(UInt32 fileCount, String& info, size_t size); + void sendDragInfo(UInt32 fileCount, std::string& info, size_t size); //@} @@ -126,7 +126,7 @@ size_t& getExpectedFileSize() { return m_expectedFileSize; } //! Return received file data - String& getReceivedFileData() { return m_receivedFileData; } + std::string& getReceivedFileData() { return m_receivedFileData; } //! Return drag file list DragFileList getDragFileList() { return m_dragFileList; } @@ -160,7 +160,7 @@ virtual void screensaver(bool activate); virtual void resetOptions(); virtual void setOptions(const OptionsList& options); - virtual String getName() const; + virtual std::string getName() const; private: void sendClipboard(ClipboardID); @@ -198,7 +198,7 @@ bool m_mock; private: - String m_name; + std::string m_name; NetworkAddress m_serverAddress; ISocketFactory* m_socketFactory; barrier::Screen* m_screen; @@ -212,12 +212,12 @@ bool m_ownClipboard[kClipboardEnd]; bool m_sentClipboard[kClipboardEnd]; IClipboard::Time m_timeClipboard[kClipboardEnd]; - String m_dataClipboard[kClipboardEnd]; + std::string m_dataClipboard[kClipboardEnd]; IEventQueue* m_events; std::size_t m_expectedFileSize; - String m_receivedFileData; + std::string m_receivedFileData; DragFileList m_dragFileList; - String m_dragFileExt; + std::string m_dragFileExt; Thread* m_sendFileThread; Thread* m_writeToDropDirThread; TCPSocket* m_socket; diff -Nru barrier-2.3.2+dfsg/src/lib/client/ServerProxy.cpp barrier-2.3.3+dfsg/src/lib/client/ServerProxy.cpp --- barrier-2.3.2+dfsg/src/lib/client/ServerProxy.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/client/ServerProxy.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -361,7 +361,7 @@ void ServerProxy::onClipboardChanged(ClipboardID id, const IClipboard* clipboard) { - String data = IClipboard::marshall(clipboard); + std::string data = IClipboard::marshall(clipboard); LOG((CLOG_DEBUG "sending clipboard %d seqnum=%d", id, m_seqNum)); StreamChunker::sendClipboard(data, data.size(), id, m_seqNum, m_events, this); @@ -550,7 +550,7 @@ ServerProxy::setClipboard() { // parse - static String dataCached; + static std::string dataCached; ClipboardID id; UInt32 seq; @@ -872,7 +872,7 @@ } else if (result == kStart) { if (m_client->getDragFileList().size() > 0) { - String filename = m_client->getDragFileList().at(0).getFilename(); + std::string filename = m_client->getDragFileList().at(0).getFilename(); LOG((CLOG_DEBUG "start receiving %s", filename.c_str())); } } @@ -883,7 +883,7 @@ { // parse UInt32 fileNum = 0; - String content; + std::string content; ProtocolUtil::readf(m_stream, kMsgDDragInfo + 4, &fileNum, &content); m_client->dragInfoReceived(fileNum, content); @@ -904,6 +904,6 @@ void ServerProxy::sendDragInfo(UInt32 fileCount, const char* info, size_t size) { - String data(info, size); + std::string data(info, size); ProtocolUtil::writef(m_stream, kMsgDDragInfo, fileCount, &data); } diff -Nru barrier-2.3.2+dfsg/src/lib/client/ServerProxy.h barrier-2.3.3+dfsg/src/lib/client/ServerProxy.h --- barrier-2.3.2+dfsg/src/lib/client/ServerProxy.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/client/ServerProxy.h 2020-07-14 17:37:45.000000000 +0000 @@ -22,7 +22,6 @@ #include "barrier/key_types.h" #include "base/Event.h" #include "base/Stopwatch.h" -#include "base/String.h" class Client; class ClientInfo; diff -Nru barrier-2.3.2+dfsg/src/lib/common/stdexcept.h barrier-2.3.3+dfsg/src/lib/common/stdexcept.h --- barrier-2.3.2+dfsg/src/lib/common/stdexcept.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/common/stdexcept.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -/* - * barrier -- mouse and keyboard sharing utility - * Copyright (C) 2014-2016 Symless Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file LICENSE that should have accompanied this file. - * - * This package 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. If not, see . - */ - -#include - -// apple declares _NOEXCEPT -#ifndef _NOEXCEPT -# define _NOEXCEPT throw() -#endif diff -Nru barrier-2.3.2+dfsg/src/lib/io/XIO.cpp barrier-2.3.3+dfsg/src/lib/io/XIO.cpp --- barrier-2.3.2+dfsg/src/lib/io/XIO.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/io/XIO.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -22,8 +22,7 @@ // XIOClosed // -String -XIOClosed::getWhat() const throw() +std::string XIOClosed::getWhat() const noexcept { return format("XIOClosed", "already closed"); } @@ -33,8 +32,7 @@ // XIOEndOfStream // -String -XIOEndOfStream::getWhat() const throw() +std::string XIOEndOfStream::getWhat() const noexcept { return format("XIOEndOfStream", "reached end of stream"); } @@ -44,8 +42,7 @@ // XIOWouldBlock // -String -XIOWouldBlock::getWhat() const throw() +std::string XIOWouldBlock::getWhat() const noexcept { return format("XIOWouldBlock", "stream operation would block"); } diff -Nru barrier-2.3.2+dfsg/src/lib/ipc/IpcClientProxy.cpp barrier-2.3.3+dfsg/src/lib/ipc/IpcClientProxy.cpp --- barrier-2.3.2+dfsg/src/lib/ipc/IpcClientProxy.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/ipc/IpcClientProxy.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -141,7 +141,7 @@ switch (message.type()) { case kIpcLogLine: { const IpcLogLineMessage& llm = static_cast(message); - const String logLine = llm.logLine(); + const std::string logLine = llm.logLine(); ProtocolUtil::writef(&m_stream, kIpcMsgLogLine, &logLine); break; } @@ -171,7 +171,7 @@ IpcCommandMessage* IpcClientProxy::parseCommand() { - String command; + std::string command; UInt8 elevate; ProtocolUtil::readf(&m_stream, kIpcMsgCommand + 4, &command, &elevate); diff -Nru barrier-2.3.2+dfsg/src/lib/ipc/IpcLogOutputter.cpp barrier-2.3.3+dfsg/src/lib/ipc/IpcLogOutputter.cpp --- barrier-2.3.2+dfsg/src/lib/ipc/IpcLogOutputter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/ipc/IpcLogOutputter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -44,8 +44,8 @@ m_running(false), m_notifyCond(ARCH->newCondVar()), m_notifyMutex(ARCH->newMutex()), - m_bufferThreadId(0), m_bufferWaiting(false), + m_bufferThreadId(0), m_bufferMaxSize(kBufferMaxSize), m_bufferRateWriteLimit(kBufferRateWriteLimit), m_bufferRateTimeLimit(kBufferRateTimeLimit), @@ -109,8 +109,7 @@ return true; } -void -IpcLogOutputter::appendBuffer(const String& text) +void IpcLogOutputter::appendBuffer(const std::string& text) { std::lock_guard lock(m_bufferMutex); @@ -173,8 +172,7 @@ ARCH->broadcastCondVar(m_notifyCond); } -String -IpcLogOutputter::getChunk(size_t count) +std::string IpcLogOutputter::getChunk(size_t count) { std::lock_guard lock(m_bufferMutex); @@ -182,7 +180,7 @@ count = m_buffer.size(); } - String chunk; + std::string chunk; for (size_t i = 0; i < count; i++) { chunk.append(m_buffer.front()); chunk.append("\n"); diff -Nru barrier-2.3.2+dfsg/src/lib/ipc/IpcLogOutputter.h barrier-2.3.3+dfsg/src/lib/ipc/IpcLogOutputter.h --- barrier-2.3.2+dfsg/src/lib/ipc/IpcLogOutputter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/ipc/IpcLogOutputter.h 2020-07-14 17:37:45.000000000 +0000 @@ -21,6 +21,7 @@ #include "arch/Arch.h" #include "arch/IArchMultithread.h" #include "base/ILogOutputter.h" +#include "base/String.h" #include "ipc/Ipc.h" #include @@ -92,12 +93,12 @@ private: void init(); void bufferThread(void*); - String getChunk(size_t count); - void appendBuffer(const String& text); + std::string getChunk(size_t count); + void appendBuffer(const std::string& text); bool isRunning(); private: - typedef std::deque Buffer; + typedef std::deque Buffer; IpcServer& m_ipcServer; Buffer m_buffer; diff -Nru barrier-2.3.2+dfsg/src/lib/ipc/IpcMessage.cpp barrier-2.3.3+dfsg/src/lib/ipc/IpcMessage.cpp --- barrier-2.3.2+dfsg/src/lib/ipc/IpcMessage.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/ipc/IpcMessage.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -47,9 +47,9 @@ { } -IpcLogLineMessage::IpcLogLineMessage(const String& logLine) : -IpcMessage(kIpcLogLine), -m_logLine(logLine) +IpcLogLineMessage::IpcLogLineMessage(const std::string& logLine) : + IpcMessage(kIpcLogLine), + m_logLine(logLine) { } @@ -57,10 +57,10 @@ { } -IpcCommandMessage::IpcCommandMessage(const String& command, bool elevate) : -IpcMessage(kIpcCommand), -m_command(command), -m_elevate(elevate) +IpcCommandMessage::IpcCommandMessage(const std::string& command, bool elevate) : + IpcMessage(kIpcCommand), + m_command(command), + m_elevate(elevate) { } diff -Nru barrier-2.3.2+dfsg/src/lib/ipc/IpcMessage.h barrier-2.3.3+dfsg/src/lib/ipc/IpcMessage.h --- barrier-2.3.2+dfsg/src/lib/ipc/IpcMessage.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/ipc/IpcMessage.h 2020-07-14 17:37:45.000000000 +0000 @@ -20,8 +20,8 @@ #include "ipc/Ipc.h" #include "base/EventTypes.h" -#include "base/String.h" #include "base/Event.h" +#include class IpcMessage : public EventData { public: @@ -58,28 +58,28 @@ class IpcLogLineMessage : public IpcMessage { public: - IpcLogLineMessage(const String& logLine); + IpcLogLineMessage(const std::string& logLine); virtual ~IpcLogLineMessage(); //! Gets the log line. - String logLine() const { return m_logLine; } + std::string logLine() const { return m_logLine; } private: - String m_logLine; + std::string m_logLine; }; class IpcCommandMessage : public IpcMessage { public: - IpcCommandMessage(const String& command, bool elevate); + IpcCommandMessage(const std::string& command, bool elevate); virtual ~IpcCommandMessage(); //! Gets the command. - String command() const { return m_command; } + std::string command() const { return m_command; } //! Gets whether or not the process should be elevated on MS Windows. bool elevate() const { return m_elevate; } private: - String m_command; + std::string m_command; bool m_elevate; }; diff -Nru barrier-2.3.2+dfsg/src/lib/ipc/IpcServerProxy.cpp barrier-2.3.3+dfsg/src/lib/ipc/IpcServerProxy.cpp --- barrier-2.3.2+dfsg/src/lib/ipc/IpcServerProxy.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/ipc/IpcServerProxy.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -94,7 +94,7 @@ case kIpcCommand: { const IpcCommandMessage& cm = static_cast(message); - const String command = cm.command(); + std::string command = cm.command(); ProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command); break; } @@ -108,7 +108,7 @@ IpcLogLineMessage* IpcServerProxy::parseLogLine() { - String logLine; + std::string logLine; ProtocolUtil::readf(&m_stream, kIpcMsgLogLine + 4, &logLine); // must be deleted by event handler. diff -Nru barrier-2.3.2+dfsg/src/lib/mt/XMT.cpp barrier-2.3.3+dfsg/src/lib/mt/XMT.cpp --- barrier-2.3.2+dfsg/src/lib/mt/XMT.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/mt/XMT.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -22,8 +22,7 @@ // XMTThreadUnavailable // -String -XMTThreadUnavailable::getWhat() const throw() +std::string XMTThreadUnavailable::getWhat() const noexcept { return format("XMTThreadUnavailable", "cannot create thread"); } diff -Nru barrier-2.3.2+dfsg/src/lib/net/IDataSocket.h barrier-2.3.3+dfsg/src/lib/net/IDataSocket.h --- barrier-2.3.2+dfsg/src/lib/net/IDataSocket.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/IDataSocket.h 2020-07-14 17:37:45.000000000 +0000 @@ -20,8 +20,8 @@ #include "net/ISocket.h" #include "io/IStream.h" -#include "base/String.h" #include "base/EventTypes.h" +#include //! Data stream socket interface /*! @@ -33,7 +33,7 @@ class ConnectionFailedInfo { public: ConnectionFailedInfo(const char* what) : m_what(what) { } - String m_what; + std::string m_what; }; IDataSocket(IEventQueue* events) { } diff -Nru barrier-2.3.2+dfsg/src/lib/net/NetworkAddress.cpp barrier-2.3.3+dfsg/src/lib/net/NetworkAddress.cpp --- barrier-2.3.2+dfsg/src/lib/net/NetworkAddress.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/NetworkAddress.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -96,7 +96,7 @@ // do nothing } -NetworkAddress::NetworkAddress(const String& hostname, int port) : +NetworkAddress::NetworkAddress(const std::string& hostname, int port) : m_address(NULL), m_hostname(hostname), m_port(port) @@ -196,8 +196,7 @@ return m_port; } -String -NetworkAddress::getHostname() const +std::string NetworkAddress::getHostname() const { return m_hostname; } diff -Nru barrier-2.3.2+dfsg/src/lib/net/NetworkAddress.h barrier-2.3.3+dfsg/src/lib/net/NetworkAddress.h --- barrier-2.3.2+dfsg/src/lib/net/NetworkAddress.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/NetworkAddress.h 2020-07-14 17:37:45.000000000 +0000 @@ -18,7 +18,6 @@ #pragma once -#include "base/String.h" #include "base/EventTypes.h" #include "arch/IArchNetwork.h" @@ -49,7 +48,7 @@ is thrown with an error of \c XSocketAddress::kBadPort. The hostname is not resolved by the c'tor; use \c resolve to do that. */ - NetworkAddress(const String& hostname, int port); + NetworkAddress(const std::string& hostname, int port); NetworkAddress(const NetworkAddress&); @@ -109,7 +108,7 @@ /*! Returns the hostname passed to the c'tor sans any port suffix. */ - String getHostname() const; + std::string getHostname() const; //@} @@ -118,6 +117,6 @@ private: ArchNetAddress m_address; - String m_hostname; + std::string m_hostname; int m_port; }; diff -Nru barrier-2.3.2+dfsg/src/lib/net/SecureListenSocket.cpp barrier-2.3.3+dfsg/src/lib/net/SecureListenSocket.cpp --- barrier-2.3.2+dfsg/src/lib/net/SecureListenSocket.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/SecureListenSocket.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -23,6 +23,7 @@ #include "net/TSocketMultiplexerMethodJob.h" #include "arch/XArch.h" #include "common/DataDirectories.h" +#include "base/String.h" static const char s_certificateDir[] = { "SSL" }; static const char s_certificateFilename[] = { "Barrier.pem" }; @@ -54,7 +55,7 @@ setListeningJob(); } - String certificateFilename = barrier::string::sprintf("%s/%s/%s", + std::string certificateFilename = barrier::string::sprintf("%s/%s/%s", DataDirectories::profile().c_str(), s_certificateDir, s_certificateFilename); diff -Nru barrier-2.3.2+dfsg/src/lib/net/SecureSocket.cpp barrier-2.3.3+dfsg/src/lib/net/SecureSocket.cpp --- barrier-2.3.2+dfsg/src/lib/net/SecureSocket.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/SecureSocket.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -23,6 +23,7 @@ #include "mt/Lock.h" #include "arch/XArch.h" #include "base/Log.h" +#include "base/String.h" #include "common/DataDirectories.h" #include @@ -328,8 +329,7 @@ initContext(server); } -bool -SecureSocket::loadCertificates(String& filename) +bool SecureSocket::loadCertificates(std::string& filename) { if (filename.empty()) { showError("ssl certificate is not specified"); @@ -341,7 +341,7 @@ file.close(); if (!exist) { - String errorMsg("ssl certificate doesn't exist: "); + std::string errorMsg("ssl certificate doesn't exist: "); errorMsg.append(filename); showError(errorMsg.c_str()); return false; @@ -630,14 +630,13 @@ LOG((CLOG_ERR "%s", reason)); } - String error = getError(); + std::string error = getError(); if (!error.empty()) { LOG((CLOG_ERR "%s", error.c_str())); } } -String -SecureSocket::getError() +std::string SecureSocket::getError() { unsigned long e = ERR_get_error(); @@ -659,8 +658,7 @@ sendEvent(getEvents()->forIStream().inputShutdown()); } -void -SecureSocket::formatFingerprint(String& fingerprint, bool hex, bool separator) +void SecureSocket::formatFingerprint(std::string& fingerprint, bool hex, bool separator) { if (hex) { // to hexidecimal @@ -696,11 +694,11 @@ } // format fingerprint into hexdecimal format with colon separator - String fingerprint(reinterpret_cast(tempFingerprint), tempFingerprintLen); + std::string fingerprint(reinterpret_cast(tempFingerprint), tempFingerprintLen); formatFingerprint(fingerprint); LOG((CLOG_NOTE "server fingerprint: %s", fingerprint.c_str())); - String trustedServersFilename; + std::string trustedServersFilename; trustedServersFilename = barrier::string::sprintf( "%s/%s/%s", DataDirectories::profile().c_str(), @@ -711,7 +709,7 @@ LOG((CLOG_NOTE "trustedServersFilename: %s", trustedServersFilename.c_str() )); // check if this fingerprint exist - String fileLine; + std::string fileLine; std::ifstream file; file.open(trustedServersFilename.c_str()); @@ -761,7 +759,7 @@ // If status > 0, success if (status > 0) { sendEvent(m_events->forIDataSocket().secureConnected()); - return {true, newJob()}; + return newJobOrStopServicing(); } // Retry case @@ -793,7 +791,7 @@ // If status > 0, success if (status > 0) { sendEvent(m_events->forClientListener().accepted()); - return {true, newJob()}; + return newJobOrStopServicing(); } // Retry case diff -Nru barrier-2.3.2+dfsg/src/lib/net/SecureSocket.h barrier-2.3.3+dfsg/src/lib/net/SecureSocket.h --- barrier-2.3.2+dfsg/src/lib/net/SecureSocket.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/SecureSocket.h 2020-07-14 17:37:45.000000000 +0000 @@ -39,23 +39,23 @@ ~SecureSocket(); // ISocket overrides - void close(); + void close() override; // IDataSocket overrides - virtual void connect(const NetworkAddress&); + virtual void connect(const NetworkAddress&) override; std::unique_ptr newJob() override; - bool isFatal() const { return m_fatal; } + bool isFatal() const override { return m_fatal; } void isFatal(bool b) { m_fatal = b; } bool isSecureReady(); void secureConnect(); void secureAccept(); int secureRead(void* buffer, int size, int& read); int secureWrite(const void* buffer, int size, int& wrote); - EJobResult doRead(); - EJobResult doWrite(); + EJobResult doRead() override; + EJobResult doWrite() override; void initSsl(bool server); - bool loadCertificates(String& CertFile); + bool loadCertificates(std::string& CertFile); private: // SSL @@ -66,11 +66,9 @@ bool showCertificate(); void checkResult(int n, int& retry); void showError(const char* reason = NULL); - String getError(); + std::string getError(); void disconnect(); - void formatFingerprint(String& fingerprint, - bool hex = true, - bool separator = true); + void formatFingerprint(std::string& fingerprint, bool hex = true, bool separator = true); bool verifyCertFingerprint(); MultiplexerJobStatus serviceConnect(ISocketMultiplexerJob*, bool, bool, bool); diff -Nru barrier-2.3.2+dfsg/src/lib/net/TCPSocket.cpp barrier-2.3.3+dfsg/src/lib/net/TCPSocket.cpp --- barrier-2.3.2+dfsg/src/lib/net/TCPSocket.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/TCPSocket.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -403,6 +403,15 @@ } } +MultiplexerJobStatus TCPSocket::newJobOrStopServicing() +{ + auto new_job = newJob(); + if (new_job) + return {true, std::move(new_job)}; + else + return {false, {}}; +} + std::unique_ptr TCPSocket::newJob() { // note -- must have m_mutex locked on entry @@ -519,22 +528,14 @@ catch (XArchNetwork& e) { sendConnectionFailedEvent(e.what()); onDisconnected(); - auto new_job = newJob(); - if (new_job) - return {true, std::move(new_job)}; - else - return {false, {}}; + return newJobOrStopServicing(); } } if (write) { sendEvent(m_events->forIDataSocket().connected()); onConnected(); - auto new_job = newJob(); - if (new_job) - return {true, std::move(new_job)}; - else - return {false, {}}; + return newJobOrStopServicing(); } return {true, {}}; @@ -548,7 +549,7 @@ if (error) { sendEvent(m_events->forISocket().disconnected()); onDisconnected(); - return {true, newJob()}; + return newJobOrStopServicing(); } EJobResult writeResult = kRetry; @@ -603,7 +604,7 @@ if (writeResult == kBreak || readResult == kBreak) { return {false, {}}; } else if (writeResult == kNew || readResult == kNew) { - return {true, newJob()}; + return newJobOrStopServicing(); } else { return {true, {}}; } diff -Nru barrier-2.3.2+dfsg/src/lib/net/TCPSocket.h barrier-2.3.3+dfsg/src/lib/net/TCPSocket.h --- barrier-2.3.2+dfsg/src/lib/net/TCPSocket.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/TCPSocket.h 2020-07-14 17:37:45.000000000 +0000 @@ -76,7 +76,8 @@ void removeJob(); void setJob(std::unique_ptr&& job); - + MultiplexerJobStatus newJobOrStopServicing(); + bool isReadable() { return m_readable; } bool isWritable() { return m_writable; } diff -Nru barrier-2.3.2+dfsg/src/lib/net/XSocket.cpp barrier-2.3.3+dfsg/src/lib/net/XSocket.cpp --- barrier-2.3.2+dfsg/src/lib/net/XSocket.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/XSocket.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -23,8 +23,7 @@ // XSocketAddress // -XSocketAddress::XSocketAddress(EError error, - const String& hostname, int port) _NOEXCEPT : +XSocketAddress::XSocketAddress(EError error, const std::string& hostname, int port) noexcept : m_error(error), m_hostname(hostname), m_port(port) @@ -32,26 +31,22 @@ // do nothing } -XSocketAddress::EError -XSocketAddress::getError() const throw() +XSocketAddress::EError XSocketAddress::getError() const noexcept { return m_error; } -String -XSocketAddress::getHostname() const throw() +std::string XSocketAddress::getHostname() const noexcept { return m_hostname; } -int -XSocketAddress::getPort() const throw() +int XSocketAddress::getPort() const noexcept { return m_port; } -String -XSocketAddress::getWhat() const throw() +std::string XSocketAddress::getWhat() const noexcept { static const char* s_errorID[] = { "XSocketAddressUnknown", @@ -77,8 +72,7 @@ // XSocketIOClose // -String -XSocketIOClose::getWhat() const throw() +std::string XSocketIOClose::getWhat() const noexcept { return format("XSocketIOClose", "close: %{1}", what()); } @@ -88,8 +82,7 @@ // XSocketBind // -String -XSocketBind::getWhat() const throw() +std::string XSocketBind::getWhat() const noexcept { return format("XSocketBind", "cannot bind address: %{1}", what()); } @@ -99,8 +92,7 @@ // XSocketConnect // -String -XSocketConnect::getWhat() const throw() +std::string XSocketConnect::getWhat() const noexcept { return format("XSocketConnect", "cannot connect socket: %{1}", what()); } @@ -110,8 +102,7 @@ // XSocketCreate // -String -XSocketCreate::getWhat() const throw() +std::string XSocketCreate::getWhat() const noexcept { return format("XSocketCreate", "cannot create socket: %{1}", what()); } diff -Nru barrier-2.3.2+dfsg/src/lib/net/XSocket.h barrier-2.3.3+dfsg/src/lib/net/XSocket.h --- barrier-2.3.2+dfsg/src/lib/net/XSocket.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/net/XSocket.h 2020-07-14 17:37:45.000000000 +0000 @@ -20,7 +20,6 @@ #include "io/XIO.h" #include "base/XBase.h" -#include "base/String.h" #include "common/basic_types.h" //! Generic socket exception @@ -41,28 +40,28 @@ kBadPort //!< The port is invalid }; - XSocketAddress(EError, const String& hostname, int port) _NOEXCEPT; - virtual ~XSocketAddress() _NOEXCEPT { } + XSocketAddress(EError, const std::string& hostname, int port) noexcept; + virtual ~XSocketAddress() noexcept { } //! @name accessors //@{ //! Get the error code - EError getError() const throw(); + EError getError() const noexcept; //! Get the hostname - String getHostname() const throw(); + std::string getHostname() const noexcept; //! Get the port - int getPort() const throw(); + int getPort() const noexcept; //@} protected: // XBase overrides - virtual String getWhat() const throw(); + virtual std::string getWhat() const noexcept; private: EError m_error; - String m_hostname; + std::string m_hostname; int m_port; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -38,11 +38,10 @@ return IClipboard::kText; } -HANDLE -MSWindowsClipboardAnyTextConverter::fromIClipboard(const String& data) const +HANDLE MSWindowsClipboardAnyTextConverter::fromIClipboard(const std::string& data) const { // convert linefeeds and then convert to desired encoding - String text = doFromIClipboard(convertLinefeedToWin32(data)); + std::string text = doFromIClipboard(convertLinefeedToWin32(data)); UInt32 size = (UInt32)text.size(); // copy to memory handle @@ -63,18 +62,17 @@ return gData; } -String -MSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const +std::string MSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const { // get datator const char* src = (const char*)GlobalLock(data); UInt32 srcSize = (UInt32)GlobalSize(data); if (src == NULL || srcSize <= 1) { - return String(); + return {}; } // convert text - String text = doToIClipboard(String(src, srcSize)); + std::string text = doToIClipboard(std::string(src, srcSize)); // release handle GlobalUnlock(data); @@ -83,9 +81,7 @@ return convertLinefeedToUnix(text); } -String -MSWindowsClipboardAnyTextConverter::convertLinefeedToWin32( - const String& src) const +std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToWin32(const std::string& src) const { // note -- we assume src is a valid UTF-8 string @@ -102,7 +98,7 @@ } // allocate new string - String dst; + std::string dst; dst.reserve(src.size() + numNewlines); // copy string, converting newlines @@ -117,9 +113,7 @@ return dst; } -String -MSWindowsClipboardAnyTextConverter::convertLinefeedToUnix( - const String& src) const +std::string MSWindowsClipboardAnyTextConverter::convertLinefeedToUnix(const std::string& src) const { // count newlines in string UInt32 numNewlines = 0; @@ -134,7 +128,7 @@ } // allocate new string - String dst; + std::string dst; dst.reserve(src.size()); // copy string, converting newlines diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardAnyTextConverter.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardAnyTextConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardAnyTextConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardAnyTextConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -31,8 +31,8 @@ virtual IClipboard::EFormat getFormat() const; virtual UINT getWin32Format() const = 0; - virtual HANDLE fromIClipboard(const String&) const; - virtual String toIClipboard(HANDLE) const; + virtual HANDLE fromIClipboard(const std::string&) const; + virtual std::string toIClipboard(HANDLE) const; protected: //! Convert from IClipboard format @@ -40,18 +40,18 @@ Do UTF-8 conversion only. Memory handle allocation and linefeed conversion is done by this class. doFromIClipboard() must include the nul terminator in the returned string (not - including the String's nul terminator). + including the std::string's nul terminator). */ - virtual String doFromIClipboard(const String&) const = 0; + virtual std::string doFromIClipboard(const std::string&) const = 0; //! Convert to IClipboard format /*! Do UTF-8 conversion only. Memory handle allocation and linefeed conversion is done by this class. */ - virtual String doToIClipboard(const String&) const = 0; + virtual std::string doToIClipboard(const std::string&) const = 0; private: - String convertLinefeedToWin32(const String&) const; - String convertLinefeedToUnix(const String&) const; + std::string convertLinefeedToWin32(const std::string&) const; + std::string convertLinefeedToUnix(const std::string&) const; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -46,8 +46,7 @@ return CF_DIB; } -HANDLE -MSWindowsClipboardBitmapConverter::fromIClipboard(const String& data) const +HANDLE MSWindowsClipboardBitmapConverter::fromIClipboard(const std::string& data) const { // copy to memory handle HGLOBAL gData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, data.size()); @@ -67,13 +66,12 @@ return gData; } -String -MSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const +std::string MSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const { // get datator LPVOID src = GlobalLock(data); if (src == NULL) { - return String(); + return {}; } UInt32 srcSize = (UInt32)GlobalSize(data); @@ -85,7 +83,7 @@ bitmap->bmiHeader.biBitCount == 32) && bitmap->bmiHeader.biCompression == BI_RGB) { // already in canonical form - String image(static_cast(src), srcSize); + std::string image(static_cast(src), srcSize); GlobalUnlock(data); return image; } @@ -138,7 +136,7 @@ GdiFlush(); // extract data - String image((const char*)&info, info.biSize); + std::string image((const char*)&info, info.biSize); image.append((const char*)raw, 4 * w * h); // clean up GDI diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardBitmapConverter.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardBitmapConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardBitmapConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardBitmapConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -31,6 +31,6 @@ virtual IClipboard::EFormat getFormat() const; virtual UINT getWin32Format() const; - virtual HANDLE fromIClipboard(const String&) const; - virtual String toIClipboard(HANDLE) const; + virtual HANDLE fromIClipboard(const std::string&) const; + virtual std::string toIClipboard(HANDLE) const; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboard.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboard.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboard.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboard.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -98,7 +98,7 @@ } void -MSWindowsClipboard::add(EFormat format, const String& data) +MSWindowsClipboard::add(EFormat format, const std::string& data) { LOG((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format)); @@ -165,8 +165,7 @@ return false; } -String -MSWindowsClipboard::get(EFormat format) const +std::string MSWindowsClipboard::get(EFormat format) const { // find the converter for the first clipboard format we can handle IMSWindowsClipboardConverter* converter = NULL; @@ -183,7 +182,7 @@ // if no converter then we don't recognize any formats if (converter == NULL) { LOG((CLOG_WARN "no converter for format %d", format)); - return String(); + return {}; } // get a handle to the clipboard data @@ -192,7 +191,7 @@ // nb: can't cause this using integ tests; this is only caused when // the selected converter returns an invalid format -- which you // cannot cause using public functions. - return String(); + return {}; } // convert diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboard.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboard.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboard.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboard.h 2020-07-14 17:37:45.000000000 +0000 @@ -55,21 +55,21 @@ // IClipboard overrides virtual bool empty(); - virtual void add(EFormat, const String& data); + virtual void add(EFormat, const std::string& data); virtual bool open(Time) const; virtual void close() const; virtual Time getTime() const; virtual bool has(EFormat) const; - virtual String get(EFormat) const; + virtual std::string get(EFormat) const; void setFacade(IMSWindowsClipboardFacade& facade); private: void clearConverters(); - UINT convertFormatToWin32(EFormat) const; - HANDLE convertTextToWin32(const String& data) const; - String convertTextFromWin32(HANDLE) const; + UINT convertFormatToWin32(EFormat) const; + HANDLE convertTextToWin32(const std::string& data) const; + std::string convertTextFromWin32(HANDLE) const; static UINT getOwnershipFormat(); @@ -105,9 +105,9 @@ // the input data must be in the IClipboard format returned by // getFormat(). the return data will be in the win32 clipboard // format returned by getWin32Format(), allocated by GlobalAlloc(). - virtual HANDLE fromIClipboard(const String&) const = 0; + virtual HANDLE fromIClipboard(const std::string&) const = 0; // convert from the win32 clipboard format to the IClipboard format // (i.e., the reverse of fromIClipboard()). - virtual String toIClipboard(HANDLE data) const = 0; + virtual std::string toIClipboard(HANDLE data) const = 0; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -46,15 +46,14 @@ return m_format; } -String -MSWindowsClipboardHTMLConverter::doFromIClipboard(const String& data) const +std::string MSWindowsClipboardHTMLConverter::doFromIClipboard(const std::string& data) const { // prepare to CF_HTML format prefix and suffix - String prefix("Version:0.9\r\nStartHTML:0000000105\r\n" + std::string prefix("Version:0.9\r\nStartHTML:0000000105\r\n" "EndHTML:ZZZZZZZZZZ\r\n" "StartFragment:XXXXXXXXXX\r\nEndFragment:YYYYYYYYYY\r\n" ""); - String suffix("\r\n"); + std::string suffix("\r\n"); // Get byte offsets for header UInt32 StartFragment = (UInt32)prefix.size(); @@ -75,45 +74,43 @@ return prefix; } -String -MSWindowsClipboardHTMLConverter::doToIClipboard(const String& data) const +std::string MSWindowsClipboardHTMLConverter::doToIClipboard(const std::string& data) const { // get fragment start/end args - String startArg = findArg(data, "StartFragment"); - String endArg = findArg(data, "EndFragment"); + std::string startArg = findArg(data, "StartFragment"); + std::string endArg = findArg(data, "EndFragment"); if (startArg.empty() || endArg.empty()) { - return String(); + return std::string(); } // convert args to integers SInt32 start = (SInt32)atoi(startArg.c_str()); SInt32 end = (SInt32)atoi(endArg.c_str()); if (start <= 0 || end <= 0 || start >= end) { - return String(); + return std::string(); } // extract the fragment return data.substr(start, end - start); } -String -MSWindowsClipboardHTMLConverter::findArg( - const String& data, const String& name) const +std::string MSWindowsClipboardHTMLConverter::findArg(const std::string& data, + const std::string& name) const { - String::size_type i = data.find(name); - if (i == String::npos) { - return String(); + std::string::size_type i = data.find(name); + if (i == std::string::npos) { + return std::string(); } i = data.find_first_of(":\r\n", i); - if (i == String::npos || data[i] != ':') { - return String(); + if (i == std::string::npos || data[i] != ':') { + return std::string(); } i = data.find_first_of("0123456789\r\n", i + 1); - if (i == String::npos || data[i] == '\r' || data[i] == '\n') { - return String(); + if (i == std::string::npos || data[i] == '\r' || data[i] == '\n') { + return std::string(); } - String::size_type j = data.find_first_not_of("0123456789", i); - if (j == String::npos) { + std::string::size_type j = data.find_first_not_of("0123456789", i); + if (j == std::string::npos) { j = data.size(); } return data.substr(i, j - i); diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardHTMLConverter.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardHTMLConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardHTMLConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardHTMLConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -34,11 +34,11 @@ protected: // MSWindowsClipboardAnyTextConverter overrides - virtual String doFromIClipboard(const String&) const; - virtual String doToIClipboard(const String&) const; + virtual std::string doFromIClipboard(const std::string&) const; + virtual std::string doToIClipboard(const std::string&) const; private: - String findArg(const String& data, const String& name) const; + std::string findArg(const std::string& data, const std::string& name) const; private: UINT m_format; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardTextConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardTextConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardTextConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardTextConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -40,20 +40,18 @@ return CF_TEXT; } -String -MSWindowsClipboardTextConverter::doFromIClipboard(const String& data) const +std::string MSWindowsClipboardTextConverter::doFromIClipboard(const std::string& data) const { // convert and add nul terminator return Unicode::UTF8ToText(data) += '\0'; } -String -MSWindowsClipboardTextConverter::doToIClipboard(const String& data) const +std::string MSWindowsClipboardTextConverter::doToIClipboard(const std::string& data) const { // convert and truncate at first nul terminator - String dst = Unicode::textToUTF8(data); - String::size_type n = dst.find('\0'); - if (n != String::npos) { + std::string dst = Unicode::textToUTF8(data); + std::string::size_type n = dst.find('\0'); + if (n != std::string::npos) { dst.erase(n); } return dst; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardTextConverter.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardTextConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardTextConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardTextConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -32,6 +32,6 @@ protected: // MSWindowsClipboardAnyTextConverter overrides - virtual String doFromIClipboard(const String&) const; - virtual String doToIClipboard(const String&) const; + virtual std::string doFromIClipboard(const std::string&) const; + virtual std::string doToIClipboard(const std::string&) const; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -40,20 +40,18 @@ return CF_UNICODETEXT; } -String -MSWindowsClipboardUTF16Converter::doFromIClipboard(const String& data) const +std::string MSWindowsClipboardUTF16Converter::doFromIClipboard(const std::string& data) const { // convert and add nul terminator return Unicode::UTF8ToUTF16(data).append(sizeof(wchar_t), 0); } -String -MSWindowsClipboardUTF16Converter::doToIClipboard(const String& data) const +std::string MSWindowsClipboardUTF16Converter::doToIClipboard(const std::string& data) const { // convert and strip nul terminator - String dst = Unicode::UTF16ToUTF8(data); - String::size_type n = dst.find('\0'); - if (n != String::npos) { + std::string dst = Unicode::UTF16ToUTF8(data); + std::string::size_type n = dst.find('\0'); + if (n != std::string::npos) { dst.erase(n); } return dst; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardUTF16Converter.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardUTF16Converter.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsClipboardUTF16Converter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsClipboardUTF16Converter.h 2020-07-14 17:37:45.000000000 +0000 @@ -32,6 +32,6 @@ protected: // MSWindowsClipboardAnyTextConverter overrides - virtual String doFromIClipboard(const String&) const; - virtual String doToIClipboard(const String&) const; + virtual std::string doFromIClipboard(const std::string&) const; + virtual std::string doToIClipboard(const std::string&) const; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsDesks.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsDesks.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsDesks.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsDesks.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -746,8 +746,7 @@ } } -MSWindowsDesks::Desk* -MSWindowsDesks::addDesk(const String& name, HDESK hdesk) +MSWindowsDesks::Desk* MSWindowsDesks::addDesk(const std::string& name, HDESK hdesk) { Desk* desk = new Desk; desk->m_name = name; @@ -782,7 +781,7 @@ // get current desktop. if we already know about it then return. Desk* desk; HDESK hdesk = openInputDesktop(); - String name = getDesktopName(hdesk); + std::string name = getDesktopName(hdesk); Desks::const_iterator index = m_desks.find(name); if (index == m_desks.end()) { desk = addDesk(name, hdesk); @@ -900,18 +899,17 @@ } } -String -MSWindowsDesks::getDesktopName(HDESK desk) +std::string MSWindowsDesks::getDesktopName(HDESK desk) { if (desk == NULL) { - return String(); + return {}; } else { DWORD size; GetUserObjectInformation(desk, UOI_NAME, NULL, 0, &size); TCHAR* name = (TCHAR*)alloca(size + sizeof(TCHAR)); GetUserObjectInformation(desk, UOI_NAME, name, size, &size); - String result(name); + std::string result(name); return result; } } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsDesks.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsDesks.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsDesks.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsDesks.h 2020-07-14 17:37:45.000000000 +0000 @@ -25,8 +25,8 @@ #include "barrier/option_types.h" #include "mt/CondVar.h" #include "mt/Mutex.h" -#include "base/String.h" #include "common/stdmap.h" +#include #define WIN32_LEAN_AND_MEAN #include @@ -195,7 +195,7 @@ private: class Desk { public: - String m_name; + std::string m_name; Thread* m_thread; DWORD m_threadID; DWORD m_targetID; @@ -204,7 +204,7 @@ HWND m_foregroundWindow; bool m_lowLevel; }; - typedef std::map Desks; + typedef std::map Desks; // initialization and shutdown operations HCURSOR createBlankCursor() const; @@ -222,7 +222,7 @@ void deskThread(void* vdesk); // desk switch checking and handling - Desk* addDesk(const String& name, HDESK hdesk); + Desk* addDesk(const std::string& name, HDESK hdesk); void removeDesks(); void checkDesk(); bool isDeskAccessible(const Desk* desk) const; @@ -238,7 +238,7 @@ // desk API wrappers HDESK openInputDesktop(); void closeDesktop(HDESK); - String getDesktopName(HDESK); + std::string getDesktopName(HDESK); // our desk window procs static LRESULT CALLBACK primaryDeskProc(HWND, UINT, WPARAM, LPARAM); @@ -276,7 +276,7 @@ // the current desk and it's name Desk* m_activeDesk; - String m_activeDeskName; + std::string m_activeDeskName; // one desk per desktop and a cond var to communicate with it Mutex m_mutex; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsEventQueueBuffer.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsEventQueueBuffer.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsEventQueueBuffer.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsEventQueueBuffer.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -21,6 +21,7 @@ #include "arch/win32/ArchMiscWindows.h" #include "mt/Thread.h" #include "base/IEventQueue.h" +#include // // EventQueueTimer @@ -48,6 +49,15 @@ // make sure this thread has a message queue MSG dummy; PeekMessage(&dummy, NULL, WM_USER, WM_USER, PM_NOREMOVE); + + m_os_supported_message_types = QS_ALLINPUT; + if (!IsWindows8OrGreater()) + { + // don't use QS_POINTER, QS_TOUCH + // because they can cause GetQueueStatus() to always return 0 and we miss events + // since those flags are confusing Windows 7. See QTBUG-29097 for related info + m_os_supported_message_types &= ~(QS_TOUCH | QS_POINTER); + } } MSWindowsEventQueueBuffer::~MSWindowsEventQueueBuffer() @@ -79,7 +89,7 @@ // cancellation but that's okay because we're run in the main // thread and we never cancel that thread. HANDLE dummy[1]; - MsgWaitForMultipleObjects(0, dummy, FALSE, t, QS_ALLINPUT); + MsgWaitForMultipleObjects(0, dummy, FALSE, t, m_os_supported_message_types); } IEventQueueBuffer::Type @@ -128,9 +138,7 @@ bool MSWindowsEventQueueBuffer::isEmpty() const { - // don't use QS_POINTER, QS_TOUCH, or any meta-flags that include them (like QS_ALLINPUT) - // because they can cause GetQueueStatus() to always return 0 and we miss events - return (HIWORD(GetQueueStatus(QS_POSTMESSAGE)) == 0); + return (HIWORD(GetQueueStatus(m_os_supported_message_types)) == 0); } EventQueueTimer* diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsEventQueueBuffer.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsEventQueueBuffer.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsEventQueueBuffer.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsEventQueueBuffer.h 2020-07-14 17:37:45.000000000 +0000 @@ -47,4 +47,5 @@ MSG m_event; UINT m_daemonQuit; IEventQueue* m_events; + UINT m_os_supported_message_types; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsKeyState.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsKeyState.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsKeyState.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsKeyState.h 2020-07-14 17:37:45.000000000 +0000 @@ -19,7 +19,6 @@ #pragma once #include "barrier/KeyState.h" -#include "base/String.h" #include "common/stdvector.h" #define WIN32_LEAN_AND_MEAN diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsScreen.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsScreen.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsScreen.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsScreen.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -38,7 +38,6 @@ #include "arch/Arch.h" #include "base/FunctionJob.h" #include "base/Log.h" -#include "base/String.h" #include "base/IEventQueue.h" #include "base/TMethodEventJob.h" #include "base/TMethodJob.h" @@ -150,7 +149,7 @@ // SHGetFolderPath is deprecated in vista, but use it for xp support. char desktopPath[MAX_PATH]; if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktopPath))) { - m_desktopPath = String(desktopPath); + m_desktopPath = std::string(desktopPath); LOG((CLOG_DEBUG "using desktop for drop target: %s", m_desktopPath.c_str())); } else { @@ -378,7 +377,7 @@ void MSWindowsScreen::sendDragThread(void*) { - String& draggingFilename = getDraggingFilename(); + std::string& draggingFilename = getDraggingFilename(); size_t size = draggingFilename.size(); if (draggingFilename.empty() == false) { @@ -1867,8 +1866,7 @@ // exception from being thrown. } -String& -MSWindowsScreen::getDraggingFilename() +std::string& MSWindowsScreen::getDraggingFilename() { if (m_draggingStarted) { m_dropTarget->clearDraggingFilename(); @@ -1894,7 +1892,7 @@ fakeKeyUp(1); fakeMouseButton(kButtonLeft, false); - String filename; + std::string filename; DOUBLE timeout = ARCH->time() + .5f; while (ARCH->time() < timeout) { ARCH->sleep(.05f); @@ -1923,8 +1921,7 @@ return m_draggingFilename; } -const String& -MSWindowsScreen::getDropTarget() const +const std::string& MSWindowsScreen::getDropTarget() const { return m_desktopPath; } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsScreen.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsScreen.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsScreen.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsScreen.h 2020-07-14 17:37:45.000000000 +0000 @@ -25,7 +25,7 @@ #include "platform/synwinhk.h" #include "mt/CondVar.h" #include "mt/Mutex.h" -#include "base/String.h" +#include #define WIN32_LEAN_AND_MEAN #include @@ -118,9 +118,8 @@ virtual void setSequenceNumber(UInt32); virtual bool isPrimary() const; virtual void fakeDraggingFiles(DragFileList fileList); - virtual String& getDraggingFilename(); - virtual const String& - getDropTarget() const; + virtual std::string& getDraggingFilename(); + virtual const std::string& getDropTarget() const; protected: // IPlatformScreen overrides @@ -333,7 +332,7 @@ IEventQueue* m_events; - String m_desktopPath; + std::string m_desktopPath; MSWindowsDropTarget* m_dropTarget; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsScreenSaver.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsScreenSaver.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsScreenSaver.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsScreenSaver.h 2020-07-14 17:37:45.000000000 +0000 @@ -19,7 +19,6 @@ #pragma once #include "barrier/IScreenSaver.h" -#include "base/String.h" #define WIN32_LEAN_AND_MEAN #include diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsSession.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsSession.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsSession.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsSession.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -172,10 +172,9 @@ return gotEntry; } -String -MSWindowsSession::getActiveDesktopName() +std::string MSWindowsSession::getActiveDesktopName() { - String result; + std::string result; try { HDESK hd = OpenInputDesktop(0, TRUE, GENERIC_READ); if (hd != NULL) { diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsSession.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsSession.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsSession.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsSession.h 2020-07-14 17:37:45.000000000 +0000 @@ -17,7 +17,7 @@ #pragma once -#include "base/String.h" +#include #define WIN32_LEAN_AND_MEAN #include @@ -42,7 +42,7 @@ void updateActiveSession(); - String getActiveDesktopName(); + std::string getActiveDesktopName(); private: BOOL nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry); diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsUtil.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsUtil.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsUtil.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsUtil.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -18,29 +18,26 @@ #include "platform/MSWindowsUtil.h" -#include "base/String.h" - #include +#include "base/String.h" // // MSWindowsUtil // -String -MSWindowsUtil::getString(HINSTANCE instance, DWORD id) +std::string MSWindowsUtil::getString(HINSTANCE instance, DWORD id) { char* msg = NULL; int n = LoadString(instance, id, reinterpret_cast(&msg), 0); if (n <= 0) { - return String(); + return {}; } - return String (msg, n); + return std::string (msg, n); } -String -MSWindowsUtil::getErrorString(HINSTANCE hinstance, DWORD error, DWORD id) +std::string MSWindowsUtil::getErrorString(HINSTANCE hinstance, DWORD error, DWORD id) { char* buffer; if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | @@ -52,12 +49,12 @@ (LPTSTR)&buffer, 0, NULL) == 0) { - String errorString = barrier::string::sprintf("%d", error); + std::string errorString = barrier::string::sprintf("%d", error); return barrier::string::format(getString(hinstance, id).c_str(), errorString.c_str()); } else { - String result(buffer); + std::string result(buffer); LocalFree(buffer); return result; } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsUtil.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsUtil.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsUtil.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsUtil.h 2020-07-14 17:37:45.000000000 +0000 @@ -18,7 +18,7 @@ #pragma once -#include "base/String.h" +#include #define WINDOWS_LEAN_AND_MEAN #include @@ -29,14 +29,14 @@ /*! Gets a string for \p id from the string table of \p instance. */ - static String getString(HINSTANCE instance, DWORD id); + static std::string getString(HINSTANCE instance, DWORD id); //! Get error string /*! Gets a system error message for \p error. If the error cannot be found return the string for \p id, replacing ${1} with \p error. */ - static String getErrorString(HINSTANCE, DWORD error, DWORD id); + static std::string getErrorString(HINSTANCE, DWORD error, DWORD id); //! Create directory /*! diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsWatchdog.cpp barrier-2.3.3+dfsg/src/lib/platform/MSWindowsWatchdog.cpp --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsWatchdog.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsWatchdog.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -327,8 +327,7 @@ } } -BOOL -MSWindowsWatchdog::doStartProcessAsSelf(String& command) +BOOL MSWindowsWatchdog::doStartProcessAsSelf(std::string& command) { DWORD creationFlags = NORMAL_PRIORITY_CLASS | @@ -347,8 +346,8 @@ return CreateProcess(NULL, LPSTR(command.c_str()), NULL, NULL, FALSE, creationFlags, NULL, NULL, &si, &m_processInfo); } -BOOL -MSWindowsWatchdog::doStartProcessAsUser(String& command, HANDLE userToken, LPSECURITY_ATTRIBUTES sa) +BOOL MSWindowsWatchdog::doStartProcessAsUser(std::string& command, HANDLE userToken, + LPSECURITY_ATTRIBUTES sa) { // clear, as we're reusing process info struct ZeroMemory(&m_processInfo, sizeof(PROCESS_INFORMATION)); diff -Nru barrier-2.3.2+dfsg/src/lib/platform/MSWindowsWatchdog.h barrier-2.3.3+dfsg/src/lib/platform/MSWindowsWatchdog.h --- barrier-2.3.2+dfsg/src/lib/platform/MSWindowsWatchdog.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/MSWindowsWatchdog.h 2020-07-14 17:37:45.000000000 +0000 @@ -55,8 +55,8 @@ HANDLE duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security); HANDLE getUserToken(LPSECURITY_ATTRIBUTES security); void startProcess(); - BOOL doStartProcessAsUser(String& command, HANDLE userToken, LPSECURITY_ATTRIBUTES sa); - BOOL doStartProcessAsSelf(String& command); + BOOL doStartProcessAsUser(std::string& command, HANDLE userToken, LPSECURITY_ATTRIBUTES sa); + BOOL doStartProcessAsSelf(std::string& command); private: Thread* m_thread; @@ -85,8 +85,8 @@ */ class XMSWindowsWatchdogError : public XBarrier { public: - XMSWindowsWatchdogError(const String& msg) : XBarrier(msg) { } + XMSWindowsWatchdogError(const std::string& msg) : XBarrier(msg) { } // XBase overrides - virtual String getWhat() const throw() { return what(); } + virtual std::string getWhat() const noexcept { return what(); } }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardAnyBitmapConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardAnyBitmapConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardAnyBitmapConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardAnyBitmapConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -35,14 +35,12 @@ return IClipboard::kBitmap; } -String -OSXClipboardAnyBitmapConverter::fromIClipboard(const String& data) const +std::string OSXClipboardAnyBitmapConverter::fromIClipboard(const std::string& data) const { return doFromIClipboard(data); } -String -OSXClipboardAnyBitmapConverter::toIClipboard(const String& data) const +std::string OSXClipboardAnyBitmapConverter::toIClipboard(const std::string& data) const { return doToIClipboard(data); } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardAnyBitmapConverter.h barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardAnyBitmapConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardAnyBitmapConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardAnyBitmapConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -30,19 +30,19 @@ virtual IClipboard::EFormat getFormat() const; virtual CFStringRef getOSXFormat() const = 0; - virtual String fromIClipboard(const String &) const; - virtual String toIClipboard(const String &) const; + virtual std::string fromIClipboard(const std::string &) const; + virtual std::string toIClipboard(const std::string &) const; protected: //! Convert from IClipboard format /*! Do UTF-8 conversion and linefeed conversion. */ - virtual String doFromIClipboard(const String&) const = 0; + virtual std::string doFromIClipboard(const std::string&) const = 0; //! Convert to IClipboard format /*! Do UTF-8 conversion and Linefeed conversion. */ - virtual String doToIClipboard(const String&) const = 0; + virtual std::string doToIClipboard(const std::string&) const = 0; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardAnyTextConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardAnyTextConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardAnyTextConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardAnyTextConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -40,15 +40,13 @@ return IClipboard::kText; } -String -OSXClipboardAnyTextConverter::fromIClipboard(const String& data) const +std::string OSXClipboardAnyTextConverter::fromIClipboard(const std::string& data) const { // convert linefeeds and then convert to desired encoding return doFromIClipboard(convertLinefeedToMacOS(data)); } -String -OSXClipboardAnyTextConverter::toIClipboard(const String& data) const +std::string OSXClipboardAnyTextConverter::toIClipboard(const std::string& data) const { // convert text then newlines return convertLinefeedToUnix(doToIClipboard(data)); @@ -68,21 +66,19 @@ return (ch == '\r'); } -String -OSXClipboardAnyTextConverter::convertLinefeedToMacOS(const String& src) +std::string OSXClipboardAnyTextConverter::convertLinefeedToMacOS(const std::string& src) { // note -- we assume src is a valid UTF-8 string - String copy = src; + std::string copy = src; std::replace_if(copy.begin(), copy.end(), isLF, '\r'); return copy; } -String -OSXClipboardAnyTextConverter::convertLinefeedToUnix(const String& src) +std::string OSXClipboardAnyTextConverter::convertLinefeedToUnix(const std::string& src) { - String copy = src; + std::string copy = src; std::replace_if(copy.begin(), copy.end(), isCR, '\n'); diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardAnyTextConverter.h barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardAnyTextConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardAnyTextConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardAnyTextConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -29,25 +29,24 @@ // IOSXClipboardConverter overrides virtual IClipboard::EFormat getFormat() const; - virtual CFStringRef - getOSXFormat() const = 0; - virtual String fromIClipboard(const String &) const; - virtual String toIClipboard(const String &) const; + virtual CFStringRef getOSXFormat() const = 0; + virtual std::string fromIClipboard(const std::string &) const; + virtual std::string toIClipboard(const std::string &) const; protected: //! Convert from IClipboard format /*! Do UTF-8 conversion and linefeed conversion. */ - virtual String doFromIClipboard(const String&) const = 0; + virtual std::string doFromIClipboard(const std::string&) const = 0; //! Convert to IClipboard format /*! Do UTF-8 conversion and Linefeed conversion. */ - virtual String doToIClipboard(const String&) const = 0; + virtual std::string doToIClipboard(const std::string&) const = 0; private: - static String convertLinefeedToMacOS(const String&); - static String convertLinefeedToUnix(const String&); + static std::string convertLinefeedToMacOS(const std::string&); + static std::string convertLinefeedToUnix(const std::string&); }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardBMPConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardBMPConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardBMPConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardBMPConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -91,8 +91,7 @@ return CFSTR("com.microsoft.bmp"); } -String -OSXClipboardBMPConverter::fromIClipboard(const String& bmp) const +std::string OSXClipboardBMPConverter::fromIClipboard(const std::string& bmp) const { LOG((CLOG_DEBUG1 "ENTER OSXClipboardBMPConverter::doFromIClipboard()")); // create BMP image @@ -104,21 +103,20 @@ toLE(dst, static_cast(0)); toLE(dst, static_cast(0)); toLE(dst, static_cast(14 + 40)); - return String(reinterpret_cast(header), 14) + bmp; + return std::string(reinterpret_cast(header), 14) + bmp; } -String -OSXClipboardBMPConverter::toIClipboard(const String& bmp) const +std::string OSXClipboardBMPConverter::toIClipboard(const std::string& bmp) const { // make sure data is big enough for a BMP file if (bmp.size() <= 14 + 40) { - return String(); + return {}; } // check BMP file header const UInt8* rawBMPHeader = reinterpret_cast(bmp.data()); if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') { - return String(); + return {}; } // get offset to image data diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardBMPConverter.h barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardBMPConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardBMPConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardBMPConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -34,11 +34,10 @@ getOSXFormat() const; // OSXClipboardAnyBMPConverter overrides - virtual String fromIClipboard(const String&) const; - virtual String toIClipboard(const String&) const; + virtual std::string fromIClipboard(const std::string&) const; + virtual std::string toIClipboard(const std::string&) const; // generic encoding converter - static String convertString(const String& data, - CFStringEncoding fromEncoding, - CFStringEncoding toEncoding); + static std::string convertString(const std::string& data, CFStringEncoding fromEncoding, + CFStringEncoding toEncoding); }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboard.cpp barrier-2.3.3+dfsg/src/lib/platform/OSXClipboard.cpp --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboard.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboard.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -92,8 +92,7 @@ return false; } - void -OSXClipboard::add(EFormat format, const String & data) +void OSXClipboard::add(EFormat format, const std::string& data) { if (m_pboard == NULL) return; @@ -116,7 +115,7 @@ // skip converters for other formats if (converter->getFormat() == format) { - String osXData = converter->fromIClipboard(data); + std::string osXData = converter->fromIClipboard(data); CFStringRef flavorType = converter->getOSXFormat(); CFDataRef dataRef = CFDataCreate(kCFAllocatorDefault, (UInt8 *)osXData.data(), osXData.size()); PasteboardItemID itemID = 0; @@ -185,12 +184,11 @@ return false; } -String -OSXClipboard::get(EFormat format) const +std::string OSXClipboard::get(EFormat format) const { CFStringRef type; PasteboardItemID item; - String result; + std::string result; if (m_pboard == NULL) return result; @@ -229,7 +227,7 @@ throw err; } - result = String((char *) CFDataGetBytePtr(buffer), CFDataGetLength(buffer)); + result = std::string((char *) CFDataGetBytePtr(buffer), CFDataGetLength(buffer)); } catch (OSStatus err) { LOG((CLOG_DEBUG "exception thrown in OSXClipboard::get MacError (%d)", err)); diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboard.h barrier-2.3.3+dfsg/src/lib/platform/OSXClipboard.h --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboard.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboard.h 2020-07-14 17:37:45.000000000 +0000 @@ -21,6 +21,7 @@ #include "barrier/IClipboard.h" #include +#include #include class IOSXClipboardConverter; @@ -36,12 +37,12 @@ // IClipboard overrides virtual bool empty(); - virtual void add(EFormat, const String& data); + virtual void add(EFormat, const std::string& data); virtual bool open(Time) const; virtual void close() const; virtual Time getTime() const; virtual bool has(EFormat) const; - virtual String get(EFormat) const; + virtual std::string get(EFormat) const; bool synchronize(); private: @@ -72,8 +73,7 @@ getFormat() const = 0; //! returns the scrap flavor type that this object converts from/to - virtual CFStringRef - getOSXFormat() const = 0; + virtual CFStringRef getOSXFormat() const = 0; //! Convert from IClipboard format /*! @@ -82,14 +82,14 @@ getFormat(). The return data will be in the scrap format returned by getOSXFormat(). */ - virtual String fromIClipboard(const String&) const = 0; + virtual std::string fromIClipboard(const std::string&) const = 0; //! Convert to IClipboard format /*! Convert from the carbon scrap format to the IClipboard format (i.e., the reverse of fromIClipboard()). */ - virtual String toIClipboard(const String&) const = 0; + virtual std::string toIClipboard(const std::string&) const = 0; //@} }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardHTMLConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardHTMLConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardHTMLConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardHTMLConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -42,18 +42,16 @@ return CFSTR("public.html"); } -String -OSXClipboardHTMLConverter::convertString( - const String& data, - CFStringEncoding fromEncoding, - CFStringEncoding toEncoding) +std::string OSXClipboardHTMLConverter::convertString(const std::string& data, + CFStringEncoding fromEncoding, + CFStringEncoding toEncoding) { CFStringRef stringRef = CFStringCreateWithCString( kCFAllocatorDefault, data.c_str(), fromEncoding); if (stringRef == NULL) { - return String(); + return {}; } CFIndex buffSize; @@ -66,13 +64,13 @@ if (buffer == NULL) { CFRelease(stringRef); - return String(); + return {}; } CFStringGetBytes(stringRef, entireString, toEncoding, 0, false, (UInt8*)buffer, buffSize, NULL); - String result(buffer, buffSize); + std::string result(buffer, buffSize); delete[] buffer; CFRelease(stringRef); @@ -80,15 +78,13 @@ return result; } -String -OSXClipboardHTMLConverter::doFromIClipboard(const String& data) const +std::string OSXClipboardHTMLConverter::doFromIClipboard(const std::string& data) const { return convertString(data, kCFStringEncodingUTF8, CFStringGetSystemEncoding()); } -String -OSXClipboardHTMLConverter::doToIClipboard(const String& data) const +std::string OSXClipboardHTMLConverter::doToIClipboard(const std::string& data) const { return convertString(data, CFStringGetSystemEncoding(), kCFStringEncodingUTF8); diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardHTMLConverter.h barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardHTMLConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardHTMLConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardHTMLConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -34,11 +34,10 @@ protected: // OSXClipboardAnyTextConverter overrides - virtual String doFromIClipboard(const String&) const; - virtual String doToIClipboard(const String&) const; + virtual std::string doFromIClipboard(const std::string&) const; + virtual std::string doToIClipboard(const std::string&) const; // generic encoding converter - static String convertString(const String& data, - CFStringEncoding fromEncoding, - CFStringEncoding toEncoding); + static std::string convertString(const std::string& data, CFStringEncoding fromEncoding, + CFStringEncoding toEncoding); }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardTextConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardTextConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardTextConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardTextConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -40,18 +40,16 @@ return CFSTR("public.plain-text"); } -String -OSXClipboardTextConverter::convertString( - const String& data, - CFStringEncoding fromEncoding, - CFStringEncoding toEncoding) +std::string OSXClipboardTextConverter::convertString(const std::string& data, + CFStringEncoding fromEncoding, + CFStringEncoding toEncoding) { CFStringRef stringRef = CFStringCreateWithCString(kCFAllocatorDefault, data.c_str(), fromEncoding); if (stringRef == NULL) { - return String(); + return {}; } CFIndex buffSize; @@ -64,13 +62,13 @@ if (buffer == NULL) { CFRelease(stringRef); - return String(); + return {}; } CFStringGetBytes(stringRef, entireString, toEncoding, 0, false, (UInt8*)buffer, buffSize, NULL); - String result(buffer, buffSize); + std::string result(buffer, buffSize); delete[] buffer; CFRelease(stringRef); @@ -78,15 +76,13 @@ return result; } -String -OSXClipboardTextConverter::doFromIClipboard(const String& data) const +std::string OSXClipboardTextConverter::doFromIClipboard(const std::string& data) const { return convertString(data, kCFStringEncodingUTF8, CFStringGetSystemEncoding()); } -String -OSXClipboardTextConverter::doToIClipboard(const String& data) const +std::string OSXClipboardTextConverter::doToIClipboard(const std::string& data) const { return convertString(data, CFStringGetSystemEncoding(), kCFStringEncodingUTF8); diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardTextConverter.h barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardTextConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardTextConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardTextConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -32,11 +32,10 @@ protected: // OSXClipboardAnyTextConverter overrides - virtual String doFromIClipboard(const String&) const; - virtual String doToIClipboard(const String&) const; + virtual std::string doFromIClipboard(const std::string&) const; + virtual std::string doToIClipboard(const std::string&) const; // generic encoding converter - static String convertString(const String& data, - CFStringEncoding fromEncoding, - CFStringEncoding toEncoding); + static std::string convertString(const std::string& data, CFStringEncoding fromEncoding, + CFStringEncoding toEncoding); }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardUTF16Converter.cpp barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardUTF16Converter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardUTF16Converter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardUTF16Converter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -40,15 +40,13 @@ return CFSTR("public.utf16-plain-text"); } -String -OSXClipboardUTF16Converter::doFromIClipboard(const String& data) const +std::string OSXClipboardUTF16Converter::doFromIClipboard(const std::string& data) const { // convert and add nul terminator return Unicode::UTF8ToUTF16(data); } -String -OSXClipboardUTF16Converter::doToIClipboard(const String& data) const +std::string OSXClipboardUTF16Converter::doToIClipboard(const std::string& data) const { // convert and strip nul terminator return Unicode::UTF16ToUTF8(data); diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardUTF16Converter.h barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardUTF16Converter.h --- barrier-2.3.2+dfsg/src/lib/platform/OSXClipboardUTF16Converter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXClipboardUTF16Converter.h 2020-07-14 17:37:45.000000000 +0000 @@ -32,6 +32,6 @@ protected: // OSXClipboardAnyTextConverter overrides - virtual String doFromIClipboard(const String&) const; - virtual String doToIClipboard(const String&) const; + virtual std::string doFromIClipboard(const std::string&) const; + virtual std::string doToIClipboard(const std::string&) const; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXDragView.m barrier-2.3.3+dfsg/src/lib/platform/OSXDragView.m --- barrier-2.3.2+dfsg/src/lib/platform/OSXDragView.m 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXDragView.m 2020-07-14 17:37:45.000000000 +0000 @@ -129,13 +129,13 @@ - (NSPoint)draggingLocation { - NSPoint point; + NSPoint point = NSMakePoint(0, 0); return point; } - (NSPoint)draggedImageLocation { - NSPoint point; + NSPoint point = NSMakePoint(0, 0); return point; } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXKeyState.cpp barrier-2.3.3+dfsg/src/lib/platform/OSXKeyState.cpp --- barrier-2.3.2+dfsg/src/lib/platform/OSXKeyState.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXKeyState.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -337,26 +337,26 @@ CGEventFlags OSXKeyState::getModifierStateAsOSXFlags() { - CGEventFlags modifiers = 0; + CGEventFlags modifiers = CGEventFlags(0); if (m_shiftPressed) { - modifiers |= kCGEventFlagMaskShift; + modifiers |= CGEventFlags(kCGEventFlagMaskShift); } if (m_controlPressed) { - modifiers |= kCGEventFlagMaskControl; + modifiers |= CGEventFlags(kCGEventFlagMaskControl); } if (m_altPressed) { - modifiers |= kCGEventFlagMaskAlternate; + modifiers |= CGEventFlags(kCGEventFlagMaskAlternate); } if (m_superPressed) { - modifiers |= kCGEventFlagMaskCommand; + modifiers |= CGEventFlags(kCGEventFlagMaskCommand); } if (m_capsPressed) { - modifiers |= kCGEventFlagMaskAlphaShift; + modifiers |= CGEventFlags(kCGEventFlagMaskAlphaShift); } return modifiers; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/OSXScreen.h barrier-2.3.3+dfsg/src/lib/platform/OSXScreen.h --- barrier-2.3.2+dfsg/src/lib/platform/OSXScreen.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/OSXScreen.h 2020-07-14 17:37:45.000000000 +0000 @@ -97,9 +97,9 @@ virtual void setSequenceNumber(UInt32); virtual bool isPrimary() const; virtual void fakeDraggingFiles(DragFileList fileList); - virtual String& getDraggingFilename(); + virtual std::string& getDraggingFilename(); - const String& getDropTarget() const { return m_dropTarget; } + const std::string& getDropTarget() const { return m_dropTarget; } void waitForCarbonLoop() const; protected: @@ -338,7 +338,7 @@ IEventQueue* m_events; Thread* m_getDropTargetThread; - String m_dropTarget; + std::string m_dropTarget; #if defined(MAC_OS_X_VERSION_10_7) Mutex* m_carbonLoopMutex; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -122,8 +122,7 @@ return 8; } -String -XWindowsClipboardAnyBitmapConverter::fromIClipboard(const String& bmp) const +std::string XWindowsClipboardAnyBitmapConverter::fromIClipboard(const std::string& bmp) const { // fill BMP info header with native-endian data CBMPInfoHeader infoHeader; @@ -145,7 +144,7 @@ infoHeader.biWidth == 0 || infoHeader.biHeight == 0 || infoHeader.biPlanes != 0 || infoHeader.biCompression != 0 || (infoHeader.biBitCount != 24 && infoHeader.biBitCount != 32)) { - return String(); + return {}; } // convert to image format @@ -160,14 +159,13 @@ } } -String -XWindowsClipboardAnyBitmapConverter::toIClipboard(const String& image) const +std::string XWindowsClipboardAnyBitmapConverter::toIClipboard(const std::string& image) const { // convert to raw BMP data UInt32 w, h, depth; - String rawBMP = doToIClipboard(image, w, h, depth); + std::string rawBMP = doToIClipboard(image, w, h, depth); if (rawBMP.empty() || w == 0 || h == 0 || (depth != 24 && depth != 32)) { - return String(); + return {}; } // fill BMP info header with little-endian data @@ -186,6 +184,6 @@ toLE(dst, static_cast(0)); // construct image - return String(reinterpret_cast(infoHeader), - sizeof(infoHeader)) + rawBMP; + return std::string(reinterpret_cast(infoHeader), + sizeof(infoHeader)) + rawBMP; } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -32,29 +32,27 @@ getFormat() const; virtual Atom getAtom() const = 0; virtual int getDataSize() const; - virtual String fromIClipboard(const String&) const; - virtual String toIClipboard(const String&) const; + virtual std::string fromIClipboard(const std::string&) const; + virtual std::string toIClipboard(const std::string&) const; protected: //! Convert from IClipboard format /*! Convert raw BGR pixel data to another image format. */ - virtual String doBGRFromIClipboard(const UInt8* bgrData, - UInt32 w, UInt32 h) const = 0; + virtual std::string doBGRFromIClipboard(const UInt8* bgrData, UInt32 w, UInt32 h) const = 0; //! Convert from IClipboard format /*! Convert raw BGRA pixel data to another image format. */ - virtual String doBGRAFromIClipboard(const UInt8* bgrData, - UInt32 w, UInt32 h) const = 0; + virtual std::string doBGRAFromIClipboard(const UInt8* bgrData, UInt32 w, UInt32 h) const = 0; //! Convert to IClipboard format /*! Convert an image into raw BGR or BGRA image data and store the width, height, and image depth (24 or 32). */ - virtual String doToIClipboard(const String&, - UInt32& w, UInt32& h, UInt32& depth) const = 0; + virtual std::string doToIClipboard(const std::string&, UInt32& w, UInt32& h, + UInt32& depth) const = 0; }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardBMPConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardBMPConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardBMPConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardBMPConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -101,8 +101,7 @@ return 8; } -String -XWindowsClipboardBMPConverter::fromIClipboard(const String& bmp) const +std::string XWindowsClipboardBMPConverter::fromIClipboard(const std::string& bmp) const { // create BMP image UInt8 header[14]; @@ -113,21 +112,20 @@ toLE(dst, static_cast(0)); toLE(dst, static_cast(0)); toLE(dst, static_cast(14 + 40)); - return String(reinterpret_cast(header), 14) + bmp; + return std::string(reinterpret_cast(header), 14) + bmp; } -String -XWindowsClipboardBMPConverter::toIClipboard(const String& bmp) const +std::string XWindowsClipboardBMPConverter::toIClipboard(const std::string& bmp) const { // make sure data is big enough for a BMP file if (bmp.size() <= 14 + 40) { - return String(); + return {}; } // check BMP file header const UInt8* rawBMPHeader = reinterpret_cast(bmp.data()); if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') { - return String(); + return {}; } // get offset to image data diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardBMPConverter.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardBMPConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardBMPConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardBMPConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -32,8 +32,8 @@ getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual String fromIClipboard(const String&) const; - virtual String toIClipboard(const String&) const; + virtual std::string fromIClipboard(const std::string&) const; + virtual std::string toIClipboard(const std::string&) const; private: Atom m_atom; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboard.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboard.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboard.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboard.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -170,7 +170,7 @@ } // handle targets - String data; + std::string data; Atom type = None; int format = 0; if (target == m_atomTargets) { @@ -303,8 +303,7 @@ return true; } -void -XWindowsClipboard::add(EFormat format, const String& data) +void XWindowsClipboard::add(EFormat format, const std::string& data) { assert(m_open); assert(m_owner); @@ -387,8 +386,7 @@ return m_added[format]; } -String -XWindowsClipboard::get(EFormat format) const +std::string XWindowsClipboard::get(EFormat format) const { assert(m_open); @@ -513,7 +511,7 @@ // instead of the correct type ATOM; allow either. const Atom atomTargets = m_atomTargets; Atom target; - String data; + std::string data; if (!icccmGetSelection(atomTargets, &target, &data) || (target != m_atomAtom && target != m_atomTargets)) { LOG((CLOG_DEBUG1 "selection doesn't support TARGETS")); @@ -557,7 +555,7 @@ // get the data Atom actualTarget; - String targetData; + std::string targetData; if (!icccmGetSelection(target, &actualTarget, &targetData)) { LOG((CLOG_DEBUG1 " no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str())); continue; @@ -573,7 +571,7 @@ bool XWindowsClipboard::icccmGetSelection(Atom target, - Atom* actualTarget, String* data) const + Atom* actualTarget, std::string* data) const { assert(actualTarget != NULL); assert(data != NULL); @@ -597,7 +595,7 @@ XWindowsClipboard::icccmGetTime() const { Atom actualTarget; - String data; + std::string data; if (icccmGetSelection(m_atomTimestamp, &actualTarget, &data) && actualTarget == m_atomInteger) { Time time = *reinterpret_cast(data.data()); @@ -668,7 +666,7 @@ // get the Motif clipboard header property from the root window Atom target; SInt32 format; - String data; + std::string data; Window root = RootWindow(m_display, DefaultScreen(m_display)); if (!XWindowsUtil::getWindowProperty(m_display, root, m_atomMotifClipHeader, @@ -697,7 +695,7 @@ // get the Motif clipboard header property from the root window Atom target; SInt32 format; - String data; + std::string data; Window root = RootWindow(m_display, DefaultScreen(m_display)); if (!XWindowsUtil::getWindowProperty(m_display, root, m_atomMotifClipHeader, @@ -741,13 +739,13 @@ static_cast(data.data())); // get the available formats - typedef std::map MotifFormatMap; + typedef std::map MotifFormatMap; MotifFormatMap motifFormats; for (SInt32 i = 0; i < numFormats; ++i) { // get Motif format property from the root window sprintf(name, "_MOTIF_CLIP_ITEM_%d", formats[i]); Atom atomFormat = m_impl->XInternAtom(m_display, name, False); - String data; + std::string data; if (!XWindowsUtil::getWindowProperty(m_display, root, atomFormat, &data, &target, &format, False)) { @@ -797,7 +795,7 @@ // get the data (finally) Atom actualTarget; - String targetData; + std::string targetData; if (!motifGetSelection(&motifFormat, &actualTarget, &targetData)) { LOG((CLOG_DEBUG1 " no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str())); continue; @@ -813,7 +811,7 @@ bool XWindowsClipboard::motifGetSelection(const MotifClipFormat* format, - Atom* actualTarget, String* data) const + Atom* actualTarget, std::string* data) const { // if the current clipboard owner and the owner indicated by the // motif clip header are the same then transfer via a property on @@ -849,7 +847,7 @@ // get the requested targets Atom target; SInt32 format; - String data; + std::string data; if (!XWindowsUtil::getWindowProperty(m_display, requestor, property, &data, &target, &format, False)) { // can't get the requested targets @@ -887,7 +885,7 @@ // add reply for MULTIPLE request insertReply(new Reply(requestor, m_atomMultiple, - time, property, String(), None, 32)); + time, property, std::string(), None, 32)); return true; } @@ -1101,7 +1099,7 @@ LOG((CLOG_DEBUG2 "properties of 0x%08x:", reply->m_requestor)); for (int i = 0; i < n; ++i) { Atom target; - String data; + std::string data; char* name = m_impl->XGetAtomName(m_display, props[i]); if (!XWindowsUtil::getWindowProperty(m_display, reply->m_requestor, @@ -1112,9 +1110,9 @@ // if there are any non-ascii characters in string // then print the binary data. static const char* hex = "0123456789abcdef"; - for (String::size_type j = 0; j < data.size(); ++j) { + for (std::string::size_type j = 0; j < data.size(); ++j) { if (data[j] < 32 || data[j] > 126) { - String tmp; + std::string tmp; tmp.reserve(data.size() * 3); for (j = 0; j < data.size(); ++j) { unsigned char v = (unsigned char)data[j]; @@ -1221,8 +1219,7 @@ return (/*when >= 0 &&*/ when <= duration); } -Atom -XWindowsClipboard::getTargetsData(String& data, int* format) const +Atom XWindowsClipboard::getTargetsData(std::string& data, int* format) const { assert(format != NULL); @@ -1246,8 +1243,7 @@ return m_atomAtom; } -Atom -XWindowsClipboard::getTimestampData(String& data, int* format) const +Atom XWindowsClipboard::getTimestampData(std::string& data, int* format) const { assert(format != NULL); @@ -1285,7 +1281,7 @@ bool XWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display, - Atom selection, Atom target, Atom* actualTarget, String* data) + Atom selection, Atom target, Atom* actualTarget, std::string* data) { assert(actualTarget != NULL); assert(data != NULL); @@ -1430,7 +1426,7 @@ // get the data from the property Atom target; - const String::size_type oldSize = m_data->size(); + const std::string::size_type oldSize = m_data->size(); if (!XWindowsUtil::getWindowProperty(display, m_requestor, m_property, m_data, &target, NULL, True)) { // unable to read property @@ -1515,7 +1511,7 @@ } XWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time, - Atom property, const String& data, Atom type, int format) : + Atom property, const std::string& data, Atom type, int format) : m_requestor(requestor), m_target(target), m_time(time), diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboard.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboard.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboard.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboard.h 2020-07-14 17:37:45.000000000 +0000 @@ -90,12 +90,12 @@ // IClipboard overrides virtual bool empty(); - virtual void add(EFormat, const String& data); + virtual void add(EFormat, const std::string& data); virtual bool open(Time) const; virtual void close() const; virtual Time getTime() const; virtual bool has(EFormat) const; - virtual String get(EFormat) const; + virtual std::string get(EFormat) const; private: // remove all converters from our list @@ -148,7 +148,7 @@ // cannot be performed (in which case *actualTarget == None). bool readClipboard(Display* display, Atom selection, Atom target, - Atom* actualTarget, String* data); + Atom* actualTarget, std::string* data); private: bool processEvent(Display* display, XEvent* event); @@ -169,7 +169,7 @@ bool m_reading; // the converted selection data - String* m_data; + std::string* m_data; // the actual type of the data. if this is None then the // selection owner cannot convert to the requested type. @@ -224,8 +224,8 @@ class Reply { public: Reply(Window, Atom target, ::Time); - Reply(Window, Atom target, ::Time, Atom property, - const String& data, Atom type, int format); + Reply(Window, Atom target, ::Time, Atom property, const std::string& data, + Atom type, int format); public: // information about the request @@ -241,7 +241,7 @@ bool m_done; // the data to send and its type and format - String m_data; + std::string m_data; Atom m_type; int m_format; @@ -254,8 +254,7 @@ // ICCCM interoperability methods void icccmFillCache(); - bool icccmGetSelection(Atom target, - Atom* actualTarget, String* data) const; + bool icccmGetSelection(Atom target, Atom* actualTarget, std::string* data) const; Time icccmGetTime() const; // motif interoperability methods @@ -263,8 +262,7 @@ void motifUnlockClipboard() const; bool motifOwnsClipboard() const; void motifFillCache(); - bool motifGetSelection(const MotifClipFormat*, - Atom* actualTarget, String* data) const; + bool motifGetSelection(const MotifClipFormat*, Atom* actualTarget, std::string* data) const; Time motifGetTime() const; // reply methods @@ -281,8 +279,8 @@ bool wasOwnedAtTime(::Time) const; // data conversion methods - Atom getTargetsData(String&, int* format) const; - Atom getTimestampData(String&, int* format) const; + Atom getTargetsData(std::string&, int* format) const; + Atom getTimestampData(std::string&, int* format) const; private: typedef std::vector ConverterList; @@ -306,7 +304,7 @@ bool m_cached; Time m_cacheTime; bool m_added[kNumFormats]; - String m_data[kNumFormats]; + std::string m_data[kNumFormats]; // conversion request replies ReplyMap m_replies; @@ -368,14 +366,14 @@ getFormat(). The return data will be in the X selection format returned by getAtom(). */ - virtual String fromIClipboard(const String&) const = 0; + virtual std::string fromIClipboard(const std::string&) const = 0; //! Convert to IClipboard format /*! Convert from the X selection format to the IClipboard format (i.e., the reverse of fromIClipboard()). */ - virtual String toIClipboard(const String&) const = 0; + virtual std::string toIClipboard(const std::string&) const = 0; //@} }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardHTMLConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardHTMLConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardHTMLConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardHTMLConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -54,14 +54,12 @@ return 8; } -String -XWindowsClipboardHTMLConverter::fromIClipboard(const String& data) const +std::string XWindowsClipboardHTMLConverter::fromIClipboard(const std::string& data) const { return Unicode::UTF8ToUTF16(data); } -String -XWindowsClipboardHTMLConverter::toIClipboard(const String& data) const +std::string XWindowsClipboardHTMLConverter::toIClipboard(const std::string& data) const { return Unicode::UTF16ToUTF8(data); } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardHTMLConverter.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardHTMLConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardHTMLConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardHTMLConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -34,8 +34,8 @@ getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual String fromIClipboard(const String&) const; - virtual String toIClipboard(const String&) const; + virtual std::string fromIClipboard(const std::string&) const; + virtual std::string toIClipboard(const std::string&) const; private: Atom m_atom; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardTextConverter.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardTextConverter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardTextConverter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardTextConverter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -54,18 +54,16 @@ return 8; } -String -XWindowsClipboardTextConverter::fromIClipboard(const String& data) const +std::string XWindowsClipboardTextConverter::fromIClipboard(const std::string& data) const { return Unicode::UTF8ToText(data); } -String -XWindowsClipboardTextConverter::toIClipboard(const String& data) const +std::string XWindowsClipboardTextConverter::toIClipboard(const std::string& data) const { // convert to UTF-8 bool errors; - String utf8 = Unicode::textToUTF8(data, &errors); + std::string utf8 = Unicode::textToUTF8(data, &errors); // if there were decoding errors then, to support old applications // that don't understand UTF-8 but can report the exact binary diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardTextConverter.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardTextConverter.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardTextConverter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardTextConverter.h 2020-07-14 17:37:45.000000000 +0000 @@ -34,8 +34,8 @@ getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual String fromIClipboard(const String&) const; - virtual String toIClipboard(const String&) const; + virtual std::string fromIClipboard(const std::string&) const; + virtual std::string toIClipboard(const std::string&) const; private: Atom m_atom; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardUCS2Converter.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardUCS2Converter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardUCS2Converter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardUCS2Converter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -54,14 +54,12 @@ return 16; } -String -XWindowsClipboardUCS2Converter::fromIClipboard(const String& data) const +std::string XWindowsClipboardUCS2Converter::fromIClipboard(const std::string& data) const { return Unicode::UTF8ToUCS2(data); } -String -XWindowsClipboardUCS2Converter::toIClipboard(const String& data) const +std::string XWindowsClipboardUCS2Converter::toIClipboard(const std::string& data) const { return Unicode::UCS2ToUTF8(data); } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardUCS2Converter.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardUCS2Converter.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardUCS2Converter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardUCS2Converter.h 2020-07-14 17:37:45.000000000 +0000 @@ -34,8 +34,8 @@ getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual String fromIClipboard(const String&) const; - virtual String toIClipboard(const String&) const; + virtual std::string fromIClipboard(const std::string&) const; + virtual std::string toIClipboard(const std::string&) const; private: Atom m_atom; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardUTF8Converter.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardUTF8Converter.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardUTF8Converter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardUTF8Converter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -52,14 +52,12 @@ return 8; } -String -XWindowsClipboardUTF8Converter::fromIClipboard(const String& data) const +std::string XWindowsClipboardUTF8Converter::fromIClipboard(const std::string& data) const { return data; } -String -XWindowsClipboardUTF8Converter::toIClipboard(const String& data) const +std::string XWindowsClipboardUTF8Converter::toIClipboard(const std::string& data) const { return data; } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardUTF8Converter.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardUTF8Converter.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsClipboardUTF8Converter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsClipboardUTF8Converter.h 2020-07-14 17:37:45.000000000 +0000 @@ -34,8 +34,8 @@ getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual String fromIClipboard(const String&) const; - virtual String toIClipboard(const String&) const; + virtual std::string fromIClipboard(const std::string&) const; + virtual std::string toIClipboard(const std::string&) const; private: Atom m_atom; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsEventQueueBuffer.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsEventQueueBuffer.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsEventQueueBuffer.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsEventQueueBuffer.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -82,6 +82,19 @@ close(m_pipefd[1]); } +int XWindowsEventQueueBuffer::getPendingCountLocked() +{ + Lock lock(&m_mutex); + // work around a bug in old libx11 which causes the first XPending not to read events under + // certain conditions. The issue happens when libx11 has not yet received replies for all + // flushed events. In that case, internally XPending will not try to process received events + // as the reply for the last event was not found. As a result, XPending will return the number + // of pending events without regard to the events it has just read. + // https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/1 fixes this on libx11 side. + m_impl->XPending(m_display); + return m_impl->XPending(m_display); +} + void XWindowsEventQueueBuffer::waitForEvent(double dtimeout) { @@ -163,7 +176,7 @@ // we want to give the cpu a chance s owe up this to 25ms #define TIMEOUT_DELAY 25 - while (((dtimeout < 0.0) || (remaining > 0)) && QLength(m_display)==0 && retval==0){ + while (((dtimeout < 0.0) || (remaining > 0)) && getPendingCountLocked() == 0 && retval == 0) { #if HAVE_POLL retval = poll(pfds, 2, TIMEOUT_DELAY); //16ms = 60hz, but we make it > to play nicely with the cpu if (pfds[1].revents & POLLIN) { diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsEventQueueBuffer.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsEventQueueBuffer.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsEventQueueBuffer.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsEventQueueBuffer.h 2020-07-14 17:37:45.000000000 +0000 @@ -51,6 +51,8 @@ private: void flush(); + int getPendingCountLocked(); + private: typedef std::vector EventList; IXWindowsImpl* m_impl; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsKeyState.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsKeyState.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsKeyState.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsKeyState.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -20,7 +20,6 @@ #include "platform/XWindowsUtil.h" #include "base/Log.h" -#include "base/String.h" #include "common/stdmap.h" #include diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsKeyState.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsKeyState.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsKeyState.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsKeyState.h 2020-07-14 17:37:45.000000000 +0000 @@ -173,6 +173,6 @@ public: SInt32 group() const { return m_group; } void group(const SInt32& group) { m_group = group; } - KeyModifierMaskList modifierFromX() const { return m_modifierFromX; } + KeyModifierMaskList& modifierFromX() { return m_modifierFromX; } #endif }; diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsScreen.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsScreen.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsScreen.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsScreen.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -30,7 +30,6 @@ #include "arch/Arch.h" #include "base/Log.h" #include "base/Stopwatch.h" -#include "base/String.h" #include "base/IEventQueue.h" #include "base/TMethodEventJob.h" diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsUtil.cpp barrier-2.3.3+dfsg/src/lib/platform/XWindowsUtil.cpp --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsUtil.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsUtil.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -1294,7 +1294,7 @@ bool XWindowsUtil::getWindowProperty(Display* display, Window window, - Atom property, String* data, Atom* type, + Atom property, std::string* data, Atom* type, SInt32* format, bool deleteProperty) { assert(display != NULL); @@ -1608,8 +1608,7 @@ } } -String -XWindowsUtil::atomToString(Display* display, Atom atom) +std::string XWindowsUtil::atomToString(Display* display, Atom atom) { if (atom == 0) { return "None"; @@ -1622,20 +1621,19 @@ return barrier::string::sprintf(" (%d)", (int)atom); } else { - String msg = barrier::string::sprintf("%s (%d)", name, (int)atom); + std::string msg = barrier::string::sprintf("%s (%d)", name, (int)atom); XFree(name); return msg; } } -String -XWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num) +std::string XWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num) { char** names = new char*[num]; bool error = false; XWindowsUtil::ErrorLock lock(display, &error); XGetAtomNames(display, const_cast(atom), (int)num, names); - String msg; + std::string msg; if (error) { for (UInt32 i = 0; i < num; ++i) { msg += barrier::string::sprintf(" (%d), ", (int)atom[i]); @@ -1654,8 +1652,7 @@ return msg; } -void -XWindowsUtil::convertAtomProperty(String& data) +void XWindowsUtil::convertAtomProperty(std::string& data) { // as best i can tell, 64-bit systems don't pack Atoms into properties // as 32-bit numbers but rather as the 64-bit numbers they are. that @@ -1669,22 +1666,19 @@ } } -void -XWindowsUtil::appendAtomData(String& data, Atom atom) +void XWindowsUtil::appendAtomData(std::string& data, Atom atom) { data.append(reinterpret_cast(&atom), sizeof(Atom)); } -void -XWindowsUtil::replaceAtomData(String& data, UInt32 index, Atom atom) +void XWindowsUtil::replaceAtomData(std::string& data, UInt32 index, Atom atom) { data.replace(index * sizeof(Atom), sizeof(Atom), reinterpret_cast(&atom), sizeof(Atom)); } -void -XWindowsUtil::appendTimeData(String& data, Time time) +void XWindowsUtil::appendTimeData(std::string& data, Time time) { data.append(reinterpret_cast(&time), sizeof(Time)); } diff -Nru barrier-2.3.2+dfsg/src/lib/platform/XWindowsUtil.h barrier-2.3.3+dfsg/src/lib/platform/XWindowsUtil.h --- barrier-2.3.2+dfsg/src/lib/platform/XWindowsUtil.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/platform/XWindowsUtil.h 2020-07-14 17:37:45.000000000 +0000 @@ -18,7 +18,6 @@ #pragma once -#include "base/String.h" #include "base/EventTypes.h" #include "common/stdmap.h" #include "common/stdvector.h" @@ -29,6 +28,8 @@ # include #endif +#include + //! X11 utility functions class XWindowsUtil { public: @@ -42,10 +43,9 @@ if \c format is not NULL. If \c deleteProperty is true then the property is deleted after being read. */ - static bool getWindowProperty(Display*, - Window window, Atom property, - String* data, Atom* type, - SInt32* format, bool deleteProperty); + static bool getWindowProperty(Display*, Window window, Atom property, + std::string* data, Atom* type, + SInt32* format, bool deleteProperty); //! Set property /*! @@ -81,44 +81,42 @@ /*! Converts \p atom to its string representation. */ - static String atomToString(Display*, Atom atom); + static std::string atomToString(Display*, Atom atom); //! Convert several Atoms to a string /*! Converts each atom in \p atoms to its string representation and concatenates the results. */ - static String atomsToString(Display* display, - const Atom* atom, UInt32 num); + static std::string atomsToString(Display* display, const Atom* atom, UInt32 num); //! Prepare a property of atoms for use /*! 64-bit systems may need to modify a property's data if it's a list of Atoms before using it. */ - static void convertAtomProperty(String& data); + static void convertAtomProperty(std::string& data); //! Append an Atom to property data /*! Converts \p atom to a 32-bit on-the-wire format and appends it to \p data. */ - static void appendAtomData(String& data, Atom atom); + static void appendAtomData(std::string& data, Atom atom); //! Replace an Atom in property data /*! Converts \p atom to a 32-bit on-the-wire format and replaces the atom at index \p index in \p data. */ - static void replaceAtomData(String& data, - UInt32 index, Atom atom); + static void replaceAtomData(std::string& data, UInt32 index, Atom atom); //! Append an Time to property data /*! Converts \p time to a 32-bit on-the-wire format and appends it to \p data. */ - static void appendTimeData(String& data, Time time); + static void appendTimeData(std::string& data, Time time); //! X11 error handler /*! diff -Nru barrier-2.3.2+dfsg/src/lib/server/BaseClientProxy.cpp barrier-2.3.3+dfsg/src/lib/server/BaseClientProxy.cpp --- barrier-2.3.2+dfsg/src/lib/server/BaseClientProxy.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/BaseClientProxy.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -22,7 +22,7 @@ // BaseClientProxy // -BaseClientProxy::BaseClientProxy(const String& name) : +BaseClientProxy::BaseClientProxy(const std::string& name) : m_name(name), m_x(0), m_y(0) @@ -49,8 +49,7 @@ y = m_y; } -String -BaseClientProxy::getName() const +std::string BaseClientProxy::getName() const { return m_name; } diff -Nru barrier-2.3.2+dfsg/src/lib/server/BaseClientProxy.h barrier-2.3.3+dfsg/src/lib/server/BaseClientProxy.h --- barrier-2.3.2+dfsg/src/lib/server/BaseClientProxy.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/BaseClientProxy.h 2020-07-14 17:37:45.000000000 +0000 @@ -19,7 +19,6 @@ #pragma once #include "barrier/IClient.h" -#include "base/String.h" namespace barrier { class IStream; } @@ -29,7 +28,7 @@ /*! \c name is the name of the client. */ - BaseClientProxy(const String& name); + BaseClientProxy(const std::string& name); ~BaseClientProxy(); //! @name manipulators @@ -89,11 +88,11 @@ virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size) = 0; virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize) = 0; - virtual String getName() const; + virtual std::string getName() const; virtual barrier::IStream* getStream() const = 0; private: - String m_name; + std::string m_name; SInt32 m_x, m_y; }; diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_0.cpp barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_0.cpp --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_0.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_0.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -31,7 +31,8 @@ // ClientProxy1_0 // -ClientProxy1_0::ClientProxy1_0(const String& name, barrier::IStream* stream, IEventQueue* events) : +ClientProxy1_0::ClientProxy1_0(const std::string& name, barrier::IStream* stream, + IEventQueue* events) : ClientProxy(name, stream), m_heartbeatTimer(NULL), m_parser(&ClientProxy1_0::parseHandshakeMessage), diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_0.h barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_0.h --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_0.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_0.h 2020-07-14 17:37:45.000000000 +0000 @@ -29,7 +29,7 @@ //! Proxy for client implementing protocol version 1.0 class ClientProxy1_0 : public ClientProxy { public: - ClientProxy1_0(const String& name, barrier::IStream* adoptedStream, IEventQueue* events); + ClientProxy1_0(const std::string& name, barrier::IStream* adoptedStream, IEventQueue* events); ~ClientProxy1_0(); // IScreen diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_1.cpp barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_1.cpp --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_1.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_1.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -27,7 +27,8 @@ // ClientProxy1_1 // -ClientProxy1_1::ClientProxy1_1(const String& name, barrier::IStream* stream, IEventQueue* events) : +ClientProxy1_1::ClientProxy1_1(const std::string& name, barrier::IStream* stream, + IEventQueue* events) : ClientProxy1_0(name, stream, events) { // do nothing diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_1.h barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_1.h --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_1.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_1.h 2020-07-14 17:37:45.000000000 +0000 @@ -23,7 +23,7 @@ //! Proxy for client implementing protocol version 1.1 class ClientProxy1_1 : public ClientProxy1_0 { public: - ClientProxy1_1(const String& name, barrier::IStream* adoptedStream, IEventQueue* events); + ClientProxy1_1(const std::string& name, barrier::IStream* adoptedStream, IEventQueue* events); ~ClientProxy1_1(); // IClient overrides diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_2.cpp barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_2.cpp --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_2.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_2.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -25,7 +25,8 @@ // ClientProxy1_1 // -ClientProxy1_2::ClientProxy1_2(const String& name, barrier::IStream* stream, IEventQueue* events) : +ClientProxy1_2::ClientProxy1_2(const std::string& name, barrier::IStream* stream, + IEventQueue* events) : ClientProxy1_1(name, stream, events) { // do nothing diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_2.h barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_2.h --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_2.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_2.h 2020-07-14 17:37:45.000000000 +0000 @@ -25,7 +25,7 @@ //! Proxy for client implementing protocol version 1.2 class ClientProxy1_2 : public ClientProxy1_1 { public: - ClientProxy1_2(const String& name, barrier::IStream* adoptedStream, IEventQueue* events); + ClientProxy1_2(const std::string& name, barrier::IStream* adoptedStream, IEventQueue* events); ~ClientProxy1_2(); // IClient overrides diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_3.cpp barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_3.cpp --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_3.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_3.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -30,7 +30,8 @@ // ClientProxy1_3 // -ClientProxy1_3::ClientProxy1_3(const String& name, barrier::IStream* stream, IEventQueue* events) : +ClientProxy1_3::ClientProxy1_3(const std::string& name, barrier::IStream* stream, + IEventQueue* events) : ClientProxy1_2(name, stream, events), m_keepAliveRate(kKeepAliveRate), m_keepAliveTimer(NULL), diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_3.h barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_3.h --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_3.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_3.h 2020-07-14 17:37:45.000000000 +0000 @@ -23,7 +23,7 @@ //! Proxy for client implementing protocol version 1.3 class ClientProxy1_3 : public ClientProxy1_2 { public: - ClientProxy1_3(const String& name, barrier::IStream* adoptedStream, IEventQueue* events); + ClientProxy1_3(const std::string& name, barrier::IStream* adoptedStream, IEventQueue* events); ~ClientProxy1_3(); // IClient overrides diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_4.cpp barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_4.cpp --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_4.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_4.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -31,7 +31,8 @@ // ClientProxy1_4 // -ClientProxy1_4::ClientProxy1_4(const String& name, barrier::IStream* stream, Server* server, IEventQueue* events) : +ClientProxy1_4::ClientProxy1_4(const std::string& name, barrier::IStream* stream, Server* server, + IEventQueue* events) : ClientProxy1_3(name, stream, events), m_server(server) { assert(m_server != NULL); diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_4.h barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_4.h --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_4.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_4.h 2020-07-14 17:37:45.000000000 +0000 @@ -25,7 +25,8 @@ //! Proxy for client implementing protocol version 1.4 class ClientProxy1_4 : public ClientProxy1_3 { public: - ClientProxy1_4(const String& name, barrier::IStream* adoptedStream, Server* server, IEventQueue* events); + ClientProxy1_4(const std::string& name, barrier::IStream* adoptedStream, Server* server, + IEventQueue* events); ~ClientProxy1_4(); //! @name accessors diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_5.cpp barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_5.cpp --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_5.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_5.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -31,7 +31,8 @@ // ClientProxy1_5 // -ClientProxy1_5::ClientProxy1_5(const String& name, barrier::IStream* stream, Server* server, IEventQueue* events) : +ClientProxy1_5::ClientProxy1_5(const std::string& name, barrier::IStream* stream, Server* server, + IEventQueue* events) : ClientProxy1_4(name, stream, server, events), m_events(events) { @@ -50,7 +51,7 @@ void ClientProxy1_5::sendDragInfo(UInt32 fileCount, const char* info, size_t size) { - String data(info, size); + std::string data(info, size); ProtocolUtil::writef(getStream(), kMsgDDragInfo, fileCount, &data); } @@ -92,7 +93,7 @@ } else if (result == kStart) { if (server->getFakeDragFileList().size() > 0) { - String filename = server->getFakeDragFileList().at(0).getFilename(); + std::string filename = server->getFakeDragFileList().at(0).getFilename(); LOG((CLOG_DEBUG "start receiving %s", filename.c_str())); } } @@ -103,7 +104,7 @@ { // parse UInt32 fileNum = 0; - String content; + std::string content; ProtocolUtil::readf(getStream(), kMsgDDragInfo + 4, &fileNum, &content); m_server->dragInfoReceived(fileNum, content); diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_5.h barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_5.h --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_5.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_5.h 2020-07-14 17:37:45.000000000 +0000 @@ -27,7 +27,8 @@ //! Proxy for client implementing protocol version 1.5 class ClientProxy1_5 : public ClientProxy1_4 { public: - ClientProxy1_5(const String& name, barrier::IStream* adoptedStream, Server* server, IEventQueue* events); + ClientProxy1_5(const std::string& name, barrier::IStream* adoptedStream, Server* server, + IEventQueue* events); ~ClientProxy1_5(); virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size); diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_6.cpp barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_6.cpp --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_6.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_6.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -29,7 +29,8 @@ // ClientProxy1_6 // -ClientProxy1_6::ClientProxy1_6(const String& name, barrier::IStream* stream, Server* server, IEventQueue* events) : +ClientProxy1_6::ClientProxy1_6(const std::string& name, barrier::IStream* stream, Server* server, + IEventQueue* events) : ClientProxy1_5(name, stream, server, events), m_events(events) { @@ -52,7 +53,7 @@ m_clipboard[id].m_dirty = false; Clipboard::copy(&m_clipboard[id].m_clipboard, clipboard); - String data = m_clipboard[id].m_clipboard.marshall(); + std::string data = m_clipboard[id].m_clipboard.marshall(); size_t size = data.size(); LOG((CLOG_DEBUG "sending clipboard %d to \"%s\"", id, getName().c_str())); @@ -71,7 +72,7 @@ ClientProxy1_6::recvClipboard() { // parse message - static String dataCached; + static std::string dataCached; ClipboardID id; UInt32 seq; diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_6.h barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_6.h --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy1_6.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy1_6.h 2020-07-14 17:37:45.000000000 +0000 @@ -25,7 +25,8 @@ //! Proxy for client implementing protocol version 1.6 class ClientProxy1_6 : public ClientProxy1_5 { public: - ClientProxy1_6(const String& name, barrier::IStream* adoptedStream, Server* server, IEventQueue* events); + ClientProxy1_6(const std::string& name, barrier::IStream* adoptedStream, Server* server, + IEventQueue* events); ~ClientProxy1_6(); virtual void setClipboard(ClipboardID id, const IClipboard* clipboard); diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy.cpp barrier-2.3.3+dfsg/src/lib/server/ClientProxy.cpp --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -27,7 +27,7 @@ // ClientProxy // -ClientProxy::ClientProxy(const String& name, barrier::IStream* stream) : +ClientProxy::ClientProxy(const std::string& name, barrier::IStream* stream) : BaseClientProxy(name), m_stream(stream) { diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxy.h barrier-2.3.3+dfsg/src/lib/server/ClientProxy.h --- barrier-2.3.2+dfsg/src/lib/server/ClientProxy.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxy.h 2020-07-14 17:37:45.000000000 +0000 @@ -20,7 +20,6 @@ #include "server/BaseClientProxy.h" #include "base/Event.h" -#include "base/String.h" #include "base/EventTypes.h" namespace barrier { class IStream; } @@ -31,7 +30,7 @@ /*! \c name is the name of the client. */ - ClientProxy(const String& name, barrier::IStream* adoptedStream); + ClientProxy(const std::string& name, barrier::IStream* adoptedStream); ~ClientProxy(); //! @name manipulators diff -Nru barrier-2.3.2+dfsg/src/lib/server/ClientProxyUnknown.cpp barrier-2.3.3+dfsg/src/lib/server/ClientProxyUnknown.cpp --- barrier-2.3.2+dfsg/src/lib/server/ClientProxyUnknown.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/ClientProxyUnknown.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -32,7 +32,6 @@ #include "io/IStream.h" #include "io/XIO.h" #include "base/Log.h" -#include "base/String.h" #include "base/IEventQueue.h" #include "base/TMethodEventJob.h" @@ -176,7 +175,7 @@ { LOG((CLOG_DEBUG1 "parsing hello reply")); - String name(""); + std::string name(""); try { // limit the maximum length of the hello UInt32 n = m_stream->getSize(); diff -Nru barrier-2.3.2+dfsg/src/lib/server/Config.cpp barrier-2.3.3+dfsg/src/lib/server/Config.cpp --- barrier-2.3.2+dfsg/src/lib/server/Config.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/Config.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -48,7 +48,7 @@ } bool -Config::addScreen(const String& name) +Config::addScreen(const std::string& name) { // alias name must not exist if (m_nameToCanonicalName.find(name) != m_nameToCanonicalName.end()) { @@ -64,12 +64,10 @@ return true; } -bool -Config::renameScreen(const String& oldName, - const String& newName) +bool Config::renameScreen(const std::string& oldName, const std::string& newName) { // get canonical name and find cell - String oldCanonical = getCanonicalName(oldName); + std::string oldCanonical = getCanonicalName(oldName); CellMap::iterator index = m_map.find(oldCanonical); if (index == m_map.end()) { return false; @@ -111,11 +109,10 @@ return true; } -void -Config::removeScreen(const String& name) +void Config::removeScreen(const std::string& name) { // get canonical name and find cell - String canonical = getCanonicalName(name); + std::string canonical = getCanonicalName(name); CellMap::iterator index = m_map.find(canonical); if (index == m_map.end()) { return; @@ -149,8 +146,7 @@ m_nameToCanonicalName.clear(); } -bool -Config::addAlias(const String& canonical, const String& alias) +bool Config::addAlias(const std::string& canonical, const std::string& alias) { // alias name must not exist if (m_nameToCanonicalName.find(alias) != m_nameToCanonicalName.end()) { @@ -168,8 +164,7 @@ return true; } -bool -Config::removeAlias(const String& alias) +bool Config::removeAlias(const std::string& alias) { // must not be a canonical name if (m_map.find(alias) != m_map.end()) { @@ -188,8 +183,7 @@ return true; } -bool -Config::removeAliases(const String& canonical) +bool Config::removeAliases(const std::string& canonical) { // must be a canonical name if (m_map.find(canonical) == m_map.end()) { @@ -224,12 +218,9 @@ } } -bool -Config::connect(const String& srcName, - EDirection srcSide, - float srcStart, float srcEnd, - const String& dstName, - float dstStart, float dstEnd) +bool Config::connect(const std::string& srcName, EDirection srcSide, + float srcStart, float srcEnd, const std::string& dstName, + float dstStart, float dstEnd) { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); @@ -245,8 +236,7 @@ return index->second.add(srcEdge, dstEdge); } -bool -Config::disconnect(const String& srcName, EDirection srcSide) +bool Config::disconnect(const std::string& srcName, EDirection srcSide) { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); @@ -262,8 +252,7 @@ return true; } -bool -Config::disconnect(const String& srcName, EDirection srcSide, float position) +bool Config::disconnect(const std::string& srcName, EDirection srcSide, float position) { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); @@ -285,8 +274,7 @@ m_barrierAddress = addr; } -bool -Config::addOption(const String& name, OptionID option, OptionValue value) +bool Config::addOption(const std::string& name, OptionID option, OptionValue value) { // find options ScreenOptions* options = NULL; @@ -308,8 +296,7 @@ return true; } -bool -Config::removeOption(const String& name, OptionID option) +bool Config::removeOption(const std::string& name, OptionID option) { // find options ScreenOptions* options = NULL; @@ -331,8 +318,7 @@ return true; } -bool -Config::removeOptions(const String& name) +bool Config::removeOptions(const std::string& name) { // find options ScreenOptions* options = NULL; @@ -354,8 +340,7 @@ return true; } -bool -Config::isValidScreenName(const String& name) const +bool Config::isValidScreenName(const std::string& name) const { // name is valid if matches validname // name ::= [_A-Za-z0-9] | [_A-Za-z0-9][-_A-Za-z0-9]*[_A-Za-z0-9] @@ -370,7 +355,7 @@ } // check each dot separated part - String::size_type b = 0; + std::string::size_type b = 0; for (;;) { // accept trailing . if (b == name.size()) { @@ -378,8 +363,8 @@ } // find end of part - String::size_type e = name.find('.', b); - if (e == String::npos) { + std::string::size_type e = name.find('.', b); + if (e == std::string::npos) { e = name.size(); } @@ -395,7 +380,7 @@ } // check interior characters - for (String::size_type i = b; i < e; ++i) { + for (std::string::size_type i = b; i < e; ++i) { if (!isalnum(name[i]) && name[i] != '_' && name[i] != '-') { return false; } @@ -437,40 +422,38 @@ } bool -Config::isScreen(const String& name) const +Config::isScreen(const std::string& name) const { return (m_nameToCanonicalName.count(name) > 0); } bool -Config::isCanonicalName(const String& name) const +Config::isCanonicalName(const std::string& name) const { return (!name.empty() && CaselessCmp::equal(getCanonicalName(name), name)); } -String -Config::getCanonicalName(const String& name) const +std::string Config::getCanonicalName(const std::string& name) const { NameMap::const_iterator index = m_nameToCanonicalName.find(name); if (index == m_nameToCanonicalName.end()) { - return String(); + return std::string(); } else { return index->second; } } -String -Config::getNeighbor(const String& srcName, EDirection srcSide, - float position, float* positionOut) const +std::string Config::getNeighbor(const std::string& srcName, EDirection srcSide, + float position, float* positionOut) const { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); // find source cell CellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); if (index == m_map.end()) { - return String(); + return std::string(); } // find edge @@ -491,15 +474,13 @@ } } -bool -Config::hasNeighbor(const String& srcName, EDirection srcSide) const +bool Config::hasNeighbor(const std::string& srcName, EDirection srcSide) const { return hasNeighbor(srcName, srcSide, 0.0f, 1.0f); } -bool -Config::hasNeighbor(const String& srcName, EDirection srcSide, - float start, float end) const +bool Config::hasNeighbor(const std::string& srcName, EDirection srcSide, + float start, float end) const { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); @@ -512,16 +493,14 @@ return index->second.overlaps(CellEdge(srcSide, Interval(start, end))); } -Config::link_const_iterator -Config::beginNeighbor(const String& srcName) const +Config::link_const_iterator Config::beginNeighbor(const std::string& srcName) const { CellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); assert(index != m_map.end()); return index->second.begin(); } -Config::link_const_iterator -Config::endNeighbor(const String& srcName) const +Config::link_const_iterator Config::endNeighbor(const std::string& srcName) const { CellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); assert(index != m_map.end()); @@ -534,8 +513,7 @@ return m_barrierAddress; } -const Config::ScreenOptions* -Config::getOptions(const String& name) const +const Config::ScreenOptions* Config::getOptions(const std::string& name) const { // find options const ScreenOptions* options = NULL; @@ -641,8 +619,7 @@ return &m_inputFilter; } -String -Config::formatInterval(const Interval& x) +std::string Config::formatInterval(const Interval& x) { if (x.first == 0.0f && x.second == 1.0f) { return ""; @@ -660,7 +637,7 @@ static const char s_links[] = "links"; static const char s_aliases[] = "aliases"; - String line; + std::string line; if (!s.readLine(line)) { // no more sections return; @@ -672,13 +649,13 @@ } // get section name - String::size_type i = line.find_first_not_of(" \t", sizeof(s_section) - 1); - if (i == String::npos) { + std::string::size_type i = line.find_first_not_of(" \t", sizeof(s_section) - 1); + if (i == std::string::npos) { throw XConfigRead(s, "section name is missing"); } - String name = line.substr(i); + std::string name = line.substr(i); i = name.find_first_of(" \t"); - if (i != String::npos) { + if (i != std::string::npos) { throw XConfigRead(s, "unexpected data after section name"); } @@ -703,7 +680,7 @@ void Config::readSectionOptions(ConfigReadContext& s) { - String line; + std::string line; while (s.readLine(line)) { // check for end of section if (line == "end") { @@ -714,8 +691,8 @@ // nameAndArgs := [(arg[,...])] // values := valueAndArgs[,valueAndArgs]... // valueAndArgs := [(arg[,...])] - String::size_type i = 0; - String name, value; + std::string::size_type i = 0; + std::string name, value; ConfigReadContext::ArgList nameArgs, valueArgs; s.parseNameWithArgs("name", line, "=", i, name, nameArgs); ++i; @@ -728,8 +705,7 @@ m_barrierAddress.resolve(); } catch (XSocketAddress& e) { - throw XConfigRead(s, - String("invalid address argument ") + e.what()); + throw XConfigRead(s, std::string("invalid address argument ") + e.what()); } } else if (name == "heartbeat") { @@ -799,7 +775,7 @@ if (i < line.length() && line[i] == ';') { // allow trailing ';' i = line.find_first_not_of(" \t", i + 1); - if (i == String::npos) { + if (i == std::string::npos) { i = line.length(); } else { @@ -825,9 +801,9 @@ void Config::readSectionScreens(ConfigReadContext& s) { - String line; - String screen; - while (s.readLine(line)) { + std::string line; + std::string screen; + while (s.readLine(line)) { // check for end of section if (line == "end") { return; @@ -853,21 +829,21 @@ } else { // parse argument: `=' - String::size_type i = line.find_first_of(" \t="); + std::string::size_type i = line.find_first_of(" \t="); if (i == 0) { throw XConfigRead(s, "missing argument name"); } - if (i == String::npos) { + if (i == std::string::npos) { throw XConfigRead(s, "missing ="); } - String name = line.substr(0, i); + std::string name = line.substr(0, i); i = line.find_first_not_of(" \t", i); - if (i == String::npos || line[i] != '=') { + if (i == std::string::npos || line[i] != '=') { throw XConfigRead(s, "missing ="); } i = line.find_first_not_of(" \t", i + 1); - String value; - if (i != String::npos) { + std::string value; + if (i != std::string::npos) { value = line.substr(i); } @@ -936,8 +912,8 @@ void Config::readSectionLinks(ConfigReadContext& s) { - String line; - String screen; + std::string line; + std::string screen; while (s.readLine(line)) { // check for end of section if (line == "end") { @@ -965,8 +941,8 @@ // the stuff in brackets is optional. interval values must be // in the range [0,100] and start < end. if not given the // interval is taken to be (0,100). - String::size_type i = 0; - String side, dstScreen, srcArgString, dstArgString; + std::string::size_type i = 0; + std::string side, dstScreen, srcArgString, dstArgString; ConfigReadContext::ArgList srcArgs, dstArgs; s.parseNameWithArgs("link", line, "=", i, side, srcArgs); ++i; @@ -1009,8 +985,8 @@ void Config::readSectionAliases(ConfigReadContext& s) { - String line; - String screen; + std::string line; + std::string screen; while (s.readLine(line)) { // check for end of section if (line == "end") { @@ -1049,9 +1025,8 @@ } -InputFilter::Condition* -Config::parseCondition(ConfigReadContext& s, - const String& name, const std::vector& args) +InputFilter::Condition* Config::parseCondition(ConfigReadContext& s, const std::string& name, + const std::vector& args) { if (name == "keystroke") { if (args.size() != 1) { @@ -1078,7 +1053,7 @@ throw XConfigRead(s, "syntax for condition: connect([screen])"); } - String screen = args[0]; + std::string screen = args[0]; if (isScreen(screen)) { screen = getCanonicalName(screen); } @@ -1092,10 +1067,9 @@ throw XConfigRead(s, "unknown argument \"%{1}\"", name); } -void -Config::parseAction(ConfigReadContext& s, - const String& name, const std::vector& args, - InputFilter::Rule& rule, bool activate) +void Config::parseAction(ConfigReadContext& s, const std::string& name, + const std::vector& args, + InputFilter::Rule& rule, bool activate) { InputFilter::Action* action; @@ -1109,7 +1083,7 @@ keyInfo = s.parseKeystroke(args[0]); } else { - std::set screens; + std::set screens; parseScreens(s, args[1], screens); keyInfo = s.parseKeystroke(args[0], screens); } @@ -1171,7 +1145,7 @@ throw XConfigRead(s, "syntax for action: switchToScreen(name)"); } - String screen = args[0]; + std::string screen = args[0]; if (isScreen(screen)) { screen = getCanonicalName(screen); } @@ -1182,6 +1156,10 @@ action = new InputFilter::SwitchToScreenAction(m_events, screen); } + else if (name == "toggleScreen") { + action = new InputFilter::ToggleScreenAction(m_events); + } + else if (name == "switchInDirection") { if (args.size() != 1) { throw XConfigRead(s, "syntax for action: switchInDirection()"); @@ -1258,7 +1236,7 @@ } } - std::set screens; + std::set screens; if (args.size() >= 2) { parseScreens(s, args[1], screens); } @@ -1273,22 +1251,21 @@ rule.adoptAction(action, activate); } -void -Config::parseScreens(ConfigReadContext& c, - const String& s, std::set& screens) const +void Config::parseScreens(ConfigReadContext& c, const std::string& s, + std::set& screens) const { screens.clear(); - String::size_type i = 0; + std::string::size_type i = 0; while (i < s.size()) { // find end of next screen name - String::size_type j = s.find(':', i); - if (j == String::npos) { + std::string::size_type j = s.find(':', i); + if (j == std::string::npos) { j = s.size(); } // extract name - String rawName; + std::string rawName; i = s.find_first_not_of(" \t", i); if (i < j) { rawName = s.substr(i, s.find_last_not_of(" \t", j - 1) - i + 1); @@ -1299,7 +1276,7 @@ screens.insert("*"); } else if (!rawName.empty()) { - String name = getCanonicalName(rawName); + std::string name = getCanonicalName(rawName); if (name.empty()) { throw XConfigRead(c, "unknown screen name \"%{1}\"", rawName); } @@ -1386,8 +1363,7 @@ return NULL; } -String -Config::getOptionValue(OptionID id, OptionValue value) +std::string Config::getOptionValue(OptionID id, OptionValue value) { if (id == kOptionHalfDuplexCapsLock || id == kOptionHalfDuplexNumLock || @@ -1463,17 +1439,16 @@ // Config::Name // -Config::Name::Name(Config* config, const String& name) : +Config::Name::Name(Config* config, const std::string& name) : m_config(config), m_name(config->getCanonicalName(name)) { // do nothing } -bool -Config::Name::operator==(const String& name) const +bool Config::Name::operator==(const std::string& name) const { - String canonical = m_config->getCanonicalName(name); + std::string canonical = m_config->getCanonicalName(name); return CaselessCmp::equal(canonical, m_name); } @@ -1496,8 +1471,7 @@ init("", side, interval); } -Config::CellEdge::CellEdge(const String& name, - EDirection side, const Interval& interval) +Config::CellEdge::CellEdge(const std::string& name, EDirection side, const Interval& interval) { assert(interval.first >= 0.0f); assert(interval.second <= 1.0f); @@ -1511,9 +1485,7 @@ // do nothing } -void -Config::CellEdge::init(const String& name, EDirection side, - const Interval& interval) +void Config::CellEdge::init(const std::string& name, EDirection side, const Interval& interval) { assert(side != kNoDirection); @@ -1528,14 +1500,12 @@ return m_interval; } -void -Config::CellEdge::setName(const String& newName) +void Config::CellEdge::setName(const std::string& newName) { m_name = newName; } -String -Config::CellEdge::getName() const +std::string Config::CellEdge::getName() const { return m_name; } @@ -1662,8 +1632,7 @@ } } -void -Config::Cell::rename(const Name& oldName, const String& newName) +void Config::Cell::rename(const Name& oldName, const std::string& newName) { for (EdgeLinks::iterator j = m_neighbors.begin(); j != m_neighbors.end(); ++j) { @@ -1789,8 +1758,7 @@ option = options->begin(); option != options->end(); ++option) { const char* name = Config::getOptionName(option->first); - String value = Config::getOptionValue(option->first, - option->second); + std::string value = Config::getOptionValue(option->first, option->second); if (name != NULL && !value.empty()) { s << "\t\t" << name << " = " << value << std::endl; } @@ -1800,7 +1768,7 @@ s << "end" << std::endl; // links section - String neighbor; + std::string neighbor; s << "section: links" << std::endl; for (Config::const_iterator screen = config.begin(); screen != config.end(); ++screen) { @@ -1821,8 +1789,7 @@ // aliases section (if there are any) if (config.m_map.size() != config.m_nameToCanonicalName.size()) { // map canonical to alias - typedef std::multimap CMNameMap; + typedef std::multimap CMNameMap; CMNameMap aliases; for (Config::NameMap::const_iterator index = config.m_nameToCanonicalName.begin(); @@ -1834,7 +1801,7 @@ } // dump it - String screen; + std::string screen; s << "section: aliases" << std::endl; for (CMNameMap::const_iterator index = aliases.begin(); index != aliases.end(); ++index) { @@ -1855,8 +1822,7 @@ option = options->begin(); option != options->end(); ++option) { const char* name = Config::getOptionName(option->first); - String value = Config::getOptionValue(option->first, - option->second); + std::string value = Config::getOptionValue(option->first, option->second); if (name != NULL && !value.empty()) { s << "\t" << name << " = " << value << std::endl; } @@ -1889,24 +1855,23 @@ // do nothing } -bool -ConfigReadContext::readLine(String& line) +bool ConfigReadContext::readLine(std::string& line) { ++m_line; while (std::getline(m_stream, line)) { // strip leading whitespace - String::size_type i = line.find_first_not_of(" \t"); - if (i != String::npos) { - line.erase(0, i); + std::string::size_type i = line.find_first_not_of(" \t"); + if (i != std::string::npos) { + line.erase(0, i); } // strip comments and then trailing whitespace i = line.find('#'); - if (i != String::npos) { + if (i != std::string::npos) { line.erase(i); } i = line.find_last_not_of(" \r\t"); - if (i != String::npos) { + if (i != std::string::npos) { line.erase(i + 1); } @@ -1942,8 +1907,7 @@ return !m_stream; } -OptionValue -ConfigReadContext::parseBoolean(const String& arg) const +OptionValue ConfigReadContext::parseBoolean(const std::string& arg) const { if (CaselessCmp::equal(arg, "true")) { return static_cast(true); @@ -1954,8 +1918,7 @@ throw XConfigRead(*this, "invalid boolean argument \"%{1}\"", arg); } -OptionValue -ConfigReadContext::parseInt(const String& arg) const +OptionValue ConfigReadContext::parseInt(const std::string& arg) const { const char* s = arg.c_str(); char* end; @@ -1972,8 +1935,7 @@ return value; } -OptionValue -ConfigReadContext::parseModifierKey(const String& arg) const +OptionValue ConfigReadContext::parseModifierKey(const std::string& arg) const { if (CaselessCmp::equal(arg, "shift")) { return static_cast(kKeyModifierIDShift); @@ -1999,8 +1961,7 @@ throw XConfigRead(*this, "invalid argument \"%{1}\"", arg); } -OptionValue -ConfigReadContext::parseCorner(const String& arg) const +OptionValue ConfigReadContext::parseCorner(const std::string& arg) const { if (CaselessCmp::equal(arg, "left")) { return kTopLeftMask | kBottomLeftMask; @@ -2035,22 +1996,21 @@ throw XConfigRead(*this, "invalid argument \"%{1}\"", arg); } -OptionValue -ConfigReadContext::parseCorners(const String& args) const +OptionValue ConfigReadContext::parseCorners(const std::string& args) const { // find first token - String::size_type i = args.find_first_not_of(" \t", 0); - if (i == String::npos) { + std::string::size_type i = args.find_first_not_of(" \t", 0); + if (i == std::string::npos) { throw XConfigRead(*this, "missing corner argument"); } - String::size_type j = args.find_first_of(" \t", i); + std::string::size_type j = args.find_first_of(" \t", i); // parse first corner token OptionValue corners = parseCorner(args.substr(i, j - i)); // get +/- i = args.find_first_not_of(" \t", j); - while (i != String::npos) { + while (i != std::string::npos) { // parse +/- bool add; if (args[i] == '-') { @@ -2060,15 +2020,14 @@ add = true; } else { - throw XConfigRead(*this, - "invalid corner operator \"%{1}\"", - String(args.c_str() + i, 1)); + throw XConfigRead(*this, "invalid corner operator \"%{1}\"", + std::string(args.c_str() + i, 1)); } // get next corner token i = args.find_first_not_of(" \t", i + 1); j = args.find_first_of(" \t", i); - if (i == String::npos) { + if (i == std::string::npos) { throw XConfigRead(*this, "missing corner argument"); } @@ -2114,21 +2073,19 @@ return Config::Interval(startValue / 100.0f, endValue / 100.0f); } -void -ConfigReadContext::parseNameWithArgs( - const String& type, const String& line, - const String& delim, String::size_type& index, - String& name, ArgList& args) const +void ConfigReadContext::parseNameWithArgs(const std::string& type, const std::string& line, + const std::string& delim, std::string::size_type& index, + std::string& name, ArgList& args) const { // skip leading whitespace - String::size_type i = line.find_first_not_of(" \t", index); - if (i == String::npos) { - throw XConfigRead(*this, String("missing ") + type); + std::string::size_type i = line.find_first_not_of(" \t", index); + if (i == std::string::npos) { + throw XConfigRead(*this, std::string("missing ") + type); } // find end of name - String::size_type j = line.find_first_of(" \t(" + delim, i); - if (j == String::npos) { + std::string::size_type j = line.find_first_of(" \t(" + delim, i); + if (j == std::string::npos) { j = line.length(); } @@ -2137,15 +2094,15 @@ args.clear(); // is it okay to not find a delimiter? - bool needDelim = (!delim.empty() && delim.find('\n') == String::npos); + bool needDelim = (!delim.empty() && delim.find('\n') == std::string::npos); // skip whitespace i = line.find_first_not_of(" \t", j); - if (i == String::npos && needDelim) { + if (i == std::string::npos && needDelim) { // expected delimiter but didn't find it - throw XConfigRead(*this, String("missing ") + delim[0]); + throw XConfigRead(*this, std::string("missing ") + delim[0]); } - if (i == String::npos) { + if (i == std::string::npos) { // no arguments index = line.length(); return; @@ -2161,18 +2118,18 @@ // parse arguments j = line.find_first_of(",)", i); - while (j != String::npos) { + while (j != std::string::npos) { // extract arg - String arg(line.substr(i, j - i)); + std::string arg(line.substr(i, j - i)); i = j; // trim whitespace j = arg.find_first_not_of(" \t"); - if (j != String::npos) { + if (j != std::string::npos) { arg.erase(0, j); } j = arg.find_last_not_of(" \t"); - if (j != String::npos) { + if (j != std::string::npos) { arg.erase(j + 1); } @@ -2192,7 +2149,7 @@ } // verify ')' - if (j == String::npos) { + if (j == std::string::npos) { // expected ) throw XConfigRead(*this, "missing )"); } @@ -2202,17 +2159,17 @@ // skip whitespace j = line.find_first_not_of(" \t", i); - if (j == String::npos && needDelim) { + if (j == std::string::npos && needDelim) { // expected delimiter but didn't find it - throw XConfigRead(*this, String("missing ") + delim[0]); + throw XConfigRead(*this, std::string("missing ") + delim[0]); } // verify delimiter - if (needDelim && delim.find(line[j]) == String::npos) { - throw XConfigRead(*this, String("expected ") + delim[0]); + if (needDelim && delim.find(line[j]) == std::string::npos) { + throw XConfigRead(*this, std::string("expected ") + delim[0]); } - if (j == String::npos) { + if (j == std::string::npos) { j = line.length(); } @@ -2220,17 +2177,15 @@ return; } -IPlatformScreen::KeyInfo* -ConfigReadContext::parseKeystroke(const String& keystroke) const +IPlatformScreen::KeyInfo* ConfigReadContext::parseKeystroke(const std::string& keystroke) const { - return parseKeystroke(keystroke, std::set()); + return parseKeystroke(keystroke, std::set()); } -IPlatformScreen::KeyInfo* -ConfigReadContext::parseKeystroke(const String& keystroke, - const std::set& screens) const +IPlatformScreen::KeyInfo* ConfigReadContext::parseKeystroke(const std::string& keystroke, + const std::set& screens) const { - String s = keystroke; + std::string s = keystroke; KeyModifierMask mask; if (!barrier::KeyMap::parseModifiers(s, mask)) { @@ -2250,9 +2205,9 @@ } IPlatformScreen::ButtonInfo* -ConfigReadContext::parseMouse(const String& mouse) const +ConfigReadContext::parseMouse(const std::string& mouse) const { - String s = mouse; + std::string s = mouse; KeyModifierMask mask; if (!barrier::KeyMap::parseModifiers(s, mask)) { @@ -2271,10 +2226,9 @@ return IPlatformScreen::ButtonInfo::alloc(button, mask); } -KeyModifierMask -ConfigReadContext::parseModifier(const String& modifiers) const +KeyModifierMask ConfigReadContext::parseModifier(const std::string& modifiers) const { - String s = modifiers; + std::string s = modifiers; KeyModifierMask mask; if (!barrier::KeyMap::parseModifiers(s, mask)) { @@ -2288,10 +2242,9 @@ return mask; } -String -ConfigReadContext::concatArgs(const ArgList& args) +std::string ConfigReadContext::concatArgs(const ArgList& args) { - String s("("); + std::string s("("); for (size_t i = 0; i < args.size(); ++i) { if (i != 0) { s += ","; @@ -2307,29 +2260,27 @@ // Config I/O exceptions // -XConfigRead::XConfigRead(const ConfigReadContext& context, - const String& error) : +XConfigRead::XConfigRead(const ConfigReadContext& context, const std::string& error) : m_error(barrier::string::sprintf("line %d: %s", context.getLineNumber(), error.c_str())) { // do nothing } -XConfigRead::XConfigRead(const ConfigReadContext& context, - const char* errorFmt, const String& arg) : +XConfigRead::XConfigRead(const ConfigReadContext& context, const char* errorFmt, + const std::string& arg) : m_error(barrier::string::sprintf("line %d: ", context.getLineNumber()) + barrier::string::format(errorFmt, arg.c_str())) { // do nothing } -XConfigRead::~XConfigRead() _NOEXCEPT +XConfigRead::~XConfigRead() noexcept { // do nothing } -String -XConfigRead::getWhat() const throw() +std::string XConfigRead::getWhat() const noexcept { return format("XConfigRead", "read error: %{1}", m_error.c_str()); } diff -Nru barrier-2.3.2+dfsg/src/lib/server/Config.h barrier-2.3.3+dfsg/src/lib/server/Config.h --- barrier-2.3.2+dfsg/src/lib/server/Config.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/Config.h 2020-07-14 17:37:45.000000000 +0000 @@ -23,7 +23,6 @@ #include "barrier/protocol_types.h" #include "barrier/IPlatformScreen.h" #include "net/NetworkAddress.h" -#include "base/String.h" #include "base/XBase.h" #include "common/stdmap.h" #include "common/stdset.h" @@ -37,11 +36,11 @@ namespace std { template <> struct iterator_traits { - typedef String value_type; + typedef std::string value_type; typedef ptrdiff_t difference_type; typedef bidirectional_iterator_tag iterator_category; - typedef String* pointer; - typedef String& reference; + typedef std::string* pointer; + typedef std::string& reference; }; }; @@ -64,12 +63,12 @@ public: CellEdge(EDirection side, float position); CellEdge(EDirection side, const Interval&); - CellEdge(const String& name, EDirection side, const Interval&); + CellEdge(const std::string& name, EDirection side, const Interval&); ~CellEdge(); Interval getInterval() const; - void setName(const String& newName); - String getName() const; + void setName(const std::string& newName); + std::string getName() const; EDirection getSide() const; bool overlaps(const CellEdge&) const; bool isInside(float x) const; @@ -88,11 +87,10 @@ bool operator!=(const CellEdge&) const; private: - void init(const String& name, EDirection side, - const Interval&); + void init(const std::string& name, EDirection side, const Interval&); private: - String m_name; + std::string m_name; EDirection m_side; Interval m_interval; }; @@ -100,13 +98,13 @@ private: class Name { public: - Name(Config*, const String& name); + Name(Config*, const std::string& name); - bool operator==(const String& name) const; + bool operator==(const std::string& name) const; private: Config* m_config; - String m_name; + std::string m_name; }; class Cell { @@ -120,7 +118,7 @@ void remove(EDirection side); void remove(EDirection side, float position); void remove(const Name& destinationName); - void rename(const Name& oldName, const String& newName); + void rename(const Name& oldName, const std::string& newName); bool hasEdge(const CellEdge&) const; bool overlaps(const CellEdge&) const; @@ -140,8 +138,8 @@ public: ScreenOptions m_options; }; - typedef std::map CellMap; - typedef std::map NameMap; + typedef std::map CellMap; + typedef std::map NameMap; public: typedef Cell::const_iterator link_const_iterator; @@ -156,8 +154,8 @@ m_i = i.m_i; return *this; } - String operator*() { return m_i->first; } - const String* operator->() { return &(m_i->first); } + std::string operator*() { return m_i->first; } + const std::string* operator->() { return &(m_i->first); } const_iterator& operator++() { ++m_i; return *this; } const_iterator operator++(int) { return const_iterator(m_i++); } const_iterator& operator--() { --m_i; return *this; } @@ -188,15 +186,14 @@ Adds a screen, returning true iff successful. If a screen or alias with the given name exists then it fails. */ - bool addScreen(const String& name); + bool addScreen(const std::string& name); //! Rename screen /*! Renames a screen. All references to the name are updated. Returns true iff successful. */ - bool renameScreen(const String& oldName, - const String& newName); + bool renameScreen(const std::string& oldName, const std::string& newName); //! Remove screen /*! @@ -204,7 +201,7 @@ disconnects any connections to the screen. \c name may be an alias. */ - void removeScreen(const String& name); + void removeScreen(const std::string& name); //! Remove all screens /*! @@ -219,22 +216,21 @@ Returns false if the alias name already exists or the canonical name is unknown, otherwise returns true. */ - bool addAlias(const String& canonical, - const String& alias); + bool addAlias(const std::string& canonical, const std::string& alias); //! Remove alias /*! Removes an alias for a screen name. It returns false if the alias is unknown or a canonical name, otherwise returns true. */ - bool removeAlias(const String& alias); + bool removeAlias(const std::string& alias); //! Remove aliases /*! Removes all aliases for a canonical screen name. It returns false if the canonical name is unknown, otherwise returns true. */ - bool removeAliases(const String& canonical); + bool removeAliases(const std::string& canonical); //! Remove all aliases /*! @@ -258,19 +254,15 @@ and all of \c srcStart, \c srcEnd, \c dstStart, or \c dstEnd must be inside the range [0,1]. */ - bool connect(const String& srcName, - EDirection srcSide, - float srcStart, float srcEnd, - const String& dstName, - float dstStart, float dstEnd); + bool connect(const std::string& srcName, EDirection srcSide, float srcStart, float srcEnd, + const std::string& dstName, float dstStart, float dstEnd); //! Disconnect screens /*! Removes all connections created by connect() on side \c srcSide. Returns false if \c srcName is unknown. */ - bool disconnect(const String& srcName, - EDirection srcSide); + bool disconnect(const std::string& srcName, EDirection srcSide); //! Disconnect screens /*! @@ -278,8 +270,7 @@ covering position \c position. Returns false if \c srcName is unknown. */ - bool disconnect(const String& srcName, - EDirection srcSide, float position); + bool disconnect(const std::string& srcName, EDirection srcSide, float position); //! Set server address /*! @@ -294,8 +285,7 @@ existing option's value if there is one. Returns true iff \c name is a known screen. */ - bool addOption(const String& name, - OptionID option, OptionValue value); + bool addOption(const std::string& name, OptionID option, OptionValue value); //! Remove a screen option /*! @@ -303,14 +293,14 @@ nothing if the option doesn't exist on the screen. Returns true iff \c name is a known screen. */ - bool removeOption(const String& name, OptionID option); + bool removeOption(const std::string& name, OptionID option); //! Remove a screen options /*! Removes all options and values from the named screen. Returns true iff \c name is a known screen. */ - bool removeOptions(const String& name); + bool removeOptions(const std::string& name); //! Get the hot key input filter /*! @@ -328,7 +318,7 @@ /*! Returns true iff \c name is a valid screen name. */ - bool isValidScreenName(const String& name) const; + bool isValidScreenName(const std::string& name) const; //! Get beginning (canonical) screen name iterator const_iterator begin() const; @@ -344,20 +334,20 @@ /*! Returns true iff \c name names a screen. */ - virtual bool isScreen(const String& name) const; + virtual bool isScreen(const std::string& name) const; //! Test for canonical screen name /*! Returns true iff \c name is the canonical name of a screen. */ - bool isCanonicalName(const String& name) const; + bool isCanonicalName(const std::string& name) const; //! Get canonical name /*! Returns the canonical name of a screen or the empty string if the name is unknown. Returns the canonical name if one is given. */ - String getCanonicalName(const String& name) const; + std::string getCanonicalName(const std::string& name) const; //! Get neighbor /*! @@ -367,7 +357,7 @@ saves the position on the neighbor in \c positionOut if it's not \c NULL. */ - String getNeighbor(const String&, EDirection, + std::string getNeighbor(const std::string&, EDirection, float position, float* positionOut) const; //! Check for neighbor @@ -375,20 +365,19 @@ Returns \c true if the screen has a neighbor anywhere along the edge given by the direction. */ - bool hasNeighbor(const String&, EDirection) const; + bool hasNeighbor(const std::string&, EDirection) const; //! Check for neighbor /*! Returns \c true if the screen has a neighbor in the given range along the edge given by the direction. */ - bool hasNeighbor(const String&, EDirection, - float start, float end) const; + bool hasNeighbor(const std::string&, EDirection, float start, float end) const; //! Get beginning neighbor iterator - link_const_iterator beginNeighbor(const String&) const; + link_const_iterator beginNeighbor(const std::string&) const; //! Get ending neighbor iterator - link_const_iterator endNeighbor(const String&) const; + link_const_iterator endNeighbor(const std::string&) const; //! Get the server address const NetworkAddress& @@ -400,8 +389,7 @@ if the screen is unknown and an empty collection if there are no options. */ - const ScreenOptions* - getOptions(const String& name) const; + const ScreenOptions* getOptions(const std::string& name) const; //! Check for lock to screen action /*! @@ -446,7 +434,7 @@ /*! Returns an interval as a parseable string. */ - static String formatInterval(const Interval&); + static std::string formatInterval(const Interval&); //@} @@ -457,19 +445,16 @@ void readSectionLinks(ConfigReadContext&); void readSectionAliases(ConfigReadContext&); - InputFilter::Condition* - parseCondition(ConfigReadContext&, - const String& condition, - const std::vector& args); - void parseAction(ConfigReadContext&, - const String& action, - const std::vector& args, - InputFilter::Rule&, bool activate); + InputFilter::Condition* parseCondition(ConfigReadContext&, const std::string& condition, + const std::vector& args); + + void parseAction(ConfigReadContext&, const std::string& action, + const std::vector& args, InputFilter::Rule&, bool activate); + + void parseScreens(ConfigReadContext&, const std::string&, std::set& screens) const; - void parseScreens(ConfigReadContext&, const String&, - std::set& screens) const; static const char* getOptionName(OptionID); - static String getOptionValue(OptionID, OptionValue); + static std::string getOptionValue(OptionID, OptionValue); private: CellMap m_map; @@ -487,42 +472,41 @@ */ class ConfigReadContext { public: - typedef std::vector ArgList; + typedef std::vector ArgList; ConfigReadContext(std::istream&, SInt32 firstLine = 1); ~ConfigReadContext(); - bool readLine(String&); + bool readLine(std::string&); UInt32 getLineNumber() const; bool operator!() const; - OptionValue parseBoolean(const String&) const; - OptionValue parseInt(const String&) const; - OptionValue parseModifierKey(const String&) const; - OptionValue parseCorner(const String&) const; - OptionValue parseCorners(const String&) const; - Config::Interval - parseInterval(const ArgList& args) const; - void parseNameWithArgs( - const String& type, const String& line, - const String& delim, String::size_type& index, - String& name, ArgList& args) const; - IPlatformScreen::KeyInfo* - parseKeystroke(const String& keystroke) const; - IPlatformScreen::KeyInfo* - parseKeystroke(const String& keystroke, - const std::set& screens) const; - IPlatformScreen::ButtonInfo* - parseMouse(const String& mouse) const; - KeyModifierMask parseModifier(const String& modifiers) const; + OptionValue parseBoolean(const std::string&) const; + OptionValue parseInt(const std::string&) const; + OptionValue parseModifierKey(const std::string&) const; + OptionValue parseCorner(const std::string&) const; + OptionValue parseCorners(const std::string&) const; + + Config::Interval parseInterval(const ArgList& args) const; + + void parseNameWithArgs(const std::string& type, const std::string& line, + const std::string& delim, std::string::size_type& index, + std::string& name, ArgList& args) const; + + IPlatformScreen::KeyInfo* parseKeystroke(const std::string& keystroke) const; + IPlatformScreen::KeyInfo* parseKeystroke(const std::string& keystroke, + const std::set& screens) const; + IPlatformScreen::ButtonInfo* parseMouse(const std::string& mouse) const; + KeyModifierMask parseModifier(const std::string& modifiers) const; + std::istream& getStream() const { return m_stream; }; private: // not implemented ConfigReadContext& operator=(const ConfigReadContext&); - static String concatArgs(const ArgList& args); + static std::string concatArgs(const ArgList& args); private: std::istream& m_stream; @@ -535,15 +519,14 @@ */ class XConfigRead : public XBase { public: - XConfigRead(const ConfigReadContext& context, const String&); - XConfigRead(const ConfigReadContext& context, - const char* errorFmt, const String& arg); - virtual ~XConfigRead() _NOEXCEPT; + XConfigRead(const ConfigReadContext& context, const std::string&); + XConfigRead(const ConfigReadContext& contex, const char* errorFmt, const std::string& arg); + virtual ~XConfigRead() noexcept; protected: // XBase overrides - virtual String getWhat() const throw(); + virtual std::string getWhat() const noexcept; private: - String m_error; + std::string m_error; }; diff -Nru barrier-2.3.2+dfsg/src/lib/server/InputFilter.cpp barrier-2.3.3+dfsg/src/lib/server/InputFilter.cpp --- barrier-2.3.2+dfsg/src/lib/server/InputFilter.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/InputFilter.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -95,8 +95,7 @@ return new KeystrokeCondition(m_events, m_key, m_mask); } -String -InputFilter::KeystrokeCondition::format() const +std::string InputFilter::KeystrokeCondition::format() const { return barrier::string::sprintf("keystroke(%s)", barrier::KeyMap::formatKey(m_key, m_mask).c_str()); @@ -183,10 +182,9 @@ return new MouseButtonCondition(m_events, m_button, m_mask); } -String -InputFilter::MouseButtonCondition::format() const +std::string InputFilter::MouseButtonCondition::format() const { - String key = barrier::KeyMap::formatKey(kKeyNone, m_mask); + std::string key = barrier::KeyMap::formatKey(kKeyNone, m_mask); if (!key.empty()) { key += "+"; } @@ -226,8 +224,8 @@ return status; } -InputFilter::ScreenConnectedCondition::ScreenConnectedCondition( - IEventQueue* events, const String& screen) : +InputFilter::ScreenConnectedCondition::ScreenConnectedCondition(IEventQueue* events, + const std::string& screen) : m_screen(screen), m_events(events) { @@ -245,8 +243,7 @@ return new ScreenConnectedCondition(m_events, m_screen); } -String -InputFilter::ScreenConnectedCondition::format() const +std::string InputFilter::ScreenConnectedCondition::format() const { return barrier::string::sprintf("connect(%s)", m_screen.c_str()); } @@ -298,8 +295,7 @@ return new LockCursorToScreenAction(*this); } -String -InputFilter::LockCursorToScreenAction::format() const +std::string InputFilter::LockCursorToScreenAction::format() const { static const char* s_mode[] = { "off", "on", "toggle" }; @@ -323,16 +319,15 @@ Event::kDeliverImmediately)); } -InputFilter::SwitchToScreenAction::SwitchToScreenAction( - IEventQueue* events, const String& screen) : +InputFilter::SwitchToScreenAction::SwitchToScreenAction(IEventQueue* events, + const std::string& screen) : m_screen(screen), m_events(events) { // do nothing } -String -InputFilter::SwitchToScreenAction::getScreen() const +std::string InputFilter::SwitchToScreenAction::getScreen() const { return m_screen; } @@ -343,8 +338,7 @@ return new SwitchToScreenAction(*this); } -String -InputFilter::SwitchToScreenAction::format() const +std::string InputFilter::SwitchToScreenAction::format() const { return barrier::string::sprintf("switchToScreen(%s)", m_screen.c_str()); } @@ -354,7 +348,7 @@ { // pick screen name. if m_screen is empty then use the screen from // event if it has one. - String screen = m_screen; + std::string screen = m_screen; if (screen.empty() && event.getType() == m_events->forServer().connected()) { Server::ScreenConnectedInfo* info = static_cast(event.getData()); @@ -369,6 +363,32 @@ Event::kDeliverImmediately)); } +InputFilter::ToggleScreenAction::ToggleScreenAction(IEventQueue* events) : + m_events(events) +{ + // do nothing +} + +InputFilter::Action* +InputFilter::ToggleScreenAction::clone() const +{ + return new ToggleScreenAction(*this); +} + +String +InputFilter::ToggleScreenAction::format() const +{ + return barrier::string::sprintf("toggleScreen"); +} + +void +InputFilter::ToggleScreenAction::perform(const Event& event) +{ + m_events->addEvent(Event(m_events->forServer().toggleScreen(), + event.getTarget(), NULL, + Event::kDeliverImmediately)); +} + InputFilter::SwitchInDirectionAction::SwitchInDirectionAction( IEventQueue* events, EDirection direction) : m_direction(direction), @@ -389,8 +409,7 @@ return new SwitchInDirectionAction(*this); } -String -InputFilter::SwitchInDirectionAction::format() const +std::string InputFilter::SwitchInDirectionAction::format() const { static const char* s_names[] = { "", @@ -421,10 +440,8 @@ // do nothing } -InputFilter::KeyboardBroadcastAction::KeyboardBroadcastAction( - IEventQueue* events, - Mode mode, - const std::set& screens) : +InputFilter::KeyboardBroadcastAction::KeyboardBroadcastAction(IEventQueue* events, Mode mode, + const std::set& screens) : m_mode(mode), m_screens(IKeyState::KeyInfo::join(screens)), m_events(events) @@ -438,10 +455,9 @@ return m_mode; } -std::set -InputFilter::KeyboardBroadcastAction::getScreens() const +std::set InputFilter::KeyboardBroadcastAction::getScreens() const { - std::set screens; + std::set screens; IKeyState::KeyInfo::split(m_screens.c_str(), screens); return screens; } @@ -452,8 +468,7 @@ return new KeyboardBroadcastAction(*this); } -String -InputFilter::KeyboardBroadcastAction::format() const +std::string InputFilter::KeyboardBroadcastAction::format() const { static const char* s_mode[] = { "off", "on", "toggle" }; static const char* s_name = "keyboardBroadcast"; @@ -525,8 +540,7 @@ return new KeystrokeAction(m_events, info, m_press); } -String -InputFilter::KeystrokeAction::format() const +std::string InputFilter::KeystrokeAction::format() const { const char* type = formatName(); @@ -607,12 +621,11 @@ return new MouseButtonAction(m_events, info, m_press); } -String -InputFilter::MouseButtonAction::format() const +std::string InputFilter::MouseButtonAction::format() const { const char* type = formatName(); - String key = barrier::KeyMap::formatKey(kKeyNone, m_buttonInfo->m_mask); + std::string key = barrier::KeyMap::formatKey(kKeyNone, m_buttonInfo->m_mask); return barrier::string::sprintf("%s(%s%s%d)", type, key.c_str(), key.empty() ? "" : "+", m_buttonInfo->m_button); @@ -820,10 +833,9 @@ return true; } -String -InputFilter::Rule::format() const +std::string InputFilter::Rule::format() const { - String s; + std::string s; if (m_condition != NULL) { // condition s += m_condition->format(); @@ -1019,10 +1031,9 @@ } } -String -InputFilter::format(const String& linePrefix) const +std::string InputFilter::format(const std::string& linePrefix) const { - String s; + std::string s; for (RuleList::const_iterator i = m_ruleList.begin(); i != m_ruleList.end(); ++i) { s += linePrefix; @@ -1048,7 +1059,7 @@ // compare rule lists. the easiest way to do that is to format each // rule into a string, sort the strings, then compare the results. - std::vector aList, bList; + std::vector aList, bList; for (RuleList::const_iterator i = m_ruleList.begin(); i != m_ruleList.end(); ++i) { aList.push_back(i->format()); diff -Nru barrier-2.3.2+dfsg/src/lib/server/InputFilter.h barrier-2.3.3+dfsg/src/lib/server/InputFilter.h --- barrier-2.3.2+dfsg/src/lib/server/InputFilter.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/InputFilter.h 2020-07-14 17:37:45.000000000 +0000 @@ -22,7 +22,6 @@ #include "barrier/mouse_types.h" #include "barrier/protocol_types.h" #include "barrier/IPlatformScreen.h" -#include "base/String.h" #include "common/stdmap.h" #include "common/stdset.h" @@ -47,7 +46,7 @@ virtual ~Condition(); virtual Condition* clone() const = 0; - virtual String format() const = 0; + virtual std::string format() const = 0; virtual EFilterStatus match(const Event&) = 0; @@ -67,7 +66,7 @@ // Condition overrides virtual Condition* clone() const; - virtual String format() const; + virtual std::string format() const; virtual EFilterStatus match(const Event&); virtual void enablePrimary(PrimaryClient*); virtual void disablePrimary(PrimaryClient*); @@ -91,7 +90,7 @@ // Condition overrides virtual Condition* clone() const; - virtual String format() const; + virtual std::string format() const; virtual EFilterStatus match(const Event&); private: @@ -103,16 +102,16 @@ // ScreenConnectedCondition class ScreenConnectedCondition : public Condition { public: - ScreenConnectedCondition(IEventQueue* events, const String& screen); + ScreenConnectedCondition(IEventQueue* events, const std::string& screen); virtual ~ScreenConnectedCondition(); // Condition overrides virtual Condition* clone() const; - virtual String format() const; + virtual std::string format() const; virtual EFilterStatus match(const Event&); private: - String m_screen; + std::string m_screen; IEventQueue* m_events; }; @@ -126,7 +125,7 @@ virtual ~Action(); virtual Action* clone() const = 0; - virtual String format() const = 0; + virtual std::string format() const = 0; virtual void perform(const Event&) = 0; }; @@ -142,7 +141,7 @@ // Action overrides virtual Action* clone() const; - virtual String format() const; + virtual std::string format() const; virtual void perform(const Event&); private: @@ -153,20 +152,34 @@ // SwitchToScreenAction class SwitchToScreenAction : public Action { public: - SwitchToScreenAction(IEventQueue* events, const String& screen); + SwitchToScreenAction(IEventQueue* events, const std::string& screen); - String getScreen() const; + std::string getScreen() const; // Action overrides virtual Action* clone() const; - virtual String format() const; + virtual std::string format() const; virtual void perform(const Event&); private: - String m_screen; + std::string m_screen; IEventQueue* m_events; }; + // ToggleScreenAction + class ToggleScreenAction : public Action { + public: + ToggleScreenAction(IEventQueue* events); + + // Action overrides + virtual Action* clone() const; + virtual String format() const; + virtual void perform(const Event&); + + private: + IEventQueue* m_events; + }; + // SwitchInDirectionAction class SwitchInDirectionAction : public Action { public: @@ -176,7 +189,7 @@ // Action overrides virtual Action* clone() const; - virtual String format() const; + virtual std::string format() const; virtual void perform(const Event&); private: @@ -190,19 +203,19 @@ enum Mode { kOff, kOn, kToggle }; KeyboardBroadcastAction(IEventQueue* events, Mode = kToggle); - KeyboardBroadcastAction(IEventQueue* events, Mode, const std::set& screens); + KeyboardBroadcastAction(IEventQueue* events, Mode, const std::set& screens); Mode getMode() const; - std::set getScreens() const; + std::set getScreens() const; // Action overrides virtual Action* clone() const; - virtual String format() const; + virtual std::string format() const; virtual void perform(const Event&); private: Mode m_mode; - String m_screens; + std::string m_screens; IEventQueue* m_events; }; @@ -219,7 +232,7 @@ // Action overrides virtual Action* clone() const; - virtual String format() const; + virtual std::string format() const; virtual void perform(const Event&); protected: @@ -245,7 +258,7 @@ // Action overrides virtual Action* clone() const; - virtual String format() const; + virtual std::string format() const; virtual void perform(const Event&); protected: @@ -287,7 +300,7 @@ bool handleEvent(const Event&); // convert rule to a string - String format() const; + std::string format() const; // get the rule's condition const Condition* @@ -340,7 +353,7 @@ virtual void setPrimaryClient(PrimaryClient* client); // convert rules to a string - String format(const String& linePrefix) const; + std::string format(const std::string& linePrefix) const; // get number of rules UInt32 getNumRules() const; diff -Nru barrier-2.3.2+dfsg/src/lib/server/PrimaryClient.cpp barrier-2.3.3+dfsg/src/lib/server/PrimaryClient.cpp --- barrier-2.3.2+dfsg/src/lib/server/PrimaryClient.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/PrimaryClient.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -26,7 +26,7 @@ // PrimaryClient // -PrimaryClient::PrimaryClient(const String& name, barrier::Screen* screen) : +PrimaryClient::PrimaryClient(const std::string& name, barrier::Screen* screen) : BaseClientProxy(name), m_screen(screen), m_fakeInputCount(0) diff -Nru barrier-2.3.2+dfsg/src/lib/server/PrimaryClient.h barrier-2.3.3+dfsg/src/lib/server/PrimaryClient.h --- barrier-2.3.2+dfsg/src/lib/server/PrimaryClient.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/PrimaryClient.h 2020-07-14 17:37:45.000000000 +0000 @@ -34,7 +34,7 @@ /*! \c name is the name of the server and \p screen is primary screen. */ - PrimaryClient(const String& name, barrier::Screen* screen); + PrimaryClient(const std::string& name, barrier::Screen* screen); ~PrimaryClient(); #ifdef TEST_ENV diff -Nru barrier-2.3.2+dfsg/src/lib/server/Server.cpp barrier-2.3.3+dfsg/src/lib/server/Server.cpp --- barrier-2.3.2+dfsg/src/lib/server/Server.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/Server.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -43,14 +43,13 @@ #include "base/IEventQueue.h" #include "base/Log.h" #include "base/TMethodEventJob.h" -#include "common/stdexcept.h" #include #include #include #include #include - +#include // // Server // @@ -101,7 +100,7 @@ assert(config.isScreen(primaryClient->getName())); assert(m_screen != NULL); - String primaryName = getName(primaryClient); + std::string primaryName = getName(primaryClient); // clear clipboards for (ClipboardID id = 0; id < kClipboardEnd; ++id) { @@ -163,6 +162,10 @@ m_inputFilter, new TMethodEventJob(this, &Server::handleSwitchToScreenEvent)); + m_events->adoptHandler(m_events->forServer().toggleScreen(), + m_inputFilter, + new TMethodEventJob(this, + &Server::handleToggleScreenEvent)); m_events->adoptHandler(m_events->forServer().switchInDirection(), m_inputFilter, new TMethodEventJob(this, @@ -370,7 +373,7 @@ } void -Server::getClients(std::vector& list) const +Server::getClients(std::vector& list) const { list.clear(); for (ClientList::const_iterator index = m_clients.begin(); @@ -379,10 +382,9 @@ } } -String -Server::getName(const BaseClientProxy* client) const +std::string Server::getName(const BaseClientProxy* client) const { - String name = m_config->getCanonicalName(client->getName()); + std::string name = m_config->getCanonicalName(client->getName()); if (name.empty()) { name = client->getName(); } @@ -600,7 +602,7 @@ assert(src != NULL); // get source screen name - String srcName = getName(src); + std::string srcName = getName(src); assert(!srcName.empty()); LOG((CLOG_DEBUG2 "find neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str())); @@ -610,7 +612,7 @@ // search for the closest neighbor that exists in direction dir float tTmp; for (;;) { - String dstName(m_config->getNeighbor(srcName, dir, t, &tTmp)); + std::string dstName(m_config->getNeighbor(srcName, dir, t, &tTmp)); // if nothing in that direction then return NULL. if the // destination is the source then we can make no more @@ -755,7 +757,7 @@ return; } - const String dstName(getName(dst)); + const std::string dstName(getName(dst)); SInt32 dx, dy, dw, dh; dst->getShape(dx, dy, dw, dh); float t = mapToFraction(dst, dir, x, y); @@ -1408,6 +1410,24 @@ } void +Server::handleToggleScreenEvent(const Event& event, void*) +{ + std::string current = getName(m_active); + ClientList::const_iterator index = m_clients.find(current); + if (index == m_clients.end()) { + LOG((CLOG_DEBUG1 "screen \"%s\" not active", current.c_str())); + } + else { + ++index; + if (index == m_clients.end()) { + index = m_clients.begin(); + } + jumpToScreen(index->second); + } +} + + +void Server::handleSwitchInDirectionEvent(const Event& event, void*) { SwitchInDirectionInfo* info = @@ -1533,7 +1553,7 @@ sender->getClipboard(id, &clipboard.m_clipboard); // ignore if data hasn't changed - String data = clipboard.m_clipboard.marshall(); + std::string data = clipboard.m_clipboard.marshall(); if (data == clipboard.m_clipboardData) { LOG((CLOG_DEBUG "ignored screen \"%s\" update of clipboard %d (unchanged)", clipboard.m_clipboardOwner.c_str(), id)); return; @@ -1703,7 +1723,7 @@ if (m_args.m_enableDragDrop) { if (!m_screen->isOnScreen()) { - String& file = m_screen->getDraggingFilename(); + std::string& file = m_screen->getDraggingFilename(); if (!file.empty()) { sendFileToClient(file.c_str()); } @@ -1829,7 +1849,7 @@ BaseClientProxy* newScreen = static_cast(arg); m_dragFileList.clear(); - String& dragFileList = m_screen->getDraggingFilename(); + std::string& dragFileList = m_screen->getDraggingFilename(); if (!dragFileList.empty()) { DragInformation di; di.setFilename(dragFileList); @@ -1856,7 +1876,7 @@ void Server::sendDragInfo(BaseClientProxy* newScreen) { - String infoString; + std::string infoString; UInt32 fileCount = DragInformation::setupDragInfo(m_dragFileList, infoString); if (fileCount > 0) { @@ -2089,7 +2109,7 @@ bool Server::addClient(BaseClientProxy* client) { - String name = getName(client); + std::string name = getName(client); if (m_clients.count(name) != 0) { return false; } @@ -2313,7 +2333,7 @@ // Server::SwitchToScreenInfo* -Server::SwitchToScreenInfo::alloc(const String& screen) +Server::SwitchToScreenInfo::alloc(const std::string& screen) { SwitchToScreenInfo* info = (SwitchToScreenInfo*)malloc(sizeof(SwitchToScreenInfo) + @@ -2351,7 +2371,7 @@ } Server::KeyboardBroadcastInfo* -Server::KeyboardBroadcastInfo::alloc(State state, const String& screens) +Server::KeyboardBroadcastInfo::alloc(State state, const std::string& screens) { KeyboardBroadcastInfo* info = (KeyboardBroadcastInfo*)malloc(sizeof(KeyboardBroadcastInfo) + @@ -2396,7 +2416,7 @@ } void -Server::dragInfoReceived(UInt32 fileNum, String content) +Server::dragInfoReceived(UInt32 fileNum, std::string content) { if (!m_args.m_enableDragDrop) { LOG((CLOG_DEBUG "drag drop not enabled, ignoring drag info.")); diff -Nru barrier-2.3.2+dfsg/src/lib/server/Server.h barrier-2.3.3+dfsg/src/lib/server/Server.h --- barrier-2.3.2+dfsg/src/lib/server/Server.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/lib/server/Server.h 2020-07-14 17:37:45.000000000 +0000 @@ -62,7 +62,7 @@ //! Switch to screen data class SwitchToScreenInfo { public: - static SwitchToScreenInfo* alloc(const String& screen); + static SwitchToScreenInfo* alloc(const std::string& screen); public: // this is a C-string; this type is a variable size structure @@ -81,10 +81,10 @@ //! Screen connected data class ScreenConnectedInfo { public: - ScreenConnectedInfo(String screen) : m_screen(screen) { } + ScreenConnectedInfo(std::string screen) : m_screen(screen) { } public: - String m_screen; // was char[1] + std::string m_screen; }; //! Keyboard broadcast data @@ -94,7 +94,7 @@ static KeyboardBroadcastInfo* alloc(State state = kToggle); static KeyboardBroadcastInfo* alloc(State state, - const String& screens); + const std::string& screens); public: State m_state; @@ -146,7 +146,7 @@ void sendFileToClient(const char* filename); //! Received dragging information from client - void dragInfoReceived(UInt32 fileNum, String content); + void dragInfoReceived(UInt32 fileNum, std::string content); //! Store ClientListener pointer void setListener(ClientListener* p) { m_clientListener = p; } @@ -165,7 +165,7 @@ /*! Set the \c list to the names of the currently connected clients. */ - void getClients(std::vector& list) const; + void getClients(std::vector& list) const; //! Return true if recieved file size is valid bool isReceivedFileSizeValid(); @@ -174,7 +174,7 @@ size_t& getExpectedFileSize() { return m_expectedFileSize; } //! Return received file data - String& getReceivedFileData() { return m_receivedFileData; } + std::string& getReceivedFileData() { return m_receivedFileData; } //! Return fake drag file list DragFileList getFakeDragFileList() { return m_fakeDragFileList; } @@ -183,7 +183,7 @@ private: // get canonical name of client - String getName(const BaseClientProxy*) const; + std::string getName(const BaseClientProxy*) const; // get the sides of the primary screen that have neighbors UInt32 getActivePrimarySides() const; @@ -308,6 +308,7 @@ void handleClientDisconnected(const Event&, void*); void handleClientCloseTimeout(const Event&, void*); void handleSwitchToScreenEvent(const Event&, void*); + void handleToggleScreenEvent(const Event&, void*); void handleSwitchInDirectionEvent(const Event&, void*); void handleKeyboardBroadcastEvent(const Event&,void*); void handleLockCursorToScreenEvent(const Event&, void*); @@ -378,8 +379,8 @@ public: Clipboard m_clipboard; - String m_clipboardData; - String m_clipboardOwner; + std::string m_clipboardData; + std::string m_clipboardOwner; UInt32 m_clipboardSeqNum; }; @@ -387,7 +388,7 @@ PrimaryClient* m_primaryClient; // all clients (including the primary client) indexed by name - typedef std::map ClientList; + typedef std::map ClientList; typedef std::set ClientSet; ClientList m_clients; ClientSet m_clientSet; @@ -454,7 +455,7 @@ // flag whether or not we have broadcasting enabled and the screens to // which we should send broadcasted keys. bool m_keyboardBroadcasting; - String m_keyboardBroadcastingScreens; + std::string m_keyboardBroadcastingScreens; // screen locking (former scroll lock) bool m_lockedToScreen; @@ -466,12 +467,12 @@ // file transfer size_t m_expectedFileSize; - String m_receivedFileData; + std::string m_receivedFileData; DragFileList m_dragFileList; DragFileList m_fakeDragFileList; Thread* m_sendFileThread; Thread* m_writeToDropDirThread; - String m_dragFileExt; + std::string m_dragFileExt; bool m_ignoreFileTransfer; bool m_enableClipboard; diff -Nru barrier-2.3.2+dfsg/src/test/global/TestEventQueue.cpp barrier-2.3.3+dfsg/src/test/global/TestEventQueue.cpp --- barrier-2.3.2+dfsg/src/test/global/TestEventQueue.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/global/TestEventQueue.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -20,7 +20,7 @@ #include "base/Log.h" #include "base/TMethodEventJob.h" #include "base/SimpleEventQueueBuffer.h" -#include "common/stdexcept.h" +#include void TestEventQueue::raiseQuitEvent() diff -Nru barrier-2.3.2+dfsg/src/test/global/TestEventQueue.h barrier-2.3.3+dfsg/src/test/global/TestEventQueue.h --- barrier-2.3.2+dfsg/src/test/global/TestEventQueue.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/global/TestEventQueue.h 2020-07-14 17:37:45.000000000 +0000 @@ -19,7 +19,7 @@ #include "base/EventQueue.h" -class EventQueueTimer; +class EventQueueTimer {}; class TestEventQueue : public EventQueue { public: diff -Nru barrier-2.3.2+dfsg/src/test/integtests/arch/ArchInternetTests.cpp barrier-2.3.3+dfsg/src/test/integtests/arch/ArchInternetTests.cpp --- barrier-2.3.2+dfsg/src/test/integtests/arch/ArchInternetTests.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/integtests/arch/ArchInternetTests.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -22,16 +22,16 @@ #define TEST_URL "https://symless.com/tests/?testString" //#define TEST_URL "http://localhost/barrier/tests/?testString" -TEST(ArchInternetTests, get) +TEST(ArchInternetTests, DISABLED_get) { ARCH_INTERNET internet; - String result = internet.get(TEST_URL); + std::string result = internet.get(TEST_URL); ASSERT_EQ("Hello world!", result); } TEST(ArchInternetTests, urlEncode) { ARCH_INTERNET internet; - String result = internet.urlEncode("hello=+&world"); + std::string result = internet.urlEncode("hello=+&world"); ASSERT_EQ("hello%3D%2B%26world", result); } diff -Nru barrier-2.3.2+dfsg/src/test/integtests/CMakeLists.txt barrier-2.3.3+dfsg/src/test/integtests/CMakeLists.txt --- barrier-2.3.2+dfsg/src/test/integtests/CMakeLists.txt 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/integtests/CMakeLists.txt 2020-07-14 17:37:45.000000000 +0000 @@ -14,24 +14,37 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -file(GLOB_RECURSE headers "*.h") -file(GLOB_RECURSE sources "*.cpp") - -# remove platform files (specific platform added later). -file(GLOB_RECURSE remove_platform "platform/*") -list(REMOVE_ITEM headers ${remove_platform}) -list(REMOVE_ITEM sources ${remove_platform}) +set(headers +) +set(sources + arch/ArchInternetTests.cpp + ipc/IpcTests.cpp + net/NetworkTests.cpp + Main.cpp +) # platform if (WIN32) - file(GLOB platform_sources "platform/MSWindows*.cpp") - file(GLOB platform_headers "platform/MSWindows*.h") + set(platform_sources + platform/MSWindowsClipboardTests.cpp + platform/MSWindowsKeyStateTests.cpp + ) + set(platform_headers) elseif (APPLE) - file(GLOB platform_sources "platform/OSX*.cpp") - file(GLOB platform_headers "platform/OSX*.h") + set(platform_sources + platform/OSXClipboardTests.cpp + platform/OSXKeyStateTests.cpp + platform/OSXScreenTests.cpp + ) + set(platform_headers) elseif (UNIX) - file(GLOB platform_sources "platform/XWindows*.cpp") - file(GLOB platform_headers "platform/XWindows*.h") + set(platform_sources + platform/XWindowsClipboardTests.cpp + platform/XWindowsKeyStateTests.cpp + platform/XWindowsScreenSaverTests.cpp + platform/XWindowsScreenTests.cpp + ) + set(platform_headers) endif() list(APPEND sources ${platform_sources}) @@ -55,7 +68,6 @@ include_directories( ../../ - ../../lib/ ../../../ext/gtest/include ../../../ext/gmock/include ) @@ -68,4 +80,4 @@ add_executable(integtests ${sources}) target_link_libraries(integtests - arch base client common io ipc mt net platform server barrier gtest gmock ${libs} ${OPENSSL_LIBS}) + arch base client common io ipc mt net platform server synlib gtest gmock ${libs} ${OPENSSL_LIBS}) diff -Nru barrier-2.3.2+dfsg/src/test/integtests/net/NetworkTests.cpp barrier-2.3.3+dfsg/src/test/integtests/net/NetworkTests.cpp --- barrier-2.3.2+dfsg/src/test/integtests/net/NetworkTests.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/integtests/net/NetworkTests.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -38,7 +38,7 @@ #include "base/TMethodEventJob.h" #include "base/TMethodJob.h" #include "base/Log.h" -#include "common/stdexcept.h" +#include #include "test/global/gtest.h" #include diff -Nru barrier-2.3.2+dfsg/src/test/integtests/platform/MSWindowsKeyStateTests.cpp barrier-2.3.3+dfsg/src/test/integtests/platform/MSWindowsKeyStateTests.cpp --- barrier-2.3.2+dfsg/src/test/integtests/platform/MSWindowsKeyStateTests.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/integtests/platform/MSWindowsKeyStateTests.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -40,7 +40,6 @@ protected: virtual void SetUp() { - m_hook.loadLibrary(); m_screensaver = new MSWindowsScreenSaver(); } diff -Nru barrier-2.3.2+dfsg/src/test/integtests/platform/XWindowsKeyStateTests.cpp barrier-2.3.3+dfsg/src/test/integtests/platform/XWindowsKeyStateTests.cpp --- barrier-2.3.2+dfsg/src/test/integtests/platform/XWindowsKeyStateTests.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/integtests/platform/XWindowsKeyStateTests.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -76,8 +76,7 @@ { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); keyState.setActiveGroup(XWindowsKeyState::kGroupPollAndSet); @@ -88,8 +87,7 @@ { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); keyState.setActiveGroup(XWindowsKeyState::kGroupPoll); @@ -100,8 +98,7 @@ { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); keyState.setActiveGroup(1); @@ -112,8 +109,7 @@ { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); int mask = keyState.mapModifiersFromX(0); @@ -124,8 +120,7 @@ { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); unsigned int modifiers = 0; bool result = keyState.mapModifiersToX(0, modifiers); @@ -137,8 +132,7 @@ { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); bool result = keyState.fakeCtrlAltDel(); @@ -149,21 +143,18 @@ { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); KeyModifierMask actual = keyState.pollActiveModifiers(); ASSERT_EQ(0, actual); } -#if 0 // TODO: fix, causes sigsegv TEST_F(XWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCorrect) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); // set mock modifier mapping std::fill(keyState.modifierFromX().begin(), keyState.modifierFromX().end(), 0); @@ -189,14 +180,12 @@ EXPECT_TRUE((modUp & KeyModifierShift) == 0) << "shift key still in mask - make sure no keys are being held down"; } -#endif TEST_F(XWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); SInt32 actual = keyState.pollActiveGroup(); @@ -207,8 +196,7 @@ { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); keyState.group(3); @@ -222,8 +210,7 @@ #if HAVE_XKB_EXTENSION MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); // reset the group keyState.group(-1); diff -Nru barrier-2.3.2+dfsg/src/test/integtests/platform/XWindowsScreenTests.cpp barrier-2.3.3+dfsg/src/test/integtests/platform/XWindowsScreenTests.cpp --- barrier-2.3.2+dfsg/src/test/integtests/platform/XWindowsScreenTests.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/integtests/platform/XWindowsScreenTests.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -29,12 +29,11 @@ EXPECT_CALL(eventQueue, adoptHandler(_, _, _)).Times(2); EXPECT_CALL(eventQueue, adoptBuffer(_)).Times(2); EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(2); - XWindowsScreen screen( - ":0.0", false, false, 0, &eventQueue); + XWindowsScreen screen(new XWindowsImpl(), ":0.0", false, false, 0, &eventQueue); screen.fakeMouseMove(10, 20); - int x, y; + SInt32 x, y; screen.getCursorPos(x, y); ASSERT_EQ(10, x); ASSERT_EQ(20, y); diff -Nru barrier-2.3.2+dfsg/src/test/mock/barrier/MockEventQueue.h barrier-2.3.3+dfsg/src/test/mock/barrier/MockEventQueue.h --- barrier-2.3.2+dfsg/src/test/mock/barrier/MockEventQueue.h 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/mock/barrier/MockEventQueue.h 2020-07-14 17:37:45.000000000 +0000 @@ -41,7 +41,7 @@ MOCK_METHOD1(dispatchEvent, bool(const Event&)); MOCK_CONST_METHOD2(getHandler, IEventJob*(Event::Type, void*)); MOCK_METHOD1(deleteTimer, void(EventQueueTimer*)); - MOCK_CONST_METHOD1(getRegisteredType, Event::Type(const String&)); + MOCK_CONST_METHOD1(getRegisteredType, Event::Type(const std::string&)); MOCK_METHOD0(getSystemTarget, void*()); MOCK_METHOD0(forClient, ClientEvents&()); MOCK_METHOD0(forIStream, IStreamEvents&()); diff -Nru barrier-2.3.2+dfsg/src/test/unittests/barrier/ClipboardChunkTests.cpp barrier-2.3.3+dfsg/src/test/unittests/barrier/ClipboardChunkTests.cpp --- barrier-2.3.2+dfsg/src/test/unittests/barrier/ClipboardChunkTests.cpp 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/unittests/barrier/ClipboardChunkTests.cpp 2020-07-14 17:37:45.000000000 +0000 @@ -22,7 +22,6 @@ TEST(ClipboardChunkTests, start_formatStartChunk) { -<<<<<<< HEAD ClipboardID id = 0; UInt32 sequence = 0; String mockDataSize("10"); @@ -34,28 +33,12 @@ EXPECT_EQ('1', chunk->m_chunk[6]); EXPECT_EQ('0', chunk->m_chunk[7]); EXPECT_EQ('\0', chunk->m_chunk[8]); -======= - ClipboardID id = 0; - UInt32 sequence = 0; - String mockDataSize("10"); - ClipboardChunk* chunk = ClipboardChunk::start(id, sequence, mockDataSize); - UInt32 temp_m_chunk; - memcpy(&temp_m_chunk, &(chunk->m_chunk[1]), 4); - - EXPECT_EQ(id, chunk->m_chunk[0]); - EXPECT_EQ(sequence, temp_m_chunk); - EXPECT_EQ(kDataStart, chunk->m_chunk[5]); - EXPECT_EQ('1', chunk->m_chunk[6]); - EXPECT_EQ('0', chunk->m_chunk[7]); - EXPECT_EQ('\0', chunk->m_chunk[8]); ->>>>>>> master delete chunk; } TEST(ClipboardChunkTests, data_formatDataChunk) { -<<<<<<< HEAD ClipboardID id = 0; UInt32 sequence = 1; String mockData("mock data"); @@ -74,35 +57,12 @@ EXPECT_EQ('t', chunk->m_chunk[13]); EXPECT_EQ('a', chunk->m_chunk[14]); EXPECT_EQ('\0', chunk->m_chunk[15]); -======= - ClipboardID id = 0; - UInt32 sequence = 1; - String mockData("mock data"); - ClipboardChunk* chunk = ClipboardChunk::data(id, sequence, mockData); - UInt32 temp_m_chunk; - memcpy(&temp_m_chunk, &(chunk->m_chunk[1]), 4); - - EXPECT_EQ(id, chunk->m_chunk[0]); - EXPECT_EQ(sequence, temp_m_chunk); - EXPECT_EQ(kDataChunk, chunk->m_chunk[5]); - EXPECT_EQ('m', chunk->m_chunk[6]); - EXPECT_EQ('o', chunk->m_chunk[7]); - EXPECT_EQ('c', chunk->m_chunk[8]); - EXPECT_EQ('k', chunk->m_chunk[9]); - EXPECT_EQ(' ', chunk->m_chunk[10]); - EXPECT_EQ('d', chunk->m_chunk[11]); - EXPECT_EQ('a', chunk->m_chunk[12]); - EXPECT_EQ('t', chunk->m_chunk[13]); - EXPECT_EQ('a', chunk->m_chunk[14]); - EXPECT_EQ('\0', chunk->m_chunk[15]); ->>>>>>> master delete chunk; } TEST(ClipboardChunkTests, end_formatDataChunk) { -<<<<<<< HEAD ClipboardID id = 1; UInt32 sequence = 1; ClipboardChunk* chunk = ClipboardChunk::end(id, sequence); @@ -111,18 +71,6 @@ EXPECT_EQ(sequence, (UInt32)chunk->m_chunk[1]); EXPECT_EQ(kDataEnd, chunk->m_chunk[5]); EXPECT_EQ('\0', chunk->m_chunk[6]); -======= - ClipboardID id = 1; - UInt32 sequence = 1; - ClipboardChunk* chunk = ClipboardChunk::end(id, sequence); - UInt32 temp_m_chunk; - memcpy(&temp_m_chunk, &(chunk->m_chunk[1]), 4); - - EXPECT_EQ(id, chunk->m_chunk[0]); - EXPECT_EQ(sequence, temp_m_chunk); - EXPECT_EQ(kDataEnd, chunk->m_chunk[5]); - EXPECT_EQ('\0', chunk->m_chunk[6]); ->>>>>>> master delete chunk; } diff -Nru barrier-2.3.2+dfsg/src/test/unittests/CMakeLists.txt barrier-2.3.3+dfsg/src/test/unittests/CMakeLists.txt --- barrier-2.3.2+dfsg/src/test/unittests/CMakeLists.txt 2019-10-03 01:26:26.000000000 +0000 +++ barrier-2.3.3+dfsg/src/test/unittests/CMakeLists.txt 2020-07-14 17:37:45.000000000 +0000 @@ -50,7 +50,6 @@ include_directories( ../../ - ../../lib/ ../../../ext/gtest/include ../../../ext/gmock/include ../../../ext @@ -68,4 +67,4 @@ add_executable(unittests ${sources}) target_link_libraries(unittests - arch base client server common io net platform server barrier mt ipc gtest gmock ${libs} ${OPENSSL_LIBS}) + arch base client server common io net platform server synlib mt ipc gtest gmock ${libs} ${OPENSSL_LIBS})