restructured source code, put CMakeLists.txt in more conventional locations, and split the libraries up

This commit is contained in:
Nick Bolton 2011-04-25 21:09:32 +00:00
parent 9dc96ef0a0
commit 143c4cd297
471 changed files with 1152 additions and 8011 deletions

View File

@ -19,13 +19,12 @@ set(VERSION_MINOR 5)
set(VERSION_REV 0)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}")
# The check for 2.6 may be too strict (consider lowering).
cmake_minimum_required(VERSION 2.4.7)
# CMake complains if we don't have this.
if (COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0003 NEW)
cmake_policy(SET CMP0003 NEW)
endif()
# We're escaping quotes in the Windows version number, because
@ -33,7 +32,7 @@ endif()
# It seems that this restores the newer behaviour where define
# args are not auto-escaped.
if (COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0005 NEW)
cmake_policy(SET CMP0005 NEW)
endif()
# First, declare project (important for prerequisite checks).
@ -46,26 +45,207 @@ set(bin_dir ${root_dir}/bin)
set(doc_dir ${root_dir}/doc)
set(doc_dir ${root_dir}/doc)
# Now for the stuff to generate config.h (and setup defines).
include(${cmake_dir}/CMakeLists_config.txt)
# Declare libs, so we can use list in linker later. There's probably
# a more elegant way of doing this; with SCons, when you check for the
# lib, it is automatically passed to the linker.
set(libs)
# Now for all the executables and libraries.
include(${cmake_dir}/CMakeLists_lib.txt)
include(${cmake_dir}/CMakeLists_synergyc.txt)
include(${cmake_dir}/CMakeLists_synergys.txt)
include(${cmake_dir}/CMakeLists_launcher.txt)
include(${cmake_dir}/CMakeLists_gtest.txt)
include(${cmake_dir}/CMakeLists_test.txt)
# Depending on the platform, pass in the required defines.
if (UNIX)
# For config.h, detect the libraries, functions, etc.
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckFunctionExists)
include(CheckTypeSize)
include(CheckIncludeFileCXX)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
check_include_file_cxx(istream HAVE_ISTREAM)
check_include_file_cxx(ostream HAVE_OSTREAM)
check_include_file_cxx(sstream HAVE_SSTREAM)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(locale.h HAVE_LOCALE_H)
check_include_files(memory.h HAVE_MEMORY_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(string.h HAVE_STRING_H)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(wchar.h HAVE_WCHAR_H)
check_function_exists(getpwuid_r HAVE_GETPWUID_R)
check_function_exists(gmtime_r HAVE_GMTIME_R)
check_function_exists(nanosleep HAVE_NANOSLEEP)
check_function_exists(poll HAVE_POLL)
check_function_exists(sigwait HAVE_POSIX_SIGWAIT)
check_function_exists(strftime HAVE_STRFTIME)
check_function_exists(vsnprintf HAVE_VSNPRINTF)
check_function_exists(inet_aton HAVE_INET_ATON)
# For some reason, the check_function_exists macro doesn't detect
# the inet_aton on some pure Unix platforms (e.g. sunos5). So we
# need to do a more detailed check and also include some extra libs.
if (NOT HAVE_INET_ATON)
set(CMAKE_REQUIRED_LIBRARIES nsl)
check_c_source_compiles(
"#include <arpa/inet.h>\n int main() { inet_aton(0, 0); }"
HAVE_INET_ATON_ADV)
set(CMAKE_REQUIRED_LIBRARIES)
if (HAVE_INET_ATON_ADV)
# Override the previous fail.
set(HAVE_INET_ATON 1)
# Assume that both nsl and socket will be needed,
# it seems safe to add socket on the back of nsl,
# since socket only ever needed when nsl is needed.
list(APPEND libs nsl socket)
endif()
endif()
check_type_size(char SIZEOF_CHAR)
check_type_size(int SIZEOF_INT)
check_type_size(long SIZEOF_LONG)
check_type_size(short SIZEOF_SHORT)
# pthread is used on both Linux and Mac
check_library_exists("pthread" pthread_create "" HAVE_PTHREAD)
if (HAVE_PTHREAD)
list(APPEND libs pthread)
else (HAVE_PTHREAD)
message(FATAL_ERROR "Missing library: pthread")
endif()
if (APPLE)
# build mac os x universal
set(CMAKE_OSX_ARCHITECTURES "ppc;i386"
CACHE STRING "Build architectures for OSX" FORCE)
find_library(lib_ScreenSaver ScreenSaver)
find_library(lib_IOKit IOKit)
find_library(lib_ApplicationServices ApplicationServices)
find_library(lib_Foundation Foundation)
find_library(lib_Carbon Carbon)
list(APPEND libs
${lib_ScreenSaver}
${lib_IOKit}
${lib_ApplicationServices}
${lib_Foundation}
${lib_Carbon}
)
else (APPLE)
set(XKBlib "X11/XKBlib.h")
check_include_files("${XKBlib};X11/extensions/dpms.h" HAVE_X11_EXTENSIONS_DPMS_H)
check_include_files("X11/extensions/Xinerama.h" HAVE_X11_EXTENSIONS_XINERAMA_H)
check_include_files("${XKBlib};X11/extensions/XKBstr.h" HAVE_X11_EXTENSIONS_XKBSTR_H)
check_include_files("X11/extensions/XKB.h" HAVE_XKB_EXTENSION)
check_include_files("X11/extensions/XTest.h" HAVE_X11_EXTENSIONS_XTEST_H)
check_include_files(${XKBlib} HAVE_X11_XKBLIB_H)
if (HAVE_X11_EXTENSIONS_DPMS_H)
# Assume that function prototypes declared, when include exists.
set(HAVE_DPMS_PROTOTYPES 1)
endif()
if (NOT HAVE_X11_XKBLIB_H)
message(FATAL_ERROR "Missing header: " ${XKBlib})
endif()
check_library_exists("SM;ICE" IceConnectionNumber "" HAVE_ICE)
check_library_exists("X11;Xext" DPMSQueryExtension "" HAVE_Xext)
check_library_exists("X11;Xext;Xtst" XTestQueryExtension "" HAVE_Xtst)
check_library_exists("Xinerama" XineramaQueryExtension "" HAVE_Xinerama)
if (HAVE_ICE)
# Assume we have SM if we have ICE.
set(HAVE_SM 1)
list(APPEND libs SM ICE)
endif()
if (HAVE_Xtst)
# Xtxt depends on X11.
set(HAVE_X11)
list(APPEND libs X11 Xtst)
else (HAVE_Xtst)
message(FATAL_ERROR "Missing library: Xtst")
endif()
if (HAVE_Xext)
list(APPEND libs Xext)
endif()
if (HAVE_Xinerama)
list(APPEND libs Xinerama)
else (HAVE_Xinerama)
if (HAVE_X11_EXTENSIONS_XINERAMA_H)
message(FATAL_ERROR "Missing library: Xinerama")
endif()
endif()
endif()
# For config.h, set some static values; it may be a good idea to make
# these values dynamic for non-standard UNIX compilers.
set(ACCEPT_TYPE_ARG3 socklen_t)
set(HAVE_CXX_BOOL 1)
set(HAVE_CXX_CASTS 1)
set(HAVE_CXX_EXCEPTIONS 1)
set(HAVE_CXX_MUTABLE 1)
set(HAVE_CXX_STDLIB 1)
set(HAVE_PTHREAD_SIGNAL 1)
set(SELECT_TYPE_ARG1 int)
set(SELECT_TYPE_ARG234 "(fd_set *)")
set(SELECT_TYPE_ARG5 "(struct timeval *)")
set(STDC_HEADERS 1)
set(TIME_WITH_SYS_TIME 1)
set(HAVE_SOCKLEN_T 1)
# For config.h, save the results based on a template (config.h.in).
configure_file(${cmake_dir}/config.h.in ${root_dir}/config.h)
add_definitions(-DSYSAPI_UNIX=1 -DHAVE_CONFIG_H)
if (APPLE)
add_definitions(-DWINAPI_CARBON=1 -D_THREAD_SAFE -DMACOSX_DEPLOYMENT_TARGET=10.4)
else (APPLE)
add_definitions(-DWINAPI_XWINDOWS=1)
endif()
else (UNIX)
list(APPEND libs Wtsapi32 Userenv)
add_definitions(
/DWIN32
/D_WINDOWS
/D_CRT_SECURE_NO_WARNINGS
/DVERSION=\"${VERSION}\"
)
if (CONF_CPACK)
# Setup the CPack config.
include(${cmake_dir}/CMakeLists_cpack.txt)
endif()
if (CONF_DOXYGEN)
# Setup doxygen
include(${cmake_dir}/CMakeLists_doxygen.txt)
endif()
add_subdirectory(src)
if (WIN32)
# add /analyze in order to unconver potential bugs in the source code
@ -96,3 +276,106 @@ if (WIN32)
set(CMAKE_CXX_FLAGS_RELEASE "/MD /O2 /Ob2")
endif()
if (CONF_CPACK)
if (WIN32)
message(FATAL_ERROR "CPack support for Windows has been removed.")
endif()
install(TARGETS
synergys
synergyc
COMPONENT core
DESTINATION bin)
if (UNIX)
if (APPLE)
# no cpack support for apple
else ()
install(FILES bin/qsynergy
DESTINATION bin
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
# install gnome menu item
install(FILES cmake/synergy.desktop
DESTINATION share/applications)
install(FILES cmd/launcher/synergy.ico
DESTINATION share/icons)
endif()
endif()
# The default CPack behaviour is not to append the system processor
# type, which is undesirable in our case, since we want to support
# both 32-bit and 64-bit processors.
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
# For source code, use .tar.gz on Unix, and .zip on Windows
if (UNIX)
set(CPACK_SOURCE_GENERATOR TGZ)
else (UNIX)
set(CPACK_SOURCE_GENERATOR ZIP)
endif()
if (APPLE)
set(CPACK_SYSTEM_NAME "MacOSX-Universal")
endif()
set(CPACK_PACKAGE_NAME "synergy")
set(CPACK_PACKAGE_VENDOR "The Synergy Project")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Synergy server and client")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_REV})
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_PACKAGE_CONTACT http://synergy-foss.org/)
set(CPACK_RESOURCE_FILE_LICENSE "${cmake_dir}/License.rtf")
set(CPACK_RESOURCE_FILE_README "${cmake_dir}/Readme.txt")
# files to exclude from src package (regex patterns)
# to escape, use 4 backslashes (\\\\) -- yuck!
set(CPACK_SOURCE_IGNORE_FILES
# temp output dir in root
"/bin/"
# generated config.h file
"/config\\\\.h$"
# buildbot stuff
"\\\\.buildbot\\\\-sourcedata$"
# qt temp build dir
"/gui/tmp/.*"
# qt make file
"/gui/Makefile$"
# qt generated ui headers
"/gui/ui_.*\\\\.h$"
# compiled python files
".*\\\\.pyc$"
# subversion caches (all dirs)
".*/\\\\.svn/.*"
# emacs temporary files
".*~$"
)
# Must be last (since it relies of CPACK_ vars).
include(CPack)
endif()
if (CONF_DOXYGEN)
set(VERSION, "${VERSION}")
# For doxygen.cfg, save the results based on a template (doxygen.cfg.in).
configure_file(${cmake_dir}/doxygen.cfg.in ${doc_dir}/doxygen.cfg)
endif()

View File

@ -1,214 +0,0 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# 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 COPYING 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 <http://www.gnu.org/licenses/>.
# Declare libs, so we can use list in linker later. There's probably
# a more elegant way of doing this; with SCons, when you check for the
# lib, it is automatically passed to the linker.
set(libs)
# Depending on the platform, pass in the required defines.
if (UNIX)
# For config.h, detect the libraries, functions, etc.
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckFunctionExists)
include(CheckTypeSize)
include(CheckIncludeFileCXX)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
check_include_file_cxx(istream HAVE_ISTREAM)
check_include_file_cxx(ostream HAVE_OSTREAM)
check_include_file_cxx(sstream HAVE_SSTREAM)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(locale.h HAVE_LOCALE_H)
check_include_files(memory.h HAVE_MEMORY_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(string.h HAVE_STRING_H)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(wchar.h HAVE_WCHAR_H)
check_function_exists(getpwuid_r HAVE_GETPWUID_R)
check_function_exists(gmtime_r HAVE_GMTIME_R)
check_function_exists(nanosleep HAVE_NANOSLEEP)
check_function_exists(poll HAVE_POLL)
check_function_exists(sigwait HAVE_POSIX_SIGWAIT)
check_function_exists(strftime HAVE_STRFTIME)
check_function_exists(vsnprintf HAVE_VSNPRINTF)
check_function_exists(inet_aton HAVE_INET_ATON)
# For some reason, the check_function_exists macro doesn't detect
# the inet_aton on some pure Unix platforms (e.g. sunos5). So we
# need to do a more detailed check and also include some extra libs.
if (NOT HAVE_INET_ATON)
set(CMAKE_REQUIRED_LIBRARIES nsl)
check_c_source_compiles(
"#include <arpa/inet.h>\n int main() { inet_aton(0, 0); }"
HAVE_INET_ATON_ADV)
set(CMAKE_REQUIRED_LIBRARIES)
if (HAVE_INET_ATON_ADV)
# Override the previous fail.
set(HAVE_INET_ATON 1)
# Assume that both nsl and socket will be needed,
# it seems safe to add socket on the back of nsl,
# since socket only ever needed when nsl is needed.
list(APPEND libs nsl socket)
endif()
endif()
check_type_size(char SIZEOF_CHAR)
check_type_size(int SIZEOF_INT)
check_type_size(long SIZEOF_LONG)
check_type_size(short SIZEOF_SHORT)
# pthread is used on both Linux and Mac
check_library_exists("pthread" pthread_create "" HAVE_PTHREAD)
if (HAVE_PTHREAD)
list(APPEND libs pthread)
else (HAVE_PTHREAD)
message(FATAL_ERROR "Missing library: pthread")
endif()
if (APPLE)
# build mac os x universal
set(CMAKE_OSX_ARCHITECTURES "ppc;i386"
CACHE STRING "Build architectures for OSX" FORCE)
find_library(lib_ScreenSaver ScreenSaver)
find_library(lib_IOKit IOKit)
find_library(lib_ApplicationServices ApplicationServices)
find_library(lib_Foundation Foundation)
find_library(lib_Carbon Carbon)
list(APPEND libs
${lib_ScreenSaver}
${lib_IOKit}
${lib_ApplicationServices}
${lib_Foundation}
${lib_Carbon}
)
else (APPLE)
set(XKBlib "X11/XKBlib.h")
check_include_files("${XKBlib};X11/extensions/dpms.h" HAVE_X11_EXTENSIONS_DPMS_H)
check_include_files("X11/extensions/Xinerama.h" HAVE_X11_EXTENSIONS_XINERAMA_H)
check_include_files("${XKBlib};X11/extensions/XKBstr.h" HAVE_X11_EXTENSIONS_XKBSTR_H)
check_include_files("X11/extensions/XKB.h" HAVE_XKB_EXTENSION)
check_include_files("X11/extensions/XTest.h" HAVE_X11_EXTENSIONS_XTEST_H)
check_include_files(${XKBlib} HAVE_X11_XKBLIB_H)
if (HAVE_X11_EXTENSIONS_DPMS_H)
# Assume that function prototypes declared, when include exists.
set(HAVE_DPMS_PROTOTYPES 1)
endif()
if (NOT HAVE_X11_XKBLIB_H)
message(FATAL_ERROR "Missing header: " ${XKBlib})
endif()
check_library_exists("SM;ICE" IceConnectionNumber "" HAVE_ICE)
check_library_exists("X11;Xext" DPMSQueryExtension "" HAVE_Xext)
check_library_exists("X11;Xext;Xtst" XTestQueryExtension "" HAVE_Xtst)
check_library_exists("Xinerama" XineramaQueryExtension "" HAVE_Xinerama)
if (HAVE_ICE)
# Assume we have SM if we have ICE.
set(HAVE_SM 1)
list(APPEND libs SM ICE)
endif()
if (HAVE_Xtst)
# Xtxt depends on X11.
set(HAVE_X11)
list(APPEND libs X11 Xtst)
else (HAVE_Xtst)
message(FATAL_ERROR "Missing library: Xtst")
endif()
if (HAVE_Xext)
list(APPEND libs Xext)
endif()
if (HAVE_Xinerama)
list(APPEND libs Xinerama)
else (HAVE_Xinerama)
if (HAVE_X11_EXTENSIONS_XINERAMA_H)
message(FATAL_ERROR "Missing library: Xinerama")
endif()
endif()
endif()
# For config.h, set some static values; it may be a good idea to make
# these values dynamic for non-standard UNIX compilers.
set(ACCEPT_TYPE_ARG3 socklen_t)
set(HAVE_CXX_BOOL 1)
set(HAVE_CXX_CASTS 1)
set(HAVE_CXX_EXCEPTIONS 1)
set(HAVE_CXX_MUTABLE 1)
set(HAVE_CXX_STDLIB 1)
set(HAVE_PTHREAD_SIGNAL 1)
set(SELECT_TYPE_ARG1 int)
set(SELECT_TYPE_ARG234 "(fd_set *)")
set(SELECT_TYPE_ARG5 "(struct timeval *)")
set(STDC_HEADERS 1)
set(TIME_WITH_SYS_TIME 1)
set(HAVE_SOCKLEN_T 1)
# For config.h, save the results based on a template (config.h.in).
configure_file(${cmake_dir}/config.h.in ${root_dir}/config.h)
add_definitions(-DSYSAPI_UNIX=1 -DHAVE_CONFIG_H)
if (APPLE)
add_definitions(-DWINAPI_CARBON=1 -D_THREAD_SAFE -DMACOSX_DEPLOYMENT_TARGET=10.4)
else (APPLE)
add_definitions(-DWINAPI_XWINDOWS=1)
endif()
else (UNIX)
list(APPEND libs Wtsapi32 Userenv)
add_definitions(
/DWIN32
/D_WINDOWS
/D_CRT_SECURE_NO_WARNINGS
/DVERSION=\"${VERSION}\"
)
endif()

View File

@ -1,107 +0,0 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# 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 COPYING 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 <http://www.gnu.org/licenses/>.
# List of CPack variables:
# http://www.vtk.org/Wiki/CMake:CPackConfiguration
if (WIN32)
message(FATAL_ERROR "CPack support for Windows has been removed.")
endif()
install(TARGETS
synergys
synergyc
COMPONENT core
DESTINATION bin)
if (UNIX)
if (APPLE)
# no cpack support for apple
else ()
install(FILES bin/qsynergy
DESTINATION bin
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
# install gnome menu item
install(FILES cmake/synergy.desktop
DESTINATION share/applications)
install(FILES cmd/launcher/synergy.ico
DESTINATION share/icons)
endif()
endif()
# The default CPack behaviour is not to append the system processor
# type, which is undesirable in our case, since we want to support
# both 32-bit and 64-bit processors.
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
# For source code, use .tar.gz on Unix, and .zip on Windows
if (UNIX)
set(CPACK_SOURCE_GENERATOR TGZ)
else (UNIX)
set(CPACK_SOURCE_GENERATOR ZIP)
endif()
if (APPLE)
set(CPACK_SYSTEM_NAME "MacOSX-Universal")
endif()
set(CPACK_PACKAGE_NAME "synergy")
set(CPACK_PACKAGE_VENDOR "The Synergy Project")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Synergy server and client")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_REV})
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_PACKAGE_CONTACT http://synergy-foss.org/)
set(CPACK_RESOURCE_FILE_LICENSE "${cmake_dir}/License.rtf")
set(CPACK_RESOURCE_FILE_README "${cmake_dir}/Readme.txt")
# files to exclude from src package (regex patterns)
# to escape, use 4 backslashes (\\\\) -- yuck!
set(CPACK_SOURCE_IGNORE_FILES
# temp output dir in root
"/bin/"
# generated config.h file
"/config\\\\.h$"
# buildbot stuff
"\\\\.buildbot\\\\-sourcedata$"
# qt temp build dir
"/gui/tmp/.*"
# qt make file
"/gui/Makefile$"
# qt generated ui headers
"/gui/ui_.*\\\\.h$"
# compiled python files
".*\\\\.pyc$"
# subversion caches (all dirs)
".*/\\\\.svn/.*"
# emacs temporary files
".*~$"
)
# Must be last (since it relies of CPACK_ vars).
include(CPack)

View File

@ -1,84 +0,0 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# 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 COPYING 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 <http://www.gnu.org/licenses/>.
if (WIN32)
set(root_cmd_launcher ${root_dir}/cmd/launcher)
set(src_cmd_launcher_mswindows
${root_cmd_launcher}/CAddScreen.cpp
${root_cmd_launcher}/CAdvancedOptions.cpp
${root_cmd_launcher}/CAutoStart.cpp
${root_cmd_launcher}/CGlobalOptions.cpp
${root_cmd_launcher}/CHotkeyOptions.cpp
${root_cmd_launcher}/CInfo.cpp
${root_cmd_launcher}/CScreensLinks.cpp
${root_cmd_launcher}/LaunchUtil.cpp
${root_cmd_launcher}/launcher.cpp
)
set(inc_cmd_launcher_mswindows
${root_cmd_launcher}/CAddScreen.h
${root_cmd_launcher}/CAdvancedOptions.h
${root_cmd_launcher}/CAutoStart.h
${root_cmd_launcher}/CGlobalOptions.h
${root_cmd_launcher}/CHotkeyOptions.h
${root_cmd_launcher}/CInfo.h
${root_cmd_launcher}/CScreensLinks.h
${root_cmd_launcher}/LaunchUtil.h
${root_cmd_launcher}/resource.h
)
set(res_cmd_launcher_mswindows
${root_cmd_launcher}/launcher.rc
${root_cmd_launcher}/synergy.ico
)
set(src_cmd_launcher)
if (UNIX)
if (APPLE)
list(APPEND src_cmd_launcher ${src_cmd_launcher_carbon})
else (APPLE)
list(APPEND src_cmd_launcher ${src_cmd_launcher_xwindows})
endif()
endif()
if (WIN32)
list(APPEND src_cmd_launcher
${inc_cmd_launcher_mswindows}
${res_cmd_launcher_mswindows}
${src_cmd_launcher_mswindows}
)
endif()
set(inc_dirs_cmd_launcher
${root_dir}
${root_dir}/lib
${root_dir}/lib/arch
${root_dir}/lib/base
${root_dir}/lib/common
${root_dir}/lib/io
${root_dir}/lib/mt
${root_dir}/lib/net
${root_dir}/lib/platform
${root_dir}/lib/synergy
${root_dir}/lib/server
)
include_directories(${inc_dirs_cmd_launcher})
add_executable(launcher WIN32 ${src_cmd_launcher})
target_link_libraries(launcher synergy ${libs})
endif()

View File

@ -1,417 +0,0 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# 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 COPYING 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 <http://www.gnu.org/licenses/>.
set(root_lib ${root_dir}/lib)
set(src_lib_arch
${root_lib}/arch/CArchAppUtil.cpp
${root_lib}/arch/CArch.cpp
${root_lib}/arch/CArchDaemonNone.cpp
${root_lib}/arch/XArch.cpp
${root_lib}/arch/CArchConsoleStd.cpp
)
set(src_lib_arch_unix
${root_lib}/arch/CArchAppUtilUnix.cpp
${root_lib}/arch/CArchConsoleUnix.cpp
${root_lib}/arch/CArchDaemonUnix.cpp
${root_lib}/arch/CArchFileUnix.cpp
${root_lib}/arch/CArchLogUnix.cpp
${root_lib}/arch/CArchMultithreadPosix.cpp
${root_lib}/arch/CArchNetworkBSD.cpp
${root_lib}/arch/CArchSleepUnix.cpp
${root_lib}/arch/CArchStringUnix.cpp
${root_lib}/arch/CArchSystemUnix.cpp
${root_lib}/arch/CArchTaskBarXWindows.cpp
${root_lib}/arch/CArchTimeUnix.cpp
${root_lib}/arch/XArchUnix.cpp
)
set(src_lib_arch_windows
${root_lib}/arch/CArchAppUtilWindows.cpp
${root_lib}/arch/CArchConsoleWindows.cpp
${root_lib}/arch/CArchDaemonWindows.cpp
${root_lib}/arch/CArchFileWindows.cpp
${root_lib}/arch/CArchLogWindows.cpp
${root_lib}/arch/CArchMiscWindows.cpp
${root_lib}/arch/CArchMultithreadWindows.cpp
${root_lib}/arch/CArchNetworkWinsock.cpp
${root_lib}/arch/CArchSleepWindows.cpp
${root_lib}/arch/CArchStringWindows.cpp
${root_lib}/arch/CArchSystemWindows.cpp
${root_lib}/arch/CArchTaskBarWindows.cpp
${root_lib}/arch/CArchTimeWindows.cpp
${root_lib}/arch/XArchWindows.cpp
)
set(inc_lib_arch_windows
${root_lib}/arch/CArchAppUtil.h
${root_lib}/arch/CArchAppUtilWindows.h
${root_lib}/arch/CArchConsoleWindows.h
${root_lib}/arch/CArchDaemonWindows.h
${root_lib}/arch/CArchFileWindows.h
${root_lib}/arch/CArchLogWindows.h
${root_lib}/arch/CArchMiscWindows.h
${root_lib}/arch/CArchMultithreadWindows.h
${root_lib}/arch/CArchNetworkWinsock.h
${root_lib}/arch/CArchSleepWindows.h
${root_lib}/arch/CArchStringWindows.h
${root_lib}/arch/CArchSystemWindows.h
${root_lib}/arch/CArchTaskBarWindows.h
${root_lib}/arch/CArchTimeWindows.h
${root_lib}/arch/CArchConsoleStd.h
${root_lib}/arch/IArchAppUtil.h
${root_lib}/arch/XArchWindows.h
)
set(src_lib_base
${root_lib}/base/CEvent.cpp
${root_lib}/base/CEventQueue.cpp
${root_lib}/base/CFunctionEventJob.cpp
${root_lib}/base/CFunctionJob.cpp
${root_lib}/base/CLog.cpp
${root_lib}/base/CSimpleEventQueueBuffer.cpp
${root_lib}/base/CStopwatch.cpp
${root_lib}/base/CStringUtil.cpp
${root_lib}/base/CUnicode.cpp
${root_lib}/base/IEventQueue.cpp
${root_lib}/base/LogOutputters.cpp
${root_lib}/base/XBase.cpp
)
set(inc_lib_base
${root_lib}/base/CEvent.h
${root_lib}/base/CEventQueue.h
${root_lib}/base/CFunctionEventJob.h
${root_lib}/base/CFunctionJob.h
${root_lib}/base/CLog.h
${root_lib}/base/CPriorityQueue.h
${root_lib}/base/CSimpleEventQueueBuffer.h
${root_lib}/base/CStopwatch.h
${root_lib}/base/CString.h
${root_lib}/base/CStringUtil.h
${root_lib}/base/CUnicode.h
${root_lib}/base/IEventJob.h
${root_lib}/base/IEventQueue.h
${root_lib}/base/IEventQueueBuffer.h
${root_lib}/base/IJob.h
${root_lib}/base/ILogOutputter.h
${root_lib}/base/LogOutputters.h
${root_lib}/base/TMethodEventJob.h
${root_lib}/base/TMethodJob.h
${root_lib}/base/XBase.h
)
set(src_lib_client
${root_lib}/client/CClient.cpp
${root_lib}/client/CServerProxy.cpp
)
set(inc_lib_client
${root_lib}/client/CClient.h
${root_lib}/client/CServerProxy.h
)
set(src_lib_common
${root_lib}/common/Version.cpp
)
set(inc_lib_common
${root_lib}/common/Version.h
)
set(src_lib_io
${root_lib}/io/CStreamBuffer.cpp
${root_lib}/io/CStreamFilter.cpp
${root_lib}/io/IStream.cpp
${root_lib}/io/XIO.cpp
)
set(inc_lib_io
${root_lib}/io/CStreamBuffer.h
${root_lib}/io/CStreamFilter.h
${root_lib}/io/IStream.h
${root_lib}/io/IStreamFilterFactory.h
${root_lib}/io/XIO.h
)
set(src_lib_mt
${root_lib}/mt/CCondVar.cpp
${root_lib}/mt/CLock.cpp
${root_lib}/mt/CMutex.cpp
${root_lib}/mt/CThread.cpp
${root_lib}/mt/XMT.cpp
)
set(inc_lib_mt
${root_lib}/mt/CCondVar.h
${root_lib}/mt/CLock.h
${root_lib}/mt/CMutex.h
${root_lib}/mt/CThread.h
${root_lib}/mt/XMT.h
${root_lib}/mt/XThread.h
)
set(src_lib_net
${root_lib}/net/CNetworkAddress.cpp
${root_lib}/net/CSocketMultiplexer.cpp
${root_lib}/net/CTCPListenSocket.cpp
${root_lib}/net/CTCPSocket.cpp
${root_lib}/net/CTCPSocketFactory.cpp
${root_lib}/net/IDataSocket.cpp
${root_lib}/net/IListenSocket.cpp
${root_lib}/net/ISocket.cpp
${root_lib}/net/XSocket.cpp
)
set(inc_lib_net
${root_lib}/net/CNetworkAddress.h
${root_lib}/net/CSocketMultiplexer.h
${root_lib}/net/CTCPListenSocket.h
${root_lib}/net/CTCPSocket.h
${root_lib}/net/CTCPSocketFactory.h
${root_lib}/net/IDataSocket.h
${root_lib}/net/IListenSocket.h
${root_lib}/net/ISocket.h
${root_lib}/net/ISocketFactory.h
${root_lib}/net/ISocketMultiplexerJob.h
${root_lib}/net/TSocketMultiplexerMethodJob.h
${root_lib}/net/XSocket.h
)
set(src_lib_platform_xwindows
${root_lib}/platform/CXWindowsClipboard.cpp
${root_lib}/platform/CXWindowsClipboardAnyBitmapConverter.cpp
${root_lib}/platform/CXWindowsClipboardBMPConverter.cpp
${root_lib}/platform/CXWindowsClipboardHTMLConverter.cpp
${root_lib}/platform/CXWindowsClipboardTextConverter.cpp
${root_lib}/platform/CXWindowsClipboardUCS2Converter.cpp
${root_lib}/platform/CXWindowsClipboardUTF8Converter.cpp
${root_lib}/platform/CXWindowsEventQueueBuffer.cpp
${root_lib}/platform/CXWindowsKeyState.cpp
${root_lib}/platform/CXWindowsScreen.cpp
${root_lib}/platform/CXWindowsScreenSaver.cpp
${root_lib}/platform/CXWindowsUtil.cpp
)
set(src_lib_platform_mswindows
${root_lib}/platform/CMSWindowsClipboard.cpp
${root_lib}/platform/CMSWindowsClipboardAnyTextConverter.cpp
${root_lib}/platform/CMSWindowsClipboardBitmapConverter.cpp
${root_lib}/platform/CMSWindowsClipboardHTMLConverter.cpp
${root_lib}/platform/CMSWindowsClipboardTextConverter.cpp
${root_lib}/platform/CMSWindowsClipboardUTF16Converter.cpp
${root_lib}/platform/CMSWindowsDesks.cpp
${root_lib}/platform/CMSWindowsEventQueueBuffer.cpp
${root_lib}/platform/CMSWindowsKeyState.cpp
${root_lib}/platform/CMSWindowsScreen.cpp
${root_lib}/platform/CMSWindowsScreenSaver.cpp
${root_lib}/platform/CMSWindowsUtil.cpp
${root_lib}/platform/CMSWindowsRelauncher.cpp
)
set(inc_lib_platform_mswindows
${root_lib}/platform/CMSWindowsClipboard.h
${root_lib}/platform/CMSWindowsClipboardAnyTextConverter.h
${root_lib}/platform/CMSWindowsClipboardBitmapConverter.h
${root_lib}/platform/CMSWindowsClipboardHTMLConverter.h
${root_lib}/platform/CMSWindowsClipboardTextConverter.h
${root_lib}/platform/CMSWindowsClipboardUTF16Converter.h
${root_lib}/platform/CMSWindowsDesks.h
${root_lib}/platform/CMSWindowsEventQueueBuffer.h
${root_lib}/platform/CMSWindowsKeyState.h
${root_lib}/platform/CMSWindowsScreen.h
${root_lib}/platform/CMSWindowsScreenSaver.h
${root_lib}/platform/CMSWindowsUtil.h
${root_lib}/platform/CMSWindowsRelauncher.h
)
set(src_lib_platform_hook
${root_lib}/platform/CSynergyHook.cpp
)
set(inc_lib_platform_hook
${root_lib}/platform/CSynergyHook.h
)
set(src_lib_platform_carbon
${root_lib}/platform/COSXClipboard.cpp
${root_lib}/platform/COSXClipboardAnyTextConverter.cpp
${root_lib}/platform/COSXClipboardTextConverter.cpp
${root_lib}/platform/COSXClipboardUTF16Converter.cpp
${root_lib}/platform/COSXEventQueueBuffer.cpp
${root_lib}/platform/COSXKeyState.cpp
${root_lib}/platform/COSXScreen.cpp
${root_lib}/platform/COSXScreenSaver.cpp
${root_lib}/platform/COSXScreenSaverUtil.m
)
set(src_lib_server
${root_lib}/server/CBaseClientProxy.cpp
${root_lib}/server/CClientListener.cpp
${root_lib}/server/CClientProxy.cpp
${root_lib}/server/CClientProxy1_0.cpp
${root_lib}/server/CClientProxy1_1.cpp
${root_lib}/server/CClientProxy1_2.cpp
${root_lib}/server/CClientProxy1_3.cpp
${root_lib}/server/CClientProxyUnknown.cpp
${root_lib}/server/CConfig.cpp
${root_lib}/server/CInputFilter.cpp
${root_lib}/server/CPrimaryClient.cpp
${root_lib}/server/CServer.cpp
)
set(inc_lib_server
${root_lib}/server/CBaseClientProxy.h
${root_lib}/server/CClientListener.h
${root_lib}/server/CClientProxy.h
${root_lib}/server/CClientProxy1_0.h
${root_lib}/server/CClientProxy1_1.h
${root_lib}/server/CClientProxy1_2.h
${root_lib}/server/CClientProxy1_3.h
${root_lib}/server/CClientProxyUnknown.h
${root_lib}/server/CConfig.h
${root_lib}/server/CInputFilter.h
${root_lib}/server/CPrimaryClient.h
${root_lib}/server/CServer.h
)
set(src_lib_synergy
${root_lib}/synergy/CClientTaskBarReceiver.cpp
${root_lib}/synergy/CServerTaskBarReceiver.cpp
${root_lib}/synergy/CApp.cpp
${root_lib}/synergy/CClientApp.cpp
${root_lib}/synergy/CServerApp.cpp
${root_lib}/synergy/CClipboard.cpp
${root_lib}/synergy/CKeyMap.cpp
${root_lib}/synergy/CKeyState.cpp
${root_lib}/synergy/CPacketStreamFilter.cpp
${root_lib}/synergy/CPlatformScreen.cpp
${root_lib}/synergy/CProtocolUtil.cpp
${root_lib}/synergy/CScreen.cpp
${root_lib}/synergy/IClipboard.cpp
${root_lib}/synergy/IKeyState.cpp
${root_lib}/synergy/IPrimaryScreen.cpp
${root_lib}/synergy/IScreen.cpp
${root_lib}/synergy/KeyTypes.cpp
${root_lib}/synergy/ProtocolTypes.cpp
${root_lib}/synergy/XScreen.cpp
${root_lib}/synergy/XSynergy.cpp
)
set(inc_lib_synergy
${root_lib}/synergy/CClientTaskBarReceiver.h
${root_lib}/synergy/CServerTaskBarReceiver.h
${root_lib}/synergy/CApp.h
${root_lib}/synergy/CClientApp.h
${root_lib}/synergy/CServerApp.h
${root_lib}/synergy/CClipboard.h
${root_lib}/synergy/CKeyMap.h
${root_lib}/synergy/CKeyState.h
${root_lib}/synergy/CPacketStreamFilter.h
${root_lib}/synergy/CPlatformScreen.h
${root_lib}/synergy/CProtocolUtil.h
${root_lib}/synergy/CScreen.h
${root_lib}/synergy/ClipboardTypes.h
${root_lib}/synergy/IClient.h
${root_lib}/synergy/IClipboard.h
${root_lib}/synergy/IKeyState.h
${root_lib}/synergy/IPlatformScreen.h
${root_lib}/synergy/IPrimaryScreen.h
${root_lib}/synergy/IScreen.h
${root_lib}/synergy/IScreenSaver.h
${root_lib}/synergy/ISecondaryScreen.h
${root_lib}/synergy/KeyTypes.h
${root_lib}/synergy/MouseTypes.h
${root_lib}/synergy/OptionTypes.h
${root_lib}/synergy/ProtocolTypes.h
${root_lib}/synergy/XScreen.h
${root_lib}/synergy/XSynergy.h
)
# Create default `src`, with cross-platform sources.
set(src_lib
${src_lib_arch}
${src_lib_base}
${src_lib_client}
${src_lib_common}
${src_lib_io}
${src_lib_mt}
${src_lib_net}
${src_lib_server}
${src_lib_synergy}
)
# Append to `src_lib`, the platform specific sources.
if (UNIX)
list(APPEND src_lib ${src_lib_arch_unix})
if (APPLE)
list(APPEND src_lib
${src_lib_platform_carbon}
${inc_lib_synergy_carbon}
${src_lib_synergy_carbon}
)
else (APPLE)
list(APPEND src_lib
${src_lib_platform_xwindows}
${inc_lib_synergy_xwindows}
${src_lib_synergy_xwindows}
)
endif()
endif()
if (WIN32)
list(APPEND src_lib
${inc_lib_base}
${inc_lib_client}
${inc_lib_common}
${inc_lib_io}
${inc_lib_mt}
${inc_lib_net}
${inc_lib_server}
${inc_lib_synergy}
${inc_lib_arch_windows}
${src_lib_arch_windows}
${inc_lib_platform_mswindows}
${src_lib_platform_mswindows}
${inc_lib_synergy_mswindows}
${src_lib_synergy_mswindows}
)
endif()
set(inc_lib_dirs
${root_dir}
${root_dir}/lib/arch
${root_dir}/lib/base
${root_dir}/lib/client
${root_dir}/lib/common
${root_dir}/lib/io
${root_dir}/lib/mt
${root_dir}/lib/net
${root_dir}/lib/platform
${root_dir}/lib/server
${root_dir}/lib/synergy
${root_dir}/third_party/gtest
${root_dir}/third_party/gtest/include
)
include_directories(${inc_lib_dirs})
add_library(synergy STATIC ${src_lib})
if (WIN32)
add_library(synrgyhk SHARED ${inc_lib_platform_hook} ${src_lib_platform_hook})
endif()

View File

@ -1,84 +0,0 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# 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 COPYING 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 <http://www.gnu.org/licenses/>.
set(root_cmd_synergyc ${root_dir}/cmd/synergyc)
set(src_cmd_synergyc_common
${root_cmd_synergyc}/synergyc.cpp
)
set(src_cmd_synergyc_xwindows
${root_cmd_synergyc}/CXWindowsClientTaskBarReceiver.cpp
)
set(src_cmd_synergyc_mswindows
${root_cmd_synergyc}/CMSWindowsClientTaskBarReceiver.cpp
)
set(inc_cmd_synergyc_mswindows
${root_cmd_synergyc}/CMSWindowsClientTaskBarReceiver.h
${root_cmd_synergyc}/resource.h
)
set(res_cmd_synergyc_mswindows
${root_cmd_synergyc}/synergyc.ico
${root_cmd_synergyc}/synergyc.rc
${root_cmd_synergyc}/tb_error.ico
${root_cmd_synergyc}/tb_idle.ico
${root_cmd_synergyc}/tb_run.ico
${root_cmd_synergyc}/tb_wait.ico
)
set(src_cmd_synergyc_carbon
${root_cmd_synergyc}/COSXClientTaskBarReceiver.cpp
)
set(src_cmd_synergyc ${src_cmd_synergyc_common})
if (UNIX)
if (APPLE)
list(APPEND src_cmd_synergyc ${src_cmd_synergyc_carbon})
else (APPLE)
list(APPEND src_cmd_synergyc ${src_cmd_synergyc_xwindows})
endif()
else (UNIX)
list(APPEND src_cmd_synergyc
${inc_cmd_synergyc_mswindows}
${res_cmd_synergyc_mswindows}
${src_cmd_synergyc_mswindows}
)
endif()
set(inc_dirs_cmd_synergyc
${root_dir}
${root_dir}/lib
${root_dir}/lib/arch
${root_dir}/lib/base
${root_dir}/lib/client
${root_dir}/lib/common
${root_dir}/lib/io
${root_dir}/lib/mt
${root_dir}/lib/net
${root_dir}/lib/platform
${root_dir}/lib/synergy
)
include_directories(${inc_dirs_cmd_synergyc})
add_executable(synergyc ${src_cmd_synergyc})
target_link_libraries(synergyc synergy ${libs})

View File

@ -1,84 +0,0 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# 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 COPYING 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 <http://www.gnu.org/licenses/>.
set(root_cmd_synergys ${root_dir}/cmd/synergys)
set(src_cmd_synergys_common
${root_cmd_synergys}/synergys.cpp
)
set(src_cmd_synergys_xwindows
${root_cmd_synergys}/CXWindowsServerTaskBarReceiver.cpp
)
set(src_cmd_synergys_mswindows
${root_cmd_synergys}/CMSWindowsServerTaskBarReceiver.cpp
)
set(inc_cmd_synergys_mswindows
${root_cmd_synergys}/CMSWindowsServerTaskBarReceiver.h
${root_cmd_synergys}/resource.h
)
set(res_cmd_synergys_mswindows
${root_cmd_synergys}/synergys.ico
${root_cmd_synergys}/synergys.rc
${root_cmd_synergys}/tb_error.ico
${root_cmd_synergys}/tb_idle.ico
${root_cmd_synergys}/tb_run.ico
${root_cmd_synergys}/tb_wait.ico
)
set(src_cmd_synergys_carbon
${root_cmd_synergys}/COSXServerTaskBarReceiver.cpp
)
set(src_cmd_synergys ${src_cmd_synergys_common})
if (UNIX)
if (APPLE)
list(APPEND src_cmd_synergys ${src_cmd_synergys_carbon})
else (APPLE)
list(APPEND src_cmd_synergys ${src_cmd_synergys_xwindows})
endif()
else (UNIX)
list(APPEND src_cmd_synergys
${inc_cmd_synergys_mswindows}
${res_cmd_synergys_mswindows}
${src_cmd_synergys_mswindows}
)
endif()
set(inc_dirs_cmd_synergys
${root_dir}
${root_dir}/lib
${root_dir}/lib/arch
${root_dir}/lib/base
${root_dir}/lib/common
${root_dir}/lib/io
${root_dir}/lib/mt
${root_dir}/lib/net
${root_dir}/lib/platform
${root_dir}/lib/synergy
${root_dir}/lib/server
)
include_directories(${inc_dirs_cmd_synergys})
add_executable(synergys ${src_cmd_synergys})
target_link_libraries(synergys synergy ${libs})

View File

@ -1,430 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#include "CConfig.h"
#include "KeyTypes.h"
#include "OptionTypes.h"
#include "ProtocolTypes.h"
#include "CStringUtil.h"
#include "CArch.h"
#include "CAddScreen.h"
#include "LaunchUtil.h"
#include "resource.h"
struct CModifierInfo {
public:
int m_ctrlID;
const char* m_name;
KeyModifierID m_modifierID;
OptionID m_optionID;
};
static const CModifierInfo s_modifiers[] = {
{ IDC_ADD_MOD_SHIFT, "Shift",
kKeyModifierIDShift, kOptionModifierMapForShift },
{ IDC_ADD_MOD_CTRL, "Ctrl",
kKeyModifierIDControl, kOptionModifierMapForControl },
{ IDC_ADD_MOD_ALT, "Alt",
kKeyModifierIDAlt, kOptionModifierMapForAlt },
{ IDC_ADD_MOD_META, "Meta",
kKeyModifierIDMeta, kOptionModifierMapForMeta },
{ IDC_ADD_MOD_SUPER, "Super",
kKeyModifierIDSuper, kOptionModifierMapForSuper }
};
static const KeyModifierID baseModifier = kKeyModifierIDShift;
//
// CAddScreen
//
CAddScreen* CAddScreen::s_singleton = NULL;
CAddScreen::CAddScreen(HWND parent, CConfig* config, const CString& name) :
m_parent(parent),
m_config(config),
m_name(name)
{
assert(s_singleton == NULL);
s_singleton = this;
}
CAddScreen::~CAddScreen()
{
s_singleton = NULL;
}
bool
CAddScreen::doModal()
{
// do dialog
return (DialogBoxParam(s_instance, MAKEINTRESOURCE(IDD_ADD),
m_parent, (DLGPROC)dlgProc, (LPARAM)this) != 0);
}
CString
CAddScreen::getName() const
{
return m_name;
}
void
CAddScreen::init(HWND hwnd)
{
// set title
CString title;
if (m_name.empty()) {
title = getString(IDS_ADD_SCREEN);
}
else {
title = CStringUtil::format(
getString(IDS_EDIT_SCREEN).c_str(),
m_name.c_str());
}
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)title.c_str());
// fill in screen name
HWND child = getItem(hwnd, IDC_ADD_SCREEN_NAME_EDIT);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)m_name.c_str());
// fill in aliases
CString aliases;
for (CConfig::all_const_iterator index = m_config->beginAll();
index != m_config->endAll(); ++index) {
if (CStringUtil::CaselessCmp::equal(index->second, m_name) &&
!CStringUtil::CaselessCmp::equal(index->second, index->first)) {
if (!aliases.empty()) {
aliases += "\r\n";
}
aliases += index->first;
}
}
child = getItem(hwnd, IDC_ADD_ALIASES_EDIT);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)aliases.c_str());
// set options
CConfig::CScreenOptions options;
getOptions(options);
CConfig::CScreenOptions::const_iterator index;
child = getItem(hwnd, IDC_ADD_HD_CAPS_CHECK);
index = options.find(kOptionHalfDuplexCapsLock);
setItemChecked(child, (index != options.end() && index->second != 0));
child = getItem(hwnd, IDC_ADD_HD_NUM_CHECK);
index = options.find(kOptionHalfDuplexNumLock);
setItemChecked(child, (index != options.end() && index->second != 0));
child = getItem(hwnd, IDC_ADD_HD_SCROLL_CHECK);
index = options.find(kOptionHalfDuplexScrollLock);
setItemChecked(child, (index != options.end() && index->second != 0));
// modifier options
for (UInt32 i = 0; i < sizeof(s_modifiers) /
sizeof(s_modifiers[0]); ++i) {
child = getItem(hwnd, s_modifiers[i].m_ctrlID);
// fill in options
for (UInt32 j = 0; j < sizeof(s_modifiers) /
sizeof(s_modifiers[0]); ++j) {
SendMessage(child, CB_ADDSTRING, 0,
(LPARAM)s_modifiers[j].m_name);
}
// choose current value
index = options.find(s_modifiers[i].m_optionID);
KeyModifierID id = s_modifiers[i].m_modifierID;
if (index != options.end()) {
id = index->second;
}
SendMessage(child, CB_SETCURSEL, id - baseModifier, 0);
}
// dead corners
UInt32 corners = 0;
index = options.find(kOptionScreenSwitchCorners);
if (index != options.end()) {
corners = index->second;
}
child = getItem(hwnd, IDC_ADD_DC_TOP_LEFT);
setItemChecked(child, (corners & kTopLeftMask) != 0);
child = getItem(hwnd, IDC_ADD_DC_TOP_RIGHT);
setItemChecked(child, (corners & kTopRightMask) != 0);
child = getItem(hwnd, IDC_ADD_DC_BOTTOM_LEFT);
setItemChecked(child, (corners & kBottomLeftMask) != 0);
child = getItem(hwnd, IDC_ADD_DC_BOTTOM_RIGHT);
setItemChecked(child, (corners & kBottomRightMask) != 0);
index = options.find(kOptionScreenSwitchCornerSize);
SInt32 size = 0;
if (index != options.end()) {
size = index->second;
}
char buffer[20];
sprintf(buffer, "%d", size);
child = getItem(hwnd, IDC_ADD_DC_SIZE);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)buffer);
}
bool
CAddScreen::save(HWND hwnd)
{
// get the old aliases and options
CStringList oldAliases;
getAliases(oldAliases);
CConfig::CScreenOptions options;
getOptions(options);
// extract name and aliases
CString newName;
HWND child = getItem(hwnd, IDC_ADD_SCREEN_NAME_EDIT);
newName = getWindowText(child);
CStringList newAliases;
child = getItem(hwnd, IDC_ADD_ALIASES_EDIT);
tokenize(newAliases, getWindowText(child));
// name must be valid
if (!m_config->isValidScreenName(newName)) {
showError(hwnd, CStringUtil::format(
getString(IDS_INVALID_SCREEN_NAME).c_str(),
newName.c_str()));
return false;
}
// aliases must be valid
for (CStringList::const_iterator index = newAliases.begin();
index != newAliases.end(); ++index) {
if (!m_config->isValidScreenName(*index)) {
showError(hwnd, CStringUtil::format(
getString(IDS_INVALID_SCREEN_NAME).c_str(),
index->c_str()));
return false;
}
}
// new name may not be in the new alias list
if (isNameInList(newAliases, newName)) {
showError(hwnd, CStringUtil::format(
getString(IDS_SCREEN_NAME_IS_ALIAS).c_str(),
newName.c_str()));
return false;
}
// name must not exist in config but allow same name. also
// allow name if it exists in the old alias list but not the
// new one.
if (m_config->isScreen(newName) &&
!CStringUtil::CaselessCmp::equal(newName, m_name) &&
!isNameInList(oldAliases, newName)) {
showError(hwnd, CStringUtil::format(
getString(IDS_DUPLICATE_SCREEN_NAME).c_str(),
newName.c_str()));
return false;
}
// aliases must not exist in config but allow same aliases and
// allow an alias to be the old name.
for (CStringList::const_iterator index = newAliases.begin();
index != newAliases.end(); ++index) {
if (m_config->isScreen(*index) &&
!CStringUtil::CaselessCmp::equal(*index, m_name) &&
!isNameInList(oldAliases, *index)) {
showError(hwnd, CStringUtil::format(
getString(IDS_DUPLICATE_SCREEN_NAME).c_str(),
index->c_str()));
return false;
}
}
// dead corner size must be non-negative
child = getItem(hwnd, IDC_ADD_DC_SIZE);
CString valueString = getWindowText(child);
int cornerSize = atoi(valueString.c_str());
if (cornerSize < 0) {
showError(hwnd, CStringUtil::format(
getString(IDS_INVALID_CORNER_SIZE).c_str(),
valueString.c_str()));
SetFocus(child);
return false;
}
// collect options
child = getItem(hwnd, IDC_ADD_HD_CAPS_CHECK);
if (isItemChecked(child)) {
options[kOptionHalfDuplexCapsLock] = 1;
}
else {
options.erase(kOptionHalfDuplexCapsLock);
}
child = getItem(hwnd, IDC_ADD_HD_NUM_CHECK);
if (isItemChecked(child)) {
options[kOptionHalfDuplexNumLock] = 1;
}
else {
options.erase(kOptionHalfDuplexNumLock);
}
child = getItem(hwnd, IDC_ADD_HD_SCROLL_CHECK);
if (isItemChecked(child)) {
options[kOptionHalfDuplexScrollLock] = 1;
}
else {
options.erase(kOptionHalfDuplexScrollLock);
}
// save modifier options
for (UInt32 i = 0; i < sizeof(s_modifiers) /
sizeof(s_modifiers[0]); ++i) {
child = getItem(hwnd, s_modifiers[i].m_ctrlID);
KeyModifierID id = static_cast<KeyModifierID>(
SendMessage(child, CB_GETCURSEL, 0, 0) +
baseModifier);
if (id != s_modifiers[i].m_modifierID) {
options[s_modifiers[i].m_optionID] = id;
}
else {
options.erase(s_modifiers[i].m_optionID);
}
}
// save dead corner options
UInt32 corners = 0;
if (isItemChecked(getItem(hwnd, IDC_ADD_DC_TOP_LEFT))) {
corners |= kTopLeftMask;
}
if (isItemChecked(getItem(hwnd, IDC_ADD_DC_TOP_RIGHT))) {
corners |= kTopRightMask;
}
if (isItemChecked(getItem(hwnd, IDC_ADD_DC_BOTTOM_LEFT))) {
corners |= kBottomLeftMask;
}
if (isItemChecked(getItem(hwnd, IDC_ADD_DC_BOTTOM_RIGHT))) {
corners |= kBottomRightMask;
}
options[kOptionScreenSwitchCorners] = corners;
options[kOptionScreenSwitchCornerSize] = cornerSize;
// save new data to config
if (m_name.empty()) {
// added screen
m_config->addScreen(newName);
}
else {
// edited screen
m_config->removeAliases(m_name);
m_config->removeOptions(m_name);
m_config->renameScreen(m_name, newName);
}
m_name = newName;
for (CStringList::const_iterator index = newAliases.begin();
index != newAliases.end(); ++index) {
m_config->addAlias(m_name, *index);
}
for (CConfig::CScreenOptions::const_iterator
index = options.begin();
index != options.end(); ++index) {
m_config->addOption(m_name, index->first, index->second);
}
return true;
}
BOOL
CAddScreen::doDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM)
{
switch (message) {
case WM_INITDIALOG:
init(hwnd);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
if (save(hwnd)) {
EndDialog(hwnd, 1);
}
return TRUE;
case IDCANCEL:
EndDialog(hwnd, 0);
return TRUE;
}
break;
default:
break;
}
return FALSE;
}
BOOL CALLBACK
CAddScreen::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return s_singleton->doDlgProc(hwnd, message, wParam, lParam);
}
void
CAddScreen::getAliases(CStringList& aliases) const
{
for (CConfig::all_const_iterator index = m_config->beginAll();
index != m_config->endAll(); ++index) {
if (CStringUtil::CaselessCmp::equal(index->second, m_name) &&
!CStringUtil::CaselessCmp::equal(index->second, index->first)) {
aliases.push_back(index->first);
}
}
}
void
CAddScreen::getOptions(CConfig::CScreenOptions& optionsOut) const
{
const CConfig::CScreenOptions* options = m_config->getOptions(m_name);
if (options == NULL) {
optionsOut = CConfig::CScreenOptions();
}
else {
optionsOut = *options;
}
}
void
CAddScreen::tokenize(CStringList& tokens, const CString& src)
{
// find first non-whitespace
CString::size_type x = src.find_first_not_of(" \t\r\n");
if (x == CString::npos) {
return;
}
// find next whitespace
do {
CString::size_type y = src.find_first_of(" \t\r\n", x);
if (y == CString::npos) {
y = src.size();
}
tokens.push_back(src.substr(x, y - x));
x = src.find_first_not_of(" \t\r\n", y);
} while (x != CString::npos);
}
bool
CAddScreen::isNameInList(const CStringList& names, const CString& name)
{
for (CStringList::const_iterator index = names.begin();
index != names.end(); ++index) {
if (CStringUtil::CaselessCmp::equal(name, *index)) {
return true;
}
}
return false;
}

View File

@ -1,77 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#ifndef CADDSCREEN_H
#define CADDSCREEN_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
class CConfig;
//! Add screen dialog for Microsoft Windows launcher
class CAddScreen {
public:
CAddScreen(HWND parent, CConfig*, const CString& name);
~CAddScreen();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user. Return
\c true if the user accepted the changes, false otherwise.
*/
bool doModal();
//@}
//! @name accessors
//@{
CString getName() const;
//@}
private:
typedef std::vector<CString> CStringList;
void getAliases(CStringList&) const;
void getOptions(CConfig::CScreenOptions&) const;
static void tokenize(CStringList& tokens, const CString& src);
static bool isNameInList(const CStringList& tokens,
const CString& src);
void init(HWND hwnd);
bool save(HWND hwnd);
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CAddScreen* s_singleton;
HWND m_parent;
CConfig* m_config;
CString m_name;
};
#endif

View File

@ -1,272 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#include "CConfig.h"
#include "ProtocolTypes.h"
#include "CStringUtil.h"
#include "CArch.h"
#include "CArchMiscWindows.h"
#include "CAdvancedOptions.h"
#include "LaunchUtil.h"
#include "XArch.h"
#include "resource.h"
//
// CAdvancedOptions
//
CAdvancedOptions* CAdvancedOptions::s_singleton = NULL;
CAdvancedOptions::CAdvancedOptions(HWND parent, CConfig* config) :
m_parent(parent),
m_config(config),
m_isClient(false),
m_screenName(ARCH->getHostName()),
m_port(kDefaultPort),
m_interface()
{
assert(s_singleton == NULL);
s_singleton = this;
init();
}
CAdvancedOptions::~CAdvancedOptions()
{
s_singleton = NULL;
}
void
CAdvancedOptions::doModal(bool isClient)
{
// save state
m_isClient = isClient;
// do dialog
DialogBoxParam(s_instance, MAKEINTRESOURCE(IDD_ADVANCED_OPTIONS),
m_parent, (DLGPROC)dlgProc, (LPARAM)this);
}
CString
CAdvancedOptions::getScreenName() const
{
return m_screenName;
}
int
CAdvancedOptions::getPort() const
{
return m_port;
}
CString
CAdvancedOptions::getInterface() const
{
return m_interface;
}
CString
CAdvancedOptions::getCommandLine(bool isClient, const CString& serverName) const
{
CString cmdLine;
// screen name
if (!m_screenName.empty()) {
cmdLine += " --name ";
cmdLine += m_screenName;
}
// port
char portString[20];
sprintf(portString, "%d", m_port);
if (isClient) {
cmdLine += " ";
cmdLine += serverName;
cmdLine += ":";
cmdLine += portString;
}
else {
cmdLine += " --address ";
if (!m_interface.empty()) {
cmdLine += m_interface;
}
cmdLine += ":";
cmdLine += portString;
}
return cmdLine;
}
void
CAdvancedOptions::init()
{
// get values from registry
HKEY key = CArchMiscWindows::openKey(HKEY_CURRENT_USER, getSettingsPath());
if (key != NULL) {
DWORD newPort = CArchMiscWindows::readValueInt(key, "port");
CString newName = CArchMiscWindows::readValueString(key, "name");
CString newInterface =
CArchMiscWindows::readValueString(key, "interface");
if (newPort != 0) {
m_port = static_cast<int>(newPort);
}
if (!newName.empty()) {
m_screenName = newName;
}
if (!newInterface.empty()) {
m_interface = newInterface;
}
CArchMiscWindows::closeKey(key);
}
}
void
CAdvancedOptions::doInit(HWND hwnd)
{
// set values in GUI
HWND child;
char buffer[20];
sprintf(buffer, "%d", m_port);
child = getItem(hwnd, IDC_ADVANCED_PORT_EDIT);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)buffer);
child = getItem(hwnd, IDC_ADVANCED_NAME_EDIT);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)m_screenName.c_str());
child = getItem(hwnd, IDC_ADVANCED_INTERFACE_EDIT);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)m_interface.c_str());
}
bool
CAdvancedOptions::save(HWND hwnd)
{
SetCursor(LoadCursor(NULL, IDC_WAIT));
HWND child = getItem(hwnd, IDC_ADVANCED_NAME_EDIT);
CString name = getWindowText(child);
if (!m_config->isValidScreenName(name)) {
showError(hwnd, CStringUtil::format(
getString(IDS_INVALID_SCREEN_NAME).c_str(),
name.c_str()));
SetFocus(child);
return false;
}
if (!m_isClient && !m_config->isScreen(name)) {
showError(hwnd, CStringUtil::format(
getString(IDS_UNKNOWN_SCREEN_NAME).c_str(),
name.c_str()));
SetFocus(child);
return false;
}
child = getItem(hwnd, IDC_ADVANCED_INTERFACE_EDIT);
CString iface = getWindowText(child);
if (!m_isClient) {
try {
if (!iface.empty()) {
ARCH->nameToAddr(iface);
}
}
catch (XArchNetworkName& e) {
showError(hwnd, CStringUtil::format(
getString(IDS_INVALID_INTERFACE_NAME).c_str(),
iface.c_str(), e.what().c_str()));
SetFocus(child);
return false;
}
}
// get and verify port
child = getItem(hwnd, IDC_ADVANCED_PORT_EDIT);
CString portString = getWindowText(child);
int port = atoi(portString.c_str());
if (port < 1 || port > 65535) {
CString defaultPortString = CStringUtil::print("%d", kDefaultPort);
showError(hwnd, CStringUtil::format(
getString(IDS_INVALID_PORT).c_str(),
portString.c_str(),
defaultPortString.c_str()));
SetFocus(child);
return false;
}
// save state
m_screenName = name;
m_port = port;
m_interface = iface;
// save values to registry
HKEY key = CArchMiscWindows::addKey(HKEY_CURRENT_USER, getSettingsPath());
if (key != NULL) {
CArchMiscWindows::setValue(key, "port", m_port);
CArchMiscWindows::setValue(key, "name", m_screenName);
CArchMiscWindows::setValue(key, "interface", m_interface);
CArchMiscWindows::closeKey(key);
}
return true;
}
void
CAdvancedOptions::setDefaults(HWND hwnd)
{
// restore defaults
m_screenName = ARCH->getHostName();
m_port = kDefaultPort;
m_interface = "";
// update GUI
doInit(hwnd);
}
BOOL
CAdvancedOptions::doDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM)
{
switch (message) {
case WM_INITDIALOG:
doInit(hwnd);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
if (save(hwnd)) {
EndDialog(hwnd, 0);
}
return TRUE;
case IDCANCEL:
EndDialog(hwnd, 0);
return TRUE;
case IDC_ADVANCED_DEFAULTS:
setDefaults(hwnd);
return TRUE;
}
break;
default:
break;
}
return FALSE;
}
BOOL CALLBACK
CAdvancedOptions::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return s_singleton->doDlgProc(hwnd, message, wParam, lParam);
}

View File

@ -1,83 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#ifndef CADVANCEDOPTIONS_H
#define CADVANCEDOPTIONS_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
class CConfig;
//! Advanced options dialog for Microsoft Windows launcher
class CAdvancedOptions {
public:
CAdvancedOptions(HWND parent, CConfig*);
~CAdvancedOptions();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user.
*/
void doModal(bool isClient);
//@}
//! @name accessors
//@{
//! Get the screen name
CString getScreenName() const;
//! Get the port
int getPort() const;
//! Get the interface
CString getInterface() const;
//! Convert options to command line string
CString getCommandLine(bool isClient,
const CString& serverName) const;
//@}
private:
void init();
void doInit(HWND hwnd);
bool save(HWND hwnd);
void setDefaults(HWND hwnd);
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CAdvancedOptions* s_singleton;
HWND m_parent;
CConfig* m_config;
bool m_isClient;
CString m_screenName;
int m_port;
CString m_interface;
};
#endif

View File

@ -1,364 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#include "CLog.h"
#include "ILogOutputter.h"
#include "CArch.h"
#include "CStringUtil.h"
#include "XArch.h"
#include "CAutoStart.h"
#include "LaunchUtil.h"
#include "resource.h"
static const char* CLIENT_DAEMON_NAME = "Synergy Client";
static const char* SERVER_DAEMON_NAME = "Synergy Server";
static const char* CLIENT_DAEMON_INFO = "Uses a shared mouse and keyboard.";
static const char* SERVER_DAEMON_INFO = "Shares this system's mouse and keyboard with others.";
//
// CAutoStartOutputter
//
// This class detects a message above a certain level and saves it
//
class CAutoStartOutputter : public ILogOutputter {
public:
CAutoStartOutputter(CString* msg) : m_msg(msg) { }
virtual ~CAutoStartOutputter() { }
// ILogOutputter overrides
virtual void open(const char*) { }
virtual void close() { }
virtual void show(bool) { }
virtual bool write(ELevel level, const char* message);
virtual const char* getNewline() const { return ""; }
private:
CString* m_msg;
};
bool
CAutoStartOutputter::write(ELevel level, const char* message)
{
if (level <= CLog::kERROR) {
*m_msg = message;
}
return false;
}
//
// CAutoStart
//
CAutoStart* CAutoStart::s_singleton = NULL;
CAutoStart::CAutoStart(HWND parent, bool isServer, const CString& cmdLine) :
m_parent(parent),
m_isServer(isServer),
m_cmdLine(cmdLine),
m_name(isServer ? SERVER_DAEMON_NAME : CLIENT_DAEMON_NAME)
{
assert(s_singleton == NULL);
s_singleton = this;
}
CAutoStart::~CAutoStart()
{
s_singleton = NULL;
}
void
CAutoStart::doModal()
{
// install our log outputter
CLOG->insert(new CAutoStartOutputter(&m_errorMessage));
// do dialog
DialogBoxParam(s_instance, MAKEINTRESOURCE(IDD_AUTOSTART),
m_parent, (DLGPROC)dlgProc, (LPARAM)this);
// remove log outputter
CLOG->pop_front();
}
void
CAutoStart::reinstallDaemon(bool isClient, const CString& cmdLine)
{
// get installation state
const char* name = (isClient ? CLIENT_DAEMON_NAME : SERVER_DAEMON_NAME);
bool installedSystem = ARCH->isDaemonInstalled(name, true);
bool installedUser = ARCH->isDaemonInstalled(name, false);
// reinstall if anything is installed
if (installedSystem || installedUser) {
ARCH->installDaemon(name,
isClient ? CLIENT_DAEMON_INFO : SERVER_DAEMON_INFO,
getAppPath(isClient ? CLIENT_APP : SERVER_APP).c_str(),
cmdLine.c_str(),
NULL,
installedSystem);
}
}
void
CAutoStart::uninstallDaemons(bool client)
{
if (client) {
try {
ARCH->uninstallDaemon(CLIENT_DAEMON_NAME, true);
}
catch (...) {
}
try {
ARCH->uninstallDaemon(CLIENT_DAEMON_NAME, false);
}
catch (...) {
}
}
else {
try {
ARCH->uninstallDaemon(SERVER_DAEMON_NAME, true);
}
catch (...) {
}
try {
ARCH->uninstallDaemon(SERVER_DAEMON_NAME, false);
}
catch (...) {
}
}
}
bool
CAutoStart::startDaemon()
{
const char* name = NULL;
if (ARCH->isDaemonInstalled(CLIENT_DAEMON_NAME, true)) {
name = CLIENT_DAEMON_NAME;
}
else if (ARCH->isDaemonInstalled(SERVER_DAEMON_NAME, true)) {
name = SERVER_DAEMON_NAME;
}
if (name == NULL) {
return false;
}
// open service manager
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ);
if (mgr == NULL) {
return false;
}
// open the service
SC_HANDLE service = OpenService(mgr, name, SERVICE_START);
if (service == NULL) {
CloseServiceHandle(mgr);
return false;
}
// start the service
BOOL okay = StartService(service, 0, NULL);
// clean up
CloseServiceHandle(service);
CloseServiceHandle(mgr);
return (okay != 0);
}
bool
CAutoStart::isDaemonInstalled()
{
return (ARCH->isDaemonInstalled(CLIENT_DAEMON_NAME, false) ||
ARCH->isDaemonInstalled(CLIENT_DAEMON_NAME, true) ||
ARCH->isDaemonInstalled(SERVER_DAEMON_NAME, false) ||
ARCH->isDaemonInstalled(SERVER_DAEMON_NAME, true));
}
void
CAutoStart::update()
{
// get installation state
const bool installedSystem = ARCH->isDaemonInstalled(
m_name.c_str(), true);
const bool installedUser = ARCH->isDaemonInstalled(
m_name.c_str(), false);
// get user's permissions
const bool canInstallSystem = ARCH->canInstallDaemon(
m_name.c_str(), true);
const bool canInstallUser = ARCH->canInstallDaemon(
m_name.c_str(), false);
// update messages
CString msg, label;
if (canInstallSystem) {
if (canInstallUser) {
msg = getString(IDS_AUTOSTART_PERMISSION_ALL);
}
else {
msg = getString(IDS_AUTOSTART_PERMISSION_SYSTEM);
}
}
else if (canInstallUser) {
msg = getString(IDS_AUTOSTART_PERMISSION_USER);
}
else {
msg = getString(IDS_AUTOSTART_PERMISSION_NONE);
}
setWindowText(getItem(m_hwnd, IDC_AUTOSTART_PERMISSION_MSG), msg);
if (installedSystem) {
msg = getString(IDS_AUTOSTART_INSTALLED_SYSTEM);
label = getString(IDS_UNINSTALL_LABEL);
}
else if (installedUser) {
msg = getString(IDS_AUTOSTART_INSTALLED_USER);
label = getString(IDS_UNINSTALL_LABEL);
}
else {
msg = getString(IDS_AUTOSTART_INSTALLED_NONE);
label = getString(IDS_INSTALL_LABEL);
}
setWindowText(getItem(m_hwnd, IDC_AUTOSTART_INSTALLED_MSG), msg);
// update buttons
setWindowText(getItem(m_hwnd, IDC_AUTOSTART_INSTALL_SYSTEM), label);
setWindowText(getItem(m_hwnd, IDC_AUTOSTART_INSTALL_USER), label);
if (installedSystem) {
enableItem(m_hwnd, IDC_AUTOSTART_INSTALL_SYSTEM, canInstallSystem);
enableItem(m_hwnd, IDC_AUTOSTART_INSTALL_USER, false);
m_install = false;
}
else if (installedUser) {
enableItem(m_hwnd, IDC_AUTOSTART_INSTALL_SYSTEM, false);
enableItem(m_hwnd, IDC_AUTOSTART_INSTALL_USER, canInstallUser);
m_install = false;
}
else {
enableItem(m_hwnd, IDC_AUTOSTART_INSTALL_SYSTEM, canInstallSystem);
enableItem(m_hwnd, IDC_AUTOSTART_INSTALL_USER, canInstallUser);
m_install = true;
}
}
bool
CAutoStart::onInstall(bool allUsers)
{
if (!m_install) {
return onUninstall(allUsers);
}
// get the app path
CString appPath = getAppPath(m_isServer ? SERVER_APP : CLIENT_APP);
// clear error message
m_errorMessage = "";
// install
try {
ARCH->installDaemon(m_name.c_str(),
m_isServer ? SERVER_DAEMON_INFO : CLIENT_DAEMON_INFO,
appPath.c_str(), m_cmdLine.c_str(),
NULL, allUsers);
askOkay(m_hwnd, getString(IDS_INSTALL_TITLE),
getString(allUsers ?
IDS_INSTALLED_SYSTEM :
IDS_INSTALLED_USER));
return true;
}
catch (XArchDaemon& e) {
if (m_errorMessage.empty()) {
m_errorMessage = CStringUtil::format(
getString(IDS_INSTALL_GENERIC_ERROR).c_str(),
e.what().c_str());
}
showError(m_hwnd, m_errorMessage);
return false;
}
}
bool
CAutoStart::onUninstall(bool allUsers)
{
// clear error message
m_errorMessage = "";
// uninstall
try {
ARCH->uninstallDaemon(m_name.c_str(), allUsers);
askOkay(m_hwnd, getString(IDS_UNINSTALL_TITLE),
getString(allUsers ?
IDS_UNINSTALLED_SYSTEM :
IDS_UNINSTALLED_USER));
return true;
}
catch (XArchDaemon& e) {
if (m_errorMessage.empty()) {
m_errorMessage = CStringUtil::format(
getString(IDS_UNINSTALL_GENERIC_ERROR).c_str(),
e.what().c_str());
}
showError(m_hwnd, m_errorMessage);
return false;
}
}
BOOL
CAutoStart::doDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM)
{
switch (message) {
case WM_INITDIALOG:
// save our hwnd
m_hwnd = hwnd;
// update the controls
update();
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_AUTOSTART_INSTALL_SYSTEM:
onInstall(true);
update();
return TRUE;
case IDC_AUTOSTART_INSTALL_USER:
onInstall(false);
update();
return TRUE;
case IDCANCEL:
EndDialog(hwnd, 0);
m_hwnd = NULL;
return TRUE;
}
break;
default:
break;
}
return FALSE;
}
BOOL CALLBACK
CAutoStart::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return s_singleton->doDlgProc(hwnd, message, wParam, lParam);
}

View File

@ -1,93 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#ifndef CAUTOSTART_H
#define CAUTOSTART_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
//! Auto start dialog for Microsoft Windows launcher
class CAutoStart {
public:
CAutoStart(HWND parent, bool isServer, const CString& cmdLine);
~CAutoStart();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user.
*/
void doModal();
//! Reinstall daemon
/*!
Reinstalls the currently installed daemon.
*/
static void reinstallDaemon(bool isClient, const CString& cmdLine);
//! Uninstalls daemon
/*!
Uninstalls all installed client (\p client is \c true) or server daemons.
*/
static void uninstallDaemons(bool client);
//! Starts an installed daemon
/*!
Returns \c true iff a daemon was started. This will only start daemons
installed for all users.
*/
static bool startDaemon();
//@}
//! @name accessors
//@{
//! Tests if any daemons are installed
/*!
Returns \c true if any daemons are installed.
*/
static bool isDaemonInstalled();
//@}
private:
void update();
bool onInstall(bool allUsers);
bool onUninstall(bool allUsers);
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CAutoStart* s_singleton;
HWND m_parent;
bool m_isServer;
CString m_cmdLine;
CString m_name;
HWND m_hwnd;
bool m_install;
CString m_errorMessage;
};
#endif

View File

@ -1,317 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#include "CConfig.h"
#include "ProtocolTypes.h"
#include "CStringUtil.h"
#include "CArch.h"
#include "CGlobalOptions.h"
#include "LaunchUtil.h"
#include "resource.h"
static const int s_defaultDelay = 250;
static const int s_defaultHeartbeat = 5000;
//
// CGlobalOptions
//
CGlobalOptions* CGlobalOptions::s_singleton = NULL;
CGlobalOptions::CGlobalOptions(HWND parent, CConfig* config) :
m_parent(parent),
m_config(config),
m_delayTime(s_defaultDelay),
m_twoTapTime(s_defaultDelay),
m_heartbeatTime(s_defaultHeartbeat)
{
assert(s_singleton == NULL);
s_singleton = this;
}
CGlobalOptions::~CGlobalOptions()
{
s_singleton = NULL;
}
void
CGlobalOptions::doModal()
{
// do dialog
DialogBoxParam(s_instance, MAKEINTRESOURCE(IDD_GLOBAL_OPTIONS),
m_parent, (DLGPROC)dlgProc, (LPARAM)this);
}
void
CGlobalOptions::init(HWND hwnd)
{
HWND child;
char buffer[30];
// reset options
sprintf(buffer, "%d", m_delayTime);
child = getItem(hwnd, IDC_GLOBAL_DELAY_CHECK);
setItemChecked(child, false);
child = getItem(hwnd, IDC_GLOBAL_DELAY_TIME);
setWindowText(child, buffer);
sprintf(buffer, "%d", m_twoTapTime);
child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_CHECK);
setItemChecked(child, false);
child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_TIME);
setWindowText(child, buffer);
child = getItem(hwnd, IDC_GLOBAL_NEEDS_SHIFT);
setItemChecked(child, false);
child = getItem(hwnd, IDC_GLOBAL_NEEDS_CONTROL);
setItemChecked(child, false);
child = getItem(hwnd, IDC_GLOBAL_NEEDS_ALT);
setItemChecked(child, false);
sprintf(buffer, "%d", m_heartbeatTime);
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
setItemChecked(child, false);
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
setWindowText(child, buffer);
child = getItem(hwnd, IDC_GLOBAL_SCREENSAVER_SYNC);
setItemChecked(child, true);
child = getItem(hwnd, IDC_GLOBAL_RELATIVE_MOVES);
setItemChecked(child, false);
child = getItem(hwnd, IDC_GLOBAL_LEAVE_FOREGROUND);
setItemChecked(child, false);
// get the global options
const CConfig::CScreenOptions* options = m_config->getOptions("");
if (options != NULL) {
for (CConfig::CScreenOptions::const_iterator index = options->begin();
index != options->end(); ++index) {
const OptionID id = index->first;
const OptionValue value = index->second;
if (id == kOptionScreenSwitchDelay) {
if (value > 0) {
sprintf(buffer, "%d", value);
child = getItem(hwnd, IDC_GLOBAL_DELAY_CHECK);
setItemChecked(child, true);
child = getItem(hwnd, IDC_GLOBAL_DELAY_TIME);
setWindowText(child, buffer);
}
}
else if (id == kOptionScreenSwitchTwoTap) {
if (value > 0) {
sprintf(buffer, "%d", value);
child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_CHECK);
setItemChecked(child, true);
child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_TIME);
setWindowText(child, buffer);
}
}
else if (id == kOptionScreenSwitchNeedsShift) {
child = getItem(hwnd, IDC_GLOBAL_NEEDS_SHIFT);
setItemChecked(child, (value != 0));
}
else if (id == kOptionScreenSwitchNeedsControl) {
child = getItem(hwnd, IDC_GLOBAL_NEEDS_CONTROL);
setItemChecked(child, (value != 0));
}
else if (id == kOptionScreenSwitchNeedsAlt) {
child = getItem(hwnd, IDC_GLOBAL_NEEDS_ALT);
setItemChecked(child, (value != 0));
}
else if (id == kOptionHeartbeat) {
if (value > 0) {
sprintf(buffer, "%d", value);
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
setItemChecked(child, true);
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
setWindowText(child, buffer);
}
}
else if (id == kOptionScreenSaverSync) {
child = getItem(hwnd, IDC_GLOBAL_SCREENSAVER_SYNC);
setItemChecked(child, (value != 0));
}
else if (id == kOptionRelativeMouseMoves) {
child = getItem(hwnd, IDC_GLOBAL_RELATIVE_MOVES);
setItemChecked(child, (value != 0));
}
else if (id == kOptionWin32KeepForeground) {
child = getItem(hwnd, IDC_GLOBAL_LEAVE_FOREGROUND);
setItemChecked(child, (value != 0));
}
}
}
}
bool
CGlobalOptions::save(HWND hwnd)
{
HWND child;
int newDelayTime = 0;
int newTwoTapTime = 0;
int newHeartbeatTime = 0;
// get requested options
child = getItem(hwnd, IDC_GLOBAL_DELAY_CHECK);
if (isItemChecked(child)) {
child = getItem(hwnd, IDC_GLOBAL_DELAY_TIME);
newDelayTime = getTime(hwnd, child, true);
if (newDelayTime == 0) {
return false;
}
}
else {
child = getItem(hwnd, IDC_GLOBAL_DELAY_TIME);
newDelayTime = getTime(hwnd, child, false);
if (newDelayTime == 0) {
newDelayTime = s_defaultDelay;
}
}
child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_CHECK);
if (isItemChecked(child)) {
child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_TIME);
newTwoTapTime = getTime(hwnd, child, true);
if (newTwoTapTime == 0) {
return false;
}
}
else {
child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_TIME);
newTwoTapTime = getTime(hwnd, child, false);
if (newTwoTapTime == 0) {
newTwoTapTime = s_defaultDelay;
}
}
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
if (isItemChecked(child)) {
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
newHeartbeatTime = getTime(hwnd, child, true);
if (newHeartbeatTime == 0) {
return false;
}
}
else {
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
newHeartbeatTime = getTime(hwnd, child, false);
if (newHeartbeatTime == 0) {
newHeartbeatTime = s_defaultHeartbeat;
}
}
// remove existing config options
m_config->removeOption("", kOptionScreenSwitchDelay);
m_config->removeOption("", kOptionScreenSwitchTwoTap);
m_config->removeOption("", kOptionHeartbeat);
m_config->removeOption("", kOptionScreenSaverSync);
m_config->removeOption("", kOptionRelativeMouseMoves);
m_config->removeOption("", kOptionWin32KeepForeground);
m_config->removeOption("", kOptionScreenSwitchNeedsAlt);
m_config->removeOption("", kOptionScreenSwitchNeedsShift);
m_config->removeOption("", kOptionScreenSwitchNeedsControl);
// add requested options
child = getItem(hwnd, IDC_GLOBAL_DELAY_CHECK);
if (isItemChecked(child)) {
m_config->addOption("", kOptionScreenSwitchDelay, newDelayTime);
}
child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_CHECK);
if (isItemChecked(child)) {
m_config->addOption("", kOptionScreenSwitchTwoTap, newTwoTapTime);
}
child = getItem(hwnd, IDC_GLOBAL_NEEDS_SHIFT);
if (isItemChecked(child)) {
m_config->addOption("", kOptionScreenSwitchNeedsShift, 1);
}
child = getItem(hwnd, IDC_GLOBAL_NEEDS_CONTROL);
if (isItemChecked(child)) {
m_config->addOption("", kOptionScreenSwitchNeedsControl, 1);
}
child = getItem(hwnd, IDC_GLOBAL_NEEDS_ALT);
if (isItemChecked(child)) {
m_config->addOption("", kOptionScreenSwitchNeedsAlt, 1);
}
child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
if (isItemChecked(child)) {
m_config->addOption("", kOptionHeartbeat, newHeartbeatTime);
}
child = getItem(hwnd, IDC_GLOBAL_SCREENSAVER_SYNC);
if (!isItemChecked(child)) {
m_config->addOption("", kOptionScreenSaverSync, 0);
}
child = getItem(hwnd, IDC_GLOBAL_RELATIVE_MOVES);
if (isItemChecked(child)) {
m_config->addOption("", kOptionRelativeMouseMoves, 1);
}
child = getItem(hwnd, IDC_GLOBAL_LEAVE_FOREGROUND);
if (isItemChecked(child)) {
m_config->addOption("", kOptionWin32KeepForeground, 1);
}
// save last values
m_delayTime = newDelayTime;
m_twoTapTime = newTwoTapTime;
m_heartbeatTime = newHeartbeatTime;
return true;
}
int
CGlobalOptions::getTime(HWND hwnd, HWND child, bool reportError)
{
CString valueString = getWindowText(child);
int value = atoi(valueString.c_str());
if (value < 1) {
if (reportError) {
showError(hwnd, CStringUtil::format(
getString(IDS_INVALID_TIME).c_str(),
valueString.c_str()));
SetFocus(child);
}
return 0;
}
return value;
}
BOOL
CGlobalOptions::doDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM)
{
switch (message) {
case WM_INITDIALOG:
init(hwnd);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
if (save(hwnd)) {
EndDialog(hwnd, 0);
}
return TRUE;
case IDCANCEL:
EndDialog(hwnd, 0);
return TRUE;
}
break;
default:
break;
}
return FALSE;
}
BOOL CALLBACK
CGlobalOptions::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return s_singleton->doDlgProc(hwnd, message, wParam, lParam);
}

View File

@ -1,70 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#ifndef CGLOBALOPTIONS_H
#define CGLOBALOPTIONS_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
class CConfig;
//! Global options dialog for Microsoft Windows launcher
class CGlobalOptions {
public:
CGlobalOptions(HWND parent, CConfig*);
~CGlobalOptions();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user.
*/
void doModal();
//@}
//! @name accessors
//@{
//@}
private:
void init(HWND hwnd);
bool save(HWND hwnd);
int getTime(HWND hwnd, HWND child, bool reportError);
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CGlobalOptions* s_singleton;
HWND m_parent;
CConfig* m_config;
int m_delayTime;
int m_twoTapTime;
int m_heartbeatTime;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,230 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2006 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#ifndef CHOTKEYOPTIONS_H
#define CHOTKEYOPTIONS_H
#include "CString.h"
#include "KeyTypes.h"
#include "MouseTypes.h"
#include "CInputFilter.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
class CConfig;
//! Hotkey options dialog for Microsoft Windows launcher
class CHotkeyOptions {
public:
CHotkeyOptions(HWND parent, CConfig*);
~CHotkeyOptions();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user.
*/
void doModal();
//@}
//! @name accessors
//@{
//@}
private:
void doInit(HWND hwnd);
void fillHotkeys(HWND hwnd, UInt32 select = (UInt32)-1);
void updateHotkeysControls(HWND hwnd);
void addHotkey(HWND hwnd);
void removeHotkey(HWND hwnd);
void editHotkey(HWND hwnd);
void fillActions(HWND hwnd, UInt32 select = (UInt32)-1);
void updateActionsControls(HWND hwnd);
void addAction(HWND hwnd);
void removeAction(HWND hwnd);
void editAction(HWND hwnd);
bool editCondition(HWND hwnd, CInputFilter::CCondition*&);
bool editAction(HWND hwnd, CInputFilter::CAction*&,
bool& onActivate);
void openRule(HWND hwnd);
void closeRule(HWND hwnd);
UInt32 findMatchingAction(
const CInputFilter::CKeystrokeAction*) const;
UInt32 findMatchingAction(
const CInputFilter::CMouseButtonAction*) const;
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
// special actions we use to combine matching down/up actions into a
// single action for the convenience of the user.
class CKeystrokeDownUpAction : public CInputFilter::CKeystrokeAction {
public:
CKeystrokeDownUpAction(IPlatformScreen::CKeyInfo* adoptedInfo) :
CInputFilter::CKeystrokeAction(adoptedInfo, true) { }
// CAction overrides
virtual CInputFilter::CAction* clone() const
{
IKeyState::CKeyInfo* info = IKeyState::CKeyInfo::alloc(*getInfo());
return new CKeystrokeDownUpAction(info);
}
protected:
// CKeystrokeAction overrides
virtual const char* formatName() const { return "keystroke"; }
};
class CMouseButtonDownUpAction : public CInputFilter::CMouseButtonAction {
public:
CMouseButtonDownUpAction(IPrimaryScreen::CButtonInfo* adoptedInfo) :
CInputFilter::CMouseButtonAction(adoptedInfo, true) { }
// CAction overrides
virtual CInputFilter::CAction* clone() const
{
IPlatformScreen::CButtonInfo* info =
IPrimaryScreen::CButtonInfo::alloc(*getInfo());
return new CMouseButtonDownUpAction(info);
}
protected:
// CMouseButtonAction overrides
virtual const char* formatName() const { return "mousebutton"; }
};
class CConditionDialog {
public:
static bool doModal(HWND parent, CInputFilter::CCondition*&);
private:
static void doInit(HWND hwnd);
static void fillHotkey(HWND hwnd);
static void onButton(HWND hwnd, ButtonID button);
static void onKey(HWND hwnd, WPARAM wParam, LPARAM lParam);
static KeyID getChar(WPARAM wParam, LPARAM lParam);
static KeyModifierMask
getModifiers();
static bool isGoodCondition();
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
static LRESULT CALLBACK editProc(HWND hwnd, UINT, WPARAM, LPARAM);
private:
static CInputFilter::CCondition*
s_condition;
static CInputFilter::CCondition*
s_lastGoodCondition;
static WNDPROC s_editWndProc;
};
class CActionDialog {
public:
static bool doModal(HWND parent, CConfig* config,
CInputFilter::CAction*&, bool& onActivate);
private:
static void doInit(HWND hwnd);
static void fillHotkey(HWND hwnd);
static void updateControls(HWND hwnd);
static void onButton(HWND hwnd, ButtonID button);
static void onKey(HWND hwnd, WPARAM wParam, LPARAM lParam);
static void onLockAction(HWND hwnd);
static void onSwitchToAction(HWND hwnd);
static void onSwitchInAction(HWND hwnd);
static void onKeyboardBroadcastAction(HWND hwnd);
static KeyID getChar(WPARAM wParam, LPARAM lParam);
static KeyModifierMask
getModifiers();
static bool isGoodAction();
static void convertAction(HWND hwnd);
static bool isDownUpAction();
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
static LRESULT CALLBACK editProc(HWND hwnd, UINT, WPARAM, LPARAM);
private:
static CConfig* s_config;
static bool s_onActivate;
static CInputFilter::CAction*
s_action;
static CInputFilter::CAction*
s_lastGoodAction;
static std::set<CString> s_screens;
static WNDPROC s_editWndProc;
};
// public to allow CActionDialog to use it
public:
class CScreensDialog {
public:
static void doModal(HWND parent, CConfig* config,
CInputFilter::CKeystrokeAction*);
// public due to compiler brokenness
typedef std::set<CString> CScreens;
private:
static void doInit(HWND hwnd);
static void doFini(HWND hwnd);
static void fillScreens(HWND hwnd);
static void updateControls(HWND hwnd);
static void add(HWND hwnd);
static void remove(HWND hwnd);
static void getSelected(HWND hwnd, UINT id,
const CScreens& inScreens, CScreens& outScreens);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CConfig* s_config;
static CInputFilter::CKeystrokeAction* s_action;
static CScreens s_nonTargets;
static CScreens s_targets;
static CString s_allScreens;
};
private:
static CHotkeyOptions* s_singleton;
HWND m_parent;
CConfig* m_config;
CInputFilter* m_inputFilter;
CInputFilter::CRule m_activeRule;
UInt32 m_activeRuleIndex;
};
#endif

View File

@ -1,114 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2006 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#include "ProtocolTypes.h"
#include "CStringUtil.h"
#include "Version.h"
#include "CArch.h"
#include "CInfo.h"
#include "LaunchUtil.h"
#include "resource.h"
//
// CInfo
//
CInfo* CInfo::s_singleton = NULL;
CInfo::CInfo(HWND parent) :
m_parent(parent)
{
assert(s_singleton == NULL);
s_singleton = this;
}
CInfo::~CInfo()
{
s_singleton = NULL;
}
void
CInfo::doModal()
{
// do dialog
DialogBoxParam(s_instance, MAKEINTRESOURCE(IDD_INFO),
m_parent, (DLGPROC)dlgProc, (LPARAM)this);
}
void
CInfo::init(HWND hwnd)
{
// collect info
CString version =
CStringUtil::format(getString(IDS_TITLE).c_str(), kApplication, kVersion);
CString hostname = ARCH->getHostName();
CString address = ARCH->addrToString(ARCH->nameToAddr(hostname));
CString userConfig = ARCH->getUserDirectory();
if (!userConfig.empty()) {
userConfig = ARCH->concatPath(userConfig, CONFIG_NAME);
}
CString sysConfig = ARCH->getSystemDirectory();
if (!sysConfig.empty()) {
sysConfig = ARCH->concatPath(sysConfig, CONFIG_NAME);
}
// set info
HWND child;
child = getItem(hwnd, IDC_INFO_VERSION);
setWindowText(child, version);
child = getItem(hwnd, IDC_INFO_HOSTNAME);
setWindowText(child, hostname);
child = getItem(hwnd, IDC_INFO_IP_ADDRESS);
setWindowText(child, address);
child = getItem(hwnd, IDC_INFO_USER_CONFIG);
setWindowText(child, userConfig);
child = getItem(hwnd, IDC_INFO_SYS_CONFIG);
setWindowText(child, sysConfig);
// focus on okay button
SetFocus(getItem(hwnd, IDOK));
}
BOOL
CInfo::doDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM)
{
switch (message) {
case WM_INITDIALOG:
init(hwnd);
return FALSE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
EndDialog(hwnd, 0);
return TRUE;
}
break;
default:
break;
}
return FALSE;
}
BOOL CALLBACK
CInfo::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return s_singleton->doDlgProc(hwnd, message, wParam, lParam);
}

View File

@ -1,60 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2006 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#ifndef CINFO_H
#define CINFO_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
//! Info dialog for Microsoft Windows launcher
class CInfo {
public:
CInfo(HWND parent);
~CInfo();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user.
*/
void doModal();
//@}
//! @name accessors
//@{
//@}
private:
void init(HWND hwnd);
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CInfo* s_singleton;
HWND m_parent;
};
#endif

View File

@ -1,858 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#include "CConfig.h"
#include "ProtocolTypes.h"
#include "CStringUtil.h"
#include "CArch.h"
#include "CScreensLinks.h"
#include "CAddScreen.h"
#include "LaunchUtil.h"
#include "resource.h"
//
// CScreensLinks
//
CScreensLinks* CScreensLinks::s_singleton = NULL;
CScreensLinks::CScreensLinks(HWND parent, CConfig* config) :
m_parent(parent),
m_mainConfig(config),
m_config(&m_scratchConfig)
{
assert(s_singleton == NULL);
s_singleton = this;
// get formatting strings
m_linkFormat = getString(IDS_LINK_FORMAT);
m_intervalFormat = getString(IDS_LINK_INTERVAL_FORMAT);
m_newLinkLabel = getString(IDS_NEW_LINK);
m_sideLabel[kLeft - kFirstDirection] = getString(IDS_SIDE_LEFT);
m_sideLabel[kRight - kFirstDirection] = getString(IDS_SIDE_RIGHT);
m_sideLabel[kTop - kFirstDirection] = getString(IDS_SIDE_TOP);
m_sideLabel[kBottom - kFirstDirection] = getString(IDS_SIDE_BOTTOM);
// GDI objects
m_redPen = CreatePen(PS_INSIDEFRAME, 1, RGB(255, 0, 0));
}
CScreensLinks::~CScreensLinks()
{
DeleteObject(m_redPen);
s_singleton = NULL;
}
void
CScreensLinks::doModal()
{
// do dialog
DialogBoxParam(s_instance, MAKEINTRESOURCE(IDD_SCREENS_LINKS),
m_parent, (DLGPROC)dlgProc, (LPARAM)this);
}
void
CScreensLinks::init(HWND hwnd)
{
// get initial config
m_scratchConfig = *m_mainConfig;
// fill side list box (in EDirection order)
HWND child = getItem(hwnd, IDC_SCREENS_SRC_SIDE);
SendMessage(child, CB_ADDSTRING, 0, (LPARAM)TEXT("---"));
SendMessage(child, CB_ADDSTRING, 0,
(LPARAM)getString(IDS_EDGE_LEFT).c_str());
SendMessage(child, CB_ADDSTRING, 0,
(LPARAM)getString(IDS_EDGE_RIGHT).c_str());
SendMessage(child, CB_ADDSTRING, 0,
(LPARAM)getString(IDS_EDGE_TOP).c_str());
SendMessage(child, CB_ADDSTRING, 0,
(LPARAM)getString(IDS_EDGE_BOTTOM).c_str());
// create error boxes
m_srcSideError = createErrorBox(hwnd);
m_srcScreenError = createErrorBox(hwnd);
m_dstScreenError = createErrorBox(hwnd);
resizeErrorBoxes();
m_selectedLink = -1;
m_editedLink = CEdgeLink();
m_edgeLinks.clear();
updateScreens(hwnd, "");
updateScreensControls(hwnd);
updateLinks(hwnd);
updateLinksControls(hwnd);
}
bool
CScreensLinks::save(HWND /*hwnd*/)
{
*m_mainConfig = m_scratchConfig;
return true;
}
BOOL
CScreensLinks::doDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_INITDIALOG:
init(hwnd);
return TRUE;
case WM_SIZE:
resizeErrorBoxes();
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
SetFocus(getItem(hwnd, IDOK));
if (save(hwnd)) {
EndDialog(hwnd, 0);
}
return TRUE;
case IDCANCEL:
EndDialog(hwnd, 0);
return TRUE;
case IDC_SCREENS_SCREENS:
switch (HIWORD(wParam)) {
case LBN_DBLCLK:
editScreen(hwnd);
return TRUE;
case LBN_SELCHANGE:
updateScreensControls(hwnd);
updateLinkView(hwnd);
return TRUE;
case LBN_SELCANCEL:
updateScreensControls(hwnd);
updateLinkView(hwnd);
return TRUE;
}
break;
case IDC_SCREENS_ADD_SCREEN:
addScreen(hwnd);
return TRUE;
case IDC_SCREENS_REMOVE_SCREEN:
removeScreen(hwnd);
return TRUE;
case IDC_SCREENS_EDIT_SCREEN:
editScreen(hwnd);
return TRUE;
case IDC_SCREENS_LINKS:
switch (HIWORD(wParam)) {
case LBN_SELCHANGE:
editLink(hwnd);
return TRUE;
case LBN_SELCANCEL:
editLink(hwnd);
return TRUE;
}
break;
case IDC_SCREENS_ADD_LINK:
addLink(hwnd);
return TRUE;
case IDC_SCREENS_REMOVE_LINK:
removeLink(hwnd);
return TRUE;
case IDC_SCREENS_SRC_SIDE:
switch (HIWORD(wParam)) {
case CBN_SELCHANGE:
changeSrcSide(hwnd);
break;
}
break;
case IDC_SCREENS_SRC_SCREEN:
switch (HIWORD(wParam)) {
case CBN_SELCHANGE:
changeSrcScreen(hwnd);
break;
}
break;
case IDC_SCREENS_DST_SCREEN:
switch (HIWORD(wParam)) {
case CBN_SELCHANGE:
changeDstScreen(hwnd);
break;
}
break;
case IDC_SCREENS_SRC_START:
switch (HIWORD(wParam)) {
case EN_KILLFOCUS:
changeIntervalStart(hwnd, LOWORD(wParam),
m_editedLink.m_srcInterval);
break;
}
break;
case IDC_SCREENS_SRC_END:
switch (HIWORD(wParam)) {
case EN_KILLFOCUS:
changeIntervalEnd(hwnd, LOWORD(wParam),
m_editedLink.m_srcInterval);
break;
}
break;
case IDC_SCREENS_DST_START:
switch (HIWORD(wParam)) {
case EN_KILLFOCUS:
changeIntervalStart(hwnd, LOWORD(wParam),
m_editedLink.m_dstInterval);
break;
}
break;
case IDC_SCREENS_DST_END:
switch (HIWORD(wParam)) {
case EN_KILLFOCUS:
changeIntervalEnd(hwnd, LOWORD(wParam),
m_editedLink.m_dstInterval);
break;
}
break;
}
break;
case WM_CTLCOLORSTATIC:
switch (GetDlgCtrlID((HWND)lParam)) {
case IDC_SCREENS_OVERLAP_ERROR:
SetBkColor((HDC)wParam, GetSysColor(COLOR_3DFACE));
SetTextColor((HDC)wParam, RGB(255, 0, 0));
return (BOOL)GetSysColorBrush(COLOR_3DFACE);
}
break;
// error outlines
case WM_DRAWITEM: {
DRAWITEMSTRUCT* di = (DRAWITEMSTRUCT*)lParam;
if (di->CtlType == ODT_STATIC) {
HGDIOBJ oldPen = SelectObject(di->hDC, m_redPen);
HGDIOBJ oldBrush = SelectObject(di->hDC,
GetStockObject(NULL_BRUSH));
Rectangle(di->hDC, di->rcItem.left, di->rcItem.top,
di->rcItem.right, di->rcItem.bottom);
SelectObject(di->hDC, oldPen);
SelectObject(di->hDC, oldBrush);
return TRUE;
}
break;
}
default:
break;
}
return FALSE;
}
BOOL CALLBACK
CScreensLinks::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return s_singleton->doDlgProc(hwnd, message, wParam, lParam);
}
CString
CScreensLinks::getSelectedScreen(HWND hwnd) const
{
HWND child = getItem(hwnd, IDC_SCREENS_SCREENS);
LRESULT index = SendMessage(child, LB_GETCURSEL, 0, 0);
if (index == LB_ERR) {
return CString();
}
LRESULT size = SendMessage(child, LB_GETTEXTLEN, index, 0);
char* buffer = new char[size + 1];
SendMessage(child, LB_GETTEXT, index, (LPARAM)buffer);
buffer[size] = '\0';
CString result(buffer);
delete[] buffer;
return result;
}
void
CScreensLinks::addScreen(HWND hwnd)
{
CAddScreen dialog(hwnd, m_config, "");
if (dialog.doModal()) {
updateScreens(hwnd, dialog.getName());
updateScreensControls(hwnd);
updateLinks(hwnd);
updateLinksControls(hwnd);
}
}
void
CScreensLinks::editScreen(HWND hwnd)
{
CString oldName = getSelectedScreen(hwnd);
CAddScreen dialog(hwnd, m_config, oldName);
if (dialog.doModal()) {
CString newName = dialog.getName();
// rename screens in the edge list
if (newName != oldName) {
for (size_t i = 0; i < m_edgeLinks.size(); ++i) {
m_edgeLinks[i].rename(oldName, newName);
}
m_editedLink.rename(oldName, newName);
}
updateScreens(hwnd, newName);
updateScreensControls(hwnd);
updateLinks(hwnd);
updateLinksControls(hwnd);
}
}
void
CScreensLinks::removeScreen(HWND hwnd)
{
// remove screen from config (this also removes aliases)
m_config->removeScreen(getSelectedScreen(hwnd));
// update dialog
updateScreens(hwnd, "");
updateScreensControls(hwnd);
updateLinks(hwnd);
updateLinksControls(hwnd);
}
void
CScreensLinks::addLink(HWND hwnd)
{
if (m_editedLink.connect(m_config)) {
m_editedLink = CEdgeLink();
updateLinks(hwnd);
updateLinksControls(hwnd);
}
}
void
CScreensLinks::editLink(HWND hwnd)
{
// get selection
HWND child = getItem(hwnd, IDC_SCREENS_LINKS);
DWORD i = (DWORD)SendMessage(child, LB_GETCURSEL, 0, 0);
if (i != LB_ERR && i != (DWORD)m_edgeLinks.size()) {
// existing link
m_selectedLink = (SInt32)SendMessage(child, LB_GETITEMDATA, i, 0);
m_editedLink = m_edgeLinks[m_selectedLink];
}
else {
// new link
m_selectedLink = -1;
m_editedLink = CEdgeLink();
}
updateLinksControls(hwnd);
}
void
CScreensLinks::removeLink(HWND hwnd)
{
if (m_editedLink.disconnect(m_config)) {
updateLinks(hwnd);
updateLinksControls(hwnd);
}
}
void
CScreensLinks::updateScreens(HWND hwnd, const CString& selectName)
{
HWND child;
// set screen list
child = getItem(hwnd, IDC_SCREENS_SCREENS);
SendMessage(child, LB_RESETCONTENT, 0, 0);
for (CConfig::const_iterator index = m_config->begin();
index != m_config->end(); ) {
const CString& name = *index;
++index;
if (index != m_config->end()) {
SendMessage(child, LB_INSERTSTRING,
(WPARAM)-1, (LPARAM)name.c_str());
}
else {
SendMessage(child, LB_ADDSTRING, 0, (LPARAM)name.c_str());
}
}
// find the named screen
if (!selectName.empty()) {
DWORD i = (DWORD)SendMessage(child, LB_FINDSTRINGEXACT,
(UINT)-1, (LPARAM)selectName.c_str());
if (i != LB_ERR) {
SendMessage(child, LB_SETSEL, TRUE, i);
}
}
}
void
CScreensLinks::updateScreensControls(HWND hwnd)
{
HWND child = getItem(hwnd, IDC_SCREENS_SCREENS);
bool screenSelected = (SendMessage(child, LB_GETCURSEL, 0, 0) != LB_ERR);
enableItem(hwnd, IDC_SCREENS_ADD_SCREEN, TRUE);
enableItem(hwnd, IDC_SCREENS_EDIT_SCREEN, screenSelected);
enableItem(hwnd, IDC_SCREENS_REMOVE_SCREEN, screenSelected);
}
void
CScreensLinks::updateLinks(HWND hwnd)
{
HWND links = getItem(hwnd, IDC_SCREENS_LINKS);
HWND srcScreens = getItem(hwnd, IDC_SCREENS_SRC_SCREEN);
HWND dstScreens = getItem(hwnd, IDC_SCREENS_DST_SCREEN);
// get old selection
CEdgeLink oldLink;
if (m_selectedLink != -1) {
oldLink = m_edgeLinks[m_selectedLink];
}
// clear links and screens
SendMessage(links, LB_RESETCONTENT, 0, 0);
SendMessage(srcScreens, CB_RESETCONTENT, 0, 0);
SendMessage(dstScreens, CB_RESETCONTENT, 0, 0);
m_edgeLinks.clear();
// add "no screen" items
SendMessage(srcScreens, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)TEXT("----"));
SendMessage(dstScreens, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)TEXT("----"));
// add links and screens
for (CConfig::const_iterator i = m_config->begin();
i != m_config->end(); ++i) {
const CString& name = *i;
// add screen
SendMessage(srcScreens, CB_INSERTSTRING, (WPARAM)-1,
(LPARAM)name.c_str());
SendMessage(dstScreens, CB_INSERTSTRING, (WPARAM)-1,
(LPARAM)name.c_str());
// add links for screen
for (CConfig::link_const_iterator j = m_config->beginNeighbor(name),
n = m_config->endNeighbor(name);
j != n; ++j) {
DWORD k = (DWORD)m_edgeLinks.size();
m_edgeLinks.push_back(CEdgeLink(name, *j));
SendMessage(links, LB_INSERTSTRING, (WPARAM)-1,
(LPARAM)formatLink(m_edgeLinks.back()).c_str());
SendMessage(links, LB_SETITEMDATA, (WPARAM)k, (LPARAM)k);
}
}
// add "new link" item to sort
SendMessage(links, LB_ADDSTRING, 0, (LPARAM)m_newLinkLabel.c_str());
// remove the "new link" item then insert it on the end
DWORD i = (DWORD)SendMessage(links, LB_FINDSTRINGEXACT,
(UINT)-1, (LPARAM)m_newLinkLabel.c_str());
if (i != LB_ERR) {
SendMessage(links, LB_DELETESTRING, i, 0);
}
SendMessage(links, LB_INSERTSTRING, (WPARAM)-1,
(LPARAM)getString(IDS_NEW_LINK).c_str());
SendMessage(links, LB_SETITEMDATA, (WPARAM)m_edgeLinks.size(),
(LPARAM)-1);
// select the same link as before
SendMessage(links, LB_SETCURSEL, (WPARAM)m_edgeLinks.size(), 0);
if (m_selectedLink != -1) {
m_selectedLink = -1;
for (SInt32 j = 0; j < (SInt32)m_edgeLinks.size(); ++j) {
if (m_edgeLinks[j] == oldLink) {
// found matching link
m_selectedLink = j;
for (UInt32 k = 0; k < (UInt32)m_edgeLinks.size(); ++k) {
if (SendMessage(links, LB_GETITEMDATA, k, 0) == (int)j) {
SendMessage(links, LB_SETCURSEL, k, 0);
break;
}
}
break;
}
}
// if we can't find the link anymore then reset edited link
if (m_selectedLink == -1) {
m_editedLink = CEdgeLink();
}
}
}
void
CScreensLinks::updateLinksControls(HWND hwnd)
{
// get selection. select "new link" if nothing is selected.
HWND child = getItem(hwnd, IDC_SCREENS_LINKS);
if (m_selectedLink == -1) {
SendMessage(child, LB_SETCURSEL, m_edgeLinks.size(), 0);
}
// enable/disable remove button
enableItem(hwnd, IDC_SCREENS_REMOVE_LINK, m_selectedLink != -1);
// fill link entry controls from m_editedLink
updateLinkEditControls(hwnd, m_editedLink);
updateLinkValid(hwnd, m_editedLink);
updateLinkView(hwnd);
}
void
CScreensLinks::changeSrcSide(HWND hwnd)
{
HWND child = getItem(hwnd, IDC_SCREENS_SRC_SIDE);
m_editedLink.m_srcSide = (EDirection)SendMessage(child, CB_GETCURSEL, 0, 0);
updateLink(hwnd);
}
void
CScreensLinks::changeSrcScreen(HWND hwnd)
{
HWND child = getItem(hwnd, IDC_SCREENS_SRC_SCREEN);
m_editedLink.m_srcName = getWindowText(child);
updateLink(hwnd);
}
void
CScreensLinks::changeDstScreen(HWND hwnd)
{
HWND child = getItem(hwnd, IDC_SCREENS_DST_SCREEN);
m_editedLink.m_dstName = getWindowText(child);
updateLink(hwnd);
}
void
CScreensLinks::changeIntervalStart(HWND hwnd, int id, CConfig::CInterval& i)
{
int x = (int)GetDlgItemInt(hwnd, id, NULL, FALSE);
if (x < 0) {
x = 0;
}
else if (x > 99) {
x = 99;
}
i.first = 0.01f * (float)x;
if (i.first >= i.second) {
i.second = 0.01f * (float)(x + 1);
}
updateLinkIntervalControls(hwnd, m_editedLink);
updateLink(hwnd);
}
void
CScreensLinks::changeIntervalEnd(HWND hwnd, int id, CConfig::CInterval& i)
{
int x = (int)GetDlgItemInt(hwnd, id, NULL, FALSE);
if (x < 1) {
x = 1;
}
else if (x > 100) {
x = 100;
}
i.second = 0.01f * (float)x;
if (i.first >= i.second) {
i.first = 0.01f * (float)(x - 1);
}
updateLinkIntervalControls(hwnd, m_editedLink);
updateLink(hwnd);
}
void
CScreensLinks::selectScreen(HWND hwnd, int id, const CString& name)
{
HWND child = getItem(hwnd, id);
DWORD i = (DWORD)SendMessage(child, CB_FINDSTRINGEXACT, (WPARAM)-1,
(LPARAM)name.c_str());
if (i == CB_ERR) {
// no match, select no screen
SendMessage(child, CB_SETCURSEL, 0, 0);
}
else {
SendMessage(child, CB_SETCURSEL, i, 0);
}
}
void
CScreensLinks::updateLinkEditControls(HWND hwnd, const CEdgeLink& link)
{
// fill link entry controls from link
HWND child = getItem(hwnd, IDC_SCREENS_SRC_SIDE);
SendMessage(child, CB_SETCURSEL, link.m_srcSide, 0);
selectScreen(hwnd, IDC_SCREENS_SRC_SCREEN, link.m_srcName);
selectScreen(hwnd, IDC_SCREENS_DST_SCREEN, link.m_dstName);
updateLinkIntervalControls(hwnd, link);
}
void
CScreensLinks::updateLinkIntervalControls(HWND hwnd, const CEdgeLink& link)
{
HWND child;
// src interval
child = getItem(hwnd, IDC_SCREENS_SRC_START);
setWindowText(child, formatIntervalValue(link.m_srcInterval.first));
child = getItem(hwnd, IDC_SCREENS_SRC_END);
setWindowText(child, formatIntervalValue(link.m_srcInterval.second));
// dst interval
child = getItem(hwnd, IDC_SCREENS_DST_START);
setWindowText(child, formatIntervalValue(link.m_dstInterval.first));
child = getItem(hwnd, IDC_SCREENS_DST_END);
setWindowText(child, formatIntervalValue(link.m_dstInterval.second));
}
void
CScreensLinks::updateLink(HWND hwnd)
{
updateLinkValid(hwnd, m_editedLink);
// update link in config
if (m_selectedLink != -1 && m_editedLinkIsValid) {
// editing an existing link and entry is valid
if (m_edgeLinks[m_selectedLink].disconnect(m_config)) {
// successfully removed old link
if (!m_editedLink.connect(m_config)) {
// couldn't set new link so restore old link
m_edgeLinks[m_selectedLink].connect(m_config);
}
else {
m_edgeLinks[m_selectedLink] = m_editedLink;
updateLinks(hwnd);
updateLinkEditControls(hwnd, m_editedLink);
}
}
}
updateLinkView(hwnd);
}
void
CScreensLinks::updateLinkValid(HWND hwnd, const CEdgeLink& link)
{
m_editedLinkIsValid = true;
// check source side and screen
if (link.m_srcSide == kNoDirection) {
m_editedLinkIsValid = false;
ShowWindow(m_srcSideError, SW_SHOWNA);
}
else {
ShowWindow(m_srcSideError, SW_HIDE);
}
if (!m_config->isCanonicalName(link.m_srcName)) {
m_editedLinkIsValid = false;
ShowWindow(m_srcScreenError, SW_SHOWNA);
}
else {
ShowWindow(m_srcScreenError, SW_HIDE);
}
// check for overlap. if editing a link we must remove it, then
// check for overlap and restore the old link.
bool overlap = false;
if (m_editedLinkIsValid) {
if (m_selectedLink == -1) {
if (link.overlaps(m_config)) {
m_editedLinkIsValid = false;
overlap = true;
}
}
else {
if (m_edgeLinks[m_selectedLink].disconnect(m_config)) {
overlap = link.overlaps(m_config);
m_edgeLinks[m_selectedLink].connect(m_config);
if (overlap) {
m_editedLinkIsValid = false;
}
}
}
}
ShowWindow(getItem(hwnd, IDC_SCREENS_OVERLAP_ERROR),
overlap ? SW_SHOWNA : SW_HIDE);
// check dst screen
if (!m_config->isCanonicalName(link.m_dstName)) {
m_editedLinkIsValid = false;
ShowWindow(m_dstScreenError, SW_SHOWNA);
}
else {
ShowWindow(m_dstScreenError, SW_HIDE);
}
// update add link button
enableItem(hwnd, IDC_SCREENS_ADD_LINK,
m_selectedLink == -1 && m_editedLinkIsValid);
}
void
CScreensLinks::updateLinkView(HWND /*hwnd*/)
{
// XXX -- draw visual of selected screen, highlighting selected link
}
HWND
CScreensLinks::createErrorBox(HWND parent)
{
return CreateWindow(TEXT("STATIC"), TEXT(""),
WS_CHILD | SS_OWNERDRAW,
0, 0, 1, 1,
parent, (HMENU)-1,
s_instance, NULL);
}
void
CScreensLinks::resizeErrorBoxes()
{
HWND hwnd = GetParent(m_srcSideError);
resizeErrorBox(m_srcSideError, getItem(hwnd, IDC_SCREENS_SRC_SIDE));
resizeErrorBox(m_srcScreenError, getItem(hwnd, IDC_SCREENS_SRC_SCREEN));
resizeErrorBox(m_dstScreenError, getItem(hwnd, IDC_SCREENS_DST_SCREEN));
}
void
CScreensLinks::resizeErrorBox(HWND box, HWND assoc)
{
RECT rect;
GetWindowRect(assoc, &rect);
MapWindowPoints(NULL, GetParent(box), (POINT*)&rect, 2);
SetWindowPos(box, HWND_TOP, rect.left - 1, rect.top - 1,
rect.right - rect.left + 2,
rect.bottom - rect.top + 2, SWP_NOACTIVATE);
}
CString
CScreensLinks::formatIntervalValue(float x) const
{
return CStringUtil::print("%d", (int)(x * 100.0f + 0.5f));
}
CString
CScreensLinks::formatInterval(const CConfig::CInterval& i) const
{
if (i.first == 0.0f && i.second == 1.0f) {
return "";
}
else {
CString start = formatIntervalValue(i.first);
CString end = formatIntervalValue(i.second);
return CStringUtil::format(m_intervalFormat.c_str(),
start.c_str(), end.c_str());
}
}
CString
CScreensLinks::formatLink(const CEdgeLink& link) const
{
CString srcInterval = formatInterval(link.m_srcInterval);
CString dstInterval = formatInterval(link.m_dstInterval);
return CStringUtil::format(m_linkFormat.c_str(),
link.m_srcName.c_str(), srcInterval.c_str(),
m_sideLabel[link.m_srcSide - kFirstDirection].c_str(),
link.m_dstName.c_str(), dstInterval.c_str());
}
//
// CScreensLinks::CEdgeLink
//
CScreensLinks::CEdgeLink::CEdgeLink() :
m_srcName(),
m_srcSide(kNoDirection),
m_srcInterval(0.0f, 1.0f),
m_dstName(),
m_dstInterval(0.0f, 1.0f)
{
// do nothing
}
CScreensLinks::CEdgeLink::CEdgeLink(const CString& name,
const CConfigLink& link) :
m_srcName(name),
m_srcSide(link.first.getSide()),
m_srcInterval(link.first.getInterval()),
m_dstName(link.second.getName()),
m_dstInterval(link.second.getInterval())
{
// do nothing
}
bool
CScreensLinks::CEdgeLink::connect(CConfig* config)
{
return config->connect(m_srcName, m_srcSide,
m_srcInterval.first, m_srcInterval.second,
m_dstName,
m_dstInterval.first, m_dstInterval.second);
}
bool
CScreensLinks::CEdgeLink::disconnect(CConfig* config)
{
return config->disconnect(m_srcName, m_srcSide, 0.5f *
(m_srcInterval.first + m_srcInterval.second));
}
void
CScreensLinks::CEdgeLink::rename(const CString& oldName, const CString& newName)
{
if (m_srcName == oldName) {
m_srcName = newName;
}
if (m_dstName == oldName) {
m_dstName = newName;
}
}
bool
CScreensLinks::CEdgeLink::overlaps(const CConfig* config) const
{
return config->hasNeighbor(m_srcName, m_srcSide,
m_srcInterval.first, m_srcInterval.second);
}
bool
CScreensLinks::CEdgeLink::operator==(const CEdgeLink& x) const
{
return (m_srcName == x.m_srcName &&
m_srcSide == x.m_srcSide &&
m_srcInterval == x.m_srcInterval &&
m_dstName == x.m_dstName &&
m_dstInterval == x.m_dstInterval);
}

View File

@ -1,141 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#ifndef CSCREENSLINKS_H
#define CSCREENSLINKS_H
#include "CConfig.h"
#include "ProtocolTypes.h"
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
//! Screens and links dialog for Microsoft Windows launcher
class CScreensLinks {
public:
CScreensLinks(HWND parent, CConfig*);
~CScreensLinks();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user.
*/
void doModal();
//@}
//! @name accessors
//@{
//@}
private:
typedef std::pair<CConfig::CCellEdge, CConfig::CCellEdge> CConfigLink;
struct CEdgeLink {
public:
CEdgeLink();
CEdgeLink(const CString& name, const CConfigLink&);
bool connect(CConfig*);
bool disconnect(CConfig*);
void rename(const CString& oldName, const CString& newName);
bool overlaps(const CConfig* config) const;
bool operator==(const CEdgeLink&) const;
public:
CString m_srcName;
EDirection m_srcSide;
CConfig::CInterval m_srcInterval;
CString m_dstName;
CConfig::CInterval m_dstInterval;
};
typedef std::vector<CEdgeLink> CEdgeLinkList;
void init(HWND hwnd);
bool save(HWND hwnd);
CString getSelectedScreen(HWND hwnd) const;
void addScreen(HWND hwnd);
void editScreen(HWND hwnd);
void removeScreen(HWND hwnd);
void addLink(HWND hwnd);
void editLink(HWND hwnd);
void removeLink(HWND hwnd);
void updateScreens(HWND hwnd, const CString& name);
void updateScreensControls(HWND hwnd);
void updateLinks(HWND hwnd);
void updateLinksControls(HWND hwnd);
void changeSrcSide(HWND hwnd);
void changeSrcScreen(HWND hwnd);
void changeDstScreen(HWND hwnd);
void changeIntervalStart(HWND hwnd, int id,
CConfig::CInterval&);
void changeIntervalEnd(HWND hwnd, int id,
CConfig::CInterval&);
void selectScreen(HWND hwnd, int id, const CString& name);
void updateLinkEditControls(HWND hwnd,
const CEdgeLink& link);
void updateLinkIntervalControls(HWND hwnd,
const CEdgeLink& link);
void updateLink(HWND hwnd);
void updateLinkValid(HWND hwnd, const CEdgeLink& link);
void updateLinkView(HWND hwnd);
HWND createErrorBox(HWND parent);
void resizeErrorBoxes();
void resizeErrorBox(HWND box, HWND assoc);
CString formatIntervalValue(float) const;
CString formatInterval(const CConfig::CInterval&) const;
CString formatLink(const CEdgeLink&) const;
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CScreensLinks* s_singleton;
HWND m_parent;
CConfig* m_mainConfig;
CConfig m_scratchConfig;
CConfig* m_config;
CString m_linkFormat;
CString m_intervalFormat;
CString m_newLinkLabel;
CString m_sideLabel[kNumDirections];
CEdgeLinkList m_edgeLinks;
SInt32 m_selectedLink;
CEdgeLink m_editedLink;
bool m_editedLinkIsValid;
HPEN m_redPen;
HWND m_srcSideError;
HWND m_srcScreenError;
HWND m_dstScreenError;
};
#endif

View File

@ -1,264 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#include "CConfig.h"
#include "LaunchUtil.h"
#include "CMSWindowsUtil.h"
#include "CArch.h"
#include "resource.h"
#include "stdfstream.h"
size_t s_showingDialog = 0;
CString
getString(DWORD id)
{
return CMSWindowsUtil::getString(s_instance, id);
}
CString
getErrorString(DWORD error)
{
return CMSWindowsUtil::getErrorString(s_instance, error, IDS_ERROR);
}
void
showError(HWND hwnd, const CString& msg)
{
CString title = getString(IDS_ERROR);
++s_showingDialog;
MessageBox(hwnd, msg.c_str(), title.c_str(), MB_OK | MB_APPLMODAL);
--s_showingDialog;
}
void
askOkay(HWND hwnd, const CString& title, const CString& msg)
{
++s_showingDialog;
MessageBox(hwnd, msg.c_str(), title.c_str(), MB_OK | MB_APPLMODAL);
--s_showingDialog;
}
bool
askVerify(HWND hwnd, const CString& msg)
{
CString title = getString(IDS_VERIFY);
++s_showingDialog;
int result = MessageBox(hwnd, msg.c_str(),
title.c_str(), MB_OKCANCEL | MB_APPLMODAL);
--s_showingDialog;
return (result == IDOK);
}
bool
isShowingDialog()
{
return (s_showingDialog != 0);
}
void
setWindowText(HWND hwnd, const CString& msg)
{
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)msg.c_str());
}
CString
getWindowText(HWND hwnd)
{
LRESULT size = SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0);
char* buffer = new char[size + 1];
SendMessage(hwnd, WM_GETTEXT, size + 1, (LPARAM)buffer);
buffer[size] = '\0';
CString result(buffer);
delete[] buffer;
return result;
}
HWND
getItem(HWND hwnd, int id)
{
return GetDlgItem(hwnd, id);
}
void
enableItem(HWND hwnd, int id, bool enabled)
{
EnableWindow(GetDlgItem(hwnd, id), enabled);
}
void
setItemChecked(HWND hwnd, bool checked)
{
SendMessage(hwnd, BM_SETCHECK, checked ? BST_CHECKED : BST_UNCHECKED, 0);
}
bool
isItemChecked(HWND hwnd)
{
return (SendMessage(hwnd, BM_GETCHECK, 0, 0) == BST_CHECKED);
}
CString
getAppPath(const CString& appName)
{
// prepare path to app
char myPathname[MAX_PATH];
GetModuleFileName(s_instance, myPathname, MAX_PATH);
const char* myBasename = ARCH->getBasename(myPathname);
CString appPath = CString(myPathname, myBasename - myPathname);
appPath += appName;
return appPath;
}
static
void
getFileTime(const CString& path, time_t& t)
{
struct _stat s;
if (_stat(path.c_str(), &s) != -1) {
t = s.st_mtime;
}
}
bool
isConfigNewer(time_t& oldTime, bool userConfig)
{
time_t newTime = oldTime;
if (userConfig) {
CString path = ARCH->getUserDirectory();
if (!path.empty()) {
path = ARCH->concatPath(path, CONFIG_NAME);
getFileTime(path, newTime);
}
}
else {
CString path = ARCH->getSystemDirectory();
if (!path.empty()) {
path = ARCH->concatPath(path, CONFIG_NAME);
getFileTime(path, newTime);
}
}
bool result = (newTime > oldTime);
oldTime = newTime;
return result;
}
static
bool
loadConfig(const CString& pathname, CConfig& config)
{
try {
std::ifstream stream(pathname.c_str());
if (stream) {
stream >> config;
return true;
}
}
catch (...) {
// ignore
}
return false;
}
bool
loadConfig(CConfig& config, time_t& t, bool& userConfig)
{
// load configuration
bool configLoaded = false;
CString path = ARCH->getUserDirectory();
if (!path.empty()) {
// try loading the user's configuration
path = ARCH->concatPath(path, CONFIG_NAME);
if (loadConfig(path, config)) {
configLoaded = true;
userConfig = true;
getFileTime(path, t);
}
else {
// try the system-wide config file
path = ARCH->getSystemDirectory();
if (!path.empty()) {
path = ARCH->concatPath(path, CONFIG_NAME);
if (loadConfig(path, config)) {
configLoaded = true;
userConfig = false;
getFileTime(path, t);
}
}
}
}
return configLoaded;
}
static
bool
saveConfig(const CString& pathname, const CConfig& config)
{
try {
std::ofstream stream(pathname.c_str());
if (stream) {
stream << config;
return !!stream;
}
}
catch (...) {
// ignore
}
return false;
}
bool
saveConfig(const CConfig& config, bool sysOnly, time_t& t)
{
// try saving the user's configuration
if (!sysOnly) {
CString path = ARCH->getUserDirectory();
if (!path.empty()) {
path = ARCH->concatPath(path, CONFIG_NAME);
if (saveConfig(path, config)) {
getFileTime(path, t);
return true;
}
}
}
// try the system-wide config file
else {
CString path = ARCH->getSystemDirectory();
if (!path.empty()) {
path = ARCH->concatPath(path, CONFIG_NAME);
if (saveConfig(path, config)) {
getFileTime(path, t);
return true;
}
}
}
return false;
}
const TCHAR* const*
getSettingsPath()
{
static const TCHAR* s_keyNames[] = {
TEXT("Software"),
TEXT("Synergy"),
TEXT("Synergy"),
NULL
};
return s_keyNames;
}

View File

@ -1,64 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#ifndef LAUNCHUTIL_H
#define LAUNCHUTIL_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#include <sys/types.h>
#include <sys/stat.h>
#define CLIENT_APP "synergyc.exe"
#define SERVER_APP "synergys.exe"
#define CONFIG_NAME "synergy.sgc"
class CConfig;
// client must define this and set it before calling any function here
extern HINSTANCE s_instance;
CString getString(DWORD id);
CString getErrorString(DWORD error);
void showError(HWND hwnd, const CString& msg);
void askOkay(HWND hwnd, const CString& title,
const CString& msg);
bool askVerify(HWND hwnd, const CString& msg);
bool isShowingDialog();
void setWindowText(HWND hwnd, const CString& msg);
CString getWindowText(HWND hwnd);
HWND getItem(HWND hwnd, int id);
void enableItem(HWND hwnd, int id, bool enabled);
void setItemChecked(HWND, bool);
bool isItemChecked(HWND);
CString getAppPath(const CString& appName);
bool isConfigNewer(time_t&, bool userConfig);
bool loadConfig(CConfig& config, time_t&, bool& userConfig);
bool saveConfig(const CConfig& config,
bool sysOnly, time_t&);
const TCHAR* const* getSettingsPath();
#endif

View File

@ -1,759 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* 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 COPYING 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 <http://www.gnu.org/licenses/>.
*/
#include "CConfig.h"
#include "KeyTypes.h"
#include "OptionTypes.h"
#include "ProtocolTypes.h"
#include "CLog.h"
#include "CStringUtil.h"
#include "CArch.h"
#include "CArchMiscWindows.h"
#include "XArch.h"
#include "Version.h"
#include "stdvector.h"
#include "resource.h"
// these must come after the above because it includes windows.h
#include "LaunchUtil.h"
#include "CAddScreen.h"
#include "CAdvancedOptions.h"
#include "CAutoStart.h"
#include "CGlobalOptions.h"
#include "CHotkeyOptions.h"
#include "CInfo.h"
#include "CScreensLinks.h"
typedef std::vector<CString> CStringList;
class CChildWaitInfo {
public:
HWND m_dialog;
HANDLE m_child;
DWORD m_childID;
HANDLE m_ready;
HANDLE m_stop;
};
static const char* s_debugName[][2] = {
{ TEXT("Error"), "ERROR" },
{ TEXT("Warning"), "WARNING" },
{ TEXT("Note"), "NOTE" },
{ TEXT("Info"), "INFO" },
{ TEXT("Debug"), "DEBUG" },
{ TEXT("Debug1"), "DEBUG1" },
{ TEXT("Debug2"), "DEBUG2" }
};
static const int s_defaultDebug = 1; // WARNING
static const int s_minTestDebug = 3; // INFO
HINSTANCE s_instance = NULL;
static CGlobalOptions* s_globalOptions = NULL;
static CAdvancedOptions* s_advancedOptions = NULL;
static CHotkeyOptions* s_hotkeyOptions = NULL;
static CScreensLinks* s_screensLinks = NULL;
static CInfo* s_info = NULL;
static bool s_userConfig = true;
static time_t s_configTime = 0;
static CConfig s_lastConfig;
static const TCHAR* s_mainClass = TEXT("GoSynergy");
static const TCHAR* s_layoutClass = TEXT("SynergyLayout");
enum SaveMode {
SAVE_QUITING,
SAVE_NORMAL,
SAVE_QUIET
};
//
// program arguments
//
#define ARG CArgs::s_instance
class CArgs {
public:
CArgs() { s_instance = this; }
~CArgs() { s_instance = NULL; }
public:
static CArgs* s_instance;
CConfig m_config;
CStringList m_screens;
};
CArgs* CArgs::s_instance = NULL;
static
BOOL CALLBACK
addDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
static
bool
isClientChecked(HWND hwnd)
{
HWND child = getItem(hwnd, IDC_MAIN_CLIENT_RADIO);
return isItemChecked(child);
}
static
void
enableMainWindowControls(HWND hwnd)
{
bool client = isClientChecked(hwnd);
enableItem(hwnd, IDC_MAIN_CLIENT_SERVER_NAME_LABEL, client);
enableItem(hwnd, IDC_MAIN_CLIENT_SERVER_NAME_EDIT, client);
enableItem(hwnd, IDC_MAIN_SERVER_SCREENS_LABEL, !client);
enableItem(hwnd, IDC_MAIN_SCREENS, !client);
enableItem(hwnd, IDC_MAIN_OPTIONS, !client);
enableItem(hwnd, IDC_MAIN_HOTKEYS, !client);
}
static
bool
execApp(const char* app, const CString& cmdLine, PROCESS_INFORMATION* procInfo)
{
// prepare startup info
STARTUPINFO startup;
startup.cb = sizeof(startup);
startup.lpReserved = NULL;
startup.lpDesktop = NULL;
startup.lpTitle = NULL;
startup.dwX = (DWORD)CW_USEDEFAULT;
startup.dwY = (DWORD)CW_USEDEFAULT;
startup.dwXSize = (DWORD)CW_USEDEFAULT;
startup.dwYSize = (DWORD)CW_USEDEFAULT;
startup.dwXCountChars = 0;
startup.dwYCountChars = 0;
startup.dwFillAttribute = 0;
startup.dwFlags = STARTF_FORCEONFEEDBACK;
startup.wShowWindow = SW_SHOWDEFAULT;
startup.cbReserved2 = 0;
startup.lpReserved2 = NULL;
startup.hStdInput = NULL;
startup.hStdOutput = NULL;
startup.hStdError = NULL;
// prepare path to app
CString appPath = getAppPath(app);
// put path to app in command line
CString commandLine = "\"";
commandLine += appPath;
commandLine += "\" ";
commandLine += cmdLine;
// start child
if (CreateProcess(NULL, (char*)commandLine.c_str(),
NULL,
NULL,
FALSE,
CREATE_DEFAULT_ERROR_MODE |
CREATE_NEW_PROCESS_GROUP |
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&startup,
procInfo) == 0) {
return false;
}
else {
return true;
}
}
static
CString
getCommandLine(HWND hwnd, bool testing, bool silent)
{
CString cmdLine;
// add constant testing args
if (testing) {
cmdLine += " -z --no-restart --no-daemon";
}
// can't start as service on NT
else if (!CArchMiscWindows::isWindows95Family()) {
cmdLine += " --no-daemon";
}
// get the server name
CString server;
bool isClient = isClientChecked(hwnd);
if (isClient) {
// check server name
HWND child = getItem(hwnd, IDC_MAIN_CLIENT_SERVER_NAME_EDIT);
server = getWindowText(child);
if (!ARG->m_config.isValidScreenName(server)) {
if (!silent) {
showError(hwnd, CStringUtil::format(
getString(IDS_INVALID_SERVER_NAME).c_str(),
server.c_str()));
}
SetFocus(child);
return CString();
}
// compare server name to local host. a common error
// is to provide the client's name for the server. we
// don't bother to check the addresses though that'd be
// more accurate.
if (CStringUtil::CaselessCmp::equal(ARCH->getHostName(), server)) {
if (!silent) {
showError(hwnd, CStringUtil::format(
getString(IDS_SERVER_IS_CLIENT).c_str(),
server.c_str()));
}
SetFocus(child);
return CString();
}
}
// debug level. always include this.
if (true) {
HWND child = getItem(hwnd, IDC_MAIN_DEBUG);
int debug = (int)SendMessage(child, CB_GETCURSEL, 0, 0);
// if testing then we force the debug level to be no less than
// s_minTestDebug. what's the point of testing if you can't
// see the debugging info?
if (testing && debug < s_minTestDebug) {
debug = s_minTestDebug;
}
cmdLine += " --debug ";
cmdLine += s_debugName[debug][1];
}
// add advanced options
cmdLine += s_advancedOptions->getCommandLine(isClient, server);
return cmdLine;
}
static
bool
launchApp(HWND hwnd, bool testing, HANDLE* thread, DWORD* threadID)
{
if (thread != NULL) {
*thread = NULL;
}
if (threadID != NULL) {
*threadID = 0;
}
// start daemon if it's installed and we're not testing
if (!testing && CAutoStart::startDaemon()) {
return true;
}
// decide if client or server
const bool isClient = isClientChecked(hwnd);
const char* app = isClient ? CLIENT_APP : SERVER_APP;
// prepare command line
CString cmdLine = getCommandLine(hwnd, testing, false);
if (cmdLine.empty()) {
return false;
}
// start child
PROCESS_INFORMATION procInfo;
if (!execApp(app, cmdLine, &procInfo)) {
showError(hwnd, CStringUtil::format(
getString(IDS_STARTUP_FAILED).c_str(),
getErrorString(GetLastError()).c_str()));
return false;
}
// don't need process handle
CloseHandle(procInfo.hProcess);
// save thread handle and thread ID if desired
if (thread != NULL) {
*thread = procInfo.hThread;
}
if (threadID != NULL) {
*threadID = procInfo.dwThreadId;
}
return true;
}
static
BOOL CALLBACK
waitDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// only one wait dialog at a time!
static CChildWaitInfo* info = NULL;
switch (message) {
case WM_INITDIALOG:
// save info pointer
info = reinterpret_cast<CChildWaitInfo*>(lParam);
// save hwnd
info->m_dialog = hwnd;
// signal ready
SetEvent(info->m_ready);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDCANCEL:
case IDOK:
// signal stop
SetEvent(info->m_stop);
// done
EndDialog(hwnd, 0);
return TRUE;
}
}
return FALSE;
}
static
DWORD WINAPI
waitForChildThread(LPVOID vinfo)
{
CChildWaitInfo* info = reinterpret_cast<CChildWaitInfo*>(vinfo);
// wait for ready
WaitForSingleObject(info->m_ready, INFINITE);
// wait for thread to complete or stop event
HANDLE handles[2];
handles[0] = info->m_child;
handles[1] = info->m_stop;
DWORD n = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
// if stop was raised then terminate child and wait for it
if (n == WAIT_OBJECT_0 + 1) {
PostThreadMessage(info->m_childID, WM_QUIT, 0, 0);
WaitForSingleObject(info->m_child, INFINITE);
}
// otherwise post IDOK to dialog box
else {
PostMessage(info->m_dialog, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);
}
return 0;
}
static
void
waitForChild(HWND hwnd, HANDLE thread, DWORD threadID)
{
// prepare info for child wait dialog and thread
CChildWaitInfo info;
info.m_dialog = NULL;
info.m_child = thread;
info.m_childID = threadID;
info.m_ready = CreateEvent(NULL, TRUE, FALSE, NULL);
info.m_stop = CreateEvent(NULL, TRUE, FALSE, NULL);
// create a thread to wait on the child thread and event
DWORD id;
HANDLE waiter = CreateThread(NULL, 0, &waitForChildThread, &info,0, &id);
// do dialog that let's the user terminate the test
DialogBoxParam(s_instance, MAKEINTRESOURCE(IDD_WAIT), hwnd,
(DLGPROC)waitDlgProc, (LPARAM)&info);
// force the waiter thread to finish and wait for it
SetEvent(info.m_ready);
SetEvent(info.m_stop);
WaitForSingleObject(waiter, INFINITE);
// clean up
CloseHandle(waiter);
CloseHandle(info.m_ready);
CloseHandle(info.m_stop);
}
static
void
initMainWindow(HWND hwnd)
{
// append version number to title
CString titleFormat = getString(IDS_TITLE);
setWindowText(hwnd, CStringUtil::format(titleFormat.c_str(), kApplication, kVersion));
// load configuration
bool configLoaded =
loadConfig(ARG->m_config, s_configTime, s_userConfig);
if (configLoaded) {
s_lastConfig = ARG->m_config;
}
// get settings from registry
bool isServer = configLoaded;
int debugLevel = s_defaultDebug;
CString server;
HKEY key = CArchMiscWindows::openKey(HKEY_CURRENT_USER, getSettingsPath());
if (key != NULL) {
if (isServer && CArchMiscWindows::hasValue(key, "isServer")) {
isServer = (CArchMiscWindows::readValueInt(key, "isServer") != 0);
}
if (CArchMiscWindows::hasValue(key, "debug")) {
debugLevel = static_cast<int>(
CArchMiscWindows::readValueInt(key, "debug"));
if (debugLevel < 0) {
debugLevel = 0;
}
else if (debugLevel > CLog::kDEBUG2) {
debugLevel = CLog::kDEBUG2;
}
}
server = CArchMiscWindows::readValueString(key, "server");
CArchMiscWindows::closeKey(key);
}
// choose client/server radio buttons
HWND child;
child = getItem(hwnd, IDC_MAIN_CLIENT_RADIO);
setItemChecked(child, !isServer);
child = getItem(hwnd, IDC_MAIN_SERVER_RADIO);
setItemChecked(child, isServer);
// set server name
child = getItem(hwnd, IDC_MAIN_CLIENT_SERVER_NAME_EDIT);
setWindowText(child, server);
// debug level
child = getItem(hwnd, IDC_MAIN_DEBUG);
for (unsigned int i = 0; i < sizeof(s_debugName) /
sizeof(s_debugName[0]); ++i) {
SendMessage(child, CB_ADDSTRING, 0, (LPARAM)s_debugName[i][0]);
}
SendMessage(child, CB_SETCURSEL, debugLevel, 0);
// update controls
enableMainWindowControls(hwnd);
}
static
bool
saveMainWindow(HWND hwnd, SaveMode mode, CString* cmdLineOut = NULL)
{
DWORD errorID = 0;
CString arg;
CString cmdLine;
// save dialog state
bool isClient = isClientChecked(hwnd);
HKEY key = CArchMiscWindows::addKey(HKEY_CURRENT_USER, getSettingsPath());
if (key != NULL) {
HWND child;
child = getItem(hwnd, IDC_MAIN_CLIENT_SERVER_NAME_EDIT);
CArchMiscWindows::setValue(key, "server", getWindowText(child));
child = getItem(hwnd, IDC_MAIN_DEBUG);
CArchMiscWindows::setValue(key, "debug",
(DWORD)SendMessage(child, CB_GETCURSEL, 0, 0));
CArchMiscWindows::setValue(key, "isServer", isClient ? 0 : 1);
CArchMiscWindows::closeKey(key);
}
// save user's configuration
if (!s_userConfig || ARG->m_config != s_lastConfig) {
time_t t;
if (!saveConfig(ARG->m_config, false, t)) {
errorID = IDS_SAVE_FAILED;
arg = getErrorString(GetLastError());
goto failed;
}
if (s_userConfig) {
s_configTime = t;
s_lastConfig = ARG->m_config;
}
}
// save autostart configuration
if (CAutoStart::isDaemonInstalled()) {
if (s_userConfig || ARG->m_config != s_lastConfig) {
time_t t;
if (!saveConfig(ARG->m_config, true, t)) {
errorID = IDS_AUTOSTART_SAVE_FAILED;
arg = getErrorString(GetLastError());
goto failed;
}
if (!s_userConfig) {
s_configTime = t;
s_lastConfig = ARG->m_config;
}
}
}
// get autostart command
cmdLine = getCommandLine(hwnd, false, mode == SAVE_QUITING);
if (cmdLineOut != NULL) {
*cmdLineOut = cmdLine;
}
if (cmdLine.empty()) {
return (mode == SAVE_QUITING);
}
// save autostart command
if (CAutoStart::isDaemonInstalled()) {
try {
CAutoStart::reinstallDaemon(isClient, cmdLine);
CAutoStart::uninstallDaemons(!isClient);
}
catch (XArchDaemon& e) {
errorID = IDS_INSTALL_GENERIC_ERROR;
arg = e.what();
goto failed;
}
}
return true;
failed:
CString errorMessage =
CStringUtil::format(getString(errorID).c_str(), arg.c_str());
if (mode == SAVE_QUITING) {
errorMessage += "\n";
errorMessage += getString(IDS_UNSAVED_DATA_REALLY_QUIT);
if (askVerify(hwnd, errorMessage)) {
return true;
}
}
else if (mode == SAVE_NORMAL) {
showError(hwnd, errorMessage);
}
return false;
}
static
LRESULT CALLBACK
mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_ACTIVATE:
if (LOWORD(wParam) != WA_INACTIVE) {
// activated
// see if the configuration changed
if (isConfigNewer(s_configTime, s_userConfig)) {
CString message2 = getString(IDS_CONFIG_CHANGED);
if (askVerify(hwnd, message2)) {
time_t configTime;
bool userConfig;
CConfig newConfig;
if (loadConfig(newConfig, configTime, userConfig) &&
userConfig == s_userConfig) {
ARG->m_config = newConfig;
s_lastConfig = ARG->m_config;
}
else {
message2 = getString(IDS_LOAD_FAILED);
showError(hwnd, message2);
s_lastConfig = CConfig();
}
}
}
}
else {
// deactivated; write configuration
if (!isShowingDialog()) {
saveMainWindow(hwnd, SAVE_QUIET);
}
}
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDCANCEL:
// save data
if (saveMainWindow(hwnd, SAVE_QUITING)) {
// quit
PostQuitMessage(0);
}
return 0;
case IDOK:
case IDC_MAIN_TEST: {
// note if testing
const bool testing = (LOWORD(wParam) == IDC_MAIN_TEST);
// save data
if (saveMainWindow(hwnd, SAVE_NORMAL)) {
// launch child app
DWORD threadID;
HANDLE thread;
if (!launchApp(hwnd, testing, &thread, &threadID)) {
return 0;
}
// handle child program
if (testing) {
// wait for process to stop, allowing the user to kill it
waitForChild(hwnd, thread, threadID);
// clean up
CloseHandle(thread);
}
else {
// don't need thread handle
if (thread != NULL) {
CloseHandle(thread);
}
// notify of success: now disabled - it's silly to notify a success
//askOkay(hwnd, getString(IDS_STARTED_TITLE), getString(IDS_STARTED));
// quit
PostQuitMessage(0);
}
}
return 0;
}
case IDC_MAIN_AUTOSTART: {
CString cmdLine;
if (saveMainWindow(hwnd, SAVE_NORMAL, &cmdLine)) {
// run dialog
CAutoStart autoStart(hwnd, !isClientChecked(hwnd), cmdLine);
autoStart.doModal();
}
return 0;
}
case IDC_MAIN_CLIENT_RADIO:
case IDC_MAIN_SERVER_RADIO:
enableMainWindowControls(hwnd);
return 0;
case IDC_MAIN_SCREENS:
s_screensLinks->doModal();
break;
case IDC_MAIN_OPTIONS:
s_globalOptions->doModal();
break;
case IDC_MAIN_ADVANCED:
s_advancedOptions->doModal(isClientChecked(hwnd));
break;
case IDC_MAIN_HOTKEYS:
s_hotkeyOptions->doModal();
break;
case IDC_MAIN_INFO:
s_info->doModal();
break;
}
default:
break;
}
return DefDlgProc(hwnd, message, wParam, lParam);
}
int WINAPI
WinMain(HINSTANCE instance, HINSTANCE, LPSTR cmdLine, int nCmdShow)
{
CArchMiscWindows::setInstanceWin32(instance);
CArch arch;
CLOG;
CArgs args;
s_instance = instance;
// if "/uninstall" is on the command line then just stop and
// uninstall the service and quit. this is the only option
// but we ignore any others.
if (CString(cmdLine).find("/uninstall") != CString::npos) {
CAutoStart::uninstallDaemons(false);
CAutoStart::uninstallDaemons(true);
return 0;
}
// register main window (dialog) class
WNDCLASSEX classInfo;
classInfo.cbSize = sizeof(classInfo);
classInfo.style = CS_HREDRAW | CS_VREDRAW;
classInfo.lpfnWndProc = &mainWndProc;
classInfo.cbClsExtra = 0;
classInfo.cbWndExtra = DLGWINDOWEXTRA;
classInfo.hInstance = instance;
classInfo.hIcon = (HICON)LoadImage(instance,
MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON,
32, 32, LR_SHARED);
classInfo.hCursor = LoadCursor(NULL, IDC_ARROW);
classInfo.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_3DFACE + 1);
classInfo.lpszMenuName = NULL;
classInfo.lpszClassName = s_mainClass;
classInfo.hIconSm = (HICON)LoadImage(instance,
MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON,
16, 16, LR_SHARED);
RegisterClassEx(&classInfo);
// create main window
HWND mainWindow = CreateDialog(s_instance,
MAKEINTRESOURCE(IDD_MAIN), 0, NULL);
// prep windows
initMainWindow(mainWindow);
s_globalOptions = new CGlobalOptions(mainWindow, &ARG->m_config);
s_advancedOptions = new CAdvancedOptions(mainWindow, &ARG->m_config);
s_hotkeyOptions = new CHotkeyOptions(mainWindow, &ARG->m_config);
s_screensLinks = new CScreensLinks(mainWindow, &ARG->m_config);
s_info = new CInfo(mainWindow);
// show window
ShowWindow(mainWindow, nCmdShow);
// main loop
MSG msg;
bool done = false;
do {
switch (GetMessage(&msg, NULL, 0, 0)) {
case -1:
// error
break;
case 0:
// quit
done = true;
break;
default:
if (!IsDialogMessage(mainWindow, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
break;
}
} while (!done);
return (int)msg.wParam;
}

View File

@ -1,626 +0,0 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <winresrc.h>
#if !defined(IDC_STATIC)
#define IDC_STATIC (-1)
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <winresrc.h>\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_MAIN DIALOG DISCARDABLE 32768, 0, 300, 199
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Synergy"
CLASS "GoSynergy"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Choose to share or use a shared keyboard and mouse, provide the requested information, then click Test to check your settings or Start to save your settings and start Synergy.",
IDC_STATIC,7,7,286,19
GROUPBOX "",IDC_STATIC,7,29,286,36
GROUPBOX "",IDC_STATIC,7,72,286,36
GROUPBOX "Options",IDC_STATIC,7,115,286,56
CONTROL "&Use another computer's shared keyboard and mouse (client)",
IDC_MAIN_CLIENT_RADIO,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,11,29,205,10
CONTROL "Share this computer's keyboard and mouse (server)",
IDC_MAIN_SERVER_RADIO,"Button",BS_AUTORADIOBUTTON,11,72,
177,10
LTEXT "Other Computer's &Host Name:",
IDC_MAIN_CLIENT_SERVER_NAME_LABEL,12,46,94,8
EDITTEXT IDC_MAIN_CLIENT_SERVER_NAME_EDIT,111,44,106,12,
ES_AUTOHSCROLL
LTEXT "&Screens && Links:",IDC_MAIN_SERVER_SCREENS_LABEL,12,89,
54,8
PUSHBUTTON "Configure...",IDC_MAIN_SCREENS,71,86,50,14
PUSHBUTTON "&Options...",IDC_MAIN_OPTIONS,12,129,50,14
PUSHBUTTON "Hot &Keys...",IDC_MAIN_HOTKEYS,68,129,50,14
PUSHBUTTON "Adva&nced...",IDC_MAIN_ADVANCED,124,129,50,14
PUSHBUTTON "&AutoStart...",IDC_MAIN_AUTOSTART,180,129,50,14
LTEXT "&Logging Level:",IDC_STATIC,12,154,48,8
COMBOBOX IDC_MAIN_DEBUG,68,151,61,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Info",IDC_MAIN_INFO,7,178,50,14
PUSHBUTTON "&Test",IDC_MAIN_TEST,131,179,50,14
DEFPUSHBUTTON "Start",IDOK,187,179,50,14
PUSHBUTTON "Quit",IDCANCEL,243,179,50,14
END
IDD_ADD DIALOG DISCARDABLE 0, 0, 192, 254
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Add Screen"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "&Screen Name:",IDC_STATIC,7,9,46,8
EDITTEXT IDC_ADD_SCREEN_NAME_EDIT,79,7,106,12,ES_AUTOHSCROLL
LTEXT "&Aliases:",IDC_STATIC,7,25,25,8
EDITTEXT IDC_ADD_ALIASES_EDIT,79,26,106,24,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
GROUPBOX "Options",IDC_STATIC,7,55,178,54
LTEXT "If your Caps, Num, or Scroll Lock keys behave strangely on this client screen then try turning the half-duplex options on and reconnect the client.",
IDC_STATIC,13,65,165,25
CONTROL "&Caps Lock",IDC_ADD_HD_CAPS_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,13,93,51,10
CONTROL "&Num Lock",IDC_ADD_HD_NUM_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,69,93,51,10
CONTROL "Sc&roll Lock",IDC_ADD_HD_SCROLL_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,125,93,51,10
GROUPBOX "Modifiers",IDC_STATIC,7,113,178,65
LTEXT "Shift",IDC_STATIC,13,129,15,8
COMBOBOX IDC_ADD_MOD_SHIFT,37,126,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Ctrl",IDC_STATIC,13,144,11,8
COMBOBOX IDC_ADD_MOD_CTRL,37,142,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Alt",IDC_STATIC,13,160,9,8
COMBOBOX IDC_ADD_MOD_ALT,37,158,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Meta",IDC_STATIC,101,128,17,8
COMBOBOX IDC_ADD_MOD_META,125,126,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Super",IDC_STATIC,101,144,20,8
COMBOBOX IDC_ADD_MOD_SUPER,125,142,48,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
GROUPBOX "Dead Corners",IDC_STATIC,7,183,178,43
LTEXT "Don't switch in these corners:",IDC_STATIC,14,198,52,18
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,68,193,47,28
CONTROL "",IDC_ADD_DC_TOP_LEFT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,76,197,16,8
CONTROL "",IDC_ADD_DC_TOP_RIGHT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,98,197,16,8
CONTROL "",IDC_ADD_DC_BOTTOM_LEFT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,76,210,16,8
CONTROL "",IDC_ADD_DC_BOTTOM_RIGHT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,98,210,16,8
LTEXT "Size",IDC_STATIC,120,202,14,8
EDITTEXT IDC_ADD_DC_SIZE,139,200,40,12,ES_AUTOHSCROLL | ES_NUMBER
DEFPUSHBUTTON "OK",IDOK,79,233,50,14
PUSHBUTTON "Cancel",IDCANCEL,135,233,50,14
END
IDD_WAIT DIALOG DISCARDABLE 0, 0, 186, 54
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Running Test..."
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Stop",IDOK,129,33,50,14
LTEXT "Running synergy. Press Stop to end the test.",
IDC_STATIC,7,7,172,15
END
IDD_AUTOSTART DIALOG DISCARDABLE 0, 0, 195, 189
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Auto Start"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Close",IDCANCEL,138,168,50,14
LTEXT "Synergy can be configured to start automatically when you log in. If you have sufficient access rights, you can instead configure synergy to start automatically when your computer starts.",
IDC_STATIC,7,7,181,33
LTEXT "You have sufficient access rights to install and uninstall Auto Start for all users or for just yourself.",
IDC_AUTOSTART_PERMISSION_MSG,7,69,181,17
LTEXT "Synergy is configured to start automatically when the system starts.",
IDC_AUTOSTART_INSTALLED_MSG,7,93,181,17
GROUPBOX "When &You Log In",IDC_STATIC,7,119,84,40
PUSHBUTTON "Install",IDC_AUTOSTART_INSTALL_USER,23,133,50,14
GROUPBOX "When &Computer Starts",IDC_STATIC,104,119,84,40
PUSHBUTTON "Install",IDC_AUTOSTART_INSTALL_SYSTEM,119,134,50,14
LTEXT "Synergy can be configured to start automatically when the computer starts or when you log in but not both.",
IDC_STATIC,7,43,181,17
END
IDD_GLOBAL_OPTIONS DIALOG DISCARDABLE 0, 0, 207, 354
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "It's easy to unintentionally switch screens when the pointer is near a screen's edge. Synergy can prevent switching until certain conditions are met to reduce unintentional switching.",
IDC_STATIC,7,7,191,26
LTEXT "Synergy can wait to switch until the cursor has been at a screen's edge for some amount of time.",
IDC_STATIC,7,37,193,16
CONTROL "Switch after waiting",IDC_GLOBAL_DELAY_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,59,77,10
EDITTEXT IDC_GLOBAL_DELAY_TIME,112,58,45,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "ms",IDC_STATIC,159,60,10,8
LTEXT "Synergy can switch only when the cursor hits a screen edge twice within some amount of time.",
IDC_STATIC,7,77,193,16
CONTROL "Switch on double tap within",IDC_GLOBAL_TWO_TAP_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,99,103,10
EDITTEXT IDC_GLOBAL_TWO_TAP_TIME,112,98,45,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "ms",IDC_STATIC,159,100,10,8
LTEXT "Synergy can be restricted to switch only if certain modifiers are pressed.",
IDC_STATIC,7,119,193,19
CONTROL "Check clients every",IDC_GLOBAL_HEARTBEAT_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,220,78,10
EDITTEXT IDC_GLOBAL_HEARTBEAT_TIME,112,219,45,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "ms",IDC_STATIC,159,221,10,8
LTEXT "Synergy can synchronize screen savers across all screens.",
IDC_STATIC,7,243,193,8
CONTROL "Synchronize screen savers",IDC_GLOBAL_SCREENSAVER_SYNC,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,259,101,10
LTEXT "Relative mouse moves on secondary screens.",IDC_STATIC,
7,280,193,8
CONTROL "Use relative mouse moves",IDC_GLOBAL_RELATIVE_MOVES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,296,99,10
CONTROL "Don't take foreground window on Windows servers",
IDC_GLOBAL_LEAVE_FOREGROUND,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,7,317,177,10
DEFPUSHBUTTON "OK",IDOK,94,333,50,14
PUSHBUTTON "Cancel",IDCANCEL,150,333,50,14
LTEXT "Synergy can periodically check that clients are still alive and connected. Use this only if synergy doesn't detect when clients disconnect.",
IDC_STATIC,7,189,193,24
CONTROL "Only switch when shift pressed.",IDC_GLOBAL_NEEDS_SHIFT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,143,115,10
CONTROL "Only switch when control pressed.",
IDC_GLOBAL_NEEDS_CONTROL,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,7,155,123,10
CONTROL "Only switch when alt pressed.",IDC_GLOBAL_NEEDS_ALT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,167,109,10
END
IDD_ADVANCED_OPTIONS DIALOG DISCARDABLE 0, 0, 230, 186
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Advanced Options"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Synergy normally uses this computer's name as its screen name. Enter another name here if you want to use a different screen name.",
IDC_STATIC,7,7,216,19
LTEXT "Screen &Name:",IDC_STATIC,7,34,46,8
EDITTEXT IDC_ADVANCED_NAME_EDIT,63,32,106,12,ES_AUTOHSCROLL
LTEXT "Synergy normally uses a particular network port number. Enter an alternative port here. (The server and all clients must use the same port number.)",
IDC_STATIC,7,56,216,26
LTEXT "&Port:",IDC_STATIC,7,90,16,8
EDITTEXT IDC_ADVANCED_PORT_EDIT,63,88,40,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "The server normally listens for client connections on all network interfaces. Enter the address of a particular interface to listen on just that interface.",
IDC_STATIC,7,110,216,26
LTEXT "&Interface:",IDC_STATIC,7,144,31,8
EDITTEXT IDC_ADVANCED_INTERFACE_EDIT,63,142,81,12,ES_AUTOHSCROLL
PUSHBUTTON "&Defaults",IDC_ADVANCED_DEFAULTS,7,165,50,14
DEFPUSHBUTTON "OK",IDOK,118,165,50,14
PUSHBUTTON "Cancel",IDCANCEL,173,165,50,14
END
IDD_SCREENS_LINKS DIALOG DISCARDABLE 0, 0, 354, 213
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Screens & Links"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "&Screens:",IDC_STATIC,7,7,29,8
LISTBOX IDC_SCREENS_SCREENS,7,18,100,36,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "+",IDC_SCREENS_ADD_SCREEN,7,57,17,14
PUSHBUTTON "-",IDC_SCREENS_REMOVE_SCREEN,28,57,17,14
PUSHBUTTON "Edit",IDC_SCREENS_EDIT_SCREEN,49,57,24,14
LTEXT "&Links:",IDC_STATIC,7,83,20,8
LISTBOX IDC_SCREENS_LINKS,7,94,339,59,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_SCREENS_SRC_START,7,156,16,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "to",IDC_STATIC,25,158,8,8
EDITTEXT IDC_SCREENS_SRC_END,33,156,16,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "% of the",IDC_STATIC,52,158,27,8
COMBOBOX IDC_SCREENS_SRC_SIDE,80,156,48,69,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "of",IDC_STATIC,129,158,8,8
COMBOBOX IDC_SCREENS_SRC_SCREEN,139,156,59,53,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "goes to",IDC_STATIC,200,158,24,8
EDITTEXT IDC_SCREENS_DST_START,225,156,16,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "to",IDC_STATIC,243,158,8,8
EDITTEXT IDC_SCREENS_DST_END,251,156,16,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "% of",IDC_STATIC,270,158,15,8
COMBOBOX IDC_SCREENS_DST_SCREEN,287,156,59,53,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "+",IDC_SCREENS_ADD_LINK,7,172,17,14
PUSHBUTTON "-",IDC_SCREENS_REMOVE_LINK,28,172,17,14
DEFPUSHBUTTON "OK",IDOK,241,192,50,14
PUSHBUTTON "Cancel",IDCANCEL,297,192,50,14
LTEXT "Source edge overlaps an existing edge.",
IDC_SCREENS_OVERLAP_ERROR,72,175,126,8,NOT WS_VISIBLE |
NOT WS_GROUP
END
IDD_INFO DIALOG DISCARDABLE 0, 0, 186, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Info"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Version:",IDC_STATIC,7,7,26,8
EDITTEXT IDC_INFO_VERSION,52,7,127,12,ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER
LTEXT "Hostname:",IDC_STATIC,7,19,35,8
EDITTEXT IDC_INFO_HOSTNAME,52,19,127,12,ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER
LTEXT "IP Address:",IDC_STATIC,7,31,37,8
EDITTEXT IDC_INFO_IP_ADDRESS,52,31,127,12,ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER
LTEXT "User Config:",IDC_STATIC,7,43,40,8
EDITTEXT IDC_INFO_USER_CONFIG,52,43,127,12,ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER
LTEXT "Sys Config:",IDC_STATIC,7,55,36,8
EDITTEXT IDC_INFO_SYS_CONFIG,52,55,127,12,ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER
DEFPUSHBUTTON "OK",IDOK,129,74,50,14
END
IDD_HOTKEY_OPTIONS DIALOG DISCARDABLE 0, 0, 360, 151
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Hot Keys"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "&Hot Keys:",IDC_STATIC,7,7,32,8
LISTBOX IDC_HOTKEY_HOTKEYS,7,18,169,88,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "+",IDC_HOTKEY_ADD_HOTKEY,7,109,17,14
PUSHBUTTON "-",IDC_HOTKEY_REMOVE_HOTKEY,28,109,17,14
PUSHBUTTON "Edit",IDC_HOTKEY_EDIT_HOTKEY,49,109,24,14
LTEXT "&Actions:",IDC_STATIC,183,7,26,8
LISTBOX IDC_HOTKEY_ACTIONS,183,18,169,88,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "+",IDC_HOTKEY_ADD_ACTION,183,109,17,14
PUSHBUTTON "-",IDC_HOTKEY_REMOVE_ACTION,204,109,17,14
PUSHBUTTON "Edit",IDC_HOTKEY_EDIT_ACTION,225,109,24,14
DEFPUSHBUTTON "OK",IDOK,302,130,50,14
END
IDD_HOTKEY_CONDITION DIALOG DISCARDABLE 0, 0, 183, 58
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Hot Key"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Enter &new hot key or mouse button:",IDC_STATIC,7,7,113,
8
EDITTEXT IDC_HOTKEY_CONDITION_HOTKEY,7,17,169,12,ES_WANTRETURN
DEFPUSHBUTTON "OK",IDOK,70,37,50,14
PUSHBUTTON "Cancel",IDCANCEL,126,37,50,14
END
IDD_HOTKEY_ACTION DIALOG DISCARDABLE 0, 0, 183, 218
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Action"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "&Action:",IDC_STATIC,7,7,23,8
CONTROL "Press:",IDC_HOTKEY_ACTION_DOWN,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,7,19,35,10
CONTROL "Release:",IDC_HOTKEY_ACTION_UP,"Button",
BS_AUTORADIOBUTTON,7,31,44,10
CONTROL "Press && Release:",IDC_HOTKEY_ACTION_DOWNUP,"Button",
BS_AUTORADIOBUTTON,7,43,69,10
CONTROL "Switch To Screen:",IDC_HOTKEY_ACTION_SWITCH_TO,"Button",
BS_AUTORADIOBUTTON,7,85,75,10
CONTROL "Switch In Direction:",IDC_HOTKEY_ACTION_SWITCH_IN,
"Button",BS_AUTORADIOBUTTON,7,101,77,10
CONTROL "Lock Cursor to Screen:",IDC_HOTKEY_ACTION_LOCK,"Button",
BS_AUTORADIOBUTTON,7,117,89,10
CONTROL "Keyboard broadcasting:",
IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST,"Button",
BS_AUTORADIOBUTTON,7,133,89,10
LTEXT "&Hot key or mouse button:",IDC_STATIC,7,55,80,8
EDITTEXT IDC_HOTKEY_ACTION_HOTKEY,7,67,152,12,ES_WANTRETURN
PUSHBUTTON "...",IDC_HOTKEY_ACTION_SCREENS,162,67,14,12
COMBOBOX IDC_HOTKEY_ACTION_SWITCH_TO_LIST,87,83,89,62,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_HOTKEY_ACTION_SWITCH_IN_LIST,106,99,70,66,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_HOTKEY_ACTION_LOCK_LIST,106,115,70,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_LIST,106,131,53,58,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_SCREENS,
162,131,14,12
LTEXT "Action takes place &when:",IDC_STATIC,7,153,81,8
CONTROL "Hot key is pressed",IDC_HOTKEY_ACTION_ON_ACTIVATE,
"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,165,74,10
CONTROL "Hot key is released",IDC_HOTKEY_ACTION_ON_DEACTIVATE,
"Button",BS_AUTORADIOBUTTON,7,177,76,10
DEFPUSHBUTTON "OK",IDOK,70,197,50,14
PUSHBUTTON "Cancel",IDCANCEL,126,197,50,14
END
IDD_HOTKEY_SCREENS DIALOG DISCARDABLE 0, 0, 237, 79
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Target Screens"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "&Available screens:",IDC_STATIC,7,7,58,8
LISTBOX IDC_HOTKEY_SCREENS_SRC,7,17,100,36,LBS_NOINTEGRALHEIGHT |
LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_HOTKEY_SCREENS_DST,130,17,100,36,
LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "-->",IDC_HOTKEY_SCREENS_ADD,109,21,17,14
PUSHBUTTON "<--",IDC_HOTKEY_SCREENS_REMOVE,109,38,17,14
DEFPUSHBUTTON "OK",IDOK,124,58,50,14
PUSHBUTTON "Cancel",IDCANCEL,180,58,50,14
LTEXT "&Send action to screens:",IDC_STATIC,130,7,76,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_MAIN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 293
TOPMARGIN, 7
BOTTOMMARGIN, 192
END
IDD_ADD, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 185
TOPMARGIN, 7
BOTTOMMARGIN, 247
END
IDD_WAIT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 47
END
IDD_AUTOSTART, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 188
TOPMARGIN, 7
BOTTOMMARGIN, 182
END
IDD_GLOBAL_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 200
TOPMARGIN, 7
BOTTOMMARGIN, 347
END
IDD_ADVANCED_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 223
TOPMARGIN, 7
BOTTOMMARGIN, 179
END
IDD_SCREENS_LINKS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 347
TOPMARGIN, 7
BOTTOMMARGIN, 206
END
IDD_INFO, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
IDD_HOTKEY_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 353
TOPMARGIN, 7
BOTTOMMARGIN, 144
END
IDD_HOTKEY_CONDITION, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 176
TOPMARGIN, 7
BOTTOMMARGIN, 51
END
IDD_HOTKEY_ACTION, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 176
TOPMARGIN, 7
BOTTOMMARGIN, 195
END
IDD_HOTKEY_SCREENS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 230
TOPMARGIN, 7
BOTTOMMARGIN, 72
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_SYNERGY ICON DISCARDABLE "synergy.ico"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ERROR "Error"
IDS_INVALID_SCREEN_NAME "Screen name `%{1}' is invalid."
IDS_DUPLICATE_SCREEN_NAME "The screen name `%{1}' is already being used."
IDS_SCREEN_NAME_IS_ALIAS "A name may not be an alias of itself."
IDS_VERIFY "Confirm"
IDS_UNSAVED_DATA_REALLY_QUIT "You have unsaved changes. Really quit?"
IDS_UNKNOWN_SCREEN_NAME "The screen name `%{1}' is not in the layout."
IDS_INVALID_PORT "The port `%{1}' is invalid. It must be between 1 and 65535 inclusive. %{2} is the standard port."
IDS_SAVE_FAILED "Failed to save configuration: %{1}"
IDS_STARTUP_FAILED "Failed to start synergy: %{1}"
IDS_STARTED_TITLE "Started"
IDS_STARTED "Synergy was successfully started. Use the task manager or tray icon to terminate it."
IDS_UNINSTALL_TITLE "Removed Auto-Start"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_AUTOSTART_PERMISSION_SYSTEM
"You have sufficient access rights to install and uninstall Auto Start for all users."
IDS_AUTOSTART_PERMISSION_USER
"You have sufficient access rights to install and uninstall Auto Start for just yourself."
IDS_AUTOSTART_PERMISSION_NONE
"You do not have sufficient access rights to install or uninstall Auto Start."
IDS_AUTOSTART_INSTALLED_SYSTEM
"Synergy is configured to start automatically when the system starts."
IDS_AUTOSTART_INSTALLED_USER
"Synergy is configured to start automatically when you log in."
IDS_AUTOSTART_INSTALLED_NONE
"Synergy is not configured to start automatically."
IDS_INSTALL_LABEL "Install"
IDS_UNINSTALL_LABEL "Uninstall"
IDS_INSTALL_GENERIC_ERROR "Install failed: %{1}"
IDS_UNINSTALL_GENERIC_ERROR "Uninstall failed: %{1}"
IDS_INSTALL_TITLE "Installed Auto-Start"
IDS_INSTALLED_SYSTEM "Installed auto-start. Synergy will automatically start each time you start your computer."
IDS_INSTALLED_USER "Installed auto-start. Synergy will automatically start each time you log in."
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_UNINSTALLED_SYSTEM "Removed auto-start. Synergy will not automatically start each time you start or reboot your computer."
IDS_UNINSTALLED_USER "Removed auto-start. Synergy will not automatically start each time you log in."
IDS_INVALID_SERVER_NAME "Server name `%{1}' is invalid."
IDS_TITLE "%{1} Version %{2}"
IDS_SERVER_IS_CLIENT "Please enter the name of the computer sharing a\nkeyboard and mouse, not the name of this computer,\nin the Other Computer's Host Name field."
IDS_ADD_SCREEN "Add Screen"
IDS_EDIT_SCREEN "Edit Screen %{1}"
IDS_ERROR_CODE "Error code: %{1}"
IDS_AUTOSTART_PERMISSION_ALL
"You have sufficient access rights to install and uninstall Auto Start for all users or for just yourself."
IDS_INVALID_INTERFACE_NAME "The interface '%{1}' is invalid: %{2}"
IDS_INVALID_CORNER_SIZE "The dead corner size %{1} is invalid; it must be 0 or higher."
IDS_NEW_LINK "[New Link]"
IDS_SIDE_LEFT "left of"
IDS_SIDE_RIGHT "right of"
IDS_SIDE_TOP "above"
IDS_SIDE_BOTTOM "below"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_LINK_FORMAT "%{4}%{5} is %{3} %{1}%{2}"
IDS_LINK_INTERVAL_FORMAT "(%{1},%{2})"
IDS_EDGE_LEFT "left"
IDS_EDGE_RIGHT "right"
IDS_EDGE_TOP "top"
IDS_EDGE_BOTTOM "bottom"
IDS_AUTOSTART_SAVE_FAILED "Failed to save autostart configuration: %{1}"
IDS_LOAD_FAILED "Failed to load configuration."
IDS_CONFIG_CHANGED "Configuration changed on disk. Reload?"
IDS_MODE_OFF "off"
IDS_MODE_ON "on"
IDS_MODE_TOGGLE "toggle"
IDS_ALL_SCREENS "All Screens"
IDS_ACTIVE_SCREEN "Active Screen"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,189 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by launcher.rc
//
#define IDS_ERROR 1
#define IDS_INVALID_SCREEN_NAME 2
#define IDS_DUPLICATE_SCREEN_NAME 3
#define IDS_SCREEN_NAME_IS_ALIAS 4
#define IDS_VERIFY 5
#define IDS_UNSAVED_DATA_REALLY_QUIT 6
#define IDS_UNKNOWN_SCREEN_NAME 7
#define IDS_INVALID_PORT 8
#define IDS_SAVE_FAILED 9
#define IDS_STARTUP_FAILED 10
#define IDS_STARTED_TITLE 11
#define IDS_STARTED 12
#define IDS_INSTALL_FAILED 13
#define IDS_UNINSTALL_TITLE 14
#define IDS_UNINSTALLED 15
#define IDS_UNINSTALL_FAILED 16
#define IDS_CLIENT 17
#define IDS_SERVER 18
#define IDS_AUTOSTART_PERMISSION_SYSTEM 19
#define IDS_AUTOSTART_PERMISSION_USER 20
#define IDS_AUTOSTART_PERMISSION_NONE 21
#define IDS_AUTOSTART_INSTALLED_SYSTEM 22
#define IDS_AUTOSTART_INSTALLED_USER 23
#define IDS_AUTOSTART_INSTALLED_NONE 24
#define IDS_INSTALL_LABEL 25
#define IDS_UNINSTALL_LABEL 26
#define IDS_INSTALL_GENERIC_ERROR 27
#define IDS_UNINSTALL_GENERIC_ERROR 28
#define IDS_INSTALL_TITLE 29
#define IDS_INSTALLED_SYSTEM 30
#define IDS_INSTALLED_USER 31
#define IDS_UNINSTALLED_SYSTEM 32
#define IDS_UNINSTALLED_USER 33
#define IDS_INVALID_SERVER_NAME 34
#define IDS_TITLE 35
#define IDS_SERVER_IS_CLIENT 36
#define IDS_ADD_SCREEN 37
#define IDS_EDIT_SCREEN 38
#define IDS_INVALID_TIME 39
#define IDS_ERROR_CODE 39
#define IDS_AUTOSTART_PERMISSION_ALL 40
#define IDS_INVALID_INTERFACE_NAME 41
#define IDS_INVALID_CORNER_SIZE 42
#define IDS_NEW_LINK 43
#define IDS_SIDE_LEFT 44
#define IDS_SIDE_RIGHT 45
#define IDS_SIDE_TOP 46
#define IDS_SIDE_BOTTOM 47
#define IDS_LINK_FORMAT 48
#define IDS_LINK_INTERVAL_FORMAT 49
#define IDS_EDGE_LEFT 50
#define IDS_EDGE_RIGHT 51
#define IDS_EDGE_TOP 52
#define IDS_EDGE_BOTTOM 53
#define IDS_AUTOSTART_SAVE_FAILED 54
#define IDS_LOAD_FAILED 55
#define IDS_CONFIG_CHANGED 56
#define IDS_MODE_OFF 57
#define IDS_MODE_ON 58
#define IDS_MODE_TOGGLE 59
#define IDS_ALL_SCREENS 60
#define IDS_ACTIVE_SCREEN 61
#define IDD_MAIN 101
#define IDD_ADD 102
#define IDD_WAIT 103
#define IDI_SYNERGY 104
#define IDD_AUTOSTART 105
#define IDD_ADVANCED_OPTIONS 106
#define IDD_GLOBAL_OPTIONS 107
#define IDD_SCREENS_LINKS 110
#define IDD_INFO 111
#define IDD_HOTKEY_OPTIONS 112
#define IDD_HOTKEY_CONDITION 113
#define IDD_HOTKEY_ACTION 114
#define IDD_HOTKEY_SCREENS 115
#define IDC_MAIN_CLIENT_RADIO 1000
#define IDC_MAIN_SERVER_RADIO 1001
#define IDC_MAIN_CLIENT_SERVER_NAME_LABEL 1002
#define IDC_MAIN_CLIENT_SERVER_NAME_EDIT 1003
#define IDC_MAIN_SERVER_SCREENS_LABEL 1004
#define IDC_MAIN_SCREENS 1005
#define IDC_MAIN_OPTIONS 1006
#define IDC_MAIN_ADVANCED 1007
#define IDC_MAIN_AUTOSTART 1008
#define IDC_MAIN_TEST 1009
#define IDC_MAIN_SAVE 1010
#define IDC_MAIN_HOTKEYS 1010
#define IDC_MAIN_DEBUG 1011
#define IDC_ADD_SCREEN_NAME_EDIT 1020
#define IDC_ADD_ALIASES_EDIT 1021
#define IDC_AUTOSTART_INSTALLED_MSG 1031
#define IDC_AUTOSTART_PERMISSION_MSG 1032
#define IDC_AUTOSTART_INSTALL_USER 1033
#define IDC_AUTOSTART_INSTALL_SYSTEM 1034
#define IDC_ADD_HD_CAPS_CHECK 1037
#define IDC_ADD_HD_NUM_CHECK 1038
#define IDC_ADVANCED_NAME_EDIT 1038
#define IDC_ADVANCED_PORT_EDIT 1039
#define IDC_ADD_HD_SCROLL_CHECK 1039
#define IDC_ADVANCED_INTERFACE_EDIT 1040
#define IDC_GLOBAL_DELAY_CHECK 1041
#define IDC_GLOBAL_DELAY_TIME 1042
#define IDC_GLOBAL_TWO_TAP_CHECK 1043
#define IDC_ADD_MOD_SHIFT 1043
#define IDC_GLOBAL_TWO_TAP_TIME 1044
#define IDC_ADD_MOD_CTRL 1044
#define IDC_ADD_MOD_ALT 1045
#define IDC_GLOBAL_HEARTBEAT_CHECK 1045
#define IDC_ADD_MOD_META 1046
#define IDC_GLOBAL_HEARTBEAT_TIME 1046
#define IDC_ADD_MOD_SUPER 1047
#define IDC_GLOBAL_SCREENSAVER_SYNC 1047
#define IDC_GLOBAL_RELATIVE_MOVES 1048
#define IDC_ADVANCED_DEFAULTS 1049
#define IDC_GLOBAL_LEAVE_FOREGROUND 1049
#define IDC_GLOBAL_NEEDS_SHIFT 1050
#define IDC_GLOBAL_NEEDS_CONTROL 1051
#define IDC_ADD_DC_SIZE 1052
#define IDC_GLOBAL_NEEDS_ALT 1052
#define IDC_ADD_DC_TOP_LEFT 1053
#define IDC_ADD_DC_TOP_RIGHT 1054
#define IDC_ADD_DC_BOTTOM_LEFT 1055
#define IDC_ADD_DC_BOTTOM_RIGHT 1056
#define IDC_SCREENS_SRC_SIDE 1057
#define IDC_SCREENS_SRC_START 1058
#define IDC_SCREENS_SRC_END 1059
#define IDC_SCREENS_SRC_SCREEN 1060
#define IDC_SCREENS_SCREENS 1061
#define IDC_SCREENS_ADD_SCREEN 1062
#define IDC_SCREENS_LINKS 1063
#define IDC_SCREENS_DST_START 1064
#define IDC_SCREENS_DST_END 1065
#define IDC_SCREENS_DST_SCREEN 1066
#define IDC_SCREENS_REMOVE_SCREEN 1067
#define IDC_SCREENS_EDIT_SCREEN 1068
#define IDC_SCREENS_ADD_LINK 1069
#define IDC_SCREENS_REMOVE_LINK 1070
#define IDC_SCREENS_OVERLAP_ERROR 1071
#define IDC_INFO_VERSION 1073
#define IDC_MAIN_INFO 1074
#define IDC_INFO_HOSTNAME 1076
#define IDC_HOTKEY_HOTKEYS 1076
#define IDC_INFO_IP_ADDRESS 1077
#define IDC_HOTKEY_ADD_HOTKEY 1077
#define IDC_INFO_USER_CONFIG 1078
#define IDC_HOTKEY_REMOVE_HOTKEY 1078
#define IDC_INFO_SYS_CONFIG 1079
#define IDC_HOTKEY_EDIT_HOTKEY 1079
#define IDC_HOTKEY_ACTIONS 1080
#define IDC_HOTKEY_CONDITION_HOTKEY 1080
#define IDC_HOTKEY_ACTION_DOWNUP 1081
#define IDC_HOTKEY_ADD_ACTION 1082
#define IDC_HOTKEY_ACTION_DOWN 1082
#define IDC_HOTKEY_REMOVE_ACTION 1083
#define IDC_HOTKEY_ACTION_UP 1083
#define IDC_HOTKEY_EDIT_ACTION 1084
#define IDC_HOTKEY_ACTION_HOTKEY 1085
#define IDC_HOTKEY_ACTION_SWITCH_TO_LIST 1086
#define IDC_HOTKEY_ACTION_SWITCH_TO 1087
#define IDC_HOTKEY_ACTION_SWITCH_IN 1088
#define IDC_HOTKEY_ACTION_LOCK 1089
#define IDC_HOTKEY_ACTION_SWITCH_IN_LIST 1090
#define IDC_HOTKEY_ACTION_LOCK_LIST 1091
#define IDC_HOTKEY_ACTION_ON_ACTIVATE 1092
#define IDC_HOTKEY_ACTION_ON_DEACTIVATE 1093
#define IDC_HOTKEY_ACTION_SCREENS 1094
#define IDC_HOTKEY_SCREENS_SRC 1095
#define IDC_HOTKEY_SCREENS_DST 1096
#define IDC_HOTKEY_SCREENS_ADD 1097
#define IDC_HOTKEY_SCREENS_REMOVE 1098
#define IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST 1099
#define IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_LIST 1100
#define IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_SCREENS 1101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 116
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1102
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 KiB

25
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,25 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2011 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# 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 COPYING 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 <http://www.gnu.org/licenses/>.
include_directories(
../tools/gtest
../tools/gtest/include)
add_library(gtest STATIC ../tools/gtest/src/gtest-all.cc)
add_subdirectory(lib)
add_subdirectory(cmd)
add_subdirectory(unittests)
add_subdirectory(integtests)

View File

@ -13,10 +13,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set(inc_gtest_dirs
${root_dir}/tools/gtest
${root_dir}/tools/gtest/include
)
include_directories(${inc_gtest_dirs})
add_library(gtest STATIC ${root_dir}/tools/gtest/src/gtest-all.cc)
add_subdirectory(synergyc)
add_subdirectory(synergys)

View File

@ -0,0 +1,56 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# 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 COPYING 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 <http://www.gnu.org/licenses/>.
set(src
synergyc.cpp
)
if (WIN32)
list(APPEND src
CMSWindowsClientTaskBarReceiver.cpp
CMSWindowsClientTaskBarReceiver.h
resource.h
synergyc.ico
synergyc.rc
tb_error.ico
tb_idle.ico
tb_run.ico
tb_wait.ico
)
elseif (APPLE)
list(APPEND src COSXClientTaskBarReceiver.cpp)
elseif (UNIX)
list(APPEND src CXWindowsClientTaskBarReceiver.cpp)
endif()
set(inc
../..
../../lib
../../lib/arch
../../lib/base
../../lib/client
../../lib/common
../../lib/io
../../lib/mt
../../lib/net
../../lib/platform
../../lib/synergy
)
include_directories(${inc})
add_executable(synergyc ${src})
target_link_libraries(synergyc
libarch libbase libclient libcommon libio libmt libnet libplatform
libserver libsynergy ${libs})

View File

Before

Width:  |  Height:  |  Size: 281 KiB

After

Width:  |  Height:  |  Size: 281 KiB

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

@ -0,0 +1,58 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
#
# 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 COPYING 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 <http://www.gnu.org/licenses/>.
set(src
synergys.cpp
)
if (WIN32)
list(APPEND src
CMSWindowsServerTaskBarReceiver.cpp
CMSWindowsServerTaskBarReceiver.h
resource.h
synergys.ico
synergys.rc
tb_error.ico
tb_idle.ico
tb_run.ico
tb_wait.ico
)
elseif (APPLE)
list(APPEND src_cmd_synergys
COSXServerTaskBarReceiver.cpp)
elseif (UNIX)
list(APPEND src
CXWindowsServerTaskBarReceiver.cpp)
endif()
set(inc
../..
../../lib
../../lib/arch
../../lib/base
../../lib/common
../../lib/io
../../lib/mt
../../lib/net
../../lib/platform
../../lib/synergy
../../lib/server
)
include_directories(${inc})
add_executable(synergys ${src})
target_link_libraries(synergys
libarch libbase libclient libcommon libio libmt libnet libplatform
libserver libsynergy ${libs})

View File

Before

Width:  |  Height:  |  Size: 281 KiB

After

Width:  |  Height:  |  Size: 281 KiB

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 283 B

View File

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 281 KiB

After

Width:  |  Height:  |  Size: 281 KiB

Some files were not shown because too many files have changed in this diff Show More