| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> | 
|---|
| 2 | <html> | 
|---|
| 3 | <head> | 
|---|
| 4 | <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1"> | 
|---|
| 5 | <meta name="keywords" content="Virtual Screen, Open Source, Software" /> | 
|---|
| 6 | <meta name="description" content="Mouse and Keyboard Sharing" /> | 
|---|
| 7 | <link rel="stylesheet" type="text/css" href="synergy.css" media="screen" /> | 
|---|
| 8 | <title>Synergy Developer Documentation</title> | 
|---|
| 9 | </head> | 
|---|
| 10 | <body class="main"> | 
|---|
| 11 | <p> | 
|---|
| 12 | Synergy is reasonably well commented so reading the source code | 
|---|
| 13 | should be enough to understand particular pieces.  See the | 
|---|
| 14 | <span class="code">doc/PORTING</span> | 
|---|
| 15 | file in the synergy source code for more high-level information. | 
|---|
| 16 | </p><p> | 
|---|
| 17 | </p><h4>How it works</h4><p> | 
|---|
| 18 | </p><p> | 
|---|
| 19 | The theory behind synergy is simple:  the server captures mouse, | 
|---|
| 20 | keyboard, clipboard, and screen saver events and forwards them to | 
|---|
| 21 | one or more clients.  If input is directed to the server itself | 
|---|
| 22 | then the input is delivered normally.  In practice, however, many | 
|---|
| 23 | complications arise. | 
|---|
| 24 | </p><p> | 
|---|
| 25 | First, different keyboard mappings can produce different characters. | 
|---|
| 26 | Synergy attempts to generate the same character on the client as | 
|---|
| 27 | would've been generated on the server, including appropriate modifier | 
|---|
| 28 | keys (like Control and Alt).  Non-character keys like Shift are also | 
|---|
| 29 | synthesized if possible.  Sometimes the client simply cannot create | 
|---|
| 30 | the character or doesn't have a corresponding non-character key and | 
|---|
| 31 | synergy must discard the event.  Note that synergy won't necessarily | 
|---|
| 32 | synthesize an event for the corresponding key on the client's | 
|---|
| 33 | keyboard.  For example, if the client or server can't distinguish | 
|---|
| 34 | between the left and right shift keys then synergy can't be certain | 
|---|
| 35 | to synthesize the shift on the same side of the keyboard as the user | 
|---|
| 36 | pressed. | 
|---|
| 37 | </p><p> | 
|---|
| 38 | Second, different systems have different clipboards and clipboard | 
|---|
| 39 | formats.  The X window system has a system-wide selection and | 
|---|
| 40 | clipboard (and yet other buffers) while Microsoft Windows has only | 
|---|
| 41 | a system-wide clipboard.  Synergy has to choose which of these | 
|---|
| 42 | buffers correspond to one another.  Furthermore, different systems | 
|---|
| 43 | use different text encodings and line breaks.  Synergy mediates and | 
|---|
| 44 | converts between them. | 
|---|
| 45 | </p><p> | 
|---|
| 46 | Finally, there are no standards across operating systems for some | 
|---|
| 47 | operations that synergy requires.  Among these are:  intercepting | 
|---|
| 48 | and synthesizing events;  enabling, disabling, starting and stopping | 
|---|
| 49 | the screen saver;  detecting when the screen saver starts;  reading | 
|---|
| 50 | and writing the clipboard(s). | 
|---|
| 51 | </p><p> | 
|---|
| 52 | All this means that synergy must be customized to each operating | 
|---|
| 53 | system (or windowing system in the case of X windows).  Synergy | 
|---|
| 54 | breaks platform differences into two groups.  The first includes | 
|---|
| 55 | the mundane platform dependent things:  file system stuff, | 
|---|
| 56 | multithreading, network I/O, multi-byte and wide character | 
|---|
| 57 | conversion, time and sleeping, message display and logging, and | 
|---|
| 58 | running a process detached from a terminal.  This code lives in | 
|---|
| 59 | <span class="code">lib/arch</span>. | 
|---|
| 60 | </p><p> | 
|---|
| 61 | The second includes screen and window management handling, user | 
|---|
| 62 | event handling, event synthesis, the clipboards, and the screen | 
|---|
| 63 | saver.  This code lives in <span class="code">lib/platform</span>. | 
|---|
| 64 | </p><p> | 
|---|
| 65 | For both groups, there are particular classes or interfaces that | 
|---|
| 66 | must be inherited and implemented for each platform.  See the | 
|---|
| 67 | <span class="code">doc/PORTING</span> file in the synergy source | 
|---|
| 68 | code for more information. | 
|---|
| 69 | </p><p> | 
|---|
| 70 | </p><h4>Auto-generated Documentation</h4><p> | 
|---|
| 71 | </p><p> | 
|---|
| 72 | Synergy can automatically generate documentation from the comments | 
|---|
| 73 | in the code using <a target="_top" href="http://www.doxygen.org/">doxygen</a>. | 
|---|
| 74 | Use <span class="command">make doxygen</span> to build it yourself | 
|---|
| 75 | from the source code into the <span class="code">doc/doxygen/html</span> | 
|---|
| 76 | directory. | 
|---|
| 77 | </p> | 
|---|
| 78 | </p> | 
|---|
| 79 | </body> | 
|---|
| 80 |  | 
|---|
| 81 | </html> | 
|---|