diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b687f47..3a5a7058 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 \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() \ No newline at end of file diff --git a/cmake/CMakeLists_config.txt b/cmake/CMakeLists_config.txt deleted file mode 100644 index 4fff9e0a..00000000 --- a/cmake/CMakeLists_config.txt +++ /dev/null @@ -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 . - -# 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 \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() diff --git a/cmake/CMakeLists_cpack.txt b/cmake/CMakeLists_cpack.txt deleted file mode 100644 index ad722836..00000000 --- a/cmake/CMakeLists_cpack.txt +++ /dev/null @@ -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 . - -# 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) diff --git a/cmake/CMakeLists_launcher.txt b/cmake/CMakeLists_launcher.txt deleted file mode 100644 index 9dc9d5d9..00000000 --- a/cmake/CMakeLists_launcher.txt +++ /dev/null @@ -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 . - -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() diff --git a/cmake/CMakeLists_lib.txt b/cmake/CMakeLists_lib.txt deleted file mode 100644 index 4bdeb904..00000000 --- a/cmake/CMakeLists_lib.txt +++ /dev/null @@ -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 . - -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() diff --git a/cmake/CMakeLists_synergyc.txt b/cmake/CMakeLists_synergyc.txt deleted file mode 100644 index 9ce94d52..00000000 --- a/cmake/CMakeLists_synergyc.txt +++ /dev/null @@ -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 . - -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}) diff --git a/cmake/CMakeLists_synergys.txt b/cmake/CMakeLists_synergys.txt deleted file mode 100644 index 87e465ab..00000000 --- a/cmake/CMakeLists_synergys.txt +++ /dev/null @@ -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 . - -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}) diff --git a/cmd/launcher/CAddScreen.cpp b/cmd/launcher/CAddScreen.cpp deleted file mode 100644 index 01494f08..00000000 --- a/cmd/launcher/CAddScreen.cpp +++ /dev/null @@ -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 . - */ - -#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( - 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; -} diff --git a/cmd/launcher/CAddScreen.h b/cmd/launcher/CAddScreen.h deleted file mode 100644 index 4ab19ed0..00000000 --- a/cmd/launcher/CAddScreen.h +++ /dev/null @@ -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 . - */ - -#ifndef CADDSCREEN_H -#define CADDSCREEN_H - -#include "CString.h" - -#define WINDOWS_LEAN_AND_MEAN -#include - -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 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 diff --git a/cmd/launcher/CAdvancedOptions.cpp b/cmd/launcher/CAdvancedOptions.cpp deleted file mode 100644 index ccb6b4ad..00000000 --- a/cmd/launcher/CAdvancedOptions.cpp +++ /dev/null @@ -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 . - */ - -#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(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); -} diff --git a/cmd/launcher/CAdvancedOptions.h b/cmd/launcher/CAdvancedOptions.h deleted file mode 100644 index 504fb733..00000000 --- a/cmd/launcher/CAdvancedOptions.h +++ /dev/null @@ -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 . - */ - -#ifndef CADVANCEDOPTIONS_H -#define CADVANCEDOPTIONS_H - -#include "CString.h" - -#define WINDOWS_LEAN_AND_MEAN -#include - -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 diff --git a/cmd/launcher/CAutoStart.cpp b/cmd/launcher/CAutoStart.cpp deleted file mode 100644 index e13521f3..00000000 --- a/cmd/launcher/CAutoStart.cpp +++ /dev/null @@ -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 . - */ - -#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); -} diff --git a/cmd/launcher/CAutoStart.h b/cmd/launcher/CAutoStart.h deleted file mode 100644 index fc192016..00000000 --- a/cmd/launcher/CAutoStart.h +++ /dev/null @@ -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 . - */ - -#ifndef CAUTOSTART_H -#define CAUTOSTART_H - -#include "CString.h" - -#define WINDOWS_LEAN_AND_MEAN -#include - -//! 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 diff --git a/cmd/launcher/CGlobalOptions.cpp b/cmd/launcher/CGlobalOptions.cpp deleted file mode 100644 index 2e007884..00000000 --- a/cmd/launcher/CGlobalOptions.cpp +++ /dev/null @@ -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 . - */ - -#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); -} diff --git a/cmd/launcher/CGlobalOptions.h b/cmd/launcher/CGlobalOptions.h deleted file mode 100644 index f1423353..00000000 --- a/cmd/launcher/CGlobalOptions.h +++ /dev/null @@ -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 . - */ - -#ifndef CGLOBALOPTIONS_H -#define CGLOBALOPTIONS_H - -#include "CString.h" - -#define WINDOWS_LEAN_AND_MEAN -#include - -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 diff --git a/cmd/launcher/CHotkeyOptions.cpp b/cmd/launcher/CHotkeyOptions.cpp deleted file mode 100644 index ea0c1f4c..00000000 --- a/cmd/launcher/CHotkeyOptions.cpp +++ /dev/null @@ -1,1955 +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 . - */ - -#include "CArchMiscWindows.h" -#include "CMSWindowsKeyState.h" -#include "CConfig.h" -#include "CHotkeyOptions.h" -#include "CStringUtil.h" -#include "CLog.h" -#include "LaunchUtil.h" -#include "resource.h" - -#if !defined(WM_XBUTTONDOWN) -#define WM_XBUTTONDOWN 0x020B -#define WM_XBUTTONUP 0x020C -#define WM_XBUTTONDBLCLK 0x020D -#define XBUTTON1 0x0001 -#define XBUTTON2 0x0002 -#endif - -// -// CAdvancedOptions -// - -CHotkeyOptions* CHotkeyOptions::s_singleton = NULL; - -CHotkeyOptions::CHotkeyOptions(HWND parent, CConfig* config) : - m_parent(parent), - m_config(config) -{ - assert(s_singleton == NULL); - s_singleton = this; -} - -CHotkeyOptions::~CHotkeyOptions() -{ - s_singleton = NULL; -} - -void -CHotkeyOptions::doModal() -{ - // do dialog - m_inputFilter = m_config->getInputFilter(); - DialogBoxParam(s_instance, MAKEINTRESOURCE(IDD_HOTKEY_OPTIONS), - m_parent, (DLGPROC)dlgProc, (LPARAM)this); -} - -void -CHotkeyOptions::doInit(HWND hwnd) -{ - m_activeRuleIndex = (UInt32)-1; - fillHotkeys(hwnd); - openRule(hwnd); -} - -void -CHotkeyOptions::fillHotkeys(HWND hwnd, UInt32 select) -{ - HWND rules = getItem(hwnd, IDC_HOTKEY_HOTKEYS); - - SendMessage(rules, LB_RESETCONTENT, 0, 0); - for (UInt32 i = 0, n = m_inputFilter->getNumRules(); i < n; ++i) { - CInputFilter::CRule& rule = m_inputFilter->getRule(i); - SendMessage(rules, LB_INSERTSTRING, (WPARAM)-1, - (LPARAM)rule.getCondition()->format().c_str()); - } - - if (select < m_inputFilter->getNumRules()) { - SendMessage(rules, LB_SETCURSEL, select, 0); - } - - updateHotkeysControls(hwnd); -} - -void -CHotkeyOptions::updateHotkeysControls(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_HOTKEYS); - bool selected = (SendMessage(child, LB_GETCURSEL, 0, 0) != LB_ERR); - - enableItem(hwnd, IDC_HOTKEY_ADD_HOTKEY, TRUE); - enableItem(hwnd, IDC_HOTKEY_EDIT_HOTKEY, selected); - enableItem(hwnd, IDC_HOTKEY_REMOVE_HOTKEY, selected); -} - -void -CHotkeyOptions::addHotkey(HWND hwnd) -{ - closeRule(hwnd); - CInputFilter::CCondition* condition = NULL; - if (editCondition(hwnd, condition)) { - m_inputFilter->addFilterRule(CInputFilter::CRule(condition)); - fillHotkeys(hwnd, m_inputFilter->getNumRules() - 1); - } - else { - delete condition; - } - openRule(hwnd); -} - -void -CHotkeyOptions::removeHotkey(HWND hwnd) -{ - UInt32 ruleIndex = m_activeRuleIndex; - closeRule(hwnd); - - m_inputFilter->removeFilterRule(ruleIndex); - UInt32 n = m_inputFilter->getNumRules(); - if (n > 0 && ruleIndex >= n) { - ruleIndex = n - 1; - } - fillHotkeys(hwnd, ruleIndex); - - openRule(hwnd); -} - -void -CHotkeyOptions::editHotkey(HWND hwnd) -{ - // save selected item in action list - HWND actions = getItem(hwnd, IDC_HOTKEY_ACTIONS); - LRESULT aIndex = SendMessage(actions, LB_GETCURSEL, 0, 0); - - UInt32 index = m_activeRuleIndex; - closeRule(hwnd); - - CInputFilter::CRule& rule = m_inputFilter->getRule(index); - CInputFilter::CCondition* condition = rule.getCondition()->clone(); - if (editCondition(hwnd, condition)) { - rule.setCondition(condition); - fillHotkeys(hwnd, index); - } - else { - delete condition; - } - - openRule(hwnd); - - // restore selected item in action list - if (aIndex != LB_ERR) { - SendMessage(actions, LB_SETCURSEL, aIndex, 0); - } -} - -void -CHotkeyOptions::fillActions(HWND hwnd, UInt32 select) -{ - HWND actions = getItem(hwnd, IDC_HOTKEY_ACTIONS); - SendMessage(actions, LB_RESETCONTENT, 0, 0); - if (m_activeRuleIndex != (UInt32)-1) { - UInt32 n = m_activeRule.getNumActions(true); - UInt32 n2 = m_activeRule.getNumActions(false); - for (UInt32 i = 0; i < n; ++i) { - const CInputFilter::CAction& action = - m_activeRule.getAction(true, i); - CString line("A "); - line += action.format(); - SendMessage(actions, LB_INSERTSTRING, (WPARAM)-1, - (LPARAM)line.c_str()); - SendMessage(actions, LB_SETITEMDATA, (WPARAM)i, (LPARAM)i); - } - for (UInt32 i = 0; i < n2; ++i) { - const CInputFilter::CAction& action = - m_activeRule.getAction(false, i); - CString line("D "); - line += action.format(); - SendMessage(actions, LB_INSERTSTRING, (WPARAM)-1, - (LPARAM)line.c_str()); - SendMessage(actions, LB_SETITEMDATA, (WPARAM)i + n, - (LPARAM)(i | 0x80000000u)); - } - - if (select < n + n2) { - SendMessage(actions, LB_SETCURSEL, select, 0); - } - } - - updateActionsControls(hwnd); -} - -void -CHotkeyOptions::updateActionsControls(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_HOTKEYS); - bool active = (m_activeRuleIndex != (UInt32)-1); - - child = getItem(hwnd, IDC_HOTKEY_ACTIONS); - bool selected = - (active && (SendMessage(child, LB_GETCURSEL, 0, 0) != LB_ERR)); - - enableItem(hwnd, IDC_HOTKEY_ADD_ACTION, active); - enableItem(hwnd, IDC_HOTKEY_EDIT_ACTION, selected); - enableItem(hwnd, IDC_HOTKEY_REMOVE_ACTION, selected); -} - -void -CHotkeyOptions::addAction(HWND hwnd) -{ - CInputFilter::CAction* action = NULL; - bool onActivate = true; - if (editAction(hwnd, action, onActivate)) { - m_activeRule.adoptAction(action, onActivate); - - UInt32 actionIndex = m_activeRule.getNumActions(true) - 1; - if (!onActivate) { - actionIndex += m_activeRule.getNumActions(false); - } - fillActions(hwnd, actionIndex); - } - else { - delete action; - } -} - -void -CHotkeyOptions::removeAction(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_ACTIONS); - LRESULT index = SendMessage(child, LB_GETCURSEL, 0, 0); - if (index != LB_ERR) { - UInt32 actionIndex = - (UInt32)SendMessage(child, LB_GETITEMDATA, index, 0); - bool onActivate = ((actionIndex & 0x80000000u) == 0); - actionIndex &= ~0x80000000u; - - m_activeRule.removeAction(onActivate, actionIndex); - - actionIndex = static_cast(index); - UInt32 n = m_activeRule.getNumActions(true) + - m_activeRule.getNumActions(false); - if (n > 0 && actionIndex >= n) { - actionIndex = n - 1; - } - fillActions(hwnd, actionIndex); - } -} - -void -CHotkeyOptions::editAction(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_ACTIONS); - LRESULT index = SendMessage(child, LB_GETCURSEL, 0, 0); - if (index != LB_ERR) { - UInt32 actionIndex = - (UInt32)SendMessage(child, LB_GETITEMDATA, index, 0); - bool onActivate = ((actionIndex & 0x80000000u) == 0); - actionIndex &= ~0x80000000u; - - CInputFilter::CAction* action = - m_activeRule.getAction(onActivate, actionIndex).clone(); - bool newOnActivate = onActivate; - if (editAction(hwnd, action, newOnActivate)) { - if (onActivate == newOnActivate) { - m_activeRule.replaceAction(action, onActivate, actionIndex); - actionIndex = static_cast(index); - } - else { - m_activeRule.removeAction(onActivate, actionIndex); - m_activeRule.adoptAction(action, newOnActivate); - actionIndex = m_activeRule.getNumActions(true) - 1; - if (!newOnActivate) { - actionIndex += m_activeRule.getNumActions(false); - } - } - fillActions(hwnd, actionIndex); - } - else { - delete action; - } - } -} - -bool -CHotkeyOptions::editCondition(HWND hwnd, CInputFilter::CCondition*& condition) -{ - return CConditionDialog::doModal(hwnd, condition); -} - -bool -CHotkeyOptions::editAction(HWND hwnd, CInputFilter::CAction*& action, - bool& onActivate) -{ - return CActionDialog::doModal(hwnd, m_config, action, onActivate); -} - -void -CHotkeyOptions::openRule(HWND hwnd) -{ - // get the active rule and copy it, merging down/up pairs of keystroke - // and mouse button actions into single actions for the convenience of - // of the user. - HWND rules = getItem(hwnd, IDC_HOTKEY_HOTKEYS); - LRESULT index = SendMessage(rules, LB_GETCURSEL, 0, 0); - if (index != LB_ERR) { - // copy the rule as is - m_activeRuleIndex = (SInt32)index; - m_activeRule = m_inputFilter->getRule(m_activeRuleIndex); - - // look for actions to combine - for (UInt32 i = 0, n = m_activeRule.getNumActions(true); i < n; ++i) { - // get next activate action - const CInputFilter::CAction* action = - &m_activeRule.getAction(true, i); - - // check if it's a key or mouse action - const CInputFilter::CKeystrokeAction* keyAction = - dynamic_cast(action); - const CInputFilter::CMouseButtonAction* mouseAction = - dynamic_cast(action); - if (keyAction == NULL && mouseAction == NULL) { - continue; - } - - // check for matching deactivate action - UInt32 j = (UInt32)-1; - CInputFilter::CAction* newAction = NULL; - if (keyAction != NULL) { - j = findMatchingAction(keyAction); - if (j != (UInt32)-1) { - // found a match - const IPlatformScreen::CKeyInfo* oldInfo = - keyAction->getInfo(); - IPlatformScreen::CKeyInfo* newInfo = - IKeyState::CKeyInfo::alloc(*oldInfo); - newAction = new CKeystrokeDownUpAction(newInfo); - } - } - else if (mouseAction != NULL) { - j = findMatchingAction(mouseAction); - if (j != (UInt32)-1) { - // found a match - const IPlatformScreen::CButtonInfo* oldInfo = - mouseAction->getInfo(); - IPlatformScreen::CButtonInfo* newInfo = - IPrimaryScreen::CButtonInfo::alloc(*oldInfo); - newAction = new CMouseButtonDownUpAction(newInfo); - } - } - - // perform merge - if (newAction != NULL) { - m_activeRule.replaceAction(newAction, true, i); - m_activeRule.removeAction(false, j); - } - } - } - else { - m_activeRuleIndex = (UInt32)-1; - } - fillActions(hwnd); -} - -void -CHotkeyOptions::closeRule(HWND) -{ - // copy rule back to input filter, expanding merged actions into the - // two component actions. - if (m_activeRuleIndex != (UInt32)-1) { - // expand merged rules - for (UInt32 i = 0, n = m_activeRule.getNumActions(true); i < n; ++i) { - // get action - const CInputFilter::CAction* action = - &m_activeRule.getAction(true, i); - - // check if it's a merged key or mouse action - const CKeystrokeDownUpAction* keyAction = - dynamic_cast(action); - const CMouseButtonDownUpAction* mouseAction = - dynamic_cast(action); - if (keyAction == NULL && mouseAction == NULL) { - continue; - } - - // expand - if (keyAction != NULL) { - const IPlatformScreen::CKeyInfo* oldInfo = - keyAction->getInfo(); - IPlatformScreen::CKeyInfo* newInfo = - IKeyState::CKeyInfo::alloc(*oldInfo); - CInputFilter::CKeystrokeAction* downAction = - new CInputFilter::CKeystrokeAction(newInfo, true); - newInfo = IKeyState::CKeyInfo::alloc(*oldInfo); - CInputFilter::CKeystrokeAction* upAction = - new CInputFilter::CKeystrokeAction(newInfo, false); - m_activeRule.replaceAction(downAction, true, i); - m_activeRule.adoptAction(upAction, false); - } - else if (mouseAction != NULL) { - const IPlatformScreen::CButtonInfo* oldInfo = - mouseAction->getInfo(); - IPlatformScreen::CButtonInfo* newInfo = - IPrimaryScreen::CButtonInfo::alloc(*oldInfo); - CInputFilter::CMouseButtonAction* downAction = - new CInputFilter::CMouseButtonAction(newInfo, true); - newInfo = IPrimaryScreen::CButtonInfo::alloc(*oldInfo); - CInputFilter::CMouseButtonAction* upAction = - new CInputFilter::CMouseButtonAction(newInfo, false); - m_activeRule.replaceAction(downAction, true, i); - m_activeRule.adoptAction(upAction, false); - } - } - - // copy it back - m_inputFilter->getRule(m_activeRuleIndex) = m_activeRule; - } - m_activeRuleIndex = (UInt32)-1; -} - -UInt32 -CHotkeyOptions::findMatchingAction( - const CInputFilter::CKeystrokeAction* src) const -{ - for (UInt32 i = 0, n = m_activeRule.getNumActions(false); i < n; ++i) { - const CInputFilter::CKeystrokeAction* dst = - dynamic_cast( - &m_activeRule.getAction(false, i)); - if (dst != NULL && - IKeyState::CKeyInfo::equal(src->getInfo(), dst->getInfo())) { - return i; - } - } - return (UInt32)-1; -} - -UInt32 -CHotkeyOptions::findMatchingAction( - const CInputFilter::CMouseButtonAction* src) const -{ - for (UInt32 i = 0, n = m_activeRule.getNumActions(false); i < n; ++i) { - const CInputFilter::CMouseButtonAction* dst = - dynamic_cast( - &m_activeRule.getAction(false, i)); - if (dst != NULL && - IPrimaryScreen::CButtonInfo::equal( - src->getInfo(), dst->getInfo())) { - return i; - } - } - return (UInt32)-1; -} - -BOOL -CHotkeyOptions::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: - case IDCANCEL: - closeRule(hwnd); - EndDialog(hwnd, 0); - return TRUE; - - case IDC_HOTKEY_HOTKEYS: - switch (HIWORD(wParam)) { - case LBN_DBLCLK: - editHotkey(hwnd); - return TRUE; - - case LBN_SELCHANGE: { - HWND rules = getItem(hwnd, IDC_HOTKEY_HOTKEYS); - LRESULT index = SendMessage(rules, LB_GETCURSEL, 0, 0); - if (m_activeRuleIndex != (UInt32)index) { - closeRule(hwnd); - updateHotkeysControls(hwnd); - openRule(hwnd); - } - return TRUE; - } - } - break; - - case IDC_HOTKEY_ADD_HOTKEY: - addHotkey(hwnd); - return TRUE; - - case IDC_HOTKEY_REMOVE_HOTKEY: - removeHotkey(hwnd); - return TRUE; - - case IDC_HOTKEY_EDIT_HOTKEY: - editHotkey(hwnd); - return TRUE; - - case IDC_HOTKEY_ACTIONS: - switch (HIWORD(wParam)) { - case LBN_DBLCLK: - editAction(hwnd); - return TRUE; - - case LBN_SELCHANGE: - updateActionsControls(hwnd); - return TRUE; - } - break; - - case IDC_HOTKEY_ADD_ACTION: - addAction(hwnd); - return TRUE; - - case IDC_HOTKEY_REMOVE_ACTION: - removeAction(hwnd); - return TRUE; - - case IDC_HOTKEY_EDIT_ACTION: - editAction(hwnd); - return TRUE; - } - break; - - default: - break; - } - - return FALSE; -} - -BOOL CALLBACK -CHotkeyOptions::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - return s_singleton->doDlgProc(hwnd, message, wParam, lParam); -} - - -// -// CHotkeyOptions::CConditionDialog -// - -CInputFilter::CCondition* - CHotkeyOptions::CConditionDialog::s_condition = NULL; -CInputFilter::CCondition* - CHotkeyOptions::CConditionDialog::s_lastGoodCondition = NULL; -WNDPROC CHotkeyOptions::CConditionDialog::s_editWndProc = NULL; - -bool -CHotkeyOptions::CConditionDialog::doModal(HWND parent, - CInputFilter::CCondition*& condition) -{ - s_condition = condition; - if (s_condition != NULL) { - s_lastGoodCondition = s_condition->clone(); - } - else { - s_lastGoodCondition = NULL; - } - int n = (int)DialogBox(s_instance, MAKEINTRESOURCE(IDD_HOTKEY_CONDITION), - parent, (DLGPROC) dlgProc); - - condition = s_condition; - delete s_lastGoodCondition; - s_condition = NULL; - s_lastGoodCondition = NULL; - - // user effectively cancelled if the condition is NULL - if (condition == NULL) { - n = 0; - } - - return (n == 1); -} - -void -CHotkeyOptions::CConditionDialog::doInit(HWND hwnd) -{ - // subclass edit control - HWND child = getItem(hwnd, IDC_HOTKEY_CONDITION_HOTKEY); - s_editWndProc = (WNDPROC)GetWindowLongPtr(child, GWLP_WNDPROC); - SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR) editProc); - - // fill control - fillHotkey(hwnd); -} - -void -CHotkeyOptions::CConditionDialog::fillHotkey(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_CONDITION_HOTKEY); - if (s_condition != NULL) { - setWindowText(child, s_condition->format().c_str()); - } - else { - setWindowText(child, ""); - } -} - -void -CHotkeyOptions::CConditionDialog::onButton(HWND hwnd, ButtonID button) -{ - delete s_condition; - s_condition = - new CInputFilter::CMouseButtonCondition(button, getModifiers()); - - fillHotkey(GetParent(hwnd)); -} - -void -CHotkeyOptions::CConditionDialog::onKey(HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - // ignore key repeats - if ((lParam & 0xc0000000u) == 0x40000000u) { - return; - } - - // ignore key releases if the condition is complete and for the tab - // key (in case we were just tabbed to) - if ((lParam & 0x80000000u) != 0) { - if (isGoodCondition() || wParam == VK_TAB) { - return; - } - } - - KeyID key = kKeyNone; - KeyModifierMask mask = getModifiers(); - switch (wParam) { - case VK_SHIFT: - case VK_LSHIFT: - case VK_RSHIFT: - case VK_CONTROL: - case VK_LCONTROL: - case VK_RCONTROL: - case VK_MENU: - case VK_LMENU: - case VK_RMENU: - case VK_LWIN: - case VK_RWIN: - break; - - case VK_TAB: - // allow tabbing out of control - if ((mask & (KeyModifierControl | - KeyModifierAlt | KeyModifierSuper)) == 0) { - HWND next = hwnd; - if ((mask & KeyModifierShift) == 0) { - do { - next = GetWindow(next, GW_HWNDNEXT); - if (next == NULL) { - next = GetWindow(hwnd, GW_HWNDFIRST); - } - } while (next != hwnd && - (!IsWindowVisible(next) || - (GetWindowLong(next, GWL_STYLE) & WS_TABSTOP) == 0)); - } - else { - do { - next = GetWindow(next, GW_HWNDPREV); - if (next == NULL) { - next = GetWindow(hwnd, GW_HWNDLAST); - } - } while (next != hwnd && - (!IsWindowVisible(next) || - (GetWindowLong(next, GWL_STYLE) & WS_TABSTOP) == 0)); - } - SetFocus(next); - return; - } - // fall through - - default: - key = CMSWindowsKeyState::getKeyID((UINT)wParam, - static_cast((lParam & 0x1ff0000u) >> 16)); - switch (key) { - case kKeyNone: - // could be a character - key = getChar(wParam, lParam); - if (key == kKeyNone) { - return; - } - break; - - case kKeyShift_L: - case kKeyShift_R: - case kKeyControl_L: - case kKeyControl_R: - case kKeyAlt_L: - case kKeyAlt_R: - case kKeyMeta_L: - case kKeyMeta_R: - case kKeySuper_L: - case kKeySuper_R: - case kKeyCapsLock: - case kKeyNumLock: - case kKeyScrollLock: - // bogus - return; - } - break; - } - - delete s_condition; - s_condition = new CInputFilter::CKeystrokeCondition(key, mask); - - fillHotkey(GetParent(hwnd)); -} - -KeyID -CHotkeyOptions::CConditionDialog::getChar(WPARAM wParam, LPARAM lParam) -{ - BYTE keyState[256]; - UINT virtualKey = (UINT)wParam; - UINT scanCode = (UINT)((lParam & 0x0ff0000u) >> 16); - if (!GetKeyboardState(keyState)) { - LOG((CLOG_WARN "GetKeyboardState failed on CHotkeyOptions::CConditionDialog::getChar")); - return kKeyNone; - } - - // reset modifier state - keyState[VK_SHIFT] = 0; - keyState[VK_LSHIFT] = 0; - keyState[VK_RSHIFT] = 0; - keyState[VK_CONTROL] = 0; - keyState[VK_LCONTROL] = 0; - keyState[VK_RCONTROL] = 0; - keyState[VK_MENU] = 0; - keyState[VK_LMENU] = 0; - keyState[VK_RMENU] = 0; - keyState[VK_LWIN] = 0; - keyState[VK_RWIN] = 0; - - // translate virtual key to character - int n; - KeyID id = kKeyNone; - if (CArchMiscWindows::isWindows95Family()) { - // XXX -- how do we get characters not in Latin-1? - WORD ascii; - n = ToAscii(virtualKey, scanCode, keyState, &ascii, 0); - id = static_cast(ascii & 0xffu); - } - else { - typedef int (WINAPI *ToUnicode_t)(UINT wVirtKey, - UINT wScanCode, - PBYTE lpKeyState, - LPWSTR pwszBuff, - int cchBuff, - UINT wFlags); - ToUnicode_t s_ToUnicode = NULL; - if (s_ToUnicode == NULL) { - HMODULE userModule = GetModuleHandle("user32.dll"); - if(userModule == NULL) { - LOG((CLOG_ERR "GetModuleHandle(\"user32.dll\") returned NULL")); - return kKeyNone; - } - s_ToUnicode = - (ToUnicode_t)GetProcAddress(userModule, "ToUnicode"); - } - - WCHAR unicode[2]; - n = s_ToUnicode(virtualKey, scanCode, keyState, - unicode, sizeof(unicode) / sizeof(unicode[0]), - 0); - id = static_cast(unicode[0]); - } - switch (n) { - case -1: - // no hot keys on dead keys - return kKeyNone; - - default: - case 0: - // unmapped - return kKeyNone; - - case 1: - return id; - } -} - -KeyModifierMask -CHotkeyOptions::CConditionDialog::getModifiers() -{ - KeyModifierMask mask = 0; - if ((GetKeyState(VK_SHIFT) & 0x8000) != 0) { - mask |= KeyModifierShift; - } - if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) { - mask |= KeyModifierControl; - } - if ((GetKeyState(VK_MENU) & 0x8000) != 0) { - mask |= KeyModifierAlt; - } - if ((GetKeyState(VK_LWIN) & 0x8000) != 0 || - (GetKeyState(VK_RWIN) & 0x8000) != 0) { - mask |= KeyModifierSuper; - } - return mask; -} - -bool -CHotkeyOptions::CConditionDialog::isGoodCondition() -{ - CInputFilter::CKeystrokeCondition* keyCondition = - dynamic_cast(s_condition); - return (keyCondition == NULL || keyCondition->getKey() != kKeyNone); -} - -BOOL CALLBACK -CHotkeyOptions::CConditionDialog::dlgProc(HWND hwnd, - UINT message, WPARAM wParam, LPARAM) -{ - switch (message) { - case WM_INITDIALOG: - doInit(hwnd); - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - EndDialog(hwnd, 1); - return TRUE; - - case IDCANCEL: - EndDialog(hwnd, 0); - return TRUE; - } - break; - - default: - break; - } - - return FALSE; -} - -LRESULT CALLBACK -CHotkeyOptions::CConditionDialog::editProc(HWND hwnd, - UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) { - case WM_LBUTTONDOWN: - if (GetFocus() == hwnd) { - onButton(hwnd, kButtonLeft); - } - else { - SetFocus(hwnd); - } - return 0; - - case WM_MBUTTONDOWN: - if (GetFocus() == hwnd) { - onButton(hwnd, kButtonMiddle); - } - return 0; - - case WM_RBUTTONDOWN: - if (GetFocus() == hwnd) { - onButton(hwnd, kButtonRight); - } - return 0; - - case WM_XBUTTONDOWN: - if (GetFocus() == hwnd) { - switch (HIWORD(wParam)) { - case XBUTTON1: - onButton(hwnd, kButtonExtra0 + 0); - break; - - case XBUTTON2: - onButton(hwnd, kButtonExtra0 + 1); - break; - } - } - return 0; - - case WM_KEYDOWN: - case WM_SYSKEYDOWN: - case WM_KEYUP: - case WM_SYSKEYUP: - onKey(hwnd, wParam, lParam); - return 0; - - case WM_LBUTTONUP: - case WM_MBUTTONUP: - case WM_RBUTTONUP: - case WM_XBUTTONUP: - case WM_CHAR: - case WM_SYSCHAR: - case WM_DEADCHAR: - case WM_SYSDEADCHAR: - return 0; - - case WM_SETFOCUS: - if (s_condition != NULL) { - delete s_lastGoodCondition; - s_lastGoodCondition = s_condition->clone(); - } - break; - - case WM_KILLFOCUS: - if (!isGoodCondition()) { - delete s_condition; - if (s_lastGoodCondition != NULL) { - s_condition = s_lastGoodCondition->clone(); - } - else { - s_condition = NULL; - } - } - fillHotkey(GetParent(hwnd)); - break; - - case WM_GETDLGCODE: - return DLGC_WANTALLKEYS; - - default: - break; - } - return CallWindowProc(s_editWndProc, hwnd, message, wParam, lParam); -} - - -// -// CHotkeyOptions::CActionDialog -// - -CConfig* CHotkeyOptions::CActionDialog::s_config = NULL; -bool CHotkeyOptions::CActionDialog::s_onActivate = false; -CInputFilter::CAction* - CHotkeyOptions::CActionDialog::s_action = NULL; -CInputFilter::CAction* - CHotkeyOptions::CActionDialog::s_lastGoodAction = NULL; -std::set - CHotkeyOptions::CActionDialog::s_screens; -WNDPROC CHotkeyOptions::CActionDialog::s_editWndProc = NULL; - -bool -CHotkeyOptions::CActionDialog::doModal(HWND parent, CConfig* config, - CInputFilter::CAction*& action, bool& onActivate) -{ - s_config = config; - s_onActivate = onActivate; - s_action = action; - if (s_action != NULL) { - s_lastGoodAction = s_action->clone(); - } - else { - s_lastGoodAction = NULL; - } - - int n = (int)DialogBox(s_instance, MAKEINTRESOURCE(IDD_HOTKEY_ACTION), - parent, (DLGPROC) dlgProc); - - onActivate = s_onActivate; - action = s_action; - delete s_lastGoodAction; - s_action = NULL; - s_lastGoodAction = NULL; - - return (n == 1); -} - -void -CHotkeyOptions::CActionDialog::doInit(HWND hwnd) -{ - // subclass edit control - HWND child = getItem(hwnd, IDC_HOTKEY_ACTION_HOTKEY); - s_editWndProc = (WNDPROC)GetWindowLongPtr(child, GWLP_WNDPROC); - SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR)editProc); - setWindowText(getItem(hwnd, IDC_HOTKEY_ACTION_HOTKEY), ""); - fillHotkey(hwnd); - - // fill screens - child = getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_TO_LIST); - SendMessage(child, CB_RESETCONTENT, 0, 0); - for (CConfig::const_iterator index = s_config->begin(); - index != s_config->end(); ) { - const CString& name = *index; - ++index; - if (index != s_config->end()) { - SendMessage(child, CB_INSERTSTRING, - (WPARAM)-1, (LPARAM)name.c_str()); - } - else { - SendMessage(child, CB_ADDSTRING, 0, (LPARAM)name.c_str()); - } - } - SendMessage(child, CB_SETCURSEL, 0, 0); - - // fill directions - child = getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_IN_LIST); - 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()); - SendMessage(child, CB_SETCURSEL, 0, 0); - - // fill lock modes - child = getItem(hwnd, IDC_HOTKEY_ACTION_LOCK_LIST); - SendMessage(child, CB_ADDSTRING, 0, - (LPARAM)getString(IDS_MODE_OFF).c_str()); - SendMessage(child, CB_ADDSTRING, 0, - (LPARAM)getString(IDS_MODE_ON).c_str()); - SendMessage(child, CB_ADDSTRING, 0, - (LPARAM)getString(IDS_MODE_TOGGLE).c_str()); - SendMessage(child, CB_SETCURSEL, 0, 0); - - // fill keyboard broadcast modes - child = getItem(hwnd, IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_LIST); - SendMessage(child, CB_ADDSTRING, 0, - (LPARAM)getString(IDS_MODE_OFF).c_str()); - SendMessage(child, CB_ADDSTRING, 0, - (LPARAM)getString(IDS_MODE_ON).c_str()); - SendMessage(child, CB_ADDSTRING, 0, - (LPARAM)getString(IDS_MODE_TOGGLE).c_str()); - SendMessage(child, CB_SETCURSEL, 0, 0); - - // select when - if (s_onActivate) { - child = getItem(hwnd, IDC_HOTKEY_ACTION_ON_ACTIVATE); - } - else { - child = getItem(hwnd, IDC_HOTKEY_ACTION_ON_DEACTIVATE); - } - setItemChecked(child, true); - - // no screens by default - s_screens.clear(); - - // select mode - child = NULL; - CInputFilter::CKeystrokeAction* keyAction = - dynamic_cast(s_action); - CInputFilter::CMouseButtonAction* mouseAction = - dynamic_cast(s_action); - CInputFilter::CLockCursorToScreenAction* lockAction = - dynamic_cast(s_action); - CInputFilter::CSwitchToScreenAction* switchToAction = - dynamic_cast(s_action); - CInputFilter::CSwitchInDirectionAction* switchInAction = - dynamic_cast(s_action); - CInputFilter::CKeyboardBroadcastAction* keyboardBroadcastAction= - dynamic_cast(s_action); - if (keyAction != NULL) { - if (dynamic_cast(s_action) != NULL) { - child = getItem(hwnd, IDC_HOTKEY_ACTION_DOWNUP); - } - else if (keyAction->isOnPress()) { - child = getItem(hwnd, IDC_HOTKEY_ACTION_DOWN); - } - else { - child = getItem(hwnd, IDC_HOTKEY_ACTION_UP); - } - } - else if (mouseAction != NULL) { - if (dynamic_cast(s_action) != NULL) { - child = getItem(hwnd, IDC_HOTKEY_ACTION_DOWNUP); - } - else if (keyAction->isOnPress()) { - child = getItem(hwnd, IDC_HOTKEY_ACTION_DOWN); - } - else { - child = getItem(hwnd, IDC_HOTKEY_ACTION_UP); - } - } - else if (lockAction != NULL) { - child = getItem(hwnd, IDC_HOTKEY_ACTION_LOCK_LIST); - SendMessage(child, CB_SETCURSEL, lockAction->getMode(), 0); - child = getItem(hwnd, IDC_HOTKEY_ACTION_LOCK); - } - else if (switchToAction != NULL) { - child = getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_TO_LIST); - DWORD i = (DWORD)SendMessage(child, CB_FINDSTRINGEXACT, (WPARAM)-1, - (LPARAM)switchToAction->getScreen().c_str()); - if (i == CB_ERR) { - i = 0; - } - SendMessage(child, CB_SETCURSEL, i, 0); - child = getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_TO); - } - else if (switchInAction != NULL) { - child = getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_IN_LIST); - SendMessage(child, CB_SETCURSEL, - switchInAction->getDirection() - kLeft, 0); - child = getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_IN); - } - else if (keyboardBroadcastAction != NULL) { - // Save the screens we're broadcasting to - s_screens = keyboardBroadcastAction->getScreens(); - - child = getItem(hwnd, IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_LIST); - SendMessage(child, CB_SETCURSEL, keyboardBroadcastAction->getMode(), 0); - child = getItem(hwnd, IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST); - } - if (child != NULL) { - setItemChecked(child, true); - } - - updateControls(hwnd); -} - -void -CHotkeyOptions::CActionDialog::fillHotkey(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_ACTION_HOTKEY); - CInputFilter::CKeystrokeAction* keyAction = - dynamic_cast(s_action); - CInputFilter::CMouseButtonAction* mouseAction = - dynamic_cast(s_action); - if (keyAction != NULL || mouseAction != NULL) { - setWindowText(child, s_action->format().c_str()); - } - else { - setWindowText(child, ""); - } - - // can only set screens in key actions - enableItem(hwnd, IDC_HOTKEY_ACTION_SCREENS, keyAction != NULL); -} - -void -CHotkeyOptions::CActionDialog::updateControls(HWND hwnd) -{ - // determine which mode we're in - UInt32 mode = 0; - if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_DOWNUP)) || - isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_DOWN)) || - isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_UP))) { - mode = 1; - } - else if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_TO))) { - mode = 2; - } - else if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_IN))) { - mode = 3; - } - else if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_LOCK))) { - mode = 4; - } - else if (isItemChecked(getItem(hwnd, - IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST))) { - mode = 5; - } - - // enable/disable all mode specific controls - enableItem(hwnd, IDC_HOTKEY_ACTION_HOTKEY, mode == 1); - enableItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_TO_LIST, mode == 2); - enableItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_IN_LIST, mode == 3); - enableItem(hwnd, IDC_HOTKEY_ACTION_LOCK_LIST, mode == 4); - enableItem(hwnd, IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_LIST, mode == 5); - enableItem(hwnd, IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_SCREENS, mode == 5); - - // can only set screens in key actions - CInputFilter::CKeystrokeAction* keyAction = - dynamic_cast(s_action); - enableItem(hwnd, IDC_HOTKEY_ACTION_SCREENS, keyAction != NULL); -} - -void -CHotkeyOptions::CActionDialog::onButton(HWND hwnd, ButtonID button) -{ - IPlatformScreen::CButtonInfo* info = - IPrimaryScreen::CButtonInfo::alloc(button, getModifiers()); - delete s_action; - HWND parent = GetParent(hwnd); - if (isItemChecked(getItem(parent, IDC_HOTKEY_ACTION_DOWNUP))) { - s_action = new CMouseButtonDownUpAction(info); - } - else if (isItemChecked(getItem(parent, IDC_HOTKEY_ACTION_DOWN))) { - s_action = new CInputFilter::CMouseButtonAction(info, true); - } - else if (isItemChecked(getItem(parent, IDC_HOTKEY_ACTION_UP))) { - s_action = new CInputFilter::CMouseButtonAction(info, false); - } - else { - s_action = NULL; - } - - fillHotkey(parent); -} - -void -CHotkeyOptions::CActionDialog::onKey(HWND hwnd, WPARAM wParam, LPARAM lParam) -{ - // ignore key repeats - if ((lParam & 0xc0000000u) == 0x40000000u) { - return; - } - - // ignore key releases if the action is complete and for the tab - // key (in case we were just tabbed to) - if ((lParam & 0x80000000u) != 0) { - if (isGoodAction() || wParam == VK_TAB) { - return; - } - } - - KeyID key = kKeyNone; - KeyModifierMask mask = getModifiers(); - switch (wParam) { - case VK_SHIFT: - case VK_LSHIFT: - case VK_RSHIFT: - case VK_CONTROL: - case VK_LCONTROL: - case VK_RCONTROL: - case VK_MENU: - case VK_LMENU: - case VK_RMENU: - case VK_LWIN: - case VK_RWIN: - break; - - case VK_TAB: - // allow tabbing out of control - if ((mask & (KeyModifierControl | - KeyModifierAlt | KeyModifierSuper)) == 0) { - HWND next = hwnd; - if ((mask & KeyModifierShift) == 0) { - do { - next = GetWindow(next, GW_HWNDNEXT); - if (next == NULL) { - next = GetWindow(hwnd, GW_HWNDFIRST); - } - } while (next != hwnd && - (!IsWindowVisible(next) || - (GetWindowLong(next, GWL_STYLE) & WS_TABSTOP) == 0)); - } - else { - do { - next = GetWindow(next, GW_HWNDPREV); - if (next == NULL) { - next = GetWindow(hwnd, GW_HWNDLAST); - } - } while (next != hwnd && - (!IsWindowVisible(next) || - (GetWindowLong(next, GWL_STYLE) & WS_TABSTOP) == 0)); - } - SetFocus(next); - return; - } - // fall through - - default: - key = CMSWindowsKeyState::getKeyID((UINT)wParam, - static_cast((lParam & 0x1ff0000u) >> 16)); - switch (key) { - case kKeyNone: - // could be a character - key = getChar(wParam, lParam); - if (key == kKeyNone) { - return; - } - break; - - case kKeyShift_L: - case kKeyShift_R: - case kKeyControl_L: - case kKeyControl_R: - case kKeyAlt_L: - case kKeyAlt_R: - case kKeyMeta_L: - case kKeyMeta_R: - case kKeySuper_L: - case kKeySuper_R: - case kKeyCapsLock: - case kKeyNumLock: - case kKeyScrollLock: - // bogus - return; - } - break; - } - - // get old screen list - std::set screens; - CInputFilter::CKeystrokeAction* keyAction = - dynamic_cast(s_action); - if (keyAction == NULL) { - keyAction = - dynamic_cast(s_lastGoodAction); - } - if (keyAction != NULL) { - IKeyState::CKeyInfo::split(keyAction->getInfo()->m_screens, screens); - } - - // create new action - IPlatformScreen::CKeyInfo* info = - IKeyState::CKeyInfo::alloc(key, mask, 0, 0, screens); - delete s_action; - HWND parent = GetParent(hwnd); - if (isItemChecked(getItem(parent, IDC_HOTKEY_ACTION_DOWNUP))) { - s_action = new CKeystrokeDownUpAction(info); - } - else if (isItemChecked(getItem(parent, IDC_HOTKEY_ACTION_DOWN))) { - s_action = new CInputFilter::CKeystrokeAction(info, true); - } - else if (isItemChecked(getItem(parent, IDC_HOTKEY_ACTION_UP))) { - s_action = new CInputFilter::CKeystrokeAction(info, false); - } - else { - s_action = NULL; - } - - fillHotkey(parent); -} - -void -CHotkeyOptions::CActionDialog::onLockAction(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_ACTION_LOCK_LIST); - LRESULT index = SendMessage(child, CB_GETCURSEL, 0, 0); - if (index != CB_ERR) { - delete s_action; - s_action = new CInputFilter::CLockCursorToScreenAction( - (CInputFilter::CLockCursorToScreenAction::Mode)index); - } -} - -void -CHotkeyOptions::CActionDialog::onSwitchToAction(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_TO_LIST); - CString screen = getWindowText(child); - delete s_action; - s_action = new CInputFilter::CSwitchToScreenAction(screen); -} - -void -CHotkeyOptions::CActionDialog::onSwitchInAction(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_ACTION_SWITCH_IN_LIST); - LRESULT index = SendMessage(child, CB_GETCURSEL, 0, 0); - if (index != CB_ERR) { - delete s_action; - s_action = new CInputFilter::CSwitchInDirectionAction( - (EDirection)(index + kLeft)); - } -} - -void -CHotkeyOptions::CActionDialog::onKeyboardBroadcastAction(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_LIST); - LRESULT index = SendMessage(child, CB_GETCURSEL, 0, 0); - if (index != CB_ERR) { - delete s_action; - s_action = new CInputFilter::CKeyboardBroadcastAction( - (CInputFilter::CKeyboardBroadcastAction::Mode)index, s_screens); - } -} - -KeyID -CHotkeyOptions::CActionDialog::getChar(WPARAM wParam, LPARAM lParam) -{ - BYTE keyState[256]; - UINT virtualKey = (UINT)wParam; - UINT scanCode = (UINT)((lParam & 0x0ff0000u) >> 16); - if (!GetKeyboardState(keyState)) { - LOG((CLOG_WARN "GetKeyboardState failed on CHotkeyOptions::CActionDialog::getChar")); - return kKeyNone; - } - // reset modifier state - keyState[VK_SHIFT] = 0; - keyState[VK_LSHIFT] = 0; - keyState[VK_RSHIFT] = 0; - keyState[VK_CONTROL] = 0; - keyState[VK_LCONTROL] = 0; - keyState[VK_RCONTROL] = 0; - keyState[VK_MENU] = 0; - keyState[VK_LMENU] = 0; - keyState[VK_RMENU] = 0; - keyState[VK_LWIN] = 0; - keyState[VK_RWIN] = 0; - - // translate virtual key to character - int n; - KeyID id; - if (CArchMiscWindows::isWindows95Family()) { - // XXX -- how do we get characters not in Latin-1? - WORD ascii; - n = ToAscii(virtualKey, scanCode, keyState, &ascii, 0); - id = static_cast(ascii & 0xffu); - } - else { - typedef int (WINAPI *ToUnicode_t)(UINT wVirtKey, - UINT wScanCode, - PBYTE lpKeyState, - LPWSTR pwszBuff, - int cchBuff, - UINT wFlags); - ToUnicode_t s_ToUnicode = NULL; - if (s_ToUnicode == NULL) { - HMODULE userModule = GetModuleHandle("user32.dll"); - if(userModule==NULL) { - LOG((CLOG_ERR "GetModuleHandle(\"user32.dll\") returned NULL")); - return kKeyNone; - } - s_ToUnicode = - (ToUnicode_t)GetProcAddress(userModule, "ToUnicode"); - } - - WCHAR unicode[2]; - n = s_ToUnicode(virtualKey, scanCode, keyState, - unicode, sizeof(unicode) / sizeof(unicode[0]), - 0); - id = static_cast(unicode[0]); - } - switch (n) { - case -1: - // no hot keys on dead keys - return kKeyNone; - - default: - case 0: - // unmapped - return kKeyNone; - - case 1: - return id; - } -} - -KeyModifierMask -CHotkeyOptions::CActionDialog::getModifiers() -{ - KeyModifierMask mask = 0; - if ((GetKeyState(VK_SHIFT) & 0x8000) != 0) { - mask |= KeyModifierShift; - } - if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) { - mask |= KeyModifierControl; - } - if ((GetKeyState(VK_MENU) & 0x8000) != 0) { - mask |= KeyModifierAlt; - } - if ((GetKeyState(VK_LWIN) & 0x8000) != 0 || - (GetKeyState(VK_RWIN) & 0x8000) != 0) { - mask |= KeyModifierSuper; - } - return mask; -} - -bool -CHotkeyOptions::CActionDialog::isGoodAction() -{ - CInputFilter::CMouseButtonAction* mouseAction = - dynamic_cast(s_action); - CInputFilter::CKeystrokeAction* keyAction = - dynamic_cast(s_action); - return (mouseAction == NULL || keyAction == NULL || - keyAction->getInfo()->m_key != kKeyNone); -} - -void -CHotkeyOptions::CActionDialog::convertAction(HWND hwnd) -{ - if (s_lastGoodAction != NULL) { - CInputFilter::CMouseButtonAction* mouseAction = - dynamic_cast(s_lastGoodAction); - CInputFilter::CKeystrokeAction* keyAction = - dynamic_cast(s_lastGoodAction); - if (mouseAction != NULL) { - IPlatformScreen::CButtonInfo* info = - IPrimaryScreen::CButtonInfo::alloc(*mouseAction->getInfo()); - delete s_action; - if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_DOWNUP))) { - s_action = new CMouseButtonDownUpAction(info); - } - else if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_DOWN))) { - s_action = new CInputFilter::CMouseButtonAction(info, true); - } - else if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_UP))) { - s_action = new CInputFilter::CMouseButtonAction(info, false); - } - else { - free(info); - s_action = NULL; - } - } - else if (keyAction != NULL) { - IPlatformScreen::CKeyInfo* info = - IKeyState::CKeyInfo::alloc(*keyAction->getInfo()); - delete s_action; - if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_DOWNUP))) { - s_action = new CKeystrokeDownUpAction(info); - } - else if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_DOWN))) { - s_action = new CInputFilter::CKeystrokeAction(info, true); - } - else if (isItemChecked(getItem(hwnd, IDC_HOTKEY_ACTION_UP))) { - s_action = new CInputFilter::CKeystrokeAction(info, false); - } - else { - free(info); - s_action = NULL; - } - } - } -} - -bool -CHotkeyOptions::CActionDialog::isDownUpAction() -{ - return (dynamic_cast(s_action) != NULL || - dynamic_cast(s_action) != NULL); -} - -BOOL CALLBACK -CHotkeyOptions::CActionDialog::dlgProc(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 (isDownUpAction()) { - s_onActivate = true; - } - EndDialog(hwnd, 1); - return TRUE; - - case IDCANCEL: - EndDialog(hwnd, 0); - return TRUE; - - case IDC_HOTKEY_ACTION_ON_ACTIVATE: - s_onActivate = true; - return TRUE; - - case IDC_HOTKEY_ACTION_ON_DEACTIVATE: - s_onActivate = false; - return TRUE; - - case IDC_HOTKEY_ACTION_DOWNUP: - case IDC_HOTKEY_ACTION_DOWN: - case IDC_HOTKEY_ACTION_UP: - convertAction(hwnd); - fillHotkey(hwnd); - updateControls(hwnd); - return TRUE; - - case IDC_HOTKEY_ACTION_LOCK: - onLockAction(hwnd); - updateControls(hwnd); - return TRUE; - - case IDC_HOTKEY_ACTION_SWITCH_TO: - onSwitchToAction(hwnd); - updateControls(hwnd); - return TRUE; - - case IDC_HOTKEY_ACTION_SWITCH_IN: - onSwitchInAction(hwnd); - updateControls(hwnd); - return TRUE; - - case IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST: - onKeyboardBroadcastAction(hwnd); - updateControls(hwnd); - return TRUE; - - case IDC_HOTKEY_ACTION_LOCK_LIST: - switch (HIWORD(wParam)) { - case LBN_SELCHANGE: - onLockAction(hwnd); - return TRUE; - } - break; - - case IDC_HOTKEY_ACTION_SWITCH_TO_LIST: - switch (HIWORD(wParam)) { - case LBN_SELCHANGE: - onSwitchToAction(hwnd); - return TRUE; - } - break; - - case IDC_HOTKEY_ACTION_SWITCH_IN_LIST: - switch (HIWORD(wParam)) { - case LBN_SELCHANGE: - onSwitchInAction(hwnd); - return TRUE; - } - break; - - case IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_LIST: - switch (HIWORD(wParam)) { - case LBN_SELCHANGE: - onKeyboardBroadcastAction(hwnd); - return TRUE; - } - break; - - case IDC_HOTKEY_ACTION_SCREENS: - CScreensDialog::doModal(hwnd, s_config, - dynamic_cast(s_action)); - fillHotkey(hwnd); - return TRUE; - - case IDC_HOTKEY_ACTION_KEYBOARD_BROADCAST_SCREENS: { - // convert screens to form that CScreenDialog::doModal() wants - IPlatformScreen::CKeyInfo* tmpInfo = - IPlatformScreen::CKeyInfo::alloc(0, 0, 0, 1, s_screens); - CInputFilter::CKeystrokeAction tmpAction(tmpInfo, true); - - // get the screens - CScreensDialog::doModal(hwnd, s_config, &tmpAction); - - // convert screens back - IPlatformScreen::CKeyInfo::split( - tmpAction.getInfo()->m_screens, s_screens); - - // update - onKeyboardBroadcastAction(hwnd); - return TRUE; - } - } - break; - - default: - break; - } - - return FALSE; -} - -LRESULT CALLBACK -CHotkeyOptions::CActionDialog::editProc(HWND hwnd, - UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) { - case WM_LBUTTONDOWN: - if (GetFocus() == hwnd) { - onButton(hwnd, kButtonLeft); - } - else { - SetFocus(hwnd); - } - return 0; - - case WM_MBUTTONDOWN: - if (GetFocus() == hwnd) { - onButton(hwnd, kButtonMiddle); - } - return 0; - - case WM_RBUTTONDOWN: - if (GetFocus() == hwnd) { - onButton(hwnd, kButtonRight); - } - return 0; - - case WM_XBUTTONDOWN: - if (GetFocus() == hwnd) { - switch (HIWORD(wParam)) { - case XBUTTON1: - onButton(hwnd, kButtonExtra0 + 0); - break; - - case XBUTTON2: - onButton(hwnd, kButtonExtra0 + 1); - break; - } - } - return 0; - - case WM_KEYDOWN: - case WM_SYSKEYDOWN: - case WM_KEYUP: - case WM_SYSKEYUP: - onKey(hwnd, wParam, lParam); - return 0; - - case WM_LBUTTONUP: - case WM_MBUTTONUP: - case WM_RBUTTONUP: - case WM_XBUTTONUP: - case WM_CHAR: - case WM_SYSCHAR: - case WM_DEADCHAR: - case WM_SYSDEADCHAR: - return 0; - - case WM_SETFOCUS: - if (s_action != NULL) { - delete s_lastGoodAction; - s_lastGoodAction = s_action->clone(); - } - break; - - case WM_KILLFOCUS: - if (!isGoodAction()) { - delete s_action; - if (s_lastGoodAction != NULL) { - s_action = s_lastGoodAction->clone(); - } - else { - s_action = NULL; - } - } - else if (s_action != NULL) { - delete s_lastGoodAction; - s_lastGoodAction = s_action->clone(); - } - fillHotkey(GetParent(hwnd)); - break; - - case WM_GETDLGCODE: - return DLGC_WANTALLKEYS; - - default: - break; - } - return CallWindowProc(s_editWndProc, hwnd, message, wParam, lParam); -} - - -// -// CHotkeyOptions::CScreensDialog -// - -CConfig* CHotkeyOptions::CScreensDialog::s_config = NULL; -CInputFilter::CKeystrokeAction* - CHotkeyOptions::CScreensDialog::s_action = NULL; -CHotkeyOptions::CScreensDialog::CScreens - CHotkeyOptions::CScreensDialog::s_nonTargets; -CHotkeyOptions::CScreensDialog::CScreens - CHotkeyOptions::CScreensDialog::s_targets; -CString CHotkeyOptions::CScreensDialog::s_allScreens; - -void -CHotkeyOptions::CScreensDialog::doModal(HWND parent, CConfig* config, - CInputFilter::CKeystrokeAction* action) -{ - s_allScreens = getString(IDS_ALL_SCREENS); - s_config = config; - s_action = action; - DialogBox(s_instance, MAKEINTRESOURCE(IDD_HOTKEY_SCREENS), - parent, (DLGPROC) dlgProc); - s_config = NULL; - s_action = NULL; -} - -void -CHotkeyOptions::CScreensDialog::doInit(HWND hwnd) -{ - s_nonTargets.clear(); - s_targets.clear(); - - // get screens from config - s_nonTargets.insert("*"); - for (CConfig::const_iterator i = s_config->begin(); - i != s_config->end(); ++i) { - s_nonTargets.insert(*i); - } - - // get screens in action - IKeyState::CKeyInfo::split(s_action->getInfo()->m_screens, s_targets); - - // remove screens in action from screens in config - for (CScreens::const_iterator i = s_targets.begin(); - i != s_targets.end(); ++i) { - s_nonTargets.erase(*i); - } - - // fill dialog - fillScreens(hwnd); - updateControls(hwnd); -} - -void -CHotkeyOptions::CScreensDialog::doFini(HWND) -{ - // put screens into action - const IPlatformScreen::CKeyInfo* oldInfo = s_action->getInfo(); - IPlatformScreen::CKeyInfo* newInfo = - IKeyState::CKeyInfo::alloc(oldInfo->m_key, - oldInfo->m_mask, 0, 0, s_targets); - s_action->adoptInfo(newInfo); -} - -void -CHotkeyOptions::CScreensDialog::fillScreens(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_SCREENS_SRC); - SendMessage(child, LB_RESETCONTENT, 0, 0); - for (CScreens::const_iterator i = s_nonTargets.begin(); - i != s_nonTargets.end(); ++i) { - CString name = *i; - if (name == "*") { - name = s_allScreens; - } - SendMessage(child, LB_INSERTSTRING, (WPARAM)-1, - (LPARAM)name.c_str()); - } - - child = getItem(hwnd, IDC_HOTKEY_SCREENS_DST); - SendMessage(child, LB_RESETCONTENT, 0, 0); - for (CScreens::const_iterator i = s_targets.begin(); - i != s_targets.end(); ++i) { - CString name = *i; - if (name == "*") { - name = s_allScreens; - } - SendMessage(child, LB_INSERTSTRING, (WPARAM)-1, - (LPARAM)name.c_str()); - } - if (s_targets.empty()) { - // if no targets then add a special item so the user knows - // what'll happen - CString activeScreenLabel = getString(IDS_ACTIVE_SCREEN); - SendMessage(child, LB_INSERTSTRING, (WPARAM)-1, - (LPARAM)activeScreenLabel.c_str()); - } -} - -void -CHotkeyOptions::CScreensDialog::updateControls(HWND hwnd) -{ - HWND child = getItem(hwnd, IDC_HOTKEY_SCREENS_SRC); - bool canAdd = (SendMessage(child, LB_GETSELCOUNT, 0, 0) != 0); - child = getItem(hwnd, IDC_HOTKEY_SCREENS_DST); - bool canRemove = (!s_targets.empty() && - (SendMessage(child, LB_GETSELCOUNT, 0, 0) != 0)); - - enableItem(hwnd, IDC_HOTKEY_SCREENS_ADD, canAdd); - enableItem(hwnd, IDC_HOTKEY_SCREENS_REMOVE, canRemove); -} - -void -CHotkeyOptions::CScreensDialog::add(HWND hwnd) -{ - CScreens selected; - getSelected(hwnd, IDC_HOTKEY_SCREENS_SRC, s_nonTargets, selected); - for (CScreens::const_iterator i = selected.begin(); - i != selected.end(); ++i) { - s_targets.insert(*i); - s_nonTargets.erase(*i); - } - fillScreens(hwnd); - updateControls(hwnd); -} - -void -CHotkeyOptions::CScreensDialog::remove(HWND hwnd) -{ - CScreens selected; - getSelected(hwnd, IDC_HOTKEY_SCREENS_DST, s_targets, selected); - for (CScreens::const_iterator i = selected.begin(); - i != selected.end(); ++i) { - s_nonTargets.insert(*i); - s_targets.erase(*i); - } - fillScreens(hwnd); - updateControls(hwnd); -} - -void -CHotkeyOptions::CScreensDialog::getSelected(HWND hwnd, UINT id, - const CScreens& inScreens, CScreens& outScreens) -{ - // get the selected item indices - HWND child = getItem(hwnd, id); - UInt32 n = (UInt32)SendMessage(child, LB_GETSELCOUNT, 0, 0); - int* index = new int[n]; - SendMessage(child, LB_GETSELITEMS, (WPARAM)n, (LPARAM)index); - - // get the items in a vector - std::vector tmpList; - for (CScreens::const_iterator i = inScreens.begin(); - i != inScreens.end(); ++i) { - tmpList.push_back(*i); - } - - // get selected items into the output set - outScreens.clear(); - for (UInt32 i = 0; i < n; ++i) { - outScreens.insert(tmpList[index[i]]); - } - - // clean up - delete[] index; -} - -BOOL CALLBACK -CHotkeyOptions::CScreensDialog::dlgProc(HWND hwnd, - UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) { - case WM_INITDIALOG: - doInit(hwnd); - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - doFini(hwnd); - EndDialog(hwnd, 0); - return TRUE; - - case IDCANCEL: - EndDialog(hwnd, 0); - return TRUE; - - case IDC_HOTKEY_SCREENS_ADD: - add(hwnd); - return TRUE; - - case IDC_HOTKEY_SCREENS_REMOVE: - remove(hwnd); - return TRUE; - - case IDC_HOTKEY_SCREENS_SRC: - case IDC_HOTKEY_SCREENS_DST: - switch (HIWORD(wParam)) { - case LBN_SELCANCEL: - case LBN_SELCHANGE: - updateControls(hwnd); - return TRUE; - } - break; - } - break; - - case WM_CTLCOLORLISTBOX: - if (s_targets.empty() && - (HWND)lParam == getItem(hwnd, IDC_HOTKEY_SCREENS_DST)) { - // override colors - HDC dc = (HDC)wParam; - SetTextColor(dc, GetSysColor(COLOR_GRAYTEXT)); - return (BOOL)GetSysColorBrush(COLOR_WINDOW); - } - break; - - default: - break; - } - - return FALSE; -} diff --git a/cmd/launcher/CHotkeyOptions.h b/cmd/launcher/CHotkeyOptions.h deleted file mode 100644 index 5e8b88ce..00000000 --- a/cmd/launcher/CHotkeyOptions.h +++ /dev/null @@ -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 . - */ - -#ifndef CHOTKEYOPTIONS_H -#define CHOTKEYOPTIONS_H - -#include "CString.h" -#include "KeyTypes.h" -#include "MouseTypes.h" -#include "CInputFilter.h" - -#define WINDOWS_LEAN_AND_MEAN -#include - -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 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 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 diff --git a/cmd/launcher/CInfo.cpp b/cmd/launcher/CInfo.cpp deleted file mode 100644 index b4a24457..00000000 --- a/cmd/launcher/CInfo.cpp +++ /dev/null @@ -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 . - */ - -#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); -} diff --git a/cmd/launcher/CInfo.h b/cmd/launcher/CInfo.h deleted file mode 100644 index cf2d6862..00000000 --- a/cmd/launcher/CInfo.h +++ /dev/null @@ -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 . - */ - -#ifndef CINFO_H -#define CINFO_H - -#include "CString.h" - -#define WINDOWS_LEAN_AND_MEAN -#include - -//! 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 diff --git a/cmd/launcher/CScreensLinks.cpp b/cmd/launcher/CScreensLinks.cpp deleted file mode 100644 index 28cf3308..00000000 --- a/cmd/launcher/CScreensLinks.cpp +++ /dev/null @@ -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 . - */ - -#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); -} diff --git a/cmd/launcher/CScreensLinks.h b/cmd/launcher/CScreensLinks.h deleted file mode 100644 index 75e0d0f1..00000000 --- a/cmd/launcher/CScreensLinks.h +++ /dev/null @@ -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 . - */ - -#ifndef CSCREENSLINKS_H -#define CSCREENSLINKS_H - -#include "CConfig.h" -#include "ProtocolTypes.h" -#include "CString.h" - -#define WINDOWS_LEAN_AND_MEAN -#include - -//! 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 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 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 diff --git a/cmd/launcher/LaunchUtil.cpp b/cmd/launcher/LaunchUtil.cpp deleted file mode 100644 index ad3ebe45..00000000 --- a/cmd/launcher/LaunchUtil.cpp +++ /dev/null @@ -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 . - */ - -#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; -} diff --git a/cmd/launcher/LaunchUtil.h b/cmd/launcher/LaunchUtil.h deleted file mode 100644 index eafbee2a..00000000 --- a/cmd/launcher/LaunchUtil.h +++ /dev/null @@ -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 . - */ - -#ifndef LAUNCHUTIL_H -#define LAUNCHUTIL_H - -#include "CString.h" - -#define WINDOWS_LEAN_AND_MEAN -#include -#include -#include - -#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 diff --git a/cmd/launcher/launcher.cpp b/cmd/launcher/launcher.cpp deleted file mode 100644 index 007ecb48..00000000 --- a/cmd/launcher/launcher.cpp +++ /dev/null @@ -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 . - */ - -#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 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(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(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( - 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(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; -} diff --git a/cmd/launcher/launcher.rc b/cmd/launcher/launcher.rc deleted file mode 100644 index aae2b3e3..00000000 --- a/cmd/launcher/launcher.rc +++ /dev/null @@ -1,626 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include -#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 \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 - diff --git a/cmd/launcher/resource.h b/cmd/launcher/resource.h deleted file mode 100644 index 14f9885d..00000000 --- a/cmd/launcher/resource.h +++ /dev/null @@ -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 diff --git a/cmd/launcher/synergy.ico b/cmd/launcher/synergy.ico deleted file mode 100644 index fc2e4146..00000000 Binary files a/cmd/launcher/synergy.ico and /dev/null differ diff --git a/cmake/Installer.nsi.in b/res/Installer.nsi.in similarity index 100% rename from cmake/Installer.nsi.in rename to res/Installer.nsi.in diff --git a/cmake/License.rtf b/res/License.rtf similarity index 100% rename from cmake/License.rtf rename to res/License.rtf diff --git a/cmake/License.tex b/res/License.tex similarity index 100% rename from cmake/License.tex rename to res/License.tex diff --git a/cmake/Readme.txt b/res/Readme.txt similarity index 100% rename from cmake/Readme.txt rename to res/Readme.txt diff --git a/cmake/config.h.in b/res/config.h.in similarity index 100% rename from cmake/config.h.in rename to res/config.h.in diff --git a/cmake/doxygen.cfg.in b/res/doxygen.cfg.in similarity index 100% rename from cmake/doxygen.cfg.in rename to res/doxygen.cfg.in diff --git a/cmake/synergy.desktop b/res/synergy.desktop similarity index 100% rename from cmake/synergy.desktop rename to res/synergy.desktop diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..bb395fc5 --- /dev/null +++ b/src/CMakeLists.txt @@ -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 . + +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) diff --git a/cmake/CMakeLists_gtest.txt b/src/cmd/CMakeLists.txt similarity index 78% rename from cmake/CMakeLists_gtest.txt rename to src/cmd/CMakeLists.txt index c16327f7..822ce1f2 100644 --- a/cmake/CMakeLists_gtest.txt +++ b/src/cmd/CMakeLists.txt @@ -13,10 +13,5 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -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) diff --git a/cmd/synergyc/.gitignore b/src/cmd/synergyc/.gitignore similarity index 100% rename from cmd/synergyc/.gitignore rename to src/cmd/synergyc/.gitignore diff --git a/cmd/synergyc/CMSWindowsClientTaskBarReceiver.cpp b/src/cmd/synergyc/CMSWindowsClientTaskBarReceiver.cpp similarity index 100% rename from cmd/synergyc/CMSWindowsClientTaskBarReceiver.cpp rename to src/cmd/synergyc/CMSWindowsClientTaskBarReceiver.cpp diff --git a/cmd/synergyc/CMSWindowsClientTaskBarReceiver.h b/src/cmd/synergyc/CMSWindowsClientTaskBarReceiver.h similarity index 100% rename from cmd/synergyc/CMSWindowsClientTaskBarReceiver.h rename to src/cmd/synergyc/CMSWindowsClientTaskBarReceiver.h diff --git a/src/cmd/synergyc/CMakeLists.txt b/src/cmd/synergyc/CMakeLists.txt new file mode 100644 index 00000000..7bd6c8dd --- /dev/null +++ b/src/cmd/synergyc/CMakeLists.txt @@ -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 . + +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}) diff --git a/cmd/synergyc/COSXClientTaskBarReceiver.cpp b/src/cmd/synergyc/COSXClientTaskBarReceiver.cpp similarity index 100% rename from cmd/synergyc/COSXClientTaskBarReceiver.cpp rename to src/cmd/synergyc/COSXClientTaskBarReceiver.cpp diff --git a/cmd/synergyc/COSXClientTaskBarReceiver.h b/src/cmd/synergyc/COSXClientTaskBarReceiver.h similarity index 100% rename from cmd/synergyc/COSXClientTaskBarReceiver.h rename to src/cmd/synergyc/COSXClientTaskBarReceiver.h diff --git a/cmd/synergyc/CXWindowsClientTaskBarReceiver.cpp b/src/cmd/synergyc/CXWindowsClientTaskBarReceiver.cpp similarity index 100% rename from cmd/synergyc/CXWindowsClientTaskBarReceiver.cpp rename to src/cmd/synergyc/CXWindowsClientTaskBarReceiver.cpp diff --git a/cmd/synergyc/CXWindowsClientTaskBarReceiver.h b/src/cmd/synergyc/CXWindowsClientTaskBarReceiver.h similarity index 100% rename from cmd/synergyc/CXWindowsClientTaskBarReceiver.h rename to src/cmd/synergyc/CXWindowsClientTaskBarReceiver.h diff --git a/cmd/synergyc/resource.h b/src/cmd/synergyc/resource.h similarity index 100% rename from cmd/synergyc/resource.h rename to src/cmd/synergyc/resource.h diff --git a/cmd/synergyc/synergyc.cpp b/src/cmd/synergyc/synergyc.cpp similarity index 100% rename from cmd/synergyc/synergyc.cpp rename to src/cmd/synergyc/synergyc.cpp diff --git a/cmd/synergyc/synergyc.ico b/src/cmd/synergyc/synergyc.ico similarity index 100% rename from cmd/synergyc/synergyc.ico rename to src/cmd/synergyc/synergyc.ico diff --git a/cmd/synergyc/synergyc.rc b/src/cmd/synergyc/synergyc.rc similarity index 100% rename from cmd/synergyc/synergyc.rc rename to src/cmd/synergyc/synergyc.rc diff --git a/cmd/synergyc/tb_error.ico b/src/cmd/synergyc/tb_error.ico similarity index 100% rename from cmd/synergyc/tb_error.ico rename to src/cmd/synergyc/tb_error.ico diff --git a/cmd/synergyc/tb_idle.ico b/src/cmd/synergyc/tb_idle.ico similarity index 100% rename from cmd/synergyc/tb_idle.ico rename to src/cmd/synergyc/tb_idle.ico diff --git a/cmd/synergyc/tb_run.ico b/src/cmd/synergyc/tb_run.ico similarity index 100% rename from cmd/synergyc/tb_run.ico rename to src/cmd/synergyc/tb_run.ico diff --git a/cmd/synergyc/tb_wait.ico b/src/cmd/synergyc/tb_wait.ico similarity index 100% rename from cmd/synergyc/tb_wait.ico rename to src/cmd/synergyc/tb_wait.ico diff --git a/cmd/synergys/.gitignore b/src/cmd/synergys/.gitignore similarity index 100% rename from cmd/synergys/.gitignore rename to src/cmd/synergys/.gitignore diff --git a/cmd/synergys/CMSWindowsServerTaskBarReceiver.cpp b/src/cmd/synergys/CMSWindowsServerTaskBarReceiver.cpp similarity index 100% rename from cmd/synergys/CMSWindowsServerTaskBarReceiver.cpp rename to src/cmd/synergys/CMSWindowsServerTaskBarReceiver.cpp diff --git a/cmd/synergys/CMSWindowsServerTaskBarReceiver.h b/src/cmd/synergys/CMSWindowsServerTaskBarReceiver.h similarity index 100% rename from cmd/synergys/CMSWindowsServerTaskBarReceiver.h rename to src/cmd/synergys/CMSWindowsServerTaskBarReceiver.h diff --git a/src/cmd/synergys/CMakeLists.txt b/src/cmd/synergys/CMakeLists.txt new file mode 100644 index 00000000..7098aa98 --- /dev/null +++ b/src/cmd/synergys/CMakeLists.txt @@ -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 . + +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}) diff --git a/cmd/synergys/COSXServerTaskBarReceiver.cpp b/src/cmd/synergys/COSXServerTaskBarReceiver.cpp similarity index 100% rename from cmd/synergys/COSXServerTaskBarReceiver.cpp rename to src/cmd/synergys/COSXServerTaskBarReceiver.cpp diff --git a/cmd/synergys/COSXServerTaskBarReceiver.h b/src/cmd/synergys/COSXServerTaskBarReceiver.h similarity index 100% rename from cmd/synergys/COSXServerTaskBarReceiver.h rename to src/cmd/synergys/COSXServerTaskBarReceiver.h diff --git a/cmd/synergys/CXWindowsServerTaskBarReceiver.cpp b/src/cmd/synergys/CXWindowsServerTaskBarReceiver.cpp similarity index 100% rename from cmd/synergys/CXWindowsServerTaskBarReceiver.cpp rename to src/cmd/synergys/CXWindowsServerTaskBarReceiver.cpp diff --git a/cmd/synergys/CXWindowsServerTaskBarReceiver.h b/src/cmd/synergys/CXWindowsServerTaskBarReceiver.h similarity index 100% rename from cmd/synergys/CXWindowsServerTaskBarReceiver.h rename to src/cmd/synergys/CXWindowsServerTaskBarReceiver.h diff --git a/cmd/synergys/resource.h b/src/cmd/synergys/resource.h similarity index 100% rename from cmd/synergys/resource.h rename to src/cmd/synergys/resource.h diff --git a/cmd/synergys/synergys.cpp b/src/cmd/synergys/synergys.cpp similarity index 100% rename from cmd/synergys/synergys.cpp rename to src/cmd/synergys/synergys.cpp diff --git a/cmd/synergys/synergys.ico b/src/cmd/synergys/synergys.ico similarity index 100% rename from cmd/synergys/synergys.ico rename to src/cmd/synergys/synergys.ico diff --git a/cmd/synergys/synergys.rc b/src/cmd/synergys/synergys.rc similarity index 100% rename from cmd/synergys/synergys.rc rename to src/cmd/synergys/synergys.rc diff --git a/cmd/synergys/tb_error.ico b/src/cmd/synergys/tb_error.ico similarity index 100% rename from cmd/synergys/tb_error.ico rename to src/cmd/synergys/tb_error.ico diff --git a/cmd/synergys/tb_idle.ico b/src/cmd/synergys/tb_idle.ico similarity index 100% rename from cmd/synergys/tb_idle.ico rename to src/cmd/synergys/tb_idle.ico diff --git a/cmd/synergys/tb_run.ico b/src/cmd/synergys/tb_run.ico similarity index 100% rename from cmd/synergys/tb_run.ico rename to src/cmd/synergys/tb_run.ico diff --git a/cmd/synergys/tb_wait.ico b/src/cmd/synergys/tb_wait.ico similarity index 100% rename from cmd/synergys/tb_wait.ico rename to src/cmd/synergys/tb_wait.ico diff --git a/gui/COPYING b/src/gui/COPYING similarity index 100% rename from gui/COPYING rename to src/gui/COPYING diff --git a/gui/INSTALL b/src/gui/INSTALL similarity index 100% rename from gui/INSTALL rename to src/gui/INSTALL diff --git a/gui/README b/src/gui/README similarity index 100% rename from gui/README rename to src/gui/README diff --git a/gui/qsynergy.pro b/src/gui/qsynergy.pro similarity index 100% rename from gui/qsynergy.pro rename to src/gui/qsynergy.pro diff --git a/gui/res/AboutDialogBase.ui b/src/gui/res/AboutDialogBase.ui similarity index 100% rename from gui/res/AboutDialogBase.ui rename to src/gui/res/AboutDialogBase.ui diff --git a/gui/res/ActionDialogBase.ui b/src/gui/res/ActionDialogBase.ui similarity index 100% rename from gui/res/ActionDialogBase.ui rename to src/gui/res/ActionDialogBase.ui diff --git a/gui/res/HotkeyDialogBase.ui b/src/gui/res/HotkeyDialogBase.ui similarity index 100% rename from gui/res/HotkeyDialogBase.ui rename to src/gui/res/HotkeyDialogBase.ui diff --git a/gui/res/LogDialogBase.ui b/src/gui/res/LogDialogBase.ui similarity index 100% rename from gui/res/LogDialogBase.ui rename to src/gui/res/LogDialogBase.ui diff --git a/gui/res/MainWindowBase.ui b/src/gui/res/MainWindowBase.ui similarity index 100% rename from gui/res/MainWindowBase.ui rename to src/gui/res/MainWindowBase.ui diff --git a/gui/res/QSynergy.qrc b/src/gui/res/QSynergy.qrc similarity index 100% rename from gui/res/QSynergy.qrc rename to src/gui/res/QSynergy.qrc diff --git a/gui/res/ScreenSettingsDialogBase.ui b/src/gui/res/ScreenSettingsDialogBase.ui similarity index 100% rename from gui/res/ScreenSettingsDialogBase.ui rename to src/gui/res/ScreenSettingsDialogBase.ui diff --git a/gui/res/ServerConfigDialogBase.ui b/src/gui/res/ServerConfigDialogBase.ui similarity index 100% rename from gui/res/ServerConfigDialogBase.ui rename to src/gui/res/ServerConfigDialogBase.ui diff --git a/gui/res/SettingsDialogBase.ui b/src/gui/res/SettingsDialogBase.ui similarity index 100% rename from gui/res/SettingsDialogBase.ui rename to src/gui/res/SettingsDialogBase.ui diff --git a/gui/res/WindowsServicesBase.ui b/src/gui/res/WindowsServicesBase.ui similarity index 100% rename from gui/res/WindowsServicesBase.ui rename to src/gui/res/WindowsServicesBase.ui diff --git a/gui/res/icons/16x16/synergy-connected.png b/src/gui/res/icons/16x16/synergy-connected.png similarity index 100% rename from gui/res/icons/16x16/synergy-connected.png rename to src/gui/res/icons/16x16/synergy-connected.png diff --git a/gui/res/icons/16x16/synergy-disconnected.png b/src/gui/res/icons/16x16/synergy-disconnected.png similarity index 100% rename from gui/res/icons/16x16/synergy-disconnected.png rename to src/gui/res/icons/16x16/synergy-disconnected.png diff --git a/gui/res/icons/64x64/user-trash.png b/src/gui/res/icons/64x64/user-trash.png similarity index 100% rename from gui/res/icons/64x64/user-trash.png rename to src/gui/res/icons/64x64/user-trash.png diff --git a/gui/res/icons/64x64/video-display.png b/src/gui/res/icons/64x64/video-display.png similarity index 100% rename from gui/res/icons/64x64/video-display.png rename to src/gui/res/icons/64x64/video-display.png diff --git a/gui/res/mac/QSynergy.icns b/src/gui/res/mac/QSynergy.icns similarity index 100% rename from gui/res/mac/QSynergy.icns rename to src/gui/res/mac/QSynergy.icns diff --git a/gui/res/mac/QSynergy.plist b/src/gui/res/mac/QSynergy.plist similarity index 100% rename from gui/res/mac/QSynergy.plist rename to src/gui/res/mac/QSynergy.plist diff --git a/gui/res/win/QSynergy.ico b/src/gui/res/win/QSynergy.ico similarity index 100% rename from gui/res/win/QSynergy.ico rename to src/gui/res/win/QSynergy.ico diff --git a/gui/res/win/QSynergy.rc b/src/gui/res/win/QSynergy.rc similarity index 100% rename from gui/res/win/QSynergy.rc rename to src/gui/res/win/QSynergy.rc diff --git a/gui/src/AboutDialog.cpp b/src/gui/src/AboutDialog.cpp similarity index 100% rename from gui/src/AboutDialog.cpp rename to src/gui/src/AboutDialog.cpp diff --git a/gui/src/AboutDialog.h b/src/gui/src/AboutDialog.h similarity index 100% rename from gui/src/AboutDialog.h rename to src/gui/src/AboutDialog.h diff --git a/gui/src/Action.cpp b/src/gui/src/Action.cpp similarity index 100% rename from gui/src/Action.cpp rename to src/gui/src/Action.cpp diff --git a/gui/src/Action.h b/src/gui/src/Action.h similarity index 100% rename from gui/src/Action.h rename to src/gui/src/Action.h diff --git a/gui/src/ActionDialog.cpp b/src/gui/src/ActionDialog.cpp similarity index 100% rename from gui/src/ActionDialog.cpp rename to src/gui/src/ActionDialog.cpp diff --git a/gui/src/ActionDialog.h b/src/gui/src/ActionDialog.h similarity index 100% rename from gui/src/ActionDialog.h rename to src/gui/src/ActionDialog.h diff --git a/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp similarity index 100% rename from gui/src/AppConfig.cpp rename to src/gui/src/AppConfig.cpp diff --git a/gui/src/AppConfig.h b/src/gui/src/AppConfig.h similarity index 100% rename from gui/src/AppConfig.h rename to src/gui/src/AppConfig.h diff --git a/gui/src/BaseConfig.cpp b/src/gui/src/BaseConfig.cpp similarity index 100% rename from gui/src/BaseConfig.cpp rename to src/gui/src/BaseConfig.cpp diff --git a/gui/src/BaseConfig.h b/src/gui/src/BaseConfig.h similarity index 100% rename from gui/src/BaseConfig.h rename to src/gui/src/BaseConfig.h diff --git a/gui/src/Hotkey.cpp b/src/gui/src/Hotkey.cpp similarity index 100% rename from gui/src/Hotkey.cpp rename to src/gui/src/Hotkey.cpp diff --git a/gui/src/Hotkey.h b/src/gui/src/Hotkey.h similarity index 100% rename from gui/src/Hotkey.h rename to src/gui/src/Hotkey.h diff --git a/gui/src/HotkeyDialog.cpp b/src/gui/src/HotkeyDialog.cpp similarity index 100% rename from gui/src/HotkeyDialog.cpp rename to src/gui/src/HotkeyDialog.cpp diff --git a/gui/src/HotkeyDialog.h b/src/gui/src/HotkeyDialog.h similarity index 100% rename from gui/src/HotkeyDialog.h rename to src/gui/src/HotkeyDialog.h diff --git a/gui/src/KeySequence.cpp b/src/gui/src/KeySequence.cpp similarity index 100% rename from gui/src/KeySequence.cpp rename to src/gui/src/KeySequence.cpp diff --git a/gui/src/KeySequence.h b/src/gui/src/KeySequence.h similarity index 100% rename from gui/src/KeySequence.h rename to src/gui/src/KeySequence.h diff --git a/gui/src/KeySequenceWidget.cpp b/src/gui/src/KeySequenceWidget.cpp similarity index 100% rename from gui/src/KeySequenceWidget.cpp rename to src/gui/src/KeySequenceWidget.cpp diff --git a/gui/src/KeySequenceWidget.h b/src/gui/src/KeySequenceWidget.h similarity index 100% rename from gui/src/KeySequenceWidget.h rename to src/gui/src/KeySequenceWidget.h diff --git a/gui/src/LogDialog.cpp b/src/gui/src/LogDialog.cpp similarity index 100% rename from gui/src/LogDialog.cpp rename to src/gui/src/LogDialog.cpp diff --git a/gui/src/LogDialog.h b/src/gui/src/LogDialog.h similarity index 100% rename from gui/src/LogDialog.h rename to src/gui/src/LogDialog.h diff --git a/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp similarity index 100% rename from gui/src/MainWindow.cpp rename to src/gui/src/MainWindow.cpp diff --git a/gui/src/MainWindow.h b/src/gui/src/MainWindow.h similarity index 100% rename from gui/src/MainWindow.h rename to src/gui/src/MainWindow.h diff --git a/gui/src/NewScreenWidget.cpp b/src/gui/src/NewScreenWidget.cpp similarity index 100% rename from gui/src/NewScreenWidget.cpp rename to src/gui/src/NewScreenWidget.cpp diff --git a/gui/src/NewScreenWidget.h b/src/gui/src/NewScreenWidget.h similarity index 100% rename from gui/src/NewScreenWidget.h rename to src/gui/src/NewScreenWidget.h diff --git a/gui/src/QSynergyApplication.cpp b/src/gui/src/QSynergyApplication.cpp similarity index 100% rename from gui/src/QSynergyApplication.cpp rename to src/gui/src/QSynergyApplication.cpp diff --git a/gui/src/QSynergyApplication.h b/src/gui/src/QSynergyApplication.h similarity index 100% rename from gui/src/QSynergyApplication.h rename to src/gui/src/QSynergyApplication.h diff --git a/gui/src/Screen.cpp b/src/gui/src/Screen.cpp similarity index 100% rename from gui/src/Screen.cpp rename to src/gui/src/Screen.cpp diff --git a/gui/src/Screen.h b/src/gui/src/Screen.h similarity index 100% rename from gui/src/Screen.h rename to src/gui/src/Screen.h diff --git a/gui/src/ScreenSettingsDialog.cpp b/src/gui/src/ScreenSettingsDialog.cpp similarity index 100% rename from gui/src/ScreenSettingsDialog.cpp rename to src/gui/src/ScreenSettingsDialog.cpp diff --git a/gui/src/ScreenSettingsDialog.h b/src/gui/src/ScreenSettingsDialog.h similarity index 100% rename from gui/src/ScreenSettingsDialog.h rename to src/gui/src/ScreenSettingsDialog.h diff --git a/gui/src/ScreenSetupModel.cpp b/src/gui/src/ScreenSetupModel.cpp similarity index 100% rename from gui/src/ScreenSetupModel.cpp rename to src/gui/src/ScreenSetupModel.cpp diff --git a/gui/src/ScreenSetupModel.h b/src/gui/src/ScreenSetupModel.h similarity index 100% rename from gui/src/ScreenSetupModel.h rename to src/gui/src/ScreenSetupModel.h diff --git a/gui/src/ScreenSetupView.cpp b/src/gui/src/ScreenSetupView.cpp similarity index 100% rename from gui/src/ScreenSetupView.cpp rename to src/gui/src/ScreenSetupView.cpp diff --git a/gui/src/ScreenSetupView.h b/src/gui/src/ScreenSetupView.h similarity index 100% rename from gui/src/ScreenSetupView.h rename to src/gui/src/ScreenSetupView.h diff --git a/gui/src/ServerConfig.cpp b/src/gui/src/ServerConfig.cpp similarity index 100% rename from gui/src/ServerConfig.cpp rename to src/gui/src/ServerConfig.cpp diff --git a/gui/src/ServerConfig.h b/src/gui/src/ServerConfig.h similarity index 100% rename from gui/src/ServerConfig.h rename to src/gui/src/ServerConfig.h diff --git a/gui/src/ServerConfigDialog.cpp b/src/gui/src/ServerConfigDialog.cpp similarity index 100% rename from gui/src/ServerConfigDialog.cpp rename to src/gui/src/ServerConfigDialog.cpp diff --git a/gui/src/ServerConfigDialog.h b/src/gui/src/ServerConfigDialog.h similarity index 100% rename from gui/src/ServerConfigDialog.h rename to src/gui/src/ServerConfigDialog.h diff --git a/gui/src/SettingsDialog.cpp b/src/gui/src/SettingsDialog.cpp similarity index 100% rename from gui/src/SettingsDialog.cpp rename to src/gui/src/SettingsDialog.cpp diff --git a/gui/src/SettingsDialog.h b/src/gui/src/SettingsDialog.h similarity index 100% rename from gui/src/SettingsDialog.h rename to src/gui/src/SettingsDialog.h diff --git a/gui/src/TrashScreenWidget.cpp b/src/gui/src/TrashScreenWidget.cpp similarity index 100% rename from gui/src/TrashScreenWidget.cpp rename to src/gui/src/TrashScreenWidget.cpp diff --git a/gui/src/TrashScreenWidget.h b/src/gui/src/TrashScreenWidget.h similarity index 100% rename from gui/src/TrashScreenWidget.h rename to src/gui/src/TrashScreenWidget.h diff --git a/gui/src/WindowsServices.cpp b/src/gui/src/WindowsServices.cpp similarity index 100% rename from gui/src/WindowsServices.cpp rename to src/gui/src/WindowsServices.cpp diff --git a/gui/src/WindowsServices.h b/src/gui/src/WindowsServices.h similarity index 100% rename from gui/src/WindowsServices.h rename to src/gui/src/WindowsServices.h diff --git a/gui/src/main.cpp b/src/gui/src/main.cpp similarity index 100% rename from gui/src/main.cpp rename to src/gui/src/main.cpp diff --git a/cmake/CMakeLists_test.txt b/src/integtests/CMakeLists.txt similarity index 50% rename from cmake/CMakeLists_test.txt rename to src/integtests/CMakeLists.txt index 13ddb456..fc7ed603 100644 --- a/cmake/CMakeLists_test.txt +++ b/src/integtests/CMakeLists.txt @@ -13,36 +13,48 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Include all files that have unit tests -set(unittests - ${root_dir}/tools/gtest/src/gtest_main.cc - ${root_dir}/src/unittest/synergy/CClipboardTests.cpp -) - -set(integtests - ${root_dir}/src/integtest/Main.cpp +set(src + Main.cpp ) if (WIN32) - list(APPEND integtests - ${root_dir}/src/integtest/platform/CMSWindowsClipboardTests.cpp + + # windows + list(APPEND src + platform/CMSWindowsClipboardTests.cpp ) + +elseif (APPLE) + + # mac + list(APPEND src + platform/COSXClipboardTests.cpp + ) + +elseif (UNIX) + + # unix/linux + list(APPEND src + platform/CXWindowsClipboardTests.cpp + ) + endif() -if (UNIX) - if (APPLE) - list(APPEND integtests - ${root_dir}/src/integtest/platform/COSXClipboardTests.cpp - ) - else () - list(APPEND integtests - ${root_dir}/src/integtest/platform/CXWindowsClipboardTests.cpp - ) - endif() -endif() +set(inc + ../lib/arch + ../lib/base + ../lib/client + ../lib/common + ../lib/io + ../lib/mt + ../lib/net + ../lib/platform + ../lib/synergy + ../../tools/gtest/include +) -add_executable(unittests ${unittests}) -target_link_libraries(unittests synergy gtest ${libs}) - -add_executable(integtests ${integtests}) -target_link_libraries(integtests synergy gtest ${libs}) +include_directories(${inc}) +add_executable(integtests ${src}) +target_link_libraries(integtests + libarch libbase libclient libcommon libio libmt libnet libplatform + libserver libsynergy gtest ${libs}) diff --git a/src/integtest/Main.cpp b/src/integtests/Main.cpp similarity index 100% rename from src/integtest/Main.cpp rename to src/integtests/Main.cpp diff --git a/src/integtest/platform/CMSWindowsClipboardTests.cpp b/src/integtests/platform/CMSWindowsClipboardTests.cpp similarity index 100% rename from src/integtest/platform/CMSWindowsClipboardTests.cpp rename to src/integtests/platform/CMSWindowsClipboardTests.cpp diff --git a/src/integtest/platform/COSXClipboardTests.cpp b/src/integtests/platform/COSXClipboardTests.cpp similarity index 100% rename from src/integtest/platform/COSXClipboardTests.cpp rename to src/integtests/platform/COSXClipboardTests.cpp diff --git a/src/integtest/platform/CXWindowsClipboardTests.cpp b/src/integtests/platform/CXWindowsClipboardTests.cpp similarity index 100% rename from src/integtest/platform/CXWindowsClipboardTests.cpp rename to src/integtests/platform/CXWindowsClipboardTests.cpp diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt new file mode 100644 index 00000000..4cbb3c78 --- /dev/null +++ b/src/lib/CMakeLists.txt @@ -0,0 +1,25 @@ +# 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 . + +add_subdirectory(arch) +add_subdirectory(base) +add_subdirectory(client) +add_subdirectory(common) +add_subdirectory(io) +add_subdirectory(mt) +add_subdirectory(net) +add_subdirectory(platform) +add_subdirectory(server) +add_subdirectory(synergy) diff --git a/lib/arch/CArch.cpp b/src/lib/arch/CArch.cpp similarity index 100% rename from lib/arch/CArch.cpp rename to src/lib/arch/CArch.cpp diff --git a/lib/arch/CArch.h b/src/lib/arch/CArch.h similarity index 100% rename from lib/arch/CArch.h rename to src/lib/arch/CArch.h diff --git a/lib/arch/CArchAppUtil.cpp b/src/lib/arch/CArchAppUtil.cpp similarity index 100% rename from lib/arch/CArchAppUtil.cpp rename to src/lib/arch/CArchAppUtil.cpp diff --git a/lib/arch/CArchAppUtil.h b/src/lib/arch/CArchAppUtil.h similarity index 100% rename from lib/arch/CArchAppUtil.h rename to src/lib/arch/CArchAppUtil.h diff --git a/lib/arch/CArchAppUtilUnix.cpp b/src/lib/arch/CArchAppUtilUnix.cpp similarity index 100% rename from lib/arch/CArchAppUtilUnix.cpp rename to src/lib/arch/CArchAppUtilUnix.cpp diff --git a/lib/arch/CArchAppUtilUnix.h b/src/lib/arch/CArchAppUtilUnix.h similarity index 100% rename from lib/arch/CArchAppUtilUnix.h rename to src/lib/arch/CArchAppUtilUnix.h diff --git a/lib/arch/CArchAppUtilWindows.cpp b/src/lib/arch/CArchAppUtilWindows.cpp similarity index 100% rename from lib/arch/CArchAppUtilWindows.cpp rename to src/lib/arch/CArchAppUtilWindows.cpp diff --git a/lib/arch/CArchAppUtilWindows.h b/src/lib/arch/CArchAppUtilWindows.h similarity index 100% rename from lib/arch/CArchAppUtilWindows.h rename to src/lib/arch/CArchAppUtilWindows.h diff --git a/lib/arch/CArchConsoleStd.cpp b/src/lib/arch/CArchConsoleStd.cpp similarity index 100% rename from lib/arch/CArchConsoleStd.cpp rename to src/lib/arch/CArchConsoleStd.cpp diff --git a/lib/arch/CArchConsoleStd.h b/src/lib/arch/CArchConsoleStd.h similarity index 100% rename from lib/arch/CArchConsoleStd.h rename to src/lib/arch/CArchConsoleStd.h diff --git a/lib/arch/CArchConsoleUnix.cpp b/src/lib/arch/CArchConsoleUnix.cpp similarity index 100% rename from lib/arch/CArchConsoleUnix.cpp rename to src/lib/arch/CArchConsoleUnix.cpp diff --git a/lib/arch/CArchConsoleUnix.h b/src/lib/arch/CArchConsoleUnix.h similarity index 100% rename from lib/arch/CArchConsoleUnix.h rename to src/lib/arch/CArchConsoleUnix.h diff --git a/lib/arch/CArchConsoleWindows.cpp b/src/lib/arch/CArchConsoleWindows.cpp similarity index 100% rename from lib/arch/CArchConsoleWindows.cpp rename to src/lib/arch/CArchConsoleWindows.cpp diff --git a/lib/arch/CArchConsoleWindows.h b/src/lib/arch/CArchConsoleWindows.h similarity index 100% rename from lib/arch/CArchConsoleWindows.h rename to src/lib/arch/CArchConsoleWindows.h diff --git a/lib/arch/CArchDaemonNone.cpp b/src/lib/arch/CArchDaemonNone.cpp similarity index 100% rename from lib/arch/CArchDaemonNone.cpp rename to src/lib/arch/CArchDaemonNone.cpp diff --git a/lib/arch/CArchDaemonNone.h b/src/lib/arch/CArchDaemonNone.h similarity index 100% rename from lib/arch/CArchDaemonNone.h rename to src/lib/arch/CArchDaemonNone.h diff --git a/lib/arch/CArchDaemonUnix.cpp b/src/lib/arch/CArchDaemonUnix.cpp similarity index 100% rename from lib/arch/CArchDaemonUnix.cpp rename to src/lib/arch/CArchDaemonUnix.cpp diff --git a/lib/arch/CArchDaemonUnix.h b/src/lib/arch/CArchDaemonUnix.h similarity index 100% rename from lib/arch/CArchDaemonUnix.h rename to src/lib/arch/CArchDaemonUnix.h diff --git a/lib/arch/CArchDaemonWindows.cpp b/src/lib/arch/CArchDaemonWindows.cpp similarity index 100% rename from lib/arch/CArchDaemonWindows.cpp rename to src/lib/arch/CArchDaemonWindows.cpp diff --git a/lib/arch/CArchDaemonWindows.h b/src/lib/arch/CArchDaemonWindows.h similarity index 100% rename from lib/arch/CArchDaemonWindows.h rename to src/lib/arch/CArchDaemonWindows.h diff --git a/lib/arch/CArchFileUnix.cpp b/src/lib/arch/CArchFileUnix.cpp similarity index 100% rename from lib/arch/CArchFileUnix.cpp rename to src/lib/arch/CArchFileUnix.cpp diff --git a/lib/arch/CArchFileUnix.h b/src/lib/arch/CArchFileUnix.h similarity index 100% rename from lib/arch/CArchFileUnix.h rename to src/lib/arch/CArchFileUnix.h diff --git a/lib/arch/CArchFileWindows.cpp b/src/lib/arch/CArchFileWindows.cpp similarity index 100% rename from lib/arch/CArchFileWindows.cpp rename to src/lib/arch/CArchFileWindows.cpp diff --git a/lib/arch/CArchFileWindows.h b/src/lib/arch/CArchFileWindows.h similarity index 100% rename from lib/arch/CArchFileWindows.h rename to src/lib/arch/CArchFileWindows.h diff --git a/lib/arch/CArchLogUnix.cpp b/src/lib/arch/CArchLogUnix.cpp similarity index 100% rename from lib/arch/CArchLogUnix.cpp rename to src/lib/arch/CArchLogUnix.cpp diff --git a/lib/arch/CArchLogUnix.h b/src/lib/arch/CArchLogUnix.h similarity index 100% rename from lib/arch/CArchLogUnix.h rename to src/lib/arch/CArchLogUnix.h diff --git a/lib/arch/CArchLogWindows.cpp b/src/lib/arch/CArchLogWindows.cpp similarity index 100% rename from lib/arch/CArchLogWindows.cpp rename to src/lib/arch/CArchLogWindows.cpp diff --git a/lib/arch/CArchLogWindows.h b/src/lib/arch/CArchLogWindows.h similarity index 100% rename from lib/arch/CArchLogWindows.h rename to src/lib/arch/CArchLogWindows.h diff --git a/lib/arch/CArchMiscWindows.cpp b/src/lib/arch/CArchMiscWindows.cpp similarity index 100% rename from lib/arch/CArchMiscWindows.cpp rename to src/lib/arch/CArchMiscWindows.cpp diff --git a/lib/arch/CArchMiscWindows.h b/src/lib/arch/CArchMiscWindows.h similarity index 100% rename from lib/arch/CArchMiscWindows.h rename to src/lib/arch/CArchMiscWindows.h diff --git a/lib/arch/CArchMultithreadPosix.cpp b/src/lib/arch/CArchMultithreadPosix.cpp similarity index 100% rename from lib/arch/CArchMultithreadPosix.cpp rename to src/lib/arch/CArchMultithreadPosix.cpp diff --git a/lib/arch/CArchMultithreadPosix.h b/src/lib/arch/CArchMultithreadPosix.h similarity index 100% rename from lib/arch/CArchMultithreadPosix.h rename to src/lib/arch/CArchMultithreadPosix.h diff --git a/lib/arch/CArchMultithreadWindows.cpp b/src/lib/arch/CArchMultithreadWindows.cpp similarity index 100% rename from lib/arch/CArchMultithreadWindows.cpp rename to src/lib/arch/CArchMultithreadWindows.cpp diff --git a/lib/arch/CArchMultithreadWindows.h b/src/lib/arch/CArchMultithreadWindows.h similarity index 100% rename from lib/arch/CArchMultithreadWindows.h rename to src/lib/arch/CArchMultithreadWindows.h diff --git a/lib/arch/CArchNetworkBSD.cpp b/src/lib/arch/CArchNetworkBSD.cpp similarity index 100% rename from lib/arch/CArchNetworkBSD.cpp rename to src/lib/arch/CArchNetworkBSD.cpp diff --git a/lib/arch/CArchNetworkBSD.h b/src/lib/arch/CArchNetworkBSD.h similarity index 100% rename from lib/arch/CArchNetworkBSD.h rename to src/lib/arch/CArchNetworkBSD.h diff --git a/lib/arch/CArchNetworkWinsock.cpp b/src/lib/arch/CArchNetworkWinsock.cpp similarity index 100% rename from lib/arch/CArchNetworkWinsock.cpp rename to src/lib/arch/CArchNetworkWinsock.cpp diff --git a/lib/arch/CArchNetworkWinsock.h b/src/lib/arch/CArchNetworkWinsock.h similarity index 100% rename from lib/arch/CArchNetworkWinsock.h rename to src/lib/arch/CArchNetworkWinsock.h diff --git a/lib/arch/CArchSleepUnix.cpp b/src/lib/arch/CArchSleepUnix.cpp similarity index 100% rename from lib/arch/CArchSleepUnix.cpp rename to src/lib/arch/CArchSleepUnix.cpp diff --git a/lib/arch/CArchSleepUnix.h b/src/lib/arch/CArchSleepUnix.h similarity index 100% rename from lib/arch/CArchSleepUnix.h rename to src/lib/arch/CArchSleepUnix.h diff --git a/lib/arch/CArchSleepWindows.cpp b/src/lib/arch/CArchSleepWindows.cpp similarity index 100% rename from lib/arch/CArchSleepWindows.cpp rename to src/lib/arch/CArchSleepWindows.cpp diff --git a/lib/arch/CArchSleepWindows.h b/src/lib/arch/CArchSleepWindows.h similarity index 100% rename from lib/arch/CArchSleepWindows.h rename to src/lib/arch/CArchSleepWindows.h diff --git a/lib/arch/CArchStringUnix.cpp b/src/lib/arch/CArchStringUnix.cpp similarity index 100% rename from lib/arch/CArchStringUnix.cpp rename to src/lib/arch/CArchStringUnix.cpp diff --git a/lib/arch/CArchStringUnix.h b/src/lib/arch/CArchStringUnix.h similarity index 100% rename from lib/arch/CArchStringUnix.h rename to src/lib/arch/CArchStringUnix.h diff --git a/lib/arch/CArchStringWindows.cpp b/src/lib/arch/CArchStringWindows.cpp similarity index 100% rename from lib/arch/CArchStringWindows.cpp rename to src/lib/arch/CArchStringWindows.cpp diff --git a/lib/arch/CArchStringWindows.h b/src/lib/arch/CArchStringWindows.h similarity index 100% rename from lib/arch/CArchStringWindows.h rename to src/lib/arch/CArchStringWindows.h diff --git a/lib/arch/CArchSystemUnix.cpp b/src/lib/arch/CArchSystemUnix.cpp similarity index 100% rename from lib/arch/CArchSystemUnix.cpp rename to src/lib/arch/CArchSystemUnix.cpp diff --git a/lib/arch/CArchSystemUnix.h b/src/lib/arch/CArchSystemUnix.h similarity index 100% rename from lib/arch/CArchSystemUnix.h rename to src/lib/arch/CArchSystemUnix.h diff --git a/lib/arch/CArchSystemWindows.cpp b/src/lib/arch/CArchSystemWindows.cpp similarity index 100% rename from lib/arch/CArchSystemWindows.cpp rename to src/lib/arch/CArchSystemWindows.cpp diff --git a/lib/arch/CArchSystemWindows.h b/src/lib/arch/CArchSystemWindows.h similarity index 100% rename from lib/arch/CArchSystemWindows.h rename to src/lib/arch/CArchSystemWindows.h diff --git a/lib/arch/CArchTaskBarWindows.cpp b/src/lib/arch/CArchTaskBarWindows.cpp similarity index 100% rename from lib/arch/CArchTaskBarWindows.cpp rename to src/lib/arch/CArchTaskBarWindows.cpp diff --git a/lib/arch/CArchTaskBarWindows.h b/src/lib/arch/CArchTaskBarWindows.h similarity index 100% rename from lib/arch/CArchTaskBarWindows.h rename to src/lib/arch/CArchTaskBarWindows.h diff --git a/lib/arch/CArchTaskBarXWindows.cpp b/src/lib/arch/CArchTaskBarXWindows.cpp similarity index 100% rename from lib/arch/CArchTaskBarXWindows.cpp rename to src/lib/arch/CArchTaskBarXWindows.cpp diff --git a/lib/arch/CArchTaskBarXWindows.h b/src/lib/arch/CArchTaskBarXWindows.h similarity index 100% rename from lib/arch/CArchTaskBarXWindows.h rename to src/lib/arch/CArchTaskBarXWindows.h diff --git a/lib/arch/CArchTimeUnix.cpp b/src/lib/arch/CArchTimeUnix.cpp similarity index 100% rename from lib/arch/CArchTimeUnix.cpp rename to src/lib/arch/CArchTimeUnix.cpp diff --git a/lib/arch/CArchTimeUnix.h b/src/lib/arch/CArchTimeUnix.h similarity index 100% rename from lib/arch/CArchTimeUnix.h rename to src/lib/arch/CArchTimeUnix.h diff --git a/lib/arch/CArchTimeWindows.cpp b/src/lib/arch/CArchTimeWindows.cpp similarity index 100% rename from lib/arch/CArchTimeWindows.cpp rename to src/lib/arch/CArchTimeWindows.cpp diff --git a/lib/arch/CArchTimeWindows.h b/src/lib/arch/CArchTimeWindows.h similarity index 100% rename from lib/arch/CArchTimeWindows.h rename to src/lib/arch/CArchTimeWindows.h diff --git a/src/lib/arch/CMakeLists.txt b/src/lib/arch/CMakeLists.txt new file mode 100644 index 00000000..3e6ae546 --- /dev/null +++ b/src/lib/arch/CMakeLists.txt @@ -0,0 +1,93 @@ +# 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 . + +set(src + CArchAppUtil.cpp + CArch.cpp + CArchDaemonNone.cpp + XArch.cpp + CArchConsoleStd.cpp +) + +if (WIN32) + + set(inc + CArchAppUtil.h + CArchAppUtilWindows.h + CArchConsoleWindows.h + CArchDaemonWindows.h + CArchFileWindows.h + CArchLogWindows.h + CArchMiscWindows.h + CArchMultithreadWindows.h + CArchNetworkWinsock.h + CArchSleepWindows.h + CArchStringWindows.h + CArchSystemWindows.h + CArchTaskBarWindows.h + CArchTimeWindows.h + CArchConsoleStd.h + IArchAppUtil.h + XArchWindows.h + ) + + list(APPEND src + ${inc} + CArchAppUtilWindows.cpp + CArchConsoleWindows.cpp + CArchDaemonWindows.cpp + CArchFileWindows.cpp + CArchLogWindows.cpp + CArchMiscWindows.cpp + CArchMultithreadWindows.cpp + CArchNetworkWinsock.cpp + CArchSleepWindows.cpp + CArchStringWindows.cpp + CArchSystemWindows.cpp + CArchTaskBarWindows.cpp + CArchTimeWindows.cpp + XArchWindows.cpp + ) + +elseif (UNIX) + + list(APPEND src + CArchAppUtilUnix.cpp + CArchConsoleUnix.cpp + CArchDaemonUnix.cpp + CArchFileUnix.cpp + CArchLogUnix.cpp + CArchMultithreadPosix.cpp + CArchNetworkBSD.cpp + CArchSleepUnix.cpp + CArchStringUnix.cpp + CArchSystemUnix.cpp + CArchTaskBarXWindows.cpp + CArchTimeUnix.cpp + XArchUnix.cpp + ) + +endif() + +set(inc + ../base + ../common + ../mt + ../platform + ../synergy +) + +include_directories(${inc}) +add_library(libarch STATIC ${src}) diff --git a/lib/arch/CMultibyte.cpp b/src/lib/arch/CMultibyte.cpp similarity index 100% rename from lib/arch/CMultibyte.cpp rename to src/lib/arch/CMultibyte.cpp diff --git a/lib/arch/IArchAppUtil.h b/src/lib/arch/IArchAppUtil.h similarity index 100% rename from lib/arch/IArchAppUtil.h rename to src/lib/arch/IArchAppUtil.h diff --git a/lib/arch/IArchConsole.h b/src/lib/arch/IArchConsole.h similarity index 100% rename from lib/arch/IArchConsole.h rename to src/lib/arch/IArchConsole.h diff --git a/lib/arch/IArchDaemon.h b/src/lib/arch/IArchDaemon.h similarity index 100% rename from lib/arch/IArchDaemon.h rename to src/lib/arch/IArchDaemon.h diff --git a/lib/arch/IArchFile.h b/src/lib/arch/IArchFile.h similarity index 100% rename from lib/arch/IArchFile.h rename to src/lib/arch/IArchFile.h diff --git a/lib/arch/IArchLog.h b/src/lib/arch/IArchLog.h similarity index 100% rename from lib/arch/IArchLog.h rename to src/lib/arch/IArchLog.h diff --git a/lib/arch/IArchMultithread.h b/src/lib/arch/IArchMultithread.h similarity index 100% rename from lib/arch/IArchMultithread.h rename to src/lib/arch/IArchMultithread.h diff --git a/lib/arch/IArchNetwork.h b/src/lib/arch/IArchNetwork.h similarity index 100% rename from lib/arch/IArchNetwork.h rename to src/lib/arch/IArchNetwork.h diff --git a/lib/arch/IArchSleep.h b/src/lib/arch/IArchSleep.h similarity index 100% rename from lib/arch/IArchSleep.h rename to src/lib/arch/IArchSleep.h diff --git a/lib/arch/IArchString.h b/src/lib/arch/IArchString.h similarity index 100% rename from lib/arch/IArchString.h rename to src/lib/arch/IArchString.h diff --git a/lib/arch/IArchSystem.h b/src/lib/arch/IArchSystem.h similarity index 100% rename from lib/arch/IArchSystem.h rename to src/lib/arch/IArchSystem.h diff --git a/lib/arch/IArchTaskBar.h b/src/lib/arch/IArchTaskBar.h similarity index 100% rename from lib/arch/IArchTaskBar.h rename to src/lib/arch/IArchTaskBar.h diff --git a/lib/arch/IArchTaskBarReceiver.h b/src/lib/arch/IArchTaskBarReceiver.h similarity index 100% rename from lib/arch/IArchTaskBarReceiver.h rename to src/lib/arch/IArchTaskBarReceiver.h diff --git a/lib/arch/IArchTime.h b/src/lib/arch/IArchTime.h similarity index 100% rename from lib/arch/IArchTime.h rename to src/lib/arch/IArchTime.h diff --git a/lib/arch/XArch.cpp b/src/lib/arch/XArch.cpp similarity index 100% rename from lib/arch/XArch.cpp rename to src/lib/arch/XArch.cpp diff --git a/lib/arch/XArch.h b/src/lib/arch/XArch.h similarity index 100% rename from lib/arch/XArch.h rename to src/lib/arch/XArch.h diff --git a/lib/arch/XArchUnix.cpp b/src/lib/arch/XArchUnix.cpp similarity index 100% rename from lib/arch/XArchUnix.cpp rename to src/lib/arch/XArchUnix.cpp diff --git a/lib/arch/XArchUnix.h b/src/lib/arch/XArchUnix.h similarity index 100% rename from lib/arch/XArchUnix.h rename to src/lib/arch/XArchUnix.h diff --git a/lib/arch/XArchWindows.cpp b/src/lib/arch/XArchWindows.cpp similarity index 100% rename from lib/arch/XArchWindows.cpp rename to src/lib/arch/XArchWindows.cpp diff --git a/lib/arch/XArchWindows.h b/src/lib/arch/XArchWindows.h similarity index 100% rename from lib/arch/XArchWindows.h rename to src/lib/arch/XArchWindows.h diff --git a/lib/arch/vsnprintf.cpp b/src/lib/arch/vsnprintf.cpp similarity index 100% rename from lib/arch/vsnprintf.cpp rename to src/lib/arch/vsnprintf.cpp diff --git a/lib/base/CEvent.cpp b/src/lib/base/CEvent.cpp similarity index 100% rename from lib/base/CEvent.cpp rename to src/lib/base/CEvent.cpp diff --git a/lib/base/CEvent.h b/src/lib/base/CEvent.h similarity index 100% rename from lib/base/CEvent.h rename to src/lib/base/CEvent.h diff --git a/lib/base/CEventQueue.cpp b/src/lib/base/CEventQueue.cpp similarity index 100% rename from lib/base/CEventQueue.cpp rename to src/lib/base/CEventQueue.cpp diff --git a/lib/base/CEventQueue.h b/src/lib/base/CEventQueue.h similarity index 100% rename from lib/base/CEventQueue.h rename to src/lib/base/CEventQueue.h diff --git a/lib/base/CFunctionEventJob.cpp b/src/lib/base/CFunctionEventJob.cpp similarity index 100% rename from lib/base/CFunctionEventJob.cpp rename to src/lib/base/CFunctionEventJob.cpp diff --git a/lib/base/CFunctionEventJob.h b/src/lib/base/CFunctionEventJob.h similarity index 100% rename from lib/base/CFunctionEventJob.h rename to src/lib/base/CFunctionEventJob.h diff --git a/lib/base/CFunctionJob.cpp b/src/lib/base/CFunctionJob.cpp similarity index 100% rename from lib/base/CFunctionJob.cpp rename to src/lib/base/CFunctionJob.cpp diff --git a/lib/base/CFunctionJob.h b/src/lib/base/CFunctionJob.h similarity index 100% rename from lib/base/CFunctionJob.h rename to src/lib/base/CFunctionJob.h diff --git a/lib/base/CLog.cpp b/src/lib/base/CLog.cpp similarity index 100% rename from lib/base/CLog.cpp rename to src/lib/base/CLog.cpp diff --git a/lib/base/CLog.h b/src/lib/base/CLog.h similarity index 100% rename from lib/base/CLog.h rename to src/lib/base/CLog.h diff --git a/src/lib/base/CMakeLists.txt b/src/lib/base/CMakeLists.txt new file mode 100644 index 00000000..7a598593 --- /dev/null +++ b/src/lib/base/CMakeLists.txt @@ -0,0 +1,66 @@ +# 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 . + +set(inc + CEvent.h + CEventQueue.h + CFunctionEventJob.h + CFunctionJob.h + CLog.h + CPriorityQueue.h + CSimpleEventQueueBuffer.h + CStopwatch.h + CString.h + CStringUtil.h + CUnicode.h + IEventJob.h + IEventQueue.h + IEventQueueBuffer.h + IJob.h + ILogOutputter.h + LogOutputters.h + TMethodEventJob.h + TMethodJob.h + XBase.h +) + +set(src + CEvent.cpp + CEventQueue.cpp + CFunctionEventJob.cpp + CFunctionJob.cpp + CLog.cpp + CSimpleEventQueueBuffer.cpp + CStopwatch.cpp + CStringUtil.cpp + CUnicode.cpp + IEventQueue.cpp + LogOutputters.cpp + XBase.cpp +) + +if (WIN32) + list(APPEND src ${inc}) +endif() + +set(inc + ../arch + ../common + ../mt + ../synergy +) + +include_directories(${inc}) +add_library(libbase STATIC ${src}) diff --git a/lib/base/CPriorityQueue.h b/src/lib/base/CPriorityQueue.h similarity index 100% rename from lib/base/CPriorityQueue.h rename to src/lib/base/CPriorityQueue.h diff --git a/lib/base/CSimpleEventQueueBuffer.cpp b/src/lib/base/CSimpleEventQueueBuffer.cpp similarity index 100% rename from lib/base/CSimpleEventQueueBuffer.cpp rename to src/lib/base/CSimpleEventQueueBuffer.cpp diff --git a/lib/base/CSimpleEventQueueBuffer.h b/src/lib/base/CSimpleEventQueueBuffer.h similarity index 100% rename from lib/base/CSimpleEventQueueBuffer.h rename to src/lib/base/CSimpleEventQueueBuffer.h diff --git a/lib/base/CStopwatch.cpp b/src/lib/base/CStopwatch.cpp similarity index 100% rename from lib/base/CStopwatch.cpp rename to src/lib/base/CStopwatch.cpp diff --git a/lib/base/CStopwatch.h b/src/lib/base/CStopwatch.h similarity index 100% rename from lib/base/CStopwatch.h rename to src/lib/base/CStopwatch.h diff --git a/lib/base/CString.h b/src/lib/base/CString.h similarity index 100% rename from lib/base/CString.h rename to src/lib/base/CString.h diff --git a/lib/base/CStringUtil.cpp b/src/lib/base/CStringUtil.cpp similarity index 100% rename from lib/base/CStringUtil.cpp rename to src/lib/base/CStringUtil.cpp diff --git a/lib/base/CStringUtil.h b/src/lib/base/CStringUtil.h similarity index 100% rename from lib/base/CStringUtil.h rename to src/lib/base/CStringUtil.h diff --git a/lib/base/CUnicode.cpp b/src/lib/base/CUnicode.cpp similarity index 100% rename from lib/base/CUnicode.cpp rename to src/lib/base/CUnicode.cpp diff --git a/lib/base/CUnicode.h b/src/lib/base/CUnicode.h similarity index 100% rename from lib/base/CUnicode.h rename to src/lib/base/CUnicode.h diff --git a/lib/base/IEventJob.h b/src/lib/base/IEventJob.h similarity index 100% rename from lib/base/IEventJob.h rename to src/lib/base/IEventJob.h diff --git a/lib/base/IEventQueue.cpp b/src/lib/base/IEventQueue.cpp similarity index 100% rename from lib/base/IEventQueue.cpp rename to src/lib/base/IEventQueue.cpp diff --git a/lib/base/IEventQueue.h b/src/lib/base/IEventQueue.h similarity index 100% rename from lib/base/IEventQueue.h rename to src/lib/base/IEventQueue.h diff --git a/lib/base/IEventQueueBuffer.h b/src/lib/base/IEventQueueBuffer.h similarity index 100% rename from lib/base/IEventQueueBuffer.h rename to src/lib/base/IEventQueueBuffer.h diff --git a/lib/base/IJob.h b/src/lib/base/IJob.h similarity index 100% rename from lib/base/IJob.h rename to src/lib/base/IJob.h diff --git a/lib/base/ILogOutputter.h b/src/lib/base/ILogOutputter.h similarity index 100% rename from lib/base/ILogOutputter.h rename to src/lib/base/ILogOutputter.h diff --git a/lib/base/LogOutputters.cpp b/src/lib/base/LogOutputters.cpp similarity index 100% rename from lib/base/LogOutputters.cpp rename to src/lib/base/LogOutputters.cpp diff --git a/lib/base/LogOutputters.h b/src/lib/base/LogOutputters.h similarity index 100% rename from lib/base/LogOutputters.h rename to src/lib/base/LogOutputters.h diff --git a/lib/base/TMethodEventJob.h b/src/lib/base/TMethodEventJob.h similarity index 100% rename from lib/base/TMethodEventJob.h rename to src/lib/base/TMethodEventJob.h diff --git a/lib/base/TMethodJob.h b/src/lib/base/TMethodJob.h similarity index 100% rename from lib/base/TMethodJob.h rename to src/lib/base/TMethodJob.h diff --git a/lib/base/XBase.cpp b/src/lib/base/XBase.cpp similarity index 100% rename from lib/base/XBase.cpp rename to src/lib/base/XBase.cpp diff --git a/lib/base/XBase.h b/src/lib/base/XBase.h similarity index 100% rename from lib/base/XBase.h rename to src/lib/base/XBase.h diff --git a/lib/client/CClient.cpp b/src/lib/client/CClient.cpp similarity index 100% rename from lib/client/CClient.cpp rename to src/lib/client/CClient.cpp diff --git a/lib/client/CClient.h b/src/lib/client/CClient.h similarity index 100% rename from lib/client/CClient.h rename to src/lib/client/CClient.h diff --git a/src/lib/client/CMakeLists.txt b/src/lib/client/CMakeLists.txt new file mode 100644 index 00000000..7edeccf7 --- /dev/null +++ b/src/lib/client/CMakeLists.txt @@ -0,0 +1,41 @@ +# 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 . + +set(inc + CClient.h + CServerProxy.h +) + +set(src + CClient.cpp + CServerProxy.cpp +) + +if (WIN32) + list(APPEND src ${inc}) +endif() + +set(inc + ../arch + ../base + ../common + ../io + ../mt + ../net + ../synergy +) + +include_directories(${inc}) +add_library(libclient STATIC ${src}) diff --git a/lib/client/CServerProxy.cpp b/src/lib/client/CServerProxy.cpp similarity index 100% rename from lib/client/CServerProxy.cpp rename to src/lib/client/CServerProxy.cpp diff --git a/lib/client/CServerProxy.h b/src/lib/client/CServerProxy.h similarity index 100% rename from lib/client/CServerProxy.h rename to src/lib/client/CServerProxy.h diff --git a/lib/common/BasicTypes.h b/src/lib/common/BasicTypes.h similarity index 100% rename from lib/common/BasicTypes.h rename to src/lib/common/BasicTypes.h diff --git a/cmake/CMakeLists_doxygen.txt b/src/lib/common/CMakeLists.txt similarity index 80% rename from cmake/CMakeLists_doxygen.txt rename to src/lib/common/CMakeLists.txt index c60ad525..0a92103e 100644 --- a/cmake/CMakeLists_doxygen.txt +++ b/src/lib/common/CMakeLists.txt @@ -13,7 +13,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set(VERSION, "${VERSION}") +set(inc + Version.h +) -# For doxygen.cfg, save the results based on a template (doxygen.cfg.in). -configure_file(${cmake_dir}/doxygen.cfg.in ${doc_dir}/doxygen.cfg) +set(src + Version.cpp +) + +if (WIN32) + list(APPEND src ${inc}) +endif() + +add_library(libcommon STATIC ${src}) diff --git a/lib/common/IInterface.h b/src/lib/common/IInterface.h similarity index 100% rename from lib/common/IInterface.h rename to src/lib/common/IInterface.h diff --git a/lib/common/MacOSXPrecomp.h b/src/lib/common/MacOSXPrecomp.h similarity index 100% rename from lib/common/MacOSXPrecomp.h rename to src/lib/common/MacOSXPrecomp.h diff --git a/lib/common/Version.cpp b/src/lib/common/Version.cpp similarity index 100% rename from lib/common/Version.cpp rename to src/lib/common/Version.cpp diff --git a/lib/common/Version.h b/src/lib/common/Version.h similarity index 100% rename from lib/common/Version.h rename to src/lib/common/Version.h diff --git a/lib/common/common.h b/src/lib/common/common.h similarity index 100% rename from lib/common/common.h rename to src/lib/common/common.h diff --git a/lib/common/stdbitset.h b/src/lib/common/stdbitset.h similarity index 100% rename from lib/common/stdbitset.h rename to src/lib/common/stdbitset.h diff --git a/lib/common/stddeque.h b/src/lib/common/stddeque.h similarity index 100% rename from lib/common/stddeque.h rename to src/lib/common/stddeque.h diff --git a/lib/common/stdfstream.h b/src/lib/common/stdfstream.h similarity index 100% rename from lib/common/stdfstream.h rename to src/lib/common/stdfstream.h diff --git a/lib/common/stdistream.h b/src/lib/common/stdistream.h similarity index 100% rename from lib/common/stdistream.h rename to src/lib/common/stdistream.h diff --git a/lib/common/stdlist.h b/src/lib/common/stdlist.h similarity index 100% rename from lib/common/stdlist.h rename to src/lib/common/stdlist.h diff --git a/lib/common/stdmap.h b/src/lib/common/stdmap.h similarity index 100% rename from lib/common/stdmap.h rename to src/lib/common/stdmap.h diff --git a/lib/common/stdostream.h b/src/lib/common/stdostream.h similarity index 100% rename from lib/common/stdostream.h rename to src/lib/common/stdostream.h diff --git a/lib/common/stdpost.h b/src/lib/common/stdpost.h similarity index 100% rename from lib/common/stdpost.h rename to src/lib/common/stdpost.h diff --git a/lib/common/stdpre.h b/src/lib/common/stdpre.h similarity index 100% rename from lib/common/stdpre.h rename to src/lib/common/stdpre.h diff --git a/lib/common/stdset.h b/src/lib/common/stdset.h similarity index 100% rename from lib/common/stdset.h rename to src/lib/common/stdset.h diff --git a/lib/common/stdsstream.h b/src/lib/common/stdsstream.h similarity index 100% rename from lib/common/stdsstream.h rename to src/lib/common/stdsstream.h diff --git a/lib/common/stdstring.h b/src/lib/common/stdstring.h similarity index 100% rename from lib/common/stdstring.h rename to src/lib/common/stdstring.h diff --git a/lib/common/stdvector.h b/src/lib/common/stdvector.h similarity index 100% rename from lib/common/stdvector.h rename to src/lib/common/stdvector.h diff --git a/src/lib/io/CMakeLists.txt b/src/lib/io/CMakeLists.txt new file mode 100644 index 00000000..95290b6a --- /dev/null +++ b/src/lib/io/CMakeLists.txt @@ -0,0 +1,41 @@ +# 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 . + +set(inc + CStreamBuffer.h + CStreamFilter.h + IStream.h + IStreamFilterFactory.h + XIO.h +) + +set(src + CStreamBuffer.cpp + CStreamFilter.cpp + IStream.cpp + XIO.cpp +) + +if (WIN32) + list(APPEND src ${inc}) +endif() + +set(inc + ../base + ../common +) + +include_directories(${inc}) +add_library(libio STATIC ${src}) diff --git a/lib/io/CStreamBuffer.cpp b/src/lib/io/CStreamBuffer.cpp similarity index 100% rename from lib/io/CStreamBuffer.cpp rename to src/lib/io/CStreamBuffer.cpp diff --git a/lib/io/CStreamBuffer.h b/src/lib/io/CStreamBuffer.h similarity index 100% rename from lib/io/CStreamBuffer.h rename to src/lib/io/CStreamBuffer.h diff --git a/lib/io/CStreamFilter.cpp b/src/lib/io/CStreamFilter.cpp similarity index 100% rename from lib/io/CStreamFilter.cpp rename to src/lib/io/CStreamFilter.cpp diff --git a/lib/io/CStreamFilter.h b/src/lib/io/CStreamFilter.h similarity index 100% rename from lib/io/CStreamFilter.h rename to src/lib/io/CStreamFilter.h diff --git a/lib/io/IStream.cpp b/src/lib/io/IStream.cpp similarity index 100% rename from lib/io/IStream.cpp rename to src/lib/io/IStream.cpp diff --git a/lib/io/IStream.h b/src/lib/io/IStream.h similarity index 100% rename from lib/io/IStream.h rename to src/lib/io/IStream.h diff --git a/lib/io/IStreamFilterFactory.h b/src/lib/io/IStreamFilterFactory.h similarity index 100% rename from lib/io/IStreamFilterFactory.h rename to src/lib/io/IStreamFilterFactory.h diff --git a/lib/io/XIO.cpp b/src/lib/io/XIO.cpp similarity index 100% rename from lib/io/XIO.cpp rename to src/lib/io/XIO.cpp diff --git a/lib/io/XIO.h b/src/lib/io/XIO.h similarity index 100% rename from lib/io/XIO.h rename to src/lib/io/XIO.h diff --git a/lib/mt/CCondVar.cpp b/src/lib/mt/CCondVar.cpp similarity index 100% rename from lib/mt/CCondVar.cpp rename to src/lib/mt/CCondVar.cpp diff --git a/lib/mt/CCondVar.h b/src/lib/mt/CCondVar.h similarity index 100% rename from lib/mt/CCondVar.h rename to src/lib/mt/CCondVar.h diff --git a/lib/mt/CLock.cpp b/src/lib/mt/CLock.cpp similarity index 100% rename from lib/mt/CLock.cpp rename to src/lib/mt/CLock.cpp diff --git a/lib/mt/CLock.h b/src/lib/mt/CLock.h similarity index 100% rename from lib/mt/CLock.h rename to src/lib/mt/CLock.h diff --git a/src/lib/mt/CMakeLists.txt b/src/lib/mt/CMakeLists.txt new file mode 100644 index 00000000..0c35e62a --- /dev/null +++ b/src/lib/mt/CMakeLists.txt @@ -0,0 +1,45 @@ +# 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 . + +set(inc + CCondVar.h + CLock.h + CMutex.h + CThread.h + XMT.h + XThread.h +) + +set(src + CCondVar.cpp + CLock.cpp + CMutex.cpp + CThread.cpp + XMT.cpp +) + +if (WIN32) + list(APPEND src ${inc}) +endif() + +set(inc + ../arch + ../base + ../common + ../synergy +) + +include_directories(${inc}) +add_library(libmt STATIC ${src}) diff --git a/lib/mt/CMutex.cpp b/src/lib/mt/CMutex.cpp similarity index 100% rename from lib/mt/CMutex.cpp rename to src/lib/mt/CMutex.cpp diff --git a/lib/mt/CMutex.h b/src/lib/mt/CMutex.h similarity index 100% rename from lib/mt/CMutex.h rename to src/lib/mt/CMutex.h diff --git a/lib/mt/CThread.cpp b/src/lib/mt/CThread.cpp similarity index 100% rename from lib/mt/CThread.cpp rename to src/lib/mt/CThread.cpp diff --git a/lib/mt/CThread.h b/src/lib/mt/CThread.h similarity index 100% rename from lib/mt/CThread.h rename to src/lib/mt/CThread.h diff --git a/lib/mt/XMT.cpp b/src/lib/mt/XMT.cpp similarity index 100% rename from lib/mt/XMT.cpp rename to src/lib/mt/XMT.cpp diff --git a/lib/mt/XMT.h b/src/lib/mt/XMT.h similarity index 100% rename from lib/mt/XMT.h rename to src/lib/mt/XMT.h diff --git a/lib/mt/XThread.h b/src/lib/mt/XThread.h similarity index 100% rename from lib/mt/XThread.h rename to src/lib/mt/XThread.h diff --git a/src/lib/net/CMakeLists.txt b/src/lib/net/CMakeLists.txt new file mode 100644 index 00000000..ecce8cd6 --- /dev/null +++ b/src/lib/net/CMakeLists.txt @@ -0,0 +1,57 @@ +# 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 . + +set(inc + CNetworkAddress.h + CSocketMultiplexer.h + CTCPListenSocket.h + CTCPSocket.h + CTCPSocketFactory.h + IDataSocket.h + IListenSocket.h + ISocket.h + ISocketFactory.h + ISocketMultiplexerJob.h + TSocketMultiplexerMethodJob.h + XSocket.h +) + +set(src + CNetworkAddress.cpp + CSocketMultiplexer.cpp + CTCPListenSocket.cpp + CTCPSocket.cpp + CTCPSocketFactory.cpp + IDataSocket.cpp + IListenSocket.cpp + ISocket.cpp + XSocket.cpp +) + +if (WIN32) + list(APPEND src ${inc}) +endif() + +set(inc + ../arch + ../base + ../common + ../io + ../mt + ../synergy +) + +include_directories(${inc}) +add_library(libnet STATIC ${src}) diff --git a/lib/net/CNetworkAddress.cpp b/src/lib/net/CNetworkAddress.cpp similarity index 100% rename from lib/net/CNetworkAddress.cpp rename to src/lib/net/CNetworkAddress.cpp diff --git a/lib/net/CNetworkAddress.h b/src/lib/net/CNetworkAddress.h similarity index 100% rename from lib/net/CNetworkAddress.h rename to src/lib/net/CNetworkAddress.h diff --git a/lib/net/CSocketMultiplexer.cpp b/src/lib/net/CSocketMultiplexer.cpp similarity index 100% rename from lib/net/CSocketMultiplexer.cpp rename to src/lib/net/CSocketMultiplexer.cpp diff --git a/lib/net/CSocketMultiplexer.h b/src/lib/net/CSocketMultiplexer.h similarity index 100% rename from lib/net/CSocketMultiplexer.h rename to src/lib/net/CSocketMultiplexer.h diff --git a/lib/net/CTCPListenSocket.cpp b/src/lib/net/CTCPListenSocket.cpp similarity index 100% rename from lib/net/CTCPListenSocket.cpp rename to src/lib/net/CTCPListenSocket.cpp diff --git a/lib/net/CTCPListenSocket.h b/src/lib/net/CTCPListenSocket.h similarity index 100% rename from lib/net/CTCPListenSocket.h rename to src/lib/net/CTCPListenSocket.h diff --git a/lib/net/CTCPSocket.cpp b/src/lib/net/CTCPSocket.cpp similarity index 100% rename from lib/net/CTCPSocket.cpp rename to src/lib/net/CTCPSocket.cpp diff --git a/lib/net/CTCPSocket.h b/src/lib/net/CTCPSocket.h similarity index 100% rename from lib/net/CTCPSocket.h rename to src/lib/net/CTCPSocket.h diff --git a/lib/net/CTCPSocketFactory.cpp b/src/lib/net/CTCPSocketFactory.cpp similarity index 100% rename from lib/net/CTCPSocketFactory.cpp rename to src/lib/net/CTCPSocketFactory.cpp diff --git a/lib/net/CTCPSocketFactory.h b/src/lib/net/CTCPSocketFactory.h similarity index 100% rename from lib/net/CTCPSocketFactory.h rename to src/lib/net/CTCPSocketFactory.h diff --git a/lib/net/IDataSocket.cpp b/src/lib/net/IDataSocket.cpp similarity index 100% rename from lib/net/IDataSocket.cpp rename to src/lib/net/IDataSocket.cpp diff --git a/lib/net/IDataSocket.h b/src/lib/net/IDataSocket.h similarity index 100% rename from lib/net/IDataSocket.h rename to src/lib/net/IDataSocket.h diff --git a/lib/net/IListenSocket.cpp b/src/lib/net/IListenSocket.cpp similarity index 100% rename from lib/net/IListenSocket.cpp rename to src/lib/net/IListenSocket.cpp diff --git a/lib/net/IListenSocket.h b/src/lib/net/IListenSocket.h similarity index 100% rename from lib/net/IListenSocket.h rename to src/lib/net/IListenSocket.h diff --git a/lib/net/ISocket.cpp b/src/lib/net/ISocket.cpp similarity index 100% rename from lib/net/ISocket.cpp rename to src/lib/net/ISocket.cpp diff --git a/lib/net/ISocket.h b/src/lib/net/ISocket.h similarity index 100% rename from lib/net/ISocket.h rename to src/lib/net/ISocket.h diff --git a/lib/net/ISocketFactory.h b/src/lib/net/ISocketFactory.h similarity index 100% rename from lib/net/ISocketFactory.h rename to src/lib/net/ISocketFactory.h diff --git a/lib/net/ISocketMultiplexerJob.h b/src/lib/net/ISocketMultiplexerJob.h similarity index 100% rename from lib/net/ISocketMultiplexerJob.h rename to src/lib/net/ISocketMultiplexerJob.h diff --git a/lib/net/TSocketMultiplexerMethodJob.h b/src/lib/net/TSocketMultiplexerMethodJob.h similarity index 100% rename from lib/net/TSocketMultiplexerMethodJob.h rename to src/lib/net/TSocketMultiplexerMethodJob.h diff --git a/lib/net/XSocket.cpp b/src/lib/net/XSocket.cpp similarity index 100% rename from lib/net/XSocket.cpp rename to src/lib/net/XSocket.cpp diff --git a/lib/net/XSocket.h b/src/lib/net/XSocket.h similarity index 100% rename from lib/net/XSocket.h rename to src/lib/net/XSocket.h diff --git a/lib/platform/CMSWindowsClipboard.cpp b/src/lib/platform/CMSWindowsClipboard.cpp similarity index 100% rename from lib/platform/CMSWindowsClipboard.cpp rename to src/lib/platform/CMSWindowsClipboard.cpp diff --git a/lib/platform/CMSWindowsClipboard.h b/src/lib/platform/CMSWindowsClipboard.h similarity index 100% rename from lib/platform/CMSWindowsClipboard.h rename to src/lib/platform/CMSWindowsClipboard.h diff --git a/lib/platform/CMSWindowsClipboardAnyTextConverter.cpp b/src/lib/platform/CMSWindowsClipboardAnyTextConverter.cpp similarity index 100% rename from lib/platform/CMSWindowsClipboardAnyTextConverter.cpp rename to src/lib/platform/CMSWindowsClipboardAnyTextConverter.cpp diff --git a/lib/platform/CMSWindowsClipboardAnyTextConverter.h b/src/lib/platform/CMSWindowsClipboardAnyTextConverter.h similarity index 100% rename from lib/platform/CMSWindowsClipboardAnyTextConverter.h rename to src/lib/platform/CMSWindowsClipboardAnyTextConverter.h diff --git a/lib/platform/CMSWindowsClipboardBitmapConverter.cpp b/src/lib/platform/CMSWindowsClipboardBitmapConverter.cpp similarity index 100% rename from lib/platform/CMSWindowsClipboardBitmapConverter.cpp rename to src/lib/platform/CMSWindowsClipboardBitmapConverter.cpp diff --git a/lib/platform/CMSWindowsClipboardBitmapConverter.h b/src/lib/platform/CMSWindowsClipboardBitmapConverter.h similarity index 100% rename from lib/platform/CMSWindowsClipboardBitmapConverter.h rename to src/lib/platform/CMSWindowsClipboardBitmapConverter.h diff --git a/lib/platform/CMSWindowsClipboardHTMLConverter.cpp b/src/lib/platform/CMSWindowsClipboardHTMLConverter.cpp similarity index 100% rename from lib/platform/CMSWindowsClipboardHTMLConverter.cpp rename to src/lib/platform/CMSWindowsClipboardHTMLConverter.cpp diff --git a/lib/platform/CMSWindowsClipboardHTMLConverter.h b/src/lib/platform/CMSWindowsClipboardHTMLConverter.h similarity index 100% rename from lib/platform/CMSWindowsClipboardHTMLConverter.h rename to src/lib/platform/CMSWindowsClipboardHTMLConverter.h diff --git a/lib/platform/CMSWindowsClipboardTextConverter.cpp b/src/lib/platform/CMSWindowsClipboardTextConverter.cpp similarity index 100% rename from lib/platform/CMSWindowsClipboardTextConverter.cpp rename to src/lib/platform/CMSWindowsClipboardTextConverter.cpp diff --git a/lib/platform/CMSWindowsClipboardTextConverter.h b/src/lib/platform/CMSWindowsClipboardTextConverter.h similarity index 100% rename from lib/platform/CMSWindowsClipboardTextConverter.h rename to src/lib/platform/CMSWindowsClipboardTextConverter.h diff --git a/lib/platform/CMSWindowsClipboardUTF16Converter.cpp b/src/lib/platform/CMSWindowsClipboardUTF16Converter.cpp similarity index 100% rename from lib/platform/CMSWindowsClipboardUTF16Converter.cpp rename to src/lib/platform/CMSWindowsClipboardUTF16Converter.cpp diff --git a/lib/platform/CMSWindowsClipboardUTF16Converter.h b/src/lib/platform/CMSWindowsClipboardUTF16Converter.h similarity index 100% rename from lib/platform/CMSWindowsClipboardUTF16Converter.h rename to src/lib/platform/CMSWindowsClipboardUTF16Converter.h diff --git a/lib/platform/CMSWindowsDesks.cpp b/src/lib/platform/CMSWindowsDesks.cpp similarity index 100% rename from lib/platform/CMSWindowsDesks.cpp rename to src/lib/platform/CMSWindowsDesks.cpp diff --git a/lib/platform/CMSWindowsDesks.h b/src/lib/platform/CMSWindowsDesks.h similarity index 100% rename from lib/platform/CMSWindowsDesks.h rename to src/lib/platform/CMSWindowsDesks.h diff --git a/lib/platform/CMSWindowsEventQueueBuffer.cpp b/src/lib/platform/CMSWindowsEventQueueBuffer.cpp similarity index 100% rename from lib/platform/CMSWindowsEventQueueBuffer.cpp rename to src/lib/platform/CMSWindowsEventQueueBuffer.cpp diff --git a/lib/platform/CMSWindowsEventQueueBuffer.h b/src/lib/platform/CMSWindowsEventQueueBuffer.h similarity index 100% rename from lib/platform/CMSWindowsEventQueueBuffer.h rename to src/lib/platform/CMSWindowsEventQueueBuffer.h diff --git a/lib/platform/CMSWindowsKeyState.cpp b/src/lib/platform/CMSWindowsKeyState.cpp similarity index 100% rename from lib/platform/CMSWindowsKeyState.cpp rename to src/lib/platform/CMSWindowsKeyState.cpp diff --git a/lib/platform/CMSWindowsKeyState.h b/src/lib/platform/CMSWindowsKeyState.h similarity index 100% rename from lib/platform/CMSWindowsKeyState.h rename to src/lib/platform/CMSWindowsKeyState.h diff --git a/lib/platform/CMSWindowsRelauncher.cpp b/src/lib/platform/CMSWindowsRelauncher.cpp similarity index 100% rename from lib/platform/CMSWindowsRelauncher.cpp rename to src/lib/platform/CMSWindowsRelauncher.cpp diff --git a/lib/platform/CMSWindowsRelauncher.h b/src/lib/platform/CMSWindowsRelauncher.h similarity index 100% rename from lib/platform/CMSWindowsRelauncher.h rename to src/lib/platform/CMSWindowsRelauncher.h diff --git a/lib/platform/CMSWindowsScreen.cpp b/src/lib/platform/CMSWindowsScreen.cpp similarity index 100% rename from lib/platform/CMSWindowsScreen.cpp rename to src/lib/platform/CMSWindowsScreen.cpp diff --git a/lib/platform/CMSWindowsScreen.h b/src/lib/platform/CMSWindowsScreen.h similarity index 100% rename from lib/platform/CMSWindowsScreen.h rename to src/lib/platform/CMSWindowsScreen.h diff --git a/lib/platform/CMSWindowsScreenSaver.cpp b/src/lib/platform/CMSWindowsScreenSaver.cpp similarity index 100% rename from lib/platform/CMSWindowsScreenSaver.cpp rename to src/lib/platform/CMSWindowsScreenSaver.cpp diff --git a/lib/platform/CMSWindowsScreenSaver.h b/src/lib/platform/CMSWindowsScreenSaver.h similarity index 100% rename from lib/platform/CMSWindowsScreenSaver.h rename to src/lib/platform/CMSWindowsScreenSaver.h diff --git a/lib/platform/CMSWindowsUtil.cpp b/src/lib/platform/CMSWindowsUtil.cpp similarity index 100% rename from lib/platform/CMSWindowsUtil.cpp rename to src/lib/platform/CMSWindowsUtil.cpp diff --git a/lib/platform/CMSWindowsUtil.h b/src/lib/platform/CMSWindowsUtil.h similarity index 100% rename from lib/platform/CMSWindowsUtil.h rename to src/lib/platform/CMSWindowsUtil.h diff --git a/src/lib/platform/CMakeLists.txt b/src/lib/platform/CMakeLists.txt new file mode 100644 index 00000000..9d71a808 --- /dev/null +++ b/src/lib/platform/CMakeLists.txt @@ -0,0 +1,105 @@ +# 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 . + +if (WIN32) + + set(inc + CMSWindowsClipboard.h + CMSWindowsClipboardAnyTextConverter.h + CMSWindowsClipboardBitmapConverter.h + CMSWindowsClipboardHTMLConverter.h + CMSWindowsClipboardTextConverter.h + CMSWindowsClipboardUTF16Converter.h + CMSWindowsDesks.h + CMSWindowsEventQueueBuffer.h + CMSWindowsKeyState.h + CMSWindowsScreen.h + CMSWindowsScreenSaver.h + CMSWindowsUtil.h + CMSWindowsRelauncher.h + ) + + set(src + ${inc} + CMSWindowsClipboard.cpp + CMSWindowsClipboardAnyTextConverter.cpp + CMSWindowsClipboardBitmapConverter.cpp + CMSWindowsClipboardHTMLConverter.cpp + CMSWindowsClipboardTextConverter.cpp + CMSWindowsClipboardUTF16Converter.cpp + CMSWindowsDesks.cpp + CMSWindowsEventQueueBuffer.cpp + CMSWindowsKeyState.cpp + CMSWindowsScreen.cpp + CMSWindowsScreenSaver.cpp + CMSWindowsUtil.cpp + CMSWindowsRelauncher.cpp + ) + + set(inc_hook + CSynergyHook.h + ) + + set(src_hook + CSynergyHook.cpp + ) + +elseif (APPLE) + + set(src + COSXClipboard.cpp + COSXClipboardAnyTextConverter.cpp + COSXClipboardTextConverter.cpp + COSXClipboardUTF16Converter.cpp + COSXEventQueueBuffer.cpp + COSXKeyState.cpp + COSXScreen.cpp + COSXScreenSaver.cpp + COSXScreenSaverUtil.m + ) + +elseif (UNIX) + + set(src + CXWindowsClipboard.cpp + CXWindowsClipboardAnyBitmapConverter.cpp + CXWindowsClipboardBMPConverter.cpp + CXWindowsClipboardHTMLConverter.cpp + CXWindowsClipboardTextConverter.cpp + CXWindowsClipboardUCS2Converter.cpp + CXWindowsClipboardUTF8Converter.cpp + CXWindowsEventQueueBuffer.cpp + CXWindowsKeyState.cpp + CXWindowsScreen.cpp + CXWindowsScreenSaver.cpp + CXWindowsUtil.cpp + ) + +endif() + +set(inc + ../arch + ../base + ../common + ../mt + ../synergy +) + +include_directories(${inc}) +add_library(libplatform STATIC ${src}) + +if (WIN32) + add_library(synrgyhk SHARED ${inc_hook} ${src_hook}) +endif() diff --git a/lib/platform/COSXClipboard.cpp b/src/lib/platform/COSXClipboard.cpp similarity index 100% rename from lib/platform/COSXClipboard.cpp rename to src/lib/platform/COSXClipboard.cpp diff --git a/lib/platform/COSXClipboard.h b/src/lib/platform/COSXClipboard.h similarity index 100% rename from lib/platform/COSXClipboard.h rename to src/lib/platform/COSXClipboard.h diff --git a/lib/platform/COSXClipboardAnyTextConverter.cpp b/src/lib/platform/COSXClipboardAnyTextConverter.cpp similarity index 100% rename from lib/platform/COSXClipboardAnyTextConverter.cpp rename to src/lib/platform/COSXClipboardAnyTextConverter.cpp diff --git a/lib/platform/COSXClipboardAnyTextConverter.h b/src/lib/platform/COSXClipboardAnyTextConverter.h similarity index 100% rename from lib/platform/COSXClipboardAnyTextConverter.h rename to src/lib/platform/COSXClipboardAnyTextConverter.h diff --git a/lib/platform/COSXClipboardTextConverter.cpp b/src/lib/platform/COSXClipboardTextConverter.cpp similarity index 100% rename from lib/platform/COSXClipboardTextConverter.cpp rename to src/lib/platform/COSXClipboardTextConverter.cpp diff --git a/lib/platform/COSXClipboardTextConverter.h b/src/lib/platform/COSXClipboardTextConverter.h similarity index 100% rename from lib/platform/COSXClipboardTextConverter.h rename to src/lib/platform/COSXClipboardTextConverter.h diff --git a/lib/platform/COSXClipboardUTF16Converter.cpp b/src/lib/platform/COSXClipboardUTF16Converter.cpp similarity index 100% rename from lib/platform/COSXClipboardUTF16Converter.cpp rename to src/lib/platform/COSXClipboardUTF16Converter.cpp diff --git a/lib/platform/COSXClipboardUTF16Converter.h b/src/lib/platform/COSXClipboardUTF16Converter.h similarity index 100% rename from lib/platform/COSXClipboardUTF16Converter.h rename to src/lib/platform/COSXClipboardUTF16Converter.h diff --git a/lib/platform/COSXEventQueueBuffer.cpp b/src/lib/platform/COSXEventQueueBuffer.cpp similarity index 100% rename from lib/platform/COSXEventQueueBuffer.cpp rename to src/lib/platform/COSXEventQueueBuffer.cpp diff --git a/lib/platform/COSXEventQueueBuffer.h b/src/lib/platform/COSXEventQueueBuffer.h similarity index 100% rename from lib/platform/COSXEventQueueBuffer.h rename to src/lib/platform/COSXEventQueueBuffer.h diff --git a/lib/platform/COSXKeyState.cpp b/src/lib/platform/COSXKeyState.cpp similarity index 100% rename from lib/platform/COSXKeyState.cpp rename to src/lib/platform/COSXKeyState.cpp diff --git a/lib/platform/COSXKeyState.h b/src/lib/platform/COSXKeyState.h similarity index 100% rename from lib/platform/COSXKeyState.h rename to src/lib/platform/COSXKeyState.h diff --git a/lib/platform/COSXScreen.cpp b/src/lib/platform/COSXScreen.cpp similarity index 100% rename from lib/platform/COSXScreen.cpp rename to src/lib/platform/COSXScreen.cpp diff --git a/lib/platform/COSXScreen.h b/src/lib/platform/COSXScreen.h similarity index 100% rename from lib/platform/COSXScreen.h rename to src/lib/platform/COSXScreen.h diff --git a/lib/platform/COSXScreenSaver.cpp b/src/lib/platform/COSXScreenSaver.cpp similarity index 100% rename from lib/platform/COSXScreenSaver.cpp rename to src/lib/platform/COSXScreenSaver.cpp diff --git a/lib/platform/COSXScreenSaver.h b/src/lib/platform/COSXScreenSaver.h similarity index 100% rename from lib/platform/COSXScreenSaver.h rename to src/lib/platform/COSXScreenSaver.h diff --git a/lib/platform/COSXScreenSaverUtil.h b/src/lib/platform/COSXScreenSaverUtil.h similarity index 100% rename from lib/platform/COSXScreenSaverUtil.h rename to src/lib/platform/COSXScreenSaverUtil.h diff --git a/lib/platform/COSXScreenSaverUtil.m b/src/lib/platform/COSXScreenSaverUtil.m similarity index 100% rename from lib/platform/COSXScreenSaverUtil.m rename to src/lib/platform/COSXScreenSaverUtil.m diff --git a/lib/platform/CSynergyHook.cpp b/src/lib/platform/CSynergyHook.cpp similarity index 100% rename from lib/platform/CSynergyHook.cpp rename to src/lib/platform/CSynergyHook.cpp diff --git a/lib/platform/CSynergyHook.h b/src/lib/platform/CSynergyHook.h similarity index 100% rename from lib/platform/CSynergyHook.h rename to src/lib/platform/CSynergyHook.h diff --git a/lib/platform/CXWindowsClipboard.cpp b/src/lib/platform/CXWindowsClipboard.cpp similarity index 100% rename from lib/platform/CXWindowsClipboard.cpp rename to src/lib/platform/CXWindowsClipboard.cpp diff --git a/lib/platform/CXWindowsClipboard.h b/src/lib/platform/CXWindowsClipboard.h similarity index 100% rename from lib/platform/CXWindowsClipboard.h rename to src/lib/platform/CXWindowsClipboard.h diff --git a/lib/platform/CXWindowsClipboardAnyBitmapConverter.cpp b/src/lib/platform/CXWindowsClipboardAnyBitmapConverter.cpp similarity index 100% rename from lib/platform/CXWindowsClipboardAnyBitmapConverter.cpp rename to src/lib/platform/CXWindowsClipboardAnyBitmapConverter.cpp diff --git a/lib/platform/CXWindowsClipboardAnyBitmapConverter.h b/src/lib/platform/CXWindowsClipboardAnyBitmapConverter.h similarity index 100% rename from lib/platform/CXWindowsClipboardAnyBitmapConverter.h rename to src/lib/platform/CXWindowsClipboardAnyBitmapConverter.h diff --git a/lib/platform/CXWindowsClipboardBMPConverter.cpp b/src/lib/platform/CXWindowsClipboardBMPConverter.cpp similarity index 100% rename from lib/platform/CXWindowsClipboardBMPConverter.cpp rename to src/lib/platform/CXWindowsClipboardBMPConverter.cpp diff --git a/lib/platform/CXWindowsClipboardBMPConverter.h b/src/lib/platform/CXWindowsClipboardBMPConverter.h similarity index 100% rename from lib/platform/CXWindowsClipboardBMPConverter.h rename to src/lib/platform/CXWindowsClipboardBMPConverter.h diff --git a/lib/platform/CXWindowsClipboardHTMLConverter.cpp b/src/lib/platform/CXWindowsClipboardHTMLConverter.cpp similarity index 100% rename from lib/platform/CXWindowsClipboardHTMLConverter.cpp rename to src/lib/platform/CXWindowsClipboardHTMLConverter.cpp diff --git a/lib/platform/CXWindowsClipboardHTMLConverter.h b/src/lib/platform/CXWindowsClipboardHTMLConverter.h similarity index 100% rename from lib/platform/CXWindowsClipboardHTMLConverter.h rename to src/lib/platform/CXWindowsClipboardHTMLConverter.h diff --git a/lib/platform/CXWindowsClipboardTextConverter.cpp b/src/lib/platform/CXWindowsClipboardTextConverter.cpp similarity index 100% rename from lib/platform/CXWindowsClipboardTextConverter.cpp rename to src/lib/platform/CXWindowsClipboardTextConverter.cpp diff --git a/lib/platform/CXWindowsClipboardTextConverter.h b/src/lib/platform/CXWindowsClipboardTextConverter.h similarity index 100% rename from lib/platform/CXWindowsClipboardTextConverter.h rename to src/lib/platform/CXWindowsClipboardTextConverter.h diff --git a/lib/platform/CXWindowsClipboardUCS2Converter.cpp b/src/lib/platform/CXWindowsClipboardUCS2Converter.cpp similarity index 100% rename from lib/platform/CXWindowsClipboardUCS2Converter.cpp rename to src/lib/platform/CXWindowsClipboardUCS2Converter.cpp diff --git a/lib/platform/CXWindowsClipboardUCS2Converter.h b/src/lib/platform/CXWindowsClipboardUCS2Converter.h similarity index 100% rename from lib/platform/CXWindowsClipboardUCS2Converter.h rename to src/lib/platform/CXWindowsClipboardUCS2Converter.h diff --git a/lib/platform/CXWindowsClipboardUTF8Converter.cpp b/src/lib/platform/CXWindowsClipboardUTF8Converter.cpp similarity index 100% rename from lib/platform/CXWindowsClipboardUTF8Converter.cpp rename to src/lib/platform/CXWindowsClipboardUTF8Converter.cpp diff --git a/lib/platform/CXWindowsClipboardUTF8Converter.h b/src/lib/platform/CXWindowsClipboardUTF8Converter.h similarity index 100% rename from lib/platform/CXWindowsClipboardUTF8Converter.h rename to src/lib/platform/CXWindowsClipboardUTF8Converter.h diff --git a/lib/platform/CXWindowsEventQueueBuffer.cpp b/src/lib/platform/CXWindowsEventQueueBuffer.cpp similarity index 100% rename from lib/platform/CXWindowsEventQueueBuffer.cpp rename to src/lib/platform/CXWindowsEventQueueBuffer.cpp diff --git a/lib/platform/CXWindowsEventQueueBuffer.h b/src/lib/platform/CXWindowsEventQueueBuffer.h similarity index 100% rename from lib/platform/CXWindowsEventQueueBuffer.h rename to src/lib/platform/CXWindowsEventQueueBuffer.h diff --git a/lib/platform/CXWindowsKeyState.cpp b/src/lib/platform/CXWindowsKeyState.cpp similarity index 100% rename from lib/platform/CXWindowsKeyState.cpp rename to src/lib/platform/CXWindowsKeyState.cpp diff --git a/lib/platform/CXWindowsKeyState.h b/src/lib/platform/CXWindowsKeyState.h similarity index 100% rename from lib/platform/CXWindowsKeyState.h rename to src/lib/platform/CXWindowsKeyState.h diff --git a/lib/platform/CXWindowsScreen.cpp b/src/lib/platform/CXWindowsScreen.cpp similarity index 100% rename from lib/platform/CXWindowsScreen.cpp rename to src/lib/platform/CXWindowsScreen.cpp diff --git a/lib/platform/CXWindowsScreen.h b/src/lib/platform/CXWindowsScreen.h similarity index 100% rename from lib/platform/CXWindowsScreen.h rename to src/lib/platform/CXWindowsScreen.h diff --git a/lib/platform/CXWindowsScreenSaver.cpp b/src/lib/platform/CXWindowsScreenSaver.cpp similarity index 100% rename from lib/platform/CXWindowsScreenSaver.cpp rename to src/lib/platform/CXWindowsScreenSaver.cpp diff --git a/lib/platform/CXWindowsScreenSaver.h b/src/lib/platform/CXWindowsScreenSaver.h similarity index 100% rename from lib/platform/CXWindowsScreenSaver.h rename to src/lib/platform/CXWindowsScreenSaver.h diff --git a/lib/platform/CXWindowsUtil.cpp b/src/lib/platform/CXWindowsUtil.cpp similarity index 100% rename from lib/platform/CXWindowsUtil.cpp rename to src/lib/platform/CXWindowsUtil.cpp diff --git a/lib/platform/CXWindowsUtil.h b/src/lib/platform/CXWindowsUtil.h similarity index 100% rename from lib/platform/CXWindowsUtil.h rename to src/lib/platform/CXWindowsUtil.h diff --git a/lib/platform/OSXScreenSaverControl.h b/src/lib/platform/OSXScreenSaverControl.h similarity index 100% rename from lib/platform/OSXScreenSaverControl.h rename to src/lib/platform/OSXScreenSaverControl.h diff --git a/lib/server/CBaseClientProxy.cpp b/src/lib/server/CBaseClientProxy.cpp similarity index 100% rename from lib/server/CBaseClientProxy.cpp rename to src/lib/server/CBaseClientProxy.cpp diff --git a/lib/server/CBaseClientProxy.h b/src/lib/server/CBaseClientProxy.h similarity index 100% rename from lib/server/CBaseClientProxy.h rename to src/lib/server/CBaseClientProxy.h diff --git a/lib/server/CClientListener.cpp b/src/lib/server/CClientListener.cpp similarity index 100% rename from lib/server/CClientListener.cpp rename to src/lib/server/CClientListener.cpp diff --git a/lib/server/CClientListener.h b/src/lib/server/CClientListener.h similarity index 100% rename from lib/server/CClientListener.h rename to src/lib/server/CClientListener.h diff --git a/lib/server/CClientProxy.cpp b/src/lib/server/CClientProxy.cpp similarity index 100% rename from lib/server/CClientProxy.cpp rename to src/lib/server/CClientProxy.cpp diff --git a/lib/server/CClientProxy.h b/src/lib/server/CClientProxy.h similarity index 100% rename from lib/server/CClientProxy.h rename to src/lib/server/CClientProxy.h diff --git a/lib/server/CClientProxy1_0.cpp b/src/lib/server/CClientProxy1_0.cpp similarity index 100% rename from lib/server/CClientProxy1_0.cpp rename to src/lib/server/CClientProxy1_0.cpp diff --git a/lib/server/CClientProxy1_0.h b/src/lib/server/CClientProxy1_0.h similarity index 100% rename from lib/server/CClientProxy1_0.h rename to src/lib/server/CClientProxy1_0.h diff --git a/lib/server/CClientProxy1_1.cpp b/src/lib/server/CClientProxy1_1.cpp similarity index 100% rename from lib/server/CClientProxy1_1.cpp rename to src/lib/server/CClientProxy1_1.cpp diff --git a/lib/server/CClientProxy1_1.h b/src/lib/server/CClientProxy1_1.h similarity index 100% rename from lib/server/CClientProxy1_1.h rename to src/lib/server/CClientProxy1_1.h diff --git a/lib/server/CClientProxy1_2.cpp b/src/lib/server/CClientProxy1_2.cpp similarity index 100% rename from lib/server/CClientProxy1_2.cpp rename to src/lib/server/CClientProxy1_2.cpp diff --git a/lib/server/CClientProxy1_2.h b/src/lib/server/CClientProxy1_2.h similarity index 100% rename from lib/server/CClientProxy1_2.h rename to src/lib/server/CClientProxy1_2.h diff --git a/lib/server/CClientProxy1_3.cpp b/src/lib/server/CClientProxy1_3.cpp similarity index 100% rename from lib/server/CClientProxy1_3.cpp rename to src/lib/server/CClientProxy1_3.cpp diff --git a/lib/server/CClientProxy1_3.h b/src/lib/server/CClientProxy1_3.h similarity index 100% rename from lib/server/CClientProxy1_3.h rename to src/lib/server/CClientProxy1_3.h diff --git a/lib/server/CClientProxyUnknown.cpp b/src/lib/server/CClientProxyUnknown.cpp similarity index 100% rename from lib/server/CClientProxyUnknown.cpp rename to src/lib/server/CClientProxyUnknown.cpp diff --git a/lib/server/CClientProxyUnknown.h b/src/lib/server/CClientProxyUnknown.h similarity index 100% rename from lib/server/CClientProxyUnknown.h rename to src/lib/server/CClientProxyUnknown.h diff --git a/lib/server/CConfig.cpp b/src/lib/server/CConfig.cpp similarity index 100% rename from lib/server/CConfig.cpp rename to src/lib/server/CConfig.cpp diff --git a/lib/server/CConfig.h b/src/lib/server/CConfig.h similarity index 100% rename from lib/server/CConfig.h rename to src/lib/server/CConfig.h diff --git a/lib/server/CInputFilter.cpp b/src/lib/server/CInputFilter.cpp similarity index 100% rename from lib/server/CInputFilter.cpp rename to src/lib/server/CInputFilter.cpp diff --git a/lib/server/CInputFilter.h b/src/lib/server/CInputFilter.h similarity index 100% rename from lib/server/CInputFilter.h rename to src/lib/server/CInputFilter.h diff --git a/src/lib/server/CMakeLists.txt b/src/lib/server/CMakeLists.txt new file mode 100644 index 00000000..25777b97 --- /dev/null +++ b/src/lib/server/CMakeLists.txt @@ -0,0 +1,61 @@ +# 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 . + +set(inc + CBaseClientProxy.h + CClientListener.h + CClientProxy.h + CClientProxy1_0.h + CClientProxy1_1.h + CClientProxy1_2.h + CClientProxy1_3.h + CClientProxyUnknown.h + CConfig.h + CInputFilter.h + CPrimaryClient.h + CServer.h +) + +set(src + CBaseClientProxy.cpp + CClientListener.cpp + CClientProxy.cpp + CClientProxy1_0.cpp + CClientProxy1_1.cpp + CClientProxy1_2.cpp + CClientProxy1_3.cpp + CClientProxyUnknown.cpp + CConfig.cpp + CInputFilter.cpp + CPrimaryClient.cpp + CServer.cpp +) + +if (WIN32) + list(APPEND src ${inc}) +endif() + +set(inc + ../arch + ../base + ../common + ../io + ../mt + ../net + ../synergy +) + +include_directories(${inc}) +add_library(libserver STATIC ${src}) diff --git a/lib/server/CPrimaryClient.cpp b/src/lib/server/CPrimaryClient.cpp similarity index 100% rename from lib/server/CPrimaryClient.cpp rename to src/lib/server/CPrimaryClient.cpp diff --git a/lib/server/CPrimaryClient.h b/src/lib/server/CPrimaryClient.h similarity index 100% rename from lib/server/CPrimaryClient.h rename to src/lib/server/CPrimaryClient.h diff --git a/lib/server/CServer.cpp b/src/lib/server/CServer.cpp similarity index 100% rename from lib/server/CServer.cpp rename to src/lib/server/CServer.cpp diff --git a/lib/server/CServer.h b/src/lib/server/CServer.h similarity index 100% rename from lib/server/CServer.h rename to src/lib/server/CServer.h diff --git a/lib/synergy/CApp.cpp b/src/lib/synergy/CApp.cpp similarity index 100% rename from lib/synergy/CApp.cpp rename to src/lib/synergy/CApp.cpp diff --git a/lib/synergy/CApp.h b/src/lib/synergy/CApp.h similarity index 100% rename from lib/synergy/CApp.h rename to src/lib/synergy/CApp.h diff --git a/lib/synergy/CClientApp.cpp b/src/lib/synergy/CClientApp.cpp similarity index 100% rename from lib/synergy/CClientApp.cpp rename to src/lib/synergy/CClientApp.cpp diff --git a/lib/synergy/CClientApp.h b/src/lib/synergy/CClientApp.h similarity index 100% rename from lib/synergy/CClientApp.h rename to src/lib/synergy/CClientApp.h diff --git a/lib/synergy/CClientTaskBarReceiver.cpp b/src/lib/synergy/CClientTaskBarReceiver.cpp similarity index 100% rename from lib/synergy/CClientTaskBarReceiver.cpp rename to src/lib/synergy/CClientTaskBarReceiver.cpp diff --git a/lib/synergy/CClientTaskBarReceiver.h b/src/lib/synergy/CClientTaskBarReceiver.h similarity index 100% rename from lib/synergy/CClientTaskBarReceiver.h rename to src/lib/synergy/CClientTaskBarReceiver.h diff --git a/lib/synergy/CClipboard.cpp b/src/lib/synergy/CClipboard.cpp similarity index 100% rename from lib/synergy/CClipboard.cpp rename to src/lib/synergy/CClipboard.cpp diff --git a/lib/synergy/CClipboard.h b/src/lib/synergy/CClipboard.h similarity index 100% rename from lib/synergy/CClipboard.h rename to src/lib/synergy/CClipboard.h diff --git a/lib/synergy/CKeyMap.cpp b/src/lib/synergy/CKeyMap.cpp similarity index 100% rename from lib/synergy/CKeyMap.cpp rename to src/lib/synergy/CKeyMap.cpp diff --git a/lib/synergy/CKeyMap.h b/src/lib/synergy/CKeyMap.h similarity index 100% rename from lib/synergy/CKeyMap.h rename to src/lib/synergy/CKeyMap.h diff --git a/lib/synergy/CKeyState.cpp b/src/lib/synergy/CKeyState.cpp similarity index 100% rename from lib/synergy/CKeyState.cpp rename to src/lib/synergy/CKeyState.cpp diff --git a/lib/synergy/CKeyState.h b/src/lib/synergy/CKeyState.h similarity index 100% rename from lib/synergy/CKeyState.h rename to src/lib/synergy/CKeyState.h diff --git a/src/lib/synergy/CMakeLists.txt b/src/lib/synergy/CMakeLists.txt new file mode 100644 index 00000000..e960b672 --- /dev/null +++ b/src/lib/synergy/CMakeLists.txt @@ -0,0 +1,87 @@ +# 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 . + +set(inc + CClientTaskBarReceiver.h + CServerTaskBarReceiver.h + CApp.h + CClientApp.h + CServerApp.h + CClipboard.h + CKeyMap.h + CKeyState.h + CPacketStreamFilter.h + CPlatformScreen.h + CProtocolUtil.h + CScreen.h + ClipboardTypes.h + IClient.h + IClipboard.h + IKeyState.h + IPlatformScreen.h + IPrimaryScreen.h + IScreen.h + IScreenSaver.h + ISecondaryScreen.h + KeyTypes.h + MouseTypes.h + OptionTypes.h + ProtocolTypes.h + XScreen.h + XSynergy.h +) + +set(src + CClientTaskBarReceiver.cpp + CServerTaskBarReceiver.cpp + CApp.cpp + CClientApp.cpp + CServerApp.cpp + CClipboard.cpp + CKeyMap.cpp + CKeyState.cpp + CPacketStreamFilter.cpp + CPlatformScreen.cpp + CProtocolUtil.cpp + CScreen.cpp + IClipboard.cpp + IKeyState.cpp + IPrimaryScreen.cpp + IScreen.cpp + KeyTypes.cpp + ProtocolTypes.cpp + XScreen.cpp + XSynergy.cpp +) + +if (WIN32) + list(APPEND src ${inc}) +endif() + +set(inc + ../arch + ../base + ../client + ../common + ../io + ../mt + ../net + ../platform + ../server + ../synergy +) + +include_directories(${inc}) +add_library(libsynergy STATIC ${src}) diff --git a/lib/synergy/CPacketStreamFilter.cpp b/src/lib/synergy/CPacketStreamFilter.cpp similarity index 100% rename from lib/synergy/CPacketStreamFilter.cpp rename to src/lib/synergy/CPacketStreamFilter.cpp diff --git a/lib/synergy/CPacketStreamFilter.h b/src/lib/synergy/CPacketStreamFilter.h similarity index 100% rename from lib/synergy/CPacketStreamFilter.h rename to src/lib/synergy/CPacketStreamFilter.h diff --git a/lib/synergy/CPlatformScreen.cpp b/src/lib/synergy/CPlatformScreen.cpp similarity index 100% rename from lib/synergy/CPlatformScreen.cpp rename to src/lib/synergy/CPlatformScreen.cpp diff --git a/lib/synergy/CPlatformScreen.h b/src/lib/synergy/CPlatformScreen.h similarity index 100% rename from lib/synergy/CPlatformScreen.h rename to src/lib/synergy/CPlatformScreen.h diff --git a/lib/synergy/CProtocolUtil.cpp b/src/lib/synergy/CProtocolUtil.cpp similarity index 100% rename from lib/synergy/CProtocolUtil.cpp rename to src/lib/synergy/CProtocolUtil.cpp diff --git a/lib/synergy/CProtocolUtil.h b/src/lib/synergy/CProtocolUtil.h similarity index 100% rename from lib/synergy/CProtocolUtil.h rename to src/lib/synergy/CProtocolUtil.h diff --git a/lib/synergy/CScreen.cpp b/src/lib/synergy/CScreen.cpp similarity index 100% rename from lib/synergy/CScreen.cpp rename to src/lib/synergy/CScreen.cpp diff --git a/lib/synergy/CScreen.h b/src/lib/synergy/CScreen.h similarity index 100% rename from lib/synergy/CScreen.h rename to src/lib/synergy/CScreen.h diff --git a/lib/synergy/CServerApp.cpp b/src/lib/synergy/CServerApp.cpp similarity index 100% rename from lib/synergy/CServerApp.cpp rename to src/lib/synergy/CServerApp.cpp diff --git a/lib/synergy/CServerApp.h b/src/lib/synergy/CServerApp.h similarity index 100% rename from lib/synergy/CServerApp.h rename to src/lib/synergy/CServerApp.h diff --git a/lib/synergy/CServerTaskBarReceiver.cpp b/src/lib/synergy/CServerTaskBarReceiver.cpp similarity index 100% rename from lib/synergy/CServerTaskBarReceiver.cpp rename to src/lib/synergy/CServerTaskBarReceiver.cpp diff --git a/lib/synergy/CServerTaskBarReceiver.h b/src/lib/synergy/CServerTaskBarReceiver.h similarity index 100% rename from lib/synergy/CServerTaskBarReceiver.h rename to src/lib/synergy/CServerTaskBarReceiver.h diff --git a/lib/synergy/ClipboardTypes.h b/src/lib/synergy/ClipboardTypes.h similarity index 100% rename from lib/synergy/ClipboardTypes.h rename to src/lib/synergy/ClipboardTypes.h diff --git a/lib/synergy/IClient.h b/src/lib/synergy/IClient.h similarity index 100% rename from lib/synergy/IClient.h rename to src/lib/synergy/IClient.h diff --git a/lib/synergy/IClipboard.cpp b/src/lib/synergy/IClipboard.cpp similarity index 100% rename from lib/synergy/IClipboard.cpp rename to src/lib/synergy/IClipboard.cpp diff --git a/lib/synergy/IClipboard.h b/src/lib/synergy/IClipboard.h similarity index 100% rename from lib/synergy/IClipboard.h rename to src/lib/synergy/IClipboard.h diff --git a/lib/synergy/IKeyState.cpp b/src/lib/synergy/IKeyState.cpp similarity index 100% rename from lib/synergy/IKeyState.cpp rename to src/lib/synergy/IKeyState.cpp diff --git a/lib/synergy/IKeyState.h b/src/lib/synergy/IKeyState.h similarity index 100% rename from lib/synergy/IKeyState.h rename to src/lib/synergy/IKeyState.h diff --git a/lib/synergy/INode.h b/src/lib/synergy/INode.h similarity index 100% rename from lib/synergy/INode.h rename to src/lib/synergy/INode.h diff --git a/lib/synergy/IPlatformScreen.h b/src/lib/synergy/IPlatformScreen.h similarity index 100% rename from lib/synergy/IPlatformScreen.h rename to src/lib/synergy/IPlatformScreen.h diff --git a/lib/synergy/IPrimaryScreen.cpp b/src/lib/synergy/IPrimaryScreen.cpp similarity index 100% rename from lib/synergy/IPrimaryScreen.cpp rename to src/lib/synergy/IPrimaryScreen.cpp diff --git a/lib/synergy/IPrimaryScreen.h b/src/lib/synergy/IPrimaryScreen.h similarity index 100% rename from lib/synergy/IPrimaryScreen.h rename to src/lib/synergy/IPrimaryScreen.h diff --git a/lib/synergy/IScreen.cpp b/src/lib/synergy/IScreen.cpp similarity index 100% rename from lib/synergy/IScreen.cpp rename to src/lib/synergy/IScreen.cpp diff --git a/lib/synergy/IScreen.h b/src/lib/synergy/IScreen.h similarity index 100% rename from lib/synergy/IScreen.h rename to src/lib/synergy/IScreen.h diff --git a/lib/synergy/IScreenSaver.h b/src/lib/synergy/IScreenSaver.h similarity index 100% rename from lib/synergy/IScreenSaver.h rename to src/lib/synergy/IScreenSaver.h diff --git a/lib/synergy/ISecondaryScreen.h b/src/lib/synergy/ISecondaryScreen.h similarity index 100% rename from lib/synergy/ISecondaryScreen.h rename to src/lib/synergy/ISecondaryScreen.h diff --git a/lib/synergy/KeyTypes.cpp b/src/lib/synergy/KeyTypes.cpp similarity index 100% rename from lib/synergy/KeyTypes.cpp rename to src/lib/synergy/KeyTypes.cpp diff --git a/lib/synergy/KeyTypes.h b/src/lib/synergy/KeyTypes.h similarity index 100% rename from lib/synergy/KeyTypes.h rename to src/lib/synergy/KeyTypes.h diff --git a/lib/synergy/MouseTypes.h b/src/lib/synergy/MouseTypes.h similarity index 100% rename from lib/synergy/MouseTypes.h rename to src/lib/synergy/MouseTypes.h diff --git a/lib/synergy/OptionTypes.h b/src/lib/synergy/OptionTypes.h similarity index 100% rename from lib/synergy/OptionTypes.h rename to src/lib/synergy/OptionTypes.h diff --git a/lib/synergy/ProtocolTypes.cpp b/src/lib/synergy/ProtocolTypes.cpp similarity index 100% rename from lib/synergy/ProtocolTypes.cpp rename to src/lib/synergy/ProtocolTypes.cpp diff --git a/lib/synergy/ProtocolTypes.h b/src/lib/synergy/ProtocolTypes.h similarity index 100% rename from lib/synergy/ProtocolTypes.h rename to src/lib/synergy/ProtocolTypes.h diff --git a/lib/synergy/XScreen.cpp b/src/lib/synergy/XScreen.cpp similarity index 100% rename from lib/synergy/XScreen.cpp rename to src/lib/synergy/XScreen.cpp diff --git a/lib/synergy/XScreen.h b/src/lib/synergy/XScreen.h similarity index 100% rename from lib/synergy/XScreen.h rename to src/lib/synergy/XScreen.h diff --git a/lib/synergy/XSynergy.cpp b/src/lib/synergy/XSynergy.cpp similarity index 100% rename from lib/synergy/XSynergy.cpp rename to src/lib/synergy/XSynergy.cpp diff --git a/lib/synergy/XSynergy.h b/src/lib/synergy/XSynergy.h similarity index 100% rename from lib/synergy/XSynergy.h rename to src/lib/synergy/XSynergy.h diff --git a/src/unittests/CMakeLists.txt b/src/unittests/CMakeLists.txt new file mode 100644 index 00000000..28bf4200 --- /dev/null +++ b/src/unittests/CMakeLists.txt @@ -0,0 +1,38 @@ +# 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 . + +set(src + ../../tools/gtest/src/gtest_main.cc + synergy/CClipboardTests.cpp +) + +set(inc + ../lib/arch + ../lib/base + ../lib/client + ../lib/common + ../lib/io + ../lib/mt + ../lib/net + ../lib/platform + ../lib/synergy + ../../tools/gtest/include +) + +include_directories(${inc}) +add_executable(unittests ${src}) +target_link_libraries(unittests + libarch libbase libclient libcommon libio libmt libnet libplatform + libserver libsynergy gtest ${libs}) diff --git a/src/unittest/synergy/CClipboardTests.cpp b/src/unittests/synergy/CClipboardTests.cpp similarity index 100% rename from src/unittest/synergy/CClipboardTests.cpp rename to src/unittests/synergy/CClipboardTests.cpp