checkpoint. more conversion to automake.
This commit is contained in:
parent
f85457c49f
commit
9c7e863d77
|
@ -3,64 +3,70 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_LINUX)
|
//
|
||||||
|
// pick types of particular sizes
|
||||||
|
//
|
||||||
|
|
||||||
#include <stdint.h>
|
#if !defined(TYPE_OF_SIZE_1)
|
||||||
|
# if SIZEOF_CHAR == 1
|
||||||
|
# define TYPE_OF_SIZE_1 char
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef int8_t SInt8;
|
#if !defined(TYPE_OF_SIZE_2)
|
||||||
typedef int16_t SInt16;
|
# if SIZEOF_INT == 2
|
||||||
typedef int32_t SInt32;
|
# define TYPE_OF_SIZE_2 int
|
||||||
typedef int64_t SInt64;
|
|
||||||
|
|
||||||
typedef uint8_t UInt8;
|
|
||||||
typedef uint16_t UInt16;
|
|
||||||
typedef uint32_t UInt32;
|
|
||||||
typedef uint64_t UInt64;
|
|
||||||
|
|
||||||
#endif // CONFIG_PLATFORM_LINUX
|
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_SOLARIS)
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
typedef int8_t SInt8;
|
|
||||||
typedef int16_t SInt16;
|
|
||||||
typedef int32_t SInt32;
|
|
||||||
typedef int64_t SInt64;
|
|
||||||
|
|
||||||
typedef uint8_t UInt8;
|
|
||||||
typedef uint16_t UInt16;
|
|
||||||
typedef uint32_t UInt32;
|
|
||||||
typedef uint64_t UInt64;
|
|
||||||
|
|
||||||
#endif // CONFIG_PLATFORM_SOLARIS
|
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
|
||||||
|
|
||||||
// use VC++ extensions if available
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
typedef signed __int8 SInt8;
|
|
||||||
typedef signed __int16 SInt16;
|
|
||||||
typedef signed __int32 SInt32;
|
|
||||||
typedef signed __int64 SInt64;
|
|
||||||
|
|
||||||
typedef unsigned __int8 UInt8;
|
|
||||||
typedef unsigned __int16 UInt16;
|
|
||||||
typedef unsigned __int32 UInt32;
|
|
||||||
typedef unsigned __int64 UInt64;
|
|
||||||
# else
|
# else
|
||||||
typedef signed char SInt8;
|
# define TYPE_OF_SIZE_2 short
|
||||||
typedef short SInt16;
|
# endif
|
||||||
typedef int SInt32;
|
|
||||||
typedef long long SInt64;
|
|
||||||
|
|
||||||
typedef unsigned char UInt8;
|
|
||||||
typedef unsigned short UInt16;
|
|
||||||
typedef unsigned int UInt32;
|
|
||||||
typedef unsigned long long UInt64;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // CONFIG_PLATFORM_WIN32
|
#if !defined(TYPE_OF_SIZE_4)
|
||||||
|
# if SIZEOF_INT == 4
|
||||||
|
# define TYPE_OF_SIZE_4 int
|
||||||
|
# else
|
||||||
|
# define TYPE_OF_SIZE_4 long
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// verify existence of required types
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(TYPE_OF_SIZE_1)
|
||||||
|
# error No 1 byte integer type
|
||||||
|
#endif
|
||||||
|
#if !defined(TYPE_OF_SIZE_2)
|
||||||
|
# error No 2 byte integer type
|
||||||
|
#endif
|
||||||
|
#if !defined(TYPE_OF_SIZE_4)
|
||||||
|
# error No 4 byte integer type
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// make typedefs
|
||||||
|
//
|
||||||
|
// except for SInt8 and UInt8 these types are only guaranteed to be
|
||||||
|
// at least as big as indicated (in bits). that is, they may be
|
||||||
|
// larger than indicated.
|
||||||
|
//
|
||||||
|
|
||||||
|
typedef signed TYPE_OF_SIZE_1 SInt8;
|
||||||
|
typedef signed TYPE_OF_SIZE_2 SInt16;
|
||||||
|
typedef signed TYPE_OF_SIZE_4 SInt32;
|
||||||
|
|
||||||
|
typedef unsigned TYPE_OF_SIZE_1 UInt8;
|
||||||
|
typedef unsigned TYPE_OF_SIZE_2 UInt16;
|
||||||
|
typedef unsigned TYPE_OF_SIZE_4 UInt32;
|
||||||
|
|
||||||
|
//
|
||||||
|
// clean up
|
||||||
|
//
|
||||||
|
|
||||||
|
#undef TYPE_OF_SIZE_1
|
||||||
|
#undef TYPE_OF_SIZE_2
|
||||||
|
#undef TYPE_OF_SIZE_4
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
|
@ -42,6 +42,13 @@ static const int g_prioritySuffixLength = 2;
|
||||||
static const int g_priorityPad = g_maxPriorityLength +
|
static const int g_priorityPad = g_maxPriorityLength +
|
||||||
g_prioritySuffixLength;
|
g_prioritySuffixLength;
|
||||||
|
|
||||||
|
// platform newline sequence
|
||||||
|
#if WINDOWS_LIKE
|
||||||
|
static const char* g_newline = "\r\n";
|
||||||
|
#else
|
||||||
|
static const char* g_newline = "\n";
|
||||||
|
#endif
|
||||||
|
|
||||||
// minimum length of a newline sequence
|
// minimum length of a newline sequence
|
||||||
static const int g_newlineLength = 2;
|
static const int g_newlineLength = 2;
|
||||||
|
|
||||||
|
@ -226,17 +233,13 @@ CLog::output(int priority, char* msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// put a newline at the end
|
// put a newline at the end
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
strcat(msg + g_priorityPad, g_newline);
|
||||||
strcat(msg + g_priorityPad, "\r\n");
|
|
||||||
#else
|
|
||||||
strcat(msg + g_priorityPad, "\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// print it
|
// print it
|
||||||
CHoldLock lock(s_lock);
|
CHoldLock lock(s_lock);
|
||||||
if (s_outputter == NULL ||
|
if (s_outputter == NULL ||
|
||||||
!s_outputter(priority, msg + g_maxPriorityLength - n)) {
|
!s_outputter(priority, msg + g_maxPriorityLength - n)) {
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
openConsole();
|
openConsole();
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, "%s", msg + g_maxPriorityLength - n);
|
fprintf(stderr, "%s", msg + g_maxPriorityLength - n);
|
||||||
|
@ -268,7 +271,7 @@ CLog::vsprint(int pad, char* buffer, int len, const char* fmt, va_list args)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
static DWORD s_thread = 0;
|
static DWORD s_thread = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef CLOG_H
|
#ifndef CLOG_H
|
||||||
#define CLOG_H
|
#define CLOG_H
|
||||||
|
|
||||||
#include "BasicTypes.h"
|
#include "common.h"
|
||||||
#include <cstdarg>
|
#include <stdarg.h>
|
||||||
|
|
||||||
class CLog {
|
class CLog {
|
||||||
public:
|
public:
|
||||||
|
@ -67,7 +67,7 @@ private:
|
||||||
static void output(int priority, char* msg);
|
static void output(int priority, char* msg);
|
||||||
static char* vsprint(int pad, char*, int len, const char*, va_list);
|
static char* vsprint(int pad, char*, int len, const char*, va_list);
|
||||||
static int nprint(const char*, va_list);
|
static int nprint(const char*, va_list);
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
static void openConsole();
|
static void openConsole();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -110,21 +110,7 @@ CStopwatch::operator double() const
|
||||||
return getTime();
|
return getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_UNIX)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
double
|
|
||||||
CStopwatch::getClock() const
|
|
||||||
{
|
|
||||||
struct timeval t;
|
|
||||||
gettimeofday(&t, NULL);
|
|
||||||
return (double)t.tv_sec + 1.0e-6 * (double)t.tv_usec;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // CONFIG_PLATFORM_UNIX
|
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
|
||||||
|
|
||||||
// avoid getting a lot a crap from mmsystem.h that we don't need
|
// avoid getting a lot a crap from mmsystem.h that we don't need
|
||||||
#define MMNODRV // Installable driver support
|
#define MMNODRV // Installable driver support
|
||||||
|
@ -198,4 +184,28 @@ CStopwatch::getClock() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_PLATFORM_WIN32
|
#elif UNIX_LIKE
|
||||||
|
|
||||||
|
#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
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
double
|
||||||
|
CStopwatch::getClock() const
|
||||||
|
{
|
||||||
|
struct timeval t;
|
||||||
|
gettimeofday(&t, NULL);
|
||||||
|
return (double)t.tv_sec + 1.0e-6 * (double)t.tv_usec;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // UNIX_LIKE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|
||||||
// win32 wants a const char* argument to std::exception c'tor
|
// win32 wants a const char* argument to std::exception c'tor
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
#define STDEXCEPTARG ""
|
#define STDEXCEPTARG ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,15 @@
|
||||||
#ifndef COMMON_H
|
#ifndef COMMON_H
|
||||||
#define COMMON_H
|
#define COMMON_H
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CONFIG_PLATFORM_LINUX
|
// check if win32 platform
|
||||||
#define CONFIG_PLATFORM_UNIX
|
#if defined(_WIN32) || HAVE_WINDOWS_H
|
||||||
#define CONFIG_TYPES_X11
|
# define WINDOWS_LIKE 1
|
||||||
#define CONFIG_PTHREADS
|
|
||||||
|
|
||||||
#elif defined(__sun__)
|
|
||||||
|
|
||||||
#define CONFIG_PLATFORM_SOLARIS
|
|
||||||
#define CONFIG_PLATFORM_UNIX
|
|
||||||
#define CONFIG_TYPES_X11
|
|
||||||
#define CONFIG_PTHREADS
|
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
|
|
||||||
#define CONFIG_PLATFORM_WIN32
|
|
||||||
|
|
||||||
|
// VC++ specific
|
||||||
# if (_MSC_VER >= 1200)
|
# if (_MSC_VER >= 1200)
|
||||||
// work around for statement scoping bug
|
// work around for statement scoping bug
|
||||||
# define for if (false) { } else for
|
# define for if (false) { } else for
|
||||||
|
@ -33,21 +24,35 @@
|
||||||
// emitted incorrectly under release build in some circumstances
|
// emitted incorrectly under release build in some circumstances
|
||||||
# if defined(NDEBUG)
|
# if defined(NDEBUG)
|
||||||
# pragma warning(disable: 4702) // unreachable code
|
# pragma warning(disable: 4702) // unreachable code
|
||||||
#pragma warning(disable: 4701) // local variable maybe used uninitialized
|
# pragma warning(disable: 4701) // variable maybe used uninitialized
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# endif // (_MSC_VER >= 1200)
|
# endif // (_MSC_VER >= 1200)
|
||||||
|
|
||||||
|
// VC++ has built-in sized types
|
||||||
|
# if defined(_MSC_VER)
|
||||||
|
# define TYPE_OF_SIZE_1 __int8
|
||||||
|
# define TYPE_OF_SIZE_2 __int16
|
||||||
|
# define TYPE_OF_SIZE_4 __int32
|
||||||
# else
|
# else
|
||||||
|
# define SIZE_OF_CHAR 1
|
||||||
|
# define SIZE_OF_SHORT 2
|
||||||
|
# define SIZE_OF_INT 4
|
||||||
|
# define SIZE_OF_LONG 4
|
||||||
|
# endif
|
||||||
|
#endif // defined(_WIN32) || HAVE_WINDOWS_H
|
||||||
|
|
||||||
#error unsupported platform
|
// unix-like if not like anything else
|
||||||
|
#if (!defined(WINDOWS_LIKE) || WINDOWS_LIKE == 0)
|
||||||
|
# define UNIX_LIKE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// define NULL
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cassert>
|
// make assert available since we use it a lot
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
#include "stdpre.h"
|
#include "stdpre.h"
|
||||||
#if !defined(CONFIG_PLATFORM_LINUX)
|
#if defined(HAVE_ISTREAM)
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#else
|
#else
|
||||||
// some versions of libstdc++ don't have <istream>
|
|
||||||
// FIXME -- only include iostream for versions that don't have istream
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#endif
|
#endif
|
||||||
#include "stdpost.h"
|
#include "stdpost.h"
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32) && defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
// istream has no overloads for __int* types
|
// istream has no overloads for __int* types
|
||||||
inline
|
inline
|
||||||
std::istream& operator>>(std::istream& s, SInt8& i)
|
std::istream& operator>>(std::istream& s, SInt8& i)
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#include "stdpre.h"
|
#include "stdpre.h"
|
||||||
#if !defined(CONFIG_PLATFORM_LINUX)
|
#if defined(HAVE_OSTREAM)
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#else
|
#else
|
||||||
// some versions of libstdc++ don't have <ostream>
|
|
||||||
// FIXME -- only include iostream for versions that don't have ostream
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#endif
|
#endif
|
||||||
#include "stdpost.h"
|
#include "stdpost.h"
|
||||||
|
|
|
@ -402,9 +402,9 @@ CClient::runSession(void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME -- use factory to create screen
|
// FIXME -- use factory to create screen
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
#include "CMSWindowsSecondaryScreen.h"
|
#include "CMSWindowsSecondaryScreen.h"
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
#include "CXWindowsSecondaryScreen.h"
|
#include "CXWindowsSecondaryScreen.h"
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
|
@ -426,9 +426,9 @@ CClient::openSecondaryScreen()
|
||||||
|
|
||||||
// open screen
|
// open screen
|
||||||
log((CLOG_DEBUG1 "creating secondary screen"));
|
log((CLOG_DEBUG1 "creating secondary screen"));
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
m_screen = new CMSWindowsSecondaryScreen;
|
m_screen = new CMSWindowsSecondaryScreen;
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
m_screen = new CXWindowsSecondaryScreen;
|
m_screen = new CXWindowsSecondaryScreen;
|
||||||
#endif
|
#endif
|
||||||
log((CLOG_DEBUG1 "opening secondary screen"));
|
log((CLOG_DEBUG1 "opening secondary screen"));
|
||||||
|
|
|
@ -4,12 +4,20 @@
|
||||||
#include "CXWindowsUtil.h"
|
#include "CXWindowsUtil.h"
|
||||||
#include "CThread.h"
|
#include "CThread.h"
|
||||||
#include "CLog.h"
|
#include "CLog.h"
|
||||||
|
#if defined(X_DISPLAY_MISSING)
|
||||||
|
# error X11 is required to build synergy
|
||||||
|
#else
|
||||||
# include <X11/X.h>
|
# include <X11/X.h>
|
||||||
# include <X11/Xutil.h>
|
# include <X11/Xutil.h>
|
||||||
# define XK_MISCELLANY
|
# define XK_MISCELLANY
|
||||||
# define XK_XKB_KEYS
|
# define XK_XKB_KEYS
|
||||||
# include <X11/keysymdef.h>
|
# include <X11/keysymdef.h>
|
||||||
|
# if defined(HAVE_X11_EXTENSIONS_XTEST_H)
|
||||||
# include <X11/extensions/XTest.h>
|
# include <X11/extensions/XTest.h>
|
||||||
|
# else
|
||||||
|
# error The XTest extension is required to build synergy
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// CXWindowsSecondaryScreen
|
// CXWindowsSecondaryScreen
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
// platform dependent name of a daemon
|
// platform dependent name of a daemon
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
#define DAEMON_NAME "Synergy Client"
|
#define DAEMON_NAME "Synergy Client"
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
#define DAEMON_NAME "synergy"
|
#define DAEMON_NAME "synergy"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ static
|
||||||
void
|
void
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
# define PLATFORM_ARGS \
|
# define PLATFORM_ARGS \
|
||||||
" [--install]" \
|
" [--install]" \
|
||||||
|
@ -326,7 +326,7 @@ parse(int argc, const char** argv)
|
||||||
bye(0);
|
bye(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
else if (isArg(i, argc, argv, NULL, "--install")) {
|
else if (isArg(i, argc, argv, NULL, "--install")) {
|
||||||
s_install = true;
|
s_install = true;
|
||||||
if (s_uninstall) {
|
if (s_uninstall) {
|
||||||
|
@ -338,7 +338,7 @@ parse(int argc, const char** argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
else if (isArg(i, argc, argv, NULL, "--uninstall")) {
|
else if (isArg(i, argc, argv, NULL, "--uninstall")) {
|
||||||
s_uninstall = true;
|
s_uninstall = true;
|
||||||
if (s_install) {
|
if (s_install) {
|
||||||
|
@ -404,7 +404,7 @@ parse(int argc, const char** argv)
|
||||||
// increase default filter level for daemon. the user must
|
// increase default filter level for daemon. the user must
|
||||||
// explicitly request another level for a daemon.
|
// explicitly request another level for a daemon.
|
||||||
if (s_daemon && s_logFilter == NULL) {
|
if (s_daemon && s_logFilter == NULL) {
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
if (CPlatform::isWindows95Family()) {
|
if (CPlatform::isWindows95Family()) {
|
||||||
// windows 95 has no place for logging so avoid showing
|
// windows 95 has no place for logging so avoid showing
|
||||||
// the log console window.
|
// the log console window.
|
||||||
|
@ -430,7 +430,7 @@ parse(int argc, const char** argv)
|
||||||
// platform dependent entry points
|
// platform dependent entry points
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
#include "CMSWindowsScreen.h"
|
#include "CMSWindowsScreen.h"
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
|
|
20
configure.in
20
configure.in
|
@ -1,6 +1,6 @@
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_INIT(base/IInterface.h)
|
AC_INIT(base/common.h)
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
AC_CONFIG_AUX_DIR(config)
|
AC_CONFIG_AUX_DIR(config)
|
||||||
AM_INIT_AUTOMAKE(synergy, 0.5)
|
AM_INIT_AUTOMAKE(synergy, 0.5)
|
||||||
|
@ -17,13 +17,13 @@ ACX_PTHREAD(,AC_MSG_ERROR(You must have pthreads to compile synergy))
|
||||||
|
|
||||||
dnl checks for header files
|
dnl checks for header files
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
AC_HEADER_TIME
|
||||||
|
AC_CHECK_HEADERS([unistd.h sys/time.h])
|
||||||
|
AC_CHECK_HEADERS([istream ostream])
|
||||||
|
AC_CHECK_HEADERS([windows.h])
|
||||||
AC_PATH_X
|
AC_PATH_X
|
||||||
if test "$no_x" = yes; then
|
|
||||||
AC_MSG_ERROR(You must have X Windows to compile synergy)
|
|
||||||
fi
|
|
||||||
AC_PATH_XTRA
|
AC_PATH_XTRA
|
||||||
AC_CHECK_HEADERS(sys/time.h)
|
AC_CHECK_HEADERS([X11/extensions/XTest.h])
|
||||||
dnl AC_HEADER_TIME
|
|
||||||
|
|
||||||
dnl checks for types
|
dnl checks for types
|
||||||
dnl AC_TYPE_SIZE_T
|
dnl AC_TYPE_SIZE_T
|
||||||
|
@ -32,7 +32,13 @@ dnl checks for structures
|
||||||
AC_STRUCT_TM
|
AC_STRUCT_TM
|
||||||
|
|
||||||
dnl checks for compiler characteristics
|
dnl checks for compiler characteristics
|
||||||
|
AC_CHECK_SIZEOF(char, 1)
|
||||||
|
AC_CHECK_SIZEOF(short, 2)
|
||||||
|
AC_CHECK_SIZEOF(int, 2)
|
||||||
|
AC_CHECK_SIZEOF(long, 4)
|
||||||
|
dnl should check for bool
|
||||||
|
dnl should require template support
|
||||||
|
dnl should require exception support
|
||||||
|
|
||||||
dnl checks for library functions
|
dnl checks for library functions
|
||||||
dnl AC_TYPE_SIGNAL
|
dnl AC_TYPE_SIGNAL
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
CCondVarBase::CCondVarBase(CMutex* mutex) :
|
CCondVarBase::CCondVarBase(CMutex* mutex) :
|
||||||
m_mutex(mutex)
|
m_mutex(mutex)
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
, m_waitCountMutex()
|
, m_waitCountMutex()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ CCondVarBase::getMutex() const
|
||||||
return m_mutex;
|
return m_mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
|
|
||||||
#include "CThread.h"
|
#include "CThread.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -169,9 +169,9 @@ CCondVarBase::wait(CStopwatch& timer, double timeout) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_PTHREADS
|
#endif // HAVE_PTHREAD
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
#include "CLock.h"
|
#include "CLock.h"
|
||||||
#include "CThreadRep.h"
|
#include "CThreadRep.h"
|
||||||
|
@ -312,4 +312,4 @@ CCondVarBase::wait(CStopwatch& timer, double timeout) const
|
||||||
result == WAIT_OBJECT_0 + 1);
|
result == WAIT_OBJECT_0 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_PLATFORM_WIN32
|
#endif // WINDOWS_LIKE
|
||||||
|
|
|
@ -56,7 +56,7 @@ private:
|
||||||
CMutex* m_mutex;
|
CMutex* m_mutex;
|
||||||
void* m_cond;
|
void* m_cond;
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
enum { kSignal, kBroadcast };
|
enum { kSignal, kBroadcast };
|
||||||
mutable UInt32 m_waitCount;
|
mutable UInt32 m_waitCount;
|
||||||
CMutex m_waitCountMutex;
|
CMutex m_waitCountMutex;
|
||||||
|
|
|
@ -26,7 +26,7 @@ CMutex::operator=(const CMutex&)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
@ -98,9 +98,9 @@ CMutex::unlock() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_PTHREADS
|
#endif // HAVE_PTHREAD
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -133,4 +133,4 @@ CMutex::unlock() const
|
||||||
LeaveCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
|
LeaveCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(m_mutex));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_PLATFORM_WIN32
|
#endif // WINDOWS_LIKE
|
||||||
|
|
|
@ -99,7 +99,7 @@ CThread::wait(double timeout) const
|
||||||
return currentRep->wait(m_rep, timeout);
|
return currentRep->wait(m_rep, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
bool
|
bool
|
||||||
CThread::waitForEvent(double timeout)
|
CThread::waitForEvent(double timeout)
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
// (cancellation point)
|
// (cancellation point)
|
||||||
bool wait(double timeout = -1.0) const;
|
bool wait(double timeout = -1.0) const;
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
// wait for a message in the queue. returns true if a message
|
// wait for a message in the queue. returns true if a message
|
||||||
// is available.
|
// is available.
|
||||||
// (cancellation point)
|
// (cancellation point)
|
||||||
|
|
|
@ -6,40 +6,34 @@
|
||||||
#include "CLog.h"
|
#include "CLog.h"
|
||||||
#include "IJob.h"
|
#include "IJob.h"
|
||||||
|
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
|
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# define SIGWAKEUP SIGUSR1
|
# define SIGWAKEUP SIGUSR1
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#elif WINDOWS_LIKE
|
||||||
|
|
||||||
# if !defined(_MT)
|
# if !defined(_MT)
|
||||||
# error multithreading compile option is required
|
# error multithreading compile option is required
|
||||||
# endif
|
# endif
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error unsupported platform for multithreading
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME -- temporary exception type
|
// FIXME -- temporary exception type
|
||||||
class XThreadUnavailable { };
|
class XThreadUnavailable { };
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_UNIX) && !defined(NDEBUG)
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
static void threadDebug(int)
|
|
||||||
{
|
|
||||||
if (fork() == 0) abort();
|
|
||||||
else { wait(0); exit(1); }
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// CThreadRep
|
// CThreadRep
|
||||||
//
|
//
|
||||||
|
|
||||||
CMutex* CThreadRep::s_mutex = NULL;
|
CMutex* CThreadRep::s_mutex = NULL;
|
||||||
CThreadRep* CThreadRep::s_head = NULL;
|
CThreadRep* CThreadRep::s_head = NULL;
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
pthread_t CThreadRep::s_signalThread;
|
pthread_t CThreadRep::s_signalThread;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -55,10 +49,10 @@ CThreadRep::CThreadRep() :
|
||||||
|
|
||||||
// initialize stuff
|
// initialize stuff
|
||||||
init();
|
init();
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
// get main thread id
|
// get main thread id
|
||||||
m_thread = pthread_self();
|
m_thread = pthread_self();
|
||||||
#elif defined(CONFIG_PLATFORM_WIN32)
|
#elif WINDOWS_LIKE
|
||||||
// get main thread id
|
// get main thread id
|
||||||
m_thread = NULL;
|
m_thread = NULL;
|
||||||
m_id = GetCurrentThreadId();
|
m_id = GetCurrentThreadId();
|
||||||
|
@ -94,7 +88,7 @@ CThreadRep::CThreadRep(IJob* job, void* userData) :
|
||||||
CLock lock(s_mutex);
|
CLock lock(s_mutex);
|
||||||
|
|
||||||
// start the thread. throw if it doesn't start.
|
// start the thread. throw if it doesn't start.
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
// mask some signals in all threads except the main thread
|
// mask some signals in all threads except the main thread
|
||||||
sigset_t sigset, oldsigset;
|
sigset_t sigset, oldsigset;
|
||||||
sigemptyset(&sigset);
|
sigemptyset(&sigset);
|
||||||
|
@ -106,7 +100,7 @@ CThreadRep::CThreadRep(IJob* job, void* userData) :
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
throw XThreadUnavailable();
|
throw XThreadUnavailable();
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_PLATFORM_WIN32)
|
#elif WINDOWS_LIKE
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
m_thread = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0,
|
m_thread = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0,
|
||||||
threadFunc, (void*)this, 0, &id));
|
threadFunc, (void*)this, 0, &id));
|
||||||
|
@ -151,7 +145,7 @@ CThreadRep::initThreads()
|
||||||
if (s_mutex == NULL) {
|
if (s_mutex == NULL) {
|
||||||
s_mutex = new CMutex;
|
s_mutex = new CMutex;
|
||||||
|
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
// install SIGWAKEUP handler
|
// install SIGWAKEUP handler
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
|
@ -162,18 +156,11 @@ CThreadRep::initThreads()
|
||||||
# endif
|
# endif
|
||||||
act.sa_handler = &threadCancel;
|
act.sa_handler = &threadCancel;
|
||||||
sigaction(SIGWAKEUP, &act, NULL);
|
sigaction(SIGWAKEUP, &act, NULL);
|
||||||
# ifndef NDEBUG
|
|
||||||
act.sa_handler = &threadDebug;
|
|
||||||
sigaction(SIGSEGV, &act, NULL);
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// set signal mask
|
// set signal mask
|
||||||
sigset_t sigset;
|
sigset_t sigset;
|
||||||
sigemptyset(&sigset);
|
sigemptyset(&sigset);
|
||||||
sigaddset(&sigset, SIGWAKEUP);
|
sigaddset(&sigset, SIGWAKEUP);
|
||||||
# ifndef NDEBUG
|
|
||||||
sigaddset(&sigset, SIGSEGV);
|
|
||||||
# endif
|
|
||||||
pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
|
pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
|
||||||
sigemptyset(&sigset);
|
sigemptyset(&sigset);
|
||||||
sigaddset(&sigset, SIGPIPE);
|
sigaddset(&sigset, SIGPIPE);
|
||||||
|
@ -196,7 +183,7 @@ CThreadRep::initThreads()
|
||||||
sigaddset(&sigset, SIGTERM);
|
sigaddset(&sigset, SIGTERM);
|
||||||
pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
|
pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // HAVE_PTHREAD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,9 +238,9 @@ CThreadRep::getCurrentThreadRep()
|
||||||
{
|
{
|
||||||
assert(s_mutex != NULL);
|
assert(s_mutex != NULL);
|
||||||
|
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
const pthread_t thread = pthread_self();
|
const pthread_t thread = pthread_self();
|
||||||
#elif defined(CONFIG_PLATFORM_WIN32)
|
#elif WINDOWS_LIKE
|
||||||
const DWORD id = GetCurrentThreadId();
|
const DWORD id = GetCurrentThreadId();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -263,11 +250,11 @@ CThreadRep::getCurrentThreadRep()
|
||||||
// search
|
// search
|
||||||
CThreadRep* scan = s_head;
|
CThreadRep* scan = s_head;
|
||||||
while (scan != NULL) {
|
while (scan != NULL) {
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
if (scan->m_thread == thread) {
|
if (scan->m_thread == thread) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#elif defined(CONFIG_PLATFORM_WIN32)
|
#elif WINDOWS_LIKE
|
||||||
if (scan->m_id == id) {
|
if (scan->m_id == id) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -326,10 +313,19 @@ CThreadRep::doThreadFunc()
|
||||||
m_result = result;
|
m_result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
|
|
||||||
#include "CStopwatch.h"
|
#include "CStopwatch.h"
|
||||||
|
#if TIME_WITH_SYS_TIME
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
|
# include <time.h>
|
||||||
|
#else
|
||||||
|
# if HAVE_SYS_TIME_H
|
||||||
|
# include <sys/time.h>
|
||||||
|
# else
|
||||||
|
# include <time.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
CThreadRep::init()
|
CThreadRep::init()
|
||||||
|
@ -492,7 +488,9 @@ CThreadRep::threadSignalHandler(void* vrep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(CONFIG_PLATFORM_WIN32)
|
#endif // HAVE_PTHREAD
|
||||||
|
|
||||||
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
void
|
void
|
||||||
CThreadRep::init()
|
CThreadRep::init()
|
||||||
|
@ -713,4 +711,4 @@ CThreadRep::threadFunc(void* arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // WINDOWS_LIKE
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#ifndef CTHREADREP_H
|
#ifndef CTHREADREP_H
|
||||||
#define CTHREADREP_H
|
#define CTHREADREP_H
|
||||||
|
|
||||||
#include "BasicTypes.h"
|
#include "common.h"
|
||||||
|
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#elif defined(CONFIG_PLATFORM_WIN32)
|
#elif WINDOWS_LIKE
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
// wait for thread to exit or for current thread to cancel
|
// wait for thread to exit or for current thread to cancel
|
||||||
bool wait(CThreadRep*, double timeout);
|
bool wait(CThreadRep*, double timeout);
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
// wait for a message on the queue
|
// wait for a message on the queue
|
||||||
bool waitForEvent(double timeout);
|
bool waitForEvent(double timeout);
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,9 +62,9 @@ public:
|
||||||
// get the current cancellable state
|
// get the current cancellable state
|
||||||
bool isCancellable() const;
|
bool isCancellable() const;
|
||||||
|
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
bool isExited() const;
|
bool isExited() const;
|
||||||
#elif defined(CONFIG_PLATFORM_WIN32)
|
#elif WINDOWS_LIKE
|
||||||
HANDLE getExitEvent() const;
|
HANDLE getExitEvent() const;
|
||||||
HANDLE getCancelEvent() const;
|
HANDLE getCancelEvent() const;
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,11 +88,11 @@ private:
|
||||||
static CThreadRep* find();
|
static CThreadRep* find();
|
||||||
|
|
||||||
// thread functions
|
// thread functions
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
static void* threadFunc(void* arg);
|
static void* threadFunc(void* arg);
|
||||||
static void threadCancel(int);
|
static void threadCancel(int);
|
||||||
static void* threadSignalHandler(void*);
|
static void* threadSignalHandler(void*);
|
||||||
#elif defined(CONFIG_PLATFORM_WIN32)
|
#elif WINDOWS_LIKE
|
||||||
static unsigned int __stdcall threadFunc(void* arg);
|
static unsigned int __stdcall threadFunc(void* arg);
|
||||||
#endif
|
#endif
|
||||||
void doThreadFunc();
|
void doThreadFunc();
|
||||||
|
@ -108,22 +108,21 @@ private:
|
||||||
CThreadRep* m_prev;
|
CThreadRep* m_prev;
|
||||||
CThreadRep* m_next;
|
CThreadRep* m_next;
|
||||||
|
|
||||||
SInt32 m_refCount;
|
int m_refCount;
|
||||||
IJob* m_job;
|
IJob* m_job;
|
||||||
void* m_userData;
|
void* m_userData;
|
||||||
void* m_result;
|
void* m_result;
|
||||||
bool m_cancellable;
|
bool m_cancellable;
|
||||||
bool m_cancelling;
|
bool m_cancelling;
|
||||||
UInt32 m_signals;
|
|
||||||
|
|
||||||
#if defined(CONFIG_PTHREADS)
|
#if HAVE_PTHREAD
|
||||||
pthread_t m_thread;
|
pthread_t m_thread;
|
||||||
bool m_exit;
|
bool m_exit;
|
||||||
bool m_cancel;
|
bool m_cancel;
|
||||||
static pthread_t s_signalThread;
|
static pthread_t s_signalThread;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
HANDLE m_thread;
|
HANDLE m_thread;
|
||||||
DWORD m_id;
|
DWORD m_id;
|
||||||
HANDLE m_exit;
|
HANDLE m_exit;
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct protoent FAR * (PASCAL FAR *CNetwork::getprotobyname)(const char FAR * na
|
||||||
int (PASCAL FAR *CNetwork::getsockerror)(void);
|
int (PASCAL FAR *CNetwork::getsockerror)(void);
|
||||||
int (PASCAL FAR *CNetwork::gethosterror)(void);
|
int (PASCAL FAR *CNetwork::gethosterror)(void);
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
int (PASCAL FAR *CNetwork::select)(int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout);
|
int (PASCAL FAR *CNetwork::select)(int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout);
|
||||||
int (PASCAL FAR *CNetwork::WSACleanup)(void);
|
int (PASCAL FAR *CNetwork::WSACleanup)(void);
|
||||||
|
@ -297,7 +297,7 @@ CNetwork::write2(Socket s, const void FAR* buf, size_t len)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_UNIX)
|
#if UNIX_LIKE
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "BasicTypes.h"
|
#include "BasicTypes.h"
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
// declare no functions in winsock2
|
// declare no functions in winsock2
|
||||||
# define INCL_WINSOCK_API_PROTOTYPES 0
|
# define INCL_WINSOCK_API_PROTOTYPES 0
|
||||||
# define INCL_WINSOCK_API_TYPEDEFS 0
|
# define INCL_WINSOCK_API_TYPEDEFS 0
|
||||||
|
@ -13,11 +13,13 @@ typedef int ssize_t;
|
||||||
# define SOL_TCP IPPROTO_TCP
|
# define SOL_TCP IPPROTO_TCP
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
|
# undef FAR
|
||||||
|
# undef PASCAL
|
||||||
# define FAR
|
# define FAR
|
||||||
# define PASCAL
|
# define PASCAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_UNIX)
|
#if UNIX_LIKE
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/poll.h>
|
# include <sys/poll.h>
|
||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
|
@ -31,7 +33,7 @@ typedef int ssize_t;
|
||||||
|
|
||||||
class CNetwork {
|
class CNetwork {
|
||||||
public:
|
public:
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
typedef SOCKET Socket;
|
typedef SOCKET Socket;
|
||||||
typedef struct sockaddr Address;
|
typedef struct sockaddr Address;
|
||||||
typedef int AddressLength;
|
typedef int AddressLength;
|
||||||
|
@ -48,7 +50,7 @@ public:
|
||||||
kPOLLERR = 4,
|
kPOLLERR = 4,
|
||||||
kPOLLNVAL = 8
|
kPOLLNVAL = 8
|
||||||
};
|
};
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
typedef int Socket;
|
typedef int Socket;
|
||||||
typedef struct sockaddr Address;
|
typedef struct sockaddr Address;
|
||||||
typedef socklen_t AddressLength;
|
typedef socklen_t AddressLength;
|
||||||
|
@ -80,9 +82,9 @@ public:
|
||||||
|
|
||||||
// getsockerror() constants
|
// getsockerror() constants
|
||||||
enum {
|
enum {
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
kEADDRINUSE = WSAEADDRINUSE,
|
kEADDRINUSE = WSAEADDRINUSE,
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
kEADDRINUSE = EADDRINUSE,
|
kEADDRINUSE = EADDRINUSE,
|
||||||
#endif
|
#endif
|
||||||
kNone = 0
|
kNone = 0
|
||||||
|
@ -90,12 +92,12 @@ public:
|
||||||
|
|
||||||
// gethosterror() constants
|
// gethosterror() constants
|
||||||
enum {
|
enum {
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
kHOST_NOT_FOUND = WSAHOST_NOT_FOUND,
|
kHOST_NOT_FOUND = WSAHOST_NOT_FOUND,
|
||||||
kNO_DATA = WSANO_DATA,
|
kNO_DATA = WSANO_DATA,
|
||||||
kNO_RECOVERY = WSANO_RECOVERY,
|
kNO_RECOVERY = WSANO_RECOVERY,
|
||||||
kTRY_AGAIN = WSATRY_AGAIN,
|
kTRY_AGAIN = WSATRY_AGAIN,
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
kHOST_NOT_FOUND = HOST_NOT_FOUND,
|
kHOST_NOT_FOUND = HOST_NOT_FOUND,
|
||||||
kNO_DATA = NO_DATA,
|
kNO_DATA = NO_DATA,
|
||||||
kNO_RECOVERY = NO_RECOVERY,
|
kNO_RECOVERY = NO_RECOVERY,
|
||||||
|
@ -137,7 +139,7 @@ public:
|
||||||
static int (PASCAL FAR *getsockerror)(void);
|
static int (PASCAL FAR *getsockerror)(void);
|
||||||
static int (PASCAL FAR *gethosterror)(void);
|
static int (PASCAL FAR *gethosterror)(void);
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
private:
|
private:
|
||||||
static void init2(HMODULE);
|
static void init2(HMODULE);
|
||||||
static int PASCAL FAR poll2(PollEntry[], int nfds, int timeout);
|
static int PASCAL FAR poll2(PollEntry[], int nfds, int timeout);
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
#include "CWin32Platform.cpp"
|
#include "CWin32Platform.cpp"
|
||||||
|
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
|
|
||||||
#include "CUnixPlatform.cpp"
|
#include "CUnixPlatform.cpp"
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error Unsupported platform
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,16 +3,20 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
#include "CWin32Platform.h"
|
#include "CWin32Platform.h"
|
||||||
typedef CWin32Platform CPlatform;
|
typedef CWin32Platform CPlatform;
|
||||||
|
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
|
|
||||||
#include "CUnixPlatform.h"
|
#include "CUnixPlatform.h"
|
||||||
typedef CUnixPlatform CPlatform;
|
typedef CUnixPlatform CPlatform;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error Unsupported platform
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,11 @@
|
||||||
#include "ClipboardTypes.h"
|
#include "ClipboardTypes.h"
|
||||||
#include "stdmap.h"
|
#include "stdmap.h"
|
||||||
#include "stdlist.h"
|
#include "stdlist.h"
|
||||||
|
#if defined(X_DISPLAY_MISSING)
|
||||||
|
# error X11 is required to build synergy
|
||||||
|
#else
|
||||||
# include <X11/Xlib.h>
|
# include <X11/Xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class CXWindowsClipboard : public IClipboard {
|
class CXWindowsClipboard : public IClipboard {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
|
|
||||||
#include "ClipboardTypes.h"
|
#include "ClipboardTypes.h"
|
||||||
#include "CMutex.h"
|
#include "CMutex.h"
|
||||||
|
#if defined(X_DISPLAY_MISSING)
|
||||||
|
# error X11 is required to build synergy
|
||||||
|
#else
|
||||||
# include <X11/Xlib.h>
|
# include <X11/Xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class IClipboard;
|
class IClipboard;
|
||||||
class CXWindowsClipboard;
|
class CXWindowsClipboard;
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
|
|
||||||
#include "CString.h"
|
#include "CString.h"
|
||||||
#include "BasicTypes.h"
|
#include "BasicTypes.h"
|
||||||
|
#if defined(X_DISPLAY_MISSING)
|
||||||
|
# error X11 is required to build synergy
|
||||||
|
#else
|
||||||
# include <X11/Xlib.h>
|
# include <X11/Xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class CXWindowsUtil {
|
class CXWindowsUtil {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1353,9 +1353,9 @@ CServer::updatePrimaryClipboard(ClipboardID id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME -- use factory to create screen
|
// FIXME -- use factory to create screen
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
#include "CMSWindowsPrimaryScreen.h"
|
#include "CMSWindowsPrimaryScreen.h"
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
#include "CXWindowsPrimaryScreen.h"
|
#include "CXWindowsPrimaryScreen.h"
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
|
@ -1377,9 +1377,9 @@ CServer::openPrimaryScreen()
|
||||||
|
|
||||||
// open screen
|
// open screen
|
||||||
log((CLOG_DEBUG1 "creating primary screen"));
|
log((CLOG_DEBUG1 "creating primary screen"));
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
m_primary = new CMSWindowsPrimaryScreen;
|
m_primary = new CMSWindowsPrimaryScreen;
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
m_primary = new CXWindowsPrimaryScreen;
|
m_primary = new CXWindowsPrimaryScreen;
|
||||||
#endif
|
#endif
|
||||||
log((CLOG_DEBUG1 "opening primary screen"));
|
log((CLOG_DEBUG1 "opening primary screen"));
|
||||||
|
|
|
@ -2,18 +2,19 @@
|
||||||
#define CSYNERGYHOOK_H
|
#define CSYNERGYHOOK_H
|
||||||
|
|
||||||
#include "BasicTypes.h"
|
#include "BasicTypes.h"
|
||||||
|
|
||||||
|
#if WINDOWS_LIKE
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#error CSynergyHook is a win32 specific file
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
|
||||||
#if defined(SYNRGYHK_EXPORTS)
|
#if defined(SYNRGYHK_EXPORTS)
|
||||||
#define CSYNERGYHOOK_API __declspec(dllexport)
|
#define CSYNERGYHOOK_API __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define CSYNERGYHOOK_API __declspec(dllimport)
|
#define CSYNERGYHOOK_API __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
#define CSYNERGYHOOK_API
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SYNERGY_MSG_MARK WM_APP + 0x0011 // mark id; <unused>
|
#define SYNERGY_MSG_MARK WM_APP + 0x0011 // mark id; <unused>
|
||||||
#define SYNERGY_MSG_KEY WM_APP + 0x0012 // vk code; key data
|
#define SYNERGY_MSG_KEY WM_APP + 0x0012 // vk code; key data
|
||||||
|
|
|
@ -5,10 +5,14 @@
|
||||||
#include "CThread.h"
|
#include "CThread.h"
|
||||||
#include "CLog.h"
|
#include "CLog.h"
|
||||||
#include "CStopwatch.h"
|
#include "CStopwatch.h"
|
||||||
|
#if defined(X_DISPLAY_MISSING)
|
||||||
|
# error X11 is required to build synergy
|
||||||
|
#else
|
||||||
# include <X11/X.h>
|
# include <X11/X.h>
|
||||||
# include <X11/Xutil.h>
|
# include <X11/Xutil.h>
|
||||||
# define XK_MISCELLANY
|
# define XK_MISCELLANY
|
||||||
# include <X11/keysymdef.h>
|
# include <X11/keysymdef.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// CXWindowsPrimaryScreen
|
// CXWindowsPrimaryScreen
|
||||||
|
|
|
@ -14,16 +14,16 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
// platform dependent name of a daemon
|
// platform dependent name of a daemon
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
#define DAEMON_NAME "Synergy Server"
|
#define DAEMON_NAME "Synergy Server"
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
#define DAEMON_NAME "synergyd"
|
#define DAEMON_NAME "synergyd"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// configuration file name
|
// configuration file name
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
#define CONFIG_NAME "synergy.sgc"
|
#define CONFIG_NAME "synergy.sgc"
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
#define CONFIG_NAME "synergy.conf"
|
#define CONFIG_NAME "synergy.conf"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
static const char* pname = NULL;
|
static const char* pname = NULL;
|
||||||
static bool s_restartable = true;
|
static bool s_restartable = true;
|
||||||
static bool s_daemon = true;
|
static bool s_daemon = true;
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
static bool s_install = false;
|
static bool s_install = false;
|
||||||
static bool s_uninstall = false;
|
static bool s_uninstall = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -209,7 +209,7 @@ static
|
||||||
void
|
void
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
# define PLATFORM_ARGS \
|
# define PLATFORM_ARGS \
|
||||||
" {--daemon|--no-daemon}" \
|
" {--daemon|--no-daemon}" \
|
||||||
|
@ -398,7 +398,7 @@ parse(int argc, const char** argv)
|
||||||
bye(0);
|
bye(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
else if (isArg(i, argc, argv, NULL, "--install")) {
|
else if (isArg(i, argc, argv, NULL, "--install")) {
|
||||||
s_install = true;
|
s_install = true;
|
||||||
if (s_uninstall) {
|
if (s_uninstall) {
|
||||||
|
@ -410,7 +410,7 @@ parse(int argc, const char** argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
else if (isArg(i, argc, argv, NULL, "--uninstall")) {
|
else if (isArg(i, argc, argv, NULL, "--uninstall")) {
|
||||||
s_uninstall = true;
|
s_uninstall = true;
|
||||||
if (s_install) {
|
if (s_install) {
|
||||||
|
@ -450,7 +450,7 @@ parse(int argc, const char** argv)
|
||||||
// increase default filter level for daemon. the user must
|
// increase default filter level for daemon. the user must
|
||||||
// explicitly request another level for a daemon.
|
// explicitly request another level for a daemon.
|
||||||
if (s_daemon && s_logFilter == NULL) {
|
if (s_daemon && s_logFilter == NULL) {
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
if (CPlatform::isWindows95Family()) {
|
if (CPlatform::isWindows95Family()) {
|
||||||
// windows 95 has no place for logging so avoid showing
|
// windows 95 has no place for logging so avoid showing
|
||||||
// the log console window.
|
// the log console window.
|
||||||
|
@ -541,7 +541,7 @@ loadConfig()
|
||||||
// platform dependent entry points
|
// platform dependent entry points
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if WINDOWS_LIKE
|
||||||
|
|
||||||
#include "CMSWindowsScreen.h"
|
#include "CMSWindowsScreen.h"
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif UNIX_LIKE
|
||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "BasicTypes.h"
|
#include "BasicTypes.h"
|
||||||
#include "XIO.h"
|
#include "XIO.h"
|
||||||
#include <cstdarg>
|
#include <stdarg.h>
|
||||||
|
|
||||||
class IInputStream;
|
class IInputStream;
|
||||||
class IOutputStream;
|
class IOutputStream;
|
||||||
|
|
Loading…
Reference in New Issue