added win32 launcher program. also changed VC++ dsp and dsw

files to binary form so \r\n aren't converted.  added icons
to client and server apps on win32.
This commit is contained in:
crs 2002-08-11 11:49:36 +00:00
parent 3d41e1c7fd
commit 435bb738e6
38 changed files with 4463 additions and 2603 deletions

View File

@ -16,6 +16,7 @@ DEPTH = ..
VDEPTH = ./$(VPATH)/$(DEPTH) VDEPTH = ./$(VPATH)/$(DEPTH)
SUBDIRS = \ SUBDIRS = \
launcher \
synergy \ synergy \
synergyd \ synergyd \
$(NULL) $(NULL)

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

@ -0,0 +1,28 @@
# 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 =
DEPTH = ../..
VDEPTH = ./$(VPATH)/$(DEPTH)
EXTRA_DIST = \
launcher.cpp \
launcher.dsp \
launcher.rc \
resource.h \
synergy.ico \
$(NULL)
MAINTAINERCLEANFILES = \
Makefile.in \
$(NULL)

1183
cmd/launcher/launcher.cpp Normal file

File diff suppressed because it is too large Load Diff

122
cmd/launcher/launcher.dsp Normal file
View File

@ -0,0 +1,122 @@
# Microsoft Developer Studio Project File - Name="launcher" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=launcher - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "launcher.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "launcher.mak" CFG="launcher - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "launcher - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "launcher - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "launcher - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\..\lib\base" /I "..\..\lib\mt" /I "..\..\lib\io" /I "..\..\lib\http" /I "..\..\lib\net" /I "..\..\lib\synergy" /I "..\..\lib\platform" /I "..\..\lib\server" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"../../Release/synergy.exe"
# SUBTRACT LINK32 /map
!ELSEIF "$(CFG)" == "launcher - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\..\lib\base" /I "..\..\lib\mt" /I "..\..\lib\io" /I "..\..\lib\http" /I "..\..\lib\net" /I "..\..\lib\synergy" /I "..\..\lib\platform" /I "..\..\lib\server" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../Debug/synergy.exe" /pdbtype:sept
!ENDIF
# Begin Target
# Name "launcher - Win32 Release"
# Name "launcher - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\launcher.cpp
# End Source File
# Begin Source File
SOURCE=.\launcher.rc
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\resource.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\synergy.ico
# End Source File
# End Group
# End Target
# End Project

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

@ -0,0 +1,218 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#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 ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_MAIN DIALOG DISCARDABLE 32768, 0, 300, 241
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Synergy"
CLASS "GoSynergy"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Choose to start either the Client or Server and 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,31
GROUPBOX "",IDC_STATIC,7,67,286,103
GROUPBOX "Advanced Options",IDC_STATIC,7,177,286,34
CONTROL "Client",IDC_MAIN_CLIENT_RADIO,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,11,29,33,10
CONTROL "Server",IDC_MAIN_SERVER_RADIO,"Button",
BS_AUTORADIOBUTTON,11,67,37,10
LTEXT "Server Host Name:",IDC_MAIN_CLIENT_SERVER_NAME_LABEL,12,
41,61,8
EDITTEXT IDC_MAIN_CLIENT_SERVER_NAME_EDIT,79,39,106,12,
ES_AUTOHSCROLL
LTEXT "Screens:",IDC_MAIN_SERVER_SCREENS_LABEL,12,79,29,8
LISTBOX IDC_MAIN_SERVER_SCREENS_LIST,12,91,106,36,
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Add",IDC_MAIN_SERVER_ADD_BUTTON,12,132,50,14
PUSHBUTTON "Edit",IDC_MAIN_SERVER_EDIT_BUTTON,68,132,50,14
PUSHBUTTON "Remove",IDC_MAIN_SERVER_REMOVE_BUTTON,12,150,50,14
LTEXT "Layout:",IDC_MAIN_SERVER_LAYOUT_LABEL,138,79,24,8
LTEXT "Left:",IDC_MAIN_SERVER_LEFT_LABEL,144,93,15,8
COMBOBOX IDC_MAIN_SERVER_LEFT_COMBO,175,91,118,46,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Right:",IDC_MAIN_SERVER_RIGHT_LABEL,144,109,20,8
COMBOBOX IDC_MAIN_SERVER_RIGHT_COMBO,175,107,118,46,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Above:",IDC_MAIN_SERVER_TOP_LABEL,144,125,24,8
COMBOBOX IDC_MAIN_SERVER_TOP_COMBO,175,123,118,46,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Below:",IDC_MAIN_SERVER_BOTTOM_LABEL,144,141,22,8
COMBOBOX IDC_MAIN_SERVER_BOTTOM_COMBO,175,139,118,46,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Screen Name:",IDC_STATIC,12,192,46,8
EDITTEXT IDC_MAIN_ADVANCED_NAME_EDIT,64,190,106,12,ES_AUTOHSCROLL
LTEXT "Port:",IDC_STATIC,194,192,16,8
EDITTEXT IDC_MAIN_ADVANCED_PORT_EDIT,216,190,40,12,ES_AUTOHSCROLL |
ES_NUMBER
DEFPUSHBUTTON "Test",IDC_MAIN_TEST,75,220,50,14
PUSHBUTTON "Start",IDOK,131,220,50,14
PUSHBUTTON "No Auto-Start",IDC_MAIN_UNINSTALL,187,220,50,14
PUSHBUTTON "Quit",IDCANCEL,243,220,50,14
END
IDD_ADD DIALOG DISCARDABLE 0, 0, 172, 95
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,59,7,106,12,ES_AUTOHSCROLL
LTEXT "Aliases:",IDC_STATIC,7,25,25,8
EDITTEXT IDC_ADD_ALIASES_EDIT,59,26,106,40,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
DEFPUSHBUTTON "OK",IDOK,59,74,50,14
PUSHBUTTON "Cancel",IDCANCEL,115,74,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
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_MAIN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 293
TOPMARGIN, 7
BOTTOMMARGIN, 234
END
IDD_ADD, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 165
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
IDD_WAIT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 47
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 to terminate it."
IDS_INSTALL_FAILED "Failed to install synergy auto-starter. Synergy will not be started now and it will not automatically start each time you start or reboot your computer."
IDS_UNINSTALL_TITLE "Removed Auto-Start"
IDS_UNINSTALLED "Removed auto-start. Synergy will not automatically start each time you start or reboot your computer."
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_UNINSTALL_FAILED "Failed to remove auto-start of %{1}. You might not have permission to remove it or it might be in use.\n\nOn Windows NT, 2000, or XP you should open the Services control panel and stop the synergy %{1} service then try again."
IDS_CLIENT "client"
IDS_SERVER "server"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

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

@ -0,0 +1,62 @@
//{{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 IDD_MAIN 101
#define IDD_ADD 102
#define IDD_WAIT 103
#define IDI_SYNERGY 104
#define IDC_MAIN_CLIENT_RADIO 1000
#define IDC_MAIN_SERVER_RADIO 1001
#define IDC_MAIN_CLIENT_SERVER_NAME_EDIT 1002
#define IDC_MAIN_ADVANCED_NAME_EDIT 1006
#define IDC_MAIN_ADVANCED_PORT_EDIT 1008
#define IDC_MAIN_TEST 1009
#define IDC_MAIN_CLIENT_SERVER_NAME_LABEL 1011
#define IDC_MAIN_SERVER_SCREENS_LIST 1012
#define IDC_MAIN_SERVER_SCREENS_LABEL 1013
#define IDC_MAIN_SERVER_LAYOUT_LABEL 1014
#define IDC_MAIN_SERVER_ADD_BUTTON 1018
#define IDC_MAIN_SERVER_EDIT_BUTTON 1019
#define IDC_ADD_SCREEN_NAME_EDIT 1020
#define IDC_MAIN_SERVER_REMOVE_BUTTON 1020
#define IDC_ADD_ALIASES_EDIT 1021
#define IDC_MAIN_SERVER_LEFT_COMBO 1022
#define IDC_MAIN_SERVER_RIGHT_COMBO 1023
#define IDC_MAIN_SERVER_TOP_COMBO 1024
#define IDC_MAIN_SERVER_BOTTOM_COMBO 1025
#define IDC_MAIN_SERVER_LEFT_LABEL 1026
#define IDC_MAIN_SERVER_RIGHT_LABEL 1027
#define IDC_MAIN_SERVER_TOP_LABEL 1028
#define IDC_MAIN_SERVER_BOTTOM_LABEL 1029
#define IDC_MAIN_UNINSTALL 1030
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1031
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

BIN
cmd/launcher/synergy.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -16,9 +16,10 @@ DEPTH = ../..
VDEPTH = ./$(VPATH)/$(DEPTH) VDEPTH = ./$(VPATH)/$(DEPTH)
EXTRA_DIST = \ EXTRA_DIST = \
synergy.dsp \
synergy.rc \
resource.h \ resource.h \
synergy.dsp \
synergy.ico \
synergy.rc \
$(NULL) $(NULL)
MAINTAINERCLEANFILES = \ MAINTAINERCLEANFILES = \

View File

@ -1,29 +1,17 @@
/*
* 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.
*/
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by client.rc // Used by synergy.rc
// //
#define IDS_FAILED 1
#define IDD_SYNERGY 101 #define IDD_SYNERGY 101
#define IDI_SYNERGY 103
#define IDC_LOG 1000 #define IDC_LOG 1000
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102 #define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101

View File

@ -33,6 +33,7 @@
#if WINDOWS_LIKE #if WINDOWS_LIKE
#include "CMSWindowsSecondaryScreen.h" #include "CMSWindowsSecondaryScreen.h"
#include "resource.h"
#elif UNIX_LIKE #elif UNIX_LIKE
#include "CXWindowsSecondaryScreen.h" #include "CXWindowsSecondaryScreen.h"
#endif #endif
@ -49,6 +50,7 @@
// //
static const char* pname = NULL; static const char* pname = NULL;
static bool s_backend = false;
static bool s_restartable = true; static bool s_restartable = true;
static bool s_daemon = true; static bool s_daemon = true;
static bool s_camp = true; static bool s_camp = true;
@ -117,104 +119,103 @@ realMain(CMutex* mutex)
{ {
// caller should have mutex locked on entry // caller should have mutex locked on entry
// initialize threading library
CThread::init();
// make logging thread safe
CMutex logMutex;
s_logMutex = &logMutex;
CLog::setLock(&logLock);
int result = kExitSuccess; int result = kExitSuccess;
do { do {
bool opened = false;
bool locked = true;
try { try {
// initialize threading library // create client
CThread::init(); s_client = new CClient(s_name);
s_client->camp(s_camp);
s_client->setAddress(s_serverAddress);
s_client->setScreenFactory(new CSecondaryScreenFactory);
s_client->setSocketFactory(new CTCPSocketFactory);
s_client->setStreamFilterFactory(NULL);
// make logging thread safe // open client
CMutex logMutex;
s_logMutex = &logMutex;
CLog::setLock(&logLock);
bool opened = false;
bool locked = true;
try { try {
// create client s_client->open();
s_client = new CClient(s_name); opened = true;
s_client->camp(s_camp);
s_client->setAddress(s_serverAddress);
s_client->setScreenFactory(new CSecondaryScreenFactory);
s_client->setSocketFactory(new CTCPSocketFactory);
s_client->setStreamFilterFactory(NULL);
// open client // run client
try { if (mutex != NULL) {
s_client->open(); mutex->unlock();
opened = true;
// run client
if (mutex != NULL) {
mutex->unlock();
}
locked = false;
s_client->mainLoop();
locked = true;
if (mutex != NULL) {
mutex->lock();
}
// clean up
s_client->close();
// get client status
if (s_client->wasRejected()) {
// try again later. we don't want to bother
// the server very often if it doesn't want us.
throw XScreenUnavailable(60.0);
}
} }
catch (XScreenUnavailable& e) { locked = false;
// wait a few seconds before retrying s_client->mainLoop();
if (s_restartable) { locked = true;
CThread::sleep(e.getRetryTime());
}
else {
result = kExitFailed;
}
}
catch (...) {
// rethrow thread exceptions
RETHROW_XTHREAD
// don't try to restart and fail // get client status
s_restartable = false; if (s_client->wasRejected()) {
result = kExitFailed; // try again later. we don't want to bother
// the server very often if it doesn't want us.
throw XScreenUnavailable(60.0);
} }
// clean up // clean up
delete s_client; #define FINALLY do { \
s_client = NULL; if (!locked && mutex != NULL) { \
CLog::setLock(NULL); mutex->lock(); \
s_logMutex = NULL; } \
if (s_client != NULL) { \
if (opened) { \
s_client->close(); \
} \
} \
delete s_client; \
s_client = NULL; \
} while (false)
FINALLY;
} }
catch (...) { catch (XScreenUnavailable& e) {
// clean up // wait before retrying if we're going to retry
if (!locked && mutex != NULL) { if (s_restartable) {
mutex->lock(); CThread::sleep(e.getRetryTime());
} }
if (s_client != NULL) { else {
if (opened) { result = kExitFailed;
s_client->close();
}
delete s_client;
s_client = NULL;
} }
CLog::setLock(NULL); FINALLY;
s_logMutex = NULL; }
catch (XThread&) {
FINALLY;
throw; throw;
} }
catch (...) {
// don't try to restart and fail
s_restartable = false;
result = kExitFailed;
FINALLY;
}
#undef FINALLY
} }
catch (XBase& e) { catch (XBase& e) {
log((CLOG_CRIT "failed: %s", e.what())); log((CLOG_CRIT "failed: %s", e.what()));
} }
catch (XThread&) { catch (XThread&) {
// terminated // terminated
return kExitTerminated; s_restartable = false;
result = kExitTerminated;
}
catch (...) {
CLog::setLock(NULL);
s_logMutex = NULL;
throw;
} }
} while (s_restartable); } while (s_restartable);
// clean up
CLog::setLock(NULL);
s_logMutex = NULL;
return result; return result;
} }
@ -382,6 +383,10 @@ parse(int argc, const char** argv)
s_restartable = true; s_restartable = true;
} }
else if (isArg(i, argc, argv, "-z", NULL)) {
s_backend = true;
}
else if (isArg(i, argc, argv, "-h", "--help")) { else if (isArg(i, argc, argv, "-h", "--help")) {
help(); help();
bye(kExitSuccess); bye(kExitSuccess);
@ -463,7 +468,7 @@ parse(int argc, const char** argv)
catch (XSocketAddress& e) { catch (XSocketAddress& e) {
log((CLOG_PRINT "%s: %s" BYE, log((CLOG_PRINT "%s: %s" BYE,
pname, e.what(), pname)); pname, e.what(), pname));
bye(kExitArgs); bye(kExitFailed);
} }
} }
@ -500,10 +505,18 @@ parse(int argc, const char** argv)
#include "CMSWindowsScreen.h" #include "CMSWindowsScreen.h"
static bool s_errors = false;
static static
bool bool
logMessageBox(int priority, const char* msg) logMessageBox(int priority, const char* msg)
{ {
if (priority <= CLog::kERROR) {
s_errors = true;
}
if (s_backend) {
return true;
}
if (priority <= CLog::kFATAL) { if (priority <= CLog::kFATAL) {
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING); MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
return true; return true;
@ -639,7 +652,8 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
case IPlatform::kAlready: case IPlatform::kAlready:
log((CLOG_CRIT "service isn't installed")); log((CLOG_CRIT "service isn't installed"));
return kExitFailed; // return success since service is uninstalled
return kExitSuccess;
} }
} }
@ -654,7 +668,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
result = platform.daemonize(DAEMON_NAME, &daemonStartup95); result = platform.daemonize(DAEMON_NAME, &daemonStartup95);
if (result == -1) { if (result == -1) {
log((CLOG_CRIT "failed to start as a service" BYE, pname)); log((CLOG_CRIT "failed to start as a service" BYE, pname));
return kExitFailed; result = kExitFailed;
} }
} }
else { else {
@ -670,6 +684,15 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
CNetwork::cleanup(); CNetwork::cleanup();
// if running as a non-daemon backend and there was an error then
// wait for the user to click okay so he can see the error messages.
if (s_backend && !s_daemon && (result == kExitFailed || s_errors)) {
char msg[1024];
msg[0] = '\0';
LoadString(instance, IDS_FAILED, msg, sizeof(msg) / sizeof(msg[0]));
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
}
return result; return result;
} }

View File

@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"../../Release/synergyc.exe"
!ELSEIF "$(CFG)" == "synergy - Win32 Debug" !ELSEIF "$(CFG)" == "synergy - Win32 Debug"
@ -81,7 +81,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../Debug/synergyc.exe" /pdbtype:sept
!ENDIF !ENDIF
@ -112,6 +112,10 @@ SOURCE=.\resource.h
# Begin Group "Resource Files" # Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\synergy.ico
# End Source File
# End Group # End Group
# End Target # End Target
# End Project # End Project

BIN
cmd/synergy/synergy.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -80,6 +80,26 @@ BEGIN
END END
#endif // APSTUDIO_INVOKED #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_FAILED "Synergy is about to quit with an error. Please check the log for error messages then click OK."
END
#endif // English (U.S.) resources #endif // English (U.S.) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -16,9 +16,10 @@ DEPTH = ../..
VDEPTH = ./$(VPATH)/$(DEPTH) VDEPTH = ./$(VPATH)/$(DEPTH)
EXTRA_DIST = \ EXTRA_DIST = \
resource.h \
synergy.ico \
synergyd.dsp \ synergyd.dsp \
synergyd.rc \ synergyd.rc \
resource.h \
$(NULL) $(NULL)
MAINTAINERCLEANFILES = \ MAINTAINERCLEANFILES = \

View File

@ -1,31 +1,19 @@
/*
* 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.
*/
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by server.rc // Used by synergyd.rc
// //
#define IDS_FAILED 1
#define IDD_SYNERGY 101 #define IDD_SYNERGY 101
#define IDI_SYNERGY 102
#define IDC_LOG 1000 #define IDC_LOG 1000
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102 #define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

BIN
cmd/synergyd/synergy.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -32,6 +32,7 @@
#if WINDOWS_LIKE #if WINDOWS_LIKE
#include "CMSWindowsPrimaryScreen.h" #include "CMSWindowsPrimaryScreen.h"
#include "resource.h"
#elif UNIX_LIKE #elif UNIX_LIKE
#include "CXWindowsPrimaryScreen.h" #include "CXWindowsPrimaryScreen.h"
#endif #endif
@ -55,6 +56,7 @@
// //
static const char* pname = NULL; static const char* pname = NULL;
static bool s_backend = false;
static bool s_restartable = true; static bool s_restartable = true;
static bool s_daemon = true; static bool s_daemon = true;
#if WINDOWS_LIKE #if WINDOWS_LIKE
@ -128,117 +130,116 @@ realMain(CMutex* mutex)
{ {
// caller should have mutex locked on entry // caller should have mutex locked on entry
// initialize threading library
CThread::init();
// make logging thread safe
CMutex logMutex;
s_logMutex = &logMutex;
CLog::setLock(&logLock);
int result = kExitSuccess; int result = kExitSuccess;
do { do {
bool opened = false;
bool locked = true;
try { try {
// initialize threading library // if configuration has no screens then add this system
CThread::init(); // as the default
if (s_config.begin() == s_config.end()) {
// make logging thread safe s_config.addScreen(s_name);
CMutex logMutex;
s_logMutex = &logMutex;
CLog::setLock(&logLock);
bool opened = false;
bool locked = true;
try {
// if configuration has no screens then add this system
// as the default
if (s_config.begin() == s_config.end()) {
s_config.addScreen(s_name);
}
// set the contact address, if provided, in the config.
// otherwise, if the config doesn't have an address, use
// the default.
if (s_synergyAddress.isValid()) {
s_config.setSynergyAddress(s_synergyAddress);
}
else if (!s_config.getSynergyAddress().isValid()) {
s_config.setSynergyAddress(CNetworkAddress(kDefaultPort));
}
// set HTTP address if provided
if (s_httpAddress.isValid()) {
s_config.setHTTPAddress(s_httpAddress);
}
// create server
s_server = new CServer(s_name);
s_server->setConfig(s_config);
s_server->setScreenFactory(new CPrimaryScreenFactory);
s_server->setSocketFactory(new CTCPSocketFactory);
s_server->setStreamFilterFactory(NULL);
// open server
try {
s_server->open();
opened = true;
// run server (unlocked)
if (mutex != NULL) {
mutex->unlock();
}
locked = false;
s_server->mainLoop();
locked = true;
if (mutex != NULL) {
mutex->lock();
}
// clean up
s_server->close();
}
catch (XScreenUnavailable& e) {
// wait before retrying if we're going to retry
if (s_restartable) {
CThread::sleep(e.getRetryTime());
}
else {
result = kExitFailed;
}
}
catch (...) {
// rethrow thread exceptions
RETHROW_XTHREAD
// don't try to restart and fail
s_restartable = false;
result = kExitFailed;
}
// clean up
delete s_server;
s_server = NULL;
CLog::setLock(NULL);
s_logMutex = NULL;
} }
catch (...) {
// set the contact address, if provided, in the config.
// otherwise, if the config doesn't have an address, use
// the default.
if (s_synergyAddress.isValid()) {
s_config.setSynergyAddress(s_synergyAddress);
}
else if (!s_config.getSynergyAddress().isValid()) {
s_config.setSynergyAddress(CNetworkAddress(kDefaultPort));
}
// set HTTP address if provided
if (s_httpAddress.isValid()) {
s_config.setHTTPAddress(s_httpAddress);
}
// create server
s_server = new CServer(s_name);
s_server->setConfig(s_config);
s_server->setScreenFactory(new CPrimaryScreenFactory);
s_server->setSocketFactory(new CTCPSocketFactory);
s_server->setStreamFilterFactory(NULL);
// open server
try {
s_server->open();
opened = true;
// run server (unlocked)
if (mutex != NULL) {
mutex->unlock();
}
locked = false;
s_server->mainLoop();
locked = true;
// clean up // clean up
if (!locked && mutex != NULL) { #define FINALLY do { \
mutex->lock(); if (!locked && mutex != NULL) { \
mutex->lock(); \
} \
if (s_server != NULL) { \
if (opened) { \
s_server->close(); \
} \
} \
delete s_server; \
s_server = NULL; \
} while (false)
FINALLY;
}
catch (XScreenUnavailable& e) {
// wait before retrying if we're going to retry
if (s_restartable) {
CThread::sleep(e.getRetryTime());
} }
if (s_server != NULL) { else {
if (opened) { result = kExitFailed;
s_server->close();
}
delete s_server;
s_server = NULL;
} }
CLog::setLock(NULL); FINALLY;
s_logMutex = NULL; }
catch (XThread&) {
FINALLY;
throw; throw;
} }
catch (...) {
// don't try to restart and fail
s_restartable = false;
result = kExitFailed;
FINALLY;
}
#undef FINALLY
} }
catch (XBase& e) { catch (XBase& e) {
log((CLOG_CRIT "failed: %s", e.what())); log((CLOG_CRIT "failed: %s", e.what()));
} }
catch (XThread&) { catch (XThread&) {
// terminated // terminated
return kExitTerminated; s_restartable = false;
result = kExitTerminated;
}
catch (...) {
CLog::setLock(NULL);
s_logMutex = NULL;
throw;
} }
} while (s_restartable); } while (s_restartable);
// clean up
CLog::setLock(NULL);
s_logMutex = NULL;
return result; return result;
} }
@ -448,6 +449,10 @@ parse(int argc, const char** argv)
s_restartable = true; s_restartable = true;
} }
else if (isArg(i, argc, argv, "-z", NULL)) {
s_backend = true;
}
else if (isArg(i, argc, argv, "-h", "--help")) { else if (isArg(i, argc, argv, "-h", "--help")) {
help(); help();
bye(kExitSuccess); bye(kExitSuccess);
@ -605,10 +610,18 @@ loadConfig()
#include "CMSWindowsScreen.h" #include "CMSWindowsScreen.h"
static bool s_errors = false;
static static
bool bool
logMessageBox(int priority, const char* msg) logMessageBox(int priority, const char* msg)
{ {
if (priority <= CLog::kERROR) {
s_errors = true;
}
if (s_backend) {
return true;
}
if (priority <= CLog::kFATAL) { if (priority <= CLog::kFATAL) {
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING); MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
return true; return true;
@ -751,7 +764,8 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
case IPlatform::kAlready: case IPlatform::kAlready:
log((CLOG_CRIT "service isn't installed")); log((CLOG_CRIT "service isn't installed"));
return kExitFailed; // return success since service is uninstalled
return kExitSuccess;
} }
} }
@ -769,7 +783,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
result = platform.daemonize(DAEMON_NAME, &daemonStartup95); result = platform.daemonize(DAEMON_NAME, &daemonStartup95);
if (result == -1) { if (result == -1) {
log((CLOG_CRIT "failed to start as a service" BYE, pname)); log((CLOG_CRIT "failed to start as a service" BYE, pname));
return kExitFailed; result = kExitFailed;
} }
} }
else { else {
@ -785,6 +799,15 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
CNetwork::cleanup(); CNetwork::cleanup();
// if running as a non-daemon backend and there was an error then
// wait for the user to click okay so he can see the error messages.
if (s_backend && !s_daemon && (result == kExitFailed || s_errors)) {
char msg[1024];
msg[0] = '\0';
LoadString(instance, IDS_FAILED, msg, sizeof(msg) / sizeof(msg[0]));
MessageBox(NULL, msg, pname, MB_OK | MB_ICONWARNING);
}
return result; return result;
} }

View File

@ -112,6 +112,10 @@ SOURCE=.\resource.h
# Begin Group "Resource Files" # Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\synergy.ico
# End Source File
# End Group # End Group
# End Target # End Target
# End Project # End Project

View File

@ -57,8 +57,9 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Synergy" CAPTION "Synergy"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
EDITTEXT IDC_LOG,7,7,517,145,ES_MULTILINE | ES_AUTOHSCROLL | LISTBOX IDC_LOG,7,7,517,145,NOT LBS_NOTIFY |
ES_READONLY | WS_VSCROLL | WS_HSCROLL LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
WS_TABSTOP
END END
@ -80,6 +81,26 @@ BEGIN
END END
#endif // APSTUDIO_INVOKED #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_FAILED "Synergy is about to quit with an error. Please check the log for error messages then click OK."
END
#endif // English (U.S.) resources #endif // English (U.S.) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -90,6 +90,7 @@ lib/platform/Makefile
lib/client/Makefile lib/client/Makefile
lib/server/Makefile lib/server/Makefile
cmd/Makefile cmd/Makefile
cmd/launcher/Makefile
cmd/synergy/Makefile cmd/synergy/Makefile
cmd/synergyd/Makefile cmd/synergyd/Makefile
dist/Makefile dist/Makefile
@ -97,4 +98,3 @@ dist/rpm/Makefile
dist/rpm/synergy.spec dist/rpm/synergy.spec
doc/doxygen.cfg doc/doxygen.cfg
]) ])

View File

@ -91,8 +91,9 @@ CStringUtil::vformat(const char* fmt, va_list args)
length.push_back(1); length.push_back(1);
for (int i = 0; i < maxIndex; ++i) { for (int i = 0; i < maxIndex; ++i) {
const char* arg = va_arg(args, const char*); const char* arg = va_arg(args, const char*);
size_t len = strlen(arg);
value.push_back(arg); value.push_back(arg);
length.push_back(strlen(arg)); length.push_back(len);
} }
// compute final length // compute final length

View File

@ -19,13 +19,13 @@
// set version macro if not set yet // set version macro if not set yet
#if !defined(VERSION) #if !defined(VERSION)
# define VERSION "1.0.0" # define VERSION "0.9.8"
#endif #endif
// important strings // important strings
static const char* kCopyright = "Copyright (C) 2002 Chris Schoeneman"; static const char* kCopyright = "Copyright (C) 2002 Chris Schoeneman";
static const char* kContact = "Chris Schoeneman, crs23@bigfoot.com"; static const char* kContact = "Chris Schoeneman, crs23@bigfoot.com";
static const char* kWebsite = ""; static const char* kWebsite = "http://synergy2.sourceforge.net/";
// build version. follows linux kernel style: an even minor number implies // build version. follows linux kernel style: an even minor number implies
// a release version, odd implies development version. // a release version, odd implies development version.

View File

@ -195,6 +195,10 @@ SOURCE=.\TMethodJob.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\Version.h
# End Source File
# Begin Source File
SOURCE=.\XBase.h SOURCE=.\XBase.h
# End Source File # End Source File
# End Group # End Group

View File

@ -349,7 +349,7 @@ CMSWindowsScreen::syncDesktop()
// change calling thread's desktop // change calling thread's desktop
if (!m_is95Family) { if (!m_is95Family) {
if (SetThreadDesktop(m_desk) == 0) { if (SetThreadDesktop(m_desk) == 0) {
log((CLOG_WARN "failed to set desktop: %d", GetLastError())); // log((CLOG_WARN "failed to set desktop: %d", GetLastError()));
} }
} }

View File

@ -49,6 +49,57 @@ CConfig::addScreen(const CString& name)
return true; return true;
} }
bool
CConfig::renameScreen(const CString& oldName,
const CString& newName)
{
// get canonical name and find cell
CString oldCanonical = getCanonicalName(oldName);
CCellMap::iterator index = m_map.find(oldCanonical);
if (index == m_map.end()) {
return false;
}
// accept if names are equal but replace with new name to maintain
// case. otherwise, the new name must not exist.
if (!CStringUtil::CaselessCmp::equal(oldName, newName) &&
m_nameToCanonicalName.find(newName) != m_nameToCanonicalName.end()) {
return false;
}
// update cell
CCell tmpCell = index->second;
m_map.erase(index);
m_map.insert(std::make_pair(newName, tmpCell));
// update name
m_nameToCanonicalName.erase(oldCanonical);
m_nameToCanonicalName.insert(std::make_pair(newName, newName));
// update connections
for (index = m_map.begin(); index != m_map.end(); ++index) {
for (UInt32 i = 0; i <= kLastDirection - kFirstDirection; ++i) {
if (CStringUtil::CaselessCmp::equal(getCanonicalName(
index->second.m_neighbor[i]), oldCanonical)) {
index->second.m_neighbor[i] = newName;
}
}
}
// update alias targets
if (CStringUtil::CaselessCmp::equal(oldName, oldCanonical)) {
for (CNameMap::iterator index = m_nameToCanonicalName.begin();
index != m_nameToCanonicalName.end(); ++index) {
if (CStringUtil::CaselessCmp::equal(
index->second, oldCanonical)) {
index->second = newName;
}
}
}
return true;
}
void void
CConfig::removeScreen(const CString& name) CConfig::removeScreen(const CString& name)
{ {
@ -65,10 +116,11 @@ CConfig::removeScreen(const CString& name)
// disconnect // disconnect
for (index = m_map.begin(); index != m_map.end(); ++index) { for (index = m_map.begin(); index != m_map.end(); ++index) {
CCell& cell = index->second; CCell& cell = index->second;
for (SInt32 i = 0; i <= kLastDirection - kFirstDirection; ++i) for (UInt32 i = 0; i <= kLastDirection - kFirstDirection; ++i) {
if (getCanonicalName(cell.m_neighbor[i]) == canonical) { if (getCanonicalName(cell.m_neighbor[i]) == canonical) {
cell.m_neighbor[i].erase(); cell.m_neighbor[i].erase();
} }
}
} }
// remove aliases (and canonical name) // remove aliases (and canonical name)
@ -99,7 +151,7 @@ CConfig::addAlias(const CString& canonical, const CString& alias)
} }
// canonical name must be known // canonical name must be known
if (m_nameToCanonicalName.find(canonical) == m_nameToCanonicalName.end()) { if (m_map.find(canonical) == m_map.end()) {
return false; return false;
} }
@ -245,6 +297,18 @@ CConfig::end() const
return const_iterator(m_map.end()); return const_iterator(m_map.end());
} }
CConfig::all_const_iterator
CConfig::beginAll() const
{
return m_nameToCanonicalName.begin();
}
CConfig::all_const_iterator
CConfig::endAll() const
{
return m_nameToCanonicalName.end();
}
bool bool
CConfig::isScreen(const CString& name) const CConfig::isScreen(const CString& name) const
{ {
@ -295,6 +359,54 @@ CConfig::getHTTPAddress() const
return m_httpAddress; return m_httpAddress;
} }
bool
CConfig::operator==(const CConfig& x) const
{
/* FIXME -- no compare available for CNetworkAddress
if (m_synergyAddress != x.m_synergyAddress) {
return false;
}
if (m_httpAddress != x.m_httpAddress) {
return false;
}
*/
if (m_map.size() != x.m_map.size()) {
return false;
}
if (m_nameToCanonicalName.size() != x.m_nameToCanonicalName.size()) {
return false;
}
for (CCellMap::const_iterator index1 = m_map.begin(),
index2 = x.m_map.begin();
index1 != m_map.end(); ++index1, ++index2) {
for (UInt32 i = 0; i <= kLastDirection - kFirstDirection; ++i) {
if (!CStringUtil::CaselessCmp::equal(index1->second.m_neighbor[i],
index2->second.m_neighbor[i])) {
return false;
}
}
}
for (CNameMap::const_iterator index1 = m_nameToCanonicalName.begin(),
index2 = x.m_nameToCanonicalName.begin();
index1 != m_nameToCanonicalName.end();
++index1, ++index2) {
if (!CStringUtil::CaselessCmp::equal(index1->first, index2->first) ||
!CStringUtil::CaselessCmp::equal(index1->second, index2->second)) {
return false;
}
}
return true;
}
bool
CConfig::operator!=(const CConfig& x) const
{
return !operator==(x);
}
const char* const char*
CConfig::dirName(EDirection dir) CConfig::dirName(EDirection dir)
{ {
@ -663,7 +775,9 @@ operator<<(std::ostream& s, const CConfig& config)
// aliases section (if there are any) // aliases section (if there are any)
if (config.m_map.size() != config.m_nameToCanonicalName.size()) { if (config.m_map.size() != config.m_nameToCanonicalName.size()) {
// map canonical to alias // map canonical to alias
CConfig::CNameMap aliases; typedef std::multimap<CString, CString,
CStringUtil::CaselessCmp> CMNameMap;
CMNameMap aliases;
for (CConfig::CNameMap::const_iterator for (CConfig::CNameMap::const_iterator
index = config.m_nameToCanonicalName.begin(); index = config.m_nameToCanonicalName.begin();
index != config.m_nameToCanonicalName.end(); index != config.m_nameToCanonicalName.end();
@ -676,11 +790,11 @@ operator<<(std::ostream& s, const CConfig& config)
// dump it // dump it
CString screen; CString screen;
s << "section: aliases" << std::endl; s << "section: aliases" << std::endl;
for (CConfig::CNameMap::const_iterator index = aliases.begin(); for (CMNameMap::const_iterator index = aliases.begin();
index != aliases.end(); ++index) { index != aliases.end(); ++index) {
if (index->first != screen) { if (index->first != screen) {
screen = index->first; screen = index->first;
s << "\t" << screen.c_str() << std::endl; s << "\t" << screen.c_str() << ":" << std::endl;
} }
s << "\t\t" << index->second.c_str() << std::endl; s << "\t\t" << index->second.c_str() << std::endl;
} }

View File

@ -51,9 +51,11 @@ private:
CString m_neighbor[kLastDirection - kFirstDirection + 1]; CString m_neighbor[kLastDirection - kFirstDirection + 1];
}; };
typedef std::map<CString, CCell, CStringUtil::CaselessCmp> CCellMap; typedef std::map<CString, CCell, CStringUtil::CaselessCmp> CCellMap;
typedef std::map<CString, CString, CStringUtil::CaselessCmp> CNameMap;
public: public:
typedef CCellMap::const_iterator internal_const_iterator; typedef CCellMap::const_iterator internal_const_iterator;
typedef CNameMap::const_iterator all_const_iterator;
class const_iterator : std::iterator_traits<CConfig> { class const_iterator : std::iterator_traits<CConfig> {
public: public:
explicit const_iterator() : m_i() { } explicit const_iterator() : m_i() { }
@ -93,6 +95,14 @@ public:
*/ */
bool addScreen(const CString& name); bool addScreen(const CString& name);
//! Rename screen
/*!
Renames a screen. All references to the name are updated.
Returns true iff successful.
*/
bool renameScreen(const CString& oldName,
const CString& newName);
//! Remove screen //! Remove screen
/*! /*!
Removes a screen. This also removes aliases for the screen and Removes a screen. This also removes aliases for the screen and
@ -180,6 +190,11 @@ public:
//! Get ending (canonical) screen name iterator //! Get ending (canonical) screen name iterator
const_iterator end() const; const_iterator end() const;
//! Get beginning screen name iterator
all_const_iterator beginAll() const;
//! Get ending screen name iterator
all_const_iterator endAll() const;
//! Test for screen name //! Test for screen name
/*! /*!
Returns true iff \c name names a screen. Returns true iff \c name names a screen.
@ -212,6 +227,11 @@ public:
//! Get the HTTP server address //! Get the HTTP server address
const CNetworkAddress& getHTTPAddress() const; const CNetworkAddress& getHTTPAddress() const;
//! Compare configurations
bool operator==(const CConfig&) const;
//! Compare configurations
bool operator!=(const CConfig&) const;
//! Read configuration //! Read configuration
/*! /*!
Reads a configuration from a stream. Throws XConfigRead on error. Reads a configuration from a stream. Throws XConfigRead on error.
@ -241,8 +261,6 @@ private:
void readSectionAliases(std::istream&); void readSectionAliases(std::istream&);
private: private:
typedef std::map<CString, CString, CStringUtil::CaselessCmp> CNameMap;
CCellMap m_map; CCellMap m_map;
CNameMap m_nameToCanonicalName; CNameMap m_nameToCanonicalName;
CNetworkAddress m_synergyAddress; CNetworkAddress m_synergyAddress;

View File

@ -17,6 +17,9 @@ Package=<4>
Begin Project Dependency Begin Project Dependency
Project_Dep_Name synergyd Project_Dep_Name synergyd
End Project Dependency End Project Dependency
Begin Project Dependency
Project_Dep_Name launcher
End Project Dependency
}}} }}}
############################################################################### ###############################################################################
@ -69,6 +72,51 @@ Package=<4>
############################################################################### ###############################################################################
Project: "launcher"=.\cmd\launcher\launcher.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name base
End Project Dependency
Begin Project Dependency
Project_Dep_Name http
End Project Dependency
Begin Project Dependency
Project_Dep_Name io
End Project Dependency
Begin Project Dependency
Project_Dep_Name mt
End Project Dependency
Begin Project Dependency
Project_Dep_Name net
End Project Dependency
Begin Project Dependency
Project_Dep_Name platform
End Project Dependency
Begin Project Dependency
Project_Dep_Name server
End Project Dependency
}}}
###############################################################################
Project: "libsynergy"=.\lib\synergy\libsynergy.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "makehook"=.\lib\platform\makehook.dsp - Package Owner=<4> Project: "makehook"=.\lib\platform\makehook.dsp - Package Owner=<4>
Package=<5> Package=<5>
@ -204,18 +252,6 @@ Package=<4>
############################################################################### ###############################################################################
Project: "libsynergy"=.\lib\synergy\libsynergy.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "synrgyhk"=.\lib\platform\synrgyhk.dsp - Package Owner=<4> Project: "synrgyhk"=.\lib\platform\synrgyhk.dsp - Package Owner=<4>
Package=<5> Package=<5>