diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 8ea04d7f..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -name: Bug report -about: Please fill in this template as much as you can, to help us, help you. -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** - -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -Please do not link to image hosting sites, as these can be ephemeral. Instead, attach them to the issue. - -**Desktop (please complete the following information):** - - - OS: [e.g. Windows] -- Barrier version [e.g 2.3.3] - -**Additional context** - -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..208e7058 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,79 @@ +name: Bug Report +description: File a bug report (for questions, ideas & support, use the Discussions tab, or IRC for quick answers, but make sure to stay on the channel!) +labels: [bug, triage] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you see! Screenshots are also helpful - please attach to the issue (when created), rather than linking to image hosting sites. + validations: + required: true + - type: dropdown + id: version + attributes: + label: Version + description: What version of Barrier are you running? + options: + - v2.0.0-RC1 + - v2.0.0-RC2 + - v2.0.0 + - v2.1.1 + - v2.1.2 + - v2.3.0 + - v2.3.1 + - v2.3.2-alpha + - v2.3.2 + - v2.3.3 + - From Git HEAD or commit (specify below) + validations: + required: true + - type: input + id: git-commit-if + attributes: + label: Git commit hash (if applicable) + description: "When building Barrier from Git, what commit hash did you checkout from?" + placeholder: b0c0b42b + validations: + required: false + - type: textarea + id: pkg-mgr-origin + attributes: + label: If applicable, where did you install Barrier from? + description: This includes Snaps, Flatpaks, and self-built executables. + validations: + required: false + - type: dropdown + id: os + attributes: + label: What OSes are you seeing the problem on? (Check all that apply) + multiple: true + options: + - Linux + - Windows + - macOS + validations: + required: true + - type: textarea + id: os-version + attributes: + label: What OS versions are you using? + description: This applies to both client(s) and the server. + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: textarea + id: misc-info + attributes: + label: Any other information + description: Please enter any other information we should know, if applicable. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..3ba13e0c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b7cb545..f4d7edac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -292,6 +292,8 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") list (APPEND libs Wtsapi32 Userenv Wininet comsuppw Shlwapi) add_definitions ( + /DSYSAPI_WIN32=1 + /DWINAPI_MSWINDOWS=1 /DWIN32 /D_WINDOWS /D_CRT_SECURE_NO_WARNINGS diff --git a/LICENSE b/LICENSE index acfef1bb..42498a45 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ Copyright (C) 2012-2016 Symless Ltd. Copyright (C) 2008-2014 Nick Bolton Copyright (C) 2002-2014 Chris Schoeneman -This program is released under the GPL with the additional exemption +This program is released under the GPL with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. GNU GENERAL PUBLIC LICENSE @@ -286,3 +286,62 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/README.md b/README.md index 749b61e6..3c545e93 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ and a [snap](https://snapcraft.io/barrier). ### Contact info: -- `#barrier` on libera IRC network +- `#barrier` on LiberaChat IRC network #### CI Build Status @@ -65,7 +65,7 @@ Note that if the keyboard's Scroll Lock is active then this will prevent the mou 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. +For short and simple questions or to just say hello find us on the LiberaChat IRC network in the #barrier channel. ### Contributions @@ -107,7 +107,8 @@ A: Start the binary with the argument `--config ` Q: After loading my configuration on the client the field 'Server IP' is still empty! -A: Edit your configuration to include the servers ip adress manually with - (...) - section: options - serverhostname= +A: Edit your configuration to include the server's ip address manually with + + (...) + section: options + serverhostname= diff --git a/_config.yml b/_config.yml index c7418817..f980e760 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-slate \ No newline at end of file +theme: jekyll-theme-slate diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e12cdd60..2b42fc1d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,9 +63,15 @@ jobs: artifactName: Windows Release Installer - job: LinuxBuild + strategy: + matrix: + ubuntu-18.04: + imageName: 'ubuntu-18.04' + ubuntu-20.04: + imageName: 'ubuntu-20.04' displayName: Linux Build pool: - vmImage: 'ubuntu-16.04' + vmImage: $(imageName) steps: - script: sudo apt-get update -y - script: sudo apt-get install -y libxtst-dev qtdeclarative5-dev libavahi-compat-libdnssd-dev libcurl4-openssl-dev @@ -75,13 +81,22 @@ jobs: - job: MacBuild displayName: Mac Build - pool: - vmImage: 'macOS-10.14' strategy: matrix: - Release: - B_BUILD_TYPE: Release - BARRIER_VERSION_STAGE: Release + big-sur-Release: + imageName: "macOS-11" + B_BUILD_TYPE: Release + BARRIER_VERSION_STAGE: Release + catalina-Release: + imageName: "macOS-10.15" + B_BUILD_TYPE: Release + BARRIER_VERSION_STAGE: Release + mojave-Release: + imageName: "macOS-10.14" + B_BUILD_TYPE: Release + BARRIER_VERSION_STAGE: Release + pool: + vmImage: $(imageName) variables: VERBOSE: 1 TERM: xterm-256color diff --git a/clean_build.bat b/clean_build.bat index 4416a7e9..79fce047 100644 --- a/clean_build.bat +++ b/clean_build.bat @@ -65,7 +65,7 @@ if exist bin\Debug ( mkdir bin\Release\platforms copy %B_QT_FULLPATH%\plugins\platforms\qwindows.dll bin\Release\platforms\ > NUL ) else ( - echo Remember to copy supporting binaries and confiuration files! + echo Remember to copy supporting binaries and configuration files! ) echo Build completed successfully diff --git a/clean_build.sh b/clean_build.sh index 3a92d8b9..585ca88b 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -1,10 +1,10 @@ #!/bin/sh -cd "$(dirname $0)" || exit 1 +cd "$(dirname "$0")" || exit 1 # some environments have cmake v2 as 'cmake' and v3 as 'cmake3' # check for cmake3 first then fallback to just cmake B_CMAKE=`type cmake3 2>/dev/null` if [ $? -eq 0 ]; then - B_CMAKE=`echo $B_CMAKE | cut -d' ' -f3` + B_CMAKE=`echo "$B_CMAKE" | cut -d' ' -f3` else B_CMAKE=cmake fi @@ -26,7 +26,7 @@ B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" rm -rf build mkdir build || exit 1 cd build || exit 1 -echo Starting Barrier $B_BUILD_TYPE build... +echo "Starting Barrier $B_BUILD_TYPE build..." $B_CMAKE $B_CMAKE_FLAGS .. || exit 1 make || exit 1 echo "Build completed successfully" diff --git a/dist/inno/barrier.iss.in b/dist/inno/barrier.iss.in index 8200330a..ab56ebcb 100644 --- a/dist/inno/barrier.iss.in +++ b/dist/inno/barrier.iss.in @@ -54,7 +54,7 @@ Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: ; to avoid duplicate entries remove the existing rule (fails if it doesn't exist) before adding Filename: {sys}\netsh.exe; Parameters: "advfirewall firewall delete rule name=""{#MyAppListenerDesc}"""; Flags: runhidden Filename: {sys}\netsh.exe; Parameters: "advfirewall firewall add rule name=""{#MyAppListenerDesc}"" protocol=TCP dir=in localport=24800 action=allow"; Flags: runhidden -Filename: {sys}\sc.exe; Parameters: "create {#MyAppServiceName} start= auto binPath= ""{app}\{#MyAppServiceExe}"""; Flags: runhidden +Filename: {sys}\sc.exe; Parameters: "create {#MyAppServiceName} start= auto binPath= ""\""{app}\{#MyAppServiceExe}\"""""; Flags: runhidden Filename: {sys}\sc.exe; Parameters: "description {#MyAppServiceName} ""{#MyAppServiceDesc}"""; Flags: runhidden Filename: {sys}\sc.exe; Parameters: "start {#MyAppServiceName}"; Flags: runhidden Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent diff --git a/dist/macos/bundle/build_dist.sh.in b/dist/macos/bundle/build_dist.sh.in index 3d5c333f..26a93201 100755 --- a/dist/macos/bundle/build_dist.sh.in +++ b/dist/macos/bundle/build_dist.sh.in @@ -1,7 +1,7 @@ #!/bin/sh # Use the same verbose variable as CMake -[ "$VERBOSE" == "1" ] && set -x +[ "$VERBOSE" = "1" ] && set -x # Exit on unset variables or pipe errors set -uo pipefail @@ -14,10 +14,10 @@ B_BARRIERC="Barrier.app/Contents/MacOS/barrierc" B_BARRIERS="Barrier.app/Contents/MacOS/barriers" # Colorized output -function info() { tput bold; echo "$@" ; tput sgr0 ;} -function error() { tput bold; tput setaf 1; echo "$@"; tput sgr0 ; } -function success() { tput bold; tput setaf 2; echo "$@"; tput sgr0 ; } -function warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; } +info() { tput bold; echo "$@"; tput sgr0 ; } +error() { tput bold; tput setaf 1; echo "$@"; tput sgr0 ; } +success() { tput bold; tput setaf 2; echo "$@"; tput sgr0 ; } +warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; } info "Checking for bundle contents" if [ ! -d "Barrier.app/Contents" ]; then @@ -40,7 +40,7 @@ if which -s port ; then info "MacPorts found, searching for macdeployqt" DEPLOYQT="$(port contents qt5-qttools | grep --only --max-count 1 '/.*macdeployqt')" if [ ! -x "$DEPLOYQT" ]; then - error Please install package qt5-qttools + error "Please install package qt5-qttools" exit 1 fi fi @@ -50,13 +50,13 @@ if which -s brew ; then info "Homebrew found, searching for macdeployqt" DEPLOYQT="$(brew list qt@5 | grep --only '/.*macdeployqt' | head -1)" if [ ! -x "$DEPLOYQT" ]; then - error Please install package qt + error "Please install package qt" exit 1 fi fi # Use macdeployqt to include libraries and create dmg -if [ "$B_BUILDTYPE" == "Release" ]; then +if [ "$B_BUILDTYPE" = "Release" ]; then info "Building Release disk image (dmg)" "$DEPLOYQT" Barrier.app -dmg \ -executable="$B_BARRIERC" \ diff --git a/dist/macos/bundle/build_installer.sh.in b/dist/macos/bundle/build_installer.sh.in index 0d2ccfc7..c1fd3fc2 100755 --- a/dist/macos/bundle/build_installer.sh.in +++ b/dist/macos/bundle/build_installer.sh.in @@ -1,30 +1,30 @@ #!/bin/sh # add warning for users running manually -function warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; } +warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; } warn "The scripts build_installer.sh and reref_dylibs.sh have been deprecated." warn "Please use build_dist.sh instead to deploy using macdeployqt" # change this to rename the installer package B_DMG="Barrier-@BARRIER_VERSION@.dmg" -cd "$( dirname '$0' )" +cd "$( dirname "$0" )" OWNDIR="$( pwd )" B_REREF_SCRIPT="$OWNDIR/reref_dylibs.sh" -if [ ! -x $B_REREF_SCRIPT ]; then - echo Missing script: $B_REREF_SCRIPT +if [ ! -x "$B_REREF_SCRIPT" ]; then + echo "Missing script: $B_REREF_SCRIPT" exit 1 fi # remove any old copies so there's no confusion about whether this # process completes successfully or not -rm -rf temp.dmg $B_DMG +rm -rf temp.dmg "$B_DMG" cd Barrier.app/Contents 2>/dev/null if [ $? -ne 0 ]; then - echo Please make sure that the build completed successfully - echo before trying to create the installer. + echo "Please make sure that the build completed successfully" + echo "before trying to create the installer." exit 1 fi @@ -77,7 +77,7 @@ hdiutil create -size 64m -fs HFS+ -volname "Barrier" temp.dmg || exit 1 hdiutil attach temp.dmg -mountpoint mnt || exit 1 cp -r Barrier.app mnt/ || exit 1 hdiutil detach mnt || exit 1 -hdiutil convert temp.dmg -format UDZO -o $B_DMG || exit 1 +hdiutil convert temp.dmg -format UDZO -o "$B_DMG" || exit 1 rm temp.dmg -echo "dmg $B_DMB created successfully" +echo "dmg $B_DMG created successfully" diff --git a/dist/macos/bundle/reref_dylibs.sh b/dist/macos/bundle/reref_dylibs.sh index 029ca4ae..71a9ba03 100755 --- a/dist/macos/bundle/reref_dylibs.sh +++ b/dist/macos/bundle/reref_dylibs.sh @@ -5,28 +5,28 @@ B_TARGET=$1 if [ "x$B_TARGET" = "x" ]; then # add warning for users running manually - function warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; } + warn() { tput bold; tput setaf 3; echo "$@"; tput sgr0 ; } warn "The scripts build_installer.sh and reref_dylibs.sh have been deprecated." warn "Please use build_dist.sh instead to deploy using macdeployqt" - echo Which binary needs to be re-referenced? + echo "Which binary needs to be re-referenced?" exit 1 fi -cd $(dirname $B_TARGET) || exit 1 +cd "$(dirname "$B_TARGET")" || exit 1 # where to find non-system libraries relative to target's directory. # the vast majority of the time this should be empty B_REL_PATH=$2 # we're in target's directory now. trim off the path -B_TARGET=$(basename $B_TARGET) +B_TARGET=$(basename "$B_TARGET") # get a list of non-system libraries and make local copies -B_LIBS=$(otool -XL $B_TARGET | awk '{ print $1 }' | grep -Ev '^(/usr/lib|/System)') +B_LIBS=$(otool -XL "$B_TARGET" | awk '{ print $1 }' | grep -Ev '^(/usr/lib|/System)') [ $? -ne 0 ] && exit 1 for B_LIB in $B_LIBS; do - B_LIB_NAME=$(basename $B_LIB) + B_LIB_NAME=$(basename "$B_LIB") # otool reports barrier as "barrier:" which fails self-reference test below B_LIB_NAME=${B_LIB_NAME//:} @@ -34,16 +34,16 @@ for B_LIB in $B_LIBS; do [ "$B_TARGET" = "$B_LIB_NAME" ] && continue B_DST=${B_REL_PATH}${B_LIB_NAME} - if [ ! -e $B_DST ]; then - cp $B_LIB $B_DST || exit 1 - chmod u+rw $B_DST || exit 1 + if [ ! -e "$B_DST" ]; then + cp "$B_LIB" "$B_DST" || exit 1 + chmod u+rw "$B_DST" || exit 1 # recursively call this script on libraries purposefully not passing # $B_REL_PATH so that it is only used explicitly - $0 $B_DST + $0 "$B_DST" fi # adjust the target's metadata to point to the local copy # rather than the system-wide copy which would only exist on # a development machine - install_name_tool -change $B_LIB @loader_path/$B_DST $B_TARGET || exit 1 + install_name_tool -change "$B_LIB" "@loader_path/$B_DST" "$B_TARGET" || exit 1 done diff --git a/doc/barrier.conf.example-advanced b/doc/barrier.conf.example-advanced index b3d6ad69..e1b23924 100644 --- a/doc/barrier.conf.example-advanced +++ b/doc/barrier.conf.example-advanced @@ -47,7 +47,7 @@ section: links end # The aliases section is to map the full names of the computers to their logical names used in the screens section -# One way to find the actual name of a comptuer is to run hostname from a command window +# One way to find the actual name of a computer is to run hostname from a command window section: aliases # Laptop is actually known as John-Smiths-MacBook-3.local John-Smiths-MacBook-3.local: diff --git a/doc/newsfragments/gui-keyboard-enabled-screen-layout.feature b/doc/newsfragments/gui-keyboard-enabled-screen-layout.feature index 5ca3019e..7e495376 100644 --- a/doc/newsfragments/gui-keyboard-enabled-screen-layout.feature +++ b/doc/newsfragments/gui-keyboard-enabled-screen-layout.feature @@ -1 +1 @@ -Made it possible to use keyboard instead of mouse to modify screen layout. \ No newline at end of file +Made it possible to use keyboard instead of mouse to modify screen layout. diff --git a/doc/newsfragments/windows-service-path.bugfix b/doc/newsfragments/windows-service-path.bugfix new file mode 100644 index 00000000..c418b0aa --- /dev/null +++ b/doc/newsfragments/windows-service-path.bugfix @@ -0,0 +1 @@ +Fixed incorrect setup of Barrier service path on Windows. diff --git a/doc/org.barrier-foss.org.barrierc.plist b/doc/org.barrier-foss.org.barrierc.plist index 31e10ba5..90345c88 100644 --- a/doc/org.barrier-foss.org.barrierc.plist +++ b/doc/org.barrier-foss.org.barrierc.plist @@ -4,17 +4,17 @@ - Label - org.debauchee.com.barrierc.plist - OnDemand - - ProgramArguments - + Label + org.debauchee.com.barrierc.plist + OnDemand + + ProgramArguments + /usr/bin/barrierc 192.168.0.2 - - RunAtLoad - + + RunAtLoad + diff --git a/doc/org.barrier-foss.org.barriers.plist b/doc/org.barrier-foss.org.barriers.plist index f1ab5bf9..fed7b47a 100644 --- a/doc/org.barrier-foss.org.barriers.plist +++ b/doc/org.barrier-foss.org.barriers.plist @@ -4,12 +4,12 @@ - Label - org.debauchee.com.barriers.plist - OnDemand - - ProgramArguments - + Label + org.debauchee.com.barriers.plist + OnDemand + + ProgramArguments + /usr/bin/barriers --no-daemon --config diff --git a/osx_environment.sh b/osx_environment.sh index 1b3c37b8..2ee886da 100644 --- a/osx_environment.sh +++ b/osx_environment.sh @@ -1,7 +1,7 @@ #!/bin/bash # Checks if directory exists, otherwise asks to install package. -function check_dir_exists() { +check_dir_exists() { local path=$1 local package=$2 @@ -11,7 +11,7 @@ function check_dir_exists() { fi } -if [ ! $BARRIER_BUILD_ENV ]; then +if [ -z "$BARRIER_BUILD_ENV" ]; then check_dir_exists '/Applications/Xcode.app' 'Xcode' printf "Modifying environment for Barrier build...\n" diff --git a/res/Readme.txt b/res/Readme.txt index 0b2802bd..9cfcf3c3 100644 --- a/res/Readme.txt +++ b/res/Readme.txt @@ -1,4 +1,4 @@ -Thank you for chosing Barrier! +Thank you for choosing Barrier! https://github.com/debauchee/barrier/ Barrier allows you to share your keyboard and mouse between computers over a network. diff --git a/res/barrier.desktop b/res/barrier.desktop index 6bb60e13..a47fd8ef 100644 --- a/res/barrier.desktop +++ b/res/barrier.desktop @@ -5,6 +5,5 @@ Comment=Keyboard and mouse sharing solution Exec=barrier Icon=barrier Terminal=false -Categories=Utility;DesktopUtility; +Categories=Utility;RemoteAccess; Keywords=keyboard;mouse;sharing;network;share; - diff --git a/res/makeicon.sh b/res/makeicon.sh index 2883755c..cfebe308 100755 --- a/res/makeicon.sh +++ b/res/makeicon.sh @@ -1,10 +1,10 @@ #!/bin/sh ICNS_BASE=../dist/macos/bundle/Barrier.app/Contents/Resources if ! which magick >/dev/null 2>&1; then - echo "Need ImageMagic for this" + echo "Need ImageMagick for this" exit 10 fi -cd $(dirname $0) || exit $? +cd "$(dirname "$0")" || exit $? if [ ! -r barrier.png ]; then echo "Use inkscape (or another vector graphics editor) to create barrier.png from barrier.svg first" exit 10 @@ -12,11 +12,11 @@ fi rm -rf work || exit $? mkdir -p work || exit $? for s in 16 24 32 48 64 128 256 512 1024; do - magick convert barrier.png -resize ${s}x${s} -depth 8 work/${s}.png || exit $? + magick convert barrier.png -resize "${s}x${s}" -depth 8 "work/${s}.png" || exit $? done # windows icon magick convert work/{16,24,32,48,64,128}.png barrier.png barrier.ico || exit $? # macos icon -png2icns $ICNS_BASE/Barrier.icns work/{16,32,256,512,1024}.png || exit $? +png2icns "$ICNS_BASE/Barrier.icns" work/{16,32,256,512,1024}.png || exit $? rm -rf work echo Done diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index 0534d0fb..946b19a2 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -20,4 +20,3 @@ add_subdirectory(barriers) if (WIN32) add_subdirectory(barrierd) endif() - diff --git a/src/cmd/barrierc/CMakeLists.txt b/src/cmd/barrierc/CMakeLists.txt index c78ac6a4..45e9ab0e 100644 --- a/src/cmd/barrierc/CMakeLists.txt +++ b/src/cmd/barrierc/CMakeLists.txt @@ -46,4 +46,3 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") install (TARGETS barrierc DESTINATION bin) endif() - diff --git a/src/cmd/barrierc/OSXClientTaskBarReceiver.cpp b/src/cmd/barrierc/OSXClientTaskBarReceiver.cpp index 1a2bf56e..e273f998 100644 --- a/src/cmd/barrierc/OSXClientTaskBarReceiver.cpp +++ b/src/cmd/barrierc/OSXClientTaskBarReceiver.cpp @@ -66,4 +66,3 @@ createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events { return new OSXClientTaskBarReceiver(logBuffer, events); } - diff --git a/src/cmd/barrierd/barrierd.rc b/src/cmd/barrierd/barrierd.rc index df31e5f6..c5ad5022 100644 --- a/src/cmd/barrierd/barrierd.rc +++ b/src/cmd/barrierd/barrierd.rc @@ -73,7 +73,7 @@ BEGIN VALUE "ProductName", "Barrier" VALUE "ProductVersion", BARRIER_VERSION VALUE "OriginalFilename", "barrierd.exe" - VALUE "FileDescription", "Open source KVM software deamon" + VALUE "FileDescription", "Open source KVM software daemon" VALUE "InternalName", "barrierd" END END diff --git a/src/cmd/barriers/CMakeLists.txt b/src/cmd/barriers/CMakeLists.txt index e92334a6..c9fa7508 100644 --- a/src/cmd/barriers/CMakeLists.txt +++ b/src/cmd/barriers/CMakeLists.txt @@ -46,5 +46,3 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") install (TARGETS barriers DESTINATION bin) endif() - - diff --git a/src/gui/res/lang/Languages.xml b/src/gui/res/lang/Languages.xml index 5948f9c6..723d667c 100644 --- a/src/gui/res/lang/Languages.xml +++ b/src/gui/res/lang/Languages.xml @@ -1,46 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/gui/res/lang/gui_ca-AD.ts b/src/gui/res/lang/gui_ca-AD.ts index 7d7d8738..3cd78957 100644 --- a/src/gui/res/lang/gui_ca-AD.ts +++ b/src/gui/res/lang/gui_ca-AD.ts @@ -905,8 +905,8 @@ To automatically trust this fingerprint for future connections, click Yes. To re 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. - Arrossega noves pantalles a la graella o mou les actuals al voltant. -Arrossega una pantalla a la paperera per eliminar-la. + Arrossega noves pantalles a la graella o mou les actuals al voltant. +Arrossega una pantalla a la paperera per eliminar-la. Fes doble clic a una pantalla per editar la seva configuració. @@ -1335,7 +1335,7 @@ p, li { white-space: pre-wrap; } Server response: %1 - Error inici de sessió, hi ha hagut un error. + Error inici de sessió, hi ha hagut un error. Resposta del servidor: %1 diff --git a/src/gui/res/lang/gui_da.ts b/src/gui/res/lang/gui_da.ts index 77c4c2b2..7bec5184 100644 --- a/src/gui/res/lang/gui_da.ts +++ b/src/gui/res/lang/gui_da.ts @@ -1334,7 +1334,7 @@ p, li { white-space: pre-wrap; } Server response: %1 - Fejl i login, en fejl opstod. + Fejl i login, en fejl opstod. Server svar: %1 diff --git a/src/gui/res/lang/gui_nl-NL.ts b/src/gui/res/lang/gui_nl-NL.ts index d666189c..4ea0ee8a 100644 --- a/src/gui/res/lang/gui_nl-NL.ts +++ b/src/gui/res/lang/gui_nl-NL.ts @@ -1334,7 +1334,7 @@ p, li { white-space: pre-wrap; } Server response: %1 - Inloggen mislukt, er is een fout opgetreden. + Inloggen mislukt, er is een fout opgetreden. Foutmelding: %1 diff --git a/src/gui/res/lang/gui_pl-PL.ts b/src/gui/res/lang/gui_pl-PL.ts index 6d357fdc..7262a2ae 100644 --- a/src/gui/res/lang/gui_pl-PL.ts +++ b/src/gui/res/lang/gui_pl-PL.ts @@ -1325,7 +1325,7 @@ p, li { white-space: pre-wrap; } Login failed, an error occurred. %1 - Logowanie nie powiodło się, wystąpił błąd. + Logowanie nie powiodło się, wystąpił błąd. %1 @@ -1335,7 +1335,7 @@ p, li { white-space: pre-wrap; } Server response: %1 - Logowanie nie powiodło się, wystąpił błąd. + Logowanie nie powiodło się, wystąpił błąd. Odpowiedź serwera: %1 diff --git a/src/gui/res/lang/gui_ru.ts b/src/gui/res/lang/gui_ru.ts index 07a94254..f9842400 100644 --- a/src/gui/res/lang/gui_ru.ts +++ b/src/gui/res/lang/gui_ru.ts @@ -1325,7 +1325,7 @@ p, li { white-space: pre-wrap; } Login failed, an error occurred. %1 - Войти не удалось, произошла ошибка. + Войти не удалось, произошла ошибка. %1 @@ -1336,7 +1336,7 @@ p, li { white-space: pre-wrap; } Server response: %1 - Войти не удалось, произошла ошибка. + Войти не удалось, произошла ошибка. Ответ сервера: diff --git a/src/gui/res/lang/gui_tr-TR.ts b/src/gui/res/lang/gui_tr-TR.ts index 95946555..924662f9 100644 --- a/src/gui/res/lang/gui_tr-TR.ts +++ b/src/gui/res/lang/gui_tr-TR.ts @@ -905,8 +905,8 @@ To automatically trust this fingerprint for future connections, click Yes. To re 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. - Izgaraya yeni ekranları sürükleyin veya çevresinde mevcut olanları taşıyın. -Silmek için çöp tenekesine ekranı sürükleyin. + Izgaraya yeni ekranları sürükleyin veya çevresinde mevcut olanları taşıyın. +Silmek için çöp tenekesine ekranı sürükleyin. Kendi ayarlarınızı düzenlemek için bir ekran üzerine çift tıklayın. diff --git a/src/gui/src/AboutDialog.h b/src/gui/src/AboutDialog.h index bd85c9d4..6fdb0a24 100644 --- a/src/gui/src/AboutDialog.h +++ b/src/gui/src/AboutDialog.h @@ -40,4 +40,3 @@ class AboutDialog : public QDialog, public Ui::AboutDialogBase }; #endif - diff --git a/src/gui/src/Action.cpp b/src/gui/src/Action.cpp index 2882afb1..f34d1e8f 100644 --- a/src/gui/src/Action.cpp +++ b/src/gui/src/Action.cpp @@ -164,4 +164,3 @@ QTextStream& operator<<(QTextStream& outStream, const Action& action) return outStream; } - diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index c7878afe..63943267 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -211,7 +211,7 @@ void AppConfig::setElevateMode(ElevateMode em) { m_ElevateMode = em; } void AppConfig::setAutoConfig(bool autoConfig) { m_AutoConfig = autoConfig; } -bool AppConfig::autoConfigPrompted() { return m_AutoConfigPrompted; } +bool AppConfig::autoConfigPrompted() { return m_AutoConfigPrompted; } void AppConfig::setAutoConfigPrompted(bool prompted) { m_AutoConfigPrompted = prompted; } diff --git a/src/gui/src/BaseConfig.cpp b/src/gui/src/BaseConfig.cpp index c61b4c5b..0f31493d 100644 --- a/src/gui/src/BaseConfig.cpp +++ b/src/gui/src/BaseConfig.cpp @@ -44,4 +44,3 @@ const char* BaseConfig::m_SwitchCornerNames[] = "bottom-left", "bottom-right" }; - diff --git a/src/gui/src/CommandProcess.cpp b/src/gui/src/CommandProcess.cpp index 57397ae7..c85e847b 100644 --- a/src/gui/src/CommandProcess.cpp +++ b/src/gui/src/CommandProcess.cpp @@ -30,35 +30,34 @@ CommandProcess::CommandProcess(QString cmd, QStringList arguments, QString input QString CommandProcess::run() { QProcess process; - QString standardOutput, standardError; process.setReadChannel(QProcess::StandardOutput); process.start(m_Command, m_Arguments); bool success = process.waitForStarted(); + QString output, error; if (success) { if (!m_Input.isEmpty()) { - process.write(m_Input.toLocal8Bit()); + process.write(m_Input.toStdString().c_str()); } if (process.waitForFinished()) { - standardOutput = QString::fromLocal8Bit(process.readAllStandardOutput().trimmed()); - standardError = QString::fromLocal8Bit(process.readAllStandardError().trimmed()); + output = process.readAllStandardOutput().trimmed(); + error = process.readAllStandardError().trimmed(); } } int code = process.exitCode(); - if (!standardError.isEmpty() || !success || code != 0) + if (!error.isEmpty() || !success || code != 0) { throw std::runtime_error( - std::string( - QString("Code: %1\nError: %2") - .arg(process.exitCode()) - .arg(standardError.isEmpty() ? "Unknown" : standardError) - .toLocal8Bit().constData())); + QString("Code: %1\nError: %2") + .arg(process.exitCode()) + .arg(error.isEmpty() ? "Unknown" : error) + .toStdString()); } emit finished(); - return standardOutput; + return output; } diff --git a/src/gui/src/Fingerprint.cpp b/src/gui/src/Fingerprint.cpp index 0e4588f8..cc1ce3bf 100644 --- a/src/gui/src/Fingerprint.cpp +++ b/src/gui/src/Fingerprint.cpp @@ -16,7 +16,8 @@ */ #include "Fingerprint.h" -#include "QUtility.h" + +#include "common/DataDirectories.h" #include #include @@ -123,8 +124,10 @@ void Fingerprint::persistDirectory() QString Fingerprint::directoryPath() { + auto profileDir = QString::fromStdString(DataDirectories::profile()); + return QString("%1/%2") - .arg(profilePath()) + .arg(profileDir) .arg(kDirName); } diff --git a/src/gui/src/IpcClient.cpp b/src/gui/src/IpcClient.cpp index b8b1bcb1..1b0e147a 100644 --- a/src/gui/src/IpcClient.cpp +++ b/src/gui/src/IpcClient.cpp @@ -104,12 +104,14 @@ void IpcClient::sendCommand(const QString& command, ElevateMode const elevate) stream.writeRawData(kIpcMsgCommand, 4); - QByteArray utf8Command = command.toUtf8(); + std::string stdStringCommand = command.toStdString(); + const char* charCommand = stdStringCommand.c_str(); + int length = (int)strlen(charCommand); char lenBuf[4]; - intToBytes(utf8Command.size(), lenBuf, 4); + intToBytes(length, lenBuf, 4); stream.writeRawData(lenBuf, 4); - stream.writeRawData(utf8Command.constData(), utf8Command.size()); + stream.writeRawData(charCommand, length); char elevateBuf[1]; // Refer to enum ElevateMode documentation for why this flag is mapped this way diff --git a/src/gui/src/IpcClient.h b/src/gui/src/IpcClient.h index cd398b3d..6040029c 100644 --- a/src/gui/src/IpcClient.h +++ b/src/gui/src/IpcClient.h @@ -28,7 +28,7 @@ class IpcReader; class IpcClient : public QObject { - Q_OBJECT + Q_OBJECT public: IpcClient(); diff --git a/src/gui/src/KeySequence.h b/src/gui/src/KeySequence.h index 9c73029a..03310918 100644 --- a/src/gui/src/KeySequence.h +++ b/src/gui/src/KeySequence.h @@ -54,4 +54,3 @@ class KeySequence }; #endif - diff --git a/src/gui/src/KeySequenceWidget.h b/src/gui/src/KeySequenceWidget.h index 42dc746d..636375b3 100644 --- a/src/gui/src/KeySequenceWidget.h +++ b/src/gui/src/KeySequenceWidget.h @@ -78,4 +78,3 @@ class KeySequenceWidget : public QPushButton }; #endif - diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index a3962aa8..40050782 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -31,6 +31,7 @@ #include "ProcessorArch.h" #include "SslCertificate.h" #include "ShutdownCh.h" +#include "common/DataDirectories.h" #include #include @@ -524,7 +525,7 @@ void MainWindow::startBarrier() // launched the process (e.g. when launched with elevation). setting the // profile dir on launch ensures it uses the same profile dir is used // no matter how its relaunched. - args << "--profile-dir" << QString("\"%1\"").arg(profilePath()); + args << "--profile-dir" << QString::fromStdString("\"" + DataDirectories::profile() + "\""); #endif if ((barrierType() == barrierClient && !clientArgs(args, app)) @@ -624,7 +625,7 @@ QString MainWindow::configFilename() if (m_pRadioInternalConfig->isChecked()) { // TODO: no need to use a temporary file, since we need it to - // be permenant (since it'll be used for Windows services, etc). + // be permanent (since it'll be used for Windows services, etc). m_pTempConfigFile = new QTemporaryFile(); if (!m_pTempConfigFile->open()) { @@ -729,7 +730,7 @@ void MainWindow::stopBarrier() void MainWindow::stopService() { - // send empty command to stop service from laucning anything. + // send empty command to stop service from launching anything. m_IpcClient.sendCommand("", appConfig().elevateMode()); } @@ -1001,7 +1002,7 @@ bool MainWindow::on_m_pButtonBrowseConfigFile_clicked() return false; } -bool MainWindow::on_m_pActionSave_triggered() +bool MainWindow::on_m_pActionSave_triggered() { QString fileName = QFileDialog::getSaveFileName(this, tr("Save configuration as..."), QString(), barrierConfigSaveFilter); diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index c115b912..131b31ce 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -211,4 +211,3 @@ private slots: }; #endif - diff --git a/src/gui/src/NewScreenWidget.cpp b/src/gui/src/NewScreenWidget.cpp index 7543bd3d..28e99fa4 100644 --- a/src/gui/src/NewScreenWidget.cpp +++ b/src/gui/src/NewScreenWidget.cpp @@ -1,4 +1,4 @@ -/* +/* * barrier -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2008 Volker Lanz (vl@fidra.de) @@ -45,4 +45,3 @@ void NewScreenWidget::mousePressEvent(QMouseEvent* event) pDrag->exec(Qt::CopyAction, Qt::CopyAction); } - diff --git a/src/gui/src/NewScreenWidget.h b/src/gui/src/NewScreenWidget.h index 03b41abd..6e527952 100644 --- a/src/gui/src/NewScreenWidget.h +++ b/src/gui/src/NewScreenWidget.h @@ -37,4 +37,3 @@ class NewScreenWidget : public QLabel }; #endif - diff --git a/src/gui/src/QBarrierApplication.h b/src/gui/src/QBarrierApplication.h index 1b06ba08..bd348b3a 100644 --- a/src/gui/src/QBarrierApplication.h +++ b/src/gui/src/QBarrierApplication.h @@ -44,4 +44,3 @@ class QBarrierApplication : public QApplication }; #endif - diff --git a/src/gui/src/QUtility.cpp b/src/gui/src/QUtility.cpp index 932bf146..2d05fc36 100644 --- a/src/gui/src/QUtility.cpp +++ b/src/gui/src/QUtility.cpp @@ -19,7 +19,6 @@ #include "ProcessorArch.h" #include "CommandProcess.h" -#include "common/DataDirectories.h" #if defined(Q_OS_LINUX) #include @@ -113,11 +112,3 @@ QString getOSInformation() return result; } - -QString profilePath() -{ - // Get path to current profile directory, properly converted - // from an OS locale std::string to Unicode QString. - auto localePath = DataDirectories::profile(); - return QString::fromLocal8Bit(localePath.c_str(), localePath.size()); -} diff --git a/src/gui/src/QUtility.h b/src/gui/src/QUtility.h index 7c05fd00..62a60825 100644 --- a/src/gui/src/QUtility.h +++ b/src/gui/src/QUtility.h @@ -29,4 +29,3 @@ QString hash(const QString& string); QString getFirstMacAddress(); qProcessorArch getProcessorArch(); QString getOSInformation(); -QString profilePath(); diff --git a/src/gui/src/Screen.h b/src/gui/src/Screen.h index e06056f7..64962214 100644 --- a/src/gui/src/Screen.h +++ b/src/gui/src/Screen.h @@ -105,4 +105,3 @@ QDataStream& operator<<(QDataStream& outStream, const Screen& screen); QDataStream& operator>>(QDataStream& inStream, Screen& screen); #endif - diff --git a/src/gui/src/ScreenSettingsDialog.cpp b/src/gui/src/ScreenSettingsDialog.cpp index 899881ed..9055e356 100644 --- a/src/gui/src/ScreenSettingsDialog.cpp +++ b/src/gui/src/ScreenSettingsDialog.cpp @@ -152,4 +152,3 @@ void ScreenSettingsDialog::on_m_pListAliases_itemSelectionChanged() { m_pButtonRemoveAlias->setEnabled(!m_pListAliases->selectedItems().isEmpty()); } - diff --git a/src/gui/src/ScreenSettingsDialog.h b/src/gui/src/ScreenSettingsDialog.h index ae1181b8..953d1f89 100644 --- a/src/gui/src/ScreenSettingsDialog.h +++ b/src/gui/src/ScreenSettingsDialog.h @@ -50,4 +50,3 @@ class ScreenSettingsDialog : public QDialog, public Ui::ScreenSettingsDialogBase }; #endif - diff --git a/src/gui/src/ScreenSetupModel.cpp b/src/gui/src/ScreenSetupModel.cpp index 405ba227..5c933f81 100644 --- a/src/gui/src/ScreenSetupModel.cpp +++ b/src/gui/src/ScreenSetupModel.cpp @@ -110,7 +110,7 @@ bool ScreenSetupModel::dropMimeData(const QMimeData* data, Qt::DropAction action return false; if (!parent.isValid() || row != -1 || column != -1) - return false; + return false; QByteArray encodedData = data->data(m_MimeType); QDataStream stream(&encodedData, QIODevice::ReadOnly); @@ -141,4 +141,3 @@ bool ScreenSetupModel::dropMimeData(const QMimeData* data, Qt::DropAction action return true; } - diff --git a/src/gui/src/ScreenSetupModel.h b/src/gui/src/ScreenSetupModel.h index 8a1a9820..0f558b42 100644 --- a/src/gui/src/ScreenSetupModel.h +++ b/src/gui/src/ScreenSetupModel.h @@ -68,4 +68,3 @@ class ScreenSetupModel : public QAbstractTableModel }; #endif - diff --git a/src/gui/src/ScreenSetupView.cpp b/src/gui/src/ScreenSetupView.cpp index 15795092..5459f23a 100644 --- a/src/gui/src/ScreenSetupView.cpp +++ b/src/gui/src/ScreenSetupView.cpp @@ -225,4 +225,3 @@ QStyleOptionViewItem ScreenSetupView::viewOptions() const option.textElideMode = Qt::ElideMiddle; return option; } - diff --git a/src/gui/src/ScreenSetupView.h b/src/gui/src/ScreenSetupView.h index 55981c78..64968a0b 100644 --- a/src/gui/src/ScreenSetupView.h +++ b/src/gui/src/ScreenSetupView.h @@ -58,4 +58,3 @@ class ScreenSetupView : public QTableView }; #endif - diff --git a/src/gui/src/ServerConfig.h b/src/gui/src/ServerConfig.h index 161b00d7..9f3e2db1 100644 --- a/src/gui/src/ServerConfig.h +++ b/src/gui/src/ServerConfig.h @@ -138,4 +138,3 @@ enum { }; #endif - diff --git a/src/gui/src/ServerConfigDialog.cpp b/src/gui/src/ServerConfigDialog.cpp index a727f331..84c20470 100644 --- a/src/gui/src/ServerConfigDialog.cpp +++ b/src/gui/src/ServerConfigDialog.cpp @@ -76,7 +76,7 @@ void ServerConfigDialog::showEvent(QShowEvent* event) if (!m_Message.isEmpty()) { - // TODO: ideally this massage box should pop up after the dialog is shown + // TODO: ideally this message box should pop up after the dialog is shown QMessageBox::information(this, tr("Configure server"), m_Message); } } diff --git a/src/gui/src/ServerConfigDialog.h b/src/gui/src/ServerConfigDialog.h index de2472ea..91da51ae 100644 --- a/src/gui/src/ServerConfigDialog.h +++ b/src/gui/src/ServerConfigDialog.h @@ -63,4 +63,3 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase }; #endif - diff --git a/src/gui/src/SetupWizard.cpp b/src/gui/src/SetupWizard.cpp index cd13c7c4..262d63c8 100644 --- a/src/gui/src/SetupWizard.cpp +++ b/src/gui/src/SetupWizard.cpp @@ -37,7 +37,7 @@ SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) : #elif defined(Q_OS_WIN) - // when areo is disabled on windows, the next/back buttons + // when aero is disabled on windows, the next/back buttons // are hidden (must be a qt bug) -- resizing the window // to +1 of the original height seems to fix this. // NOTE: calling setMinimumSize after this will break diff --git a/src/gui/src/ShutdownCh.h b/src/gui/src/ShutdownCh.h index 2462cae7..54ec84d4 100644 --- a/src/gui/src/ShutdownCh.h +++ b/src/gui/src/ShutdownCh.h @@ -19,4 +19,3 @@ // included in both the GUI and the child apps (server & client) const char ShutdownCh = 'S'; - diff --git a/src/gui/src/SslCertificate.cpp b/src/gui/src/SslCertificate.cpp index de3eea67..9dc93ce8 100644 --- a/src/gui/src/SslCertificate.cpp +++ b/src/gui/src/SslCertificate.cpp @@ -17,7 +17,7 @@ #include "SslCertificate.h" #include "Fingerprint.h" -#include "QUtility.h" +#include "common/DataDirectories.h" #include #include @@ -43,13 +43,13 @@ static const char kConfigFile[] = "barrier.conf"; SslCertificate::SslCertificate(QObject *parent) : QObject(parent) { - m_ProfileDir = profilePath(); - if (m_ProfileDir.isEmpty()) { + m_ProfileDir = DataDirectories::profile(); + if (m_ProfileDir.empty()) { emit error(tr("Failed to get profile directory.")); } } -std::pair SslCertificate::runTool(const QStringList& args) +std::pair SslCertificate::runTool(const QStringList& args) { QString program; #if defined(Q_OS_WIN) @@ -68,15 +68,17 @@ std::pair SslCertificate::runTool(const QStringList& args) #endif QProcess process; - QString standardOutput, standardError; process.setEnvironment(environment); process.start(program, args); - bool success = process.waitForStarted(); + bool success = process.waitForStarted(); + std::string output; + + QString standardError; if (success && process.waitForFinished()) { - standardOutput = QString::fromLocal8Bit(process.readAllStandardOutput().trimmed()); - standardError = QString::fromLocal8Bit(process.readAllStandardError().trimmed()); + output = process.readAllStandardOutput().trimmed().toStdString(); + standardError = process.readAllStandardError().trimmed(); } int code = process.exitCode(); @@ -87,15 +89,15 @@ std::pair SslCertificate::runTool(const QStringList& args) .arg(program) .arg(process.exitCode()) .arg(standardError.isEmpty() ? "Unknown" : standardError)); - return {false, standardOutput}; + return {false, output}; } - return {true, standardOutput}; + return {true, output}; } void SslCertificate::generateCertificate() { - auto filename = getCertificatePath(); + auto filename = QString::fromStdString(getCertificatePath()); QFile file(filename); if (!file.exists() || !isCertificateValid(filename)) { @@ -106,7 +108,7 @@ void SslCertificate::generateCertificate() arguments.append("-x509"); arguments.append("-nodes"); - // valide duration + // valid duration arguments.append("-days"); arguments.append(kCertificateLifetime); @@ -120,7 +122,7 @@ void SslCertificate::generateCertificate() arguments.append("-newkey"); arguments.append("rsa:2048"); - QDir sslDir(getCertificateDirectory()); + QDir sslDir(QString::fromStdString(getCertificateDirectory())); if (!sslDir.exists()) { sslDir.mkpath("."); } @@ -157,17 +159,20 @@ void SslCertificate::generateFingerprint(const QString& certificateFilename) auto ret = runTool(arguments); bool success = ret.first; + std::string output = ret.second; + if (!success) { return; } // find the fingerprint from the tool output - QString fingerprint = ret.second; - auto i = fingerprint.indexOf('='); - if (i != -1) { - fingerprint.remove(0, i+1); + auto i = output.find_first_of('='); + if (i != std::string::npos) { + i++; + auto fingerprint = output.substr( + i, output.size() - i); - Fingerprint::local().trust(fingerprint, false); + Fingerprint::local().trust(QString::fromStdString(fingerprint), false); emit info(tr("SSL fingerprint generated.")); } else { @@ -175,14 +180,14 @@ void SslCertificate::generateFingerprint(const QString& certificateFilename) } } -QString SslCertificate::getCertificatePath() +std::string SslCertificate::getCertificatePath() { - return getCertificateDirectory() + QDir::separator() + kCertificateFilename; + return getCertificateDirectory() + QDir::separator().toLatin1() + kCertificateFilename; } -QString SslCertificate::getCertificateDirectory() +std::string SslCertificate::getCertificateDirectory() { - return m_ProfileDir + QDir::separator() + kSslDir; + return m_ProfileDir + QDir::separator().toLatin1() + kSslDir; } bool SslCertificate::isCertificateValid(const QString& path) @@ -193,7 +198,7 @@ bool SslCertificate::isCertificateValid(const QString& path) BIO* bio = BIO_new(BIO_s_file()); - auto ret = BIO_read_filename(bio, path.toLocal8Bit().constData()); + auto ret = BIO_read_filename(bio, path.toStdString().c_str()); if (!ret) { emit info(tr("Could not read from default certificate file.")); BIO_free_all(bio); diff --git a/src/gui/src/SslCertificate.h b/src/gui/src/SslCertificate.h index 3ff3ff5c..2fe807a2 100644 --- a/src/gui/src/SslCertificate.h +++ b/src/gui/src/SslCertificate.h @@ -22,7 +22,7 @@ class SslCertificate : public QObject { -Q_OBJECT + Q_OBJECT public: explicit SslCertificate(QObject *parent = 0); @@ -36,13 +36,13 @@ signals: void generateFinished(); private: - std::pair runTool(const QStringList& args); + std::pair runTool(const QStringList& args); void generateFingerprint(const QString& certificateFilename); - QString getCertificatePath(); - QString getCertificateDirectory(); + std::string getCertificatePath(); + std::string getCertificateDirectory(); bool isCertificateValid(const QString& path); private: - QString m_ProfileDir; + std::string m_ProfileDir; }; diff --git a/src/gui/src/TrashScreenWidget.cpp b/src/gui/src/TrashScreenWidget.cpp index 4e81d4da..6f2abad7 100644 --- a/src/gui/src/TrashScreenWidget.cpp +++ b/src/gui/src/TrashScreenWidget.cpp @@ -40,4 +40,3 @@ void TrashScreenWidget::dropEvent(QDropEvent* event) else event->ignore(); } - diff --git a/src/gui/src/TrashScreenWidget.h b/src/gui/src/TrashScreenWidget.h index 676b44fb..967f73d5 100644 --- a/src/gui/src/TrashScreenWidget.h +++ b/src/gui/src/TrashScreenWidget.h @@ -39,4 +39,3 @@ class TrashScreenWidget : public QLabel }; #endif - diff --git a/src/gui/src/main.cpp b/src/gui/src/main.cpp index 73251d52..776b44de 100644 --- a/src/gui/src/main.cpp +++ b/src/gui/src/main.cpp @@ -97,6 +97,12 @@ int main(int argc, char* argv[]) QApplication::setQuitOnLastWindowClosed(false); + if (QGuiApplication::platformName() == "wayland") { + QMessageBox::warning( + NULL, "Barrier", + "You are using wayland session, which is currently not fully supported by Barrier."); + } + QSettings settings; AppConfig appConfig (&settings); diff --git a/src/lib/arch/ArchConsoleStd.cpp b/src/lib/arch/ArchConsoleStd.cpp index adb2d010..2e188bb5 100644 --- a/src/lib/arch/ArchConsoleStd.cpp +++ b/src/lib/arch/ArchConsoleStd.cpp @@ -30,4 +30,4 @@ ArchConsoleStd::writeConsole(ELevel level, const char* str) std::cout << str << std::endl; std::cout.flush(); -} \ No newline at end of file +} diff --git a/src/lib/arch/win32/ArchInternetWindows.cpp b/src/lib/arch/win32/ArchInternetWindows.cpp index df08afa7..fb75e7df 100644 --- a/src/lib/arch/win32/ArchInternetWindows.cpp +++ b/src/lib/arch/win32/ArchInternetWindows.cpp @@ -72,7 +72,7 @@ std::string ArchInternetWindows::urlEncode(const std::string& url) std::string result(buffer); - // the win32 url encoding funcitons are pretty useless (to us) and only + // the win32 url encoding functions are pretty useless (to us) and only // escape "unsafe" chars, but not + or =, so we need to replace these // manually (and probably many other chars). barrier::string::findReplaceAll(result, "+", "%2B"); diff --git a/src/lib/arch/win32/ArchMiscWindows.cpp b/src/lib/arch/win32/ArchMiscWindows.cpp index 6ee01fc1..ab16daad 100644 --- a/src/lib/arch/win32/ArchMiscWindows.cpp +++ b/src/lib/arch/win32/ArchMiscWindows.cpp @@ -443,7 +443,7 @@ ArchMiscWindows::wasLaunchedAsService() bool ArchMiscWindows::getParentProcessName(std::string &name) { PROCESSENTRY32 parentEntry; - if (!getParentProcessEntry(parentEntry)){ + if (!getParentProcessEntry(parentEntry)) { LOG((CLOG_ERR "could not get entry for parent process")); return false; } diff --git a/src/lib/arch/win32/ArchTaskBarWindows.cpp b/src/lib/arch/win32/ArchTaskBarWindows.cpp index c406124a..1d8eac18 100644 --- a/src/lib/arch/win32/ArchTaskBarWindows.cpp +++ b/src/lib/arch/win32/ArchTaskBarWindows.cpp @@ -511,4 +511,4 @@ ArchTaskBarWindows::threadEntry(void* self) HINSTANCE ArchTaskBarWindows::instanceWin32() { return ArchMiscWindows::instanceWin32(); -} \ No newline at end of file +} diff --git a/src/lib/arch/win32/XArchWindows.cpp b/src/lib/arch/win32/XArchWindows.cpp index 9391a375..eb3c1513 100644 --- a/src/lib/arch/win32/XArchWindows.cpp +++ b/src/lib/arch/win32/XArchWindows.cpp @@ -57,58 +57,58 @@ XArchEvalWinsock::eval() const noexcept // may not look up network error messages correctly. we'll have // to do it ourself. static const struct { int m_code; const char* m_msg; } s_netErrorCodes[] = { - /* 10004 */{WSAEINTR, "The (blocking) call was canceled via WSACancelBlockingCall"}, - /* 10009 */{WSAEBADF, "Bad file handle"}, - /* 10013 */{WSAEACCES, "The requested address is a broadcast address, but the appropriate flag was not set"}, - /* 10014 */{WSAEFAULT, "WSAEFAULT"}, - /* 10022 */{WSAEINVAL, "WSAEINVAL"}, - /* 10024 */{WSAEMFILE, "No more file descriptors available"}, - /* 10035 */{WSAEWOULDBLOCK, "Socket is marked as non-blocking and no connections are present or the receive operation would block"}, - /* 10036 */{WSAEINPROGRESS, "A blocking Windows Sockets operation is in progress"}, + /* 10004 */{WSAEINTR, "The (blocking) call was canceled via WSACancelBlockingCall"}, + /* 10009 */{WSAEBADF, "Bad file handle"}, + /* 10013 */{WSAEACCES, "The requested address is a broadcast address, but the appropriate flag was not set"}, + /* 10014 */{WSAEFAULT, "WSAEFAULT"}, + /* 10022 */{WSAEINVAL, "WSAEINVAL"}, + /* 10024 */{WSAEMFILE, "No more file descriptors available"}, + /* 10035 */{WSAEWOULDBLOCK, "Socket is marked as non-blocking and no connections are present or the receive operation would block"}, + /* 10036 */{WSAEINPROGRESS, "A blocking Windows Sockets operation is in progress"}, /* 10037 */{WSAEALREADY, "The asynchronous routine being canceled has already completed"}, /* 10038 */{WSAENOTSOCK, "At least on descriptor is not a socket"}, /* 10039 */{WSAEDESTADDRREQ, "A destination address is required"}, /* 10040 */{WSAEMSGSIZE, "The datagram was too large to fit into the specified buffer and was truncated"}, - /* 10041 */{WSAEPROTOTYPE, "The specified protocol is the wrong type for this socket"}, - /* 10042 */{WSAENOPROTOOPT, "The option is unknown or unsupported"}, - /* 10043 */{WSAEPROTONOSUPPORT,"The specified protocol is not supported"}, - /* 10044 */{WSAESOCKTNOSUPPORT,"The specified socket type is not supported by this address family"}, - /* 10045 */{WSAEOPNOTSUPP, "The referenced socket is not a type that supports that operation"}, + /* 10041 */{WSAEPROTOTYPE, "The specified protocol is the wrong type for this socket"}, + /* 10042 */{WSAENOPROTOOPT, "The option is unknown or unsupported"}, + /* 10043 */{WSAEPROTONOSUPPORT, "The specified protocol is not supported"}, + /* 10044 */{WSAESOCKTNOSUPPORT, "The specified socket type is not supported by this address family"}, + /* 10045 */{WSAEOPNOTSUPP, "The referenced socket is not a type that supports that operation"}, /* 10046 */{WSAEPFNOSUPPORT, "BSD: Protocol family not supported"}, /* 10047 */{WSAEAFNOSUPPORT, "The specified address family is not supported"}, - /* 10048 */{WSAEADDRINUSE, "The specified address is already in use"}, - /* 10049 */{WSAEADDRNOTAVAIL, "The specified address is not available from the local machine"}, + /* 10048 */{WSAEADDRINUSE, "The specified address is already in use"}, + /* 10049 */{WSAEADDRNOTAVAIL, "The specified address is not available from the local machine"}, /* 10050 */{WSAENETDOWN, "The Windows Sockets implementation has detected that the network subsystem has failed"}, - /* 10051 */{WSAENETUNREACH, "The network can't be reached from this host at this time"}, - /* 10052 */{WSAENETRESET, "The connection must be reset because the Windows Sockets implementation dropped it"}, + /* 10051 */{WSAENETUNREACH, "The network can't be reached from this host at this time"}, + /* 10052 */{WSAENETRESET, "The connection must be reset because the Windows Sockets implementation dropped it"}, /* 10053 */{WSAECONNABORTED, "The virtual circuit was aborted due to timeout or other failure"}, - /* 10054 */{WSAECONNRESET, "The virtual circuit was reset by the remote side"}, - /* 10055 */{WSAENOBUFS, "No buffer space is available or a buffer deadlock has occured. The socket cannot be created"}, - /* 10056 */{WSAEISCONN, "The socket is already connected"}, + /* 10054 */{WSAECONNRESET, "The virtual circuit was reset by the remote side"}, + /* 10055 */{WSAENOBUFS, "No buffer space is available or a buffer deadlock has occurred. The socket cannot be created"}, + /* 10056 */{WSAEISCONN, "The socket is already connected"}, /* 10057 */{WSAENOTCONN, "The socket is not connected"}, - /* 10058 */{WSAESHUTDOWN, "The socket has been shutdown"}, + /* 10058 */{WSAESHUTDOWN, "The socket has been shutdown"}, /* 10059 */{WSAETOOMANYREFS, "BSD: Too many references"}, - /* 10060 */{WSAETIMEDOUT, "Attempt to connect timed out without establishing a connection"}, + /* 10060 */{WSAETIMEDOUT, "Attempt to connect timed out without establishing a connection"}, /* 10061 */{WSAECONNREFUSED, "Connection was refused"}, - /* 10062 */{WSAELOOP, "Undocumented WinSock error code used in BSD"}, + /* 10062 */{WSAELOOP, "Undocumented WinSock error code used in BSD"}, /* 10063 */{WSAENAMETOOLONG, "Undocumented WinSock error code used in BSD"}, - /* 10064 */{WSAEHOSTDOWN, "Undocumented WinSock error code used in BSD"}, + /* 10064 */{WSAEHOSTDOWN, "Undocumented WinSock error code used in BSD"}, /* 10065 */{WSAEHOSTUNREACH, "No route to host"}, - /* 10066 */{WSAENOTEMPTY, "Undocumented WinSock error code"}, + /* 10066 */{WSAENOTEMPTY, "Undocumented WinSock error code"}, /* 10067 */{WSAEPROCLIM, "Undocumented WinSock error code"}, - /* 10068 */{WSAEUSERS, "Undocumented WinSock error code"}, - /* 10069 */{WSAEDQUOT, "Undocumented WinSock error code"}, - /* 10070 */{WSAESTALE, "Undocumented WinSock error code"}, - /* 10071 */{WSAEREMOTE, "Undocumented WinSock error code"}, - /* 10091 */{WSASYSNOTREADY, "Underlying network subsytem is not ready for network communication"}, - /* 10092 */{WSAVERNOTSUPPORTED, "The version of WinSock API support requested is not provided in this implementation"}, - /* 10093 */{WSANOTINITIALISED, "WinSock subsystem not properly initialized"}, - /* 10101 */{WSAEDISCON, "Virtual circuit has gracefully terminated connection"}, - /* 11001 */{WSAHOST_NOT_FOUND, "The specified host is unknown"}, - /* 11002 */{WSATRY_AGAIN, "A temporary error occurred on an authoritative name server"}, - /* 11003 */{WSANO_RECOVERY, "A non-recoverable name server error occurred"}, - /* 11004 */{WSANO_DATA, "The requested name is valid but does not have an IP address"}, - /* end */{0, NULL} + /* 10068 */{WSAEUSERS, "Undocumented WinSock error code"}, + /* 10069 */{WSAEDQUOT, "Undocumented WinSock error code"}, + /* 10070 */{WSAESTALE, "Undocumented WinSock error code"}, + /* 10071 */{WSAEREMOTE, "Undocumented WinSock error code"}, + /* 10091 */{WSASYSNOTREADY, "Underlying network subsystem is not ready for network communication"}, + /* 10092 */{WSAVERNOTSUPPORTED, "The version of WinSock API support requested is not provided in this implementation"}, + /* 10093 */{WSANOTINITIALISED, "WinSock subsystem not properly initialized"}, + /* 10101 */{WSAEDISCON, "Virtual circuit has gracefully terminated connection"}, + /* 11001 */{WSAHOST_NOT_FOUND, "The specified host is unknown"}, + /* 11002 */{WSATRY_AGAIN, "A temporary error occurred on an authoritative name server"}, + /* 11003 */{WSANO_RECOVERY, "A non-recoverable name server error occurred"}, + /* 11004 */{WSANO_DATA, "The requested name is valid but does not have an IP address"}, + /* end */{0, NULL} }; for (unsigned int i = 0; s_netErrorCodes[i].m_code != 0; ++i) { diff --git a/src/lib/barrier/App.h b/src/lib/barrier/App.h index ed034b62..749ca85d 100644 --- a/src/lib/barrier/App.h +++ b/src/lib/barrier/App.h @@ -90,7 +90,7 @@ public: ARCH_APP_UTIL& appUtil() { return m_appUtil; } - virtual IArchTaskBarReceiver* taskBarReceiver() const { return m_taskBarReceiver; } + virtual IArchTaskBarReceiver* taskBarReceiver() const { return m_taskBarReceiver; } virtual void setByeFunc(void(*bye)(int)) { m_bye = bye; } virtual void bye(int error) { m_bye(error); } diff --git a/src/lib/barrier/ArgParser.cpp b/src/lib/barrier/ArgParser.cpp index 5bf08b6c..1ac4baff 100644 --- a/src/lib/barrier/ArgParser.cpp +++ b/src/lib/barrier/ArgParser.cpp @@ -133,10 +133,10 @@ ArgParser::parseClientArgs(ClientArgs& args, int argc, const char* const* argv) return true; } -bool -ArgParser::parsePlatformArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i) -{ #if WINAPI_MSWINDOWS +bool +ArgParser::parseMSWindowsArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i) +{ if (isArg(i, argc, argv, NULL, "--service")) { LOG((CLOG_WARN "obsolete argument --service, use barrierd instead.")); argsBase.m_shouldExit = true; @@ -153,25 +153,46 @@ ArgParser::parsePlatformArg(ArgsBase& argsBase, const int& argc, const char* con } return true; -#elif WINAPI_XWINDOWS +} +#endif + +#if WINAPI_CARBON +bool +ArgParser::parseCarbonArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i) +{ + // no options for carbon + return false; +} +#endif + +#if WINAPI_XWINDOWS +bool +ArgParser::parseXWindowsArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i) +{ if (isArg(i, argc, argv, "-display", "--display", 1)) { // use alternative display argsBase.m_display = argv[++i]; } - else if (isArg(i, argc, argv, NULL, "--no-xinitthreads")) { argsBase.m_disableXInitThreads = true; - } - - else { + } else { // option not supported here return false; } return true; +} +#endif + +bool +ArgParser::parsePlatformArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i) +{ +#if WINAPI_MSWINDOWS + return parseMSWindowsArg(argsBase, argc, argv, i); #elif WINAPI_CARBON - // no options for carbon - return false; + return parseCarbonArg(argsBase, argc, argv, i); +#elif WINAPI_XWINDOWS + return parseXWindowsArg(argsBase, argc, argv, i); #endif } @@ -352,7 +373,7 @@ ArgParser::splitCommandString(String& command, std::vector& argv) if (space > leftDoubleQuote && space < rightDoubleQuote) { ignoreThisSpace = true; } - else if (space > rightDoubleQuote){ + else if (space > rightDoubleQuote) { searchDoubleQuotes(command, leftDoubleQuote, rightDoubleQuote, rightDoubleQuote + 1); } diff --git a/src/lib/barrier/ArgParser.h b/src/lib/barrier/ArgParser.h index 239a20cd..c8e9e68d 100644 --- a/src/lib/barrier/ArgParser.h +++ b/src/lib/barrier/ArgParser.h @@ -53,6 +53,9 @@ private: bool checkUnexpectedArgs(); static ArgsBase& argsBase() { return *m_argsBase; } + bool parseMSWindowsArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i); + bool parseCarbonArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i); + bool parseXWindowsArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i); private: App* m_app; diff --git a/src/lib/barrier/DropHelper.cpp b/src/lib/barrier/DropHelper.cpp index e3e15939..32f20cfc 100644 --- a/src/lib/barrier/DropHelper.cpp +++ b/src/lib/barrier/DropHelper.cpp @@ -18,6 +18,7 @@ #include "barrier/DropHelper.h" #include "base/Log.h" +#include "io/fstream.h" #include @@ -35,7 +36,7 @@ DropHelper::writeToDir(const String& destination, DragFileList& fileList, String dropTarget.append("/"); #endif dropTarget.append(fileList.at(0).getFilename()); - file.open(dropTarget.c_str(), std::ios::out | std::ios::binary); + barrier::open_utf8_path(file, dropTarget, std::ios::out | std::ios::binary); if (!file.is_open()) { LOG((CLOG_ERR "drop file failed: can not open %s", dropTarget.c_str())); } diff --git a/src/lib/barrier/IScreenSaver.h b/src/lib/barrier/IScreenSaver.h index 475f9f83..2099f6d1 100644 --- a/src/lib/barrier/IScreenSaver.h +++ b/src/lib/barrier/IScreenSaver.h @@ -56,7 +56,7 @@ public: //! Deactivate screen saver /*! - Deactivate (i.e. hide) the screen saver, reseting the screen saver + Deactivate (i.e. hide) the screen saver, resetting the screen saver timer. */ virtual void deactivate() = 0; diff --git a/src/lib/barrier/protocol_types.h b/src/lib/barrier/protocol_types.h index 7ed0d070..ccc1c3ea 100644 --- a/src/lib/barrier/protocol_types.h +++ b/src/lib/barrier/protocol_types.h @@ -267,8 +267,8 @@ extern const char* kMsgDSetOptions; // 2 means the file transfer is finished. extern const char* kMsgDFileTransfer; -// drag infomation: primary <-> secondary -// transfer drag infomation. The first 2 bytes are used for storing +// drag information: primary <-> secondary +// transfer drag information. The first 2 bytes are used for storing // the number of dragging objects. Then the following string consists // of each object's directory. extern const char* kMsgDDragInfo; diff --git a/src/lib/barrier/win32/DaemonApp.cpp b/src/lib/barrier/win32/DaemonApp.cpp index f8cf591a..88e6b4ef 100644 --- a/src/lib/barrier/win32/DaemonApp.cpp +++ b/src/lib/barrier/win32/DaemonApp.cpp @@ -34,7 +34,6 @@ #include "base/log_outputters.h" #include "base/Log.h" #include "common/DataDirectories.h" -#include "base/Unicode.h" #include "arch/win32/ArchMiscWindows.h" #include "arch/win32/XArchWindows.h" @@ -258,7 +257,7 @@ DaemonApp::handleIpcMessage(const Event& e, void*) switch (m->type()) { case kIpcCommand: { IpcCommandMessage* cm = static_cast(m); - String command = Unicode::UTF8ToText(cm->command()); + String command = cm->command(); // if empty quotes, clear. if (command == "\"\"") { diff --git a/src/lib/base/Log.cpp b/src/lib/base/Log.cpp index 6a43521d..66a5364b 100644 --- a/src/lib/base/Log.cpp +++ b/src/lib/base/Log.cpp @@ -62,7 +62,7 @@ Log::Log() { assert(s_log == NULL); - // other initalization + // other initialization m_maxPriority = g_defaultMaxPriority; m_maxNewlineLength = 0; insert(new ConsoleLogOutputter); diff --git a/src/lib/base/log_outputters.cpp b/src/lib/base/log_outputters.cpp index 1d43f605..6d3374b5 100644 --- a/src/lib/base/log_outputters.cpp +++ b/src/lib/base/log_outputters.cpp @@ -20,7 +20,7 @@ #include "base/TMethodJob.h" #include "arch/Arch.h" #include "base/String.h" - +#include "io/fstream.h" #include enum EFileLogOutputter { @@ -260,7 +260,7 @@ FileLogOutputter::write(ELevel level, const char *message) bool moveFile = false; std::ofstream m_handle; - m_handle.open(m_fileName.c_str(), std::fstream::app); + barrier::open_utf8_path(m_handle, m_fileName, std::fstream::app); if (m_handle.is_open() && m_handle.fail() != true) { m_handle << message << std::endl; diff --git a/src/lib/client/Client.h b/src/lib/client/Client.h index 6979fc3a..ea9af253 100644 --- a/src/lib/client/Client.h +++ b/src/lib/client/Client.h @@ -119,7 +119,7 @@ public: */ NetworkAddress getServerAddress() const; - //! Return true if recieved file size is valid + //! Return true if received file size is valid bool isReceivedFileSizeValid(); //! Return expected file size diff --git a/src/lib/common/common.h b/src/lib/common/common.h index 5eac5684..2feea235 100644 --- a/src/lib/common/common.h +++ b/src/lib/common/common.h @@ -18,13 +18,8 @@ #pragma once -#if defined(_WIN32) -# define SYSAPI_WIN32 1 -# define WINAPI_MSWINDOWS 1 -#elif HAVE_CONFIG_H +#if HAVE_CONFIG_H # include "config.h" -#else -# error "config.h missing" #endif // VC++ has built-in sized types diff --git a/src/lib/common/win32/DataDirectories.cpp b/src/lib/common/win32/DataDirectories.cpp index 3e86c59b..32bc2136 100644 --- a/src/lib/common/win32/DataDirectories.cpp +++ b/src/lib/common/win32/DataDirectories.cpp @@ -16,12 +16,26 @@ */ #include "../DataDirectories.h" -#include "KnownFolderPaths.h" +#include "encoding_utilities.h" + +#include + +std::string known_folder_path(const KNOWNFOLDERID& id) +{ + std::string path; + WCHAR* buffer; + HRESULT result = SHGetKnownFolderPath(id, 0, NULL, &buffer); + if (result == S_OK) { + path = win_wchar_to_utf8(buffer); + CoTaskMemFree(buffer); + } + return path; +} const std::string& DataDirectories::profile() { if (_profile.empty()) - _profile = localAppDataPath() + "\\Barrier"; + _profile = known_folder_path(FOLDERID_LocalAppData) + "\\Barrier"; return _profile; } const std::string& DataDirectories::profile(const std::string& path) @@ -33,7 +47,7 @@ const std::string& DataDirectories::profile(const std::string& path) const std::string& DataDirectories::global() { if (_global.empty()) - _global = programDataPath() + "\\Barrier"; + _global = known_folder_path(FOLDERID_ProgramData) + "\\Barrier"; return _global; } const std::string& DataDirectories::global(const std::string& path) @@ -45,7 +59,7 @@ const std::string& DataDirectories::global(const std::string& path) const std::string& DataDirectories::systemconfig() { // systemconfig() is a special case in that it will track the current value - // of global() unless and until it is explictly set otherwise + // of global() unless and until it is explicitly set otherwise // previously it would default to the windows folder which was horrible! if (_systemconfig.empty()) return global(); diff --git a/src/lib/common/win32/KnownFolderPaths.cpp b/src/lib/common/win32/KnownFolderPaths.cpp deleted file mode 100644 index 23ccc84a..00000000 --- a/src/lib/common/win32/KnownFolderPaths.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -* barrier -- mouse and keyboard sharing utility -* Copyright (C) 2018 Debauchee Open Source Group -* -* 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 "KnownFolderPaths.h" - -#define WIN32_LEAN_AND_MEAN -#include -#include - -static std::string wide_to_mb(const wchar_t* source, int length) -{ - int ansiLength = WideCharToMultiByte(CP_ACP, 0, source, length, NULL, 0, NULL, NULL); - if (ansiLength > 0) { - std::string ansiString(ansiLength, 0); - ansiLength = WideCharToMultiByte(CP_ACP, 0, source, length, &ansiString[0], ansiLength, NULL, NULL); - if (ansiLength > 0) { - return ansiString; - } - } - return {}; -} - -static std::string known_folder_path(const KNOWNFOLDERID& id) -{ - std::string path; - WCHAR* buffer; - HRESULT result = SHGetKnownFolderPath(id, 0, NULL, &buffer); - if (result == S_OK) { - auto length = lstrlenW(buffer); - path = wide_to_mb(buffer, length); - CoTaskMemFree(buffer); - } - return path; -} - -std::string desktopPath() -{ - return known_folder_path(FOLDERID_Desktop); -} - -std::string localAppDataPath() -{ - return known_folder_path(FOLDERID_LocalAppData); -} - -std::string programDataPath() -{ - return known_folder_path(FOLDERID_ProgramData); -} diff --git a/src/lib/common/win32/KnownFolderPaths.h b/src/lib/common/win32/KnownFolderPaths.h deleted file mode 100644 index 81b650ec..00000000 --- a/src/lib/common/win32/KnownFolderPaths.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -* barrier -- mouse and keyboard sharing utility -* Copyright (C) 2018 Debauchee Open Source Group -* -* 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 . -*/ - -#pragma once - -#include - -std::string desktopPath(); -std::string localAppDataPath(); -std::string programDataPath(); diff --git a/src/lib/common/win32/encoding_utilities.cpp b/src/lib/common/win32/encoding_utilities.cpp new file mode 100644 index 00000000..11781d36 --- /dev/null +++ b/src/lib/common/win32/encoding_utilities.cpp @@ -0,0 +1,37 @@ +/* + barrier -- mouse and keyboard sharing utility + Copyright (C) Barrier contributors + + 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 "encoding_utilities.h" +#include + +std::string win_wchar_to_utf8(const WCHAR* utfStr) +{ + int utfLength = lstrlenW(utfStr); + int mbLength = WideCharToMultiByte(CP_UTF8, 0, utfStr, utfLength, NULL, 0, NULL, NULL); + std::string mbStr(mbLength, 0); + WideCharToMultiByte(CP_UTF8, 0, utfStr, utfLength, &mbStr[0], mbLength, NULL, NULL); + return mbStr; +} + +std::vector utf8_to_win_char(const std::string& str) +{ + int result_len = MultiByteToWideChar(CP_UTF8, 0, str.data(), str.size(), NULL, 0); + std::vector result; + result.resize(result_len + 1, 0); + MultiByteToWideChar(CP_UTF8, 0, str.data(), str.size(), result.data(), result_len); + return result; +} diff --git a/src/lib/common/win32/encoding_utilities.h b/src/lib/common/win32/encoding_utilities.h new file mode 100644 index 00000000..747371e8 --- /dev/null +++ b/src/lib/common/win32/encoding_utilities.h @@ -0,0 +1,28 @@ +/* + barrier -- mouse and keyboard sharing utility + Copyright (C) Barrier contributors + + 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 . +*/ + +#ifndef BARRIER_LIB_COMMON_WIN32_ENCODING_UTILITIES_H +#define BARRIER_LIB_COMMON_WIN32_ENCODING_UTILITIES_H + +#include +#include +#include + +std::string win_wchar_to_utf8(const WCHAR* utfStr); +std::vector utf8_to_win_char(const std::string& str); + +#endif diff --git a/src/lib/io/fstream.cpp b/src/lib/io/fstream.cpp new file mode 100644 index 00000000..4aef9073 --- /dev/null +++ b/src/lib/io/fstream.cpp @@ -0,0 +1,57 @@ +/* + barrier -- mouse and keyboard sharing utility + Copyright (C) Barrier contributors + + 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 "fstream.h" +#if SYSAPI_WIN32 +#include "common/win32/encoding_utilities.h" +#endif +#include + +namespace barrier { + +namespace { + +template +void open_utf8_path_impl(Stream& stream, const std::string& path, std::ios_base::openmode mode) +{ +#if SYSAPI_WIN32 + // on Windows we need to use a private constructor from wchar_t* string. + auto wchar_path = utf8_to_win_char(path); + stream.open(wchar_path.data(), mode); +#else + stream.open(path.c_str(), mode); +#endif +} + +} // namespace + +void open_utf8_path(std::ifstream& stream, const std::string& path, std::ios_base::openmode mode) +{ + open_utf8_path_impl(stream, path, mode); +} + +void open_utf8_path(std::ofstream& stream, const std::string& path, std::ios_base::openmode mode) +{ + open_utf8_path_impl(stream, path, mode); +} + +void open_utf8_path(std::fstream& stream, const std::string& path, std::ios_base::openmode mode) +{ + open_utf8_path_impl(stream, path, mode); +} + +} // namespace barrier diff --git a/src/lib/io/fstream.h b/src/lib/io/fstream.h new file mode 100644 index 00000000..26288373 --- /dev/null +++ b/src/lib/io/fstream.h @@ -0,0 +1,35 @@ +/* + barrier -- mouse and keyboard sharing utility + Copyright (C) Barrier contributors + + 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 . +*/ + +#ifndef BARRIER_LIB_IO_FSTREAM_H +#define BARRIER_LIB_IO_FSTREAM_H + +#include +#include + +namespace barrier { + +void open_utf8_path(std::ifstream& stream, const std::string& path, + std::ios_base::openmode mode = std::ios_base::in); +void open_utf8_path(std::ofstream& stream, const std::string& path, + std::ios_base::openmode mode = std::ios_base::out); +void open_utf8_path(std::fstream& stream, const std::string& path, + std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out); + +} // namespace barrier + +#endif diff --git a/src/lib/ipc/IpcLogOutputter.cpp b/src/lib/ipc/IpcLogOutputter.cpp index c895dc12..223f52f7 100644 --- a/src/lib/ipc/IpcLogOutputter.cpp +++ b/src/lib/ipc/IpcLogOutputter.cpp @@ -29,7 +29,6 @@ #include "base/EventQueue.h" #include "base/TMethodEventJob.h" #include "base/TMethodJob.h" -#include "base/Unicode.h" enum EIpcLogOutputter { kBufferMaxSize = 1000, @@ -197,7 +196,7 @@ IpcLogOutputter::sendBuffer() return; } - IpcLogLineMessage message(Unicode::textToUTF8(getChunk(kMaxSendLines))); + IpcLogLineMessage message(getChunk(kMaxSendLines)); m_sending = true; m_ipcServer.send(message, kIpcClientGui); m_sending = false; diff --git a/src/lib/mt/Thread.h b/src/lib/mt/Thread.h index dbde3afc..8179aea0 100644 --- a/src/lib/mt/Thread.h +++ b/src/lib/mt/Thread.h @@ -25,7 +25,7 @@ class IJob; //! Thread handle /*! Creating a Thread creates a new context of execution (i.e. thread) that -runs simulatenously with the calling thread. A Thread is only a handle +runs simultaneously with the calling thread. A Thread is only a handle to a thread; deleting a Thread does not cancel or destroy the thread it refers to and multiple Thread objects can refer to the same thread. @@ -122,7 +122,7 @@ public: /*! Change the priority of the thread. Normal priority is 0, 1 is the next lower, etc. -1 is the next higher, etc. but boosting - the priority may not be permitted and will be silenty ignored. + the priority may not be permitted and will be silently ignored. */ void setPriority(int n); diff --git a/src/lib/net/NetworkAddress.h b/src/lib/net/NetworkAddress.h index b572d757..3a006af5 100644 --- a/src/lib/net/NetworkAddress.h +++ b/src/lib/net/NetworkAddress.h @@ -43,7 +43,7 @@ public: If \c hostname can be parsed as a numerical address then that's how it's used, otherwise it's used as a host name. If \c hostname ends in ":[0-9]+" then that suffix is extracted and used as the port, - overridding the port parameter. The resulting port must be a valid + overriding the port parameter. The resulting port must be a valid port number (zero is not a valid port number) otherwise \c XSocketAddress is thrown with an error of \c XSocketAddress::kBadPort. The hostname is not resolved by the c'tor; use \c resolve to do that. diff --git a/src/lib/net/SecureListenSocket.h b/src/lib/net/SecureListenSocket.h index 11456879..fab92bf5 100644 --- a/src/lib/net/SecureListenSocket.h +++ b/src/lib/net/SecureListenSocket.h @@ -24,7 +24,7 @@ class IEventQueue; class SocketMultiplexer; class IDataSocket; -class SecureListenSocket : public TCPListenSocket{ +class SecureListenSocket : public TCPListenSocket { public: SecureListenSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer, diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index d84f3461..c3c1a064 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -25,6 +25,7 @@ #include "base/Log.h" #include "base/String.h" #include "common/DataDirectories.h" +#include "io/fstream.h" #include #include @@ -658,7 +659,7 @@ SecureSocket::disconnect() void SecureSocket::formatFingerprint(std::string& fingerprint, bool hex, bool separator) { if (hex) { - // to hexidecimal + // to hexadecimal barrier::string::toHex(fingerprint, 2); } @@ -666,7 +667,7 @@ void SecureSocket::formatFingerprint(std::string& fingerprint, bool hex, bool se barrier::string::uppercase(fingerprint); if (separator) { - // add colon to separate each 2 charactors + // add colon to separate each 2 characters size_t separators = fingerprint.size() / 2; for (size_t i = 1; i < separators; i++) { fingerprint.insert(i * 3 - 1, ":"); @@ -708,7 +709,7 @@ SecureSocket::verifyCertFingerprint() // check if this fingerprint exist std::string fileLine; std::ifstream file; - file.open(trustedServersFilename.c_str()); + barrier::open_utf8_path(file, trustedServersFilename); if (!file.is_open()) { LOG((CLOG_NOTE "Unable to open trustedServersFile: %s", trustedServersFilename.c_str() )); @@ -830,7 +831,7 @@ SecureSocket::showSecureCipherInfo() } #if OPENSSL_VERSION_NUMBER < 0x10100000L - // m_ssl->m_ssl->session->ciphers is not forward compatable, + // m_ssl->m_ssl->session->ciphers is not forward compatible, // In future release of OpenSSL, it's not visible, STACK_OF(SSL_CIPHER) * cStack = m_ssl->m_ssl->session->ciphers; #else diff --git a/src/lib/platform/IMSWindowsClipboardFacade.h b/src/lib/platform/IMSWindowsClipboardFacade.h index 1c314736..d848184a 100644 --- a/src/lib/platform/IMSWindowsClipboardFacade.h +++ b/src/lib/platform/IMSWindowsClipboardFacade.h @@ -33,4 +33,4 @@ public: virtual ~IMSWindowsClipboardFacade() { } }; -#endif \ No newline at end of file +#endif diff --git a/src/lib/platform/ImmuneKeysReader.cpp b/src/lib/platform/ImmuneKeysReader.cpp index 72baed3c..eaeedc17 100644 --- a/src/lib/platform/ImmuneKeysReader.cpp +++ b/src/lib/platform/ImmuneKeysReader.cpp @@ -50,4 +50,4 @@ static void add_key(const char * const buffer, std::vector &keys) } } return true; -} \ No newline at end of file +} diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index be9a28d1..848ded78 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -803,7 +803,7 @@ MSWindowsDesks::checkDesk() // if active desktop changed then tell the old and new desk threads // about the change. don't switch desktops when the screensaver is - // active becaue we'd most likely switch to the screensaver desktop + // active because we'd most likely switch to the screensaver desktop // which would have the side effect of forcing the screensaver to // stop. if (name != m_activeDeskName && !m_screensaver->isActive()) { diff --git a/src/lib/platform/MSWindowsHookResource.cpp b/src/lib/platform/MSWindowsHookResource.cpp index ced5ff12..c6349ab3 100644 --- a/src/lib/platform/MSWindowsHookResource.cpp +++ b/src/lib/platform/MSWindowsHookResource.cpp @@ -30,4 +30,4 @@ bool WindowsHookResource::unset() } bool WindowsHookResource::is_set() const { return _hook != NULL; } -WindowsHookResource::operator HHOOK() const { return _hook; } \ No newline at end of file +WindowsHookResource::operator HHOOK() const { return _hook; } diff --git a/src/lib/platform/MSWindowsHookResource.h b/src/lib/platform/MSWindowsHookResource.h index b66c4b8c..a3c9d836 100644 --- a/src/lib/platform/MSWindowsHookResource.h +++ b/src/lib/platform/MSWindowsHookResource.h @@ -17,4 +17,4 @@ public: private: HHOOK _hook; -}; \ No newline at end of file +}; diff --git a/src/lib/platform/MSWindowsKeyState.cpp b/src/lib/platform/MSWindowsKeyState.cpp index 5afa9e8f..05d0dde0 100644 --- a/src/lib/platform/MSWindowsKeyState.cpp +++ b/src/lib/platform/MSWindowsKeyState.cpp @@ -61,12 +61,12 @@ const KeyID MSWindowsKeyState::s_virtualKey[] = /* 0x012 */ { kKeyAlt_L }, // VK_MENU /* 0x013 */ { kKeyPause }, // VK_PAUSE /* 0x014 */ { kKeyCapsLock }, // VK_CAPITAL - /* 0x015 */ { kKeyKana }, // VK_HANGUL, VK_KANA - /* 0x016 */ { kKeyNone }, // undefined + /* 0x015 */ { kKeyNone }, // undefined + /* 0x016 */ { kKeyKana }, // VK_HANGUL, VK_KANA, VK_IME_ON /* 0x017 */ { kKeyNone }, // VK_JUNJA /* 0x018 */ { kKeyNone }, // VK_FINAL /* 0x019 */ { kKeyKanzi }, // VK_HANJA, VK_KANJI - /* 0x01a */ { kKeyNone }, // undefined + /* 0x01a */ { kKeyEisuToggle }, // VK_IME_OFF /* 0x01b */ { kKeyEscape }, // VK_ESCAPE /* 0x01c */ { kKeyHenkan }, // VK_CONVERT /* 0x01d */ { kKeyMuhenkan }, // VK_NONCONVERT @@ -1330,7 +1330,7 @@ MSWindowsKeyState::getKeyID(UINT virtualKey, KeyButton button) const if ((LOWORD(m_keyLayout) & 0xffffu) == 0x0412u) { // 0x0412 : Korean Locale ID if (virtualKey == VK_HANGUL || virtualKey == VK_HANJA) { // If shift-space is used to change the input mode, - // the extented bit is not set. So add it to get right key id. + // the extended bit is not set. So add it to get right key id. button |= 0x100u; } } diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index 739a1e25..2449ba7c 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -41,9 +41,9 @@ #include "base/IEventQueue.h" #include "base/TMethodEventJob.h" #include "base/TMethodJob.h" -#include "common/win32/KnownFolderPaths.h" #include +#include #include #include @@ -1916,12 +1916,14 @@ const std::string& MSWindowsScreen::getDropTarget() const { if (m_dropTargetPath.empty()) { - m_dropTargetPath = desktopPath(); - if (!m_dropTargetPath.empty()) { - LOG((CLOG_DEBUG "using desktop for drop target: %s", m_dropTargetPath.c_str())); + // 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_dropTargetPath = std::string(desktopPath); + LOG((CLOG_INFO "using desktop for drop target: %s", m_dropTargetPath.c_str())); } else { - LOG((CLOG_ERR "failed to get desktop path, no drop target available")); + LOG((CLOG_ERR "failed to get desktop path, no drop target available, error=%d", GetLastError())); } } return m_dropTargetPath; diff --git a/src/lib/platform/MSWindowsSession.cpp b/src/lib/platform/MSWindowsSession.cpp index 90b8c142..daa92768 100644 --- a/src/lib/platform/MSWindowsSession.cpp +++ b/src/lib/platform/MSWindowsSession.cpp @@ -94,7 +94,7 @@ MSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL) } std::string nameListJoin; - for(std::list::iterator it = nameList.begin(); + for (std::list::iterator it = nameList.begin(); it != nameList.end(); it++) { nameListJoin.append(*it); nameListJoin.append(", "); diff --git a/src/lib/platform/MSWindowsWatchdog.h b/src/lib/platform/MSWindowsWatchdog.h index 4e752c0c..d3741619 100644 --- a/src/lib/platform/MSWindowsWatchdog.h +++ b/src/lib/platform/MSWindowsWatchdog.h @@ -81,7 +81,7 @@ private: //! Relauncher error /*! -An error occured in the process watchdog. +An error occurred in the process watchdog. */ class XMSWindowsWatchdogError : public XBarrier { public: diff --git a/src/lib/platform/OSXClipboard.cpp b/src/lib/platform/OSXClipboard.cpp index ed995d0b..ff1779ce 100644 --- a/src/lib/platform/OSXClipboard.cpp +++ b/src/lib/platform/OSXClipboard.cpp @@ -52,7 +52,7 @@ OSXClipboard::OSXClipboard() : OSStatus syncErr = PasteboardSynchronize(m_pboard); if (syncErr != noErr) { - LOG((CLOG_DEBUG "failed to syncronize clipboard: error %i", syncErr)); + LOG((CLOG_DEBUG "failed to synchronize clipboard: error %i", syncErr)); } } diff --git a/src/lib/platform/OSXDragSimulator.m b/src/lib/platform/OSXDragSimulator.m index affed383..735aa4a1 100644 --- a/src/lib/platform/OSXDragSimulator.m +++ b/src/lib/platform/OSXDragSimulator.m @@ -30,9 +30,9 @@ void runCocoaApp() { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - + [NSApplication sharedApplication]; - + NSWindow* window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, 3, 3) styleMask: NSBorderlessWindowMask @@ -41,16 +41,16 @@ runCocoaApp() [window setTitle: @""]; [window setAlphaValue:0.1]; [window makeKeyAndOrderFront:nil]; - + OSXDragView* dragView = [[OSXDragView alloc] initWithFrame:NSMakeRect(0, 0, 3, 3)]; - + g_dragWindow = window; g_dragView = dragView; [window setContentView: dragView]; - + NSLog(@"starting cocoa loop"); [NSApp run]; - + NSLog(@"cocoa: release"); [pool release]; } @@ -65,25 +65,25 @@ void fakeDragging(const char* str, int cursorX, int cursorY) { g_ext = [NSString stringWithUTF8String:str]; - + dispatch_async(dispatch_get_main_queue(), ^{ NSRect screen = [[NSScreen mainScreen] frame]; - NSLog ( @"screen size: witdh = %f height = %f", screen.size.width, screen.size.height); + NSLog ( @"screen size: width = %f height = %f", screen.size.width, screen.size.height); NSLog ( @"mouseLocation: %d %d", cursorX, cursorY); - + int newPosX = 0; int newPosY = 0; newPosX = cursorX - 1; newPosY = screen.size.height - cursorY - 1; - + NSRect rect = NSMakeRect(newPosX, newPosY, 3, 3); NSLog ( @"newPosX: %d", newPosX); NSLog ( @"newPosY: %d", newPosY); - + [g_dragWindow setFrame:rect display:NO]; [g_dragWindow makeKeyAndOrderFront:nil]; [NSApp activateIgnoringOtherApps:YES]; - + [g_dragView setFileExt:g_ext]; CGEventRef down = CGEventCreateMouseEvent(CGEventSourceCreate(kCGEventSourceStateHIDSystemState), kCGEventLeftMouseDown, CGPointMake(cursorX, cursorY), kCGMouseButtonLeft); diff --git a/src/lib/platform/OSXKeyState.cpp b/src/lib/platform/OSXKeyState.cpp index b1f070f5..aad20729 100644 --- a/src/lib/platform/OSXKeyState.cpp +++ b/src/lib/platform/OSXKeyState.cpp @@ -43,6 +43,9 @@ static const UInt32 s_launchpadVK = 131; static const UInt32 s_osxNumLock = 1 << 16; +static const UInt32 s_int4VK = 0x8a; // international4 +static const UInt32 s_int5VK = 0x8b; // international5 + struct KeyEntry { public: KeyID m_keyID; @@ -126,7 +129,10 @@ static const KeyEntry s_controlKeys[] = { // JIS keyboards only { kKeyEisuToggle, kVK_JIS_Eisu }, - { kKeyKana, kVK_JIS_Kana } + { kKeyKana, kVK_JIS_Kana }, + { kKeyMuhenkan, s_int5VK }, + { kKeyHenkan, s_int4VK }, + { kKeyZenkaku, kVK_ANSI_Grave } }; diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm index 2b4594ff..693ae45c 100644 --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -2,11 +2,11 @@ * barrier -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2004 Chris Schoeneman - * + * * 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 @@ -110,10 +110,10 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso updateScreenShape(m_displayID, 0); m_screensaver = new OSXScreenSaver(m_events, getEventTarget()); m_keyState = new OSXKeyState(m_events); - + // only needed when running as a server. if (m_isPrimary) { - + #if defined(MAC_OS_X_VERSION_10_9) // we can't pass options to show the dialog, this must be done by the gui. if (!AXIsProcessTrusted()) { @@ -126,7 +126,7 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso } #endif } - + // install display manager notification handler CGDisplayRegisterReconfigurationCallback(displayReconfigurationCallback, this); @@ -166,7 +166,7 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso if (m_switchEventHandlerRef != 0) { RemoveEventHandler(m_switchEventHandlerRef); } - + CGDisplayRemoveReconfigurationCallback(displayReconfigurationCallback, this); delete m_keyState; @@ -217,7 +217,7 @@ OSXScreen::~OSXScreen() delete m_keyState; delete m_screensaver; - + #if defined(MAC_OS_X_VERSION_10_7) delete m_carbonLoopMutex; delete m_carbonLoopReady; @@ -273,7 +273,7 @@ OSXScreen::warpCursor(SInt32 x, SInt32 y) pos.x = x; pos.y = y; CGWarpMouseCursorPosition(pos); - + // save new cursor position m_xCursor = x; m_yCursor = y; @@ -325,7 +325,7 @@ OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask)); return 0; } - + // choose hotkey id UInt32 id; if (!m_oldHotKeyIDs.empty()) { @@ -351,7 +351,7 @@ OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) } else { EventHotKeyID hkid = { 'SNRG', (UInt32)id }; - OSStatus status = RegisterEventHotKey(macKey, macMask, hkid, + OSStatus status = RegisterEventHotKey(macKey, macMask, hkid, GetApplicationEventTarget(), 0, &ref); okay = (status == noErr); @@ -366,7 +366,7 @@ OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) } m_hotKeys.insert(std::make_pair(id, HotKeyItem(ref, macKey, macMask))); - + LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", barrier::KeyMap::formatKey(key, mask).c_str(), key, mask, id)); return id; } @@ -468,7 +468,7 @@ OSXScreen::postMouseEvent(CGPoint& pos) const } } } - + CGEventType type = kCGEventMouseMoved; SInt8 button = m_buttonState.getFirstButtonDown(); @@ -478,10 +478,10 @@ OSXScreen::postMouseEvent(CGPoint& pos) const } CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, static_cast(button)); - + // Dragging events also need the click state CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState); - + // Fix for sticky keys CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags(); CGEventSetFlags(event, modifiers); @@ -503,7 +503,7 @@ OSXScreen::postMouseEvent(CGPoint& pos) const CGEventSetDoubleValueField(event, kCGMouseEventDeltaY, deltaFY); CGEventPost(kCGHIDEventTap, event); - + CFRelease(event); } @@ -515,7 +515,7 @@ OSXScreen::fakeMouseButton(ButtonID id, bool press) if (index >= NumButtonIDs) { return; } - + CGPoint pos; if (!m_cursorPosValid) { SInt32 x, y; @@ -533,55 +533,55 @@ OSXScreen::fakeMouseButton(ButtonID id, bool press) // since we don't have double click distance in NX APIs // we define our own defaults. const double maxDiff = sqrt(2) + 0.0001; - + double clickTime = [NSEvent doubleClickInterval]; - + // As long as the click is within the time window and distance window // increase clickState (double click, triple click, etc) - // This will allow for higher than triple click but the quartz documenation + // This will allow for higher than triple click but the quartz documentation // does not specify that this should be limited to triple click if (press) { - if ((ARCH->time() - m_lastClickTime) <= clickTime && diff <= maxDiff){ + if ((ARCH->time() - m_lastClickTime) <= clickTime && diff <= maxDiff) { m_clickState++; } else { m_clickState = 1; } - + m_lastClickTime = ARCH->time(); } - - if (m_clickState == 1){ + + if (m_clickState == 1) { m_lastSingleClickXCursor = m_xCursor; m_lastSingleClickYCursor = m_yCursor; } - + EMouseButtonState state = press ? kMouseButtonDown : kMouseButtonUp; - + LOG((CLOG_DEBUG1 "faking mouse button id: %d press: %s", index, press ? "pressed" : "released")); - + MouseButtonEventMapType thisButtonMap = MouseButtonEventMap[index]; CGEventType type = thisButtonMap[state]; CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, static_cast(index)); - + CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState); - + // Fix for sticky keys CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags(); CGEventSetFlags(event, modifiers); - + m_buttonState.set(index, state); CGEventPost(kCGHIDEventTap, event); - + CFRelease(event); - + if (!press && (id == kButtonLeft)) { if (m_fakeDraggingStarted) { m_getDropTargetThread = new Thread(new TMethodJob( this, &OSXScreen::getDropTargetThread)); } - + m_draggingStarted = false; } } @@ -591,21 +591,21 @@ OSXScreen::getDropTargetThread(void*) { #if defined(MAC_OS_X_VERSION_10_7) char* cstr = NULL; - + // wait for 5 secs for the drop destinaiton string to be filled. UInt32 timeout = ARCH->time() + 5; - + while (ARCH->time() < timeout) { CFStringRef cfstr = getCocoaDropTarget(); cstr = CFStringRefToUTF8String(cfstr); CFRelease(cfstr); - + if (cstr != NULL) { break; } ARCH->sleep(.1f); } - + if (cstr != NULL) { LOG((CLOG_DEBUG "drop target: %s", cstr)); m_dropTarget = cstr; @@ -626,12 +626,12 @@ OSXScreen::fakeMouseMove(SInt32 x, SInt32 y) if (m_fakeDraggingStarted) { m_buttonState.set(0, kMouseButtonDown); } - + // index 0 means left mouse button if (m_buttonState.test(0)) { m_draggingStarted = true; } - + // synthesize event CGPoint pos; pos.x = x; @@ -679,11 +679,11 @@ OSXScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const NULL, kCGScrollEventUnitLine, 2, mapScrollWheelFromBarrier(yDelta), -mapScrollWheelFromBarrier(xDelta)); - + // Fix for sticky keys CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags(); CGEventSetFlags(scrollEvent, modifiers); - + CGEventPost(kCGHIDEventTap, scrollEvent); CFRelease(scrollEvent); } @@ -754,11 +754,11 @@ OSXScreen::enable() if (m_isPrimary) { // FIXME -- start watching jump zones - + // kCGEventTapOptionDefault = 0x00000000 (Missing in 10.4, so specified literally) m_eventTapPort = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, - kCGEventMaskForAllEvents, - handleCGInputEvent, + kCGEventMaskForAllEvents, + handleCGInputEvent, this); } else { @@ -773,10 +773,10 @@ OSXScreen::enable() // there may be a better way to do this, but we register an event handler even if we're // not on the primary display (acting as a client). This way, if a local event comes in - // (either keyboard or mouse), we can make sure to show the cursor if we've hidden it. + // (either keyboard or mouse), we can make sure to show the cursor if we've hidden it. m_eventTapPort = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, - kCGEventMaskForAllEvents, - handleCGInputEventSecondary, + kCGEventMaskForAllEvents, + handleCGInputEventSecondary, this); } @@ -798,9 +798,9 @@ OSXScreen::disable() if (m_autoShowHideCursor) { showCursor(); } - + // FIXME -- stop watching jump zones, stop capturing input - + if (m_eventTapRLSR) { CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_eventTapRLSR, kCFRunLoopDefaultMode); CFRelease(m_eventTapRLSR); @@ -846,7 +846,7 @@ OSXScreen::enter() io_registry_entry_t entry = IORegistryEntryFromPath( kIOMasterPortDefault, "IOService:/IOResources/IODisplayWrangler"); - + if (entry != MACH_PORT_NULL) { IORegistryEntrySetCFProperty(entry, CFSTR("IORequestIdle"), kCFBooleanFalse); IOObjectRelease(entry); @@ -863,15 +863,15 @@ bool OSXScreen::leave() { hideCursor(); - + if (isDraggingStarted()) { String& fileList = getDraggingFilename(); - + if (!m_isPrimary) { if (fileList.empty() == false) { ClientApp& app = ClientApp::instance(); Client* client = app.getClientPtr(); - + DragInformation di; di.setFilename(fileList); DragFileList dragFileList; @@ -881,7 +881,7 @@ OSXScreen::leave() dragFileList, info); client->sendDragInfo(fileCount, info, info.size()); LOG((CLOG_DEBUG "send dragging file to server")); - + // TODO: what to do with multiple file or even // a folder client->sendFileToServer(fileList.c_str()); @@ -889,7 +889,7 @@ OSXScreen::leave() } m_draggingStarted = false; } - + if (m_isPrimary) { avoidHesitatingCursor(); @@ -906,8 +906,8 @@ OSXScreen::setClipboard(ClipboardID, const IClipboard* src) { if (src != NULL) { LOG((CLOG_DEBUG "setting clipboard")); - Clipboard::copy(&m_pasteboard, src); - } + Clipboard::copy(&m_pasteboard, src); + } return true; } @@ -1036,16 +1036,16 @@ OSXScreen::handleSystemEvent(const Event& event, void*) } break; - case kEventClassKeyboard: + case kEventClassKeyboard: switch (GetEventKind(*carbonEvent)) { case kEventHotKeyPressed: case kEventHotKeyReleased: onHotKey(*carbonEvent); break; } - + break; - + case kEventClassWindow: // 2nd param was formerly GetWindowEventTarget(m_userInputWindow) which is 32-bit only, // however as m_userInputWindow is never initialized to anything we can take advantage of @@ -1076,7 +1076,7 @@ OSXScreen::handleSystemEvent(const Event& event, void*) } } -bool +bool OSXScreen::onMouseMove(CGFloat mx, CGFloat my) { LOG((CLOG_DEBUG2 "mouse move %+f,%+f", mx, my)); @@ -1140,7 +1140,7 @@ OSXScreen::onMouseMove(CGFloat mx, CGFloat my) return true; } -bool +bool OSXScreen::onMouseButton(bool pressed, UInt16 macButton) { // Buttons 2 and 3 are inverted on the mac @@ -1176,7 +1176,7 @@ OSXScreen::onMouseButton(bool pressed, UInt16 macButton) } } } - + if (macButton == kButtonLeft) { EMouseButtonState state = pressed ? kMouseButtonDown : kMouseButtonUp; m_buttonState.set(kButtonLeft - 1, state); @@ -1189,7 +1189,7 @@ OSXScreen::onMouseButton(bool pressed, UInt16 macButton) m_getDropTargetThread = new Thread(new TMethodJob( this, &OSXScreen::getDropTargetThread)); } - + m_draggingStarted = false; } } @@ -1218,16 +1218,16 @@ OSXScreen::displayReconfigurationCallback(CGDirectDisplayID displayID, CGDisplay // Closing or opening the lid when an external monitor is // connected causes an kCGDisplayBeginConfigurationFlag event - CGDisplayChangeSummaryFlags mask = kCGDisplayBeginConfigurationFlag | kCGDisplayMovedFlag | - kCGDisplaySetModeFlag | kCGDisplayAddFlag | kCGDisplayRemoveFlag | - kCGDisplayEnabledFlag | kCGDisplayDisabledFlag | - kCGDisplayMirrorFlag | kCGDisplayUnMirrorFlag | + CGDisplayChangeSummaryFlags mask = kCGDisplayBeginConfigurationFlag | kCGDisplayMovedFlag | + kCGDisplaySetModeFlag | kCGDisplayAddFlag | kCGDisplayRemoveFlag | + kCGDisplayEnabledFlag | kCGDisplayDisabledFlag | + kCGDisplayMirrorFlag | kCGDisplayUnMirrorFlag | kCGDisplayDesktopShapeChangedFlag; - + LOG((CLOG_DEBUG1 "event: display was reconfigured: %x %x %x", flags, mask, flags & mask)); if (flags & mask) { /* Something actually did change */ - + LOG((CLOG_DEBUG1 "event: screen changed shape; refreshing dimensions")); screen->updateScreenShape(displayID, flags); } @@ -1274,7 +1274,7 @@ OSXScreen::onKey(CGEventRef event) m_activeModifierHotKeyMask = 0; } } - + return true; } @@ -1342,7 +1342,7 @@ OSXScreen::onKey(CGEventRef event) } void -OSXScreen::onMediaKey(CGEventRef event) +OSXScreen::onMediaKey(CGEventRef event) { KeyID keyID; bool down; @@ -1405,7 +1405,7 @@ OSXScreen::mapBarrierButtonToMac(UInt16 button) const return static_cast(button); } -ButtonID +ButtonID OSXScreen::mapMacButtonToBarrier(UInt16 macButton) const { switch (macButton) { @@ -1418,7 +1418,7 @@ OSXScreen::mapMacButtonToBarrier(UInt16 macButton) const case 3: return kButtonMiddle; } - + return static_cast(macButton); } @@ -1445,8 +1445,8 @@ OSXScreen::getScrollSpeed() const double scaling = 0.0; CFPropertyListRef pref = ::CFPreferencesCopyValue( - CFSTR("com.apple.scrollwheel.scaling") , - kCFPreferencesAnyApplication, + CFSTR("com.apple.scrollwheel.scaling") , + kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); if (pref != NULL) { @@ -1535,7 +1535,7 @@ OSXScreen::updateScreenShape() if (CGGetActiveDisplayList(0, NULL, &displayCount) != CGDisplayNoErr) { return; } - + if (displayCount == 0) { return; } @@ -1579,13 +1579,13 @@ OSXScreen::updateScreenShape() (displayCount == 1) ? "display" : "displays")); } -#pragma mark - +#pragma mark - // // FAST USER SWITCH NOTIFICATION SUPPORT // // OSXScreen::userSwitchCallback(void*) -// +// // gets called if a fast user switch occurs // @@ -1611,14 +1611,14 @@ OSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, return (CallNextEventHandler(nextHandler, theEvent)); } -#pragma mark - +#pragma mark - // // SLEEP/WAKEUP NOTIFICATION SUPPORT // // OSXScreen::watchSystemPowerThread(void*) -// -// main of thread monitoring system power (sleep/wakup) using a CFRunLoop +// +// main of thread monitoring system power (sleep/wakeup) using a CFRunLoop // void @@ -1641,7 +1641,7 @@ OSXScreen::watchSystemPowerThread(void*) CFRunLoopAddSource(m_pmRunloop, runloopSourceRef, kCFRunLoopCommonModes); } - + // thread is ready { Lock lock(m_pmMutex); @@ -1658,15 +1658,15 @@ OSXScreen::watchSystemPowerThread(void*) } LOG((CLOG_DEBUG "started watchSystemPowerThread")); - + LOG((CLOG_DEBUG "waiting for event loop")); m_events->waitForReady(); - + #if defined(MAC_OS_X_VERSION_10_7) { Lock lockCarbon(m_carbonLoopMutex); if (*m_carbonLoopReady == false) { - + // we signalling carbon loop ready before starting // unless we know how to do it within the loop LOG((CLOG_DEBUG "signalling carbon loop ready")); @@ -1676,12 +1676,12 @@ OSXScreen::watchSystemPowerThread(void*) } } #endif - + // start the run loop LOG((CLOG_DEBUG "starting carbon loop")); CFRunLoopRun(); LOG((CLOG_DEBUG "carbon loop has stopped")); - + // cleanup if (notificationPortRef) { CFRunLoopRemoveSource(m_pmRunloop, @@ -1716,7 +1716,7 @@ OSXScreen::handlePowerChangeRequest(natural_t messageType, void* messageArg) getEventTarget(), messageArg, Event::kDontFreeData)); return; - + case kIOMessageSystemHasPoweredOn: LOG((CLOG_DEBUG "system wakeup")); m_events->addEvent(Event(m_events->forIScreen().resume(), @@ -1742,16 +1742,16 @@ OSXScreen::handleConfirmSleep(const Event& event, void*) if (m_pmRootPort != 0) { // deliver suspend event immediately. m_events->addEvent(Event(m_events->forIScreen().suspend(), - getEventTarget(), NULL, + getEventTarget(), NULL, Event::kDeliverImmediately)); - + LOG((CLOG_DEBUG "system will sleep")); IOAllowPowerChange(m_pmRootPort, messageArg); } } } -#pragma mark - +#pragma mark - // // GLOBAL HOTKEY OPERATING MODE SUPPORT (10.3) @@ -1941,7 +1941,7 @@ OSXScreen::handleCGInputEvent(CGEventTapProxy proxy, case kCGEventMouseMoved: pos = CGEventGetLocation(event); screen->onMouseMove(pos.x, pos.y); - + // The system ignores our cursor-centering calls if // we don't return the event. This should be harmless, // but might register as slight movement to other apps @@ -1980,10 +1980,10 @@ OSXScreen::handleCGInputEvent(CGEventTapProxy proxy, } break; } - + LOG((CLOG_DEBUG3 "unknown quartz event type: 0x%02x", type)); } - + if (screen->m_isOnScreen) { return event; } else { @@ -1992,38 +1992,38 @@ OSXScreen::handleCGInputEvent(CGEventTapProxy proxy, } void -OSXScreen::MouseButtonState::set(UInt32 button, EMouseButtonState state) +OSXScreen::MouseButtonState::set(UInt32 button, EMouseButtonState state) { bool newState = (state == kMouseButtonDown); m_buttons.set(button, newState); } bool -OSXScreen::MouseButtonState::any() +OSXScreen::MouseButtonState::any() { return m_buttons.any(); } void -OSXScreen::MouseButtonState::reset() +OSXScreen::MouseButtonState::reset() { m_buttons.reset(); } void -OSXScreen::MouseButtonState::overwrite(UInt32 buttons) +OSXScreen::MouseButtonState::overwrite(UInt32 buttons) { m_buttons = std::bitset(buttons); } bool -OSXScreen::MouseButtonState::test(UInt32 button) const +OSXScreen::MouseButtonState::test(UInt32 button) const { return m_buttons.test(button); } SInt8 -OSXScreen::MouseButtonState::getFirstButtonDown() const +OSXScreen::MouseButtonState::getFirstButtonDown() const { if (m_buttons.any()) { for (unsigned short button = 0; button < m_buttons.size(); button++) { @@ -2041,7 +2041,7 @@ OSXScreen::CFStringRefToUTF8String(CFStringRef aString) if (aString == NULL) { return NULL; } - + CFIndex length = CFStringGetLength(aString); CFIndex maxSize = CFStringGetMaximumSizeForEncoding( length, diff --git a/src/lib/platform/XWindowsScreenSaver.h b/src/lib/platform/XWindowsScreenSaver.h index cce337fe..00285ec2 100644 --- a/src/lib/platform/XWindowsScreenSaver.h +++ b/src/lib/platform/XWindowsScreenSaver.h @@ -115,7 +115,7 @@ private: // the X display Display* m_display; - // window to receive xscreensaver repsonses + // window to receive xscreensaver responses Window m_xscreensaverSink; // the target for the events we generate diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index 334049cf..2eff0029 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -1136,9 +1136,9 @@ Server::processOptions() return; } - m_switchNeedsShift = false; // it seems if i don't add these + m_switchNeedsShift = false; // it seems if I don't add these m_switchNeedsControl = false; // lines, the 'reload config' option - m_switchNeedsAlt = false; // doesnt' work correct. + m_switchNeedsAlt = false; // doesn't work correct. bool newRelativeMoves = m_relativeMoves; for (Config::ScreenOptions::const_iterator index = options->begin(); diff --git a/src/lib/server/Server.h b/src/lib/server/Server.h index 38bbbd8e..cb71ec3d 100644 --- a/src/lib/server/Server.h +++ b/src/lib/server/Server.h @@ -167,7 +167,7 @@ public: */ void getClients(std::vector& list) const; - //! Return true if recieved file size is valid + //! Return true if received file size is valid bool isReceivedFileSizeValid(); //! Return expected file data size @@ -357,7 +357,7 @@ private: // force the cursor off of \p client void forceLeaveClient(BaseClientProxy* client); - // thread funciton for sending file + // thread function for sending file void sendFileThread(void*); // thread function for writing file to drop directory