Added more debug levels and moved some annoying debug messages
to those levels. Default log level is now DEBUG for debug builds and INFO for release builds.
This commit is contained in:
parent
9ac0473d5a
commit
d1ca5295d1
|
@ -18,6 +18,8 @@ static const char* g_priority[] = {
|
||||||
"NOTE",
|
"NOTE",
|
||||||
"INFO",
|
"INFO",
|
||||||
"DEBUG",
|
"DEBUG",
|
||||||
|
"DEBUG1",
|
||||||
|
"DEBUG2"
|
||||||
};
|
};
|
||||||
static const int g_numPriority = (int)(sizeof(g_priority) /
|
static const int g_numPriority = (int)(sizeof(g_priority) /
|
||||||
sizeof(g_priority[0]));
|
sizeof(g_priority[0]));
|
||||||
|
@ -108,7 +110,11 @@ void CLog::output(int priority, char* msg)
|
||||||
assert(msg != 0);
|
assert(msg != 0);
|
||||||
|
|
||||||
if (g_maxPriority == -1) {
|
if (g_maxPriority == -1) {
|
||||||
g_maxPriority = g_numPriority - 1;
|
#if defined(NDEBUG)
|
||||||
|
g_maxPriority = 4;
|
||||||
|
#else
|
||||||
|
g_maxPriority = 5;
|
||||||
|
#endif
|
||||||
const char* priEnv = getenv("SYN_LOG_PRI");
|
const char* priEnv = getenv("SYN_LOG_PRI");
|
||||||
if (priEnv != NULL) {
|
if (priEnv != NULL) {
|
||||||
for (int i = 0; i < g_numPriority; ++i)
|
for (int i = 0; i < g_numPriority; ++i)
|
||||||
|
|
|
@ -40,5 +40,7 @@ class CLog {
|
||||||
#define CLOG_NOTE CLOG_TRACE "%z\063"
|
#define CLOG_NOTE CLOG_TRACE "%z\063"
|
||||||
#define CLOG_INFO CLOG_TRACE "%z\064"
|
#define CLOG_INFO CLOG_TRACE "%z\064"
|
||||||
#define CLOG_DEBUG CLOG_TRACE "%z\065"
|
#define CLOG_DEBUG CLOG_TRACE "%z\065"
|
||||||
|
#define CLOG_DEBUG1 CLOG_TRACE "%z\066"
|
||||||
|
#define CLOG_DEBUG2 CLOG_TRACE "%z\067"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -58,7 +58,7 @@ void CClient::run(const CNetworkAddress& serverAddress)
|
||||||
m_screen->run();
|
m_screen->run();
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
log((CLOG_DEBUG "stopping client"));
|
log((CLOG_NOTE "stopping client"));
|
||||||
thread->cancel();
|
thread->cancel();
|
||||||
thread->wait();
|
thread->wait();
|
||||||
delete thread;
|
delete thread;
|
||||||
|
@ -109,7 +109,7 @@ void CClient::runSession(void*)
|
||||||
CTimerThread timer(30.0); // FIXME -- timeout in member
|
CTimerThread timer(30.0); // FIXME -- timeout in member
|
||||||
|
|
||||||
// create socket and attempt to connect to server
|
// create socket and attempt to connect to server
|
||||||
log((CLOG_DEBUG "connecting to server"));
|
log((CLOG_DEBUG1 "connecting to server"));
|
||||||
assign(socket, new CTCPSocket(), ISocket); // FIXME -- use factory
|
assign(socket, new CTCPSocket(), ISocket); // FIXME -- use factory
|
||||||
socket->connect(*m_serverAddress);
|
socket->connect(*m_serverAddress);
|
||||||
log((CLOG_INFO "connected to server"));
|
log((CLOG_INFO "connected to server"));
|
||||||
|
@ -135,19 +135,19 @@ void CClient::runSession(void*)
|
||||||
assign(output, new COutputPacketStream(srcOutput, own), IOutputStream);
|
assign(output, new COutputPacketStream(srcOutput, own), IOutputStream);
|
||||||
|
|
||||||
// wait for hello from server
|
// wait for hello from server
|
||||||
log((CLOG_DEBUG "wait for hello"));
|
log((CLOG_DEBUG1 "wait for hello"));
|
||||||
SInt32 major, minor;
|
SInt16 major, minor;
|
||||||
CProtocolUtil::readf(input.get(), "Synergy%2i%2i", &major, &minor);
|
CProtocolUtil::readf(input.get(), "Synergy%2i%2i", &major, &minor);
|
||||||
|
|
||||||
// check versions
|
// check versions
|
||||||
log((CLOG_DEBUG "got hello version %d.%d", major, minor));
|
log((CLOG_DEBUG1 "got hello version %d.%d", major, minor));
|
||||||
if (major < kMajorVersion ||
|
if (major < kMajorVersion ||
|
||||||
(major == kMajorVersion && minor < kMinorVersion)) {
|
(major == kMajorVersion && minor < kMinorVersion)) {
|
||||||
throw XIncompatibleClient(major, minor);
|
throw XIncompatibleClient(major, minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// say hello back
|
// say hello back
|
||||||
log((CLOG_DEBUG "say hello version %d.%d", kMajorVersion, kMinorVersion));
|
log((CLOG_DEBUG1 "say hello version %d.%d", kMajorVersion, kMinorVersion));
|
||||||
CProtocolUtil::writef(output.get(), "Synergy%2i%2i%s",
|
CProtocolUtil::writef(output.get(), "Synergy%2i%2i%s",
|
||||||
kMajorVersion, kMinorVersion, &m_name);
|
kMajorVersion, kMinorVersion, &m_name);
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ void CClient::runSession(void*)
|
||||||
// handle messages from server
|
// handle messages from server
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// wait for reply
|
// wait for reply
|
||||||
log((CLOG_DEBUG "waiting for message"));
|
log((CLOG_DEBUG1 "waiting for message"));
|
||||||
UInt8 code[4];
|
UInt8 code[4];
|
||||||
UInt32 n = input->read(code, 4);
|
UInt32 n = input->read(code, 4);
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ void CClient::runSession(void*)
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse message
|
// parse message
|
||||||
log((CLOG_DEBUG "msg from server: %c%c%c%c", code[0], code[1], code[2], code[3]));
|
log((CLOG_DEBUG2 "msg from server: %c%c%c%c", code[0], code[1], code[2], code[3]));
|
||||||
if (memcmp(code, kMsgDMouseMove, 4) == 0) {
|
if (memcmp(code, kMsgDMouseMove, 4) == 0) {
|
||||||
onMouseMove();
|
onMouseMove();
|
||||||
}
|
}
|
||||||
|
@ -272,13 +272,13 @@ void CClient::openSecondaryScreen()
|
||||||
assert(m_screen == NULL);
|
assert(m_screen == NULL);
|
||||||
|
|
||||||
// open screen
|
// open screen
|
||||||
log((CLOG_DEBUG "creating secondary screen"));
|
log((CLOG_DEBUG1 "creating secondary screen"));
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if defined(CONFIG_PLATFORM_WIN32)
|
||||||
m_screen = new CMSWindowsSecondaryScreen;
|
m_screen = new CMSWindowsSecondaryScreen;
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif defined(CONFIG_PLATFORM_UNIX)
|
||||||
m_screen = new CXWindowsSecondaryScreen;
|
m_screen = new CXWindowsSecondaryScreen;
|
||||||
#endif
|
#endif
|
||||||
log((CLOG_DEBUG "opening secondary screen"));
|
log((CLOG_DEBUG1 "opening secondary screen"));
|
||||||
m_screen->open(this);
|
m_screen->open(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ void CClient::closeSecondaryScreen()
|
||||||
|
|
||||||
// close the secondary screen
|
// close the secondary screen
|
||||||
try {
|
try {
|
||||||
log((CLOG_DEBUG "closing secondary screen"));
|
log((CLOG_DEBUG1 "closing secondary screen"));
|
||||||
m_screen->close();
|
m_screen->close();
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
@ -296,7 +296,7 @@ void CClient::closeSecondaryScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
log((CLOG_DEBUG "destroying secondary screen"));
|
log((CLOG_DEBUG1 "destroying secondary screen"));
|
||||||
delete m_screen;
|
delete m_screen;
|
||||||
m_screen = NULL;
|
m_screen = NULL;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ void CClient::onQueryInfo()
|
||||||
m_screen->getSize(&w, &h);
|
m_screen->getSize(&w, &h);
|
||||||
SInt32 zoneSize = m_screen->getJumpZoneSize();
|
SInt32 zoneSize = m_screen->getJumpZoneSize();
|
||||||
|
|
||||||
log((CLOG_DEBUG "sending info size=%d,%d zone=%d", w, h, zoneSize));
|
log((CLOG_DEBUG1 "sending info size=%d,%d zone=%d", w, h, zoneSize));
|
||||||
CLock lock(&m_mutex);
|
CLock lock(&m_mutex);
|
||||||
CProtocolUtil::writef(m_output, kMsgDInfo, w, h, zoneSize);
|
CProtocolUtil::writef(m_output, kMsgDInfo, w, h, zoneSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ void CThread::sleep(double timeout)
|
||||||
void CThread::exit(void* result)
|
void CThread::exit(void* result)
|
||||||
{
|
{
|
||||||
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
|
CThreadPtr currentRep(CThreadRep::getCurrentThreadRep());
|
||||||
log((CLOG_DEBUG "throw exit on thread %p", currentRep.operator->()));
|
log((CLOG_DEBUG1 "throw exit on thread %p", currentRep.operator->()));
|
||||||
throw XThreadExit(result);
|
throw XThreadExit(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,16 +264,16 @@ void CThreadRep::doThreadFunc()
|
||||||
|
|
||||||
catch (XThreadCancel&) {
|
catch (XThreadCancel&) {
|
||||||
// client called cancel()
|
// client called cancel()
|
||||||
log((CLOG_DEBUG "caught cancel on thread %p", this));
|
log((CLOG_DEBUG1 "caught cancel on thread %p", this));
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (XThreadExit& e) {
|
catch (XThreadExit& e) {
|
||||||
// client called exit()
|
// client called exit()
|
||||||
result = e.m_result;
|
result = e.m_result;
|
||||||
log((CLOG_DEBUG "caught exit on thread %p", this));
|
log((CLOG_DEBUG1 "caught exit on thread %p", this));
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
log((CLOG_DEBUG "exception on thread %p", this));
|
log((CLOG_DEBUG1 "exception on thread %p", this));
|
||||||
// note -- don't catch (...) to avoid masking bugs
|
// note -- don't catch (...) to avoid masking bugs
|
||||||
delete m_job;
|
delete m_job;
|
||||||
throw;
|
throw;
|
||||||
|
@ -331,7 +331,7 @@ void CThreadRep::cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
// break out of system calls
|
// break out of system calls
|
||||||
log((CLOG_DEBUG "cancel thread %p", this));
|
log((CLOG_DEBUG1 "cancel thread %p", this));
|
||||||
pthread_kill(m_thread, SIGWAKEUP);
|
pthread_kill(m_thread, SIGWAKEUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ void CThreadRep::testCancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
// start cancel
|
// start cancel
|
||||||
log((CLOG_DEBUG "throw cancel on thread %p", this));
|
log((CLOG_DEBUG1 "throw cancel on thread %p", this));
|
||||||
throw XThreadCancel();
|
throw XThreadCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ void CThreadRep::sleep(double timeout)
|
||||||
|
|
||||||
void CThreadRep::cancel()
|
void CThreadRep::cancel()
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "cancel thread %p", this));
|
log((CLOG_DEBUG1 "cancel thread %p", this));
|
||||||
SetEvent(m_cancel);
|
SetEvent(m_cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ void CThreadRep::testCancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
// start cancel
|
// start cancel
|
||||||
log((CLOG_DEBUG "throw cancel on thread %p", this));
|
log((CLOG_DEBUG1 "throw cancel on thread %p", this));
|
||||||
throw XThreadCancel();
|
throw XThreadCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,19 +18,19 @@ CTimerThread::CTimerThread(double timeout) : m_timeout(timeout)
|
||||||
|
|
||||||
CTimerThread::~CTimerThread()
|
CTimerThread::~CTimerThread()
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "cancelling timeout"));
|
log((CLOG_DEBUG1 "cancelling timeout"));
|
||||||
m_timingThread->cancel();
|
m_timingThread->cancel();
|
||||||
m_timingThread->wait();
|
m_timingThread->wait();
|
||||||
log((CLOG_DEBUG "cancelled timeout"));
|
log((CLOG_DEBUG1 "cancelled timeout"));
|
||||||
delete m_timingThread;
|
delete m_timingThread;
|
||||||
delete m_callingThread;
|
delete m_callingThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTimerThread::timer(void*)
|
void CTimerThread::timer(void*)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "timeout in %f seconds", m_timeout));
|
log((CLOG_DEBUG1 "timeout in %f seconds", m_timeout));
|
||||||
CThread::sleep(m_timeout);
|
CThread::sleep(m_timeout);
|
||||||
log((CLOG_DEBUG "timeout"));
|
log((CLOG_DEBUG1 "timeout"));
|
||||||
m_callingThread->cancel();
|
m_callingThread->cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ void CNetwork::init()
|
||||||
// try winsock 2
|
// try winsock 2
|
||||||
HMODULE module = (HMODULE)::LoadLibrary("ws2_32.dll");
|
HMODULE module = (HMODULE)::LoadLibrary("ws2_32.dll");
|
||||||
if (module == NULL) {
|
if (module == NULL) {
|
||||||
log((CLOG_DEBUG "ws2_32.dll not found"));
|
log((CLOG_NOTE "ws2_32.dll not found"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
|
@ -79,14 +79,14 @@ void CNetwork::init()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (XNetwork& e) {
|
catch (XNetwork& e) {
|
||||||
log((CLOG_DEBUG "ws2_32.dll error: %s", e.what()));
|
log((CLOG_NOTE "ws2_32.dll error: %s", e.what()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// try winsock 1
|
// try winsock 1
|
||||||
module = (HMODULE)::LoadLibrary("wsock32.dll");
|
module = (HMODULE)::LoadLibrary("wsock32.dll");
|
||||||
if (module == NULL) {
|
if (module == NULL) {
|
||||||
log((CLOG_DEBUG "wsock32.dll not found"));
|
log((CLOG_NOTE "wsock32.dll not found"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
|
@ -94,7 +94,7 @@ void CNetwork::init()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (XNetwork& e) {
|
catch (XNetwork& e) {
|
||||||
log((CLOG_DEBUG "wsock32.dll error: %s", e.what()));
|
log((CLOG_NOTE "wsock32.dll error: %s", e.what()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ void CServer::run()
|
||||||
m_primary->run();
|
m_primary->run();
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
log((CLOG_DEBUG "stopping server"));
|
log((CLOG_NOTE "stopping server"));
|
||||||
cleanupThreads();
|
cleanupThreads();
|
||||||
closePrimaryScreen();
|
closePrimaryScreen();
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ bool CServer::onCommandKey(KeyID /*id*/,
|
||||||
|
|
||||||
void CServer::onKeyDown(KeyID id, KeyModifierMask mask)
|
void CServer::onKeyDown(KeyID id, KeyModifierMask mask)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "onKeyDown id=%d mask=0x%04x", id, mask));
|
log((CLOG_DEBUG1 "onKeyDown id=%d mask=0x%04x", id, mask));
|
||||||
assert(m_active != NULL);
|
assert(m_active != NULL);
|
||||||
|
|
||||||
// handle command keys
|
// handle command keys
|
||||||
|
@ -264,7 +264,7 @@ void CServer::onKeyDown(KeyID id, KeyModifierMask mask)
|
||||||
|
|
||||||
void CServer::onKeyUp(KeyID id, KeyModifierMask mask)
|
void CServer::onKeyUp(KeyID id, KeyModifierMask mask)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "onKeyUp id=%d mask=0x%04x", id, mask));
|
log((CLOG_DEBUG1 "onKeyUp id=%d mask=0x%04x", id, mask));
|
||||||
assert(m_active != NULL);
|
assert(m_active != NULL);
|
||||||
|
|
||||||
// handle command keys
|
// handle command keys
|
||||||
|
@ -281,7 +281,7 @@ void CServer::onKeyUp(KeyID id, KeyModifierMask mask)
|
||||||
void CServer::onKeyRepeat(
|
void CServer::onKeyRepeat(
|
||||||
KeyID id, KeyModifierMask mask, SInt32 count)
|
KeyID id, KeyModifierMask mask, SInt32 count)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "onKeyRepeat id=%d mask=0x%04x count=%d", id, mask, count));
|
log((CLOG_DEBUG1 "onKeyRepeat id=%d mask=0x%04x count=%d", id, mask, count));
|
||||||
assert(m_active != NULL);
|
assert(m_active != NULL);
|
||||||
|
|
||||||
// handle command keys
|
// handle command keys
|
||||||
|
@ -298,7 +298,7 @@ void CServer::onKeyRepeat(
|
||||||
|
|
||||||
void CServer::onMouseDown(ButtonID id)
|
void CServer::onMouseDown(ButtonID id)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "onMouseDown id=%d", id));
|
log((CLOG_DEBUG1 "onMouseDown id=%d", id));
|
||||||
assert(m_active != NULL);
|
assert(m_active != NULL);
|
||||||
|
|
||||||
// relay
|
// relay
|
||||||
|
@ -309,7 +309,7 @@ void CServer::onMouseDown(ButtonID id)
|
||||||
|
|
||||||
void CServer::onMouseUp(ButtonID id)
|
void CServer::onMouseUp(ButtonID id)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "onMouseUp id=%d", id));
|
log((CLOG_DEBUG1 "onMouseUp id=%d", id));
|
||||||
assert(m_active != NULL);
|
assert(m_active != NULL);
|
||||||
|
|
||||||
// relay
|
// relay
|
||||||
|
@ -320,7 +320,7 @@ void CServer::onMouseUp(ButtonID id)
|
||||||
|
|
||||||
bool CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
bool CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||||
{
|
{
|
||||||
// log((CLOG_DEBUG "onMouseMovePrimary %d,%d", x, y));
|
log((CLOG_DEBUG2 "onMouseMovePrimary %d,%d", x, y));
|
||||||
|
|
||||||
// mouse move on primary (server's) screen
|
// mouse move on primary (server's) screen
|
||||||
assert(m_active != NULL);
|
assert(m_active != NULL);
|
||||||
|
@ -336,22 +336,22 @@ bool CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||||
if (x < m_active->m_zoneSize) {
|
if (x < m_active->m_zoneSize) {
|
||||||
x -= m_active->m_zoneSize;
|
x -= m_active->m_zoneSize;
|
||||||
dir = CScreenMap::kLeft;
|
dir = CScreenMap::kLeft;
|
||||||
log((CLOG_DEBUG "switch to left"));
|
log((CLOG_DEBUG1 "switch to left"));
|
||||||
}
|
}
|
||||||
else if (x >= m_active->m_width - m_active->m_zoneSize) {
|
else if (x >= m_active->m_width - m_active->m_zoneSize) {
|
||||||
x += m_active->m_zoneSize;
|
x += m_active->m_zoneSize;
|
||||||
dir = CScreenMap::kRight;
|
dir = CScreenMap::kRight;
|
||||||
log((CLOG_DEBUG "switch to right"));
|
log((CLOG_DEBUG1 "switch to right"));
|
||||||
}
|
}
|
||||||
else if (y < m_active->m_zoneSize) {
|
else if (y < m_active->m_zoneSize) {
|
||||||
y -= m_active->m_zoneSize;
|
y -= m_active->m_zoneSize;
|
||||||
dir = CScreenMap::kTop;
|
dir = CScreenMap::kTop;
|
||||||
log((CLOG_DEBUG "switch to top"));
|
log((CLOG_DEBUG1 "switch to top"));
|
||||||
}
|
}
|
||||||
else if (y >= m_active->m_height - m_active->m_zoneSize) {
|
else if (y >= m_active->m_height - m_active->m_zoneSize) {
|
||||||
y += m_active->m_zoneSize;
|
y += m_active->m_zoneSize;
|
||||||
dir = CScreenMap::kBottom;
|
dir = CScreenMap::kBottom;
|
||||||
log((CLOG_DEBUG "switch to bottom"));
|
log((CLOG_DEBUG1 "switch to bottom"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// still on local screen
|
// still on local screen
|
||||||
|
@ -376,7 +376,7 @@ bool CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||||
|
|
||||||
void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
|
void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "onMouseMoveSecondary %+d,%+d", dx, dy));
|
log((CLOG_DEBUG1 "onMouseMoveSecondary %+d,%+d", dx, dy));
|
||||||
|
|
||||||
// mouse move on secondary (client's) screen
|
// mouse move on secondary (client's) screen
|
||||||
assert(m_active != NULL);
|
assert(m_active != NULL);
|
||||||
|
@ -409,7 +409,7 @@ void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
|
||||||
|
|
||||||
// get neighbor if we should switch
|
// get neighbor if we should switch
|
||||||
if (newScreen == NULL) {
|
if (newScreen == NULL) {
|
||||||
log((CLOG_DEBUG "leave \"%s\" on %s", m_active->m_name.c_str(), CScreenMap::dirName(dir)));
|
log((CLOG_DEBUG1 "leave \"%s\" on %s", m_active->m_name.c_str(), CScreenMap::dirName(dir)));
|
||||||
|
|
||||||
SInt32 x = m_x, y = m_y;
|
SInt32 x = m_x, y = m_y;
|
||||||
newScreen = getNeighbor(m_active, dir, x, y);
|
newScreen = getNeighbor(m_active, dir, x, y);
|
||||||
|
@ -421,7 +421,7 @@ void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
|
||||||
m_y = y;
|
m_y = y;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log((CLOG_DEBUG "no neighbor; clamping"));
|
log((CLOG_DEBUG1 "no neighbor; clamping"));
|
||||||
if (m_x < 0)
|
if (m_x < 0)
|
||||||
m_x = 0;
|
m_x = 0;
|
||||||
else if (m_x > m_active->m_width - 1)
|
else if (m_x > m_active->m_width - 1)
|
||||||
|
@ -435,7 +435,7 @@ void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// clamp to edge when locked
|
// clamp to edge when locked
|
||||||
log((CLOG_DEBUG "clamp to \"%s\"", m_active->m_name.c_str()));
|
log((CLOG_DEBUG1 "clamp to \"%s\"", m_active->m_name.c_str()));
|
||||||
if (m_x < 0)
|
if (m_x < 0)
|
||||||
m_x = 0;
|
m_x = 0;
|
||||||
else if (m_x > m_active->m_width - 1)
|
else if (m_x > m_active->m_width - 1)
|
||||||
|
@ -450,7 +450,7 @@ void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
|
||||||
if (newScreen == NULL || newScreen == m_active) {
|
if (newScreen == NULL || newScreen == m_active) {
|
||||||
// do nothing if mouse didn't move
|
// do nothing if mouse didn't move
|
||||||
if (m_x != xOld || m_y != yOld) {
|
if (m_x != xOld || m_y != yOld) {
|
||||||
log((CLOG_DEBUG "move on %s to %d,%d", m_active->m_name.c_str(), m_x, m_y));
|
log((CLOG_DEBUG1 "move on %s to %d,%d", m_active->m_name.c_str(), m_x, m_y));
|
||||||
m_active->m_protocol->sendMouseMove(m_x, m_y);
|
m_active->m_protocol->sendMouseMove(m_x, m_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
|
||||||
|
|
||||||
void CServer::onMouseWheel(SInt32 delta)
|
void CServer::onMouseWheel(SInt32 delta)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "onMouseWheel %+d", delta));
|
log((CLOG_DEBUG1 "onMouseWheel %+d", delta));
|
||||||
assert(m_active != NULL);
|
assert(m_active != NULL);
|
||||||
|
|
||||||
// relay
|
// relay
|
||||||
|
@ -547,14 +547,14 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
|
||||||
|
|
||||||
CString srcName = src->m_name;
|
CString srcName = src->m_name;
|
||||||
assert(!srcName.empty());
|
assert(!srcName.empty());
|
||||||
log((CLOG_DEBUG "find neighbor on %s of \"%s\"", CScreenMap::dirName(dir), srcName.c_str()));
|
log((CLOG_DEBUG2 "find neighbor on %s of \"%s\"", CScreenMap::dirName(dir), srcName.c_str()));
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// look up name of neighbor
|
// look up name of neighbor
|
||||||
const CString dstName(m_screenMap.getNeighbor(srcName, dir));
|
const CString dstName(m_screenMap.getNeighbor(srcName, dir));
|
||||||
|
|
||||||
// if nothing in that direction then return NULL
|
// if nothing in that direction then return NULL
|
||||||
if (dstName.empty()) {
|
if (dstName.empty()) {
|
||||||
log((CLOG_DEBUG "no neighbor on %s of \"%s\"", CScreenMap::dirName(dir), srcName.c_str()));
|
log((CLOG_DEBUG2 "no neighbor on %s of \"%s\"", CScreenMap::dirName(dir), srcName.c_str()));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,11 +563,11 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
|
||||||
// screen.
|
// screen.
|
||||||
CScreenList::const_iterator index = m_screens.find(dstName);
|
CScreenList::const_iterator index = m_screens.find(dstName);
|
||||||
if (index != m_screens.end()) {
|
if (index != m_screens.end()) {
|
||||||
log((CLOG_DEBUG "\"%s\" is on %s of \"%s\"", dstName.c_str(), CScreenMap::dirName(dir), srcName.c_str()));
|
log((CLOG_DEBUG2 "\"%s\" is on %s of \"%s\"", dstName.c_str(), CScreenMap::dirName(dir), srcName.c_str()));
|
||||||
return index->second;
|
return index->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
log((CLOG_DEBUG "ignored \"%s\" on %s of \"%s\"", dstName.c_str(), CScreenMap::dirName(dir), srcName.c_str()));
|
log((CLOG_DEBUG2 "ignored \"%s\" on %s of \"%s\"", dstName.c_str(), CScreenMap::dirName(dir), srcName.c_str()));
|
||||||
srcName = dstName;
|
srcName = dstName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
|
||||||
if (x >= 0) {
|
if (x >= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
log((CLOG_DEBUG "skipping over screen %s", dst->m_name.c_str()));
|
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
||||||
dst = getNeighbor(lastGoodScreen, srcSide);
|
dst = getNeighbor(lastGoodScreen, srcSide);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -610,7 +610,7 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
|
||||||
if (x < w) {
|
if (x < w) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
log((CLOG_DEBUG "skipping over screen %s", dst->m_name.c_str()));
|
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
||||||
dst = getNeighbor(lastGoodScreen, srcSide);
|
dst = getNeighbor(lastGoodScreen, srcSide);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -624,7 +624,7 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
|
||||||
if (y >= 0) {
|
if (y >= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
log((CLOG_DEBUG "skipping over screen %s", dst->m_name.c_str()));
|
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
||||||
dst = getNeighbor(lastGoodScreen, srcSide);
|
dst = getNeighbor(lastGoodScreen, srcSide);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -638,7 +638,7 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
|
||||||
if (y < h) {
|
if (y < h) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
log((CLOG_DEBUG "skipping over screen %s", dst->m_name.c_str()));
|
log((CLOG_DEBUG2 "skipping over screen %s", dst->m_name.c_str()));
|
||||||
dst = getNeighbor(lastGoodScreen, srcSide);
|
dst = getNeighbor(lastGoodScreen, srcSide);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -725,7 +725,7 @@ void CServer::mapPosition(CScreenInfo* src,
|
||||||
#include "CTCPListenSocket.h"
|
#include "CTCPListenSocket.h"
|
||||||
void CServer::acceptClients(void*)
|
void CServer::acceptClients(void*)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "starting to wait for clients"));
|
log((CLOG_DEBUG1 "starting to wait for clients"));
|
||||||
|
|
||||||
// add this thread to the list of threads to cancel. remove from
|
// add this thread to the list of threads to cancel. remove from
|
||||||
// list in d'tor.
|
// list in d'tor.
|
||||||
|
@ -743,25 +743,25 @@ void CServer::acceptClients(void*)
|
||||||
CNetworkAddress addr(50001 /* FIXME -- m_port */);
|
CNetworkAddress addr(50001 /* FIXME -- m_port */);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
try {
|
try {
|
||||||
log((CLOG_DEBUG "binding listen socket"));
|
log((CLOG_DEBUG1 "binding listen socket"));
|
||||||
listen->bind(addr);
|
listen->bind(addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (XSocketAddressInUse&) {
|
catch (XSocketAddressInUse&) {
|
||||||
// give up if we've waited too long
|
// give up if we've waited too long
|
||||||
if (timer.getTime() >= m_bindTimeout) {
|
if (timer.getTime() >= m_bindTimeout) {
|
||||||
log((CLOG_DEBUG "waited too long to bind, giving up"));
|
log((CLOG_DEBUG1 "waited too long to bind, giving up"));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait a bit before retrying
|
// wait a bit before retrying
|
||||||
log((CLOG_DEBUG "bind failed; waiting to retry"));
|
log((CLOG_DEBUG1 "bind failed; waiting to retry"));
|
||||||
CThread::sleep(5.0);
|
CThread::sleep(5.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// accept connections and begin processing them
|
// accept connections and begin processing them
|
||||||
log((CLOG_DEBUG "waiting for client connections"));
|
log((CLOG_DEBUG1 "waiting for client connections"));
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// accept connection
|
// accept connection
|
||||||
CThread::testCancel();
|
CThread::testCancel();
|
||||||
|
@ -782,7 +782,7 @@ void CServer::acceptClients(void*)
|
||||||
|
|
||||||
void CServer::handshakeClient(void* vsocket)
|
void CServer::handshakeClient(void* vsocket)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "negotiating with new client"));
|
log((CLOG_DEBUG1 "negotiating with new client"));
|
||||||
|
|
||||||
// get the socket pointer from the argument
|
// get the socket pointer from the argument
|
||||||
assert(vsocket != NULL);
|
assert(vsocket != NULL);
|
||||||
|
@ -826,22 +826,22 @@ void CServer::handshakeClient(void* vsocket)
|
||||||
static const UInt32 maxHelloLen = 1024;
|
static const UInt32 maxHelloLen = 1024;
|
||||||
|
|
||||||
// say hello
|
// say hello
|
||||||
log((CLOG_DEBUG "saying hello"));
|
log((CLOG_DEBUG1 "saying hello"));
|
||||||
CProtocolUtil::writef(output.get(), "Synergy%2i%2i",
|
CProtocolUtil::writef(output.get(), "Synergy%2i%2i",
|
||||||
kMajorVersion, kMinorVersion);
|
kMajorVersion, kMinorVersion);
|
||||||
output->flush();
|
output->flush();
|
||||||
|
|
||||||
// wait for the reply
|
// wait for the reply
|
||||||
log((CLOG_DEBUG "waiting for hello reply"));
|
log((CLOG_DEBUG1 "waiting for hello reply"));
|
||||||
UInt32 n = input->getSize();
|
UInt32 n = input->getSize();
|
||||||
if (n > maxHelloLen) {
|
if (n > maxHelloLen) {
|
||||||
throw XBadClient();
|
throw XBadClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get and parse the reply to hello
|
// get and parse the reply to hello
|
||||||
SInt32 major, minor;
|
SInt16 major, minor;
|
||||||
try {
|
try {
|
||||||
log((CLOG_DEBUG "parsing hello reply"));
|
log((CLOG_DEBUG1 "parsing hello reply"));
|
||||||
CProtocolUtil::readf(input.get(), "Synergy%2i%2i%s",
|
CProtocolUtil::readf(input.get(), "Synergy%2i%2i%s",
|
||||||
&major, &minor, &name);
|
&major, &minor, &name);
|
||||||
}
|
}
|
||||||
|
@ -853,7 +853,7 @@ void CServer::handshakeClient(void* vsocket)
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a protocol interpreter for the version
|
// create a protocol interpreter for the version
|
||||||
log((CLOG_DEBUG "creating interpreter for client %s version %d.%d", name.c_str(), major, minor));
|
log((CLOG_DEBUG1 "creating interpreter for client %s version %d.%d", name.c_str(), major, minor));
|
||||||
assign(protocol, CServerProtocol::create(major, minor,
|
assign(protocol, CServerProtocol::create(major, minor,
|
||||||
this, name, input.get(), output.get()),
|
this, name, input.get(), output.get()),
|
||||||
IServerProtocol);
|
IServerProtocol);
|
||||||
|
@ -863,7 +863,7 @@ void CServer::handshakeClient(void* vsocket)
|
||||||
name, protocol.get()), CConnectionNote);
|
name, protocol.get()), CConnectionNote);
|
||||||
|
|
||||||
// ask and wait for the client's info
|
// ask and wait for the client's info
|
||||||
log((CLOG_DEBUG "waiting for info for client %s", name.c_str()));
|
log((CLOG_DEBUG1 "waiting for info for client %s", name.c_str()));
|
||||||
protocol->queryInfo();
|
protocol->queryInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,13 +905,13 @@ void CServer::openPrimaryScreen()
|
||||||
assert(m_primary == NULL);
|
assert(m_primary == NULL);
|
||||||
|
|
||||||
// open screen
|
// open screen
|
||||||
log((CLOG_DEBUG "creating primary screen"));
|
log((CLOG_DEBUG1 "creating primary screen"));
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if defined(CONFIG_PLATFORM_WIN32)
|
||||||
m_primary = new CMSWindowsPrimaryScreen;
|
m_primary = new CMSWindowsPrimaryScreen;
|
||||||
#elif defined(CONFIG_PLATFORM_UNIX)
|
#elif defined(CONFIG_PLATFORM_UNIX)
|
||||||
m_primary = new CXWindowsPrimaryScreen;
|
m_primary = new CXWindowsPrimaryScreen;
|
||||||
#endif
|
#endif
|
||||||
log((CLOG_DEBUG "opening primary screen"));
|
log((CLOG_DEBUG1 "opening primary screen"));
|
||||||
m_primary->open(this);
|
m_primary->open(this);
|
||||||
|
|
||||||
// add connection
|
// add connection
|
||||||
|
@ -944,7 +944,7 @@ void CServer::closePrimaryScreen()
|
||||||
|
|
||||||
// close the primary screen
|
// close the primary screen
|
||||||
try {
|
try {
|
||||||
log((CLOG_DEBUG "closing primary screen"));
|
log((CLOG_DEBUG1 "closing primary screen"));
|
||||||
m_primary->close();
|
m_primary->close();
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
@ -952,7 +952,7 @@ void CServer::closePrimaryScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
log((CLOG_DEBUG "destroying primary screen"));
|
log((CLOG_DEBUG1 "destroying primary screen"));
|
||||||
delete m_primary;
|
delete m_primary;
|
||||||
m_primary = NULL;
|
m_primary = NULL;
|
||||||
}
|
}
|
||||||
|
@ -979,7 +979,7 @@ void CServer::removeCleanupThread(const CThread& thread)
|
||||||
|
|
||||||
void CServer::cleanupThreads()
|
void CServer::cleanupThreads()
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "cleaning up threads"));
|
log((CLOG_DEBUG1 "cleaning up threads"));
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
while (m_cleanupList.begin() != m_cleanupList.end()) {
|
while (m_cleanupList.begin() != m_cleanupList.end()) {
|
||||||
// get the next thread and cancel it
|
// get the next thread and cancel it
|
||||||
|
@ -995,7 +995,7 @@ void CServer::cleanupThreads()
|
||||||
|
|
||||||
// FIXME -- delete remaining threads from list
|
// FIXME -- delete remaining threads from list
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
log((CLOG_DEBUG "cleaned up threads"));
|
log((CLOG_DEBUG1 "cleaned up threads"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CServer::CScreenInfo* CServer::addConnection(
|
CServer::CScreenInfo* CServer::addConnection(
|
||||||
|
|
|
@ -46,7 +46,7 @@ void CServerProtocol1_0::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse message
|
// parse message
|
||||||
log((CLOG_DEBUG "msg from \"%s\": %c%c%c%c", getClient().c_str(), code[0], code[1], code[2], code[3]));
|
log((CLOG_DEBUG2 "msg from \"%s\": %c%c%c%c", getClient().c_str(), code[0], code[1], code[2], code[3]));
|
||||||
if (memcmp(code, kMsgDInfo, 4) == 0) {
|
if (memcmp(code, kMsgDInfo, 4) == 0) {
|
||||||
recvInfo();
|
recvInfo();
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ void CServerProtocol1_0::run()
|
||||||
|
|
||||||
void CServerProtocol1_0::queryInfo()
|
void CServerProtocol1_0::queryInfo()
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "querying client \"%s\" info", getClient().c_str()));
|
log((CLOG_DEBUG1 "querying client \"%s\" info", getClient().c_str()));
|
||||||
|
|
||||||
// send request
|
// send request
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgQInfo);
|
CProtocolUtil::writef(getOutputStream(), kMsgQInfo);
|
||||||
|
@ -86,95 +86,95 @@ void CServerProtocol1_0::queryInfo()
|
||||||
|
|
||||||
void CServerProtocol1_0::sendClose()
|
void CServerProtocol1_0::sendClose()
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send close to \"%s\"", getClient().c_str()));
|
log((CLOG_DEBUG1 "send close to \"%s\"", getClient().c_str()));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgCClose);
|
CProtocolUtil::writef(getOutputStream(), kMsgCClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendEnter(
|
void CServerProtocol1_0::sendEnter(
|
||||||
SInt32 xAbs, SInt32 yAbs)
|
SInt32 xAbs, SInt32 yAbs)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send enter to \"%s\", %d,%d", getClient().c_str(), xAbs, yAbs));
|
log((CLOG_DEBUG1 "send enter to \"%s\", %d,%d", getClient().c_str(), xAbs, yAbs));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgCEnter, xAbs, yAbs);
|
CProtocolUtil::writef(getOutputStream(), kMsgCEnter, xAbs, yAbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendLeave()
|
void CServerProtocol1_0::sendLeave()
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send leave to \"%s\"", getClient().c_str()));
|
log((CLOG_DEBUG1 "send leave to \"%s\"", getClient().c_str()));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgCLeave);
|
CProtocolUtil::writef(getOutputStream(), kMsgCLeave);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendClipboard(
|
void CServerProtocol1_0::sendClipboard(
|
||||||
ClipboardID id, const CString& data)
|
ClipboardID id, const CString& data)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send clipboard %d to \"%s\" size=%d", id, getClient().c_str(), data.size()));
|
log((CLOG_DEBUG "send clipboard %d to \"%s\" size=%d", id, getClient().c_str(), data.size()));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgDClipboard, id, 0, &data);
|
CProtocolUtil::writef(getOutputStream(), kMsgDClipboard, id, 0, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendGrabClipboard(ClipboardID id)
|
void CServerProtocol1_0::sendGrabClipboard(ClipboardID id)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send grab clipboard %d to \"%s\"", id, getClient().c_str()));
|
log((CLOG_DEBUG "send grab clipboard %d to \"%s\"", id, getClient().c_str()));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id);
|
CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendQueryClipboard(
|
void CServerProtocol1_0::sendQueryClipboard(
|
||||||
ClipboardID id, UInt32 seqNum)
|
ClipboardID id, UInt32 seqNum)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "query clipboard %d to \"%s\"", id, getClient().c_str()));
|
log((CLOG_DEBUG "query clipboard %d to \"%s\"", id, getClient().c_str()));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgQClipboard, id, seqNum);
|
CProtocolUtil::writef(getOutputStream(), kMsgQClipboard, id, seqNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendScreenSaver(bool on)
|
void CServerProtocol1_0::sendScreenSaver(bool on)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send screen saver to \"%s\"", getClient().c_str()));
|
log((CLOG_DEBUG1 "send screen saver to \"%s\"", getClient().c_str()));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgCScreenSaver, on ? 1 : 0);
|
CProtocolUtil::writef(getOutputStream(), kMsgCScreenSaver, on ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendKeyDown(
|
void CServerProtocol1_0::sendKeyDown(
|
||||||
KeyID key, KeyModifierMask mask)
|
KeyID key, KeyModifierMask mask)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send key down to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
|
log((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgDKeyDown, key, mask);
|
CProtocolUtil::writef(getOutputStream(), kMsgDKeyDown, key, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendKeyRepeat(
|
void CServerProtocol1_0::sendKeyRepeat(
|
||||||
KeyID key, KeyModifierMask mask, SInt32 count)
|
KeyID key, KeyModifierMask mask, SInt32 count)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send key repeat to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
|
log((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgDKeyRepeat, key, mask, count);
|
CProtocolUtil::writef(getOutputStream(), kMsgDKeyRepeat, key, mask, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendKeyUp(
|
void CServerProtocol1_0::sendKeyUp(
|
||||||
KeyID key, KeyModifierMask mask)
|
KeyID key, KeyModifierMask mask)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send key up to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
|
log((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getClient().c_str(), key, mask));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgDKeyUp, key, mask);
|
CProtocolUtil::writef(getOutputStream(), kMsgDKeyUp, key, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendMouseDown(
|
void CServerProtocol1_0::sendMouseDown(
|
||||||
ButtonID button)
|
ButtonID button)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send mouse down to \"%s\" id=%d", getClient().c_str(), button));
|
log((CLOG_DEBUG1 "send mouse down to \"%s\" id=%d", getClient().c_str(), button));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgDMouseDown, button);
|
CProtocolUtil::writef(getOutputStream(), kMsgDMouseDown, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendMouseUp(
|
void CServerProtocol1_0::sendMouseUp(
|
||||||
ButtonID button)
|
ButtonID button)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send mouse up to \"%s\" id=%d", getClient().c_str(), button));
|
log((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getClient().c_str(), button));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgDMouseUp, button);
|
CProtocolUtil::writef(getOutputStream(), kMsgDMouseUp, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendMouseMove(
|
void CServerProtocol1_0::sendMouseMove(
|
||||||
SInt32 xAbs, SInt32 yAbs)
|
SInt32 xAbs, SInt32 yAbs)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send mouse move to \"%s\" %d,%d", getClient().c_str(), xAbs, yAbs));
|
log((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getClient().c_str(), xAbs, yAbs));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgDMouseMove, xAbs, yAbs);
|
CProtocolUtil::writef(getOutputStream(), kMsgDMouseMove, xAbs, yAbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerProtocol1_0::sendMouseWheel(
|
void CServerProtocol1_0::sendMouseWheel(
|
||||||
SInt32 delta)
|
SInt32 delta)
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "send mouse wheel to \"%s\" %+d", getClient().c_str(), delta));
|
log((CLOG_DEBUG1 "send mouse wheel to \"%s\" %+d", getClient().c_str(), delta));
|
||||||
CProtocolUtil::writef(getOutputStream(), kMsgDMouseWheel, delta);
|
CProtocolUtil::writef(getOutputStream(), kMsgDMouseWheel, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ void CServerProtocol1_0::recvInfo()
|
||||||
// parse the message
|
// parse the message
|
||||||
SInt16 w, h, zoneInfo;
|
SInt16 w, h, zoneInfo;
|
||||||
CProtocolUtil::readf(getInputStream(), kMsgDInfo + 4, &w, &h, &zoneInfo);
|
CProtocolUtil::readf(getInputStream(), kMsgDInfo + 4, &w, &h, &zoneInfo);
|
||||||
log((CLOG_INFO "received client \"%s\" info size=%dx%d, zone=%d", getClient().c_str(), w, h, zoneInfo));
|
log((CLOG_DEBUG "received client \"%s\" info size=%dx%d, zone=%d", getClient().c_str(), w, h, zoneInfo));
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
if (w == 0 || h == 0) {
|
if (w == 0 || h == 0) {
|
||||||
|
@ -200,7 +200,7 @@ void CServerProtocol1_0::recvClipboard()
|
||||||
UInt32 seqNum;
|
UInt32 seqNum;
|
||||||
CString data;
|
CString data;
|
||||||
CProtocolUtil::readf(getInputStream(), kMsgDClipboard + 4, &id, &seqNum, &data);
|
CProtocolUtil::readf(getInputStream(), kMsgDClipboard + 4, &id, &seqNum, &data);
|
||||||
log((CLOG_INFO "received client \"%s\" clipboard %d seqnum=%d, size=%d", getClient().c_str(), id, seqNum, data.size()));
|
log((CLOG_DEBUG "received client \"%s\" clipboard %d seqnum=%d, size=%d", getClient().c_str(), id, seqNum, data.size()));
|
||||||
getServer()->setClipboard(id, seqNum, data);
|
getServer()->setClipboard(id, seqNum, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +208,6 @@ void CServerProtocol1_0::recvGrabClipboard()
|
||||||
{
|
{
|
||||||
ClipboardID id;
|
ClipboardID id;
|
||||||
CProtocolUtil::readf(getInputStream(), kMsgCClipboard + 4, &id);
|
CProtocolUtil::readf(getInputStream(), kMsgCClipboard + 4, &id);
|
||||||
log((CLOG_INFO "received client \"%s\" grabbed clipboard %d", getClient().c_str(), id));
|
log((CLOG_DEBUG "received client \"%s\" grabbed clipboard %d", getClient().c_str(), id));
|
||||||
getServer()->grabClipboard(id, getClient());
|
getServer()->grabClipboard(id, getClient());
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ void CXWindowsPrimaryScreen::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
case KeyPress: {
|
case KeyPress: {
|
||||||
log((CLOG_DEBUG "event: KeyPress code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
|
log((CLOG_DEBUG1 "event: KeyPress code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
|
||||||
const KeyModifierMask mask = mapModifier(xevent.xkey.state);
|
const KeyModifierMask mask = mapModifier(xevent.xkey.state);
|
||||||
const KeyID key = mapKey(&xevent.xkey);
|
const KeyID key = mapKey(&xevent.xkey);
|
||||||
if (key != kKeyNone) {
|
if (key != kKeyNone) {
|
||||||
|
@ -65,7 +65,7 @@ void CXWindowsPrimaryScreen::run()
|
||||||
// FIXME -- simulate key repeat. X sends press/release for
|
// FIXME -- simulate key repeat. X sends press/release for
|
||||||
// repeat. must detect auto repeat and use kKeyRepeat.
|
// repeat. must detect auto repeat and use kKeyRepeat.
|
||||||
case KeyRelease: {
|
case KeyRelease: {
|
||||||
log((CLOG_DEBUG "event: KeyRelease code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
|
log((CLOG_DEBUG1 "event: KeyRelease code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
|
||||||
const KeyModifierMask mask = mapModifier(xevent.xkey.state);
|
const KeyModifierMask mask = mapModifier(xevent.xkey.state);
|
||||||
const KeyID key = mapKey(&xevent.xkey);
|
const KeyID key = mapKey(&xevent.xkey);
|
||||||
if (key != kKeyNone) {
|
if (key != kKeyNone) {
|
||||||
|
@ -77,7 +77,7 @@ void CXWindowsPrimaryScreen::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
case ButtonPress: {
|
case ButtonPress: {
|
||||||
log((CLOG_DEBUG "event: ButtonPress button=%d", xevent.xbutton.button));
|
log((CLOG_DEBUG1 "event: ButtonPress button=%d", xevent.xbutton.button));
|
||||||
const ButtonID button = mapButton(xevent.xbutton.button);
|
const ButtonID button = mapButton(xevent.xbutton.button);
|
||||||
if (button != kButtonNone) {
|
if (button != kButtonNone) {
|
||||||
m_server->onMouseDown(button);
|
m_server->onMouseDown(button);
|
||||||
|
@ -86,7 +86,7 @@ void CXWindowsPrimaryScreen::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
case ButtonRelease: {
|
case ButtonRelease: {
|
||||||
log((CLOG_DEBUG "event: ButtonRelease button=%d", xevent.xbutton.button));
|
log((CLOG_DEBUG1 "event: ButtonRelease button=%d", xevent.xbutton.button));
|
||||||
const ButtonID button = mapButton(xevent.xbutton.button);
|
const ButtonID button = mapButton(xevent.xbutton.button);
|
||||||
if (button != kButtonNone) {
|
if (button != kButtonNone) {
|
||||||
m_server->onMouseUp(button);
|
m_server->onMouseUp(button);
|
||||||
|
@ -95,7 +95,7 @@ void CXWindowsPrimaryScreen::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
case MotionNotify: {
|
case MotionNotify: {
|
||||||
// log((CLOG_DEBUG "event: MotionNotify %d,%d", xevent.xmotion.x_root, xevent.xmotion.y_root));
|
log((CLOG_DEBUG2 "event: MotionNotify %d,%d", xevent.xmotion.x_root, xevent.xmotion.y_root));
|
||||||
SInt32 x, y;
|
SInt32 x, y;
|
||||||
if (!m_active) {
|
if (!m_active) {
|
||||||
x = xevent.xmotion.x_root;
|
x = xevent.xmotion.x_root;
|
||||||
|
@ -270,11 +270,11 @@ void CXWindowsPrimaryScreen::leave()
|
||||||
m_window, None, CurrentTime);
|
m_window, None, CurrentTime);
|
||||||
assert(result != GrabNotViewable);
|
assert(result != GrabNotViewable);
|
||||||
if (result != GrabSuccess) {
|
if (result != GrabSuccess) {
|
||||||
log((CLOG_DEBUG "waiting to grab pointer"));
|
log((CLOG_DEBUG2 "waiting to grab pointer"));
|
||||||
CThread::sleep(0.1);
|
CThread::sleep(0.1);
|
||||||
}
|
}
|
||||||
} while (result != GrabSuccess);
|
} while (result != GrabSuccess);
|
||||||
log((CLOG_DEBUG "grabbed pointer"));
|
log((CLOG_DEBUG2 "grabbed pointer"));
|
||||||
|
|
||||||
// now the keyboard
|
// now the keyboard
|
||||||
result = XGrabKeyboard(display, m_window, True,
|
result = XGrabKeyboard(display, m_window, True,
|
||||||
|
@ -283,11 +283,11 @@ void CXWindowsPrimaryScreen::leave()
|
||||||
if (result != GrabSuccess) {
|
if (result != GrabSuccess) {
|
||||||
// back off to avoid grab deadlock
|
// back off to avoid grab deadlock
|
||||||
XUngrabPointer(display, CurrentTime);
|
XUngrabPointer(display, CurrentTime);
|
||||||
log((CLOG_DEBUG "ungrabbed pointer, waiting to grab keyboard"));
|
log((CLOG_DEBUG2 "ungrabbed pointer, waiting to grab keyboard"));
|
||||||
CThread::sleep(0.1);
|
CThread::sleep(0.1);
|
||||||
}
|
}
|
||||||
} while (result != GrabSuccess);
|
} while (result != GrabSuccess);
|
||||||
log((CLOG_DEBUG "grabbed keyboard"));
|
log((CLOG_DEBUG1 "grabbed pointer and keyboard"));
|
||||||
|
|
||||||
// move the mouse to the center of grab window
|
// move the mouse to the center of grab window
|
||||||
SInt32 w, h;
|
SInt32 w, h;
|
||||||
|
@ -313,7 +313,7 @@ void CXWindowsPrimaryScreen::warpCursorNoLock(
|
||||||
// warp the mouse
|
// warp the mouse
|
||||||
XWarpPointer(display, None, getRoot(), 0, 0, 0, 0, x, y);
|
XWarpPointer(display, None, getRoot(), 0, 0, 0, 0, x, y);
|
||||||
XSync(display, False);
|
XSync(display, False);
|
||||||
log((CLOG_DEBUG "warped to %d,%d", x, y));
|
log((CLOG_DEBUG1 "warped to %d,%d", x, y));
|
||||||
|
|
||||||
// discard mouse events since we just added one we don't want
|
// discard mouse events since we just added one we don't want
|
||||||
XEvent xevent;
|
XEvent xevent;
|
||||||
|
|
|
@ -15,7 +15,7 @@ void CProtocolUtil::writef(IOutputStream* stream,
|
||||||
{
|
{
|
||||||
assert(stream != NULL);
|
assert(stream != NULL);
|
||||||
assert(fmt != NULL);
|
assert(fmt != NULL);
|
||||||
log((CLOG_DEBUG "writef(%s)", fmt));
|
log((CLOG_DEBUG2 "writef(%s)", fmt));
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ void CProtocolUtil::writef(IOutputStream* stream,
|
||||||
UInt8* scan = buffer;
|
UInt8* scan = buffer;
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
const UInt32 n = stream->write(scan, count);
|
const UInt32 n = stream->write(scan, count);
|
||||||
log((CLOG_DEBUG "wrote %d of %d bytes", n, count));
|
log((CLOG_DEBUG2 "wrote %d of %d bytes", n, count));
|
||||||
count -= n;
|
count -= n;
|
||||||
scan += n;
|
scan += n;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ void CProtocolUtil::readf(IInputStream* stream,
|
||||||
{
|
{
|
||||||
assert(stream != NULL);
|
assert(stream != NULL);
|
||||||
assert(fmt != NULL);
|
assert(fmt != NULL);
|
||||||
log((CLOG_DEBUG "readf(%s)", fmt));
|
log((CLOG_DEBUG2 "readf(%s)", fmt));
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
@ -78,7 +78,7 @@ void CProtocolUtil::readf(IInputStream* stream,
|
||||||
case 1:
|
case 1:
|
||||||
// 1 byte integer
|
// 1 byte integer
|
||||||
*reinterpret_cast<UInt8*>(v) = buffer[0];
|
*reinterpret_cast<UInt8*>(v) = buffer[0];
|
||||||
log((CLOG_DEBUG "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt8*>(v), *reinterpret_cast<UInt8*>(v)));
|
log((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt8*>(v), *reinterpret_cast<UInt8*>(v)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -86,7 +86,7 @@ void CProtocolUtil::readf(IInputStream* stream,
|
||||||
*reinterpret_cast<UInt16*>(v) =
|
*reinterpret_cast<UInt16*>(v) =
|
||||||
(static_cast<UInt16>(buffer[0]) << 8) |
|
(static_cast<UInt16>(buffer[0]) << 8) |
|
||||||
static_cast<UInt16>(buffer[1]);
|
static_cast<UInt16>(buffer[1]);
|
||||||
log((CLOG_DEBUG "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt16*>(v), *reinterpret_cast<UInt16*>(v)));
|
log((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt16*>(v), *reinterpret_cast<UInt16*>(v)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -96,7 +96,7 @@ void CProtocolUtil::readf(IInputStream* stream,
|
||||||
(static_cast<UInt32>(buffer[1]) << 16) |
|
(static_cast<UInt32>(buffer[1]) << 16) |
|
||||||
(static_cast<UInt32>(buffer[2]) << 8) |
|
(static_cast<UInt32>(buffer[2]) << 8) |
|
||||||
static_cast<UInt32>(buffer[3]);
|
static_cast<UInt32>(buffer[3]);
|
||||||
log((CLOG_DEBUG "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt32*>(v), *reinterpret_cast<UInt32*>(v)));
|
log((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt32*>(v), *reinterpret_cast<UInt32*>(v)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -135,7 +135,7 @@ void CProtocolUtil::readf(IInputStream* stream,
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
log((CLOG_DEBUG "readf: read %d byte string: %.*s", len, len, sBuffer));
|
log((CLOG_DEBUG2 "readf: read %d byte string: %.*s", len, len, sBuffer));
|
||||||
|
|
||||||
// save the data
|
// save the data
|
||||||
CString* dst = va_arg(args, CString*);
|
CString* dst = va_arg(args, CString*);
|
||||||
|
@ -166,7 +166,7 @@ void CProtocolUtil::readf(IInputStream* stream,
|
||||||
|
|
||||||
// verify match
|
// verify match
|
||||||
if (buffer[0] != *fmt) {
|
if (buffer[0] != *fmt) {
|
||||||
log((CLOG_DEBUG "readf: format mismatch: %c vs %c", *fmt, buffer[0]));
|
log((CLOG_DEBUG2 "readf: format mismatch: %c vs %c", *fmt, buffer[0]));
|
||||||
throw XIOReadMismatch();
|
throw XIOReadMismatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ void CProtocolUtil::read(IInputStream* stream,
|
||||||
|
|
||||||
// bail if stream has hungup
|
// bail if stream has hungup
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
log((CLOG_DEBUG "unexpected disconnect in readf(), %d bytes left", count));
|
log((CLOG_DEBUG2 "unexpected disconnect in readf(), %d bytes left", count));
|
||||||
throw XIOEndOfStream();
|
throw XIOEndOfStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,11 +274,11 @@ void CXWindowsScreen::getDisplayClipboard(
|
||||||
log((CLOG_INFO "getting selection with %d targets", numTargets));
|
log((CLOG_INFO "getting selection with %d targets", numTargets));
|
||||||
for (SInt32 i = 0; i < numTargets; ++i) {
|
for (SInt32 i = 0; i < numTargets; ++i) {
|
||||||
Atom format = targetAtoms[i];
|
Atom format = targetAtoms[i];
|
||||||
log((CLOG_DEBUG " source target %d", format));
|
log((CLOG_DEBUG1 " source target %d", format));
|
||||||
|
|
||||||
// skip already handled targets
|
// skip already handled targets
|
||||||
if (targets.count(format) > 0) {
|
if (targets.count(format) > 0) {
|
||||||
log((CLOG_DEBUG " skipping handled target %d", format));
|
log((CLOG_DEBUG1 " skipping handled target %d", format));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,29 +291,29 @@ void CXWindowsScreen::getDisplayClipboard(
|
||||||
// if we can use the format and we haven't already retrieved
|
// if we can use the format and we haven't already retrieved
|
||||||
// it then get it
|
// it then get it
|
||||||
if (expectedFormat == IClipboard::kNumFormats) {
|
if (expectedFormat == IClipboard::kNumFormats) {
|
||||||
log((CLOG_DEBUG " no format for target", format));
|
log((CLOG_DEBUG1 " no format for target", format));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (clipboardFormats.count(expectedFormat) > 0) {
|
if (clipboardFormats.count(expectedFormat) > 0) {
|
||||||
log((CLOG_DEBUG " skipping handled format %d", expectedFormat));
|
log((CLOG_DEBUG1 " skipping handled format %d", expectedFormat));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString data;
|
CString data;
|
||||||
if (!getDisplayClipboard(selection, format,
|
if (!getDisplayClipboard(selection, format,
|
||||||
requestor, timestamp, &format, &data)) {
|
requestor, timestamp, &format, &data)) {
|
||||||
log((CLOG_DEBUG " no data for target", format));
|
log((CLOG_DEBUG1 " no data for target", format));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use the actual format, not the expected
|
// use the actual format, not the expected
|
||||||
IClipboard::EFormat actualFormat = getFormat(format);
|
IClipboard::EFormat actualFormat = getFormat(format);
|
||||||
if (actualFormat == IClipboard::kNumFormats) {
|
if (actualFormat == IClipboard::kNumFormats) {
|
||||||
log((CLOG_DEBUG " no format for target", format));
|
log((CLOG_DEBUG1 " no format for target", format));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (clipboardFormats.count(actualFormat) > 0) {
|
if (clipboardFormats.count(actualFormat) > 0) {
|
||||||
log((CLOG_DEBUG " skipping handled format %d", actualFormat));
|
log((CLOG_DEBUG1 " skipping handled format %d", actualFormat));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ void CXWindowsScreen::getDisplayClipboard(
|
||||||
else {
|
else {
|
||||||
// non-ICCCM conforming selection owner. try TEXT format.
|
// non-ICCCM conforming selection owner. try TEXT format.
|
||||||
// FIXME
|
// FIXME
|
||||||
log((CLOG_DEBUG "selection doesn't support TARGETS, format is %d", format));
|
log((CLOG_DEBUG1 "selection doesn't support TARGETS, format is %d", format));
|
||||||
}
|
}
|
||||||
|
|
||||||
// done with clipboard
|
// done with clipboard
|
||||||
|
@ -386,7 +386,7 @@ bool CXWindowsScreen::getDisplayClipboard(
|
||||||
// handle INCR type specially. it means we'll be receiving the data
|
// handle INCR type specially. it means we'll be receiving the data
|
||||||
// piecemeal so we just loop until we've collected all the data.
|
// piecemeal so we just loop until we've collected all the data.
|
||||||
if (*outputType == m_atomINCR) {
|
if (*outputType == m_atomINCR) {
|
||||||
log((CLOG_DEBUG "selection data for format %d is incremental", type));
|
log((CLOG_DEBUG1 "selection data for format %d is incremental", type));
|
||||||
// the data is a lower bound on the amount of data to be
|
// the data is a lower bound on the amount of data to be
|
||||||
// transferred. use it as a hint to size our buffer.
|
// transferred. use it as a hint to size our buffer.
|
||||||
UInt32 size;
|
UInt32 size;
|
||||||
|
@ -726,7 +726,7 @@ bool CXWindowsScreen::sendClipboardData(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.size() > kMaxRequestSize) {
|
if (data.size() > kMaxRequestSize) {
|
||||||
log((CLOG_DEBUG "handling clipboard request for %d as INCR", target));
|
log((CLOG_DEBUG1 "handling clipboard request for %d as INCR", target));
|
||||||
|
|
||||||
// get the appropriate list, creating it if necessary
|
// get the appropriate list, creating it if necessary
|
||||||
CRequestList* list = m_clipboards[id].m_requests[requestor];
|
CRequestList* list = m_clipboards[id].m_requests[requestor];
|
||||||
|
@ -763,7 +763,7 @@ bool CXWindowsScreen::sendClipboardData(
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log((CLOG_DEBUG "handling clipboard request for %d", target));
|
log((CLOG_DEBUG1 "handling clipboard request for %d", target));
|
||||||
|
|
||||||
// FIXME -- handle Alloc errors (by returning false)
|
// FIXME -- handle Alloc errors (by returning false)
|
||||||
XChangeProperty(m_display, requestor, property,
|
XChangeProperty(m_display, requestor, property,
|
||||||
|
@ -783,7 +783,7 @@ bool CXWindowsScreen::sendClipboardMultiple(
|
||||||
Window requestor,
|
Window requestor,
|
||||||
Atom property, Time time)
|
Atom property, Time time)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "handling clipboard request for MULTIPLE"));
|
log((CLOG_DEBUG1 "handling clipboard request for MULTIPLE"));
|
||||||
|
|
||||||
// get the list of requested formats
|
// get the list of requested formats
|
||||||
Atom type;
|
Atom type;
|
||||||
|
@ -850,7 +850,7 @@ bool CXWindowsScreen::sendClipboardTargets(
|
||||||
Window requestor,
|
Window requestor,
|
||||||
Atom property, Time /*time*/)
|
Atom property, Time /*time*/)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "handling request for TARGETS"));
|
log((CLOG_DEBUG1 "handling request for TARGETS"));
|
||||||
|
|
||||||
// count the number of targets, plus TARGETS and MULTIPLE
|
// count the number of targets, plus TARGETS and MULTIPLE
|
||||||
SInt32 numTargets = 2;
|
SInt32 numTargets = 2;
|
||||||
|
@ -888,7 +888,7 @@ bool CXWindowsScreen::sendClipboardTimestamp(
|
||||||
Window requestor,
|
Window requestor,
|
||||||
Atom property, Time /*time*/)
|
Atom property, Time /*time*/)
|
||||||
{
|
{
|
||||||
log((CLOG_DEBUG "handling clipboard request for TIMESTAMP"));
|
log((CLOG_DEBUG1 "handling clipboard request for TIMESTAMP"));
|
||||||
|
|
||||||
// FIXME -- handle Alloc errors (by returning false)
|
// FIXME -- handle Alloc errors (by returning false)
|
||||||
XChangeProperty(m_display, requestor, property,
|
XChangeProperty(m_display, requestor, property,
|
||||||
|
|
Loading…
Reference in New Issue