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:
crs
2002-04-27 18:49:03 +00:00
parent 9ac0473d5a
commit d1ca5295d1
12 changed files with 133 additions and 125 deletions

View File

@@ -73,7 +73,7 @@ void CServer::run()
m_primary->run();
// clean up
log((CLOG_DEBUG "stopping server"));
log((CLOG_NOTE "stopping server"));
cleanupThreads();
closePrimaryScreen();
}
@@ -248,7 +248,7 @@ bool CServer::onCommandKey(KeyID /*id*/,
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);
// handle command keys
@@ -264,7 +264,7 @@ void CServer::onKeyDown(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);
// handle command keys
@@ -281,7 +281,7 @@ void CServer::onKeyUp(KeyID id, KeyModifierMask mask)
void CServer::onKeyRepeat(
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);
// handle command keys
@@ -298,7 +298,7 @@ void CServer::onKeyRepeat(
void CServer::onMouseDown(ButtonID id)
{
log((CLOG_DEBUG "onMouseDown id=%d", id));
log((CLOG_DEBUG1 "onMouseDown id=%d", id));
assert(m_active != NULL);
// relay
@@ -309,7 +309,7 @@ void CServer::onMouseDown(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);
// relay
@@ -320,7 +320,7 @@ void CServer::onMouseUp(ButtonID id)
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
assert(m_active != NULL);
@@ -336,22 +336,22 @@ bool CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
if (x < m_active->m_zoneSize) {
x -= m_active->m_zoneSize;
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) {
x += m_active->m_zoneSize;
dir = CScreenMap::kRight;
log((CLOG_DEBUG "switch to right"));
log((CLOG_DEBUG1 "switch to right"));
}
else if (y < m_active->m_zoneSize) {
y -= m_active->m_zoneSize;
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) {
y += m_active->m_zoneSize;
dir = CScreenMap::kBottom;
log((CLOG_DEBUG "switch to bottom"));
log((CLOG_DEBUG1 "switch to bottom"));
}
else {
// still on local screen
@@ -376,7 +376,7 @@ bool CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
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
assert(m_active != NULL);
@@ -409,7 +409,7 @@ void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
// get neighbor if we should switch
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;
newScreen = getNeighbor(m_active, dir, x, y);
@@ -421,7 +421,7 @@ void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
m_y = y;
}
else {
log((CLOG_DEBUG "no neighbor; clamping"));
log((CLOG_DEBUG1 "no neighbor; clamping"));
if (m_x < 0)
m_x = 0;
else if (m_x > m_active->m_width - 1)
@@ -435,7 +435,7 @@ void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
}
else {
// 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)
m_x = 0;
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) {
// do nothing if mouse didn't move
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);
}
}
@@ -463,7 +463,7 @@ void CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
void CServer::onMouseWheel(SInt32 delta)
{
log((CLOG_DEBUG "onMouseWheel %+d", delta));
log((CLOG_DEBUG1 "onMouseWheel %+d", delta));
assert(m_active != NULL);
// relay
@@ -547,14 +547,14 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
CString srcName = src->m_name;
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 (;;) {
// look up name of neighbor
const CString dstName(m_screenMap.getNeighbor(srcName, dir));
// if nothing in that direction then return NULL
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;
}
@@ -563,11 +563,11 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
// screen.
CScreenList::const_iterator index = m_screens.find(dstName);
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;
}
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;
}
}
@@ -596,7 +596,7 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
if (x >= 0) {
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);
}
break;
@@ -610,7 +610,7 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
if (x < w) {
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);
}
break;
@@ -624,7 +624,7 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
if (y >= 0) {
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);
}
break;
@@ -638,7 +638,7 @@ CServer::CScreenInfo* CServer::getNeighbor(CScreenInfo* src,
if (y < h) {
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);
}
break;
@@ -725,7 +725,7 @@ void CServer::mapPosition(CScreenInfo* src,
#include "CTCPListenSocket.h"
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
// list in d'tor.
@@ -743,25 +743,25 @@ void CServer::acceptClients(void*)
CNetworkAddress addr(50001 /* FIXME -- m_port */);
for (;;) {
try {
log((CLOG_DEBUG "binding listen socket"));
log((CLOG_DEBUG1 "binding listen socket"));
listen->bind(addr);
break;
}
catch (XSocketAddressInUse&) {
// give up if we've waited too long
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;
}
// 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);
}
}
// accept connections and begin processing them
log((CLOG_DEBUG "waiting for client connections"));
log((CLOG_DEBUG1 "waiting for client connections"));
for (;;) {
// accept connection
CThread::testCancel();
@@ -782,7 +782,7 @@ void CServer::acceptClients(void*)
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
assert(vsocket != NULL);
@@ -826,22 +826,22 @@ void CServer::handshakeClient(void* vsocket)
static const UInt32 maxHelloLen = 1024;
// say hello
log((CLOG_DEBUG "saying hello"));
log((CLOG_DEBUG1 "saying hello"));
CProtocolUtil::writef(output.get(), "Synergy%2i%2i",
kMajorVersion, kMinorVersion);
output->flush();
// wait for the reply
log((CLOG_DEBUG "waiting for hello reply"));
log((CLOG_DEBUG1 "waiting for hello reply"));
UInt32 n = input->getSize();
if (n > maxHelloLen) {
throw XBadClient();
}
// get and parse the reply to hello
SInt32 major, minor;
SInt16 major, minor;
try {
log((CLOG_DEBUG "parsing hello reply"));
log((CLOG_DEBUG1 "parsing hello reply"));
CProtocolUtil::readf(input.get(), "Synergy%2i%2i%s",
&major, &minor, &name);
}
@@ -853,7 +853,7 @@ void CServer::handshakeClient(void* vsocket)
}
// 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,
this, name, input.get(), output.get()),
IServerProtocol);
@@ -863,7 +863,7 @@ void CServer::handshakeClient(void* vsocket)
name, protocol.get()), CConnectionNote);
// 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();
}
@@ -905,13 +905,13 @@ void CServer::openPrimaryScreen()
assert(m_primary == NULL);
// open screen
log((CLOG_DEBUG "creating primary screen"));
log((CLOG_DEBUG1 "creating primary screen"));
#if defined(CONFIG_PLATFORM_WIN32)
m_primary = new CMSWindowsPrimaryScreen;
#elif defined(CONFIG_PLATFORM_UNIX)
m_primary = new CXWindowsPrimaryScreen;
#endif
log((CLOG_DEBUG "opening primary screen"));
log((CLOG_DEBUG1 "opening primary screen"));
m_primary->open(this);
// add connection
@@ -944,7 +944,7 @@ void CServer::closePrimaryScreen()
// close the primary screen
try {
log((CLOG_DEBUG "closing primary screen"));
log((CLOG_DEBUG1 "closing primary screen"));
m_primary->close();
}
catch (...) {
@@ -952,7 +952,7 @@ void CServer::closePrimaryScreen()
}
// clean up
log((CLOG_DEBUG "destroying primary screen"));
log((CLOG_DEBUG1 "destroying primary screen"));
delete m_primary;
m_primary = NULL;
}
@@ -979,7 +979,7 @@ void CServer::removeCleanupThread(const CThread& thread)
void CServer::cleanupThreads()
{
log((CLOG_DEBUG "cleaning up threads"));
log((CLOG_DEBUG1 "cleaning up threads"));
m_mutex.lock();
while (m_cleanupList.begin() != m_cleanupList.end()) {
// get the next thread and cancel it
@@ -995,7 +995,7 @@ void CServer::cleanupThreads()
// FIXME -- delete remaining threads from list
m_mutex.unlock();
log((CLOG_DEBUG "cleaned up threads"));
log((CLOG_DEBUG1 "cleaned up threads"));
}
CServer::CScreenInfo* CServer::addConnection(

View File

@@ -46,7 +46,7 @@ void CServerProtocol1_0::run()
}
// 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) {
recvInfo();
}
@@ -68,7 +68,7 @@ void CServerProtocol1_0::run()
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
CProtocolUtil::writef(getOutputStream(), kMsgQInfo);
@@ -86,95 +86,95 @@ void CServerProtocol1_0::queryInfo()
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);
}
void CServerProtocol1_0::sendEnter(
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);
}
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);
}
void CServerProtocol1_0::sendClipboard(
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);
}
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);
}
void CServerProtocol1_0::sendQueryClipboard(
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);
}
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);
}
void CServerProtocol1_0::sendKeyDown(
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);
}
void CServerProtocol1_0::sendKeyRepeat(
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);
}
void CServerProtocol1_0::sendKeyUp(
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);
}
void CServerProtocol1_0::sendMouseDown(
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);
}
void CServerProtocol1_0::sendMouseUp(
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);
}
void CServerProtocol1_0::sendMouseMove(
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);
}
void CServerProtocol1_0::sendMouseWheel(
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);
}
@@ -183,7 +183,7 @@ void CServerProtocol1_0::recvInfo()
// parse the message
SInt16 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
if (w == 0 || h == 0) {
@@ -200,7 +200,7 @@ void CServerProtocol1_0::recvClipboard()
UInt32 seqNum;
CString 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);
}
@@ -208,6 +208,6 @@ void CServerProtocol1_0::recvGrabClipboard()
{
ClipboardID 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());
}

View File

@@ -51,7 +51,7 @@ void CXWindowsPrimaryScreen::run()
}
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 KeyID key = mapKey(&xevent.xkey);
if (key != kKeyNone) {
@@ -65,7 +65,7 @@ void CXWindowsPrimaryScreen::run()
// FIXME -- simulate key repeat. X sends press/release for
// repeat. must detect auto repeat and use kKeyRepeat.
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 KeyID key = mapKey(&xevent.xkey);
if (key != kKeyNone) {
@@ -77,7 +77,7 @@ void CXWindowsPrimaryScreen::run()
}
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);
if (button != kButtonNone) {
m_server->onMouseDown(button);
@@ -86,7 +86,7 @@ void CXWindowsPrimaryScreen::run()
}
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);
if (button != kButtonNone) {
m_server->onMouseUp(button);
@@ -95,7 +95,7 @@ void CXWindowsPrimaryScreen::run()
}
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;
if (!m_active) {
x = xevent.xmotion.x_root;
@@ -270,11 +270,11 @@ void CXWindowsPrimaryScreen::leave()
m_window, None, CurrentTime);
assert(result != GrabNotViewable);
if (result != GrabSuccess) {
log((CLOG_DEBUG "waiting to grab pointer"));
log((CLOG_DEBUG2 "waiting to grab pointer"));
CThread::sleep(0.1);
}
} while (result != GrabSuccess);
log((CLOG_DEBUG "grabbed pointer"));
log((CLOG_DEBUG2 "grabbed pointer"));
// now the keyboard
result = XGrabKeyboard(display, m_window, True,
@@ -283,11 +283,11 @@ void CXWindowsPrimaryScreen::leave()
if (result != GrabSuccess) {
// back off to avoid grab deadlock
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);
}
} while (result != GrabSuccess);
log((CLOG_DEBUG "grabbed keyboard"));
log((CLOG_DEBUG1 "grabbed pointer and keyboard"));
// move the mouse to the center of grab window
SInt32 w, h;
@@ -313,7 +313,7 @@ void CXWindowsPrimaryScreen::warpCursorNoLock(
// warp the mouse
XWarpPointer(display, None, getRoot(), 0, 0, 0, 0, x, y);
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
XEvent xevent;