From 2bbfe450aecffdbd1283f3d568e1cc9c66dd327c Mon Sep 17 00:00:00 2001 From: Steve Williams Date: Mon, 5 Mar 2018 13:43:47 +0000 Subject: [PATCH 1/4] #5648 Fixed mouse drift by switching from int to float --- src/lib/platform/OSXScreen.h | 2 +- src/lib/platform/OSXScreen.mm | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/lib/platform/OSXScreen.h b/src/lib/platform/OSXScreen.h index 25531e0e..6b1e8211 100644 --- a/src/lib/platform/OSXScreen.h +++ b/src/lib/platform/OSXScreen.h @@ -118,7 +118,7 @@ private: void sendClipboardEvent(Event::Type type, ClipboardID id) const; // message handlers - bool onMouseMove(SInt32 mx, SInt32 my); + bool onMouseMove(CGFloat mx, CGFloat my); // mouse button handler. pressed is true if this is a mousedown // event, false if it is a mouseup event. macButton is the index // of the button pressed using the mac button mapping. diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm index 93bec0e9..ba2814ef 100644 --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -1080,20 +1080,20 @@ OSXScreen::handleSystemEvent(const Event& event, void*) } bool -OSXScreen::onMouseMove(SInt32 mx, SInt32 my) +OSXScreen::onMouseMove(CGFloat mx, CGFloat my) { - LOG((CLOG_DEBUG2 "mouse move %+d,%+d", mx, my)); + LOG((CLOG_DEBUG2 "mouse move %+f,%+f", mx, my)); - SInt32 x = mx - m_xCursor; - SInt32 y = my - m_yCursor; + CGFloat x = mx - m_xCursor; + CGFloat y = my - m_yCursor; if ((x == 0 && y == 0) || (mx == m_xCenter && mx == m_yCenter)) { return true; } // save position to compute delta of next motion - m_xCursor = mx; - m_yCursor = my; + m_xCursor = (SInt32)mx; + m_yCursor = (SInt32)my; if (m_isOnScreen) { // motion on primary screen @@ -1122,7 +1122,21 @@ OSXScreen::onMouseMove(SInt32 mx, SInt32 my) } else { // send motion - sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y)); + // Accumulate together the move into the running total + static CGFloat m_xFractionalMove = 0; + static CGFloat m_yFractionalMove = 0; + + m_xFractionalMove += x; + m_yFractionalMove += y; + + // Return the integer part + SInt32 intX = (SInt32)m_xFractionalMove; + SInt32 intY = (SInt32)m_yFractionalMove; + + // And keep only the fractional part + m_xFractionalMove -= intX; + m_yFractionalMove -= intY; + sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(intX, intY)); } } From 2713b95af7e21322d4d7674335e5cc0cd8e48a3b Mon Sep 17 00:00:00 2001 From: Jnewbon <48688400+Jnewbon@users.noreply.github.com> Date: Fri, 5 Apr 2019 18:37:59 +0100 Subject: [PATCH 2/4] Fixed Hostname dialog box opening unnecessarily (#6468) #6392 Added check for autoconfig mode --- src/gui/src/MainWindow.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 751d2ee1..3813f1e4 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -763,14 +763,27 @@ bool MainWindow::clientArgs(QStringList& args, QString& app) } #endif - if (m_pLineEditHostname->text().isEmpty()) { - show(); - QMessageBox::warning( - this, tr("Hostname is empty"), - tr("Please fill in a hostname for the synergy client to connect to.")); - return false; - } + if (m_pLineEditHostname->text().isEmpty()) + { +#ifndef SYNERGY_ENTERPRISE + //check if autoconfig mode is enabled + if (!appConfig().autoConfig()) + { +#endif + show(); + QMessageBox::warning( + this, tr("Hostname is empty"), + tr("Please fill in a hostname for the synergy client to connect to.")); + return false; +#ifndef SYNERGY_ENTERPRISE + } + else + { + return false; + } +#endif + } args << m_pLineEditHostname->text() + ":" + QString::number(appConfig().port()); return true; } From 9bccfb89cca19abe85aca614a860b951c90fa9f7 Mon Sep 17 00:00:00 2001 From: Jnewbon <48688400+Jnewbon@users.noreply.github.com> Date: Fri, 26 Apr 2019 17:17:06 +0100 Subject: [PATCH 3/4] #6486 Added CI solution for automated builds * Added Ubuntu Dockers for 16, 18, and 19 * Added Cirrus CI build task for gcloud instance with SSDs * Added macOS instance build with brew Qt install * Fixed Qt headers for 5.12.2 used in Ubuntu 19.04 * Consolidated version info into CMake file --- .cirrus.yml | 62 +++++++++++++++++++++++++++++++++ CI/MacOS/qtifwsilent.qs | 56 +++++++++++++++++++++++++++++ CI/Windows/build.bat | 6 ++++ CI/Windows/qtifwsilent.qs | 54 ++++++++++++++++++++++++++++ CI/build.sh | 6 ++++ CI/package.sh | 12 +++++++ CI/ubuntu1604.Dockerfile | 24 +++++++++++++ CI/ubuntu1804.Dockerfile | 24 +++++++++++++ CI/ubuntu1904.Dockerfile | 24 +++++++++++++ CMakeLists.txt | 22 +++++++++++- src/gui/src/ActionDialog.cpp | 1 + src/gui/src/ScreenSetupView.cpp | 1 + 12 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 .cirrus.yml create mode 100644 CI/MacOS/qtifwsilent.qs create mode 100644 CI/Windows/build.bat create mode 100644 CI/Windows/qtifwsilent.qs create mode 100644 CI/build.sh create mode 100644 CI/package.sh create mode 100644 CI/ubuntu1604.Dockerfile create mode 100644 CI/ubuntu1804.Dockerfile create mode 100644 CI/ubuntu1904.Dockerfile diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 00000000..09408928 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,62 @@ +gcp_credentials: ENCRYPTED[d3110e2399b82e1d2adb6f9294917064a448a4d102c42c5023815723841db4ff7aa1d0df64a44281ed25b3adbeb08eff] + +windows_task: + gce_instance: + image_project: buildcluster-237411 + image_name: windows2019-vs2017-ramdisk + platform: windows + zone: us-central1-a + type: n1-highcpu-16 + disk: 32 + use_ssd: true + + env: + BONJOUR_SDK_HOME: C:\Program Files\Bonjour SDK\ + CMAKE_PREFIX_PATH: C:\Qt\5.9.5\msvc2017_64 + CIRRUS_WORKING_DIR: D:\ + + build_script: + - .\CI\Windows\build.bat + +ubuntu1604_task: + use_compute_credits: true + container: + dockerfile: CI/ubuntu1604.Dockerfile + build_script: + - pwd; ls -la + - chmod +x ./CI/build.sh + - ./CI/build.sh + +ubuntu1804_task: + use_compute_credits: true + container: + dockerfile: CI/ubuntu1804.Dockerfile + build_script: + - pwd; ls -la + - chmod +x ./CI/build.sh + - ./CI/build.sh + +ubuntu1904_task: + use_compute_credits: true + container: + dockerfile: CI/ubuntu1904.Dockerfile + build_script: + - pwd; ls -la + - chmod +x ./CI/build.sh + - ./CI/build.sh + +macos_task: + use_compute_credits: true + osx_instance: + image: mojave-xcode-10.2 + + env: + PATH: /usr/local/opt/qt/bin:$PATH + + install_script: + - brew install qt + build_script: + - mkdir build + - cd build + - cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DCMAKE_CONFIGURATION_TYPES=$CMAKE_BUILD_TYPE .. + - make diff --git a/CI/MacOS/qtifwsilent.qs b/CI/MacOS/qtifwsilent.qs new file mode 100644 index 00000000..d4069ef3 --- /dev/null +++ b/CI/MacOS/qtifwsilent.qs @@ -0,0 +1,56 @@ +function Controller() { + installer.autoRejectMessageBoxes(); + installer.installationFinished.connect(function() { + gui.clickButton(buttons.NextButton); + }) +} + +Controller.prototype.WelcomePageCallback = function() { + gui.clickButton(buttons.NextButton, 3000); +} + +Controller.prototype.CredentialsPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.IntroductionPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.TargetDirectoryPageCallback = function() +{ + gui.currentPageWidget().TargetDirectoryLineEdit.setText(installer.value("HomeDir") + "/Qt"); + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.ComponentSelectionPageCallback = function() { + var widget = gui.currentPageWidget(); + + widget.deselectAll(); + + widget.selectComponent("qt.595.clang_64") + + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.LicenseAgreementPageCallback = function() { + gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true); + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.StartMenuDirectoryPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.ReadyForInstallationPageCallback = function() +{ + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.FinishedPageCallback = function() { +var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm +if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) { + checkBoxForm.launchQtCreatorCheckBox.checked = false; +} + gui.clickButton(buttons.FinishButton); +} \ No newline at end of file diff --git a/CI/Windows/build.bat b/CI/Windows/build.bat new file mode 100644 index 00000000..61973076 --- /dev/null +++ b/CI/Windows/build.bat @@ -0,0 +1,6 @@ +SET VS_INSTALL_PATH=C:\"Program Files (x86)"\"Microsoft Visual Studio"\2019\Community\ +call %VS_INSTALL_PATH%Common7\Tools\VsDevCmd.bat +mkdir build +cd build +cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Debug .. +msbuild synergy-core.sln /p:Platform="x64" /p:Configuration=Debug /m \ No newline at end of file diff --git a/CI/Windows/qtifwsilent.qs b/CI/Windows/qtifwsilent.qs new file mode 100644 index 00000000..c980892a --- /dev/null +++ b/CI/Windows/qtifwsilent.qs @@ -0,0 +1,54 @@ +function Controller() { + installer.autoRejectMessageBoxes(); + installer.installationFinished.connect(function() { + gui.clickButton(buttons.NextButton); + }) +} + +Controller.prototype.WelcomePageCallback = function() { + gui.clickButton(buttons.NextButton, 3000); +} + +Controller.prototype.CredentialsPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.IntroductionPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.TargetDirectoryPageCallback = function() { + gui.currentPageWidget().TargetDirectoryLineEdit.setText(installer.environmentVariable("QT_INSTALL_DIR")); + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.ComponentSelectionPageCallback = function() { + var widget = gui.currentPageWidget(); + widget.deselectAll(); + widget.selectComponent("qt.595.win32_msvc2015"); + widget.selectComponent("qt.595.win64_msvc2015_64"); + widget.selectComponent("qt.595.qtscript"); + widget.selectComponent("qt.tools.vcredist_msvc2015_x86"); + widget.selectComponent("qt.tools.vcredist_msvc2015_x64"); + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.LicenseAgreementPageCallback = function() { + gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true); + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.StartMenuDirectoryPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.ReadyForInstallationPageCallback = function() { + gui.clickButton(buttons.NextButton); +} + +Controller.prototype.FinishedPageCallback = function() { + var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm; + if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) + checkBoxForm.launchQtCreatorCheckBox.checked = false; + gui.clickButton(buttons.FinishButton); +} \ No newline at end of file diff --git a/CI/build.sh b/CI/build.sh new file mode 100644 index 00000000..d940c135 --- /dev/null +++ b/CI/build.sh @@ -0,0 +1,6 @@ +pwd +ls -la +mkdir build +cd build +cmake .. +make \ No newline at end of file diff --git a/CI/package.sh b/CI/package.sh new file mode 100644 index 00000000..e5a3fa59 --- /dev/null +++ b/CI/package.sh @@ -0,0 +1,12 @@ +cd ${CIRRUS_WORKING_DIR} + +source ./build/version + +SYNERGY_VERSION="$SYNERGY_VERSION_MAJOR.$SYNERGY_VERSION_MINOR.$SYNERGY_VERSION_PATCH" +SYNERGY_REVISION=`git rev-parse --short=8 HEAD` +SYNERGY_DEB_VERSION="${SYNERGY_VERSION}.${SYNERGY_VERSION_STAGE}~b${BUILD_NUMBER}+${SYNERGY_REVISION}" + +dch --create --package "synergy" --controlmaint --distribution unstable --newversion $SYNERGY_DEB_VERSION "Initial release" + +export DEB_BUILD_OPTIONS="parallel=4" +debuild --preserve-envvar SYNERGY_* --preserve-envvar GIT_COMMIT --preserve-envvar BUILD_NUMBER \ No newline at end of file diff --git a/CI/ubuntu1604.Dockerfile b/CI/ubuntu1604.Dockerfile new file mode 100644 index 00000000..de1b1c64 --- /dev/null +++ b/CI/ubuntu1604.Dockerfile @@ -0,0 +1,24 @@ +# +# Ubuntu Dockerfile +# +# https://github.com/dockerfile/ubuntu +# + +# Pull base image. +FROM ubuntu:16.04 + +# Install. +RUN \ + sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ + apt-get update && \ + apt-get install -y git cmake qtbase5-dev build-essential libx11-dev libxtst-dev libgl1-mesa-dev libssl-dev libavahi-compat-libdnssd-dev && \ + apt-get install -y debhelper devscripts + +# Set environment variables. +ENV HOME /root + +# Define working directory. +WORKDIR /root + +# Define default command. +CMD ["bash"] \ No newline at end of file diff --git a/CI/ubuntu1804.Dockerfile b/CI/ubuntu1804.Dockerfile new file mode 100644 index 00000000..733cbbd7 --- /dev/null +++ b/CI/ubuntu1804.Dockerfile @@ -0,0 +1,24 @@ +# +# Ubuntu Dockerfile +# +# https://github.com/dockerfile/ubuntu +# + +# Pull base image. +FROM ubuntu:18.04 + +# Install. +RUN \ + sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ + apt-get update && \ + apt-get install -y git cmake qtbase5-dev build-essential libx11-dev libxtst-dev libgl1-mesa-dev libssl-dev libavahi-compat-libdnssd-dev && \ + apt-get install -y debhelper devscripts + +# Set environment variables. +ENV HOME /root + +# Define working directory. +WORKDIR /root + +# Define default command. +CMD ["bash"] \ No newline at end of file diff --git a/CI/ubuntu1904.Dockerfile b/CI/ubuntu1904.Dockerfile new file mode 100644 index 00000000..2e48cf4f --- /dev/null +++ b/CI/ubuntu1904.Dockerfile @@ -0,0 +1,24 @@ +# +# Ubuntu Dockerfile +# +# https://github.com/dockerfile/ubuntu +# + +# Pull base image. +FROM ubuntu:19.04 + +# Install. +RUN \ + sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ + apt-get update && \ + apt-get install -y git cmake qtbase5-dev build-essential libx11-dev libxtst-dev libgl1-mesa-dev libssl-dev libavahi-compat-libdnssd-dev && \ + apt-get install -y debhelper devscripts + +# Set environment variables. +ENV HOME /root + +# Define working directory. +WORKDIR /root + +# Define default command. +CMD ["bash"] \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 35bbfabb..bf9eecbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -336,6 +336,23 @@ macro (configure_files srcDir destDir) endforeach (templateFile) endmacro (configure_files) +macro(generate_versionfile) + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux") + FILE(WRITE ${CMAKE_BINARY_DIR}/version + "export SYNERGY_VERSION_MAJOR=\"${SYNERGY_VERSION_MAJOR}\"\n" + "export SYNERGY_VERSION_MINOR=\"${SYNERGY_VERSION_MINOR}\"\n" + "export SYNERGY_VERSION_PATCH=\"${SYNERGY_VERSION_PATCH}\"\n" + "export SYNERGY_VERSION_STAGE=\"${SYNERGY_VERSION_STAGE}\"\n") + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + FILE(WRITE ${CMAKE_BINARY_DIR}/version + "$env:SYNERGY_VERSION_MAJOR=\"${SYNERGY_VERSION_MAJOR}\"\n" + "$env:SYNERGY_VERSION_MINOR=\"${SYNERGY_VERSION_MINOR}\"\n" + "$env:SYNERGY_VERSION_PATCH=\"${SYNERGY_VERSION_PATCH}\"\n" + "$env:SYNERGY_VERSION_STAGE=\"${SYNERGY_VERSION_STAGE}\"\n") + endif() +endmacro(generate_versionfile) + + if (${SYNERGY_BUILD_LEGACY_INSTALLER}) # # macOS app Bundle @@ -346,7 +363,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set (SYNERGY_BUNDLE_DIR ${CMAKE_BINARY_DIR}/bundle) set (SYNERGY_BUNDLE_APP_DIR ${SYNERGY_BUNDLE_DIR}/Synergy.app) set (SYNERGY_BUNDLE_BINARY_DIR ${SYNERGY_BUNDLE_APP_DIR}/Contents/MacOS) - + + generate_versionfile() configure_files (${SYNERGY_BUNDLE_SOURCE_DIR} ${SYNERGY_BUNDLE_DIR}) endif() @@ -356,6 +374,7 @@ endif() if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") message (STATUS "Configuring the v1 installer") configure_files (${CMAKE_CURRENT_SOURCE_DIR}/dist/wix ${CMAKE_BINARY_DIR}/installer) + generate_versionfile() endif() # @@ -369,6 +388,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") else() install(FILES res/synergy.desktop DESTINATION share/applications) endif() + generate_versionfile() endif() else() diff --git a/src/gui/src/ActionDialog.cpp b/src/gui/src/ActionDialog.cpp index 94950338..2adc7f7a 100644 --- a/src/gui/src/ActionDialog.cpp +++ b/src/gui/src/ActionDialog.cpp @@ -25,6 +25,7 @@ #include #include +#include ActionDialog::ActionDialog(QWidget* parent, ServerConfig& config, Hotkey& hotkey, Action& action) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), diff --git a/src/gui/src/ScreenSetupView.cpp b/src/gui/src/ScreenSetupView.cpp index f26d9700..1f83068f 100644 --- a/src/gui/src/ScreenSetupView.cpp +++ b/src/gui/src/ScreenSetupView.cpp @@ -22,6 +22,7 @@ #include #include +#include ScreenSetupView::ScreenSetupView(QWidget* parent) : QTableView(parent) From a56abf68dd4fd1bfacecfac82841c7210a5d1184 Mon Sep 17 00:00:00 2001 From: Jnewbon <48688400+Jnewbon@users.noreply.github.com> Date: Mon, 29 Apr 2019 13:56:08 +0100 Subject: [PATCH 4/4] #6488 Fixed a memory leak in the TLS socket code --- src/lib/net/SecureSocket.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index 43b45e2a..21d9bbdf 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -199,6 +199,7 @@ SecureSocket::doWrite() { static bool s_retry = false; static int s_retrySize = 0; + static int s_staticBufferSize = 0; static void* s_staticBuffer = NULL; // write data @@ -211,8 +212,13 @@ SecureSocket::doWrite() } else { bufferSize = m_outputBuffer.getSize(); - s_staticBuffer = malloc(bufferSize); - memcpy(s_staticBuffer, m_outputBuffer.peek(bufferSize), bufferSize); + if (bufferSize != 0) { + if (bufferSize > s_staticBufferSize) { + s_staticBuffer = realloc(s_staticBuffer, bufferSize); + s_staticBufferSize = bufferSize; + } + memcpy(s_staticBuffer, m_outputBuffer.peek(bufferSize), bufferSize); + } } if (bufferSize == 0) { @@ -224,8 +230,6 @@ SecureSocket::doWrite() if (status > 0) { s_retry = false; bufferSize = 0; - free(s_staticBuffer); - s_staticBuffer = NULL; } else if (status < 0) { return kBreak;