Commit Graph

57 Commits

Author SHA1 Message Date
crs fee4095624 Reorganized source tree. Moved client.cpp into cmd/synergy as
synergy.cpp and server.cpp into cmd/synergyd as synergyd.cpp.
Moved and renamed related files.  Moved remaining source files
into lib/....  Modified and added makefiles as appropriate.
Result is that library files are under lib with each library
in its own directory and program files are under cmd with each
command in its own directory.
2002-07-30 16:52:46 +00:00
crs 9792d35a6b Replaced method name `run' with `mainLoop', and `stop' and `quit'
with `exitMainLoop' in most places.
2002-07-30 15:17:44 +00:00
crs c6ecc79c0d removed restart function from platform. no longer trying to
restart if the X server connection was lost;  since synergy
is likely to be started by xdm or the user's xsession, it's
better for synergy to simply terminate when the connection
is lost.  synergy will still restart due to other errors.
also fixed numerous other minor bugs and cleaned some stuff
up (like app error codes are now consistent and enumerated
in Version.h, for lack of a better place).  and boosted
version and protocol numbers.
2002-07-24 13:01:18 +00:00
crs 635c3d1c62 now cancelling and waiting for the accept client thread before
cancelling any other threads.  this prevents a race condition
where we disconnect a client but it reconnects before we
manage to shutdown.  that might leave a thread running and
the connection won't be closed down properly.
2002-07-18 17:00:48 +00:00
crs 7c391a0f35 moved onError() method to IScreenReceiver from IPrimaryScreenReceiver.
also implemented onError in CClient which previously did not have
any way to handle display disconnection.
2002-07-16 16:52:26 +00:00
crs 4b46862026 checkpoint. refactored win32 code. had to edit and rename some
files so this is only a checkpoint.
2002-07-15 15:01:36 +00:00
crs f48a5fe387 checkpoint. still refactoring. merged common code from primary
screens into CPrimaryScreen and merged common code from secondary
screens into CSecondaryScreen.  changed is-a relationship to a
has-a between the primary and secondary screen classes and the
generic platform dependent screen class to avoid multiple
inheritance of implementation.  also standardized the interface
for those generic screen classes.  adding a platform now involves
implementing simpler interfaces:  IScreen for the generic screen,
IScreenEventHandler and some methods of CPrimaryScreen for the
primary screen, and IScreenEventHandler and some methods of
CSecondaryScreen for the secondary screen.  did X11 platform
but not win32 platform.
2002-07-13 22:00:38 +00:00
crs feeb15a08d applied refactoring to win32 code. 2002-07-11 13:13:37 +00:00
crs 710e1bdd47 refactored client code. it now uses IClient and IServer and
has a CServerProxy, making it's design similar to the server
code.
2002-07-10 20:18:32 +00:00
crs f90076938b removed IPrimaryReceiver in favor of IServer, which required a few
minor changes to support IPrimaryReciever's functionality.  this
does mean that the IPrimaryScreen class will be calling some
methods with dummy arguments.  those are documented in
CPrimaryClient.
2002-07-10 14:15:17 +00:00
crs 64232c7854 updated to new automake and refactored server stuff. the server
now speaks to the primary screen and secondary screens almost
everywhere the same way through an IClient interface;  only
special primary screen calls are accessed through a different
interface, the CPrimaryClient interface.  this simplifies the
server since it no longer needs to test whether the active screen
is the primary or a secondary in most cases.

the server no longer speaks directly to the primary screen;  all
that goes through the CPrimaryClient, which often just forwards
the call.  the primary screen no longer speaks directly to the
server either, again going through the CPrimaryClient via a
IPrimaryReceiver interface.

CServerProtocol classes have been replaced by CClientProxy
classes which are very similar.  the name makes more sense
though.
2002-07-09 21:22:31 +00:00
crs ed8ed72f26 synergy hook DLL will now restart itself if a client tries to
init() it while it's already running.  fixed an uninitialized
pointer bug in CServer and some cleanup-on-error code in
CMSWindowsPrimaryScreen.  also added timeout to read() on
IInputStream and a heartbeat sent by clients so the server
can disconnect clients that are dead but never reset the TCP
connection.  previously the server would keep these dead
clients around forever and if the user was locked on the
client screen for some reason then the server would have to
be rebooted (or the server would have to be killed via a
remote login).
2002-06-26 16:31:48 +00:00
crs 1377882a9f fixed handling of jumping to primary when screen saver starts
and back to secondary when it stops.  also now redirecting
keyboard input to root window when screen saver starts;  this
allows the user to type in the lock dialog and also effectively
discards any input used to deactivate the screen saver.
2002-06-23 23:24:22 +00:00
crs a5391a0a1d checkpoint screensaver changes. now handling xscreensaver
dying and restarting or starting after synergy does.  also
now disabling the screen saver on the client.  next step:
win32 support.
2002-06-23 15:43:40 +00:00
crs 504bfa2def checkpoint. adding screen saver support. only on X so far
and untested.  also some known problems:  not detecting an
xscreensaver started after us and not detecting built-in
screen saver activation (not sure if we can without using
ugly extensions).
2002-06-22 19:20:21 +00:00
crs ede18cb7f3 cleaned up some minor bugs. 2002-06-21 17:55:47 +00:00
crs e2ee2371e0 some cleanup. also fixed a race condition when adding threads
to the thread list:  the child thread would add itself to the
list which means there could be a time interval in the parent
where the child thread exists but isn't on the list.  the
parent now does the adding and removing.
2002-06-21 15:18:01 +00:00
crs bebb63ac53 checkpoint. initial support for multiple displays on win32. 2002-06-19 17:03:29 +00:00
crs 9c7e863d77 checkpoint. more conversion to automake. 2002-06-19 11:23:49 +00:00
crs fe16546a1d formatting changes. 2002-06-17 13:31:21 +00:00
crs 57fb87ad10 refactored ISocket into IDataSocket. the latter and IListenSocket
now derive from ISocket.
2002-06-17 12:02:26 +00:00
crs 88490de5a2 fixed bug with switching screens on primary when there's no
link in that direction (it would assert).  introduced bug
when adding support for wrapping.  now ignores attempts to
move in a direction with no link.
2002-06-11 18:31:06 +00:00
crs 62519b19fe indentation and other formatting changes. also cleaned up
#includes.
2002-06-10 22:06:45 +00:00
crs 172fc7e5b3 now allowing a screen to be its own neighbor to allow wrapping.
also no longer warping mouse to 0,0 when setting server screen
info.  that was causing the mouse to jump if the server screen
had itself as its left or top neighbor (directly or indirectly)
once a screen could be its own neighbor.
2002-06-10 10:08:36 +00:00
crs 7ca4804667 added command line option to choose the screen name. also now
using the hostname as the default name.  this is on both client
and server.
2002-06-09 17:59:32 +00:00
crs 255e46017e fixed problem with setConfig(). if the new config didn't
include a screen that was already connected under an alias
then that screen wouldn't be disconnected and removed from
the screen list until the screen voluntarily disconnected.
at that time removeConnection() would assert because the
screen name would not be found.  now using the canonical
name in the protocol object as well as CServer.  this
allows setConfig() to always detect removed screens and
disconnect them.
2002-06-09 17:21:33 +00:00
crs 555aa19eb2 added command line and configuration file arguments to choose
the address and port to listen on or connect to.  changed the
default port and put it in ProtocolTypes.h.  the HTTP port is
now no longer opened unless the --http argument is supplied
or the config file includes it.
2002-06-09 16:53:25 +00:00
crs 8b2a282eb5 added aliases to configuration. an alias is another name for
a screen.  it's expected that the server will want to accept
a given client under several names (e.g. the hostname and the
FQDN).
2002-06-08 23:24:40 +00:00
crs 4b28ffc5b2 win32 changes. changed names of binaries. added support for
running as (and installing/installing) a service.  added
support for multiple desktops (NT only, 95 doesn't support
multiple desktops).
2002-06-08 21:48:00 +00:00
crs c3649df304 added command line parsing, restartability, and daemonizing to
client.  broke win32 stuff though.  also moved version and
copyright constants into a new file and renamed protocol
version constants.
2002-06-04 11:06:26 +00:00
crs beda89fd53 changes to add command line arguments. also added automatic
restarting and daemonizing on unix.  daemon sends log messages
to syslog.  unix now reads config file from file named on
command line;  if no command line arg then uses effective
user's config file and if that's not there it finally tries
/etc/synergy.conf.  if there are no screens configured then
one is added for the primary screen.  broke some startup
stuff on win32.

also now timing out if X primary screen can't grab the mouse
and keyboard.  the server will just give up trying to switch
screens.  the grabs will fail is some other app has a grab
and won't release it.  note that kdm grabs the keyboard for
the duration that the login window is displayed, effectively
disabling synergy.
2002-06-03 18:53:18 +00:00
crs 1cbdaee31b added better handling of X server disconnecting unexpectedly.
the apps still exit but they do it in a mostly controlled
manner.  in particular, the server threads except the one
processing primary screen events will terminate gracefully.
this will be important should the server ever allow HTTP
clients to rewrite the configuration file.

note that X makes it effectively impossible to continue once
the X server disconnects.  even if it didn't it would be
difficult for synergy to recover.  users will have to add
synergy to the X display manager's startup script if they
expect the server to be restarted.  alternatively, we could
add code to fork synergy at startup;  the child would do
the normal work while the parent would simply wait for the
child to exit and restart it.
2002-06-03 13:45:30 +00:00
crs 1d3807cb0e added SIGINT and SIGTERM handling to unix client and server.
either signal causes the main thread to be cancelled.  added
necessary code to make main thread cancellation clean up
nicely.
2002-06-02 18:49:35 +00:00
crs fa4d24216f now limiting number of simultaneous HTTP requests being handled
at once.  this is to prevent denial of service.
2002-06-02 11:49:46 +00:00
crs d2135af0d9 fixes, mainly for windows. first, had to add a notification from
CServer to the primary screen when the configuration changes so it
can make necessary adjustments (the win32 primary screen must tell
the hook dll about the new jump zones).

changed includes of some std c++ library files to go through
our own include files.  these wrap the include with stuff to
keep vc++ quiet when compiling at warning level 4, which is
what it does now.  it also works around missing <istream> and
<ostream> on g++2.96.

added missing std:: where necessary.  g++ doesn't really support
namespaces so it lets references without the namespace slip
through.

added workaround or fix.  not sure if istringstream::str(string)
should reset eofbit.  it does on g++ but does not on vc++.
added clear() after str() so it works either way.

added low-level keyboard hook to win32.  if available (it's only
available on NT SP3 and up) it allows us to catch and handle
alt+tab, alt+esc, ctrl+esc, and windows key hot keys.  i think
that leaves only ctrl+alt+del and accessibility functions
uncaught on those systems.
2002-06-01 19:26:11 +00:00
crs 1ac62a9533 added mutex to all public methods that didn't already have it.
fixed two blown assertions.  first, if user tried to switch to
a client that had connected but hadn't yet sent the first info
message it would assert on the zero size screen.  second, if
the primary screen was handling a mouse motion on behalf of a
secondary screen when that secondary screen disconnected then
an assert would blow because the primary screen would call
onMouseMoveSecondary() but m_protocol on the active screen is
NULL because disconnecting the active secondary screen caused
the mouse to jump to the primary screen.
2002-06-01 10:52:02 +00:00
crs 793c968f00 server now rejects clients that are not in the configuration.
added a protocol message to indicate this.
2002-05-31 18:18:29 +00:00
crs 1e8a5d7fa9 fixed setConfig() to disconnect secondary screens that aren't
in the new configuration.
2002-05-31 18:09:43 +00:00
crs 67b149d3a4 checkpoint. changed CScreenMap to CConfig. must still change
CScreenMap.cpp to CConfig.cpp.
2002-05-31 14:43:23 +00:00
crs 70f5f9491d added basic support for an embedded HTTP server. server
currently supports editing the screen map but changing
the map won't behave correctly if there are connected
screens.
2002-05-30 16:13:16 +00:00
crs 5fc87baa0f added screen locking support to win32. added support for
resolution changing (only semi-supported on X because that
has no means for resizing screen anyway).  also fixed some
clipboard problems on win32.
2002-05-24 17:54:28 +00:00
crs 34c587e864 added support for locking to a screen when the sroll lock is
toggled on or when any key or button is pressed.  fully
implemented on X but stubbed out for now on win32.
2002-05-24 14:37:12 +00:00
crs 9ce7a2757a fixed log message. 2002-05-23 15:00:13 +00:00
crs 13eee14232 server no longer asserts when a client connects with a name that's
already in use by another client.  also added reporting of errors
from the server to clients so clients can report meaningful
messages to users.
2002-05-23 14:56:03 +00:00
crs f052d126c0 Added more checks to avoid sending unchanged clipboard data.
Still takes too long to query the clipboard owner for info
(maybe 1/10th second) but not sure why or if that can be
improved.
2002-05-01 16:17:57 +00:00
crs 59c5e4bf13 Fixed uninitialized variable when computing toggle mask. Also
reduced priority of some mouse motion log messages.
2002-05-01 14:36:52 +00:00
crs b279c80608 checkpoint. now sending toggle modifier state when entering
a screen.  this allows the secondary screen to set it's
modifier state to match the primary screen's state.  this is
not strictly necessary since each keystroke should adjust the
modifier state as needed to get the right result.
2002-04-30 17:48:11 +00:00
crs ea6b347b18 Indentation changes. 2002-04-29 14:40:01 +00:00
crs 3ca72b35f3 Added some validation of protocol message parameters. 2002-04-29 14:25:24 +00:00
crs 6a9a180688 Made event selection a little more robust. Also fixed failure
to marshall clipboard data when updating primary clipboards.
2002-04-29 14:08:48 +00:00