mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-24 06:15:57 +03:00
64232c7854
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.
615 lines
20 KiB
Plaintext
615 lines
20 KiB
Plaintext
server client
|
|
------ ------
|
|
[accept] <-- connect
|
|
challenge --> [encrypt]
|
|
[verify] <-- response (encrypted challenge, client name)
|
|
hangup if invalid
|
|
query info -->
|
|
<-- info (size)
|
|
|
|
---
|
|
nedit doesn't seem to be playing nice with the motif clipboard lock
|
|
it's not releasing it
|
|
may need to learn more about how the motif clipboard lock works
|
|
not sure if this a new problem with synergy or a problem with new nedit
|
|
|
|
---
|
|
enable heartbeat disconnection or remove heartbeat sending in client
|
|
should either ship with it fully enabled or fully disabled
|
|
possibly make it part of startup negotiation
|
|
|
|
---
|
|
getting a stuttering when leaving win32 server screen
|
|
|
|
---
|
|
merge platform dependent code into platform independent where possible
|
|
also try to simplify where possible
|
|
|
|
---
|
|
IServer and IPrimaryReceiver are really similar
|
|
can we merge them into one?
|
|
|
|
---
|
|
use automake
|
|
use doxygen
|
|
|
|
---
|
|
HTTP stuff
|
|
no way to save config using HTTP
|
|
should have a button or a page to force save of config
|
|
or just save config every time it's changed
|
|
should use authentication (at least basic)
|
|
provide way to kill/restart server via HTTP
|
|
provide way to query why locked to screen?
|
|
handy for debugging at least
|
|
|
|
---
|
|
negotiation:
|
|
use a generic negotiation message (name/value pair) or specific
|
|
messages (name/values)? later allows more parsing to be done by
|
|
CProtocolUtil but how can we skip unknown messages? would have
|
|
to have a method on CInputPacketStream to discard to end of
|
|
message and we'd need to know the stream is a CInputPacketStream.
|
|
|
|
how does negotiation proceed?
|
|
could have sequence of queries and replies:
|
|
server -> client -> server ... end
|
|
client -> server -> client ... end
|
|
or a sequence of messages:
|
|
server -> client ... end
|
|
client -> server ... end
|
|
probably go with latter because it's more efficient but make it
|
|
3-way:
|
|
client -> server ... end
|
|
server -> client ... end
|
|
client -> server ... end
|
|
first messages from client must be version and name. the server
|
|
can create the appropriate protocol object right away then.
|
|
|
|
example: clipboard formats:
|
|
# CNEG = negotiation command CNEG%s%s
|
|
# CNGE = end of negotiation command
|
|
# cbfa = clipboard, format, add (permitted format)
|
|
# cbia = clipboard, id, add (clipboard with id exists)
|
|
client -> server: CNEG "vers" "1.0"
|
|
client -> server: CNEG "name" "foobar"
|
|
client -> server: CNGE
|
|
server -> client: CNEG "cbfa" "text/plain/LF"
|
|
server -> client: CNEG "cbfa" "image/BMP"
|
|
server -> client: CNGE
|
|
client -> server: CNEG "cbia" "0"
|
|
client -> server: CNGE
|
|
|
|
server should just ask CProtocol (renamed from CServerProtocol) to
|
|
return a protocol. CProtocol should do negotiation, create the
|
|
appropriate protocol object, finish negotiation, and return the
|
|
new protocol object. unless connection is registered with server,
|
|
though, we can't save any screen info. perhaps CProtocol should
|
|
also return a screen info object or that should be part of the
|
|
protocol object (currently the protocol is part of the screen info).
|
|
if screen info is available to CProtocol then it should finish with
|
|
requesting the screen info, waiting for and then handling the reply.
|
|
the server can then just ask CProtocol for the protocol object then
|
|
add it to the connections.
|
|
|
|
maybe call the protocol types CClientProxy since that's how the
|
|
server uses it: as a stand-in for the client object. the interface
|
|
should closely reflect the CClient interface. do the reverse for
|
|
a server proxy for the client. maybe even have interface classes
|
|
for the client and server methods.
|
|
|
|
---
|
|
should add clipboard data type format negotiation
|
|
server sends permitted data type formats
|
|
client responds with known formats in permitted list
|
|
client must only send permitted formats
|
|
server can discard non-permitted formats
|
|
server must only send known, permitted formats to client
|
|
formats are names of the form [a-zA-Z0-9_/]+
|
|
server must be able to translate between all permitted formats
|
|
example: text formats:
|
|
text/plain/CRLF -- windows plain text
|
|
text/plain/LF -- unix plain text
|
|
text/plain/CR -- mac plain text
|
|
text/rtf -- rich text (does that require a particular newline?)
|
|
or image formats:
|
|
image/BMP
|
|
image/RAW
|
|
image/XPM
|
|
|
|
this will allow future versions to interoperate better. it also
|
|
allows compatibility with versions that are identical except for
|
|
the support clipboard formats, obviating bumping up the protocol
|
|
version number.
|
|
|
|
maybe config file can list format shared libraries to load. user
|
|
can then pick formats to support. but why would you ever want
|
|
fewer formats?
|
|
|
|
should the major burden of translation be on client or server?
|
|
probably client since it knows the formats preferred by the
|
|
platform and may be able to use platform utilities to convert.
|
|
server would then just support formats that minimize loss of
|
|
information.
|
|
|
|
desired formats to support:
|
|
text (LF)
|
|
text with character set
|
|
unicode (LF)
|
|
rich text (or some kind of formatting)
|
|
bitmap (BMP, PNG?)
|
|
sound (WAV)
|
|
|
|
note that formats should be added to the win32 clipboard in the
|
|
order of most descriptive to least because they're kept in order
|
|
and apps will generally use the first suitable match.
|
|
|
|
---
|
|
hot keys
|
|
should have keyboard shortcuts to jump to screens
|
|
|
|
---
|
|
win32:
|
|
need icon
|
|
provide taskbar icon
|
|
provide control panel?
|
|
|
|
win32 dll:
|
|
should make this as small as possible
|
|
don't use standard libraries
|
|
use custom _DllMainCRTStartup(); just call DllMain() from it.
|
|
use /MERGE linker switch to merge sections
|
|
|
|
win32 service:
|
|
need message table for proper event reporting
|
|
|
|
clean up c:\winnt\synergy.sgc
|
|
|
|
desktop switcher program failure when running synergy as service
|
|
returns access denied from CreateDesktop()
|
|
don't know why
|
|
|
|
---
|
|
bug with half-duplex keys
|
|
win32 server sent num-lock to grace
|
|
grace converts to half-duplex so only synthesizes key down
|
|
now grace starts server and is locked to screen
|
|
grace should ignore half duplex keys when seeing if locked to screen
|
|
|
|
---
|
|
bug in updating screens
|
|
saw a goofy set of screens after update
|
|
i think the config was similar to:
|
|
A B
|
|
C
|
|
D E
|
|
|
|
---
|
|
should switch to user nobody (or something similar) if running as root
|
|
for security reasons
|
|
will make it impossible to overwrite /etc/synergy.conf
|
|
if that file is only root writable (as it should be)
|
|
|
|
---
|
|
Xsetup file may have to kill previous synergy
|
|
or synergy should exit if there's already a synergy running
|
|
|
|
---
|
|
not handling international characters
|
|
|
|
---
|
|
xscreensaver won't start if pointer on secondary screen
|
|
unless using MIT or SGI screen saver extensions
|
|
otherwise it cannot know when to stop the screen saver
|
|
cos it can't grab mouse and keyboard
|
|
|
|
---
|
|
all screensavers hidden when showing win32 screensaver lock window
|
|
win32 kills the screen saver and shows the lock window
|
|
synergy thinks the screen saver is dead (cos the process is)
|
|
deactivates secondary screen screen savers
|
|
user is constrained to locked display, though
|
|
also, we don't detect screen saver restarting if user doesn't unlock screen
|
|
|
|
---
|
|
not distinguishing between caps lock and shift lock
|
|
In Caps Lock mode, the alphabetic keys send their uppercase (shifted) char-
|
|
acter when pressed alone. For Caps Lock mode, pressing and releasing the
|
|
lock key turns on the mode and pressing and releasing the lock key again
|
|
turns off the mode. In Shift Lock mode, all keys on the main keypad send
|
|
their shifted character when pressed alone. For Shift Lock mode, pressing
|
|
and releasing the Lock key turns on the mode, and pressing and releasing
|
|
either the Lock or the Shift key turns off the mode.
|
|
|
|
---
|
|
currently sending all clipboards to all clients
|
|
some clients may not need all clipboards
|
|
add filtering mechanism
|
|
setup is probably part of clipboard (format) negotiation
|
|
|
|
---
|
|
not handling large motif selections
|
|
there must be a limit because properties can only be so big
|
|
don't know protocol for transfer, though
|
|
|
|
---
|
|
need timeout on CXWindowsClipboard::CReply objects
|
|
should flush replies that are too old
|
|
assumption is that requestor is broken
|
|
|
|
---
|
|
inconsistencies
|
|
exceptions
|
|
using getWhat() in some places to return a code, elsewhere returns message
|
|
references/pointers
|
|
should use pointers for any in/out parameter
|
|
but using references in some places
|
|
|
|
---
|
|
avoid fullscreen transparent window on win32
|
|
using CBT hook to discard activation/focus messages
|
|
but it's not being called when we lose keyboard input
|
|
also, we sometimes don't get the keyboard input to start with
|
|
|
|
---
|
|
keyboard hook problems (win32)
|
|
now passing keyboard events through in most cases
|
|
this fixes problem on isabel where toggle lights don't toggle
|
|
and num-lock behaved incorrectly (generated wrong keys).
|
|
seems the DefWindowProc() needed to process the keys
|
|
unfortunately, keys sometimes leak into wrong app. seems related
|
|
to times when we don't get the keyboard input. key events are
|
|
not delivered to app on primary until cursor returns to primary.
|
|
no idea how that's possible.
|
|
current have some code to check active window and reset it in
|
|
keyboard hook. that code doesn't work.
|
|
seem to be having problems with windows key now, too. looks like
|
|
a down is sent but not the corresponding up so secondary system
|
|
thinks the key is always down.
|
|
|
|
---
|
|
try to determine X11 keyboard quirks automatically
|
|
in particular, set the half-duplex flags
|
|
maybe KBD extension will help determine this
|
|
|
|
---
|
|
key events sent to console on win me (95/98?) are very slow
|
|
1/4 to 1/2 second delay before key up is processed
|
|
key up log message is also delayed
|
|
console causing a system-wide delay?
|
|
|
|
---
|
|
adjust thread priorities on win32
|
|
maybe remove changes altogether
|
|
currently isabel starts single-stepping mouse when dragging window
|
|
sometimes it goes normal speed but it's mostly very slow
|
|
even a very high priority doesn't seem to help
|
|
haven't tried real-time priority
|
|
a very high priority on client fixes delay when typeing into console
|
|
is it the output console causing the slowness?
|
|
mouse motion compression seems to handle slow dragging on grace
|
|
pretty sure nothing else was wrong on grace
|
|
maybe same problem and solution on win32
|
|
|
|
---
|
|
results:
|
|
X primary
|
|
ctrl+alt+keypad_add, ctrl+alt_keypad_minus -> eaten by primary X server
|
|
ctrl+alt+backspace probably eaten by primary X server if so configured
|
|
ctrl+alt+delete probably eaten locally
|
|
probably underneath primary X server too
|
|
Win32 desktop -> X laptop
|
|
eaten global hot keys:
|
|
ctrl+alt+delete -> task manager (or logon or reboot)
|
|
alt+[shift+]tab -> cycle through tasks
|
|
alt+[shift+]esc -> cycle windows
|
|
ctrl+esc -> start menu
|
|
windows+R -> run dialog
|
|
windows+M -> minimize all
|
|
windows+shift+M -> undo minimize all
|
|
windows+F1 -> help
|
|
windows+E -> explorer
|
|
windows+F -> find files
|
|
windows+ctrl+F -> find computer
|
|
windows+tab -> cycle through taskbar buttons
|
|
windows+break -> system properties
|
|
not eaten:
|
|
alt+space -> system menu
|
|
shift+F10 -> context menu
|
|
app key -> context menu
|
|
misc:
|
|
accessibility shortcuts: not eaten but dialogs appear anyway
|
|
X laptop -> Win32 desktop
|
|
check:
|
|
shift+tab -> okay
|
|
alt+[shift+]tab -> okay
|
|
alt+[shift+]esc -> okay
|
|
ctrl+esc -> start menu -> okay
|
|
ctrl+esc, esc, shift+F10 -> toolbar context menu -> okay
|
|
F10 -> activate menu in explorer -> okay
|
|
shift+F10 -> context menu -> okay
|
|
alt+space -> context menu -> okay
|
|
alt+hyphen -> MDI window menu -> okay
|
|
alt+letter -> open corresponding menu -> okay
|
|
alt+F6 -> switch between windows in single program -> okay
|
|
shift+insert CD-ROM -> bypass auto-run
|
|
check accessibility shortcuts -> does not work
|
|
check accessibility features
|
|
sticky keys -> no
|
|
filter keys -> no
|
|
toggle keys -> no
|
|
mouse keys -> no
|
|
high contrast -> no
|
|
X desktop -> win32
|
|
check:
|
|
shift+tab
|
|
windows+R -> run dialog
|
|
windows+M -> minimize all
|
|
windows+shift+M -> minimize all
|
|
windows+F1 -> help
|
|
windows+E -> explorer
|
|
windows+F -> find files
|
|
windows+ctrl+F -> find computer
|
|
windows+tab -> cycle through taskbar buttons
|
|
windows+break -> system properties
|
|
app key -> context menu
|
|
Win32 -> Win32
|
|
alt+F6 -> eaten (isabel to audrey, but not audrey to isabel)
|
|
check accessibility shortcuts work on secondary
|
|
check accessibility features work on secondary
|
|
|
|
---
|
|
Accessibility Shortcuts
|
|
|
|
Key Result
|
|
-------------------------------------------------------------------
|
|
Tap SHIFT 5 times Toggles StickyKeys on and off.
|
|
|
|
Press down and hold the right Toggles FilterKeys on and off.
|
|
SHIFT key for 8 seconds
|
|
|
|
Press down and hold the NUM LOCK Toggles ToggleKeys on and off.
|
|
key for 5 seconds
|
|
|
|
Left ALT+left SHIFT+NUM LOCK Toggles MouseKeys on and off.
|
|
|
|
Left ALT+left SHIFT+PRINT SCREEN Toggles High Contrast on and off.
|
|
|
|
---
|
|
disable ctrl+alt+del info:
|
|
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &dummy, 0)
|
|
fools system into thinking screen saver is running
|
|
that disables ctrl+alt+del, alt+tab, ctrl+esc
|
|
dunno if keystrokes are queued
|
|
may be limited to win 95/98/me
|
|
win nt sp 3 and above:
|
|
low-level keyboard hook is called before ctrl+esc, alt+tab, alt+esc
|
|
use that to capture and disable
|
|
seems that low-level hook is notified of ctrl+alt+del but can't stop it
|
|
win nt sp 2 and below
|
|
ctrl+esc can be disabled by replacing task manager (dunno how)
|
|
RegisterHotKey() can be used to catch alt+tab and alt+esc
|
|
only while app is running, of course
|
|
win nt
|
|
keyboard filter driver can capture keys (see win NT DDK)
|
|
http://216.239.51.100/search?q=cache:q-f03UHhFMMC:www.thescarms.com/VBasic/StopReBoot.asp+alt%2Btab+disable&hl=en
|
|
some info on changing keyboard scan code mapping
|
|
can be used to disable keys but looks like reboot is required
|
|
|
|
---
|
|
Q179905
|
|
suggestion for bypassing hook code when called by debugger.
|
|
may prevent system from getting locked up when debugging.
|
|
|
|
---
|
|
win32 rel notes:
|
|
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\NoInteractiveServices
|
|
can prevent an interactive service from running interactively.
|
|
how can we tell if we're not running interactively?
|
|
even if not interactive we can use MessageBox() to alert user
|
|
use MB_SERVICE_NOTIFICATION flag
|
|
must use a separate thread in initialization if called from handler
|
|
must close dialog if CTRL_LOGOFF_EVENT is received
|
|
see SetConsoleCtrlHandler() and CLog (which uses it)
|
|
maybe possible to get around NoInteractiveServices
|
|
modify DACLs on windows station/desktops to impersonate logged on user
|
|
see "Interacting with the User by a Win32 Service"
|
|
|
|
---
|
|
unix release notes:
|
|
restarting fails to connect until a user logs in:
|
|
Xlib: no protocol specified
|
|
this is caused by login manager
|
|
all clients are rejected, except those started by manager itself
|
|
workaround is to have synergy started by login manager
|
|
should then use --no-restart, though that's not necessary
|
|
affects client and server
|
|
cannot switch screens on login screen:
|
|
xdm,kdm grab keyboard for duration of login screen
|
|
synergy cannot switch unless it can grab keyboard
|
|
gdm doesn't appear to grab keyboard or mouse for duration
|
|
affects server, only
|
|
|
|
=== feedback ===
|
|
send all toggle states instead of (individual) toggle ups/downs (gspencer)
|
|
Actually, Teleffect already does that too, but what I meant was that
|
|
each time the state of a "toggle" key (caps lock, scroll lock, num lock)
|
|
changes on the master, I think it should force the client to take on
|
|
that state, instead of just toggling on the client. That way when Word
|
|
(on the client) helpfullly turns off the caps lock, it doesn't get
|
|
toggled back on when I turn off the caps lock on the master. Ideally,
|
|
it would just notice that Word turned off the caps lock on the client
|
|
and turn it off on the master (and all other clients) too, but I think
|
|
that's probably too complicated to implement.
|
|
|
|
double clicking NT binaries fails (liz)
|
|
add note to README or use separate binaries for services. client
|
|
would also need a dialog to query options. server would probably
|
|
need one too. use dialogs if there are no command line args.
|
|
|
|
how to exit (liz)
|
|
no good way to exit on windows
|
|
|
|
win32 console disappears too quickly (liz)
|
|
maybe show a message box if exiting to due an error
|
|
|
|
better support for reloading configuration (liz)
|
|
use SIGHUP on unix
|
|
use an app message on win32
|
|
provide access through a control panel or taskbar icon
|
|
|
|
non-functional on ctrl+alt+del screen in win2k (kurt)
|
|
i suppose it must be when win2k is the client. mouse input wasn't
|
|
working. keyboard probably didn't work either.
|
|
|
|
gspencer:
|
|
OK, I've narrowed it down a little -- it seems to happen if you have any
|
|
key down (I tried the shift key and the letter 's' key) when you cross
|
|
over from master to client, which would make me suspect the "capture"
|
|
code, since if you have a key down you aren't supposed to be able to
|
|
cross over...
|
|
|
|
gspencer:
|
|
bouncy mouse at edge of screen (win32 server). almost certainly
|
|
related to changes that fixed mouse delta calculation.
|
|
|
|
|
|
== fixed? ===
|
|
dragging windows is too slow
|
|
grace (as client) exhibits this
|
|
dunno if it happens with audrey2 as the client
|
|
liz says her windows laptop does it too
|
|
also closing/iconifying has a delay
|
|
dragging multiple files also sluggish
|
|
|
|
liz seems to still be seeing sluggish cursor updates
|
|
|
|
---
|
|
automake stuff
|
|
rebuild:
|
|
* 'autoheader' - creates config.h.in
|
|
* 'touch NEWS README AUTHORS ChangeLog'
|
|
* 'touch stamp-h'
|
|
* aclocal - adds aclocal.m4 to directory. Defines some m4 macros used by the auto tools.
|
|
* 'autoconf '- creates configure from configure.in
|
|
* 'automake' - Creates Makefile.in from Makefile.am
|
|
* './configure' - creates Makefile from Makefile.in
|
|
* 'make'
|
|
|
|
funky functions:
|
|
snprintf -- ick!
|
|
some return negative value -- no problem
|
|
some return truncated length -- uh oh
|
|
some return buffer length without truncation -- huh?
|
|
some actually overrun the buffer -- must not build on those!
|
|
|
|
use AC_LIBOBJ(function) for missing/broken functions
|
|
adds function.c to build
|
|
must add @LIBOBJS@ to *_LIBADD
|
|
or AC_REPLACE_FUNCS(function ...)
|
|
automatically calls AC_LIBOBJ for missing functions
|
|
use AC_CHECK_FUNC or AC_CHECK_FUNCS to detect missing functions
|
|
use AC_CHECK_LIB first if function not in std C lib
|
|
|
|
maybe AC_CHECK_TYPE for size_t and ssize_t
|
|
|
|
replace sys/time.h with:
|
|
#if TIME_WITH_SYS_TIME
|
|
# include <sys/time.h>
|
|
# include <time.h>
|
|
#else
|
|
# if HAVE_SYS_TIME_H
|
|
# include <sys/time.h>
|
|
# else
|
|
# include <time.h>
|
|
# endif
|
|
#endif
|
|
|
|
what does `make install' do?
|
|
|
|
check in derived files?
|
|
aclocal.m4
|
|
config.h.in
|
|
configure
|
|
|
|
used library functions:
|
|
accept
|
|
bind
|
|
chdir
|
|
close
|
|
connect
|
|
dup
|
|
fork
|
|
fprintf
|
|
getenv
|
|
gethostbyaddr
|
|
gethostbyname
|
|
gethostname
|
|
getpeername
|
|
getprotobyname
|
|
getprotobynumber
|
|
getservbyname
|
|
getservbyport
|
|
getsockname
|
|
getsockopt
|
|
gettimeofday
|
|
inet_addr
|
|
inet_ntoa
|
|
ioctl
|
|
listen
|
|
memcpy
|
|
memmove
|
|
memset
|
|
nanosleep
|
|
open
|
|
openlog
|
|
poll
|
|
read
|
|
recv
|
|
recvfrom
|
|
send
|
|
sendto
|
|
setsid
|
|
setsockopt
|
|
shutdown
|
|
sigaction
|
|
sigaddset
|
|
sigemptyset
|
|
socket
|
|
sprintf
|
|
strcat
|
|
strcmp
|
|
strerror
|
|
strrchr
|
|
syslog
|
|
umask
|
|
vsnprintf
|
|
write
|
|
|
|
included files
|
|
#include <arpa/inet.h>
|
|
#include <fcntl.h>
|
|
#include <pthread.h>
|
|
#include <pwd.h>
|
|
#include <shlobj.h>
|
|
#include <signal.h>
|
|
#include <sys/ioctl.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/time.h>
|
|
#include <sys/types.h>
|
|
#include <sys/wait.h>
|
|
#include <syslog.h>
|
|
#include <unistd.h>
|
|
these put stuff in std::. replace with .h versions or use std::?
|
|
3 #include <cctype>
|
|
3 #include <cerrno>
|
|
1 #include <clocale>
|
|
3 #include <cstdio>
|
|
4 #include <cstdlib>
|
|
12 #include <cstring>
|
|
1 #include <ctime>
|
|
|
|
can we use AC_REPLACE_FUNCS and only build the missing function files
|
|
in a single directory. do we have to have a separate configure.in
|
|
script to do that?
|