Initial commit of the synergy trunk sources from sf.net

This commit is contained in:
Sorin Sbarnea 2009-02-27 11:54:59 +00:00
commit 958fa80d1d
429 changed files with 96848 additions and 0 deletions

1
AUTHORS Normal file
View File

@ -0,0 +1 @@
See doc/authors.html.

286
COPYING Normal file
View File

@ -0,0 +1,286 @@
Synergy is copyright (C) 2002-2007 Chris Schoeneman.
Synergy is distributed under the following license.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE
IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY
WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED
ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF
THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT
LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
END OF TERMS AND CONDITIONS

11453
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

1
INSTALL Normal file
View File

@ -0,0 +1 @@
See doc/compiling.html.

97
Makefile.am Normal file
View File

@ -0,0 +1,97 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2002 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
## Process this file with automake to produce Makefile.in
NULL =
SUBDIRS = \
lib \
cmd \
doc \
dist \
$(NULL)
EXTRA_DIST = \
Makefile.win \
examples/synergy.conf \
win32util/autodep.cpp \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
aclocal.m4 \
config.h \
config.h.in \
config.log \
config.status \
configure \
stamp-h.in \
stamp-h1 \
$(NULL)
PKG_FILES = \
ChangeLog \
README \
cmd/synergyc/synergyc \
cmd/synergys/synergys \
examples/synergy.conf \
$(NULL)
PKG_DOC_FILES = \
doc/PORTING \
doc/*.html \
doc/*.css \
$(NULL)
PKG_PROG_FILES = \
synergyc \
synergys \
$(NULL)
# build doxygen documentation
doxygen:
doxygen doc/doxygen.cfg
# build RPMs
RPMTOPDIR=/var/tmp/@PACKAGE@-@VERSION@
dist-rpm: dist
rm -rf $(RPMTOPDIR)
mkdir $(RPMTOPDIR)
(cd $(RPMTOPDIR); mkdir BUILD SOURCES SPECS SRPMS RPMS)
cp @PACKAGE@-@VERSION@.tar.gz $(RPMTOPDIR)/SOURCES
rpm --define '_topdir $(RPMTOPDIR)' -ba dist/rpm/synergy.spec && \
mv -f $(RPMTOPDIR)/SRPMS/*.rpm . && \
mv -f $(RPMTOPDIR)/RPMS/*/*.rpm . && \
rm -rf $(RPMTOPDIR)
# build zip
# FIXME -- have automake generate this rule for us
dist-zip: distdir
zip -r $(distdir).zip $(distdir)
-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
# build binary package. owner/group of packaged files will be
# owner/group of user running make.
PKGTOPDIR=/var/tmp/@PACKAGE@-@VERSION@
dist-pkg: all
rm -rf $(PKGTOPDIR)
mkdir $(PKGTOPDIR)
mkdir $(PKGTOPDIR)/@PACKAGE@-@VERSION@
mkdir $(PKGTOPDIR)/@PACKAGE@-@VERSION@/doc
cp $(PKG_FILES) $(PKGTOPDIR)/@PACKAGE@-@VERSION@
cp $(PKG_DOC_FILES) $(PKGTOPDIR)/@PACKAGE@-@VERSION@/doc
(cd $(PKGTOPDIR)/@PACKAGE@-@VERSION@; \
chmod 644 *; \
chmod 755 doc $(PKG_PROG_FILES); \
strip $(PKG_PROG_FILES) )
type=`uname -s -m | tr '[A-Z] ' '[a-z].'`; \
(cd $(PKGTOPDIR); tar cf - @PACKAGE@-@VERSION@ | \
gzip - ) > @PACKAGE@-@VERSION@-1.$${type}.tar.gz && \
rm -rf $(PKGTOPDIR)

145
Makefile.win Normal file
View File

@ -0,0 +1,145 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2007 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
# Name of this file for recursive make
MAKEFILE = Makefile.win
# Default build is release is NODEBUG is defined, debug otherwise.
!if !DEFINED(DEBUG)
NODEBUG = 1
!else
!undef NODEBUG
!endif
# Build all by default
default: all
# Redefine implicit rule suffixes
.SUFFIXES:
.SUFFIXES: .cpp .rc .obj
# Shut up
.SILENT:
# Include system macros
#APPVER = 5.0
#TARGETOS = WINNT
!include <win32.mak>
# Be explicit about C++ compiler
cpp = $(cc)
cppdebug = $(cdebug)
cppflags = $(cflags)
cppvarsmt = $(cvarsmt)
# Library tool options
ildebug =
ilflags = /nologo
# Handy macro for defining list macros
NULL =
# System commands
ECHO = echo
MKDIR = mkdir
RM = del /f
RMR = rmdir /q /s
# Local build utilities
UTIL_DIR = win32util
AUTODEP = "$(UTIL_DIR)\autodep.exe"
# Destination for intermediate build targets
BUILD_DIR = build
BUILD_DEBUG_DIR = $(BUILD_DIR)\Debug
BUILD_RELEASE_DIR = $(BUILD_DIR)\Release
!if DEFINED(NODEBUG)
BUILD_DST = $(BUILD_RELEASE_DIR)
!else
BUILD_DST = $(BUILD_DEBUG_DIR)
!endif
# Compiler argument changes
cflags = $(cflags:-W3=-W4) /WX
cflags = $(cflags) -D_CRT_SECURE_NO_DEPRECATE
cflags = $(cflags) /GR
!if !DEFINED(OLDCOMPILER)
cflags = $(cflags) /EHsc
!else
cflags = $(cflags) /GX
!endif
!if !DEFINED(NODEBUG)
!if !DEFINED(OLDCOMPILER)
cdebug = $(cdebug) /RTC1
!else
cdebug = $(cdebug) /GZ
!endif
!endif
# Initialize variables for library and program makefiles
C_FILES =
CPP_FILES =
OBJ_FILES =
LIB_FILES =
PROGRAMS =
OPTPROGRAMS = $(AUTODEP)
# Include subdirectory makefiles
!include lib\common\$(MAKEFILE)
!include lib\arch\$(MAKEFILE)
!include lib\base\$(MAKEFILE)
!include lib\mt\$(MAKEFILE)
!include lib\io\$(MAKEFILE)
!include lib\net\$(MAKEFILE)
!include lib\synergy\$(MAKEFILE)
!include lib\platform\$(MAKEFILE)
!include lib\client\$(MAKEFILE)
!include lib\server\$(MAKEFILE)
!include cmd\synergyc\$(MAKEFILE)
!include cmd\synergys\$(MAKEFILE)
!include cmd\launcher\$(MAKEFILE)
!include dist\nullsoft\$(MAKEFILE)
# Collect library and program variables
INTERMEDIATES = $(OBJ_FILES) $(AUTODEP:.exe=.obj)
TARGETS = $(LIB_FILES) $(PROGRAMS)
OPTTARGETS = $(OPTPROGRAMS)
# Build release by reinvoking make with NODEBUG defined
release:
@$(MAKE) /nologo /f $(MAKEFILE) NODEBUG=1
# Build debug by reinvoking make with DEBUG defined
debug:
@$(MAKE) /nologo /f $(MAKEFILE) DEBUG=1
# Build all targets
all: $(TARGETS)
# Clean intermediate targets
clean:
-$(RMR) $(BUILD_DEBUG_DIR)
-$(RMR) $(BUILD_RELEASE_DIR)
# Clean all targets
clobber: clean
-$(RMR) $(BUILD_DIR)
# Utility command build rules
$(AUTODEP): $(AUTODEP:.exe=.cpp)
!if DEFINED(NODEBUG)
@$(ECHO) Build $(@F)
$(cpp) $(cppdebug) $(cppflags) $(cppvars) /Fo"$(**:.cpp=.obj)" $**
$(link) $(ldebug) $(conflags) -out:$@ $(**:.cpp=.obj) $(conlibs)
!else
@$(MAKE) /nologo /f $(MAKEFILE) NODEBUG=1 $@
!endif

1
NEWS Normal file
View File

@ -0,0 +1 @@
See doc/news.html.

21
README Normal file
View File

@ -0,0 +1,21 @@
Synergy
=======
synergy: [noun] a mutually advantageous conjunction of distinct elements
Synergy lets you easily share a single mouse and keyboard between
multiple computers with different operating systems, each with its
own display, without special hardware. It's intended for users
with multiple computers on their desk since each system uses its
own display.
Redirecting the mouse and keyboard is as simple as moving the mouse
off the edge of your screen. Synergy also merges the clipboards of
all the systems into one, allowing cut-and-paste between systems.
Furthermore, it synchronizes screen savers so they all start and stop
together and, if screen locking is enabled, only one screen requires
a password to unlock them all.
Synergy is open source and released under the GNU Public License (GPL).
Please see doc/index.html for more information.

571
acinclude.m4 Normal file
View File

@ -0,0 +1,571 @@
dnl synergy -- mouse and keyboard sharing utility
dnl Copyright (C) 2002 Chris Schoeneman
dnl
dnl This package is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl found in the file COPYING that should have accompanied this file.
dnl
dnl This package is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
AC_DEFUN([ACX_CHECK_SOCKLEN_T], [
AC_MSG_CHECKING([for socklen_t])
AC_TRY_COMPILE([
#include <unistd.h>
#include <sys/socket.h>
],
[socklen_t len;],[acx_socklen_t_ok=yes],[acx_socklen_t_ok=no])
AC_MSG_RESULT($acx_socklen_t_ok)
if test x"$acx_socklen_t_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_SOCKLEN_T,1,[Define if your compiler defines socklen_t.]),[$1])
:
else
acx_socklen_t_ok=no
$2
fi
])dnl ACX_CHECK_SOCKLEN_T
# HP-UX defines socklen_t but doesn't use it in arg 3 for accept().
AC_DEFUN([ACX_FUNC_ACCEPT], [
AC_MSG_CHECKING([for type of arg 3 for accept])
acx_accept_socklen_t_arg3=int
if test x"$acx_socklen_t_ok" = xyes; then
AC_TRY_COMPILE([
#include <unistd.h>
#include <sys/socket.h>
],
[struct sockaddr addr; socklen_t len; accept(0, &addr, &len);],
[acx_accept_socklen_t_arg3=socklen_t],
[acx_accept_socklen_t_arg3=int])
fi
AC_MSG_RESULT($acx_accept_socklen_t_arg3)
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG3,$acx_accept_socklen_t_arg3,[Define to the base type of arg 3 for `accept'.])
])dnl ACX_FUNC_ACCEPT
AC_DEFUN([ACX_CHECK_CXX], [
AC_MSG_CHECKING([if g++ defines correct C++ macro])
AC_TRY_COMPILE(, [
#if defined(_LANGUAGE_C) && !defined(_LANGUAGE_C_PLUS_PLUS)
#error wrong macro
#endif],[acx_cxx_macro_ok=yes],[acx_cxx_macro_ok=no])
AC_MSG_RESULT($acx_cxx_macro_ok)
if test x"$acx_cxx_macro_ok" = xyes; then
SYNERGY_CXXFLAGS=""
else
SYNERGY_CXXFLAGS="-U_LANGUAGE_C -D_LANGUAGE_C_PLUS_PLUS"
fi
])dnl ACX_CHECK_CXX
AC_DEFUN([ACX_CHECK_CXX_BOOL], [
AC_MSG_CHECKING([for bool support])
AC_TRY_COMPILE(, [bool t = true, f = false;],
[acx_cxx_bool_ok=yes],[acx_cxx_bool_ok=no])
AC_MSG_RESULT($acx_cxx_bool_ok)
if test x"$acx_cxx_bool_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_CXX_BOOL,1,[Define if your compiler has bool support.]),[$1])
:
else
acx_cxx_bool_ok=no
$2
fi
])dnl ACX_CHECK_CXX_BOOL
AC_DEFUN([ACX_CHECK_CXX_EXCEPTIONS], [
AC_MSG_CHECKING([for exception support])
AC_TRY_COMPILE(, [try{throw int(4);}catch(int){throw;}catch(...){}],
[acx_cxx_exception_ok=yes],[acx_cxx_exception_ok=no])
AC_MSG_RESULT($acx_cxx_exception_ok)
if test x"$acx_cxx_exception_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_CXX_EXCEPTIONS,1,[Define if your compiler has exceptions support.]),[$1])
:
else
acx_cxx_exception_ok=no
$2
fi
])dnl ACX_CHECK_CXX_EXCEPTIONS
AC_DEFUN([ACX_CHECK_CXX_CASTS], [
AC_MSG_CHECKING([for C++ cast support])
AC_TRY_COMPILE(, [const char* f="a";const_cast<char*>(f);
reinterpret_cast<const int*>(f);static_cast<int>(4.5);],
[acx_cxx_cast_ok=yes],[acx_cxx_cast_ok=no])
AC_MSG_RESULT($acx_cxx_cast_ok)
if test x"$acx_cxx_cast_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_CXX_CASTS,1,[Define if your compiler has C++ cast support.]),[$1])
:
else
acx_cxx_cast_ok=no
$2
fi
])dnl ACX_CHECK_CXX_CASTS
AC_DEFUN([ACX_CHECK_CXX_MUTABLE], [
AC_MSG_CHECKING([for mutable support])
AC_TRY_COMPILE(, [struct A{mutable int b;void f() const {b=0;}};
A a;a.f();],[acx_cxx_mutable_ok=yes],[acx_cxx_mutable_ok=no])
AC_MSG_RESULT($acx_cxx_mutable_ok)
if test x"$acx_cxx_mutable_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_CXX_MUTABLE,1,[Define if your compiler has mutable support.]),[$1])
:
else
acx_cxx_mutable_ok=no
$2
fi
])dnl ACX_CHECK_CXX_MUTABLE
AC_DEFUN([ACX_CHECK_CXX_STDLIB], [
AC_MSG_CHECKING([for C++ standard library])
AC_TRY_LINK([#include <set>], [std::set<int> a; a.insert(3);],
[acx_cxx_stdlib_ok=yes],[acx_cxx_stdlib_ok=no])
AC_MSG_RESULT($acx_cxx_stdlib_ok)
if test x"$acx_cxx_stdlib_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_CXX_STDLIB,1,[Define if your compiler has standard C++ library support.]),[$1])
:
else
acx_cxx_stdlib_ok=no
$2
fi
])dnl ACX_CHECK_CXX_STDLIB
AC_DEFUN([ACX_CHECK_GETPWUID_R], [
AC_MSG_CHECKING([for working getpwuid_r])
AC_TRY_LINK([#include <pwd.h>],
[char buffer[4096]; struct passwd pwd, *pwdp;
getpwuid_r(0, &pwd, buffer, sizeof(buffer), &pwdp);],
acx_getpwuid_r_ok=yes, acx_getpwuid_r_ok=no)
AC_MSG_RESULT($acx_getpwuid_r_ok)
if test x"$acx_getpwuid_r_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_GETPWUID_R,1,[Define if you have a working \`getpwuid_r\' function.]),[$1])
:
else
acx_getpwuid_r_ok=no
$2
fi
])dnl ACX_CHECK_GETPWUID_R
AC_DEFUN([ACX_CHECK_POLL], [
AC_MSG_CHECKING([for poll])
AC_TRY_LINK([#include <poll.h>],
[#if defined(_POLL_EMUL_H_)
#error emulated poll
#endif
struct pollfd ufds[] = { 0, POLLIN, 0 }; poll(ufds, 1, 10);],
acx_poll_ok=yes, acx_poll_ok=no)
AC_MSG_RESULT($acx_poll_ok)
if test x"$acx_poll_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_POLL,1,[Define if you have the \`poll\' function.]),[$1])
:
else
acx_poll_ok=no
$2
fi
])dnl ACX_CHECK_POLL
dnl See if we need extra libraries for nanosleep
AC_DEFUN([ACX_CHECK_NANOSLEEP], [
acx_nanosleep_ok=no
acx_nanosleep_list=""
dnl check if user has set NANOSLEEP_LIBS
save_user_NANOSLEEP_LIBS="$NANOSLEEP_LIBS"
if test x"$NANOSLEEP_LIBS" != x; then
acx_nanosleep_list=user
fi
dnl check various libraries (including no extra libraries) for
dnl nanosleep. `none' should appear first.
acx_nanosleep_list="none $acx_nanosleep_list rt"
for flag in $acx_nanosleep_list; do
case $flag in
none)
AC_MSG_CHECKING([for nanosleep])
NANOSLEEP_LIBS=""
;;
user)
AC_MSG_CHECKING([for nanosleep in $save_user_NANOSLEEP_LIBS])
NANOSLEEP_LIBS="$save_user_NANOSLEEP_LIBS"
;;
*)
AC_MSG_CHECKING([for nanosleep in -l$flag])
NANOSLEEP_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
LIBS="$NANOSLEEP_LIBS $LIBS"
AC_TRY_LINK([#include <time.h>],
[struct timespec t = { 1, 1000 }; nanosleep(&t, NULL);],
acx_nanosleep_ok=yes, acx_nanosleep_ok=no)
LIBS="$save_LIBS"
AC_MSG_RESULT($acx_nanosleep_ok)
if test x"$acx_nanosleep_ok" = xyes; then
break;
fi
NANOSLEEP_LIBS=""
done
AC_SUBST(NANOSLEEP_LIBS)
# execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_nanosleep_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_NANOSLEEP,1,[Define if you have the \`nanosleep\' function.]),[$1])
:
else
acx_nanosleep_ok=no
$2
fi
])dnl ACX_CHECK_NANOSLEEP
dnl See if we need extra libraries for inet_aton
AC_DEFUN([ACX_CHECK_INET_ATON], [
acx_inet_aton_ok=no
acx_inet_aton_list=""
dnl check if user has set INET_ATON_LIBS
save_user_INET_ATON_LIBS="$INET_ATON_LIBS"
if test x"$INET_ATON_LIBS" != x; then
acx_inet_aton_list=user
fi
dnl check various libraries (including no extra libraries) for
dnl inet_aton. `none' should appear first.
acx_inet_aton_list="none $acx_inet_aton_list resolv"
for flag in $acx_inet_aton_list; do
case $flag in
none)
AC_MSG_CHECKING([for inet_aton])
INET_ATON_LIBS=""
;;
user)
AC_MSG_CHECKING([for inet_aton in $save_user_INET_ATON_LIBS])
INET_ATON_LIBS="$save_user_INET_ATON_LIBS"
;;
*)
AC_MSG_CHECKING([for inet_aton in -l$flag])
INET_ATON_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
LIBS="$INET_ATON_LIBS $LIBS"
AC_TRY_LINK([#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>],
[struct in_addr addr; inet_aton("foo.bar", &addr);],
acx_inet_aton_ok=yes, acx_inet_aton_ok=no)
LIBS="$save_LIBS"
AC_MSG_RESULT($acx_inet_aton_ok)
if test x"$acx_inet_aton_ok" = xyes; then
AC_DEFINE(HAVE_INET_ATON,1,[Define if you have the \`inet_aton\' function.])
break;
fi
INET_ATON_LIBS=""
done
AC_SUBST(INET_ATON_LIBS)
])dnl ACX_CHECK_INET_ATON
dnl The following macros are from http://www.gnu.org/software/ac-archive/
dnl which distributes them under the following license:
dnl
dnl Every Autoconf macro presented on this web site is free software; you can
dnl redistribute it and/or modify it under the terms of the GNU General
dnl Public License as published by the Free Software Foundation; either
dnl version 2, or (at your option) any later version.
dnl
dnl They are distributed in the hope that they will be useful, but WITHOUT
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
dnl more details. (You should have received a copy of the GNU General Public
dnl License along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place -- Suite 330, Boston, MA 02111-1307,
dnl USA.)
dnl
dnl As a special exception, the Free Software Foundation gives unlimited
dnl permission to copy, distribute and modify the configure scripts that are
dnl the output of Autoconf. You need not follow the terms of the GNU General
dnl Public License when using or distributing such scripts, even though
dnl portions of the text of Autoconf appear in them. The GNU General Public
dnl License (GPL) does govern all other use of the material that constitutes
dnl the Autoconf program.
dnl
dnl Certain portions of the Autoconf source text are designed to be copied
dnl (in certain cases, depending on the input) into the output of Autoconf.
dnl We call these the "data" portions. The rest of the Autoconf source text
dnl consists of comments plus executable code that decides which of the data
dnl portions to output in any given case. We call these comments and
dnl executable code the "non-data" portions. Autoconf never copies any of the
dnl non-data portions into its output.
dnl
dnl This special exception to the GPL applies to versions of Autoconf
dnl released by the Free Software Foundation. When you make and distribute a
dnl modified version of Autoconf, you may extend this special exception to
dnl the GPL to apply to your modified version as well, *unless* your modified
dnl version has the potential to copy into its output some of the text that
dnl was the non-data portion of the version that you started with. (In other
dnl words, unless your change moves or copies text from the non-data portions
dnl to the data portions.) If your modification has such potential, you must
dnl delete any notice of this special exception to the GPL from your modified
dnl version
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case "${host_cpu}-${host_os}" in
*solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthread or
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
;;
esac
if test x"$acx_pthread_ok" = xno; then
for flag in $acx_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
if test x"$acx_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($acx_pthread_ok)
if test "x$acx_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$acx_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
[attr_name=$attr; break])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
# Detect POSIX sigwait()
AC_MSG_CHECKING([for POSIX sigwait])
AC_TRY_LINK([#include <pthread.h>
#include <signal.h>],
[sigset_t sigset; int signal; sigwait(&sigset, &signal);],
ok=yes, ok=unknown)
if test x"$ok" = xunknown; then
save_CFLAGS2="$CFLAGS"
CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
AC_TRY_LINK([#include <pthread.h>
#include <signal.h>],
[sigset_t sigset; int signal; sigwait(&sigset, &signal);],
ok=-D_POSIX_PTHREAD_SEMANTICS, ok=no)
CFLAGS="$save_CFLAGS2"
fi
AC_MSG_RESULT(${ok})
if test x"$ok" != xno; then
AC_DEFINE(HAVE_POSIX_SIGWAIT,1,[Define if you have a POSIX \`sigwait\' function.])
if test x"$ok" != xyes; then
PTHREAD_CFLAGS="$ok $PTHREAD_CFLAGS"
fi
fi
# Detect pthread signal functions
AC_MSG_CHECKING([for pthread signal functions])
AC_TRY_LINK([#include <pthread.h>
#include <signal.h>],
[pthread_kill(pthread_self(), SIGTERM);],
ok=yes, ok=no)
AC_MSG_RESULT(${ok})
if test x"$ok" = xyes; then
AC_DEFINE(HAVE_PTHREAD_SIGNAL,1,[Define if you have \`pthread_sigmask\' and \`pthread_kill\' functions.])
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with cc_r
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
acx_pthread_ok=no
$2
fi
AC_LANG_RESTORE
])dnl ACX_PTHREAD
dnl enable maximum compiler warnings. must ignore unknown pragmas to
dnl build on solaris.
dnl we only know how to do this for g++
AC_DEFUN([ACX_CXX_WARNINGS], [
AC_MSG_CHECKING([for C++ compiler warning flags])
if test "$GXX" = "yes"; then
acx_cxx_warnings="-Wall -Wno-unknown-pragmas"
fi
if test -n "$acx_cxx_warnings"; then
CXXFLAGS="$CXXFLAGS $acx_cxx_warnings"
else
acx_cxx_warnings="unknown"
fi
AC_MSG_RESULT($acx_cxx_warnings)
])dnl ACX_CXX_WARNINGS
dnl enable compiler warnings are errors
dnl we only know how to do this for g++
AC_DEFUN([ACX_CXX_WARNINGS_ARE_ERRORS], [
AC_MSG_CHECKING([for C++ compiler warning are errors flags])
if test "$GXX" = "yes"; then
acx_cxx_warnings_are_errors="-Werror"
fi
if test -n "$acx_cxx_warnings_are_errors"; then
CXXFLAGS="$CXXFLAGS $acx_cxx_warnings_are_errors"
else
acx_cxx_warnings_are_errors="unknown"
fi
AC_MSG_RESULT($acx_cxx_warnings_are_errors)
])dnl ACX_CXX_WARNINGS_ARE_ERRORS

27
cmd/Makefile.am Normal file
View File

@ -0,0 +1,27 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2002 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
## Process this file with automake to produce Makefile.in
NULL =
SUBDIRS = \
launcher \
synergyc \
synergys \
$(NULL)
EXTRA_DIST = \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
$(NULL)

427
cmd/launcher/CAddScreen.cpp Normal file
View File

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

74
cmd/launcher/CAddScreen.h Normal file
View File

@ -0,0 +1,74 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CADDSCREEN_H
#define CADDSCREEN_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
class CConfig;
//! Add screen dialog for Microsoft Windows launcher
class CAddScreen {
public:
CAddScreen(HWND parent, CConfig*, const CString& name);
~CAddScreen();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user. Return
\c true if the user accepted the changes, false otherwise.
*/
bool doModal();
//@}
//! @name accessors
//@{
CString getName() const;
//@}
private:
typedef std::vector<CString> CStringList;
void getAliases(CStringList&) const;
void getOptions(CConfig::CScreenOptions&) const;
static void tokenize(CStringList& tokens, const CString& src);
static bool isNameInList(const CStringList& tokens,
const CString& src);
void init(HWND hwnd);
bool save(HWND hwnd);
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CAddScreen* s_singleton;
HWND m_parent;
CConfig* m_config;
CString m_name;
};
#endif

View File

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

View File

@ -0,0 +1,80 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CADVANCEDOPTIONS_H
#define CADVANCEDOPTIONS_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
class CConfig;
//! Advanced options dialog for Microsoft Windows launcher
class CAdvancedOptions {
public:
CAdvancedOptions(HWND parent, CConfig*);
~CAdvancedOptions();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user.
*/
void doModal(bool isClient);
//@}
//! @name accessors
//@{
//! Get the screen name
CString getScreenName() const;
//! Get the port
int getPort() const;
//! Get the interface
CString getInterface() const;
//! Convert options to command line string
CString getCommandLine(bool isClient,
const CString& serverName) const;
//@}
private:
void init();
void doInit(HWND hwnd);
bool save(HWND hwnd);
void setDefaults(HWND hwnd);
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CAdvancedOptions* s_singleton;
HWND m_parent;
CConfig* m_config;
bool m_isClient;
CString m_screenName;
int m_port;
CString m_interface;
};
#endif

361
cmd/launcher/CAutoStart.cpp Normal file
View File

@ -0,0 +1,361 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#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);
}

90
cmd/launcher/CAutoStart.h Normal file
View File

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

View File

@ -0,0 +1,281 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#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);
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 == 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);
// 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_HEARTBEAT_CHECK);
if (isItemChecked(child)) {
m_config->addOption("", kOptionHeartbeat, newHeartbeatTime);
}
child = getItem(hwnd, IDC_GLOBAL_SCREENSAVER_SYNC);
if (!isItemChecked(child)) {
m_config->addOption("", kOptionScreenSaverSync, 0);
}
child = getItem(hwnd, IDC_GLOBAL_RELATIVE_MOVES);
if (isItemChecked(child)) {
m_config->addOption("", kOptionRelativeMouseMoves, 1);
}
child = getItem(hwnd, IDC_GLOBAL_LEAVE_FOREGROUND);
if (isItemChecked(child)) {
m_config->addOption("", kOptionWin32KeepForeground, 1);
}
// save last values
m_delayTime = newDelayTime;
m_twoTapTime = newTwoTapTime;
m_heartbeatTime = newHeartbeatTime;
return true;
}
int
CGlobalOptions::getTime(HWND hwnd, HWND child, bool reportError)
{
CString valueString = getWindowText(child);
int value = atoi(valueString.c_str());
if (value < 1) {
if (reportError) {
showError(hwnd, CStringUtil::format(
getString(IDS_INVALID_TIME).c_str(),
valueString.c_str()));
SetFocus(child);
}
return 0;
}
return value;
}
BOOL
CGlobalOptions::doDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM)
{
switch (message) {
case WM_INITDIALOG:
init(hwnd);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
if (save(hwnd)) {
EndDialog(hwnd, 0);
}
return TRUE;
case IDCANCEL:
EndDialog(hwnd, 0);
return TRUE;
}
break;
default:
break;
}
return FALSE;
}
BOOL CALLBACK
CGlobalOptions::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return s_singleton->doDlgProc(hwnd, message, wParam, lParam);
}

View File

@ -0,0 +1,67 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CGLOBALOPTIONS_H
#define CGLOBALOPTIONS_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
class CConfig;
//! Global options dialog for Microsoft Windows launcher
class CGlobalOptions {
public:
CGlobalOptions(HWND parent, CConfig*);
~CGlobalOptions();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user.
*/
void doModal();
//@}
//! @name accessors
//@{
//@}
private:
void init(HWND hwnd);
bool save(HWND hwnd);
int getTime(HWND hwnd, HWND child, bool reportError);
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CGlobalOptions* s_singleton;
HWND m_parent;
CConfig* m_config;
int m_delayTime;
int m_twoTapTime;
int m_heartbeatTime;
};
#endif

File diff suppressed because it is too large Load Diff

View File

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

111
cmd/launcher/CInfo.cpp Normal file
View File

@ -0,0 +1,111 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2006 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#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(), VERSION);
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);
}

57
cmd/launcher/CInfo.h Normal file
View File

@ -0,0 +1,57 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2006 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CINFO_H
#define CINFO_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
//! Info dialog for Microsoft Windows launcher
class CInfo {
public:
CInfo(HWND parent);
~CInfo();
//! @name manipulators
//@{
//! Run dialog
/*!
Display and handle the dialog until closed by the user.
*/
void doModal();
//@}
//! @name accessors
//@{
//@}
private:
void init(HWND hwnd);
// message handling
BOOL doDlgProc(HWND, UINT, WPARAM, LPARAM);
static BOOL CALLBACK dlgProc(HWND, UINT, WPARAM, LPARAM);
private:
static CInfo* s_singleton;
HWND m_parent;
};
#endif

View File

@ -0,0 +1,855 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#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 = 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 = 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 = 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 = 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 (size_t j = 0; j < m_edgeLinks.size(); ++j) {
if (m_edgeLinks[j] == oldLink) {
// found matching link
m_selectedLink = j;
for (size_t k = 0; k < 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 = SendMessage(child, CB_FINDSTRINGEXACT, (WPARAM)-1,
(LPARAM)name.c_str());
if (i == CB_ERR) {
// no match, select no screen
SendMessage(child, CB_SETCURSEL, 0, 0);
}
else {
SendMessage(child, CB_SETCURSEL, i, 0);
}
}
void
CScreensLinks::updateLinkEditControls(HWND hwnd, const CEdgeLink& link)
{
// fill link entry controls from link
HWND child = getItem(hwnd, IDC_SCREENS_SRC_SIDE);
SendMessage(child, CB_SETCURSEL, link.m_srcSide, 0);
selectScreen(hwnd, IDC_SCREENS_SRC_SCREEN, link.m_srcName);
selectScreen(hwnd, IDC_SCREENS_DST_SCREEN, link.m_dstName);
updateLinkIntervalControls(hwnd, link);
}
void
CScreensLinks::updateLinkIntervalControls(HWND hwnd, const CEdgeLink& link)
{
HWND child;
// src interval
child = getItem(hwnd, IDC_SCREENS_SRC_START);
setWindowText(child, formatIntervalValue(link.m_srcInterval.first));
child = getItem(hwnd, IDC_SCREENS_SRC_END);
setWindowText(child, formatIntervalValue(link.m_srcInterval.second));
// dst interval
child = getItem(hwnd, IDC_SCREENS_DST_START);
setWindowText(child, formatIntervalValue(link.m_dstInterval.first));
child = getItem(hwnd, IDC_SCREENS_DST_END);
setWindowText(child, formatIntervalValue(link.m_dstInterval.second));
}
void
CScreensLinks::updateLink(HWND hwnd)
{
updateLinkValid(hwnd, m_editedLink);
// update link in config
if (m_selectedLink != -1 && m_editedLinkIsValid) {
// editing an existing link and entry is valid
if (m_edgeLinks[m_selectedLink].disconnect(m_config)) {
// successfully removed old link
if (!m_editedLink.connect(m_config)) {
// couldn't set new link so restore old link
m_edgeLinks[m_selectedLink].connect(m_config);
}
else {
m_edgeLinks[m_selectedLink] = m_editedLink;
updateLinks(hwnd);
updateLinkEditControls(hwnd, m_editedLink);
}
}
}
updateLinkView(hwnd);
}
void
CScreensLinks::updateLinkValid(HWND hwnd, const CEdgeLink& link)
{
m_editedLinkIsValid = true;
// check source side and screen
if (link.m_srcSide == kNoDirection) {
m_editedLinkIsValid = false;
ShowWindow(m_srcSideError, SW_SHOWNA);
}
else {
ShowWindow(m_srcSideError, SW_HIDE);
}
if (!m_config->isCanonicalName(link.m_srcName)) {
m_editedLinkIsValid = false;
ShowWindow(m_srcScreenError, SW_SHOWNA);
}
else {
ShowWindow(m_srcScreenError, SW_HIDE);
}
// check for overlap. if editing a link we must remove it, then
// check for overlap and restore the old link.
bool overlap = false;
if (m_editedLinkIsValid) {
if (m_selectedLink == -1) {
if (link.overlaps(m_config)) {
m_editedLinkIsValid = false;
overlap = true;
}
}
else {
if (m_edgeLinks[m_selectedLink].disconnect(m_config)) {
overlap = link.overlaps(m_config);
m_edgeLinks[m_selectedLink].connect(m_config);
if (overlap) {
m_editedLinkIsValid = false;
}
}
}
}
ShowWindow(getItem(hwnd, IDC_SCREENS_OVERLAP_ERROR),
overlap ? SW_SHOWNA : SW_HIDE);
// check dst screen
if (!m_config->isCanonicalName(link.m_dstName)) {
m_editedLinkIsValid = false;
ShowWindow(m_dstScreenError, SW_SHOWNA);
}
else {
ShowWindow(m_dstScreenError, SW_HIDE);
}
// update add link button
enableItem(hwnd, IDC_SCREENS_ADD_LINK,
m_selectedLink == -1 && m_editedLinkIsValid);
}
void
CScreensLinks::updateLinkView(HWND /*hwnd*/)
{
// XXX -- draw visual of selected screen, highlighting selected link
}
HWND
CScreensLinks::createErrorBox(HWND parent)
{
return CreateWindow(TEXT("STATIC"), TEXT(""),
WS_CHILD | SS_OWNERDRAW,
0, 0, 1, 1,
parent, (HMENU)-1,
s_instance, NULL);
}
void
CScreensLinks::resizeErrorBoxes()
{
HWND hwnd = GetParent(m_srcSideError);
resizeErrorBox(m_srcSideError, getItem(hwnd, IDC_SCREENS_SRC_SIDE));
resizeErrorBox(m_srcScreenError, getItem(hwnd, IDC_SCREENS_SRC_SCREEN));
resizeErrorBox(m_dstScreenError, getItem(hwnd, IDC_SCREENS_DST_SCREEN));
}
void
CScreensLinks::resizeErrorBox(HWND box, HWND assoc)
{
RECT rect;
GetWindowRect(assoc, &rect);
MapWindowPoints(NULL, GetParent(box), (POINT*)&rect, 2);
SetWindowPos(box, HWND_TOP, rect.left - 1, rect.top - 1,
rect.right - rect.left + 2,
rect.bottom - rect.top + 2, SWP_NOACTIVATE);
}
CString
CScreensLinks::formatIntervalValue(float x) const
{
return CStringUtil::print("%d", (int)(x * 100.0f + 0.5f));
}
CString
CScreensLinks::formatInterval(const CConfig::CInterval& i) const
{
if (i.first == 0.0f && i.second == 1.0f) {
return "";
}
else {
CString start = formatIntervalValue(i.first);
CString end = formatIntervalValue(i.second);
return CStringUtil::format(m_intervalFormat.c_str(),
start.c_str(), end.c_str());
}
}
CString
CScreensLinks::formatLink(const CEdgeLink& link) const
{
CString srcInterval = formatInterval(link.m_srcInterval);
CString dstInterval = formatInterval(link.m_dstInterval);
return CStringUtil::format(m_linkFormat.c_str(),
link.m_srcName.c_str(), srcInterval.c_str(),
m_sideLabel[link.m_srcSide - kFirstDirection].c_str(),
link.m_dstName.c_str(), dstInterval.c_str());
}
//
// CScreensLinks::CEdgeLink
//
CScreensLinks::CEdgeLink::CEdgeLink() :
m_srcName(),
m_srcSide(kNoDirection),
m_srcInterval(0.0f, 1.0f),
m_dstName(),
m_dstInterval(0.0f, 1.0f)
{
// do nothing
}
CScreensLinks::CEdgeLink::CEdgeLink(const CString& name,
const CConfigLink& link) :
m_srcName(name),
m_srcSide(link.first.getSide()),
m_srcInterval(link.first.getInterval()),
m_dstName(link.second.getName()),
m_dstInterval(link.second.getInterval())
{
// do nothing
}
bool
CScreensLinks::CEdgeLink::connect(CConfig* config)
{
return config->connect(m_srcName, m_srcSide,
m_srcInterval.first, m_srcInterval.second,
m_dstName,
m_dstInterval.first, m_dstInterval.second);
}
bool
CScreensLinks::CEdgeLink::disconnect(CConfig* config)
{
return config->disconnect(m_srcName, m_srcSide, 0.5f *
(m_srcInterval.first + m_srcInterval.second));
}
void
CScreensLinks::CEdgeLink::rename(const CString& oldName, const CString& newName)
{
if (m_srcName == oldName) {
m_srcName = newName;
}
if (m_dstName == oldName) {
m_dstName = newName;
}
}
bool
CScreensLinks::CEdgeLink::overlaps(const CConfig* config) const
{
return config->hasNeighbor(m_srcName, m_srcSide,
m_srcInterval.first, m_srcInterval.second);
}
bool
CScreensLinks::CEdgeLink::operator==(const CEdgeLink& x) const
{
return (m_srcName == x.m_srcName &&
m_srcSide == x.m_srcSide &&
m_srcInterval == x.m_srcInterval &&
m_dstName == x.m_dstName &&
m_dstInterval == x.m_dstInterval);
}

View File

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

261
cmd/launcher/LaunchUtil.cpp Normal file
View File

@ -0,0 +1,261 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#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;
}

61
cmd/launcher/LaunchUtil.h Normal file
View File

@ -0,0 +1,61 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef LAUNCHUTIL_H
#define LAUNCHUTIL_H
#include "CString.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#include <sys/types.h>
#include <sys/stat.h>
#define CLIENT_APP "synergyc.exe"
#define SERVER_APP "synergys.exe"
#define CONFIG_NAME "synergy.sgc"
class CConfig;
// client must define this and set it before calling any function here
extern HINSTANCE s_instance;
CString getString(DWORD id);
CString getErrorString(DWORD error);
void showError(HWND hwnd, const CString& msg);
void askOkay(HWND hwnd, const CString& title,
const CString& msg);
bool askVerify(HWND hwnd, const CString& msg);
bool isShowingDialog();
void setWindowText(HWND hwnd, const CString& msg);
CString getWindowText(HWND hwnd);
HWND getItem(HWND hwnd, int id);
void enableItem(HWND hwnd, int id, bool enabled);
void setItemChecked(HWND, bool);
bool isItemChecked(HWND);
CString getAppPath(const CString& appName);
bool isConfigNewer(time_t&, bool userConfig);
bool loadConfig(CConfig& config, time_t&, bool& userConfig);
bool saveConfig(const CConfig& config,
bool sysOnly, time_t&);
const TCHAR* const* getSettingsPath();
#endif

75
cmd/launcher/Makefile.am Normal file
View File

@ -0,0 +1,75 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2002 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
## Process this file with automake to produce Makefile.in
NULL =
MSWINDOWS_SOURCE_FILES = \
CAddScreen.cpp \
CAdvancedOptions.cpp \
CAutoStart.cpp \
CGlobalOptions.cpp \
CHotkeyOptions.cpp \
CInfo.cpp \
CScreensLinks.cpp \
LaunchUtil.cpp \
launcher.cpp \
CAddScreen.h \
CAdvancedOptions.h \
CAutoStart.h \
CGlobalOptions.h \
CHotkeyOptions.h \
CInfo.h \
CScreensLinks.h \
LaunchUtil.h \
resource.h \
launcher.rc \
$(NULL)
EXTRA_DIST = \
Makefile.win \
synergy.ico \
$(MSWINDOWS_SOURCE_FILES) \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
$(NULL)
if MSWINDOWS
bin_PROGRAMS = synergy
synergy_SOURCES = \
$(MSWINDOWS_SOURCE_FILES) \
$(NULL)
endif
synergy_LDADD = \
$(top_builddir)/lib/server/libserver.a \
$(top_builddir)/lib/platform/libplatform.a \
$(top_builddir)/lib/synergy/libsynergy.a \
$(top_builddir)/lib/net/libnet.a \
$(top_builddir)/lib/io/libio.a \
$(top_builddir)/lib/mt/libmt.a \
$(top_builddir)/lib/base/libbase.a \
$(top_builddir)/lib/common/libcommon.a \
$(top_builddir)/lib/arch/libarch.a \
$(NULL)
INCLUDES = \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/arch \
-I$(top_srcdir)/lib/base \
-I$(top_srcdir)/lib/mt \
-I$(top_srcdir)/lib/io \
-I$(top_srcdir)/lib/net \
-I$(top_srcdir)/lib/synergy \
-I$(top_srcdir)/lib/platform \
-I$(top_srcdir)/lib/server \
$(NULL)

101
cmd/launcher/Makefile.win Normal file
View File

@ -0,0 +1,101 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2007 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
BIN_LAUNCHER_SRC = cmd\launcher
BIN_LAUNCHER_DST = $(BUILD_DST)\$(BIN_LAUNCHER_SRC)
BIN_LAUNCHER_EXE = "$(BUILD_DST)\synergy.exe"
BIN_LAUNCHER_CPP = \
"CAddScreen.cpp" \
"CAdvancedOptions.cpp" \
"CAutoStart.cpp" \
"CGlobalOptions.cpp" \
"CHotkeyOptions.cpp" \
"CInfo.cpp" \
"CScreensLinks.cpp" \
"LaunchUtil.cpp" \
"launcher.cpp" \
$(NULL)
BIN_LAUNCHER_OBJ = \
"$(BIN_LAUNCHER_DST)\CAddScreen.obj" \
"$(BIN_LAUNCHER_DST)\CAdvancedOptions.obj" \
"$(BIN_LAUNCHER_DST)\CAutoStart.obj" \
"$(BIN_LAUNCHER_DST)\CGlobalOptions.obj" \
"$(BIN_LAUNCHER_DST)\CHotkeyOptions.obj" \
"$(BIN_LAUNCHER_DST)\CInfo.obj" \
"$(BIN_LAUNCHER_DST)\CScreensLinks.obj" \
"$(BIN_LAUNCHER_DST)\LaunchUtil.obj" \
"$(BIN_LAUNCHER_DST)\launcher.obj" \
$(NULL)
BIN_LAUNCHER_RC = "$(BIN_LAUNCHER_SRC)\launcher.rc"
BIN_LAUNCHER_RES = "$(BIN_LAUNCHER_DST)\launcher.res"
BIN_LAUNCHER_INC = \
/I"lib\common" \
/I"lib\arch" \
/I"lib\base" \
/I"lib\mt" \
/I"lib\io" \
/I"lib\net" \
/I"lib\synergy" \
/I"lib\platform" \
/I"lib\server" \
$(NULL)
BIN_LAUNCHER_LIB = \
$(LIB_SERVER_LIB) \
$(LIB_PLATFORM_LIB) \
$(LIB_SYNERGY_LIB) \
$(LIB_NET_LIB) \
$(LIB_IO_LIB) \
$(LIB_MT_LIB) \
$(LIB_BASE_LIB) \
$(LIB_ARCH_LIB) \
$(LIB_COMMON_LIB) \
$(NULL)
CPP_FILES = $(CPP_FILES) $(BIN_LAUNCHER_CPP)
OBJ_FILES = $(OBJ_FILES) $(BIN_LAUNCHER_OBJ)
PROGRAMS = $(PROGRAMS) $(BIN_LAUNCHER_EXE)
# Need shell functions.
guilibs = $(guilibs) shell32.lib
# Dependency rules
$(BIN_LAUNCHER_OBJ): $(AUTODEP)
!if EXIST($(BIN_LAUNCHER_DST)\deps.mak)
!include $(BIN_LAUNCHER_DST)\deps.mak
!endif
# Build rules. Use batch-mode rules if possible.
!if DEFINED(_NMAKE_VER)
{$(BIN_LAUNCHER_SRC)\}.cpp{$(BIN_LAUNCHER_DST)\}.obj::
!else
{$(BIN_LAUNCHER_SRC)\}.cpp{$(BIN_LAUNCHER_DST)\}.obj:
!endif
@$(ECHO) Compile in $(BIN_LAUNCHER_SRC)
-@$(MKDIR) $(BIN_LAUNCHER_DST) 2>NUL:
$(cpp) $(cppdebug) $(cppflags) $(cppvarsmt) /showIncludes \
$(BIN_LAUNCHER_INC) \
/Fo$(BIN_LAUNCHER_DST)\ \
/Fd$(BIN_LAUNCHER_DST)\src.pdb \
$< | $(AUTODEP) $(BIN_LAUNCHER_SRC) $(BIN_LAUNCHER_DST)
$(BIN_LAUNCHER_RES): $(BIN_LAUNCHER_RC)
@$(ECHO) Compile $(**F)
-@$(MKDIR) $(BIN_LAUNCHER_DST) 2>NUL:
$(rc) $(rcflags) $(rcvars) \
/fo$@ \
$**
$(BIN_LAUNCHER_EXE): $(BIN_LAUNCHER_OBJ) $(BIN_LAUNCHER_RES) $(BIN_LAUNCHER_LIB)
@$(ECHO) Link $(@F)
$(link) $(ldebug) $(guilflags) $(guilibsmt) \
/out:$@ \
$**
$(AUTODEP) $(BIN_LAUNCHER_SRC) $(BIN_LAUNCHER_DST) \
$(BIN_LAUNCHER_OBJ:.obj=.d)

755
cmd/launcher/launcher.cpp Normal file
View File

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

617
cmd/launcher/launcher.rc Normal file
View File

@ -0,0 +1,617 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <winresrc.h>
#if !defined(IDC_STATIC)
#define IDC_STATIC (-1)
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <winresrc.h>\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_MAIN DIALOG DISCARDABLE 32768, 0, 300, 199
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Synergy"
CLASS "GoSynergy"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Choose to share or use a shared keyboard and mouse, provide the requested information, then click Test to check your settings or Start to save your settings and start Synergy.",
IDC_STATIC,7,7,286,19
GROUPBOX "",IDC_STATIC,7,29,286,36
GROUPBOX "",IDC_STATIC,7,72,286,36
GROUPBOX "Options",IDC_STATIC,7,115,286,56
CONTROL "&Use another computer's shared keyboard and mouse (client)",
IDC_MAIN_CLIENT_RADIO,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,11,29,205,10
CONTROL "Share this computer's keyboard and mouse (server)",
IDC_MAIN_SERVER_RADIO,"Button",BS_AUTORADIOBUTTON,11,72,
177,10
LTEXT "Other Computer's &Host Name:",
IDC_MAIN_CLIENT_SERVER_NAME_LABEL,12,46,94,8
EDITTEXT IDC_MAIN_CLIENT_SERVER_NAME_EDIT,111,44,106,12,
ES_AUTOHSCROLL
LTEXT "&Screens && Links:",IDC_MAIN_SERVER_SCREENS_LABEL,12,89,
54,8
PUSHBUTTON "Configure...",IDC_MAIN_SCREENS,71,86,50,14
PUSHBUTTON "&Options...",IDC_MAIN_OPTIONS,12,129,50,14
PUSHBUTTON "Hot &Keys...",IDC_MAIN_HOTKEYS,68,129,50,14
PUSHBUTTON "Adva&nced...",IDC_MAIN_ADVANCED,124,129,50,14
PUSHBUTTON "&AutoStart...",IDC_MAIN_AUTOSTART,180,129,50,14
LTEXT "&Logging Level:",IDC_STATIC,12,154,48,8
COMBOBOX IDC_MAIN_DEBUG,68,151,61,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Info",IDC_MAIN_INFO,7,178,50,14
DEFPUSHBUTTON "&Test",IDC_MAIN_TEST,131,179,50,14
PUSHBUTTON "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, 290
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 periodically check that clients are still alive and connected. Use this only if synergy doesn't detect when clients disconnect.",
IDC_STATIC,7,122,193,24
CONTROL "Check clients every",IDC_GLOBAL_HEARTBEAT_CHECK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,153,78,10
EDITTEXT IDC_GLOBAL_HEARTBEAT_TIME,112,152,45,12,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "ms",IDC_STATIC,159,154,10,8
LTEXT "Synergy can synchronize screen savers across all screens.",
IDC_STATIC,7,176,193,8
CONTROL "Synchronize screen savers",IDC_GLOBAL_SCREENSAVER_SYNC,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,192,101,10
LTEXT "Relative mouse moves on secondary screens.",IDC_STATIC,
7,213,193,8
CONTROL "Use relative mouse moves",IDC_GLOBAL_RELATIVE_MOVES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,229,99,10
CONTROL "Don't take foreground window on Windows servers",
IDC_GLOBAL_LEAVE_FOREGROUND,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,7,250,177,10
DEFPUSHBUTTON "OK",IDOK,94,269,50,14
PUSHBUTTON "Cancel",IDCANCEL,150,269,50,14
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, 283
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 "Synergy - Version %{1}"
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

186
cmd/launcher/resource.h Normal file
View File

@ -0,0 +1,186 @@
//{{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_ADD_DC_SIZE 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

BIN
cmd/launcher/synergy.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,136 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#include "CClientTaskBarReceiver.h"
#include "CClient.h"
#include "CLock.h"
#include "CStringUtil.h"
#include "IEventQueue.h"
#include "CArch.h"
#include "Version.h"
//
// CClientTaskBarReceiver
//
CClientTaskBarReceiver::CClientTaskBarReceiver() :
m_state(kNotRunning)
{
// do nothing
}
CClientTaskBarReceiver::~CClientTaskBarReceiver()
{
// do nothing
}
void
CClientTaskBarReceiver::updateStatus(CClient* client, const CString& errorMsg)
{
{
// update our status
m_errorMessage = errorMsg;
if (client == NULL) {
if (m_errorMessage.empty()) {
m_state = kNotRunning;
}
else {
m_state = kNotWorking;
}
}
else {
m_server = client->getServerAddress().getHostname();
if (client->isConnected()) {
m_state = kConnected;
}
else if (client->isConnecting()) {
m_state = kConnecting;
}
else {
m_state = kNotConnected;
}
}
// let subclasses have a go
onStatusChanged(client);
}
// tell task bar
ARCH->updateReceiver(this);
}
CClientTaskBarReceiver::EState
CClientTaskBarReceiver::getStatus() const
{
return m_state;
}
const CString&
CClientTaskBarReceiver::getErrorMessage() const
{
return m_errorMessage;
}
void
CClientTaskBarReceiver::quit()
{
EVENTQUEUE->addEvent(CEvent(CEvent::kQuit));
}
void
CClientTaskBarReceiver::onStatusChanged(CClient*)
{
// do nothing
}
void
CClientTaskBarReceiver::lock() const
{
// do nothing
}
void
CClientTaskBarReceiver::unlock() const
{
// do nothing
}
std::string
CClientTaskBarReceiver::getToolTip() const
{
switch (m_state) {
case kNotRunning:
return CStringUtil::print("%s: Not running", kAppVersion);
case kNotWorking:
return CStringUtil::print("%s: %s",
kAppVersion, m_errorMessage.c_str());
case kNotConnected:
return CStringUtil::print("%s: Not connected: %s",
kAppVersion, m_errorMessage.c_str());
case kConnecting:
return CStringUtil::print("%s: Connecting to %s...",
kAppVersion, m_server.c_str());
case kConnected:
return CStringUtil::print("%s: Connected to %s",
kAppVersion, m_server.c_str());
default:
return "";
}
}

View File

@ -0,0 +1,83 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CCLIENTTASKBARRECEIVER_H
#define CCLIENTTASKBARRECEIVER_H
#include "CString.h"
#include "IArchTaskBarReceiver.h"
class CClient;
//! Implementation of IArchTaskBarReceiver for the synergy server
class CClientTaskBarReceiver : public IArchTaskBarReceiver {
public:
CClientTaskBarReceiver();
virtual ~CClientTaskBarReceiver();
//! @name manipulators
//@{
//! Update status
/*!
Determine the status and query required information from the client.
*/
void updateStatus(CClient*, const CString& errorMsg);
//@}
// IArchTaskBarReceiver overrides
virtual void showStatus() = 0;
virtual void runMenu(int x, int y) = 0;
virtual void primaryAction() = 0;
virtual void lock() const;
virtual void unlock() const;
virtual const Icon getIcon() const = 0;
virtual std::string getToolTip() const;
protected:
enum EState {
kNotRunning,
kNotWorking,
kNotConnected,
kConnecting,
kConnected,
kMaxState
};
//! Get status
EState getStatus() const;
//! Get error message
const CString& getErrorMessage() const;
//! Quit app
/*!
Causes the application to quit gracefully
*/
void quit();
//! Status change notification
/*!
Called when status changes. The default implementation does nothing.
*/
virtual void onStatusChanged(CClient* client);
private:
EState m_state;
CString m_errorMessage;
CString m_server;
};
#endif

View File

@ -0,0 +1,346 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#include "CMSWindowsClientTaskBarReceiver.h"
#include "CClient.h"
#include "CMSWindowsClipboard.h"
#include "LogOutputters.h"
#include "BasicTypes.h"
#include "CArch.h"
#include "CArchTaskBarWindows.h"
#include "resource.h"
//
// CMSWindowsClientTaskBarReceiver
//
const UINT CMSWindowsClientTaskBarReceiver::s_stateToIconID[kMaxState] =
{
IDI_TASKBAR_NOT_RUNNING,
IDI_TASKBAR_NOT_WORKING,
IDI_TASKBAR_NOT_CONNECTED,
IDI_TASKBAR_NOT_CONNECTED,
IDI_TASKBAR_CONNECTED
};
CMSWindowsClientTaskBarReceiver::CMSWindowsClientTaskBarReceiver(
HINSTANCE appInstance, const CBufferedLogOutputter* logBuffer) :
CClientTaskBarReceiver(),
m_appInstance(appInstance),
m_window(NULL),
m_logBuffer(logBuffer)
{
for (UInt32 i = 0; i < kMaxState; ++i) {
m_icon[i] = loadIcon(s_stateToIconID[i]);
}
m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR));
// don't create the window yet. we'll create it on demand. this
// has the side benefit of being created in the thread used for
// the task bar. that's good because it means the existence of
// the window won't prevent changing the main thread's desktop.
// add ourself to the task bar
ARCH->addReceiver(this);
}
CMSWindowsClientTaskBarReceiver::~CMSWindowsClientTaskBarReceiver()
{
ARCH->removeReceiver(this);
for (UInt32 i = 0; i < kMaxState; ++i) {
deleteIcon(m_icon[i]);
}
DestroyMenu(m_menu);
destroyWindow();
}
void
CMSWindowsClientTaskBarReceiver::showStatus()
{
// create the window
createWindow();
// lock self while getting status
lock();
// get the current status
std::string status = getToolTip();
// done getting status
unlock();
// update dialog
HWND child = GetDlgItem(m_window, IDC_TASKBAR_STATUS_STATUS);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)status.c_str());
if (!IsWindowVisible(m_window)) {
// position it by the mouse
POINT cursorPos;
GetCursorPos(&cursorPos);
RECT windowRect;
GetWindowRect(m_window, &windowRect);
int x = cursorPos.x;
int y = cursorPos.y;
int fw = GetSystemMetrics(SM_CXDLGFRAME);
int fh = GetSystemMetrics(SM_CYDLGFRAME);
int ww = windowRect.right - windowRect.left;
int wh = windowRect.bottom - windowRect.top;
int sw = GetSystemMetrics(SM_CXFULLSCREEN);
int sh = GetSystemMetrics(SM_CYFULLSCREEN);
if (fw < 1) {
fw = 1;
}
if (fh < 1) {
fh = 1;
}
if (x + ww - fw > sw) {
x -= ww - fw;
}
else {
x -= fw;
}
if (x < 0) {
x = 0;
}
if (y + wh - fh > sh) {
y -= wh - fh;
}
else {
y -= fh;
}
if (y < 0) {
y = 0;
}
SetWindowPos(m_window, HWND_TOPMOST, x, y, ww, wh,
SWP_SHOWWINDOW);
}
}
void
CMSWindowsClientTaskBarReceiver::runMenu(int x, int y)
{
// do popup menu. we need a window to pass to TrackPopupMenu().
// the SetForegroundWindow() and SendMessage() calls around
// TrackPopupMenu() are to get the menu to be dismissed when
// another window gets activated and are just one of those
// win32 weirdnesses.
createWindow();
SetForegroundWindow(m_window);
HMENU menu = GetSubMenu(m_menu, 0);
SetMenuDefaultItem(menu, IDC_TASKBAR_STATUS, FALSE);
HMENU logLevelMenu = GetSubMenu(menu, 3);
CheckMenuRadioItem(logLevelMenu, 0, 6,
CLOG->getFilter() - CLog::kERROR, MF_BYPOSITION);
int n = TrackPopupMenu(menu,
TPM_NONOTIFY |
TPM_RETURNCMD |
TPM_LEFTBUTTON |
TPM_RIGHTBUTTON,
x, y, 0, m_window, NULL);
SendMessage(m_window, WM_NULL, 0, 0);
// perform the requested operation
switch (n) {
case IDC_TASKBAR_STATUS:
showStatus();
break;
case IDC_TASKBAR_LOG:
copyLog();
break;
case IDC_TASKBAR_SHOW_LOG:
ARCH->showConsole(true);
break;
case IDC_TASKBAR_LOG_LEVEL_ERROR:
CLOG->setFilter(CLog::kERROR);
break;
case IDC_TASKBAR_LOG_LEVEL_WARNING:
CLOG->setFilter(CLog::kWARNING);
break;
case IDC_TASKBAR_LOG_LEVEL_NOTE:
CLOG->setFilter(CLog::kNOTE);
break;
case IDC_TASKBAR_LOG_LEVEL_INFO:
CLOG->setFilter(CLog::kINFO);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG:
CLOG->setFilter(CLog::kDEBUG);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG1:
CLOG->setFilter(CLog::kDEBUG1);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG2:
CLOG->setFilter(CLog::kDEBUG2);
break;
case IDC_TASKBAR_QUIT:
quit();
break;
}
}
void
CMSWindowsClientTaskBarReceiver::primaryAction()
{
showStatus();
}
const IArchTaskBarReceiver::Icon
CMSWindowsClientTaskBarReceiver::getIcon() const
{
return reinterpret_cast<Icon>(m_icon[getStatus()]);
}
void
CMSWindowsClientTaskBarReceiver::copyLog() const
{
if (m_logBuffer != NULL) {
// collect log buffer
CString data;
for (CBufferedLogOutputter::const_iterator index = m_logBuffer->begin();
index != m_logBuffer->end(); ++index) {
data += *index;
data += "\n";
}
// copy log to clipboard
if (!data.empty()) {
CMSWindowsClipboard clipboard(m_window);
clipboard.open(0);
clipboard.emptyUnowned();
clipboard.add(IClipboard::kText, data);
clipboard.close();
}
}
}
void
CMSWindowsClientTaskBarReceiver::onStatusChanged()
{
if (IsWindowVisible(m_window)) {
showStatus();
}
}
HICON
CMSWindowsClientTaskBarReceiver::loadIcon(UINT id)
{
HANDLE icon = LoadImage(m_appInstance,
MAKEINTRESOURCE(id),
IMAGE_ICON,
0, 0,
LR_DEFAULTCOLOR);
return reinterpret_cast<HICON>(icon);
}
void
CMSWindowsClientTaskBarReceiver::deleteIcon(HICON icon)
{
if (icon != NULL) {
DestroyIcon(icon);
}
}
void
CMSWindowsClientTaskBarReceiver::createWindow()
{
// ignore if already created
if (m_window != NULL) {
return;
}
// get the status dialog
m_window = CreateDialogParam(m_appInstance,
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
NULL,
(DLGPROC)&CMSWindowsClientTaskBarReceiver::staticDlgProc,
reinterpret_cast<LPARAM>(
reinterpret_cast<void*>(this)));
// window should appear on top of everything, including (especially)
// the task bar.
LONG_PTR style = GetWindowLongPtr(m_window, GWL_EXSTYLE);
style |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
SetWindowLongPtr(m_window, GWL_EXSTYLE, style);
// tell the task bar about this dialog
CArchTaskBarWindows::addDialog(m_window);
}
void
CMSWindowsClientTaskBarReceiver::destroyWindow()
{
if (m_window != NULL) {
CArchTaskBarWindows::removeDialog(m_window);
DestroyWindow(m_window);
m_window = NULL;
}
}
BOOL
CMSWindowsClientTaskBarReceiver::dlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM)
{
switch (msg) {
case WM_INITDIALOG:
// use default focus
return TRUE;
case WM_ACTIVATE:
// hide when another window is activated
if (LOWORD(wParam) == WA_INACTIVE) {
ShowWindow(hwnd, SW_HIDE);
}
break;
}
return FALSE;
}
BOOL CALLBACK
CMSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam)
{
// if msg is WM_INITDIALOG, extract the CMSWindowsClientTaskBarReceiver*
// and put it in the extra window data then forward the call.
CMSWindowsClientTaskBarReceiver* self = NULL;
if (msg == WM_INITDIALOG) {
self = reinterpret_cast<CMSWindowsClientTaskBarReceiver*>(
reinterpret_cast<void*>(lParam));
SetWindowLong(hwnd, GWL_USERDATA, lParam);
}
else {
// get the extra window data and forward the call
LONG data = GetWindowLong(hwnd, GWL_USERDATA);
if (data != 0) {
self = reinterpret_cast<CMSWindowsClientTaskBarReceiver*>(
reinterpret_cast<void*>(data));
}
}
// forward the message
if (self != NULL) {
return self->dlgProc(hwnd, msg, wParam, lParam);
}
else {
return (msg == WM_INITDIALOG) ? TRUE : FALSE;
}
}

View File

@ -0,0 +1,64 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CMSWINDOWSCLIENTTASKBARRECEIVER_H
#define CMSWINDOWSCLIENTTASKBARRECEIVER_H
#define WIN32_LEAN_AND_MEAN
#include "CClientTaskBarReceiver.h"
#include <windows.h>
class CBufferedLogOutputter;
//! Implementation of CClientTaskBarReceiver for Microsoft Windows
class CMSWindowsClientTaskBarReceiver : public CClientTaskBarReceiver {
public:
CMSWindowsClientTaskBarReceiver(HINSTANCE, const CBufferedLogOutputter*);
virtual ~CMSWindowsClientTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
protected:
void copyLog() const;
// CClientTaskBarReceiver overrides
virtual void onStatusChanged();
private:
HICON loadIcon(UINT);
void deleteIcon(HICON);
void createWindow();
void destroyWindow();
BOOL dlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK
staticDlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam);
private:
HINSTANCE m_appInstance;
HWND m_window;
HMENU m_menu;
HICON m_icon[kMaxState];
const CBufferedLogOutputter* m_logBuffer;
static const UINT s_stateToIconID[];
};
#endif

View File

@ -0,0 +1,56 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#include "COSXClientTaskBarReceiver.h"
#include "CArch.h"
//
// COSXClientTaskBarReceiver
//
COSXClientTaskBarReceiver::COSXClientTaskBarReceiver(
const CBufferedLogOutputter*)
{
// add ourself to the task bar
ARCH->addReceiver(this);
}
COSXClientTaskBarReceiver::~COSXClientTaskBarReceiver()
{
ARCH->removeReceiver(this);
}
void
COSXClientTaskBarReceiver::showStatus()
{
// do nothing
}
void
COSXClientTaskBarReceiver::runMenu(int, int)
{
// do nothing
}
void
COSXClientTaskBarReceiver::primaryAction()
{
// do nothing
}
const IArchTaskBarReceiver::Icon
COSXClientTaskBarReceiver::getIcon() const
{
return NULL;
}

View File

@ -0,0 +1,35 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef COSXCLIENTTASKBARRECEIVER_H
#define COSXCLIENTTASKBARRECEIVER_H
#include "CClientTaskBarReceiver.h"
class CBufferedLogOutputter;
//! Implementation of CClientTaskBarReceiver for OS X
class COSXClientTaskBarReceiver : public CClientTaskBarReceiver {
public:
COSXClientTaskBarReceiver(const CBufferedLogOutputter*);
virtual ~COSXClientTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
};
#endif

View File

@ -0,0 +1,56 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#include "CXWindowsClientTaskBarReceiver.h"
#include "CArch.h"
//
// CXWindowsClientTaskBarReceiver
//
CXWindowsClientTaskBarReceiver::CXWindowsClientTaskBarReceiver(
const CBufferedLogOutputter*)
{
// add ourself to the task bar
ARCH->addReceiver(this);
}
CXWindowsClientTaskBarReceiver::~CXWindowsClientTaskBarReceiver()
{
ARCH->removeReceiver(this);
}
void
CXWindowsClientTaskBarReceiver::showStatus()
{
// do nothing
}
void
CXWindowsClientTaskBarReceiver::runMenu(int, int)
{
// do nothing
}
void
CXWindowsClientTaskBarReceiver::primaryAction()
{
// do nothing
}
const IArchTaskBarReceiver::Icon
CXWindowsClientTaskBarReceiver::getIcon() const
{
return NULL;
}

View File

@ -0,0 +1,35 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CXWINDOWSCLIENTTASKBARRECEIVER_H
#define CXWINDOWSCLIENTTASKBARRECEIVER_H
#include "CClientTaskBarReceiver.h"
class CBufferedLogOutputter;
//! Implementation of CClientTaskBarReceiver for X Windows
class CXWindowsClientTaskBarReceiver : public CClientTaskBarReceiver {
public:
CXWindowsClientTaskBarReceiver(const CBufferedLogOutputter*);
virtual ~CXWindowsClientTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
};
#endif

98
cmd/synergyc/Makefile.am Normal file
View File

@ -0,0 +1,98 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2002 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
## Process this file with automake to produce Makefile.in
NULL =
COMMON_SOURCE_FILES = \
CClientTaskBarReceiver.cpp \
CClientTaskBarReceiver.h \
synergyc.cpp \
$(NULL)
XWINDOWS_SOURCE_FILES = \
CXWindowsClientTaskBarReceiver.cpp \
CXWindowsClientTaskBarReceiver.h \
$(NULL)
MSWINDOWS_SOURCE_FILES = \
CMSWindowsClientTaskBarReceiver.cpp \
CMSWindowsClientTaskBarReceiver.h \
resource.h \
synergyc.rc \
$(NULL)
CARBON_SOURCE_FILES = \
COSXClientTaskBarReceiver.cpp \
COSXClientTaskBarReceiver.h \
$(NULL)
EXTRA_DIST = \
Makefile.win \
synergyc.ico \
tb_error.ico \
tb_idle.ico \
tb_run.ico \
tb_wait.ico \
$(XWINDOWS_SOURCE_FILES) \
$(MSWINDOWS_SOURCE_FILES) \
$(CARBON_SOURCE_FILES) \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
$(NULL)
bin_PROGRAMS = synergyc
if XWINDOWS
synergyc_SOURCES = \
$(COMMON_SOURCE_FILES) \
$(XWINDOWS_SOURCE_FILES) \
$(NULL)
endif
if MSWINDOWS
synergyc_SOURCES = \
$(COMMON_SOURCE_FILES) \
$(MSWINDOWS_SOURCE_FILES) \
$(NULL)
endif
if CARBON
synergyc_SOURCES = \
$(COMMON_SOURCE_FILES) \
$(CARBON_SOURCE_FILES) \
$(NULL)
synergyc_LDFLAGS = \
-framework ScreenSaver \
-framework IOKit \
-framework ApplicationServices \
-framework Foundation \
$(NULL)
endif
synergyc_LDADD = \
$(top_builddir)/lib/client/libclient.a \
$(top_builddir)/lib/platform/libplatform.a \
$(top_builddir)/lib/synergy/libsynergy.a \
$(top_builddir)/lib/net/libnet.a \
$(top_builddir)/lib/io/libio.a \
$(top_builddir)/lib/mt/libmt.a \
$(top_builddir)/lib/base/libbase.a \
$(top_builddir)/lib/common/libcommon.a \
$(top_builddir)/lib/arch/libarch.a \
$(NULL)
INCLUDES = \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/arch \
-I$(top_srcdir)/lib/base \
-I$(top_srcdir)/lib/mt \
-I$(top_srcdir)/lib/io \
-I$(top_srcdir)/lib/net \
-I$(top_srcdir)/lib/synergy \
-I$(top_srcdir)/lib/platform \
-I$(top_srcdir)/lib/client \
$(NULL)

89
cmd/synergyc/Makefile.win Normal file
View File

@ -0,0 +1,89 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2007 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
BIN_SYNERGYC_SRC = cmd\synergyc
BIN_SYNERGYC_DST = $(BUILD_DST)\$(BIN_SYNERGYC_SRC)
BIN_SYNERGYC_EXE = "$(BUILD_DST)\synergyc.exe"
BIN_SYNERGYC_CPP = \
"CClientTaskBarReceiver.cpp" \
"CMSWindowsClientTaskBarReceiver.cpp" \
"synergyc.cpp" \
$(NULL)
BIN_SYNERGYC_OBJ = \
"$(BIN_SYNERGYC_DST)\CClientTaskBarReceiver.obj" \
"$(BIN_SYNERGYC_DST)\CMSWindowsClientTaskBarReceiver.obj" \
"$(BIN_SYNERGYC_DST)\synergyc.obj" \
$(NULL)
BIN_SYNERGYC_RC = "$(BIN_SYNERGYC_SRC)\synergyc.rc"
BIN_SYNERGYC_RES = "$(BIN_SYNERGYC_DST)\synergyc.res"
BIN_SYNERGYC_INC = \
/I"lib\common" \
/I"lib\arch" \
/I"lib\base" \
/I"lib\mt" \
/I"lib\io" \
/I"lib\net" \
/I"lib\synergy" \
/I"lib\platform" \
/I"lib\client" \
$(NULL)
BIN_SYNERGYC_LIB = \
$(LIB_CLIENT_LIB) \
$(LIB_PLATFORM_LIB) \
$(LIB_SYNERGY_LIB) \
$(LIB_NET_LIB) \
$(LIB_IO_LIB) \
$(LIB_MT_LIB) \
$(LIB_BASE_LIB) \
$(LIB_ARCH_LIB) \
$(LIB_COMMON_LIB) \
$(NULL)
CPP_FILES = $(CPP_FILES) $(BIN_SYNERGYC_CPP)
OBJ_FILES = $(OBJ_FILES) $(BIN_SYNERGYC_OBJ)
PROGRAMS = $(PROGRAMS) $(BIN_SYNERGYC_EXE)
# Need shell functions.
guilibs = $(guilibs) shell32.lib
# Dependency rules
$(BIN_SYNERGYC_OBJ): $(AUTODEP)
!if EXIST($(BIN_SYNERGYC_DST)\deps.mak)
!include $(BIN_SYNERGYC_DST)\deps.mak
!endif
# Build rules. Use batch-mode rules if possible.
!if DEFINED(_NMAKE_VER)
{$(BIN_SYNERGYC_SRC)\}.cpp{$(BIN_SYNERGYC_DST)\}.obj::
!else
{$(BIN_SYNERGYC_SRC)\}.cpp{$(BIN_SYNERGYC_DST)\}.obj:
!endif
@$(ECHO) Compile in $(BIN_SYNERGYC_SRC)
-@$(MKDIR) $(BIN_SYNERGYC_DST) 2>NUL:
$(cpp) $(cppdebug) $(cppflags) $(cppvarsmt) /showIncludes \
$(BIN_SYNERGYC_INC) \
/Fo$(BIN_SYNERGYC_DST)\ \
/Fd$(BIN_SYNERGYC_DST)\src.pdb \
$< | $(AUTODEP) $(BIN_SYNERGYC_SRC) $(BIN_SYNERGYC_DST)
$(BIN_SYNERGYC_RES): $(BIN_SYNERGYC_RC)
@$(ECHO) Compile $(**F)
-@$(MKDIR) $(BIN_SYNERGYC_DST) 2>NUL:
$(rc) $(rcflags) $(rcvars) \
/fo$@ \
$**
$(BIN_SYNERGYC_EXE): $(BIN_SYNERGYC_OBJ) $(BIN_SYNERGYC_RES) $(BIN_SYNERGYC_LIB)
@$(ECHO) Link $(@F)
$(link) $(ldebug) $(guilflags) $(guilibsmt) \
/out:$@ \
$**
$(AUTODEP) $(BIN_SYNERGYC_SRC) $(BIN_SYNERGYC_DST) \
$(BIN_SYNERGYC_OBJ:.obj=.d)

37
cmd/synergyc/resource.h Normal file
View File

@ -0,0 +1,37 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by synergyc.rc
//
#define IDS_FAILED 1
#define IDS_INIT_FAILED 2
#define IDS_UNCAUGHT_EXCEPTION 3
#define IDI_SYNERGY 101
#define IDI_TASKBAR_NOT_RUNNING 102
#define IDI_TASKBAR_NOT_WORKING 103
#define IDI_TASKBAR_NOT_CONNECTED 104
#define IDI_TASKBAR_CONNECTED 105
#define IDR_TASKBAR 107
#define IDD_TASKBAR_STATUS 108
#define IDC_TASKBAR_STATUS_STATUS 1000
#define IDC_TASKBAR_QUIT 40001
#define IDC_TASKBAR_STATUS 40002
#define IDC_TASKBAR_LOG 40003
#define IDC_TASKBAR_SHOW_LOG 40004
#define IDC_TASKBAR_LOG_LEVEL_ERROR 40009
#define IDC_TASKBAR_LOG_LEVEL_WARNING 40010
#define IDC_TASKBAR_LOG_LEVEL_NOTE 40011
#define IDC_TASKBAR_LOG_LEVEL_INFO 40012
#define IDC_TASKBAR_LOG_LEVEL_DEBUG 40013
#define IDC_TASKBAR_LOG_LEVEL_DEBUG1 40014
#define IDC_TASKBAR_LOG_LEVEL_DEBUG2 40015
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 109
#define _APS_NEXT_COMMAND_VALUE 40016
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

910
cmd/synergyc/synergyc.cpp Normal file
View File

@ -0,0 +1,910 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#include "CClient.h"
#include "CScreen.h"
#include "ProtocolTypes.h"
#include "Version.h"
#include "XScreen.h"
#include "CNetworkAddress.h"
#include "CSocketMultiplexer.h"
#include "CTCPSocketFactory.h"
#include "XSocket.h"
#include "CThread.h"
#include "CEventQueue.h"
#include "CFunctionEventJob.h"
#include "CFunctionJob.h"
#include "CLog.h"
#include "CString.h"
#include "CStringUtil.h"
#include "LogOutputters.h"
#include "CArch.h"
#include "XArch.h"
#include <cstring>
#define DAEMON_RUNNING(running_)
#if WINAPI_MSWINDOWS
#include "CArchMiscWindows.h"
#include "CMSWindowsScreen.h"
#include "CMSWindowsUtil.h"
#include "CMSWindowsClientTaskBarReceiver.h"
#include "resource.h"
#undef DAEMON_RUNNING
#define DAEMON_RUNNING(running_) CArchMiscWindows::daemonRunning(running_)
#elif WINAPI_XWINDOWS
#include "CXWindowsScreen.h"
#include "CXWindowsClientTaskBarReceiver.h"
#elif WINAPI_CARBON
#include "COSXScreen.h"
#include "COSXClientTaskBarReceiver.h"
#endif
// platform dependent name of a daemon
#if SYSAPI_WIN32
#define DAEMON_NAME "Synergy Client"
#elif SYSAPI_UNIX
#define DAEMON_NAME "synergyc"
#endif
typedef int (*StartupFunc)(int, char**);
static bool startClient();
static void parse(int argc, const char* const* argv);
//
// program arguments
//
#define ARG CArgs::s_instance
class CArgs {
public:
CArgs() :
m_pname(NULL),
m_backend(false),
m_restartable(true),
m_daemon(true),
m_logFilter(NULL),
m_display(NULL),
m_serverAddress(NULL)
{ s_instance = this; }
~CArgs() { s_instance = NULL; }
public:
static CArgs* s_instance;
const char* m_pname;
bool m_backend;
bool m_restartable;
bool m_daemon;
const char* m_logFilter;
const char* m_display;
CString m_name;
CNetworkAddress* m_serverAddress;
};
CArgs* CArgs::s_instance = NULL;
//
// platform dependent factories
//
static
CScreen*
createScreen()
{
#if WINAPI_MSWINDOWS
return new CScreen(new CMSWindowsScreen(false));
#elif WINAPI_XWINDOWS
return new CScreen(new CXWindowsScreen(ARG->m_display, false));
#elif WINAPI_CARBON
return new CScreen(new COSXScreen(false));
#endif
}
static
CClientTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer)
{
#if WINAPI_MSWINDOWS
return new CMSWindowsClientTaskBarReceiver(
CMSWindowsScreen::getInstance(), logBuffer);
#elif WINAPI_XWINDOWS
return new CXWindowsClientTaskBarReceiver(logBuffer);
#elif WINAPI_CARBON
return new COSXClientTaskBarReceiver(logBuffer);
#endif
}
//
// platform independent main
//
static CClient* s_client = NULL;
static CScreen* s_clientScreen = NULL;
static CClientTaskBarReceiver* s_taskBarReceiver = NULL;
static double s_retryTime = 0.0;
static bool s_suspened = false;
static
void
updateStatus()
{
s_taskBarReceiver->updateStatus(s_client, "");
}
static
void
updateStatus(const CString& msg)
{
s_taskBarReceiver->updateStatus(s_client, msg);
}
static
void
resetRestartTimeout()
{
s_retryTime = 0.0;
}
static
double
nextRestartTimeout()
{
// choose next restart timeout. we start with rapid retries
// then slow down.
if (s_retryTime < 1.0) {
s_retryTime = 1.0;
}
else if (s_retryTime < 3.0) {
s_retryTime = 3.0;
}
else if (s_retryTime < 5.0) {
s_retryTime = 5.0;
}
else if (s_retryTime < 15.0) {
s_retryTime = 15.0;
}
else if (s_retryTime < 30.0) {
s_retryTime = 30.0;
}
else {
s_retryTime = 60.0;
}
return s_retryTime;
}
static
void
handleScreenError(const CEvent&, void*)
{
LOG((CLOG_CRIT "error on screen"));
EVENTQUEUE->addEvent(CEvent(CEvent::kQuit));
}
static
CScreen*
openClientScreen()
{
CScreen* screen = createScreen();
EVENTQUEUE->adoptHandler(IScreen::getErrorEvent(),
screen->getEventTarget(),
new CFunctionEventJob(
&handleScreenError));
return screen;
}
static
void
closeClientScreen(CScreen* screen)
{
if (screen != NULL) {
EVENTQUEUE->removeHandler(IScreen::getErrorEvent(),
screen->getEventTarget());
delete screen;
}
}
static
void
handleClientRestart(const CEvent&, void* vtimer)
{
// discard old timer
CEventQueueTimer* timer = reinterpret_cast<CEventQueueTimer*>(vtimer);
EVENTQUEUE->deleteTimer(timer);
EVENTQUEUE->removeHandler(CEvent::kTimer, timer);
// reconnect
startClient();
}
static
void
scheduleClientRestart(double retryTime)
{
// install a timer and handler to retry later
LOG((CLOG_DEBUG "retry in %.0f seconds", retryTime));
CEventQueueTimer* timer = EVENTQUEUE->newOneShotTimer(retryTime, NULL);
EVENTQUEUE->adoptHandler(CEvent::kTimer, timer,
new CFunctionEventJob(&handleClientRestart, timer));
}
static
void
handleClientConnected(const CEvent&, void*)
{
LOG((CLOG_NOTE "connected to server"));
resetRestartTimeout();
updateStatus();
}
static
void
handleClientFailed(const CEvent& e, void*)
{
CClient::CFailInfo* info =
reinterpret_cast<CClient::CFailInfo*>(e.getData());
updateStatus(CString("Failed to connect to server: ") + info->m_what);
if (!ARG->m_restartable || !info->m_retry) {
LOG((CLOG_ERR "failed to connect to server: %s", info->m_what));
EVENTQUEUE->addEvent(CEvent(CEvent::kQuit));
}
else {
LOG((CLOG_WARN "failed to connect to server: %s", info->m_what));
if (!s_suspened) {
scheduleClientRestart(nextRestartTimeout());
}
}
}
static
void
handleClientDisconnected(const CEvent&, void*)
{
LOG((CLOG_NOTE "disconnected from server"));
if (!ARG->m_restartable) {
EVENTQUEUE->addEvent(CEvent(CEvent::kQuit));
}
else if (!s_suspened) {
s_client->connect();
}
updateStatus();
}
static
CClient*
openClient(const CString& name, const CNetworkAddress& address, CScreen* screen)
{
CClient* client = new CClient(name, address,
new CTCPSocketFactory, NULL, screen);
EVENTQUEUE->adoptHandler(CClient::getConnectedEvent(),
client->getEventTarget(),
new CFunctionEventJob(handleClientConnected));
EVENTQUEUE->adoptHandler(CClient::getConnectionFailedEvent(),
client->getEventTarget(),
new CFunctionEventJob(handleClientFailed));
EVENTQUEUE->adoptHandler(CClient::getDisconnectedEvent(),
client->getEventTarget(),
new CFunctionEventJob(handleClientDisconnected));
return client;
}
static
void
closeClient(CClient* client)
{
if (client == NULL) {
return;
}
EVENTQUEUE->removeHandler(CClient::getConnectedEvent(), client);
EVENTQUEUE->removeHandler(CClient::getConnectionFailedEvent(), client);
EVENTQUEUE->removeHandler(CClient::getDisconnectedEvent(), client);
delete client;
}
static
bool
startClient()
{
double retryTime;
CScreen* clientScreen = NULL;
try {
if (s_clientScreen == NULL) {
clientScreen = openClientScreen();
s_client = openClient(ARG->m_name,
*ARG->m_serverAddress, clientScreen);
s_clientScreen = clientScreen;
LOG((CLOG_NOTE "started client"));
}
s_client->connect();
updateStatus();
return true;
}
catch (XScreenUnavailable& e) {
LOG((CLOG_WARN "cannot open secondary screen: %s", e.what()));
closeClientScreen(clientScreen);
updateStatus(CString("Cannot open secondary screen: ") + e.what());
retryTime = e.getRetryTime();
}
catch (XScreenOpenFailure& e) {
LOG((CLOG_CRIT "cannot open secondary screen: %s", e.what()));
closeClientScreen(clientScreen);
return false;
}
catch (XBase& e) {
LOG((CLOG_CRIT "failed to start client: %s", e.what()));
closeClientScreen(clientScreen);
return false;
}
if (ARG->m_restartable) {
scheduleClientRestart(retryTime);
return true;
}
else {
// don't try again
return false;
}
}
static
void
stopClient()
{
closeClient(s_client);
closeClientScreen(s_clientScreen);
s_client = NULL;
s_clientScreen = NULL;
}
static
int
mainLoop()
{
// create socket multiplexer. this must happen after daemonization
// on unix because threads evaporate across a fork().
CSocketMultiplexer multiplexer;
// create the event queue
CEventQueue eventQueue;
// start the client. if this return false then we've failed and
// we shouldn't retry.
LOG((CLOG_DEBUG1 "starting client"));
if (!startClient()) {
return kExitFailed;
}
// run event loop. if startClient() failed we're supposed to retry
// later. the timer installed by startClient() will take care of
// that.
CEvent event;
DAEMON_RUNNING(true);
EVENTQUEUE->getEvent(event);
while (event.getType() != CEvent::kQuit) {
EVENTQUEUE->dispatchEvent(event);
CEvent::deleteData(event);
EVENTQUEUE->getEvent(event);
}
DAEMON_RUNNING(false);
// close down
LOG((CLOG_DEBUG1 "stopping client"));
stopClient();
updateStatus();
LOG((CLOG_NOTE "stopped client"));
return kExitSuccess;
}
static
int
daemonMainLoop(int, const char**)
{
#if SYSAPI_WIN32
CSystemLogger sysLogger(DAEMON_NAME, false);
#else
CSystemLogger sysLogger(DAEMON_NAME, true);
#endif
return mainLoop();
}
static
int
standardStartup(int argc, char** argv)
{
if (!ARG->m_daemon) {
ARCH->showConsole(false);
}
// parse command line
parse(argc, argv);
// daemonize if requested
if (ARG->m_daemon) {
return ARCH->daemonize(DAEMON_NAME, &daemonMainLoop);
}
else {
return mainLoop();
}
}
static
int
run(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup)
{
// general initialization
ARG->m_serverAddress = new CNetworkAddress;
ARG->m_pname = ARCH->getBasename(argv[0]);
// install caller's output filter
if (outputter != NULL) {
CLOG->insert(outputter);
}
// save log messages
CBufferedLogOutputter logBuffer(1000);
CLOG->insert(&logBuffer, true);
// make the task bar receiver. the user can control this app
// through the task bar.
s_taskBarReceiver = createTaskBarReceiver(&logBuffer);
// run
int result = startup(argc, argv);
// done with task bar receiver
delete s_taskBarReceiver;
// done with log buffer
CLOG->remove(&logBuffer);
delete ARG->m_serverAddress;
return result;
}
//
// command line parsing
//
#define BYE "\nTry `%s --help' for more information."
static void (*bye)(int) = &exit;
static
void
version()
{
LOG((CLOG_PRINT "%s %s, protocol version %d.%d\n%s",
ARG->m_pname,
kVersion,
kProtocolMajorVersion,
kProtocolMinorVersion,
kCopyright));
}
static
void
help()
{
#if WINAPI_XWINDOWS
# define USAGE_DISPLAY_ARG \
" [--display <display>]"
# define USAGE_DISPLAY_INFO \
" --display <display> connect to the X server at <display>\n"
#else
# define USAGE_DISPLAY_ARG
# define USAGE_DISPLAY_INFO
#endif
LOG((CLOG_PRINT
"Usage: %s"
" [--daemon|--no-daemon]"
" [--debug <level>]"
USAGE_DISPLAY_ARG
" [--name <screen-name>]"
" [--restart|--no-restart]"
" <server-address>"
"\n\n"
"Start the synergy mouse/keyboard sharing server.\n"
"\n"
" -d, --debug <level> filter out log messages with priorty below level.\n"
" level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n"
" DEBUG, DEBUG1, DEBUG2.\n"
USAGE_DISPLAY_INFO
" -f, --no-daemon run the client in the foreground.\n"
"* --daemon run the client as a daemon.\n"
" -n, --name <screen-name> use screen-name instead the hostname to identify\n"
" ourself to the server.\n"
" -1, --no-restart do not try to restart the client if it fails for\n"
" some reason.\n"
"* --restart restart the client automatically if it fails.\n"
" -h, --help display this help and exit.\n"
" --version display version information and exit.\n"
"\n"
"* marks defaults.\n"
"\n"
"The server address is of the form: [<hostname>][:<port>]. The hostname\n"
"must be the address or hostname of the server. The port overrides the\n"
"default port, %d.\n"
"\n"
"Where log messages go depends on the platform and whether or not the\n"
"client is running as a daemon.",
ARG->m_pname, kDefaultPort));
}
static
bool
isArg(int argi, int argc, const char* const* argv,
const char* name1, const char* name2,
int minRequiredParameters = 0)
{
if ((name1 != NULL && strcmp(argv[argi], name1) == 0) ||
(name2 != NULL && strcmp(argv[argi], name2) == 0)) {
// match. check args left.
if (argi + minRequiredParameters >= argc) {
LOG((CLOG_PRINT "%s: missing arguments for `%s'" BYE,
ARG->m_pname, argv[argi], ARG->m_pname));
bye(kExitArgs);
}
return true;
}
// no match
return false;
}
static
void
parse(int argc, const char* const* argv)
{
assert(ARG->m_pname != NULL);
assert(argv != NULL);
assert(argc >= 1);
// set defaults
ARG->m_name = ARCH->getHostName();
// parse options
int i;
for (i = 1; i < argc; ++i) {
if (isArg(i, argc, argv, "-d", "--debug", 1)) {
// change logging level
ARG->m_logFilter = argv[++i];
}
else if (isArg(i, argc, argv, "-n", "--name", 1)) {
// save screen name
ARG->m_name = argv[++i];
}
else if (isArg(i, argc, argv, NULL, "--camp")) {
// ignore -- included for backwards compatibility
}
else if (isArg(i, argc, argv, NULL, "--no-camp")) {
// ignore -- included for backwards compatibility
}
else if (isArg(i, argc, argv, "-f", "--no-daemon")) {
// not a daemon
ARG->m_daemon = false;
}
else if (isArg(i, argc, argv, NULL, "--daemon")) {
// daemonize
ARG->m_daemon = true;
}
#if WINAPI_XWINDOWS
else if (isArg(i, argc, argv, "-display", "--display", 1)) {
// use alternative display
ARG->m_display = argv[++i];
}
#endif
else if (isArg(i, argc, argv, "-1", "--no-restart")) {
// don't try to restart
ARG->m_restartable = false;
}
else if (isArg(i, argc, argv, NULL, "--restart")) {
// try to restart
ARG->m_restartable = true;
}
else if (isArg(i, argc, argv, "-z", NULL)) {
ARG->m_backend = true;
}
else if (isArg(i, argc, argv, "-h", "--help")) {
help();
bye(kExitSuccess);
}
else if (isArg(i, argc, argv, NULL, "--version")) {
version();
bye(kExitSuccess);
}
else if (isArg(i, argc, argv, "--", NULL)) {
// remaining arguments are not options
++i;
break;
}
else if (argv[i][0] == '-') {
LOG((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
ARG->m_pname, argv[i], ARG->m_pname));
bye(kExitArgs);
}
else {
// this and remaining arguments are not options
break;
}
}
// exactly one non-option argument (server-address)
if (i == argc) {
LOG((CLOG_PRINT "%s: a server address or name is required" BYE,
ARG->m_pname, ARG->m_pname));
bye(kExitArgs);
}
if (i + 1 != argc) {
LOG((CLOG_PRINT "%s: unrecognized option `%s'" BYE,
ARG->m_pname, argv[i], ARG->m_pname));
bye(kExitArgs);
}
// save server address
try {
*ARG->m_serverAddress = CNetworkAddress(argv[i], kDefaultPort);
ARG->m_serverAddress->resolve();
}
catch (XSocketAddress& e) {
// allow an address that we can't look up if we're restartable.
// we'll try to resolve the address each time we connect to the
// server. a bad port will never get better. patch by Brent
// Priddy.
if (!ARG->m_restartable || e.getError() == XSocketAddress::kBadPort) {
LOG((CLOG_PRINT "%s: %s" BYE,
ARG->m_pname, e.what(), ARG->m_pname));
bye(kExitFailed);
}
}
// increase default filter level for daemon. the user must
// explicitly request another level for a daemon.
if (ARG->m_daemon && ARG->m_logFilter == NULL) {
#if SYSAPI_WIN32
if (CArchMiscWindows::isWindows95Family()) {
// windows 95 has no place for logging so avoid showing
// the log console window.
ARG->m_logFilter = "FATAL";
}
else
#endif
{
ARG->m_logFilter = "NOTE";
}
}
// set log filter
if (!CLOG->setFilter(ARG->m_logFilter)) {
LOG((CLOG_PRINT "%s: unrecognized log level `%s'" BYE,
ARG->m_pname, ARG->m_logFilter, ARG->m_pname));
bye(kExitArgs);
}
// identify system
LOG((CLOG_INFO "Synergy client %s on %s", kVersion, ARCH->getOSName().c_str()));
}
//
// platform dependent entry points
//
#if SYSAPI_WIN32
static bool s_hasImportantLogMessages = false;
//
// CMessageBoxOutputter
//
// This class writes severe log messages to a message box
//
class CMessageBoxOutputter : public ILogOutputter {
public:
CMessageBoxOutputter() { }
virtual ~CMessageBoxOutputter() { }
// 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 ""; }
};
bool
CMessageBoxOutputter::write(ELevel level, const char* message)
{
// note any important messages the user may need to know about
if (level <= CLog::kWARNING) {
s_hasImportantLogMessages = true;
}
// FATAL and PRINT messages get a dialog box if not running as
// backend. if we're running as a backend the user will have
// a chance to see the messages when we exit.
if (!ARG->m_backend && level <= CLog::kFATAL) {
MessageBox(NULL, message, ARG->m_pname, MB_OK | MB_ICONWARNING);
return false;
}
else {
return true;
}
}
static
void
byeThrow(int x)
{
CArchMiscWindows::daemonFailed(x);
}
static
int
daemonNTMainLoop(int argc, const char** argv)
{
parse(argc, argv);
ARG->m_backend = false;
return CArchMiscWindows::runDaemon(mainLoop);
}
static
int
daemonNTStartup(int, char**)
{
CSystemLogger sysLogger(DAEMON_NAME, false);
bye = &byeThrow;
return ARCH->daemonize(DAEMON_NAME, &daemonNTMainLoop);
}
static
int
foregroundStartup(int argc, char** argv)
{
ARCH->showConsole(false);
// parse command line
parse(argc, argv);
// never daemonize
return mainLoop();
}
static
void
showError(HINSTANCE instance, const char* title, UINT id, const char* arg)
{
CString fmt = CMSWindowsUtil::getString(instance, id);
CString msg = CStringUtil::format(fmt.c_str(), arg);
MessageBox(NULL, msg.c_str(), title, MB_OK | MB_ICONWARNING);
}
int WINAPI
WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
{
try {
CArchMiscWindows::setIcons((HICON)LoadImage(instance,
MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON,
32, 32, LR_SHARED),
(HICON)LoadImage(instance,
MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON,
16, 16, LR_SHARED));
CArch arch(instance);
CMSWindowsScreen::init(instance);
CLOG;
CThread::getCurrentThread().setPriority(-14);
CArgs args;
// set title on log window
ARCH->openConsole((CString(kAppVersion) + " " + "Client").c_str());
// windows NT family starts services using no command line options.
// since i'm not sure how to tell the difference between that and
// a user providing no options we'll assume that if there are no
// arguments and we're on NT then we're being invoked as a service.
// users on NT can use `--daemon' or `--no-daemon' to force us out
// of the service code path.
StartupFunc startup = &standardStartup;
if (!CArchMiscWindows::isWindows95Family()) {
if (__argc <= 1) {
startup = &daemonNTStartup;
}
else {
startup = &foregroundStartup;
}
}
// send PRINT and FATAL output to a message box
int result = run(__argc, __argv, new CMessageBoxOutputter, startup);
// let user examine any messages if we're running as a backend
// by putting up a dialog box before exiting.
if (args.m_backend && s_hasImportantLogMessages) {
showError(instance, args.m_pname, IDS_FAILED, "");
}
delete CLOG;
return result;
}
catch (XBase& e) {
showError(instance, __argv[0], IDS_UNCAUGHT_EXCEPTION, e.what());
//throw;
}
catch (XArch& e) {
showError(instance, __argv[0], IDS_INIT_FAILED, e.what().c_str());
}
catch (...) {
showError(instance, __argv[0], IDS_UNCAUGHT_EXCEPTION, "<unknown>");
//throw;
}
return kExitFailed;
}
#elif SYSAPI_UNIX
int
main(int argc, char** argv)
{
CArgs args;
try {
int result;
CArch arch;
CLOG;
CArgs args;
result = run(argc, argv, NULL, &standardStartup);
delete CLOG;
return result;
}
catch (XBase& e) {
LOG((CLOG_CRIT "Uncaught exception: %s\n", e.what()));
throw;
}
catch (XArch& e) {
LOG((CLOG_CRIT "Initialization failed: %s" BYE, e.what().c_str()));
return kExitFailed;
}
catch (...) {
LOG((CLOG_CRIT "Uncaught exception: <unknown exception>\n"));
throw;
}
}
#else
#error no main() for platform
#endif

BIN
cmd/synergyc/synergyc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

141
cmd/synergyc/synergyc.rc Normal file
View File

@ -0,0 +1,141 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <winresrc.h>
#if !defined(IDC_STATIC)
#define IDC_STATIC (-1)
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <winresrc.h>\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_SYNERGY ICON DISCARDABLE "synergyc.ico"
IDI_TASKBAR_NOT_RUNNING ICON DISCARDABLE "tb_idle.ico"
IDI_TASKBAR_NOT_WORKING ICON DISCARDABLE "tb_error.ico"
IDI_TASKBAR_NOT_CONNECTED ICON DISCARDABLE "tb_wait.ico"
IDI_TASKBAR_CONNECTED ICON DISCARDABLE "tb_run.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_TASKBAR_STATUS DIALOG DISCARDABLE 0, 0, 145, 18
STYLE DS_MODALFRAME | WS_POPUP
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_TASKBAR_STATUS_STATUS,3,3,139,12,ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_TASKBAR MENU DISCARDABLE
BEGIN
POPUP "Synergy"
BEGIN
MENUITEM "Show Status", IDC_TASKBAR_STATUS
MENUITEM "Show Log", IDC_TASKBAR_SHOW_LOG
MENUITEM "Copy Log To Clipboard", IDC_TASKBAR_LOG
POPUP "Set Log Level"
BEGIN
MENUITEM "Error", IDC_TASKBAR_LOG_LEVEL_ERROR
MENUITEM "Warning", IDC_TASKBAR_LOG_LEVEL_WARNING
MENUITEM "Note", IDC_TASKBAR_LOG_LEVEL_NOTE
MENUITEM "Info", IDC_TASKBAR_LOG_LEVEL_INFO
MENUITEM "Debug", IDC_TASKBAR_LOG_LEVEL_DEBUG
MENUITEM "Debug1", IDC_TASKBAR_LOG_LEVEL_DEBUG1
MENUITEM "Debug2", IDC_TASKBAR_LOG_LEVEL_DEBUG2
END
MENUITEM SEPARATOR
MENUITEM "Quit", IDC_TASKBAR_QUIT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_FAILED "Synergy is about to quit with errors or warnings. Please check the log then click OK."
IDS_INIT_FAILED "Synergy failed to initialize: %{1}"
IDS_UNCAUGHT_EXCEPTION "Uncaught exception: %{1}"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

BIN
cmd/synergyc/tb_error.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
cmd/synergyc/tb_idle.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
cmd/synergyc/tb_run.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
cmd/synergyc/tb_wait.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

@ -0,0 +1,374 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#include "CMSWindowsServerTaskBarReceiver.h"
#include "CServer.h"
#include "CMSWindowsClipboard.h"
#include "IEventQueue.h"
#include "LogOutputters.h"
#include "BasicTypes.h"
#include "CArch.h"
#include "CArchTaskBarWindows.h"
#include "resource.h"
extern CEvent::Type getReloadConfigEvent();
extern CEvent::Type getForceReconnectEvent();
//
// CMSWindowsServerTaskBarReceiver
//
const UINT CMSWindowsServerTaskBarReceiver::s_stateToIconID[kMaxState] =
{
IDI_TASKBAR_NOT_RUNNING,
IDI_TASKBAR_NOT_WORKING,
IDI_TASKBAR_NOT_CONNECTED,
IDI_TASKBAR_CONNECTED
};
CMSWindowsServerTaskBarReceiver::CMSWindowsServerTaskBarReceiver(
HINSTANCE appInstance, const CBufferedLogOutputter* logBuffer) :
CServerTaskBarReceiver(),
m_appInstance(appInstance),
m_window(NULL),
m_logBuffer(logBuffer)
{
for (UInt32 i = 0; i < kMaxState; ++i) {
m_icon[i] = loadIcon(s_stateToIconID[i]);
}
m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR));
// don't create the window yet. we'll create it on demand. this
// has the side benefit of being created in the thread used for
// the task bar. that's good because it means the existence of
// the window won't prevent changing the main thread's desktop.
// add ourself to the task bar
ARCH->addReceiver(this);
}
CMSWindowsServerTaskBarReceiver::~CMSWindowsServerTaskBarReceiver()
{
ARCH->removeReceiver(this);
for (UInt32 i = 0; i < kMaxState; ++i) {
deleteIcon(m_icon[i]);
}
DestroyMenu(m_menu);
destroyWindow();
}
void
CMSWindowsServerTaskBarReceiver::showStatus()
{
// create the window
createWindow();
// lock self while getting status
lock();
// get the current status
std::string status = getToolTip();
// get the connect clients, if any
const CClients& clients = getClients();
// done getting status
unlock();
// update dialog
HWND child = GetDlgItem(m_window, IDC_TASKBAR_STATUS_STATUS);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)status.c_str());
child = GetDlgItem(m_window, IDC_TASKBAR_STATUS_CLIENTS);
SendMessage(child, LB_RESETCONTENT, 0, 0);
for (CClients::const_iterator index = clients.begin();
index != clients.end(); ) {
const char* client = index->c_str();
if (++index == clients.end()) {
SendMessage(child, LB_ADDSTRING, 0, (LPARAM)client);
}
else {
SendMessage(child, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)client);
}
}
if (!IsWindowVisible(m_window)) {
// position it by the mouse
POINT cursorPos;
GetCursorPos(&cursorPos);
RECT windowRect;
GetWindowRect(m_window, &windowRect);
int x = cursorPos.x;
int y = cursorPos.y;
int fw = GetSystemMetrics(SM_CXDLGFRAME);
int fh = GetSystemMetrics(SM_CYDLGFRAME);
int ww = windowRect.right - windowRect.left;
int wh = windowRect.bottom - windowRect.top;
int sw = GetSystemMetrics(SM_CXFULLSCREEN);
int sh = GetSystemMetrics(SM_CYFULLSCREEN);
if (fw < 1) {
fw = 1;
}
if (fh < 1) {
fh = 1;
}
if (x + ww - fw > sw) {
x -= ww - fw;
}
else {
x -= fw;
}
if (x < 0) {
x = 0;
}
if (y + wh - fh > sh) {
y -= wh - fh;
}
else {
y -= fh;
}
if (y < 0) {
y = 0;
}
SetWindowPos(m_window, HWND_TOPMOST, x, y, ww, wh,
SWP_SHOWWINDOW);
}
}
void
CMSWindowsServerTaskBarReceiver::runMenu(int x, int y)
{
// do popup menu. we need a window to pass to TrackPopupMenu().
// the SetForegroundWindow() and SendMessage() calls around
// TrackPopupMenu() are to get the menu to be dismissed when
// another window gets activated and are just one of those
// win32 weirdnesses.
createWindow();
SetForegroundWindow(m_window);
HMENU menu = GetSubMenu(m_menu, 0);
SetMenuDefaultItem(menu, IDC_TASKBAR_STATUS, FALSE);
HMENU logLevelMenu = GetSubMenu(menu, 3);
CheckMenuRadioItem(logLevelMenu, 0, 6,
CLOG->getFilter() - CLog::kERROR, MF_BYPOSITION);
int n = TrackPopupMenu(menu,
TPM_NONOTIFY |
TPM_RETURNCMD |
TPM_LEFTBUTTON |
TPM_RIGHTBUTTON,
x, y, 0, m_window, NULL);
SendMessage(m_window, WM_NULL, 0, 0);
// perform the requested operation
switch (n) {
case IDC_TASKBAR_STATUS:
showStatus();
break;
case IDC_TASKBAR_LOG:
copyLog();
break;
case IDC_TASKBAR_SHOW_LOG:
ARCH->showConsole(true);
break;
case IDC_RELOAD_CONFIG:
EVENTQUEUE->addEvent(CEvent(getReloadConfigEvent(),
IEventQueue::getSystemTarget()));
break;
case IDC_FORCE_RECONNECT:
EVENTQUEUE->addEvent(CEvent(getForceReconnectEvent(),
IEventQueue::getSystemTarget()));
break;
case IDC_TASKBAR_LOG_LEVEL_ERROR:
CLOG->setFilter(CLog::kERROR);
break;
case IDC_TASKBAR_LOG_LEVEL_WARNING:
CLOG->setFilter(CLog::kWARNING);
break;
case IDC_TASKBAR_LOG_LEVEL_NOTE:
CLOG->setFilter(CLog::kNOTE);
break;
case IDC_TASKBAR_LOG_LEVEL_INFO:
CLOG->setFilter(CLog::kINFO);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG:
CLOG->setFilter(CLog::kDEBUG);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG1:
CLOG->setFilter(CLog::kDEBUG1);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG2:
CLOG->setFilter(CLog::kDEBUG2);
break;
case IDC_TASKBAR_QUIT:
quit();
break;
}
}
void
CMSWindowsServerTaskBarReceiver::primaryAction()
{
showStatus();
}
const IArchTaskBarReceiver::Icon
CMSWindowsServerTaskBarReceiver::getIcon() const
{
return reinterpret_cast<Icon>(m_icon[getStatus()]);
}
void
CMSWindowsServerTaskBarReceiver::copyLog() const
{
if (m_logBuffer != NULL) {
// collect log buffer
CString data;
for (CBufferedLogOutputter::const_iterator index = m_logBuffer->begin();
index != m_logBuffer->end(); ++index) {
data += *index;
data += "\n";
}
// copy log to clipboard
if (!data.empty()) {
CMSWindowsClipboard clipboard(m_window);
clipboard.open(0);
clipboard.emptyUnowned();
clipboard.add(IClipboard::kText, data);
clipboard.close();
}
}
}
void
CMSWindowsServerTaskBarReceiver::onStatusChanged()
{
if (IsWindowVisible(m_window)) {
showStatus();
}
}
HICON
CMSWindowsServerTaskBarReceiver::loadIcon(UINT id)
{
HANDLE icon = LoadImage(m_appInstance,
MAKEINTRESOURCE(id),
IMAGE_ICON,
0, 0,
LR_DEFAULTCOLOR);
return reinterpret_cast<HICON>(icon);
}
void
CMSWindowsServerTaskBarReceiver::deleteIcon(HICON icon)
{
if (icon != NULL) {
DestroyIcon(icon);
}
}
void
CMSWindowsServerTaskBarReceiver::createWindow()
{
// ignore if already created
if (m_window != NULL) {
return;
}
// get the status dialog
m_window = CreateDialogParam(m_appInstance,
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
NULL,
(DLGPROC)&CMSWindowsServerTaskBarReceiver::staticDlgProc,
reinterpret_cast<LPARAM>(
reinterpret_cast<void*>(this)));
// window should appear on top of everything, including (especially)
// the task bar.
LONG_PTR style = GetWindowLongPtr(m_window, GWL_EXSTYLE);
style |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
SetWindowLongPtr(m_window, GWL_EXSTYLE, style);
// tell the task bar about this dialog
CArchTaskBarWindows::addDialog(m_window);
}
void
CMSWindowsServerTaskBarReceiver::destroyWindow()
{
if (m_window != NULL) {
CArchTaskBarWindows::removeDialog(m_window);
DestroyWindow(m_window);
m_window = NULL;
}
}
BOOL
CMSWindowsServerTaskBarReceiver::dlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM)
{
switch (msg) {
case WM_INITDIALOG:
// use default focus
return TRUE;
case WM_ACTIVATE:
// hide when another window is activated
if (LOWORD(wParam) == WA_INACTIVE) {
ShowWindow(hwnd, SW_HIDE);
}
break;
}
return FALSE;
}
BOOL CALLBACK
CMSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam)
{
// if msg is WM_INITDIALOG, extract the CMSWindowsServerTaskBarReceiver*
// and put it in the extra window data then forward the call.
CMSWindowsServerTaskBarReceiver* self = NULL;
if (msg == WM_INITDIALOG) {
self = reinterpret_cast<CMSWindowsServerTaskBarReceiver*>(
reinterpret_cast<void*>(lParam));
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
}
else {
// get the extra window data and forward the call
LONG data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (data != 0) {
self = reinterpret_cast<CMSWindowsServerTaskBarReceiver*>(
reinterpret_cast<void*>(data));
}
}
// forward the message
if (self != NULL) {
return self->dlgProc(hwnd, msg, wParam, lParam);
}
else {
return (msg == WM_INITDIALOG) ? TRUE : FALSE;
}
}

View File

@ -0,0 +1,64 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CMSWINDOWSSERVERTASKBARRECEIVER_H
#define CMSWINDOWSSERVERTASKBARRECEIVER_H
#define WIN32_LEAN_AND_MEAN
#include "CServerTaskBarReceiver.h"
#include <windows.h>
class CBufferedLogOutputter;
//! Implementation of CServerTaskBarReceiver for Microsoft Windows
class CMSWindowsServerTaskBarReceiver : public CServerTaskBarReceiver {
public:
CMSWindowsServerTaskBarReceiver(HINSTANCE, const CBufferedLogOutputter*);
virtual ~CMSWindowsServerTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
protected:
void copyLog() const;
// CServerTaskBarReceiver overrides
virtual void onStatusChanged();
private:
HICON loadIcon(UINT);
void deleteIcon(HICON);
void createWindow();
void destroyWindow();
BOOL dlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK
staticDlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam);
private:
HINSTANCE m_appInstance;
HWND m_window;
HMENU m_menu;
HICON m_icon[kMaxState];
const CBufferedLogOutputter* m_logBuffer;
static const UINT s_stateToIconID[];
};
#endif

View File

@ -0,0 +1,56 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#include "COSXServerTaskBarReceiver.h"
#include "CArch.h"
//
// COSXServerTaskBarReceiver
//
COSXServerTaskBarReceiver::COSXServerTaskBarReceiver(
const CBufferedLogOutputter*)
{
// add ourself to the task bar
ARCH->addReceiver(this);
}
COSXServerTaskBarReceiver::~COSXServerTaskBarReceiver()
{
ARCH->removeReceiver(this);
}
void
COSXServerTaskBarReceiver::showStatus()
{
// do nothing
}
void
COSXServerTaskBarReceiver::runMenu(int, int)
{
// do nothing
}
void
COSXServerTaskBarReceiver::primaryAction()
{
// do nothing
}
const IArchTaskBarReceiver::Icon
COSXServerTaskBarReceiver::getIcon() const
{
return NULL;
}

View File

@ -0,0 +1,35 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef COSXSERVERTASKBARRECEIVER_H
#define COSXSERVERTASKBARRECEIVER_H
#include "CServerTaskBarReceiver.h"
class CBufferedLogOutputter;
//! Implementation of CServerTaskBarReceiver for OS X
class COSXServerTaskBarReceiver : public CServerTaskBarReceiver {
public:
COSXServerTaskBarReceiver(const CBufferedLogOutputter*);
virtual ~COSXServerTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
};
#endif

View File

@ -0,0 +1,133 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#include "CServerTaskBarReceiver.h"
#include "CServer.h"
#include "CLock.h"
#include "CStringUtil.h"
#include "IEventQueue.h"
#include "CArch.h"
#include "Version.h"
//
// CServerTaskBarReceiver
//
CServerTaskBarReceiver::CServerTaskBarReceiver() :
m_state(kNotRunning)
{
// do nothing
}
CServerTaskBarReceiver::~CServerTaskBarReceiver()
{
// do nothing
}
void
CServerTaskBarReceiver::updateStatus(CServer* server, const CString& errorMsg)
{
{
// update our status
m_errorMessage = errorMsg;
if (server == NULL) {
if (m_errorMessage.empty()) {
m_state = kNotRunning;
}
else {
m_state = kNotWorking;
}
}
else {
m_clients.clear();
server->getClients(m_clients);
if (m_clients.size() <= 1) {
m_state = kNotConnected;
}
else {
m_state = kConnected;
}
}
// let subclasses have a go
onStatusChanged(server);
}
// tell task bar
ARCH->updateReceiver(this);
}
CServerTaskBarReceiver::EState
CServerTaskBarReceiver::getStatus() const
{
return m_state;
}
const CString&
CServerTaskBarReceiver::getErrorMessage() const
{
return m_errorMessage;
}
const CServerTaskBarReceiver::CClients&
CServerTaskBarReceiver::getClients() const
{
return m_clients;
}
void
CServerTaskBarReceiver::quit()
{
EVENTQUEUE->addEvent(CEvent(CEvent::kQuit));
}
void
CServerTaskBarReceiver::onStatusChanged(CServer*)
{
// do nothing
}
void
CServerTaskBarReceiver::lock() const
{
// do nothing
}
void
CServerTaskBarReceiver::unlock() const
{
// do nothing
}
std::string
CServerTaskBarReceiver::getToolTip() const
{
switch (m_state) {
case kNotRunning:
return CStringUtil::print("%s: Not running", kAppVersion);
case kNotWorking:
return CStringUtil::print("%s: %s",
kAppVersion, m_errorMessage.c_str());
case kNotConnected:
return CStringUtil::print("%s: Waiting for clients", kAppVersion);
case kConnected:
return CStringUtil::print("%s: Connected", kAppVersion);
default:
return "";
}
}

View File

@ -0,0 +1,88 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CSERVERTASKBARRECEIVER_H
#define CSERVERTASKBARRECEIVER_H
#include "CString.h"
#include "IArchTaskBarReceiver.h"
#include "stdvector.h"
class CServer;
//! Implementation of IArchTaskBarReceiver for the synergy server
class CServerTaskBarReceiver : public IArchTaskBarReceiver {
public:
CServerTaskBarReceiver();
virtual ~CServerTaskBarReceiver();
//! @name manipulators
//@{
//! Update status
/*!
Determine the status and query required information from the server.
*/
void updateStatus(CServer*, const CString& errorMsg);
//@}
// IArchTaskBarReceiver overrides
virtual void showStatus() = 0;
virtual void runMenu(int x, int y) = 0;
virtual void primaryAction() = 0;
virtual void lock() const;
virtual void unlock() const;
virtual const Icon getIcon() const = 0;
virtual std::string getToolTip() const;
protected:
typedef std::vector<CString> CClients;
enum EState {
kNotRunning,
kNotWorking,
kNotConnected,
kConnected,
kMaxState
};
//! Get status
EState getStatus() const;
//! Get error message
const CString& getErrorMessage() const;
//! Get connected clients
const CClients& getClients() const;
//! Quit app
/*!
Causes the application to quit gracefully
*/
void quit();
//! Status change notification
/*!
Called when status changes. The default implementation does
nothing.
*/
virtual void onStatusChanged(CServer* server);
private:
EState m_state;
CString m_errorMessage;
CClients m_clients;
};
#endif

View File

@ -0,0 +1,56 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#include "CXWindowsServerTaskBarReceiver.h"
#include "CArch.h"
//
// CXWindowsServerTaskBarReceiver
//
CXWindowsServerTaskBarReceiver::CXWindowsServerTaskBarReceiver(
const CBufferedLogOutputter*)
{
// add ourself to the task bar
ARCH->addReceiver(this);
}
CXWindowsServerTaskBarReceiver::~CXWindowsServerTaskBarReceiver()
{
ARCH->removeReceiver(this);
}
void
CXWindowsServerTaskBarReceiver::showStatus()
{
// do nothing
}
void
CXWindowsServerTaskBarReceiver::runMenu(int, int)
{
// do nothing
}
void
CXWindowsServerTaskBarReceiver::primaryAction()
{
// do nothing
}
const IArchTaskBarReceiver::Icon
CXWindowsServerTaskBarReceiver::getIcon() const
{
return NULL;
}

View File

@ -0,0 +1,35 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file 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.
*/
#ifndef CXWINDOWSSERVERTASKBARRECEIVER_H
#define CXWINDOWSSERVERTASKBARRECEIVER_H
#include "CServerTaskBarReceiver.h"
class CBufferedLogOutputter;
//! Implementation of CServerTaskBarReceiver for X Windows
class CXWindowsServerTaskBarReceiver : public CServerTaskBarReceiver {
public:
CXWindowsServerTaskBarReceiver(const CBufferedLogOutputter*);
virtual ~CXWindowsServerTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
};
#endif

98
cmd/synergys/Makefile.am Normal file
View File

@ -0,0 +1,98 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2002 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
## Process this file with automake to produce Makefile.in
NULL =
COMMON_SOURCE_FILES = \
CServerTaskBarReceiver.cpp \
CServerTaskBarReceiver.h \
synergys.cpp \
$(NULL)
XWINDOWS_SOURCE_FILES = \
CXWindowsServerTaskBarReceiver.cpp \
CXWindowsServerTaskBarReceiver.h \
$(NULL)
MSWINDOWS_SOURCE_FILES = \
CMSWindowsServerTaskBarReceiver.cpp \
CMSWindowsServerTaskBarReceiver.h \
resource.h \
synergys.rc \
$(NULL)
CARBON_SOURCE_FILES = \
COSXServerTaskBarReceiver.cpp \
COSXServerTaskBarReceiver.h \
$(NULL)
EXTRA_DIST = \
Makefile.win \
synergys.ico \
tb_error.ico \
tb_idle.ico \
tb_run.ico \
tb_wait.ico \
$(XWINDOWS_SOURCE_FILES) \
$(MSWINDOWS_SOURCE_FILES) \
$(CARBON_SOURCE_FILES) \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
$(NULL)
bin_PROGRAMS = synergys
if XWINDOWS
synergys_SOURCES = \
$(COMMON_SOURCE_FILES) \
$(XWINDOWS_SOURCE_FILES) \
$(NULL)
endif
if MSWINDOWS
synergys_SOURCES = \
$(COMMON_SOURCE_FILES) \
$(MSWINDOWS_SOURCE_FILES) \
$(NULL)
endif
if CARBON
synergys_SOURCES = \
$(COMMON_SOURCE_FILES) \
$(CARBON_SOURCE_FILES) \
$(NULL)
synergys_LDFLAGS = \
-framework ScreenSaver \
-framework IOKit \
-framework ApplicationServices \
-framework Foundation \
$(NULL)
endif
synergys_LDADD = \
$(top_builddir)/lib/server/libserver.a \
$(top_builddir)/lib/platform/libplatform.a \
$(top_builddir)/lib/synergy/libsynergy.a \
$(top_builddir)/lib/net/libnet.a \
$(top_builddir)/lib/io/libio.a \
$(top_builddir)/lib/mt/libmt.a \
$(top_builddir)/lib/base/libbase.a \
$(top_builddir)/lib/common/libcommon.a \
$(top_builddir)/lib/arch/libarch.a \
$(NULL)
INCLUDES = \
-I$(top_srcdir)/lib/common \
-I$(top_srcdir)/lib/arch \
-I$(top_srcdir)/lib/base \
-I$(top_srcdir)/lib/mt \
-I$(top_srcdir)/lib/io \
-I$(top_srcdir)/lib/net \
-I$(top_srcdir)/lib/synergy \
-I$(top_srcdir)/lib/platform \
-I$(top_srcdir)/lib/server \
$(NULL)

89
cmd/synergys/Makefile.win Normal file
View File

@ -0,0 +1,89 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2007 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
BIN_SYNERGYS_SRC = cmd\synergys
BIN_SYNERGYS_DST = $(BUILD_DST)\$(BIN_SYNERGYS_SRC)
BIN_SYNERGYS_EXE = "$(BUILD_DST)\synergys.exe"
BIN_SYNERGYS_CPP = \
"CServerTaskBarReceiver.cpp" \
"CMSWindowsServerTaskBarReceiver.cpp" \
"synergys.cpp" \
$(NULL)
BIN_SYNERGYS_OBJ = \
"$(BIN_SYNERGYS_DST)\CServerTaskBarReceiver.obj" \
"$(BIN_SYNERGYS_DST)\CMSWindowsServerTaskBarReceiver.obj" \
"$(BIN_SYNERGYS_DST)\synergys.obj" \
$(NULL)
BIN_SYNERGYS_RC = "$(BIN_SYNERGYS_SRC)\synergys.rc"
BIN_SYNERGYS_RES = "$(BIN_SYNERGYS_DST)\synergys.res"
BIN_SYNERGYS_INC = \
/I"lib\common" \
/I"lib\arch" \
/I"lib\base" \
/I"lib\mt" \
/I"lib\io" \
/I"lib\net" \
/I"lib\synergy" \
/I"lib\platform" \
/I"lib\server" \
$(NULL)
BIN_SYNERGYS_LIB = \
$(LIB_SERVER_LIB) \
$(LIB_PLATFORM_LIB) \
$(LIB_SYNERGY_LIB) \
$(LIB_NET_LIB) \
$(LIB_IO_LIB) \
$(LIB_MT_LIB) \
$(LIB_BASE_LIB) \
$(LIB_ARCH_LIB) \
$(LIB_COMMON_LIB) \
$(NULL)
CPP_FILES = $(CPP_FILES) $(BIN_SYNERGYS_CPP)
OBJ_FILES = $(OBJ_FILES) $(BIN_SYNERGYS_OBJ)
PROGRAMS = $(PROGRAMS) $(BIN_SYNERGYS_EXE)
# Need shell functions.
guilibs = $(guilibs) shell32.lib
# Dependency rules
$(BIN_SYNERGYS_OBJ): $(AUTODEP)
!if EXIST($(BIN_SYNERGYS_DST)\deps.mak)
!include $(BIN_SYNERGYS_DST)\deps.mak
!endif
# Build rules. Use batch-mode rules if possible.
!if DEFINED(_NMAKE_VER)
{$(BIN_SYNERGYS_SRC)\}.cpp{$(BIN_SYNERGYS_DST)\}.obj::
!else
{$(BIN_SYNERGYS_SRC)\}.cpp{$(BIN_SYNERGYS_DST)\}.obj:
!endif
@$(ECHO) Compile in $(BIN_SYNERGYS_SRC)
-@$(MKDIR) $(BIN_SYNERGYS_DST) 2>NUL:
$(cpp) $(cppdebug) $(cppflags) $(cppvarsmt) /showIncludes \
$(BIN_SYNERGYS_INC) \
/Fo$(BIN_SYNERGYS_DST)\ \
/Fd$(BIN_SYNERGYS_DST)\src.pdb \
$< | $(AUTODEP) $(BIN_SYNERGYS_SRC) $(BIN_SYNERGYS_DST)
$(BIN_SYNERGYS_RES): $(BIN_SYNERGYS_RC)
@$(ECHO) Compile $(**F)
-@$(MKDIR) $(BIN_SYNERGYS_DST) 2>NUL:
$(rc) $(rcflags) $(rcvars) \
/fo$@ \
$**
$(BIN_SYNERGYS_EXE): $(BIN_SYNERGYS_OBJ) $(BIN_SYNERGYS_RES) $(BIN_SYNERGYS_LIB)
@$(ECHO) Link $(@F)
$(link) $(ldebug) $(guilflags) $(guilibsmt) \
/out:$@ \
$**
$(AUTODEP) $(BIN_SYNERGYS_SRC) $(BIN_SYNERGYS_DST) \
$(BIN_SYNERGYS_OBJ:.obj=.d)

40
cmd/synergys/resource.h Normal file
View File

@ -0,0 +1,40 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by synergys.rc
//
#define IDS_FAILED 1
#define IDS_INIT_FAILED 2
#define IDS_UNCAUGHT_EXCEPTION 3
#define IDI_SYNERGY 101
#define IDI_TASKBAR_NOT_RUNNING 102
#define IDI_TASKBAR_NOT_WORKING 103
#define IDI_TASKBAR_NOT_CONNECTED 104
#define IDI_TASKBAR_CONNECTED 105
#define IDR_TASKBAR 107
#define IDD_TASKBAR_STATUS 108
#define IDC_TASKBAR_STATUS_STATUS 1000
#define IDC_TASKBAR_STATUS_CLIENTS 1001
#define IDC_TASKBAR_QUIT 40003
#define IDC_TASKBAR_STATUS 40004
#define IDC_TASKBAR_LOG 40005
#define IDC_RELOAD_CONFIG 40006
#define IDC_FORCE_RECONNECT 40007
#define IDC_TASKBAR_SHOW_LOG 40008
#define IDC_TASKBAR_LOG_LEVEL_ERROR 40009
#define IDC_TASKBAR_LOG_LEVEL_WARNING 40010
#define IDC_TASKBAR_LOG_LEVEL_NOTE 40011
#define IDC_TASKBAR_LOG_LEVEL_INFO 40012
#define IDC_TASKBAR_LOG_LEVEL_DEBUG 40013
#define IDC_TASKBAR_LOG_LEVEL_DEBUG1 40014
#define IDC_TASKBAR_LOG_LEVEL_DEBUG2 40015
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 109
#define _APS_NEXT_COMMAND_VALUE 40016
#define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

1312
cmd/synergys/synergys.cpp Normal file

File diff suppressed because it is too large Load Diff

BIN
cmd/synergys/synergys.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

146
cmd/synergys/synergys.rc Normal file
View File

@ -0,0 +1,146 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <winresrc.h>
#if !defined(IDC_STATIC)
#define IDC_STATIC (-1)
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <winresrc.h>\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_SYNERGY ICON DISCARDABLE "synergys.ico"
IDI_TASKBAR_NOT_RUNNING ICON DISCARDABLE "tb_idle.ico"
IDI_TASKBAR_NOT_WORKING ICON DISCARDABLE "tb_error.ico"
IDI_TASKBAR_NOT_CONNECTED ICON DISCARDABLE "tb_wait.ico"
IDI_TASKBAR_CONNECTED ICON DISCARDABLE "tb_run.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_TASKBAR MENU DISCARDABLE
BEGIN
POPUP "Synergy"
BEGIN
MENUITEM "Show Status", IDC_TASKBAR_STATUS
MENUITEM "Show Log", IDC_TASKBAR_SHOW_LOG
MENUITEM "Copy Log To Clipboard", IDC_TASKBAR_LOG
POPUP "Set Log Level"
BEGIN
MENUITEM "Error", IDC_TASKBAR_LOG_LEVEL_ERROR
MENUITEM "Warning", IDC_TASKBAR_LOG_LEVEL_WARNING
MENUITEM "Note", IDC_TASKBAR_LOG_LEVEL_NOTE
MENUITEM "Info", IDC_TASKBAR_LOG_LEVEL_INFO
MENUITEM "Debug", IDC_TASKBAR_LOG_LEVEL_DEBUG
MENUITEM "Debug1", IDC_TASKBAR_LOG_LEVEL_DEBUG1
MENUITEM "Debug2", IDC_TASKBAR_LOG_LEVEL_DEBUG2
END
MENUITEM "Reload Configuration", IDC_RELOAD_CONFIG
MENUITEM "Force Reconnect", IDC_FORCE_RECONNECT
MENUITEM SEPARATOR
MENUITEM "Quit", IDC_TASKBAR_QUIT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_TASKBAR_STATUS DIALOG DISCARDABLE 0, 0, 145, 60
STYLE DS_MODALFRAME | WS_POPUP
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_TASKBAR_STATUS_STATUS,3,3,139,12,ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER
LISTBOX IDC_TASKBAR_STATUS_CLIENTS,3,17,139,40,NOT LBS_NOTIFY |
LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_NOSEL | WS_VSCROLL |
WS_TABSTOP
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_FAILED "Synergy is about to quit with errors or warnings. Please check the log then click OK."
IDS_INIT_FAILED "Synergy failed to initialize: %{1}"
IDS_UNCAUGHT_EXCEPTION "Uncaught exception: %{1}"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

BIN
cmd/synergys/tb_error.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
cmd/synergys/tb_idle.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
cmd/synergys/tb_run.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
cmd/synergys/tb_wait.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

1327
config/config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

1410
config/config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

411
config/depcomp Normal file
View File

@ -0,0 +1,411 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 AIX compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
tmpdepfile1="$object.d"
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
if test "$libtool" = yes; then
"$@" -Wc,-MD
else
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
test -z "$dashmflag" && dashmflag=-M
( IFS=" "
case " $* " in
*" --mode=compile "*) # this is libtool, let us make it quiet
for arg
do # cycle over the arguments
case "$arg" in
"--mode=compile")
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet
shift # fnord
;;
esac
set fnord "$@" "$arg"
shift # fnord
shift # "$arg"
done
;;
esac
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
# X makedepend
(
shift
cleared=no
for arg in "$@"; do
case $cleared in no)
set ""; shift
cleared=yes
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift;;
-*)
;;
*)
set fnord "$@" "$arg"; shift;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tail +3 "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
( IFS=" "
case " $* " in
*" --mode=compile "*)
for arg
do # cycle over the arguments
case $arg in
"--mode=compile")
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet
shift # fnord
;;
esac
set fnord "$@" "$arg"
shift # fnord
shift # "$arg"
done
;;
esac
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
( IFS=" "
case " $* " in
*" --mode=compile "*)
for arg
do # cycle over the arguments
case $arg in
"--mode=compile")
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet
shift # fnord
;;
esac
set fnord "$@" "$arg"
shift # fnord
shift # "$arg"
done
;;
esac
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0

251
config/install-sh Normal file
View File

@ -0,0 +1,251 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

283
config/missing Normal file
View File

@ -0,0 +1,283 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.3 - GNU automake"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar ${1+"$@"} && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar ${1+"$@"} && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" ${1+"$@"} && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" ${1+"$@"} && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0

40
config/mkinstalldirs Normal file
View File

@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id$
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

289
configure.in Normal file
View File

@ -0,0 +1,289 @@
dnl synergy -- mouse and keyboard sharing utility
dnl Copyright (C) 2002 Chris Schoeneman
dnl
dnl This package is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl found in the file COPYING that should have accompanied this file.
dnl
dnl This package is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl Process this file with autoconf to produce a configure script.
dnl initialize
AC_INIT(lib/common/common.h)
AC_CONFIG_AUX_DIR(config)
dnl current version, extracted from $srcdir/lib/common/Version.h
MAJOR_VERSION=`grep '#.*define VERSION "' $srcdir/lib/common/Version.h | sed -e 's/.*"\([0-9]*\)\.[0-9]*\.[0-9]*".*/\1/'`
MINOR_VERSION=`grep '#.*define VERSION "' $srcdir/lib/common/Version.h | sed -e 's/.*"[0-9]*\.\([0-9]*\)\.[0-9]*".*/\1/'`
RELEASE_VERSION=`grep '#.*define VERSION "' $srcdir/lib/common/Version.h | sed -e 's/.*"[0-9]*\.[0-9]*\.\([0-9]*\)".*/\1/'`
dnl initialize automake
AM_INIT_AUTOMAKE(synergy, $MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION)
AM_CONFIG_HEADER(config.h)
dnl information on the package
dnl decide on platform
ARCH_LIBS=""
ARCH_CFLAGS=""
AC_CANONICAL_HOST
case $host in
*-*-mingw32* | *-*-windows*)
acx_host_arch="WIN32"
acx_host_winapi="MSWINDOWS"
;;
*-*-darwin*)
acx_host_arch="UNIX"
acx_host_winapi="CARBON"
;;
*)
acx_host_arch="UNIX"
acx_host_winapi="XWINDOWS"
;;
esac
ARCH_CFLAGS="$ARCH_CFLAGS -DSYSAPI_$acx_host_arch=1 -DWINAPI_$acx_host_winapi=1"
AM_CONDITIONAL(WIN32, test x$acx_host_arch = xWIN32)
AM_CONDITIONAL(UNIX, test x$acx_host_arch = xUNIX)
AM_CONDITIONAL(MSWINDOWS, test x$acx_host_winapi = xMSWINDOWS)
AM_CONDITIONAL(CARBON, test x$acx_host_winapi = xCARBON)
AM_CONDITIONAL(XWINDOWS, test x$acx_host_winapi = xXWINDOWS)
dnl checks for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_CHECK_PROG(HAVE_DOT, dot, YES, NO)
dnl AC_PROG_OBJC doesn't exist. Borrow some ideas from KDE.
dnl AC_MSG_CHECKING(for an Objective-C compiler)
OBJC="${CC}"
OBJCFLAGS="${CFLAGS}"
AC_SUBST(OBJC)
AC_SUBST(OBJCFLAGS)
_AM_DEPENDENCIES(OBJC)
dnl do checks using C++
AC_LANG_CPLUSPLUS
dnl our files end in .cpp not .C so tests should also end in .cpp
ac_ext=cpp
dnl enable debugging or disable asserts
AC_ARG_ENABLE([debug], [ --enable-debug enable debugging])
if test "x$enable_debug" != xno; then
CXXFLAGS="$CXXFLAGS -g"
else
CXXFLAGS="$CXXFLAGS -DNDEBUG"
fi
dnl check compiler
ACX_CHECK_CXX
dnl checks for libraries
if test x"$acx_host_arch" = xUNIX; then
ACX_PTHREAD(,AC_MSG_ERROR(You must have pthreads to compile synergy))
ARCH_LIBS="$PTHREAD_LIBS $ARCH_LIBS"
ARCH_CFLAGS="$ARCH_CFLAGS $PTHREAD_CFLAGS"
fi
if test x"$acx_host_winapi" = xCARBON; then
ARCH_LIBS="-framework Carbon $ARCH_LIBS"
fi
ACX_CHECK_NANOSLEEP
ACX_CHECK_INET_ATON
dnl checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS([unistd.h sys/time.h sys/types.h locale.h wchar.h])
AC_CHECK_HEADERS([sys/socket.h sys/select.h])
AC_CHECK_HEADERS([sys/utsname.h])
AC_CHECK_HEADERS([istream ostream sstream])
AC_HEADER_TIME
if test x"$acx_host_winapi" = xXWINDOWS; then
AC_PATH_X
AC_PATH_XTRA
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
XEXT_LDADD=
AC_CHECK_LIB(Xtst,
XTestQueryExtension,
[XEXT_LDADD="$XEXT_LDADD -lXtst"],
AC_MSG_ERROR(You must have the XTest library to build synergy),
[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
AC_CHECK_HEADERS([X11/extensions/XTest.h],
,
AC_MSG_ERROR(You must have the XTest headers to compile synergy))
acx_have_xkb=no
AC_CHECK_LIB(X11,
XkbQueryExtension,
[acx_have_xkb=yes],
[acx_have_xkb=no],
[$X_LIBS $X_EXTRA_LIBS])
if test x"$acx_have_xkb" = xyes; then
AC_CHECK_HEADERS([X11/XKBlib.h X11/extensions/XKBstr.h],
[acx_have_xkb=yes],
[acx_have_xkb=no],
[#include <X11/Xlib.h>])
if test x"$acx_have_xkb" = xyes; then
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
],[
XkbQueryExtension(0, 0, 0, 0, 0, 0);
],
[acx_have_xkb=yes],
[acx_have_xkb=no])
fi
fi
if test x"$acx_have_xkb" = xyes; then
AC_DEFINE(HAVE_XKB_EXTENSION, 1,
[Define this if the XKB extension is available.])
fi
acx_have_xinerama=yes
AC_CHECK_LIB(Xinerama,
XineramaQueryExtension,
[acx_have_xinerama=yes],
[acx_have_xinerama=no],
[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
if test x"$acx_have_xinerama" = xyes; then
AC_CHECK_HEADERS([X11/extensions/Xinerama.h],
[acx_have_xinerama=yes],
[acx_have_xinerama=no],
[#include <X11/Xlib.h>])
fi
if test x"$acx_have_xinerama" = xyes; then
XEXT_LDADD="$XEXT_LDADD -lXinerama"
fi
X_DPMS_LDADD=
acx_have_dpms=no
AC_CHECK_LIB(Xext,
DPMSQueryExtension,
[acx_have_dpms=yes],
[acx_have_dpms=no],
[$X_LIBS -lX11 $X_EXTRA_LIBS])
if test x"$acx_have_dpms" != xyes; then
AC_CHECK_LIB(Xdpms,
DPMSQueryExtension,
[acx_have_dpms=yes; XDPMS_LDADD=-lXdpms],
[acx_have_dpms=no],
[$X_LIBS -lX11 $X_EXTRA_LIBS])
fi
if test x"$acx_have_dpms" = xyes; then
AC_CHECK_HEADERS([X11/extensions/dpms.h],
[acx_have_dpms_h=yes],
[acx_have_dpms_h=no],
[#include <X11/Xlib.h>])
if test x"$acx_have_dpms_h" = xyes; then
XEXT_LDADD="$XEXT_LDADD $XDPMS_LDADD"
AC_MSG_CHECKING(for prototypes in X11/extensions/dpms.h)
acx_have_dpms_protos=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
extern "C" {
#include <X11/extensions/dpms.h>
}
],[
int s = DPMSModeOn;
DPMSQueryExtension(0, 0, 0);
],
[acx_have_dpms_protos=yes])
AC_MSG_RESULT($acx_have_dpms_protos)
if test x"$acx_have_dpms_protos" = xyes; then
AC_DEFINE(HAVE_DPMS_PROTOTYPES,1,[Define if the <X11/extensions/dpms.h> header file declares function prototypes.])
fi
fi
fi
CPPFLAGS="$save_CPPFLAGS"
ARCH_LIBS="$X_LIBS $X_PRE_LIBS $XEXT_LDADD -lXext -lX11 $X_EXTRA_LIBS $ARCH_LIBS"
ARCH_CFLAGS="$ARCH_CFLAGS $X_CFLAGS"
fi
dnl checks for types
AC_TYPE_SIZE_T
ACX_CHECK_SOCKLEN_T
dnl checks for structures
AC_STRUCT_TM
dnl checks for compiler characteristics
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 2)
AC_CHECK_SIZEOF(long, 4)
ACX_CHECK_CXX_BOOL(,AC_MSG_ERROR(Your compiler must support bool to compile synergy))
ACX_CHECK_CXX_EXCEPTIONS(,AC_MSG_ERROR(Your compiler must support exceptions to compile synergy))
ACX_CHECK_CXX_CASTS(,AC_MSG_ERROR(Your compiler must support C++ casts to compile synergy))
ACX_CHECK_CXX_MUTABLE(,AC_MSG_ERROR(Your compiler must support mutable to compile synergy))
ACX_CHECK_CXX_STDLIB(,AC_MSG_ERROR(Your compiler must support the C++ standard library to compile synergy))
dnl checks for library functions
dnl AC_TYPE_SIGNAL
AC_FUNC_MEMCMP
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(gmtime_r)
ACX_CHECK_GETPWUID_R
AC_CHECK_FUNCS(vsnprintf)
AC_FUNC_SELECT_ARGTYPES
ACX_CHECK_POLL
ACX_FUNC_ACCEPT
dnl use AC_REPLACE_FUNCS() for stuff in string.h
dnl checks for system services
dnl enable maximum compiler warnings and warnings are errors.
ACX_CXX_WARNINGS
ACX_CXX_WARNINGS_ARE_ERRORS
dnl adjust compiler and linker variables
CXXFLAGS="$CXXFLAGS $SYNERGY_CXXFLAGS $ARCH_CFLAGS"
OBJCXXFLAGS="$OBJCXXFLAGS $CXXFLAGS $ARCH_CFLAGS"
LIBS="$NANOSLEEP_LIBS $INET_ATON_LIBS $ARCH_LIBS $LIBS"
dnl we need to have an environment variable set when building on OS X.
dnl i'm not sure of the right way to do that. writing 'export ...' to
dnl the makefiles isn't portable. here we'll hijack XXXDEPMODE (where
dnl XXX depends on the language) to insert setting the environment
dnl variable when running the compiler. we'd like to put that in CC,
dnl CXX and OBJC but that breaks depcomp. let's hope this works.
if test x"$acx_host_winapi" = xCARBON; then
MACOSX_DEPLOYMENT_TARGET="10.2"
CCDEPMODE="MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET $CCDEPMODE"
CXXDEPMODE="MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET $CXXDEPMODE"
OBJCDEPMODE="MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET $OBJCDEPMODE"
else
MACOSX_DEPLOYMENT_TARGET="5"
CXXDEPMODE="FOO=$MACOSX_DEPLOYMENT_TARGET $CXXDEPMODE"
fi
AC_OUTPUT([
Makefile
cmd/Makefile
cmd/launcher/Makefile
cmd/synergyc/Makefile
cmd/synergys/Makefile
dist/Makefile
dist/nullsoft/Makefile
dist/rpm/Makefile
dist/rpm/synergy.spec
doc/Makefile
doc/doxygen.cfg
lib/Makefile
lib/arch/Makefile
lib/base/Makefile
lib/client/Makefile
lib/common/Makefile
lib/io/Makefile
lib/mt/Makefile
lib/net/Makefile
lib/platform/Makefile
lib/server/Makefile
lib/synergy/Makefile
])

26
dist/Makefile.am vendored Normal file
View File

@ -0,0 +1,26 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2002 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
## Process this file with automake to produce Makefile.in
NULL =
SUBDIRS = \
rpm \
nullsoft \
$(NULL)
EXTRA_DIST = \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
$(NULL)

24
dist/nullsoft/Makefile.am vendored Normal file
View File

@ -0,0 +1,24 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2002 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
## Process this file with automake to produce Makefile.in
NULL =
EXTRA_DIST = \
Makefile.win \
synergy.nsi \
dosify.c \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
$(NULL)

63
dist/nullsoft/Makefile.win vendored Normal file
View File

@ -0,0 +1,63 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2007 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
NSIS = "$(PROGRAMFILES)\NSIS\makensis.exe"
NSIS_FLAGS = /NOCD /V1
BIN_INSTALLER_SRC = dist\nullsoft
BIN_INSTALLER_DST = $(BUILD_DST)\$(BIN_INSTALLER_SRC)
BIN_DOSIFY_EXE = "$(BIN_INSTALLER_DST)\dosify.exe"
BIN_DOSIFY_C = \
"$(BIN_INSTALLER_SRC)\dosify.c" \
$(NULL)
BIN_DOSIFY_OBJ = \
"$(BIN_INSTALLER_DST)\dosify.obj" \
$(NULL)
BIN_INSTALLER_NSI = "$(BIN_INSTALLER_SRC)\synergy.nsi"
BIN_INSTALLER_EXE = "$(BUILD_DST)\SynergyInstaller.exe"
BIN_INSTALLER_DOCS = \
COPYING \
ChangeLog \
$(NULL)
BIN_INSTALLER_DOS_DOCS = \
$(BUILD_DST)\COPYING.txt \
$(BUILD_DST)\ChangeLog.txt \
$(NULL)
C_FILES = $(C_FILES) $(BIN_DOSIFY_C)
OBJ_FILES = $(OBJ_FILES) $(BIN_DOSIFY_OBJ)
OPTPROGRAMS = $(OPTPROGRAMS) $(BIN_DOSIFY_EXE)
# Build rules.
$(BIN_DOSIFY_OBJ): $(BIN_DOSIFY_C)
@$(ECHO) Compile $(BIN_DOSIFY_C)
-@$(MKDIR) $(BIN_INSTALLER_DST) 2>NUL:
$(cc) $(cdebug) $(cflags) $(cvars) /Fo$@ /Fd$(@:.obj=.pdb) $**
$(BIN_DOSIFY_EXE): $(BIN_DOSIFY_OBJ)
@$(ECHO) Link $(@F)
$(link) $(ldebug) $(conlflags) $(conlibsmt) /out:$@ $**
# Convert text files from Unix to DOS format.
$(BIN_INSTALLER_DOS_DOCS): $(BIN_DOSIFY_EXE) $(BIN_INSTALLER_DOCS)
@$(ECHO) Convert text files to DOS format
$(BIN_DOSIFY_EXE) "." "$(BUILD_DST)" $(BIN_INSTALLER_DOCS)
# Allow installers for both debug and release.
$(BIN_INSTALLER_EXE): $(BIN_INSTALLER_NSI) all $(BIN_INSTALLER_DOS_DOCS)
@$(ECHO) Build $(@F)
$(NSIS) $(NSIS_FLAGS) /DOUTPUTDIR=$(@D) /DOUTPUTFILE=$@ $(BIN_INSTALLER_NSI)
installer: $(BIN_INSTALLER_EXE)
debug-installer:
@$(MAKE) /nologo /f $(MAKEFILE) DEBUG=1 installer
release-installer:
@$(MAKE) /nologo /f $(MAKEFILE) NODEBUG=1 installer

99
dist/nullsoft/dosify.c vendored Normal file
View File

@ -0,0 +1,99 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static
char*
concatPath(const char* dir, const char* name, const char* ext)
{
size_t nDir = (dir != NULL) ? strlen(dir) : 0;
size_t nPath = nDir + 1 + strlen(name) + strlen(ext?ext:"") + 1;
char* path = malloc(nPath);
/* directory */
if (nDir > 0 && strcmp(dir, ".") != 0) {
strcpy(path, dir);
if (path[nDir - 1] != '\\' && path[nDir - 1] != '/') {
strcat(path, "\\");
}
}
else {
strcpy(path, "");
}
/* name */
strcat(path, name);
/* extension */
if (ext != NULL && strrchr(name, '.') == NULL) {
strcat(path, ext);
}
return path;
}
static
int
dosify(const char* srcdir, const char* dstdir, const char* name)
{
FILE* dFile, *sFile;
char* dName, *sName;
sName = concatPath(srcdir, name, NULL);
dName = concatPath(dstdir, name, ".txt");
sFile = fopen(sName, "rb");
if (sFile == NULL) {
fprintf(stderr, "Can't open \"%s\" for reading\n", sName);
return 0;
}
else {
dFile = fopen(dName, "w");
if (dFile == NULL) {
fclose(sFile);
fprintf(stderr, "Can't open \"%s\" for writing\n", dName);
return 0;
}
else {
char buffer[1024];
while (!ferror(dFile) &&
fgets(buffer, sizeof(buffer), sFile) != NULL) {
fprintf(dFile, "%s", buffer);
}
if (ferror(sFile) || ferror(dFile)) {
fprintf(stderr,
"Error copying \"%s\" to \"%s\"\n", sName, dName);
fclose(dFile);
fclose(sFile);
_unlink(dName);
return 0;
}
}
}
fclose(dFile);
fclose(sFile);
free(dName);
free(sName);
return 1;
}
#include <windows.h>
int
main(int argc, char** argv)
{
int i;
if (argc < 3) {
fprintf(stderr, "usage: %s <srcdir> <dstdir> [files]\n", argv[0]);
return 1;
}
for (i = 3; i < argc; ++i) {
if (!dosify(argv[1], argv[2], argv[i]))
return 1;
}
return 0;
}

179
dist/nullsoft/synergy.nsi vendored Normal file
View File

@ -0,0 +1,179 @@
; Synergy.nsi
;
; This script is based on example1.nsi, but it remember the directory,
; has uninstall support and (optionally) installs start menu shortcuts.
;
; It will install makensisw.exe into a directory that the user selects,
;--------------------------------
!ifndef OUTPUTDIR
!define OUTPUTDIR "build\Release"
!endif
; The name of the installer
Name "Synergy"
; The file to write
OutFile "${OUTPUTFILE}"
; The default installation directory
InstallDir $PROGRAMFILES\Synergy
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\Synergy" "Install_Dir"
;--------------------------------
; Pages
Page components
Page license
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; Text
ComponentText "This will install Synergy on your computer. Select the optional components you want to install."
DirText "Choose a directory to install Synergy to:"
UninstallText "This will uninstall Synergy from your computer."
LicenseText "Synergy is distributed under the GNU GPL:"
LicenseData ${OUTPUTDIR}\COPYING.txt
;--------------------------------
; The stuff to install
Section "Synergy (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put files there
File "${OUTPUTDIR}\synergy.exe"
File "${OUTPUTDIR}\synergyc.exe"
File "${OUTPUTDIR}\synergys.exe"
File "${OUTPUTDIR}\*.dll"
File "${OUTPUTDIR}\COPYING.txt"
File "${OUTPUTDIR}\ChangeLog.txt"
File doc\PORTING
File doc\about.html
File doc\authors.html
File doc\autostart.html
File doc\banner.html
File doc\compiling.html
File doc\configuration.html
File doc\contact.html
File doc\developer.html
File doc\faq.html
File doc\history.html
File doc\home.html
File doc\index.html
File doc\license.html
File doc\news.html
File doc\roadmap.html
File doc\running.html
File doc\security.html
File doc\synergy.css
File doc\tips.html
File doc\toc.html
File doc\trouble.html
SetOutPath $INSTDIR\images
File doc\images\logo.gif
File doc\images\warp.gif
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\Synergy "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "DisplayName" "Synergy"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\Synergy"
CreateShortCut "$SMPROGRAMS\Synergy\Synergy.lnk" "$INSTDIR\synergy.exe" "" "$INSTDIR\synergy.exe" 0
CreateShortCut "$SMPROGRAMS\Synergy\README.lnk" "$INSTDIR\index.html"
CreateShortCut "$SMPROGRAMS\Synergy\Synergy Folder.lnk" "$INSTDIR"
CreateShortCut "$SMPROGRAMS\Synergy\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
SectionEnd
; Optional section (can be disabled by the user)
Section "Desktop Icon"
CreateShortCut "$DESKTOP\Synergy.lnk" "$INSTDIR\synergy.exe" "" "$INSTDIR\synergy.exe" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Stop and uninstall the daemons
ExecWait '"$INSTDIR\synergy.exe" /uninstall'
; Remove autorun registry keys for synergy
DeleteRegKey HKLM "SYSTEM\CurrentControlSet\Services\Synergy Server"
DeleteRegKey HKLM "SYSTEM\CurrentControlSet\Services\Synergy Client"
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\RunServices" "Synergy Server"
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\RunServices" "Synergy Client"
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Synergy Server"
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Synergy Client"
; not all keys will have existed, so errors WILL have happened
ClearErrors
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Synergy"
DeleteRegKey HKLM SOFTWARE\Synergy
ClearErrors
; First try to remove files that might be locked (if synergy is running)
Delete /REBOOTOK $INSTDIR\synergy.exe
Delete /REBOOTOK $INSTDIR\synergyc.exe
Delete /REBOOTOK $INSTDIR\synergys.exe
Delete /REBOOTOK $INSTDIR\synrgyhk.dll
; Remove files and directory
Delete $INSTDIR\*.*
RMDir $INSTDIR
; Remove shortcuts, if any
Delete "$SMPROGRAMS\Synergy\*.*"
Delete "$DESKTOP\Synergy.lnk"
; Remove directories used
RMDir "$SMPROGRAMS\Synergy"
RMDir "$INSTDIR"
IfRebootFlag 0 EndOfAll
MessageBox MB_OKCANCEL "Uninstaller needs to reboot to finish cleaning up. reboot now?" IDCANCEL NoReboot
ClearErrors
Reboot
IfErrors 0 EndOfAll
MessageBox MB_OK "Uninstaller could not reboot. Please reboot manually. Thank you."
Abort "Uninstaller could not reboot. Please reboot manually. Thank you."
NoReboot:
DetailPrint ""
DetailPrint "Uninstaller could not reboot. Please reboot manually. Thank you."
DetailPrint ""
SetDetailsView show
EndOfAll:
SectionEnd

22
dist/rpm/Makefile.am vendored Normal file
View File

@ -0,0 +1,22 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2002 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
## Process this file with automake to produce Makefile.in
NULL =
EXTRA_DIST = \
synergy.spec.in \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
$(NULL)

66
dist/rpm/synergy.spec.in vendored Normal file
View File

@ -0,0 +1,66 @@
Summary: Mouse and keyboard sharing utility
Name: @PACKAGE@
Version: @VERSION@
Release: 1
License: GPL
Packager: Chris Schoeneman <crs23@users.sourceforge.net>
Group: System Environment/Daemons
Prefixes: /usr/bin
Source: @PACKAGE@-@VERSION@.tar.gz
Buildroot: /var/tmp/@PACKAGE@-@VERSION@-root
%description
Synergy lets you easily share a single mouse and keyboard between
multiple computers with different operating systems, each with its
own display, without special hardware. It's intended for users
with multiple computers on their desk since each system uses its
own display.
%prep
%setup
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr
%build
make
%install
make install DESTDIR=$RPM_BUILD_ROOT
strip $RPM_BUILD_ROOT/usr/bin/synergyc
strip $RPM_BUILD_ROOT/usr/bin/synergys
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-, root, root)
/usr/bin/synergyc
/usr/bin/synergys
%doc AUTHORS
%doc COPYING
%doc ChangeLog
%doc INSTALL
%doc NEWS
%doc README
%doc doc/about.html
%doc doc/authors.html
%doc doc/autostart.html
%doc doc/banner.html
%doc doc/border.html
%doc doc/compiling.html
%doc doc/configuration.html
%doc doc/contact.html
%doc doc/developer.html
%doc doc/faq.html
%doc doc/history.html
%doc doc/home.html
%doc doc/index.html
%doc doc/license.html
%doc doc/news.html
%doc doc/roadmap.html
%doc doc/running.html
%doc doc/security.html
%doc doc/tips.html
%doc doc/toc.html
%doc doc/trouble.html
%doc doc/synergy.css
%doc examples/synergy.conf

49
doc/Makefile.am Normal file
View File

@ -0,0 +1,49 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2002 Chris Schoeneman
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file 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.
## Process this file with automake to produce Makefile.in
NULL =
EXTRA_DIST = \
PORTING \
doxygen.cfg.in \
synergy.css \
about.html \
authors.html \
autostart.html \
banner.html \
border.html \
compiling.html \
configuration.html \
contact.html \
developer.html \
faq.html \
history.html \
home.html \
index.html \
license.html \
news.html \
roadmap.html \
running.html \
security.html \
tips.html \
toc.html \
trouble.html \
images/logo.gif \
images/warp.gif \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
doc/doxygen.cfg \
doc/doxygen/html/* \
$(NULL)

419
doc/PORTING Normal file
View File

@ -0,0 +1,419 @@
Synergy Developer and Porting Guide
===================================
This document is under development.
Code Organization
-----------------
The synergy source code organization is:
. -- root makefiles, some standard documentation
cmd -- program source code
launcher -- synergy launcher for Windows
synergyc -- synergy client
synergys -- synergy server
config -- stuff for autoconf/automake
dist -- files for creating distributions
nullsoft -- files for creating Nullsoft NSIS installer (Windows)
rpm -- files for creating RPMs
doc -- placeholder for documentation
examples -- example files
lib -- library source code
arch -- platform dependent utility library
base -- simple utilities
client -- synergy client library
common -- commonly needed header files
io -- I/O
mt -- multithreading
net -- networking
platform -- platform dependent display/window/event stuff
server -- synergy server library
synergy -- synergy shared client/server code library
Note how the utility code required by the programs is placed into
separate library directories. This makes the makefiles a little
more awkward but makes for a cleaner organization. The top level
directory has only the standard documentation files and the files
necessary to configure and build the rest of the project.
Coding Style Guide
------------------
Synergy uses many coding conventions. Contributed code should
following these guidelines.
- Symbol Naming
Names always begin with a letter (never an underscore). The first
letter of interior names are always capitalized. Acronyms should
be all uppercase. For example: myTextAsASCII.
Names come it two flavors: leading capital and leading lowercase.
The former have the first character capitalized and the latter
don't. In the following table, leading capital names are indicated
by `Name' and leading lowercase names by `name'.
The naming convention for various things are:
* Exceptions -- X + Name XMyException
* Interfaces -- I + Name IMyInterface
* Template Classes -- T + Name TMyTemplate<>
* Other Classes -- C + Name CMyClass
* Enumerations -- E + Name EMyEnumeration
* Constants -- k + Name kMyConstant
* Data Members -- m_ + name m_myDataMember
* Methods -- name myMethod
* Functions -- name myFunction
* Variables -- name myVariable
Exceptions are types that get thrown and are generally derived
(possibly indirectly) from XBase. Interfaces are derived (possibly
indirectly) from IInterface and have only pure virtual functions.
Other classes are classes that aren't exceptions or interfaces.
Constants include global constants and enumerants.
Method names should usually have the form `verbObject'. For example:
* isGameOn()
* getBeer()
* pressPowerButton()
* setChannel()
In general, use `get' and `set' to read and write state but use `is'
to read boolean state. Note that classes that contain only `is',
`get', and `set' are probably plain old data; you might want to
consider using public data members only or, better, refactor your
design to have classes that actually do something more than just
hold data.
- File Naming
Each class should have one source and one header file. If the
class is named `CMyClass' then the source file should be named
`CMyClass.cpp' and the header file `CMyClass.h'.
Headers files not containing a class should have some meaningful
name with a leading capital (e.g. `Version.h').
Source files without a header file have a leading lowercase name.
Only files containing the entry point for an application should
lack a header file.
- Dependencies
* No circular library dependencies
Library dependencies form an acyclic graph. Conceptually
libraries can be arranged in layers where each library only
references libraries in layers below it, not in the same layer
or layers above it. The makefiles build the lowest layer
libraries first and work upwards.
* Avoid circular uses-a relationships
When possible, design classes with one-way uses-a relationships
and avoid cycles. This makes it easier to understand the code.
However, sometimes it's not always practical so it is permitted.
* Included files in headers
Headers should #include only the necessary headers. In
particular, if a class is referenced in a header file only as a
pointer or a reference then use `class COtherClass;' instead of
`#include "COtherClass.h".'
* #include syntax
Non-synergy header files must be included using angle brackets
while synergy header files must be included using double quotes.
#include "CSynergyHeader.h"
#include <systemheader.h>
The file name in a #include must not be a relative path unless
it's a system header file and it's customary to use a relative
path, e.g. `#include <sys/types.h>'. Use compiler options to
add necessary directories to the include search path.
* Included file ordering
Files should be included in the following order:
* Header for source file
The first include for CMyClass.cpp must be CMyClass.h.
* Other headers in directory, sorted alphabetically
* Headers for each library, sorted alphabetically per library
Include headers from the library closest in the dependency graph
first, then the next farthest, etc. Sort alphabetically within
each library.
* System headers
- C++
* C++ features
Synergy uses the following more recent C++ features:
* bool
* templates
* exceptions
* mutable
* new scoping rules
* the standard C++ library
Do not use the following C++ features:
* dynamic_cast
* run time type information
* namespaces and using (use std:: where necessary)
The new scoping rules say that the scope of a variable declared
in a for statement is limited to the for loop. For example:
for (int i = 0; i < 10; ++i) {
// i is in scope here
}
// i is not in scope here
for (int i = -10; i < 0; ++i) {
// an entirely new i is in scope here
}
// i is not in scope here
This is used routinely in synergy, but only in for loops. There
is a macro for `for' in lib/base/common.h when building under
Microsoft Visual C++ that works around the fact that that compiler
doesn't follow the new scoping rules. Use the macro if your
compiler uses the old scoping rules.
* Standard C++ library
The standard C++ library containers should always be used in favor
of custom containers wherever reasonable. std::string is used
throughout synergy but only as the CString typedef; always use
CString, never std::string except in the arch library. Synergy
avoids using auto_ptr due to some portability problems. Synergy
makes limited use of standard algorithms and streams but they can
be freely used in new code.
* Limited multiple inheritance
Classes should inherit implementation from at most one superclass.
Inheriting implementation from multiple classes can have unpleasant
consequences in C++ due to it's limited capabilities. Classes can
inherit from any number of interface classes. An interface class
provides only pure virtual methods. Synergy breaks this rule in
IInterface which implements the virtual destructor for convenience.
* No globals
Avoid global variables. All global variables must be static, making
it visible only with its source file. Most uses of global variables
are better served by static data members of a class. Global
constants are permitted in some circumstances.
Also avoid global functions. Use public static member functions in
a class instead.
These rules are violated by the main source file for each program
(except that the globals are still static). They could easily be
rewritten to put all the variables and functions into a class but
there's little to be gained by that.
* Private data only
If a class is plain-old-data (i.e. it has no methods) all of its
data members should be public. Otherwise all of its data members
should be private, not public or protected. This makes it much
easier to track the use of a member when reading code. Protected
data is not allowed because `protected' is a synonym for `public
to my subclasses' and public data is a Bad Thing. While it might
seem okay in this limited situation, the situation is not at all
limited since an arbitrary number of classes can be derived,
directly or indirectly, from the class and any of those classes
have full access to the protected data.
* Plain old data
A class that merely contains data and doesn't perform operations
on that data (other than reads and writes) is plain old data (POD).
POD should have only public data members and non-copy constructors.
It must not have any methods other than constructors, not even a
destructor or assignment operators, nor protected or private data.
Note that this definition of POD is not the definition used in the
C++ standard, which limits the contained data types to types that
have no constructors, destructors, or methods.
* Avoid using friend
Avoid declaring friend functions or classes. They're sometimes
necessary for operator overloading. If you find it necessary to
add friends to some class C, consider creating a utility class U.
A utility class is declared as the only friend of C and provides
only static methods. Each method forwards to a private method on
an object of C type (passed as a parameter to the U's method).
This makes maintenance easier since only U has friend access to C
and finding any call to U is trivial (they're prefixed by U::).
* Don't test for NULL when using `delete' or `delete[]'
It's unnecessary since delete does it anyway.
- Makefiles
Automake's makefiles (named Makefile.am) have a few requirements:
* Define the following macro at the top of the file:
NULL =
* Lists should have one item per line and end in $(NULL). For
example:
EXTRA_DIST = \
kiwi.txt \
mango.cpp \
papaya.h \
$(NULL)
Indentation must use tabs in a makefile. Line continuations
(backslashes) should be aligned using tabs.
* Lists of files should be sorted alphabetically in groups (e..g
source files, header files, then other files). Lists of
subdirectories must be in the desired build order.
- Source Formatting
Every project has its own formatting style and no style satisfies
everyone. New code should be consistent with existing code:
* All files should include the copyright and license notice
* Use tabs to indent
* Tabs are 4 columns
* Lines should not extend past the 80th column
* Open braces ({) go on same line as introducing statement
`for (i = 0; i < 10; ++i) {' not
for (i = 0; i < 10; ++i)
{
* Close braces line up with introducing statement
* Open brace for function is on a line by itself in first column
* Close brace for function lines up with open brace
* Always use braces on: if, else, for, while, do, switch
* `else {' goes on its own line
* Always explicitly test pointers against NULL
e.g. `if (ptr == NULL)' not `if (ptr)'
* Always explicitly test integral values against 0
e.g. `if (i == 0)' not `if (i)'
* Put spaces around binary operators and after statements
e.g. `if (a == b) {' not `if(a==b){'
* C'tor initializers are one per line, indented one tab stop
* Other indentation should follow existing practice
* Use Qt style comments for extraction by doxygen (i.e. //! and /*!)
* Mark incomplete or buggy code with `FIXME'
- Other
* calls to LOG() should always be all on one line (even past column 80)
Class Relationships
-------------------
The doxygen documentation can help in understanding the relationships
between objects. Use `make doxygen' in the top level directory to
create the doxygen documentation into doc/doxygen/html. You must have
doxygen installed, of course.
FIXME -- high level overview of class relationships
Portability
-----------
Synergy is mostly platform independent code but necessarily has
platform dependent parts. The mundane platform dependent parts
come from the usual suspects: networking, multithreading, file
system, high resolution clocks, system logging, etc. Porting
these parts is relatively straightforward.
Synergy also has more esoteric platform dependent code. The
functions for low-level event interception and insertion,
warping the cursor position, character to keyboard event
translation, clipboard manipulation, and screen saver control
are often obscure and poorly documented. Unfortunately, these
are exactly the functions synergy requires to do its magic.
Porting synergy to a new platform requires the following steps:
- Setting up the build
- Adjusting lib/common/common.h
- Implementing lib/arch
- Implementing lib/platform
- Tweaks
Setting up the build:
The first phase is simply to create the files necessary to build the
other files. On Unix, synergy uses autoconf/automake which produces
a `configure' script that generates makefiles. On Windows, synergy
uses Visual C++ workspace and project files. If you're porting to
another Unix variant, you may need to adjust `configure.in',
`acinclude.m4', and Unix flavor dependent code in lib/arch. Note
especially the SYSAPI_* and WINAPI_* macro definitions in
ARCH_CFLAGS. Exactly one of each must be defined. It should also
add AM_CONDITIONALs if a new SYSAPI_* or WINAPI_* was added.
Adjusting lib/common/common.h:
The lib/common/common.h header file is included directly or indirectly
by every other file. Its primary job is to include config.h, which
defines macros depending on what the 'configure' script discovered
about the system. If the platform does not use the 'configure' script
it must define the appropriate SYSAPI_* and WINAPI_* macro. It may
also do other platform specific setup.
Adjusting lib/common/BasicTypes.h:
No changes should be necessary in BasicTypes.h. However, if the
platform's system header files define SInt8, et al. you may need
to adjust the typedefs to match the system's definitions.
Implementing lib/arch:
Much platform dependent code lives in lib/arch. There are several
interface classes there and they must all be implemented for each
platform. See the interface header files for more information.
Platforms requiring special functions should create a class named
CArchMiscXXX where XXX is the platform name. The class should have
only static methods. Clients can include the appropriate header
file and make calls directly, surrounded by a suitable #ifdef/#endif.
If using automake, the Makefile.am should list the system specific
files in a XXX_SOURCE_FILES macro where XXX matches the appropriate
AM_CONDITIONAL symbol. XXX_SOURCE_FILES must be added to EXTRA_DIST
and the following added above the INCLUDES macro:
if XXX
libarch_a_SOURCES = \
$(COMMON_SOURCE_FILES) \
$(XXX_SOURCE_FILES) \
$(NULL)
endif
Implementing lib/platform:
Most of the remaining platform dependent code lives in lib/platform.
The code there implements platform dependent window, clipboard, keyboard
and screen saver handling. If a platform is named XXX then the following
classes should be derived and implemented:
* CXXXClipboard : IClipboard
Provides clipboard operations. Typically, this class will
have helper classes for converting between various clipboard
data formats.
* CXXXEventQueueBuffer : IEventQueueBuffer
Provides operations for waiting for, posting and retrieving events.
Also provides operations for creating and deleting timers.
* CXXXKeyState : CKeyState
Provides operations for synthesizing key events and for mapping a
key ID to a sequence of events to generate that key.
* CXXXScreen : IScreen, IPrimaryScreen, ISecondaryScreen, IPlatformScreen
Provides screen operations.
* CXXXScreenSaver : IScreenSaver
Provides screen saver operations.
If using automake, the Makefile.am should list the window system
specific files in a XXX_SOURCE_FILES macro where XXX matches the
appropriate AM_CONDITIONAL symbol. XXX_SOURCE_FILES must be added
to EXTRA_DIST and the following added above the INCLUDES macro:
if XXX
libplatform_a_SOURCES = $(XXX_SOURCE_FILES)
endif
Tweaks:
Finally, each platform typically requires various adjustments here
and there. In particular, synergyc.cpp and synergys.cpp usually
require platform dependent code for the main entry point, parsing
arguments, and reporting errors. Also, some platforms may benefit
from a graphical user interface front end. These are generally
not portable and synergy doesn't provide any infrastructure for
the code common to any platform, though it may do so someday.
There is, however, an implementation of a GUI front end for Windows
that serves as an example.

55
doc/about.html Normal file
View File

@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>About Synergy</title>
</head>
<body class="main">
<p>
With synergy, all the computers on your desktop form a single virtual
screen. You use the mouse and keyboard of only one of the computers
while you use all of the monitors on all of the computers.
You tell synergy how many screens you have and their positions relative
to one another. Synergy then detects when the mouse moves off
the edge of a screen and jumps it instantly to the neighboring screen.
The keyboard works normally on each screen; input goes to whichever
screen has the cursor.
</p><p>
In this example, the user is moving the mouse from left to right.
When the cursor reaches the right edge of the left screen it jumps
instantly to the left edge of the right screen.
</p><p>
<center><img src="images/warp.gif"></center>
</p><p>
You can arrange screens side-by-side, above and below one another,
or any combination. You can even have a screen jump to the opposite
edge of itself. Synergy also understands multiple screens attached
to the same computer.
</p><p>
Running a game and don't want synergy to jump screens? No problem.
Just toggle Scroll Lock. Synergy keeps the cursor on the same screen
when Scroll Lock is on. (This can be configured to another hot key.)
</p><p>
Do you wish you could cut and paste between computers? Now you can!
Just copy text, HTML, or an image as you normally would on one screen
then switch to another screen and paste it. It's as if all your
computers shared a single clipboard (and separate primary selection for
you X11 users). It even converts newlines to each computer's native
form so cut and paste between different operating systems works
seamlessly. And it does it all in Unicode so any text can be copied.
</p><p>
</p><p>
Do you use a screen saver? With synergy all your screen savers act in
concert. When one starts they all start. When one stops they all
stop. And, if you require a password to unlock the screen, you'll
only have to enter a password on one screen.
</p><p>
If you regularly use multiple computers on one desk, give synergy a
try. You'll wonder how you ever lived without it.
</p>
</body>
</html>

72
doc/authors.html Normal file
View File

@ -0,0 +1,72 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy Authors</title>
</head>
<body class="main">
<p>
</p><h3>Synergy Authors</h3><p>
</p><p>
<table>
<tr>
<td>Chris Schoeneman</td>
<td>&nbsp;</td>
<td><span class="fakelink">crs23@users.sourceforge<span class="hide">.no_spam</span>.net</span></td>
<td>&nbsp;</td>
<td>Creator, owner, primary developer</td>
</tr>
<tr>
<td>Ryan Breen</td>
<td>&nbsp;</td>
<td><span class="fakelink">ryan@ryanbreen<span class="hide">.no_spam</span>.com</span></td>
<td>&nbsp;</td>
<td>Initial Mac OS X port</td>
</tr>
<tr>
<td>Guido Poschta</td>
<td>&nbsp;</td>
<td><span class="fakelink">moolder@gmx<span class="hide">.no_spam</span>.net</span></td>
<td>&nbsp;</td>
<td>Windows installer</td>
</tr>
<tr>
<td>Bertrand Landry Hetu</td>
<td>&nbsp;</td>
<td><span class="fakelink">bertrand@landryhetu<span class="hide">.no_spam</span>.com</span></td>
<td>&nbsp;</td>
<td>Mac OS X port</td>
</tr>
<tr>
<td>Tom Chadwick</td>
<td>&nbsp;</td>
<td><span class="fakelink">vttom@users.sourceforge<span class="hide">.no_spam</span>.net</span></td>
<td>&nbsp;</td>
<td>PageUp/PageDown on X servers without mouse wheel support</td>
</tr>
<tr>
<td>Brent Priddy</td>
<td>&nbsp;</td>
<td><span class="fakelink">toopriddy@users.sourceforge<span class="hide">.no_spam</span>.net</span></td>
<td>&nbsp;</td>
<td>Re-resolving server hostname on each connection</td>
</tr>
<tr>
<td>Marc-Antoine Ruel</td>
<td>&nbsp;</td>
<td><span class="fakelink">maruel@users.sourceforge<span class="hide">.no_spam</span>.net</span></td>
<td>&nbsp;</td>
<td>Visual Studio 2005 port</td>
</tr>
</table>
</p><p>
To avoid spam bots, the above email addresses have ".no_spam"
hidden near the end. If you copy and paste the text be sure to
remove it.
</p>
</body>
</html>

428
doc/autostart.html Normal file
View File

@ -0,0 +1,428 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy Autostart Guide</title>
</head>
<body class="main">
<p>
</p><h3>Starting synergy automatically</h3><p>
</p><p>
You can configure synergy to start automatically when the computer
starts or when you log in. The steps to do that are different on
each platform. Note that changing these configurations doesn't
actually start or stop synergy. The changes take effect the next
time you start your computer or log in.
</p><p>
</p><h4>Windows</h4><p>
</p><p>
Start synergy and click the <span class="code">Configure...</span> button
by the text <span class="code">Automatic Startup</span>. The
<span class="code">Auto Start</span> dialog will pop up.
If an error occurs then correct the problem and click
<span class="code">Configure</span> again.
</p><p>
On the <span class="code">Auto Start</span> dialog you'll configure
synergy to start or not start automatically when the computer starts
or when you log in. You need Administrator access rights to start
synergy automatically when the computer starts. The dialog will let
you know if you have sufficient permission.
</p><p>
If synergy is already configured to automatically start then there
will be two <span class="code">Uninstall</span> buttons, at most one
of which is enabled. Click the enabled button, if any, to tell
synergy to not start automatically.
</p><p>
If synergy is not configured to start automatically then there will
be two <span class="code">Install</span> buttons. If you have
sufficient permission to have synergy start automatically when the
computer does then the <span class="code">Install</span> button in the
<span class="code">When Computer Starts</span> box will be enabled.
Click it to have synergy start for all users when the computer starts.
In this case, synergy will be available during the login screen.
Otherwise, click the <span class="code">Install</span> button in the
<span class="code">When You Log In</span> box to have synergy
automatically start when you log in.
</p><p>
</p><h4>Unix</h4><p>
</p><p>
Synergy requires an X server. That means a server must be
running and synergy must be authorized to connect to that server.
It's best to have the display manager start synergy. You'll need
the necessary (probably root) permission to modify the display
manager configuration files. If you don't have that permission
you can start synergy after logging in via the
<span class="code">.xsession</span> file.
</p><p>
Typically, you need to edit three script files. The first file
will start synergy before a user logs in, the second will kill
that copy of synergy, and the third will start it again after
the user logs in.
</p><p>
The contents of the scripts varies greatly between systems so
there's no one definite place where you should insert your edits.
However, these scripts often exit before reaching the bottom so
put the edits near the top of the script.
</p><p>
The location and names of these files depend on the operating
system and display manager you're using. A good guess for the
location is <span class="code">/etc/X11</span>. If you use kdm
then try looking in <span class="code">/etc/kde3</span> or
<span class="code">/usr/kde/<span class="arg">version</span>/share/config</span>.
Typical file names are:
</p><p>
<span class="code">
<table>
<tr><td>&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;</td> <td>xdm</td> <td>&nbsp;&nbsp;</td> <td>kdm</td> <td>&nbsp;&nbsp;</td> <td>gdm</td></tr>
<tr><td>1</td> <td></td> <td>xdm/Xsetup</td> <td></td> <td>kdm/Xsetup</td> <td></td> <td>gdm/Init/Default (*)</td></tr>
<tr><td>2</td> <td></td> <td>xdm/Xstartup</td> <td></td> <td>kdm/Xstartup</td> <td></td> <td>gdm/PostLogin/Default (*)</td></tr>
<tr><td>3</td> <td></td> <td>xdm/Xsession</td> <td></td> <td>kdm/Xsession</td> <td></td> <td>gdm/Sessions/Default (*, **)</td></tr>
</table>
</span>
</p><p>
*) The <span class="code">Default</span> file is used if no other
suitable file is found. <span class="code">gdm</span> will try
<span class="arg">displayname</span> (e.g. <span class="code">:0</span>)
and <span class="arg">hostname</span> (e.g. <span class="code">somehost</span>),
in that order, before and instead of <span class="code">Default</span>.
<br>
**) gdm may use <span class="code">gdm/Xsession</span>,
<span class="code">xdm/Xsession</span> or
<span class="code">dm/Xsession</span> if
<span class="code">gdm/Sessions/Default</span> doesn't exist.
</p><p>
For a synergy client, add the following to the first file:
<span class="codeblock">
/usr/bin/killall synergyc
sleep 1
/usr/bin/synergyc [&lt;options&gt;] <span class="arg">synergy-server-hostname</span>
</span>
Of course, the path to synergyc depends on where you installed it
so adjust as necessary.
</p><p>
Add to the second file:
<span class="codeblock">
/usr/bin/killall synergyc
sleep 1
</span>
</p><p>
And to the third file:
<span class="codeblock">
/usr/bin/killall synergyc
sleep 1
/usr/bin/synergyc <span class="arg">[&lt;options&gt;]</span> <span class="arg">synergy-server-hostname</span>
</span>
Note that <a href="running.html#options"><span class="arg">&lt;options&gt;</span></a>
must not include
<span class="code">-f</span> or <span class="code">--no-daemon</span> or
the script will never exit and you won't be able to log in.
</p><p>
The changes are the same for the synergy server except replace
<span class="code">synergyc</span> with <span class="code">synergys</span>
and use the appropriate synergys <a href="running.html#options">command
line options</a>. Note that the
first script is run as root so synergys will look for the configuration
file in root's home directory then in <span class="code">/etc</span>.
Make sure it exists in one of those places or use the
<span class="code">--config <span class="arg">config-pathname</span></span>
option to specify its location.
</p><p>
Note that some display managers (xdm and kdm, but not gdm) grab
the keyboard and do not release it until the user logs in for
security reasons. This prevents a synergy server from sharing
the mouse and keyboard until the user logs in. It doesn't
prevent a synergy client from synthesizing mouse and keyboard
input, though.
</p><p>
If you're configuring synergy to start only after you log in then edit
your <span class="code">.xsession</span> file. Add just what you
would add to the third file above.
</p><p>
</p><h4>Mac OS X</h4><p>
</p><p>
[By Tor Slettnes]
</p><p>
There are three different ways to automatically start Synergy
(client or server) on Mac OS X:
</p><p>
<ol>
<li>
The first method involves creating a <span class="code">StartupItem</span>
at the system level, which is executed when the machine starts up
or shuts down. This script will run in the background, and
relaunch synergy as needed.
</p><p>
<dl>
<dt><b>Pros:</b></dt>
<dd>
Synergy is persistent, so this allows for a multi-user
setup and interactive logins.
</dd>
<dt><b>Cons:</b></dt>
<dd>
The synergy process does not have access to the clipboard
of the logged-in user.
</dd>
</dl>
</li>
</p><p>
<li>
The second method will launch Synergy from the
<span class="code">LoginWindow</span> application, once a particular
user has logged in.
</p><p>
<dl>
<dt><b>Pros:</b></dt>
<dd>
The synergy process inherits the
<span class="code">$SECURITYSESSIONID</span> environment variable,
and therefore copy/paste works.
</dd>
<dt><b>Cons:</b></dt>
<dd>
Once the user logs out, synergy dies, and no remote
control is possible.
</dd>
</dl>
</li>
</p><p>
<li>
The third method is to launch a startup script from the
"Startup Items" tab under System Preferences -> Accounts.
</p><p>
<dl>
<dt><b>Pros:</b></dt>
<dd>
Does not require root (Administrator) access
</dd>
<dt><b>Cons:</b></dt>
<dd>
Once the user logs out, synergy dies, and no remote
control is possible.
</dd>
</dl>
</li>
</ol>
</p><p>
The text below describes how to implement a Synergy client using
the first two methods simultaneously. This way, Synergy is
always running, and the clipboard is available when someone is
logged in. A Mac OS X Synergy server setup will be quite similar.
</p><p>
<b>1. Create a System Level Startup Item</b>
</p><p>
<ul>
<li>
Open a <span class="code">Terminal</span> window, and become root:
<span class="userinput">
$ sudo su -
</span>
</li>
<li>
Create a folder for this item:
<span class="userinput">
# mkdir -p /Library/StartupItems/Synergy
</span>
</li>
<li>
In this folder, create a new script file by the same name as
the directory itself, <span class="code">Synergy</span>. This script
should contain the following text:
</p><p>
<span class="codeblock">
#!/bin/sh
. /etc/rc.common
&nbsp;
run=(/usr/local/bin/synergyc -n $(hostname -s) -1 -f <span class="arg">synergy-server</span>)
&nbsp;
KeepAlive ()
{
proc=${1##*/}
&nbsp;
while [ -x "$1" ]
do
if ! ps axco command | grep -q "^${proc}\$"
then
"$@"
fi
&nbsp;
sleep 3
done
}
&nbsp;
StartService ()
{
ConsoleMessage "Starting Synergy"
KeepAlive "${run[@]}" &
}
&nbsp;
StopService ()
{
return 0
}
&nbsp;
RestartService ()
{
return 0
}
&nbsp;
RunService "$1"
</span>
</p><p>
However, replace <span class="arg">synergy-server</span> with the actual
name or IP address of your Synergy server.
</p><p>
Note that this scripts takes care <em>not</em> to start
Synergy if another instance is currently running. This
allows it to run in the background even when synergy is also
started independently, e.g. from the <span class="code">LoginWindow</span>
application as described below.
</li>
<li>
Make this script executable:
<span class="userinput">
# chmod 755 /Library/StartupItems/Synergy/Synergy
</span>
</li>
<li>
In the same folder, create a file named
<span class="code">StartupParameters.plist</span> containing:
</p><p>
<span class="codeblock">
{
Description = "Synergy Client";
Provides = ("Synergy");
Requires = ("Network");
OrderPreference = "None";
}
</span>
</li>
</ul>
</p><p>
That's it! If you want to test this setup, you can run the
startup script as follows:
</p><p>
<span class="userinput">
# /Library/StartupItems/Synergy/Synergy start
</span>
</p><p>
Any errors, as well as output from Synergy, will be shown in
your terminal window.
</p><p>
Next time you reboot, Synergy should start automatically.
</p><p>
<b>2. Run Synergy When a User Logs In</b>
</p><p>
Each time a user successfully logs in via the console, the
<span class="code">LoginWindow</span> application creates a unique session
cookie and stores it in the environment variable
<span class="code">$SECURITYSESSIONID</span>. For copy and paste operations
to work, Synergy needs access to this environment variable. In
other words, Synergy needs to be launched (directly or
indirectly) via the <span class="code">LoginWindow</span> application.
</p><p>
However, in order to kill any synergy processes started at the
system level (as described above), we need root access. Thus,
launching Synergy within the User's environment (e.g. via the
Startup Items tab in System Preferences -> Accounts) is not an
option that work in conjunction with the method above.
</p><p>
Fortunately, the <span class="code">LoginWindow</span> application provides
a "hook" for running a custom program (as root, with the username provided as
the first and only argument) once a user has authenticated, but
before the user is logged in.
</p><p>
Unfortunately, only one such hook is available. If you have
already installed a Login Hook, you may need to add the text
from below to your existing script, rather than creating a new
one.
</p><p>
<ul>
<li>
Launch a Terminal window, and become root:
<span class="userinput">
$ sudo su -
</span>
</li>
</p><p>
<li>
Find out if a LoginHook already exists:
<span class="userinput">
# defaults read com.apple.loginwindow LoginHook
</span>
This will either show the full path to a script or
executable file, or the text:
<span class="userinput">
The domain/default pair of (com.apple.loginwindow, LoginHook) does not exist
</span>
In the former case, you need to modify your existing script,
and/or create a "superscript" which in turn calls your
existing script plus the one we will create here.
</p><p>
The rest of this text assumes that this item did not already
exist, and that we will create a new script.
</li>
<li>
Create a folder in which we will store our custom startup
script:
<span class="userinput">
# mkdir -p /Library/LoginWindow
</span>
</li>
<li>
In this folder, create a new script file (let's name it
<span class="code">LoginHook.sh</span>), containing the following text:
</p><p>
<span class="codeblock">
#!/bin/sh
prog=(/usr/local/bin/synergyc -n $(hostname -s) <span class="arg">ip-address-of-server</span>)
&nbsp;
### Stop any currently running Synergy client
killall ${prog[0]##*/}
&nbsp;
### Start the new client
exec "${prog[@]}"
</span>
</li>
<li>
Make this script executable:
<span class="userinput">
# chmod 755 /Library/LoginWindow/LoginHook.sh
</span>
</li>
<li>
Create a login hook to call the script you just created:
<span class="userinput">
# defaults&nbsp;write&nbsp;com.apple.loginwindow&nbsp;LoginHook&nbsp;/Library/LoginWindow/LoginHook.sh
</span>
</li>
</ul>
</p><p>
More information on setting up login hooks can be found at
<a target="_top" href="http://docs.info.apple.com/article.html?artnum=301446">Apple</a>.
</p><p>
When running the Synergy client, you may need to use the IP
address of the Synergy server rather than its host name.
Specifically, unless you have listed the server in your
local <span class="code">/etc/hosts</span> file or in your local NetInfo
database, name services (i.e. DNS) may not yet be available by the
time you log in after power-up. <span class="code">synergyc</span> will
quit if it cannot resolve the server name.
</p><p>
(This is not an issue with the previous method, because the
<span class="code">StartupParameters.plist</span> file specifies that this
script should not be run until "network" is available).
</p><p>
<b>3. Good Luck!</b>
</p><p>
Remember to look in your system log on both your server and your
client(s) for clues to any problems you may have
(<span class="code">/var/log/system.log</span> on your OS X box, typically
<span class="code">/var/log/syslog</span> on Linux boxes).
</p>
</body>
</html>

16
doc/banner.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy Header</title>
<base target="_top">
</head>
<body class="banner">
<table border="0" cellspacing="0" cellpadding="0">
<tr><td><a href="index.html"><img src="images/logo.gif" alt="Synergy" border="0"></a></td></tr>
</table>
</body>
</html>

14
doc/border.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy</title>
<base target="_top">
</head>
<body class="bannerb">
<br>
</body>
</html>

112
doc/compiling.html Normal file
View File

@ -0,0 +1,112 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Building and Installing Synergy</title>
</head>
<body class="main">
<p>
</p><h3>Prerequisites for building</h3><p>
</p><p>
To build synergy from the sources you'll need the following:
<ul>
<li>Windows
<ul>
<li>Microsoft Windows SDK for Vista; or
<li>VC++ 6.0 or up should work
</ul>
</p><p>
<li>Unix
<ul>
<li>gcc 2.95 or up
<li>X11R4 or up headers and libraries
</ul>
</p><p>
<li>Mac OS X
<ul>
<li>gcc 2.95 or up
<li>Carbon development headers and libraries
</ul>
</ul>
</p><p>
</p><h3>Configuring the build</h3><p>
</p><p>
This step is not necessary on Windows.
</p><p>
To configure the build for your platform use the configure script:
<pre>
./configure
</pre>
For a list of options to configure use:
<pre>
./configure --help
</pre>
On Solaris you may need to use:
<pre>
<nobr>./configure --x-includes=/usr/openwin/include --x-libraries=/usr/openwin/lib</nobr>
</pre>
so synergy can find the X11 includes and libraries.
</p><p>
</p><h3>Building</h3><p>
<ul>
<li>Windows
<p>
Open a command prompt window (cmd.exe or command.exe). If necessary
run vcvars.bat, created when VC++ or Visual Studio was installed. (Use
search to find it.) It's necessary to run the file if you didn't have
the installer set up environment variables for you. Then enter:
<pre>
nmake /nologo /f Makefile.win
</pre>
This will build the programs into <span class="code">build\Release</span>.
</p>
<li>Unix or Mac OS X
</p><p>
Simply enter:
<pre>
make
</pre>
This will build the client and server and leave them in their
respective source directories.
</p>
</ul>
<p>
</p><h3>Installing</h3><p>
<ul>
<li>Windows
<p>
You'll need <a target="_top" href="http://nsis.sourceforge.net/">NSIS</a>,
the Nullsoft Scriptable Install System. As in the building on Windows
description above, enter:
<pre>
nmake /nologo /f Makefile.win installer
</pre>
to build <span class="code">build\Release\SynergyInstaller.exe</span>. Run
this to install synergy.
</p><p>
Alternatively, you can simply copy the following files from the
<span class="code">build\Release</span>
directory to a directory you choose (perhaps under the
<span class="code">Program Files</span> directory):
<ul class="code">
<li>synergy.exe
<li>synergyc.exe
<li>synergys.exe
<li>synrgyhk.dll
</ul>
</p>
<li>Unix or Mac OS X
<p>
<pre>
make install
</pre>
will install the client and server into
<span class="code">/usr/local/bin</span> unless you
specified a different directory when you ran configure.
</p>
</body>
</html>

686
doc/configuration.html Normal file
View File

@ -0,0 +1,686 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy Configuration Guide</title>
</head>
<body class="main">
<p>
</p><h3>Synergy Configuration File Format</h3><p>
</p><p>
The synergy server requires configuration. It will try certain
pathnames to load the configuration file if you don't specify a
path using the <span class="code">--config</span> command line
option. <span class="code">synergys --help</span> reports those
pathnames.
</p><p>
The configuration file is a plain text file. Use any text editor
to create the configuration file. The file is broken into sections
and each section has the form:
<span class="codeblock">
section: <span class="arg">name</span>
<span class="arg">args</span>
end
</span>
Comments are introduced by <span class="code">#</span> and continue to
the end of the line. <span class="arg">name</span> must be one of the
following:
<ul class="code">
<li>screens
<li>aliases
<li>links
<li>options
</ul>
See below for further explanation of each section type. The
configuration file is case-sensitive so <span class="code">Section</span>,
<span class="code">SECTION</span>, and <span class="code">section</span>
are all different and only the last is valid. Screen names are the
exception; screen names are case-insensitive.
</p><p>
The file is parsed top to bottom and names cannot be used before
they've been defined in the <span class="code">screens</span> or
<span class="code">aliases</span> sections. So the
<span class="code">links</span> and <span class="code">aliases</span>
must appear after the <span class="code">screens</span> and links
cannot refer to aliases unless the <span class="code">aliases</span>
appear before the <span class="code">links</span>.
</p><p>
</p><h4>screens</h4><p>
</p><p>
<span class="arg">args</span> is a list of screen names, one name per
line, each followed by a colon. Names are arbitrary strings but they
must be unique. The hostname of each computer is recommended. (This
is the computer's network name on win32 and the name reported by the
program <span class="code">hostname</span> on Unix and OS X. Note
that OS X may append <span class="code">.local</span> to the name you
gave your computer; e.g. <span class="code">somehost.local</span>.)
There must be a screen name for the server and each client. Each
screen can specify a number of options. Options have the form
<span class="code"><span class="arg">name</span> =
<span class="arg">value</span></span> and are listed one per line
after the screen name.
</p><p>
Example:
<span class="codeblock">
section: screens
moe:
larry:
halfDuplexCapsLock = true
halfDuplexNumLock = true
curly:
meta = alt
end
</span>
This declares three screens named <span class="code">moe</span>,
<span class="code">larry</span>, and <span class="code">curly</span>.
Screen <span class="code">larry</span> has half-duplex Caps Lock and
Num Lock keys (see below) and screen <span class="code">curly</span>
converts the meta modifier key to the alt modifier key.
</p><p>
A screen can have the following options:
<ul>
<li><span class="code">halfDuplexCapsLock = {true|false}</span>
</p><p>
This computer has a Caps Lock key that doesn't report a
press and a release event when the user presses it but
instead reports a press event when it's turned on and a
release event when it's turned off. If Caps Lock acts
strangely on all screens then you may need to set this
option to <span class="code">true</span>
on the server screen. If it acts strangely on one
screen then that screen may need the option set to
<span class="code">true</span>.
</p><p>
<li><span class="code">halfDuplexNumLock = {true|false}</span>
</p><p>
This is identical to <span class="code">halfDuplexCapsLock</span>
except it applies to the Num Lock key.
</p><p>
<li><span class="code">halfDuplexScrollLock = {true|false}</span>
</p><p>
This is identical to <span class="code">halfDuplexCapsLock</span>
except it applies to the Scroll Lock key. Note that, by default,
synergy uses Scroll Lock to keep the cursor on the current screen. That
is, when Scroll Lock is toggled on, the cursor is locked to the screen
that it's currently on. You can use that to prevent accidental switching.
You can also configure other hot keys to do that; see <a href="#lockCursor">
lockCursorToScreen</a>.
</p><p>
<li><span class="code">switchCorners = &lt;corners&gt;</span>
</p><p>
See <a href="#corners">switchCorners</a> below.
</p><p>
<li><span class="code">switchCornerSize = N</span>
</p><p>
See <a href="#cornerSize">switchCornerSize</a> below.
</p><p>
<li><span class="code">xtestIsXineramaUnaware = {true|false}</span>
</p><p>
This option works around a bug in the XTest extension
when used in combination with Xinerama. It affects
X11 clients only. Not all versions of the XTest
extension are aware of the Xinerama extension. As a
result, they do not move the mouse correctly when
using multiple Xinerama screens. This option is
currently <span class="code">true</span> by default. If
you know your XTest extension is Xinerama aware then set
this option to <span class="code">false</span>.
</p><p>
<li><span class="code">shift = {shift|ctrl|alt|meta|super|none}<br>
ctrl = {shift|ctrl|alt|meta|super|none}<br>
alt = {shift|ctrl|alt|meta|super|none}<br>
meta = {shift|ctrl|alt|meta|super|none}<br>
super = {shift|ctrl|alt|meta|super|none}</span>
</p><p>
Map a modifier key pressed on the server's keyboard to
a different modifier on this client. This option only
has an effect on a client screen; it's accepted and
ignored on the server screen.
</p><p>
You can map, say, the shift key to shift (the default),
ctrl, alt, meta, super or nothing. Normally, you
wouldn't remap shift or ctrl. You might, however, have
an X11 server with meta bound to the Alt keys. To use
this server effectively with a windows client, which
doesn't use meta but uses alt extensively, you'll want
the windows client to map meta to alt (using
<span class="code">meta = alt</span>).
</p><p>
</ul>
</p><p>
</p><a name="aliases"></a><h4>aliases</h4><p>
</p><p>
<span class="arg">args</span> is a list of screen names just like
in the <span class="code">screens</span> section except each screen
is followed by a list of aliases, one per line, <b>not</b> followed
by a colon. An alias is a screen name and must be unique. During
screen name lookup each alias is equivalent to the screen name it
aliases. So a client can connect using its canonical screen name
or any of its aliases.
</p><p>
Example:
<span class="codeblock">
section: aliases
larry:
larry.stooges.com
curly:
shemp
end
</span>
Screen <span class="code">larry</span> is also known as
<span class="code">larry.stooges.com</span> and can connect as
either name. Screen <span class="code">curly</span> is also
known as <span class="code">shemp</span> (hey, it's just an example).
</p><p>
</p><h4>links</h4><p>
</p><p>
<span class="arg">args</span> is a list of screen names just like
in the <span class="code">screens</span> section except each screen
is followed by a list of links, one per line. Each link has the
form <span class="code">{left|right|up|down}[&lt;range&gt;]</span> =
<span class="code">name[&lt;range&gt;]</span>. A link indicates which
screen is adjacent in the given direction.
</p><p>
Each side of a link can specify a range which defines a portion
of an edge. A range on the direction is the portion of edge you can
leave from while a range on the screen is the portion of edge you'll
enter into. Ranges are optional and default to the entire edge. All
ranges on a particular direction of a particular screen must not
overlap.
</p><p>
A &lt;range&gt; is written as <span class="code">(&lt;start&gt;,&lt;end&gt;)</span>.
Both <span class="code">start</span> and <span class="code">end</span>
are percentages in the range 0 to 100, inclusive. The start must be
less than the end. 0 is the left or top of an edge and 100 is the
right or bottom.
</p><p>
Example:
<span class="codeblock">
section: links
moe:
right = larry
up(50,100) = curly(0,50)
larry:
left = moe
up(0,50) = curly(50,100)
curly:
down(0,50) = moe
down(50,100) = larry(0,50)
end
</span>
This indicates that screen <span class="code">larry</span> is to
the right of screen <span class="code">moe</span> (so moving the
cursor off the right edge of <span class="code">moe</span> would
make it appear at the left edge of <span class="code">larry</span>),
the left half of
<span class="code">curly</span> is above the right half of
<span class="code">moe</span>,
<span class="code">moe</span> is to the left of
<span class="code">larry</span> (edges are not necessarily symmetric
so you have to provide both directions), the right half of
<span class="code">curly</span> is above the left half of
<span class="code">larry</span>, all of <span class="code">moe</span>
is below the left half of <span class="code">curly</span>, and the
left half of <span class="code">larry</span> is below the right half of
<span class="code">curly</span>.
</p><p>
<a name="asymmetric"></a>Note that links do not have to be
symmetrical; for instance, here the edge between
<span class="code">moe</span> and <span class="code">curly</span>
maps to different ranges depending on if you're going up or down.
In fact links don't have to be bidirectional. You can configure
the right of <span class="code">moe</span> to go to
<span class="code">larry</span> without a link from the left of
<span class="code">larry</span> to <span class="code">moe</span>.
It's possible to configure a screen with no outgoing links; the
cursor will get stuck on that screen unless you have a hot key
configured to switch off of that screen.
</p><p>
</p><h4>options</h4><p>
</p><p>
<span class="arg">args</span> is a list of lines of the form
<span class="code">name = value</span>. These set the global
options.
</p><p>
Example:
<span class="codeblock">
section: options
heartbeat = 5000
switchDelay = 500
end
</span>
</p><p>
You can use the following options:
<ul>
<li><span class="code">heartbeat = N</span>
</p><p>
The server will expect each client to send a message no
less than every <span class="code">N</span> milliseconds.
If no message arrives from a client within
<span class="code">3N</span> seconds the server forces that
client to disconnect.
</p><p>
If synergy fails to detect clients disconnecting while
the server is sleeping or vice versa, try using this
option.
</p><p>
<li><span class="code"><a name="corners"></a>switchCorners = &lt;corners&gt;</span>
</p><p>
Synergy won't switch screens when the mouse reaches the edge of
the screen if it's in a listed corner. The size of all corners
is given by the <span class="code">switchCornerSize</span>
option.
</p><p>
Corners are specified by a list using the following names:
<ul>
<li><span class="code">none</span> -- no corners
<li><span class="code">top-left</span> -- the top left corner
<li><span class="code">top-right</span> -- the top right corner
<li><span class="code">bottom-left</span> -- the bottom left corner
<li><span class="code">bottom-right</span> -- the bottom right corner
<li><span class="code">left</span> -- top and bottom left corners
<li><span class="code">right</span> -- top and bottom right corners
<li><span class="code">top</span> -- left and right top corners
<li><span class="code">bottom</span> -- left and right bottom corners
<li><span class="code">all</span> -- all corners
</ul>
</p><p>
The first name in the list is one of the above names and defines
the initial set of corners. Subsequent names are prefixed with
+ or - to add the corner to or remove the corner from the set,
respectively. For example:
</p><p>
<span class="code">
all -left +top-left
</span>
</p><p>
starts will all corners, removes the left corners (top and bottom)
then adds the top-left back in, resulting in the top-left,
bottom-left and bottom-right corners.
</p><p>
<li><span class="code"><a name="cornerSize"></a>switchCornerSize = N</span>
</p><p>
Sets the size of all corners in pixels. The cursor must be within
<span class="code">N</span> pixels of the corner to be considered
to be in the corner.
</p><p>
<li><span class="code">switchDelay = N</span>
</p><p>
Synergy won't switch screens when the mouse reaches the
edge of a screen unless it stays on the edge for
<span class="code">N</span>
milliseconds. This helps prevent unintentional
switching when working near the edge of a screen.
</p><p>
<li><span class="code">switchDoubleTap = N</span>
</p><p>
Synergy won't switch screens when the mouse reaches the
edge of a screen unless it's moved away from the edge
and then back to the edge within <span class="code">N</span>
milliseconds. With
the option you have to quickly tap the edge twice to
switch. This helps prevent unintentional switching
when working near the edge of a screen.
</p><p>
<li><span class="code">screenSaverSync = {true|false}</span>
</p><p>
If set to <span class="code">false</span> then synergy
won't synchronize screen savers. Client screen savers
will start according to their individual configurations.
The server screen saver won't start if there is input,
even if that input is directed toward a client screen.
</p><p>
<li><span class="code">relativeMouseMoves = {true|false}</span>
</p><p>
If set to <span class="code">true</span> then secondary
screens move the mouse using relative rather than absolute
mouse moves when and only when the cursor is locked to the
screen (by Scroll Lock or a <a href="#lockCursor">configured
hot key</a>).
This is intended to make synergy work better with certain
games. If set to <span class="code">false</span> or not
set then all mouse moves are absolute.
</p><p>
<li><span class="code">keystroke(<span class="arg">key</span>) = <span class="arg">actions</span></span>
</p><p>
Binds the key combination <span class="arg">key</span> to the
given <span class="arg">actions</span>. <span class="arg">key</span>
is an optional list of modifiers (<span class="code">shift</span>,
<span class="code">control</span>, <span class="code">alt</span>,
<span class="code">meta</span> or <span class="code">super</span>)
optionally followed by a character or a key name, all separated by
<span class="code">+</span> (plus signs). You must have either
modifiers or a character/key name or both. See below for
<a href="#keynames">valid key names</a>.
</p><p>
Actions are described <a href="#actions">below</a>.
</p><p>
Keyboard hot keys are handled while the cursor is on the primary
screen and secondary screens. Separate actions can be assigned
to press and release.
</p><p>
<li><span class="code">mousebutton(<span class="arg">button</span>) = <span class="arg">actions</span></span>
</p><p>
Binds the modifier and mouse button combination
<span class="arg">button</span> to the given
<span class="arg">actions</span>. <span class="arg">button</span>
is an optional list of modifiers (<span class="code">shift</span>,
<span class="code">control</span>, <span class="code">alt</span>,
<span class="code">meta</span> or <span class="code">super</span>)
followed by a button number. The primary button (the
left button for right handed users) is button 1, the middle button
is 2, etc.
</p><p>
Actions are described <a href="#actions">below</a>.
</p><p>
Mouse button actions are not handled while the cursor is on the
primary screen. You cannot use these to perform an action while
on the primary screen. Separate actions can be assigned to press
and release.
</p><p>
</ul>
You can use both the <span class="code">switchDelay</span> and
<span class="code">switchDoubleTap</span> options at the same
time. Synergy will switch when either requirement is satisfied.
</p><p>
<a name="actions">Actions</a> are two lists of individual actions separated
by commas. The two lists are separated by a semicolon. Either list can be
empty and if the second list is empty then the semicolon is optional. The
first list lists actions to take when the condition becomes true (e.g. the
hot key or mouse button is pressed) and the second lists actions to take
when the condition becomes false (e.g. the hot key or button is released).
The condition becoming true is called activation and becoming false is
called deactivation.
Allowed individual actions are:
<ul>
<li><span class="code">keystroke(<span class="arg">key</span>[,<span class="arg">screens</span>])</span>
<li><span class="code">keyDown(<span class="arg">key</span>[,<span class="arg">screens</span>])</span>
<li><span class="code">keyUp(<span class="arg">key</span>[,<span class="arg">screens</span>])</span>
</p><p>
Synthesizes the modifiers and key given in <span class="arg">key</span>
which has the same form as described in the
<span class="code">keystroke</span> option. If given,
<span class="arg">screens</span> lists the screen or screens to
direct the event to, regardless of the active screen. If not
given then the event is directed to the active screen only.
(Due to a bug, keys cannot be directed to the server while on a
client screen.)
</p><p>
<span class="code">keyDown</span> synthesizes a key press and
<span class="code">keyUp</span> synthesizes a key release.
<span class="code">keystroke</span> synthesizes a key press on
activation and a release on deactivation and is equivalent to
a <span class="code">keyDown</span> on activation and
<span class="code">keyUp</span> on deactivation.
</p><p>
<span class="arg">screens</span> is either <span class="code">*</span>
to indicate all screens or a colon (:) separated list of screen
names. (Note that the screen name must have already been encountered
in the configuration file so you'll probably want to put actions at
the bottom of the file.)
</p><p>
<li><span class="code">mousebutton(<span class="arg">button</span>)</span>
<li><span class="code">mouseDown(<span class="arg">button</span>)</span>
<li><span class="code">mouseUp(<span class="arg">button</span>)</span>
</p><p>
Synthesizes the modifiers and mouse button given in
<span class="arg">button</span>
which has the same form as described in the
<span class="code">mousebutton</span> option.
</p><p>
<span class="code">mouseDown</span> synthesizes a mouse press and
<span class="code">mouseUp</span> synthesizes a mouse release.
<span class="code">mousebutton</span> synthesizes a mouse press on
activation and a release on deactivation and is equivalent to
a <span class="code">mouseDown</span> on activation and
<span class="code">mouseUp</span> on deactivation.
</p><p>
<li><a name="lockCursor"></a><span class="code">lockCursorToScreen(<span class="arg">mode</span>)</span>
</p><p>
Locks the cursor to or unlocks the cursor from the active screen.
<span class="arg">mode</span> can be <span class="code">off</span>
to unlock the cursor, <span class="code">on</span> to lock the
cursor, or <span class="code">toggle</span> to toggle the current
state. The default is <span class="code">toggle</span>. If the
configuration has no <span class="code">lockCursorToScreen</span>
action and Scroll Lock is not used as a hot key then Scroll Lock
toggles cursor locking.
</p><p>
<li><span class="code">switchToScreen(<span class="arg">screen</span>)</span>
</p><p>
Jump to screen with name or alias <span class="arg">screen</span>.
</p><p>
<li><span class="code">switchInDirection(<span class="arg">dir</span>)</span>
</p><p>
Switch to the screen in the direction <span class="arg">dir</span>,
which may be one of <span class="code">left</span>,
<span class="code">right</span>, <span class="code">up</span> or
<span class="code">down</span>.
</p><p>
<li><a name="keyboardBroadcast"></a><span class="code">keyboardBroadcast(<span class="arg">mode</span>[,<span class="arg">screens</span>])</span>
</p><p>
Turns broadcasting of keystrokes to multiple screens on and off. When
turned on all key presses and releases are sent to all of the screens
listed in <span class="arg">screens</span>. If not given, empty or
<span class="code">*</span> then keystrokes are broadcast to all screens.
(However, due to a bug, keys cannot be sent to the server while on a
client screen.)
</p><p>
<span class="arg">mode</span> can be <span class="code">off</span>
to turn broadcasting off, <span class="code">on</span> to turn it
on, or <span class="code">toggle</span> to toggle the current
state. The default is <span class="code">toggle</span>.
</p><p>
<span class="arg">screens</span> is either <span class="code">*</span>
to indicate all screens or a colon (:) separated list of screen
names. (Note that the screen name must have already been encountered
in the configuration file so you'll probably want to put actions at
the bottom of the file.)
</p><p>
Multiple <span class="code">keyboardBroadcast</span> actions may be
configured with different <span class="arg">screens</span>. The most
recently performed action defines the screens to broadcast to.
</p><p>
</ul>
</p><p>
Examples:
<ul>
<li><span class="code">keystroke(alt+left) = switchInDirection(left)</span>
</p><p>
Switches to the screen to left when the left arrow key is pressed
in combination with the Alt key.
</p><p>
<li><span class="code">keystroke(shift+control+alt+super) = switchToScreen(moe)</span>
</p><p>
Switches to screen <span class="code">moe</span> when all of the
Shift, Control, Alt, and Super modifier keys are pressed together.
</p><p>
<li><span class="code">keystroke(alt+f1) = ; lockCursorToScreen(toggle)</span>
</p><p>
Toggles locking the cursor to the screen when Alt+F1 is released.
</p><p>
<li><span class="code">mousebutton(2) = mouseDown(control+1) ; mouseUp(control+1)</span>
</p><p>
While on a secondary screen clicking the middle mouse button will
become a Control click of the primary button.
</p><p>
<li><span class="code">keystroke(super+f1) = keystroke(super+L,larry), keystroke(control+alt+delete,curly)</span>
</p><p>
Pressing Super+F1 (on any screen) will synthesize Super+L on screen
<span class="code">larry</span> and Control+Alt+Delete on screen
<span class="code">curly</span>.
</p><p>
</ul></span>
</p><p>
<a name="keynames">Valid key names</a> are:
<span class="code"><ul>
<li>AppMail
<li>AppMedia
<li>AppUser1
<li>AppUser2
<li>AudioDown
<li>AudioMute
<li>AudioNext
<li>AudioPlay
<li>AudioPrev
<li>AudioStop
<li>AudioUp
<li>BackSpace
<li>Begin
<li>Break
<li>Cancel
<li>CapsLock
<li>Clear
<li>Delete
<li>Down
<li>Eject
<li>End
<li>Escape
<li>Execute
<li>F1
<li>F2
<li>F3
<li>F4
<li>F5
<li>F6
<li>F7
<li>F8
<li>F9
<li>F10
<li>F11
<li>F12
<li>F13
<li>F14
<li>F15
<li>F16
<li>F17
<li>F18
<li>F19
<li>F20
<li>F21
<li>F22
<li>F23
<li>F24
<li>F25
<li>F26
<li>F27
<li>F28
<li>F29
<li>F30
<li>F31
<li>F32
<li>F33
<li>F34
<li>F35
<li>Find
<li>Help
<li>Home
<li>Insert
<li>KP_0
<li>KP_1
<li>KP_2
<li>KP_3
<li>KP_4
<li>KP_5
<li>KP_6
<li>KP_7
<li>KP_8
<li>KP_9
<li>KP_Add
<li>KP_Begin
<li>KP_Decimal
<li>KP_Delete
<li>KP_Divide
<li>KP_Down
<li>KP_End
<li>KP_Enter
<li>KP_Equal
<li>KP_F1
<li>KP_F2
<li>KP_F3
<li>KP_F4
<li>KP_Home
<li>KP_Insert
<li>KP_Left
<li>KP_Multiply
<li>KP_PageDown
<li>KP_PageUp
<li>KP_Right
<li>KP_Separator
<li>KP_Space
<li>KP_Subtract
<li>KP_Tab
<li>KP_Up
<li>Left
<li>LeftTab
<li>Linefeed
<li>Menu
<li>NumLock
<li>PageDown
<li>PageUp
<li>Pause
<li>Print
<li>Redo
<li>Return
<li>Right
<li>ScrollLock
<li>Select
<li>Sleep
<li>Space
<li>SysReq
<li>Tab
<li>Undo
<li>Up
<li>WWWBack
<li>WWWFavorites
<li>WWWForward
<li>WWWHome
<li>WWWRefresh
<li>WWWSearch
<li>WWWStop
<li>Space
<li>Exclaim
<li>DoubleQuote
<li>Number
<li>Dollar
<li>Percent
<li>Ampersand
<li>Apostrophe
<li>ParenthesisL
<li>ParenthesisR
<li>Asterisk
<li>Plus
<li>Comma
<li>Minus
<li>Period
<li>Slash
<li>Colon
<li>Semicolon
<li>Less
<li>Equal
<li>Greater
<li>Question
<li>At
<li>BracketL
<li>Backslash
<li>BracketR
<li>Circumflex
<li>Underscore
<li>Grave
<li>BraceL
<li>Bar
<li>BraceR
<li>Tilde
</ul></span>
Additionally, a name of the form <span class="code">\uXXXX</span> where
<span class="code">XXXX</span> is a hexadecimal number is interpreted as
a unicode character code.
Key and modifier names are case-insensitive. Keys that don't exist on
the keyboard or in the default keyboard layout will not work.
</p>
</body>
</html>

44
doc/contact.html Normal file
View File

@ -0,0 +1,44 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy Contact Info</title>
</head>
<body class="main">
<p>
Use the following addresses to contact the synergy project:
</p><p>
<table border="0">
<tr>
<td align="right">Bug reports:</td>
<td>&nbsp;</td>
<td><a target="_top" href="http://sourceforge.net/tracker/?func=add&group_id=59275&atid=490467">Add Synergy Bug</a></td>
</tr>
<tr>
<td align="right">Help:</td>
<td>&nbsp;</td>
<td><span class="fakelink">synergy-help@groundhog.pair.<span class="hide">.no_spam</span>com</span></td>
</tr>
<tr>
<td align="right">General:</td>
<td>&nbsp;</td>
<td><span class="fakelink">crs23@users.sourceforge.<span class="hide">.no_spam</span>net</span></td>
</tr>
</table>
</p><p>
To avoid spam bots, the above email addresses have ".no_spam"
hidden near the end. If you copy and paste the text be sure to
remove it.
</p><p>
Please check the
<a target="_top" href="http://sourceforge.net/tracker/?func=browse&group_id=59275&atid=490467">
bug list</a> before reporting a bug. You may also find answers at the
synergy <a target="_top" href="http://sourceforge.net/forum/?group_id=59275">forums</a>.
Emails for help asking questions answered on this site will go unanswered.
</p>
</body>
</html>

81
doc/developer.html Normal file
View File

@ -0,0 +1,81 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy Developer Documentation</title>
</head>
<body class="main">
<p>
Synergy is reasonably well commented so reading the source code
should be enough to understand particular pieces. See the
<span class="code">doc/PORTING</span>
file in the synergy source code for more high-level information.
</p><p>
</p><h4>How it works</h4><p>
</p><p>
The theory behind synergy is simple: the server captures mouse,
keyboard, clipboard, and screen saver events and forwards them to
one or more clients. If input is directed to the server itself
then the input is delivered normally. In practice, however, many
complications arise.
</p><p>
First, different keyboard mappings can produce different characters.
Synergy attempts to generate the same character on the client as
would've been generated on the server, including appropriate modifier
keys (like Control and Alt). Non-character keys like Shift are also
synthesized if possible. Sometimes the client simply cannot create
the character or doesn't have a corresponding non-character key and
synergy must discard the event. Note that synergy won't necessarily
synthesize an event for the corresponding key on the client's
keyboard. For example, if the client or server can't distinguish
between the left and right shift keys then synergy can't be certain
to synthesize the shift on the same side of the keyboard as the user
pressed.
</p><p>
Second, different systems have different clipboards and clipboard
formats. The X window system has a system-wide selection and
clipboard (and yet other buffers) while Microsoft Windows has only
a system-wide clipboard. Synergy has to choose which of these
buffers correspond to one another. Furthermore, different systems
use different text encodings and line breaks. Synergy mediates and
converts between them.
</p><p>
Finally, there are no standards across operating systems for some
operations that synergy requires. Among these are: intercepting
and synthesizing events; enabling, disabling, starting and stopping
the screen saver; detecting when the screen saver starts; reading
and writing the clipboard(s).
</p><p>
All this means that synergy must be customized to each operating
system (or windowing system in the case of X windows). Synergy
breaks platform differences into two groups. The first includes
the mundane platform dependent things: file system stuff,
multithreading, network I/O, multi-byte and wide character
conversion, time and sleeping, message display and logging, and
running a process detached from a terminal. This code lives in
<span class="code">lib/arch</span>.
</p><p>
The second includes screen and window management handling, user
event handling, event synthesis, the clipboards, and the screen
saver. This code lives in <span class="code">lib/platform</span>.
</p><p>
For both groups, there are particular classes or interfaces that
must be inherited and implemented for each platform. See the
<span class="code">doc/PORTING</span> file in the synergy source
code for more information.
</p><p>
</p><h4>Auto-generated Documentation</h4><p>
</p><p>
Synergy can automatically generate documentation from the comments
in the code using <a target="_top" href="http://www.doxygen.org/">doxygen</a>.
Use <span class="command">make doxygen</span> to build it yourself
from the source code into the <span class="code">doc/doxygen/html</span>
directory.
</p>
</p>
</body>
</html>

898
doc/doxygen.cfg.in Normal file
View File

@ -0,0 +1,898 @@
# Doxyfile 1.2.13.1
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
# All text after a hash (#) is considered a comment and will be ignored
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (" ")
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
PROJECT_NAME = @PACKAGE@
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = @VERSION@
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = doc/doxygen
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French,
# German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Polish,
# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
OUTPUT_LANGUAGE = English
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = YES
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these class will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
# the brief description of a member or function before the detailed description.
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
REPEAT_BRIEF = YES
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
# members of a class in the documentation of that class as if those members were
# ordinary class members. Constructors, destructors and assignment operators of
# the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. It is allowed to use relative paths in the argument list.
STRIP_FROM_PATH =
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = YES
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower case letters. If set to YES upper case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# users are adviced to set this option to NO.
CASE_SENSE_NAMES = YES
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful is your file systems
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like the Qt-style comments (thus requiring an
# explict @brief command for a brief description.
JAVADOC_AUTOBRIEF = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# reimplements.
INHERIT_DOCS = YES
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
# will sort the (detailed) documentation of file and class members
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
DISTRIBUTE_GROUP_DOC = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 4
# The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation.
GENERATE_TODOLIST = YES
# The GENERATE_TESTLIST tag can be used to enable (YES) or
# disable (NO) the test list. This list is created by putting \test
# commands in the documentation.
GENERATE_TESTLIST = YES
# The GENERATE_BUGLIST tag can be used to enable (YES) or
# disable (NO) the bug list. This list is created by putting \bug
# commands in the documentation.
GENERATE_BUGLIST = YES
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES =
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
# the initial value of a variable or define consist of for it to appear in
# the documentation. If the initializer consists of more lines than specified
# here it will be hidden. Use a value of 0 to hide initializers completely.
# The appearance of the initializer of individual variables and defines in the
# documentation can be controlled using \showinitializer or \hideinitializer
# command in the documentation regardless of this setting.
MAX_INITIALIZER_LINES = 30
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C.
# For instance some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = NO
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
# at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
# NO is used.
WARNINGS = YES
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
WARN_IF_UNDOCUMENTED = YES
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
# tags, which will be replaced by the file and line number from which the
# warning originated and the warning text.
WARN_FORMAT =
# The WARN_LOGFILE tag can be used to specify a file to which warning
# and error messages should be written. If left blank the output is written
# to stderr.
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
# The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = .
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
# *.h++ *.idl
FILE_PATTERNS = *.cpp *.h
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE =
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
# certain files from those directories.
EXCLUDE_PATTERNS =
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH =
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
EXAMPLE_PATTERNS =
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude
# commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = NO
# The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see
# the \image command).
IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes
# to standard output.
INPUT_FILTER =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse.
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
SOURCE_BROWSER = YES
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = NO
# If the REFERENCED_BY_RELATION tag is set to YES (the default)
# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES (the default)
# then for each documented function all documented entities
# called/used by that function will be listed.
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = YES
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 3
# In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index.
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT =
# The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet
HTML_STYLESHEET =
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
GENERATE_CHI = NO
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
# controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file.
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the Html help documentation and to the tree view.
TOC_EXPAND = NO
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
DISABLE_INDEX = NO
# This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation.
ENUM_VALUES_PER_LINE = 4
# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
# generated containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
# or Internet explorer 4.0+). Note that for large projects the tree generation
# can take a very long time. In such cases it is better to disable this feature.
# Windows users are probably better off using the HTML help feature.
GENERATE_TREEVIEW = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `latex' will be used as the default path.
LATEX_OUTPUT =
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used
# by the printer. Possible values are: a4, a4wide, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4wide
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
# the generated latex document. The header should contain everything until
# the first chapter. If it is left blank doxygen will generate a
# standard header. Notice: only use this tag if you know what you are doing!
LATEX_HEADER =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
# contain links (just like the HTML output) instead of page references
# This makes the output suitable for online browsing using a pdf viewer.
PDF_HYPERLINKS = NO
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
USE_PDFLATEX = NO
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
# command to the generated LaTeX files. This will instruct LaTeX to keep
# running if errors occur, instead of asking the user for help.
# This option is also used when generating formulas in HTML.
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
# The RTF output is optimised for Word 97 and may not look very pretty with
# other RTF readers or editors.
GENERATE_RTF = NO
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `rtf' will be used as the default path.
RTF_OUTPUT =
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
# RTF documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_RTF = NO
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
# will contain hyperlink fields. The RTF file will
# contain links (just like the HTML output) instead of page references.
# This makes the output suitable for online browsing using WORD or other
# programs which support those fields.
# Note: wordpad (write) and others do not support links.
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# config file, i.e. a series of assigments. You only have to provide
# replacements, missing definitions are set to their default value.
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = NO
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `man' will be used as the default path.
MAN_OUTPUT =
# The MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION =
# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
# then it will generate one additional man file for each entity
# documented in the real man page(s). These additional files
# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES Doxygen will
# generate an XML file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
GENERATE_XML = NO
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
# generate an AutoGen Definitions (see autogen.sf.net) file
# that captures the structure of the code including all
# documentation. Note that this feature is still experimental
# and incomplete at the moment.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
# evaluate all C-preprocessor directives found in the sources and include
# files.
ENABLE_PREPROCESSING = YES
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
# names in the source code. If set to NO (the default) only conditional
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_PREDEFINED tags.
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by
# the preprocessor.
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# directories. If left blank, the patterns specified with FILE_PATTERNS will
# be used.
INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that
# are defined before the preprocessor is started (similar to the -D option of
# gcc). The argument of the tag is a list of macros of the form: name
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed.
PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
# on a line and do not end with a semicolon. Such function macros are typically
# used for boiler-plate code, and will confuse the parser if not removed.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
# The TAGFILES tag can be used to specify one or more tagfiles.
TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
# in the class index. If set to NO only the inherited external classes
# will be listed.
ALLEXTERNALS = NO
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH =
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
# super classes. Setting the tag to NO turns the diagrams off. Note that this
# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
# recommended to install and use dot, since it yield more powerful graphs.
CLASS_DIAGRAMS = NO
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = @HAVE_DOT@
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the
# the CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = YES
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect implementation dependencies (inheritance, containment, and
# class references variables) of the class with other documented classes.
COLLABORATION_GRAPH = YES
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = YES
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
# tags are set to YES then doxygen will generate a graph for each documented
# file showing the direct and indirect include dependencies of the file with
# other documented files.
INCLUDE_GRAPH = YES
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
# documented header file showing the documented files that directly or
# indirectly include this file.
INCLUDED_BY_GRAPH = YES
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will graphical hierarchy of all classes instead of a textual one.
GRAPHICAL_HIERARCHY = YES
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found on the path.
DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the
# \dotfile command).
DOTFILE_DIRS =
# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
# this value, doxygen will try to truncate the graph, so that it fits within
# the specified constraint. Beware that most browsers cannot cope with very
# large images.
MAX_DOT_GRAPH_WIDTH = 1024
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
# this value, doxygen will try to truncate the graph, so that it fits within
# the specified constraint. Beware that most browsers cannot cope with very
# large images.
MAX_DOT_GRAPH_HEIGHT = 1024
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
# remove the intermedate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
# The SEARCHENGINE tag specifies whether or not a search engine should be
# used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = NO
# The CGI_NAME tag should be the name of the CGI script that
# starts the search engine (doxysearch) with the correct parameters.
# A script with this name will be generated by doxygen.
CGI_NAME =
# The CGI_URL tag should be the absolute URL to the directory where the
# cgi binaries are located. See the documentation of your http daemon for
# details.
CGI_URL =
# The DOC_URL tag should be the absolute URL to the directory where the
# documentation is located. If left blank the absolute path to the
# documentation, with file:// prepended to it, will be used.
DOC_URL =
# The DOC_ABSPATH tag should be the absolute path to the directory where the
# documentation is located. If left blank the directory on the local machine
# will be used.
DOC_ABSPATH =
# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
# is installed.
BIN_ABSPATH =
# The EXT_DOC_PATHS tag can be used to specify one or more paths to
# documentation generated for other projects. This allows doxysearch to search
# the documentation for these projects as well.
EXT_DOC_PATHS =

266
doc/faq.html Normal file
View File

@ -0,0 +1,266 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy Frequently Asked Questions</title>
</head>
<body class="main">
<p></p>
<h3>Synergy Frequently Asked Questions</h3>
</p><p>
<h4>Questions</h4>
<ol>
<li><a href="#faq1">Why doesn't ctrl+alt+del work on secondary screens?</a>
<li><a href="#faq2">Can the server and client be using different operating systems?</a>
<li><a href="#faq3">What's the difference between synergy and x2x, x2vnc, etc?</a>
<li><a href="#faq4">What does "Cannot initialize hook library" mean?</a>
<li><a href="#faq5">What security/encryption does synergy provide?</a>
<li><a href="#faq6">What should I call my screens in the configuration?</a>
<li><a href="#faq7">Why do my Caps-Lock, Num-Lock, Scroll-Lock keys act funny?</a>
<li><a href="#faq8">Can synergy share the display in addition to the mouse and keyboard?</a>
<li><a href="#faq9">Can synergy do drag and drop between computers?</a>
<li><a href="#faq10">Do AltGr or Mode-Switch or ISO_Level3_Shift work?</a>
<li><a href="#faq11">Why isn't synergy ported to platform XYZ?</a>
<li><a href="#faq12">My client can't connect. What's wrong?</a>
<li><a href="#faq13">Linking fails on Solaris. What's wrong?</a>
<li><a href="#faq14">The screen saver never starts. Why not?</a>
<li><a href="#faq15">I can't switch screens anymore for no apparent reason. Why?</a>
<li><a href="#faq16">I get the error 'Xlib: No protocol specified'. Why?</a>
<li><a href="#faq17">The cursor goes to secondary screen but won't come back. Why?</a>
<li><a href="#faq18">The cursor wraps from one edge of the screen to the opposite. Why?</a>
<li><a href="#faq19">How do I stop my game from minimizing when I leave the screen?</a>
</ol>
<h4>Answers</h4>
<ol>
<li><a name="faq1"></a><span class="fakelink">Why doesn't ctrl+alt+del work on secondary screens?</span>
<p>
Synergy isn't able to capture ctrl+alt+del on PC compatible
primary screens because it's handled completely differently than
other keystrokes. However, when the mouse is on a client
screen, pressing ctrl+alt+pause will simulate ctrl+alt+del
on the client. (A client running on Windows NT, 2000, or XP
must be configured to autostart when the computer starts for
this to work.)
</p><p>
On a primary screen running on an OS X system, you can use
ctrl+command+del. Using the pause key isn't necessary since OS X
doesn't treat ctrl+command+del differently. And using the pause
key isn't usually possible because there isn't one on most OS X
systems. Use command instead of option/alt because
the command key, not the option/alt key, maps to alt on windows.
The reason is because the command key is in the same physical
location and performs the same general function (menu shortcuts)
as alt on a windows system. This mapping can be modified in
the configuration.
</p><p>
On mac laptops, the key labeled "delete" is actually backspace
and ctrl+command+delete won't work. However fn+delete really
is delete so fn+ctrl+command+delete will act as ctrl+alt+del
on a windows secondary screen.
</p>
<li><a name="faq2"></a><span class="fakelink">Can the server and client be using different operating systems?</span>
<p>
Yes. The synergy network protocol is platform neutral so
synergy doesn't care what operating systems are running on
the server and clients.
</p>
<li><a name="faq3"></a><span class="fakelink">What's the difference between synergy and
<span class="code">x2x</span>, <span class="code">x2vnc</span>, etc?</span>
<p>
Unlike <span class="code">x2x</span>, synergy supports any number of computers and
it doesn't require X on Microsoft Windows platforms. It
also has more advanced clipboard support and synchronizes
screensavers. <span class="code">x2vnc</span> is also limited to two computers,
requires the separate vnc package, and is really only
appropriate for using an X system to control a non-X system.
However, the right tool for the job is whatever tool works
best for you.
</p>
<li><a name="faq4"></a><span class="fakelink">What does "Cannot initialize hook library" mean?</span>
<p>
This error can occur on a synergy server running on a
Microsoft Windows operating system. It means that synergy
is already running or possibly was not shut down properly.
If it's running then first end the synergy task. If it's
not then try logging off and back on or rebooting then
starting synergy again.
</p>
<li><a name="faq5"></a><span class="fakelink">What security/encryption does synergy provide?</span>
<p>
Synergy provides no built-in encryption or authentication.
Given that, synergy should not be used on or over any untrusted
network, especially the Internet. It's generally fine for home
networks. Future versions may provide built-in encryption and
authentication.
</p><p>
Strong encryption and authentication is available through SSH
(secure shell). Run the SSH daemon (i.e. server) on the same
computer that you run the synergy server. It requires no
special configuration to support synergy. On each synergy
client system, run SSH with port forwarding:
</p><p>
<pre>
ssh -f -N -L 24800:<span class="arg">server-hostname</span>:24800 <span class="arg">server-hostname</span>
</pre>
</p><p>
where <span class="arg">server-hostname</span> is the name of the
SSH/synergy server.
Once ssh authenticates itself, start the synergy client
normally except use <span class="code">localhost</span> or
<span class="code">127.0.0.1</span> as the server's
address. SSH will then encrypt all communication on behalf of
synergy. Authentication is handled by the SSH authentication.
</p><p>
A free implementation of SSH for Linux and many Unix systems is
<a target="_top" href="http://www.openssh.com/">OpenSSH</a>. For
Windows there's a port of OpenSSH using
<a target="_top" href="http://www.cygwin.com/">Cygwin<a>.
</p>
<li><a name="faq6"></a><span class="fakelink">What should I call my screens in the configuration?</span>
<p>
You can use any unique name in the configuration file for each
screen but it's easiest to use the hostname of the computer.
That's the computer name not including the domain. For example,
a computer with the fully qualified domain name <span class="code">xyz.foo.com</span> has
the hostname <span class="code">xyz</span>. There should also be an alias for <span class="code">xyz</span> to
<span class="code">xyz.foo.com</span>. If you don't use the computer's hostname, you
have to tell synergy the name of the screen using a command line
option, or the startup dialog on Windows.
</p><p>
Some systems are configured to report the fully qualified domain
name as the hostname. For those systems it will be easier to use
the FQDN as the screen name. Also note that a Mac OS X system
named <span class="code">xyz</span> may report its hostname as
<span class="code">xyz.local</span>. If that's the case for you
then use <span class="code">xyz.local</span> as the screen name.
</p>
<li><a name="faq7"></a><span class="fakelink">Why do my Caps-Lock, Num-Lock, Scroll-Lock keys act funny?</span>
<p>
Some systems treat the Caps-Lock, Num-Lock, and Scroll-Lock keys
differently than all the others. Whereas most keys report going down
when physically pressed and going up when physically released, on
these systems the Caps-Lock and Num-Lock keys report going down
when being activated and going up when being deactivated. That
is, when you press and release, say, Caps-Lock to activate it, it
only reports going down, and when you press and release to
deactivate it, it only reports going up. This confuses synergy.
</p><p>
You can solve the problem by changing your configuration file.
In the screens section, following each screen that has the
problem, any or all of these lines as appropriate:
</p><p>
<pre>
halfDuplexCapsLock = true
halfDuplexNumLock = true
halfDuplexScrollLock = true
</pre>
</p><p>
Then restart synergy on the server or reload the configuration.
</p>
<li><a name="faq8"></a><span class="fakelink">Can synergy share the display in addition to the mouse and keyboard?</span>
<p>
No. Synergy is a KM solution not a KVM (keyboard, video, mouse)
solution. However, future versions will probably support KVM.
Hopefully, this will make synergy suitable for managing large
numbers of headless servers.
</p>
<li><a name="faq9"></a><span class="fakelink">Can synergy do drag and drop between computers?</span>
<p>
No. That's a very cool idea and it'll be explored. However, it's
also clearly difficult and may take a long time to implement.
</p>
<li><a name="faq10"></a><span class="fakelink">Does AltGr/Mode-Switch/ISO_Level3_Shift work?</span>
<p>
Yes, as of 1.0.12 synergy has full support for AltGr/Mode-switch.
That includes support for most (all?) European keyboard layouts.
All systems should be using the same keyboard layout, though, for
all characters to work. (Any character missing from a client's
layout cannot be generated by synergy.) There is experimental
support for ISO_Level3_Shift in 1.1.3.
</p>
<li><a name="faq11"></a><span class="fakelink">Why isn't synergy ported to platform XYZ?</span>
<p>
Probably because the developers don't have access to platform XYZ
and/or are unfamiliar with development on XYZ. Also, synergy has
inherently non-portable aspects so there's a not insignificant
effort involved in porting.
</p>
<li><a name="faq12"></a><span class="fakelink">My client can't connect. What's wrong?</span>
<p>
A common mistake when starting the client is to give the wrong
server host name. The last synergyc command line option (Unix)
or the "Server Host Name" edit field (Windows) should be the
host name (or IP address) of the server <b>not</b> the client's host
name. If you get the error <span class="code">connection failed: cannot connect
socket</span> followed by <span class="code">the attempt to connect was forcefully
rejected</span> or <span class="code">connection refused</span> then the server isn't started,
can't bind the address, or the client is connecting to the wrong
host name/address or port. See the
<a href="trouble.html">troublshooting</a> page for more help.
</p>
<li><a name="faq13"></a><span class="fakelink">Linking fails on Solaris. What's wrong?</span>
<p>
Did you add
</p><p>
<pre>
<nobr>--x-includes=/usr/openwin/include --x-libraries=/usr/openwin/lib</nobr>
</pre>
</p><p>
to the <span class="code">configure</span> command line? Solaris puts
the X11 includes and libraries in an unusual place and the above lets
synergy find them.
</p>
<li><a name="faq14"></a><span class="fakelink">The screen saver never starts. Why not?</span>
<p>
If the synergy server is on X Windows then the screen saver will
not start while the mouse is on a client screen. This is a
consequence of how X Windows, synergy and xscreensaver work.
</p>
<li><a name="faq15"></a><span class="fakelink">I can't switch screens anymore for no apparent reason. Why?</span>
<p>
This should not happen with 1.1.3 and up. Earlier versions of
synergy would not allow switching screens when a key was down and
sometimes it would believe a key was down when it was not.
</p>
<li><a name="faq16"></a><span class="fakelink">I get the error 'Xlib: No protocol specified'. Why?</span>
<p>
You're running synergy without authorization to connect to the
X display. Typically the reason is running synergy as root when
logged in as non-root. Just run synergy as the same user that's
logged in.
</p>
<li><a name="faq17"></a><span class="fakelink">The cursor goes to secondary screen but won't come back. Why?</span>
<p>
Your configuration is incorrect. You must indicate the neighbors
of every screen. Just because you've configured 'Apple' to be to
the left of 'Orange' does not mean that 'Orange' is to the right
of 'Apple'. You must provide both in the configuration.
</p>
<li><a name="faq18"></a><span class="fakelink">The cursor wraps from one edge of the screen to the opposite. Why?</span>
<p>
Because you told it to. If you list 'Orange' to be to the left of
'Orange' then moving the mouse off the left edge of 'Orange' will
make it jump to the right edge. Remove the offending line from the
configuration if you don't want that behavior.
</p>
<li><a name="faq19"></a><span class="fakelink">How do I stop my game from minimizing when I leave the screen?</span>
<p>
Many full screen applications, particularly games, automatically
minimize when they're no longer the active (foreground) application
on Microsoft Windows. The synergy server normally becomes the foreground
when you switch to another screen in order to more reliably capture all
user input causing those full screen applications to minimize. To
prevent synergy from stealing the foreground just click "Options..."
and check "Don't take foreground window on Windows servers." If you
turn this on then be aware that synergy may not function correctly when
certain programs, particularly the command prompt, are the foreground
when you switch to other screens. Simply make a different program the
foreground before switching to work around that.
</p>
</ol>
</body>
</html>

30
doc/history.html Normal file
View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy History</title>
</head>
<body class="main">
<p>
</p><h3>Synergy History</h3><p>
</p><p>
The first incarnation of synergy was CosmoSynergy, created by
Richard Lee and Adam Feder then at Cosmo Software, Inc., a
subsidiary of SGI (nee Silicon Graphics, Inc.), at the end of
1996. They wrote it, and Chris Schoeneman contributed, to
solve a problem: most of the engineers in Cosmo Software had
both an Irix and a Windows box on their desks and switchboxes
were expensive and annoying. CosmoSynergy was a great success
but Cosmo Software declined to productize it and the company
was later closed.
</p><p>
Synergy is a from-scratch reimplementation of CosmoSynergy.
It provides most of the features of the original and adds a
few improvements.
</p>
</body>
</html>

61
doc/home.html Normal file
View File

@ -0,0 +1,61 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy</title>
</head>
<body class="main">
<p>
</p><h4>Introduction</h4><p>
synergy: [noun] a mutually advantageous conjunction of distinct elements
</p><p>
Synergy lets you easily share a single mouse and keyboard between
multiple computers with different operating systems, each with its
own display, without special hardware. It's intended for users
with multiple computers on their desk since each system uses its
own monitor(s).
</p><p>
Redirecting the mouse and keyboard is as simple as moving the mouse
off the edge of your screen. Synergy also merges the clipboards of
all the systems into one, allowing cut-and-paste between systems.
Furthermore, it synchronizes screen savers so they all start and stop
together and, if screen locking is enabled, only one screen requires
a password to unlock them all. <a href="about.html">Learn more</a>
about how it works.
</p><p>
Synergy is open source and released under the
<a href="license.html#GPL">GNU Public License (GPL)</a>.
</p><p>
</p><h4>System Requirements</h4><p>
</p><p>
<ul>
<li>Microsoft Windows 95, Windows 98, Windows Me (the Windows 95 family)
<li>Microsoft Windows NT, Windows 2000, Windows XP (the Windows NT family)
<li>Mac OS X 10.2 or higher
<li>Unix
<ul>
<li>X Windows version 11 revision 4 or up
<li>XTEST extension<br>
(use "<span class="code">xdpyinfo | grep XTEST</span>" to check for XTEST)
</ul>
</ul>
All systems must support TCP/IP networking.
</p><p>
"Unix" includes Linux, Solaris, Irix and other variants. Synergy has
only been extensively tested on Linux and may not work completely or
at all on other versions of Unix. Patches are welcome (including
patches that package binaries) at the
<a target="_top" href="http://sourceforge.net/tracker/?group_id=59275&atid=490469">patches page</a>.
</p><p>
The Mac OS X port is incomplete. It does not synchronize the screen saver,
only text clipboard data works (i.e. HTML and bitmap data do not work),
the cursor won't hide when not on the screen, and there may be problems
with mouse wheel acceleration. Other problems should be
<a target="_top" href="http://sourceforge.net/tracker/?func=add&group_id=59275&atid=490467">filed as bugs</a>.
</p>
</body>
</html>

BIN
doc/images/logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
doc/images/warp.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

33
doc/index.html Normal file
View File

@ -0,0 +1,33 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<meta name="keywords" content="Virtual Screen, Open Source, Software" />
<meta name="description" content="Mouse and Keyboard Sharing" />
<link rel="stylesheet" type="text/css" href="synergy.css" media="screen" />
<title>Synergy</title>
</head>
<script language="JavaScript">
<!--
pageName = (location.search ? location.search.substring(1) + location.hash : "home.html");
document.write('<frameset rows="77,2,*" frameborder="no" framespacing="0" border="0">');
document.write('<frame name="banner" noresize="yes" marginwidth="0" marginheight="0" scrolling="no" src="banner.html">');
document.write('<frame name="border" noresize="yes" marginwidth="0" marginheight="0" scrolling="no" src="border.html">');
document.write('<frameset cols="120,*">');
document.write('<frame name="toc" noresize="yes" marginwidth="0" marginheight="0" scrolling="no" src="toc.html">');
document.write('<frame name="page" noresize="yes" marginwidth="0" marginheight="0" scrolling="yes" src="' + pageName + '">');
document.write('</frameset>');
document.write('</frameset>');
//-->
</script>
<noscript>
<frameset rows="77,2,*" frameborder="no" framespacing="0" border="0">
<frame name="banner" noresize="yes" marginwidth="0" marginheight="0" scrolling="no" src="banner.html">
<frame name="border" noresize="yes" marginwidth="0" marginheight="0" scrolling="no" src="border.html">
<frameset cols="120,*">
<frame name="toc" noresize="yes" marginwidth="0" marginheight="0" scrolling="no" src="toc.html">
<frame name="page" noresize="yes" marginwidth="0" marginheight="0" scrolling="yes" src="home.html">
</frameset>
</frameset>
</noscript>
</html>

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