barrier/doc/developer.html

82 lines
3.7 KiB
HTML
Raw Normal View History

<!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>