Added -display option for X11 version.
This commit is contained in:
parent
f10ef9a97c
commit
2513ae8972
|
@ -79,6 +79,7 @@ public:
|
||||||
m_restartable(true),
|
m_restartable(true),
|
||||||
m_daemon(true),
|
m_daemon(true),
|
||||||
m_logFilter(NULL),
|
m_logFilter(NULL),
|
||||||
|
m_display(NULL),
|
||||||
m_serverAddress(NULL)
|
m_serverAddress(NULL)
|
||||||
{ s_instance = this; }
|
{ s_instance = this; }
|
||||||
~CArgs() { s_instance = NULL; }
|
~CArgs() { s_instance = NULL; }
|
||||||
|
@ -90,6 +91,7 @@ public:
|
||||||
bool m_restartable;
|
bool m_restartable;
|
||||||
bool m_daemon;
|
bool m_daemon;
|
||||||
const char* m_logFilter;
|
const char* m_logFilter;
|
||||||
|
const char* m_display;
|
||||||
CString m_name;
|
CString m_name;
|
||||||
CNetworkAddress* m_serverAddress;
|
CNetworkAddress* m_serverAddress;
|
||||||
};
|
};
|
||||||
|
@ -110,7 +112,7 @@ createScreen()
|
||||||
new CFunctionJob(&handleSystemSuspend),
|
new CFunctionJob(&handleSystemSuspend),
|
||||||
new CFunctionJob(&handleSystemResume)));
|
new CFunctionJob(&handleSystemResume)));
|
||||||
#elif WINAPI_XWINDOWS
|
#elif WINAPI_XWINDOWS
|
||||||
return new CScreen(new CXWindowsScreen(false));
|
return new CScreen(new CXWindowsScreen(ARG->m_display, false));
|
||||||
#elif WINAPI_CARBON
|
#elif WINAPI_CARBON
|
||||||
return new CScreen(new COSXScreen(false));
|
return new CScreen(new COSXScreen(false));
|
||||||
#endif
|
#endif
|
||||||
|
@ -521,19 +523,31 @@ static
|
||||||
void
|
void
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
|
#if WINAPI_XWINDOWS
|
||||||
|
# define USAGE_DISPLAY_ARG \
|
||||||
|
" [--display <display>]"
|
||||||
|
# define USAGE_DISPLAY_INFO \
|
||||||
|
" --display <display> connect to the X server at <display>\n"
|
||||||
|
#else
|
||||||
|
# define USAGE_DISPLAY_ARG
|
||||||
|
# define USAGE_DISPLAY_INFO
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG((CLOG_PRINT
|
LOG((CLOG_PRINT
|
||||||
"Usage: %s"
|
"Usage: %s"
|
||||||
" [--daemon|--no-daemon]"
|
" [--daemon|--no-daemon]"
|
||||||
" [--debug <level>]"
|
" [--debug <level>]"
|
||||||
|
USAGE_DISPLAY_ARG
|
||||||
" [--name <screen-name>]"
|
" [--name <screen-name>]"
|
||||||
" [--restart|--no-restart]"
|
" [--restart|--no-restart]"
|
||||||
" <server-address>\n"
|
" <server-address>"
|
||||||
"\n"
|
"\n\n"
|
||||||
"Start the synergy mouse/keyboard sharing server.\n"
|
"Start the synergy mouse/keyboard sharing server.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" -d, --debug <level> filter out log messages with priorty below level.\n"
|
" -d, --debug <level> filter out log messages with priorty below level.\n"
|
||||||
" level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n"
|
" level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n"
|
||||||
" DEBUG, DEBUG1, DEBUG2.\n"
|
" DEBUG, DEBUG1, DEBUG2.\n"
|
||||||
|
USAGE_DISPLAY_INFO
|
||||||
" -f, --no-daemon run the client in the foreground.\n"
|
" -f, --no-daemon run the client in the foreground.\n"
|
||||||
"* --daemon run the client as a daemon.\n"
|
"* --daemon run the client as a daemon.\n"
|
||||||
" -n, --name <screen-name> use screen-name instead the hostname to identify\n"
|
" -n, --name <screen-name> use screen-name instead the hostname to identify\n"
|
||||||
|
@ -619,6 +633,13 @@ parse(int argc, const char* const* argv)
|
||||||
ARG->m_daemon = true;
|
ARG->m_daemon = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WINAPI_XWINDOWS
|
||||||
|
else if (isArg(i, argc, argv, "-display", "--display", 1)) {
|
||||||
|
// use alternative display
|
||||||
|
ARG->m_display = argv[++i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
else if (isArg(i, argc, argv, "-1", "--no-restart")) {
|
else if (isArg(i, argc, argv, "-1", "--no-restart")) {
|
||||||
// don't try to restart
|
// don't try to restart
|
||||||
ARG->m_restartable = false;
|
ARG->m_restartable = false;
|
||||||
|
|
|
@ -88,7 +88,10 @@ public:
|
||||||
m_restartable(true),
|
m_restartable(true),
|
||||||
m_daemon(true),
|
m_daemon(true),
|
||||||
m_configFile(),
|
m_configFile(),
|
||||||
m_logFilter(NULL)
|
m_logFilter(NULL),
|
||||||
|
m_display(NULL),
|
||||||
|
m_synergyAddress(NULL),
|
||||||
|
m_config(NULL)
|
||||||
{ s_instance = this; }
|
{ s_instance = this; }
|
||||||
~CArgs() { s_instance = NULL; }
|
~CArgs() { s_instance = NULL; }
|
||||||
|
|
||||||
|
@ -100,6 +103,7 @@ public:
|
||||||
bool m_daemon;
|
bool m_daemon;
|
||||||
CString m_configFile;
|
CString m_configFile;
|
||||||
const char* m_logFilter;
|
const char* m_logFilter;
|
||||||
|
const char* m_display;
|
||||||
CString m_name;
|
CString m_name;
|
||||||
CNetworkAddress* m_synergyAddress;
|
CNetworkAddress* m_synergyAddress;
|
||||||
CConfig* m_config;
|
CConfig* m_config;
|
||||||
|
@ -119,7 +123,7 @@ createScreen()
|
||||||
#if WINAPI_MSWINDOWS
|
#if WINAPI_MSWINDOWS
|
||||||
return new CScreen(new CMSWindowsScreen(true, NULL, NULL));
|
return new CScreen(new CMSWindowsScreen(true, NULL, NULL));
|
||||||
#elif WINAPI_XWINDOWS
|
#elif WINAPI_XWINDOWS
|
||||||
return new CScreen(new CXWindowsScreen(true));
|
return new CScreen(new CXWindowsScreen(ARG->m_display, true));
|
||||||
#elif WINAPI_CARBON
|
#elif WINAPI_CARBON
|
||||||
return new CScreen(new COSXScreen(true));
|
return new CScreen(new COSXScreen(true));
|
||||||
#endif
|
#endif
|
||||||
|
@ -613,10 +617,20 @@ static
|
||||||
void
|
void
|
||||||
help()
|
help()
|
||||||
{
|
{
|
||||||
|
#if WINAPI_XWINDOWS
|
||||||
|
# define USAGE_DISPLAY_ARG \
|
||||||
|
" [--display <display>]"
|
||||||
|
# define USAGE_DISPLAY_INFO \
|
||||||
|
" --display <display> connect to the X server at <display>\n"
|
||||||
|
#else
|
||||||
|
# define USAGE_DISPLAY_ARG
|
||||||
|
# define USAGE_DISPLAY_INFO
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
|
|
||||||
# define PLATFORM_ARGS \
|
# define PLATFORM_ARGS \
|
||||||
" {--daemon|--no-daemon}"
|
" [--daemon|--no-daemon]"
|
||||||
# define PLATFORM_DESC
|
# define PLATFORM_DESC
|
||||||
# define PLATFORM_EXTRA \
|
# define PLATFORM_EXTRA \
|
||||||
"At least one command line argument is required. If you don't otherwise\n" \
|
"At least one command line argument is required. If you don't otherwise\n" \
|
||||||
|
@ -637,10 +651,11 @@ help()
|
||||||
" [--address <address>]"
|
" [--address <address>]"
|
||||||
" [--config <pathname>]"
|
" [--config <pathname>]"
|
||||||
" [--debug <level>]"
|
" [--debug <level>]"
|
||||||
|
USAGE_DISPLAY_ARG
|
||||||
" [--name <screen-name>]"
|
" [--name <screen-name>]"
|
||||||
" [--restart|--no-restart]\n"
|
" [--restart|--no-restart]"
|
||||||
PLATFORM_ARGS
|
PLATFORM_ARGS
|
||||||
"\n"
|
"\n\n"
|
||||||
"Start the synergy mouse/keyboard sharing server.\n"
|
"Start the synergy mouse/keyboard sharing server.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" -a, --address <address> listen for clients on the given address.\n"
|
" -a, --address <address> listen for clients on the given address.\n"
|
||||||
|
@ -648,6 +663,7 @@ PLATFORM_ARGS
|
||||||
" -d, --debug <level> filter out log messages with priorty below level.\n"
|
" -d, --debug <level> filter out log messages with priorty below level.\n"
|
||||||
" level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n"
|
" level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n"
|
||||||
" DEBUG, DEBUG1, DEBUG2.\n"
|
" DEBUG, DEBUG1, DEBUG2.\n"
|
||||||
|
USAGE_DISPLAY_INFO
|
||||||
" -f, --no-daemon run the server in the foreground.\n"
|
" -f, --no-daemon run the server in the foreground.\n"
|
||||||
"* --daemon run the server as a daemon.\n"
|
"* --daemon run the server as a daemon.\n"
|
||||||
" -n, --name <screen-name> use screen-name instead the hostname to identify\n"
|
" -n, --name <screen-name> use screen-name instead the hostname to identify\n"
|
||||||
|
@ -750,6 +766,13 @@ parse(int argc, const char* const* argv)
|
||||||
ARG->m_configFile = argv[++i];
|
ARG->m_configFile = argv[++i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WINAPI_XWINDOWS
|
||||||
|
else if (isArg(i, argc, argv, "-display", "--display", 1)) {
|
||||||
|
// use alternative display
|
||||||
|
ARG->m_display = argv[++i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
else if (isArg(i, argc, argv, "-f", "--no-daemon")) {
|
else if (isArg(i, argc, argv, "-f", "--no-daemon")) {
|
||||||
// not a daemon
|
// not a daemon
|
||||||
ARG->m_daemon = false;
|
ARG->m_daemon = false;
|
||||||
|
|
|
@ -103,7 +103,7 @@ static const KeySym g_map1008FF[] =
|
||||||
|
|
||||||
CXWindowsScreen* CXWindowsScreen::s_screen = NULL;
|
CXWindowsScreen* CXWindowsScreen::s_screen = NULL;
|
||||||
|
|
||||||
CXWindowsScreen::CXWindowsScreen(bool isPrimary) :
|
CXWindowsScreen::CXWindowsScreen(const char* displayName, bool isPrimary) :
|
||||||
m_isPrimary(isPrimary),
|
m_isPrimary(isPrimary),
|
||||||
m_display(NULL),
|
m_display(NULL),
|
||||||
m_root(None),
|
m_root(None),
|
||||||
|
@ -132,7 +132,7 @@ CXWindowsScreen::CXWindowsScreen(bool isPrimary) :
|
||||||
XSetIOErrorHandler(&CXWindowsScreen::ioErrorHandler);
|
XSetIOErrorHandler(&CXWindowsScreen::ioErrorHandler);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
m_display = openDisplay();
|
m_display = openDisplay(displayName);
|
||||||
m_root = DefaultRootWindow(m_display);
|
m_root = DefaultRootWindow(m_display);
|
||||||
saveShape();
|
saveShape();
|
||||||
m_window = openWindow();
|
m_window = openWindow();
|
||||||
|
@ -599,13 +599,15 @@ CXWindowsScreen::fakeMouseWheel(SInt32 delta) const
|
||||||
}
|
}
|
||||||
|
|
||||||
Display*
|
Display*
|
||||||
CXWindowsScreen::openDisplay() const
|
CXWindowsScreen::openDisplay(const char* displayName) const
|
||||||
{
|
{
|
||||||
// get the DISPLAY
|
// get the DISPLAY
|
||||||
const char* displayName = getenv("DISPLAY");
|
if (displayName == NULL) {
|
||||||
|
displayName = getenv("DISPLAY");
|
||||||
if (displayName == NULL) {
|
if (displayName == NULL) {
|
||||||
displayName = ":0.0";
|
displayName = ":0.0";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// open the display
|
// open the display
|
||||||
LOG((CLOG_DEBUG "XOpenDisplay(\"%s\")", displayName));
|
LOG((CLOG_DEBUG "XOpenDisplay(\"%s\")", displayName));
|
||||||
|
|
|
@ -30,7 +30,7 @@ class CXWindowsScreenSaver;
|
||||||
//! Implementation of IPlatformScreen for X11
|
//! Implementation of IPlatformScreen for X11
|
||||||
class CXWindowsScreen : public CPlatformScreen {
|
class CXWindowsScreen : public CPlatformScreen {
|
||||||
public:
|
public:
|
||||||
CXWindowsScreen(bool isPrimary);
|
CXWindowsScreen(const char* displayName, bool isPrimary);
|
||||||
virtual ~CXWindowsScreen();
|
virtual ~CXWindowsScreen();
|
||||||
|
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
|
@ -111,7 +111,7 @@ private:
|
||||||
KeyCode m_keycode;
|
KeyCode m_keycode;
|
||||||
};
|
};
|
||||||
|
|
||||||
Display* openDisplay() const;
|
Display* openDisplay(const char* displayName) const;
|
||||||
void saveShape();
|
void saveShape();
|
||||||
Window openWindow() const;
|
Window openWindow() const;
|
||||||
void openIM();
|
void openIM();
|
||||||
|
|
Loading…
Reference in New Issue