Changed log() and logc() macros to LOG() and LOGC(), respectively.

This avoids a conflict with the standard math library log()
function.
This commit is contained in:
crs
2002-10-15 21:29:44 +00:00
parent 9e7b411f78
commit d8dde48c2b
30 changed files with 422 additions and 422 deletions

View File

@@ -122,7 +122,7 @@ CClient::onError()
void
CClient::onInfoChanged(const CClientInfo& info)
{
log((CLOG_DEBUG "resolution changed"));
LOG((CLOG_DEBUG "resolution changed"));
CLock lock(&m_mutex);
if (m_server != NULL) {
@@ -168,12 +168,12 @@ CClient::open()
{
// open the screen
try {
log((CLOG_INFO "opening screen"));
LOG((CLOG_INFO "opening screen"));
openSecondaryScreen();
}
catch (XScreenOpenFailure&) {
// can't open screen
log((CLOG_INFO "failed to open screen"));
LOG((CLOG_INFO "failed to open screen"));
throw;
}
}
@@ -193,7 +193,7 @@ CClient::mainLoop()
}
try {
log((CLOG_NOTE "starting client \"%s\"", m_name.c_str()));
LOG((CLOG_NOTE "starting client \"%s\"", m_name.c_str()));
// start server interactions
{
@@ -207,29 +207,29 @@ CClient::mainLoop()
// clean up
deleteSession();
log((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
LOG((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
}
catch (XBase& e) {
log((CLOG_ERR "client error: %s", e.what()));
LOG((CLOG_ERR "client error: %s", e.what()));
// clean up
deleteSession();
log((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
LOG((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
CLock lock(&m_mutex);
m_rejected = false;
}
catch (XThread&) {
// clean up
deleteSession();
log((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
LOG((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
throw;
}
catch (...) {
log((CLOG_DEBUG "unknown client error"));
LOG((CLOG_DEBUG "unknown client error"));
// clean up
deleteSession();
log((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
LOG((CLOG_NOTE "stopping client \"%s\"", m_name.c_str()));
throw;
}
}
@@ -238,7 +238,7 @@ void
CClient::close()
{
closeSecondaryScreen();
log((CLOG_INFO "closed screen"));
LOG((CLOG_INFO "closed screen"));
}
void
@@ -392,7 +392,7 @@ CClient::openSecondaryScreen()
}
// create screen
log((CLOG_DEBUG1 "creating secondary screen"));
LOG((CLOG_DEBUG1 "creating secondary screen"));
if (m_screenFactory != NULL) {
m_screen = m_screenFactory->create(this);
}
@@ -402,11 +402,11 @@ CClient::openSecondaryScreen()
// open screen
try {
log((CLOG_DEBUG1 "opening secondary screen"));
LOG((CLOG_DEBUG1 "opening secondary screen"));
m_screen->open();
}
catch (...) {
log((CLOG_DEBUG1 "destroying secondary screen"));
LOG((CLOG_DEBUG1 "destroying secondary screen"));
delete m_screen;
m_screen = NULL;
throw;
@@ -419,7 +419,7 @@ CClient::closeSecondaryScreen()
// close the secondary screen
try {
if (m_screen != NULL) {
log((CLOG_DEBUG1 "closing secondary screen"));
LOG((CLOG_DEBUG1 "closing secondary screen"));
m_screen->close();
}
}
@@ -428,7 +428,7 @@ CClient::closeSecondaryScreen()
}
// clean up
log((CLOG_DEBUG1 "destroying secondary screen"));
LOG((CLOG_DEBUG1 "destroying secondary screen"));
delete m_screen;
m_screen = NULL;
}
@@ -471,14 +471,14 @@ void
CClient::runSession(void*)
{
try {
log((CLOG_DEBUG "starting server proxy"));
LOG((CLOG_DEBUG "starting server proxy"));
runServer();
m_screen->exitMainLoop();
log((CLOG_DEBUG "stopping server proxy"));
LOG((CLOG_DEBUG "stopping server proxy"));
}
catch (...) {
m_screen->exitMainLoop();
log((CLOG_DEBUG "stopping server proxy"));
LOG((CLOG_DEBUG "stopping server proxy"));
throw;
}
}
@@ -514,17 +514,17 @@ CClient::runServer()
CTimerThread timer(15.0);
// create socket and attempt to connect to server
log((CLOG_DEBUG1 "connecting to server"));
LOG((CLOG_DEBUG1 "connecting to server"));
if (m_socketFactory != NULL) {
socket = m_socketFactory->create();
}
assert(socket != NULL);
socket->connect(m_serverAddress);
log((CLOG_INFO "connected to server"));
LOG((CLOG_INFO "connected to server"));
break;
}
catch (XSocketConnect& e) {
log((CLOG_DEBUG1 "failed to connect to server: %s", e.getErrstr()));
LOG((CLOG_DEBUG1 "failed to connect to server: %s", e.getErrstr()));
// failed to connect. if not camping then rethrow.
if (!m_camp) {
@@ -537,25 +537,25 @@ CClient::runServer()
}
// create proxy
log((CLOG_DEBUG1 "negotiating with server"));
LOG((CLOG_DEBUG1 "negotiating with server"));
proxy = handshakeServer(socket);
CLock lock(&m_mutex);
m_server = proxy;
}
catch (XThread&) {
log((CLOG_ERR "connection timed out"));
LOG((CLOG_ERR "connection timed out"));
delete socket;
throw;
}
catch (XBase& e) {
log((CLOG_ERR "connection failed: %s", e.what()));
log((CLOG_DEBUG "disconnecting from server"));
LOG((CLOG_ERR "connection failed: %s", e.what()));
LOG((CLOG_DEBUG "disconnecting from server"));
delete socket;
return;
}
catch (...) {
log((CLOG_ERR "connection failed: <unknown error>"));
log((CLOG_DEBUG "disconnecting from server"));
LOG((CLOG_ERR "connection failed: <unknown error>"));
LOG((CLOG_DEBUG "disconnecting from server"));
delete socket;
return;
}
@@ -564,7 +564,7 @@ CClient::runServer()
// process messages
bool rejected = true;
if (proxy != NULL) {
log((CLOG_DEBUG1 "communicating with server"));
LOG((CLOG_DEBUG1 "communicating with server"));
rejected = !proxy->mainLoop();
}
@@ -573,7 +573,7 @@ CClient::runServer()
m_rejected = rejected;
m_server = NULL;
delete proxy;
log((CLOG_DEBUG "disconnecting from server"));
LOG((CLOG_DEBUG "disconnecting from server"));
socket->close();
delete socket;
}
@@ -582,7 +582,7 @@ CClient::runServer()
m_rejected = false;
m_server = NULL;
delete proxy;
log((CLOG_DEBUG "disconnecting from server"));
LOG((CLOG_DEBUG "disconnecting from server"));
socket->close();
delete socket;
throw;
@@ -615,19 +615,19 @@ CClient::handshakeServer(IDataSocket* socket)
CTimerThread timer(30.0);
// wait for hello from server
log((CLOG_DEBUG1 "wait for hello"));
LOG((CLOG_DEBUG1 "wait for hello"));
SInt16 major, minor;
CProtocolUtil::readf(input, kMsgHello, &major, &minor);
// check versions
log((CLOG_DEBUG1 "got hello version %d.%d", major, minor));
LOG((CLOG_DEBUG1 "got hello version %d.%d", major, minor));
if (major < kProtocolMajorVersion ||
(major == kProtocolMajorVersion && minor < kProtocolMinorVersion)) {
throw XIncompatibleClient(major, minor);
}
// say hello back
log((CLOG_DEBUG1 "say hello version %d.%d", kProtocolMajorVersion, kProtocolMinorVersion));
LOG((CLOG_DEBUG1 "say hello version %d.%d", kProtocolMajorVersion, kProtocolMinorVersion));
CProtocolUtil::writef(output, kMsgHelloBack,
kProtocolMajorVersion,
kProtocolMinorVersion, &m_name);
@@ -641,10 +641,10 @@ CClient::handshakeServer(IDataSocket* socket)
return proxy;
}
catch (XIncompatibleClient& e) {
log((CLOG_ERR "server has incompatible version %d.%d", e.getMajor(), e.getMinor()));
LOG((CLOG_ERR "server has incompatible version %d.%d", e.getMajor(), e.getMinor()));
}
catch (XBase& e) {
log((CLOG_WARN "error communicating with server: %s", e.what()));
LOG((CLOG_WARN "error communicating with server: %s", e.what()));
}
catch (...) {
// probably timed out

View File

@@ -492,7 +492,7 @@ CMSWindowsSecondaryScreen::updateKeys()
m_mask |= KeyModifierScrollLock;
}
// note -- do not save KeyModifierModeSwitch in m_mask
log((CLOG_DEBUG2 "modifiers on update: 0x%04x", m_mask));
LOG((CLOG_DEBUG2 "modifiers on update: 0x%04x", m_mask));
}
void
@@ -625,7 +625,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
virtualKey = g_mapEF00[id & 0xff];
}
if (virtualKey == 0) {
log((CLOG_DEBUG2 "unknown special key"));
LOG((CLOG_DEBUG2 "unknown special key"));
return m_mask;
}
}
@@ -685,7 +685,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
TCHAR ascii = static_cast<TCHAR>(id & 0x000000ff);
SHORT vk = VkKeyScan(ascii);
if (vk == 0xffff) {
log((CLOG_DEBUG2 "no virtual key for character %d", id));
LOG((CLOG_DEBUG2 "no virtual key for character %d", id));
return m_mask;
}
@@ -712,7 +712,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
// are subject to case conversion.
if ((outMask & KeyModifierCapsLock) != 0) {
if (tolower(ascii) != toupper(ascii)) {
log((CLOG_DEBUG2 "flip shift"));
LOG((CLOG_DEBUG2 "flip shift"));
outMask ^= KeyModifierShift;
}
}
@@ -734,11 +734,11 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
// set required shift state based on current numlock state
if ((outMask & KeyModifierNumLock) == 0) {
if ((m_mask & KeyModifierNumLock) == 0) {
log((CLOG_DEBUG2 "turn on num lock for keypad key"));
LOG((CLOG_DEBUG2 "turn on num lock for keypad key"));
outMask |= KeyModifierNumLock;
}
else {
log((CLOG_DEBUG2 "turn on shift for keypad key"));
LOG((CLOG_DEBUG2 "turn on shift for keypad key"));
outMask |= KeyModifierShift;
}
}
@@ -749,7 +749,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
outMask |= KeyModifierShift;
}
}
log((CLOG_DEBUG2 "KeyID %d to virtual key %d mask 0x%04x", id, virtualKey, outMask));
LOG((CLOG_DEBUG2 "KeyID %d to virtual key %d mask 0x%04x", id, virtualKey, outMask));
// a list of modifier key info
class CModifierInfo {
@@ -956,7 +956,7 @@ CMSWindowsSecondaryScreen::mapKey(Keystrokes& keys, UINT& virtualKey,
}
}
log((CLOG_DEBUG2 "previous modifiers 0x%04x, final modifiers 0x%04x", m_mask, mask));
LOG((CLOG_DEBUG2 "previous modifiers 0x%04x, final modifiers 0x%04x", m_mask, mask));
return mask;
}
@@ -1145,5 +1145,5 @@ CMSWindowsSecondaryScreen::sendKeyEvent(UINT virtualKey, bool press)
const UINT code = virtualKeyToScanCode(virtualKey);
keybd_event(static_cast<BYTE>(virtualKey & 0xff),
static_cast<BYTE>(code), flags, 0);
log((CLOG_DEBUG1 "send key %d, 0x%04x, %s%s", virtualKey & 0xff, code, ((flags & KEYEVENTF_KEYUP) ? "release" : "press"), ((flags & KEYEVENTF_EXTENDEDKEY) ? " extended" : "")));
LOG((CLOG_DEBUG1 "send key %d, 0x%04x, %s%s", virtualKey & 0xff, code, ((flags & KEYEVENTF_KEYUP) ? "release" : "press"), ((flags & KEYEVENTF_EXTENDEDKEY) ? " extended" : "")));
}

View File

@@ -40,15 +40,15 @@ CSecondaryScreen::mainLoop()
// run event loop
try {
log((CLOG_DEBUG "entering event loop"));
LOG((CLOG_DEBUG "entering event loop"));
onPreMainLoop();
getScreen()->mainLoop();
onPostMainLoop();
log((CLOG_DEBUG "exiting event loop"));
LOG((CLOG_DEBUG "exiting event loop"));
}
catch (...) {
onPostMainLoop();
log((CLOG_DEBUG "exiting event loop"));
LOG((CLOG_DEBUG "exiting event loop"));
throw;
}
}
@@ -115,7 +115,7 @@ CSecondaryScreen::enter(SInt32 x, SInt32 y, KeyModifierMask mask)
CLock lock(&m_mutex);
assert(m_active == false);
log((CLOG_INFO "entering screen at %d,%d mask=%04x", x, y, mask));
LOG((CLOG_INFO "entering screen at %d,%d mask=%04x", x, y, mask));
getScreen()->syncDesktop();
@@ -144,7 +144,7 @@ CSecondaryScreen::enter(SInt32 x, SInt32 y, KeyModifierMask mask)
void
CSecondaryScreen::leave()
{
log((CLOG_INFO "leaving screen"));
LOG((CLOG_INFO "leaving screen"));
CLock lock(&m_mutex);
assert(m_active == true);

View File

@@ -69,13 +69,13 @@ CServerProxy::mainLoop()
}
// wait for a message
log((CLOG_DEBUG2 "waiting for message"));
LOG((CLOG_DEBUG2 "waiting for message"));
UInt8 code[4];
UInt32 n = getInputStream()->read(code, 4, kHeartRate);
// check if server hungup
if (n == 0) {
log((CLOG_NOTE "server disconnected"));
LOG((CLOG_NOTE "server disconnected"));
break;
}
@@ -95,12 +95,12 @@ CServerProxy::mainLoop()
// verify we got an entire code
if (n != 4) {
// client sent an incomplete message
log((CLOG_ERR "incomplete message from server"));
LOG((CLOG_ERR "incomplete message from server"));
break;
}
// parse message
log((CLOG_DEBUG2 "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) {
mouseMove();
}
@@ -163,7 +163,7 @@ CServerProxy::mainLoop()
else if (memcmp(code, kMsgCClose, 4) == 0) {
// server wants us to hangup
log((CLOG_DEBUG1 "recv close"));
LOG((CLOG_DEBUG1 "recv close"));
break;
}
@@ -171,39 +171,39 @@ CServerProxy::mainLoop()
SInt32 major, minor;
CProtocolUtil::readf(getInputStream(),
kMsgEIncompatible + 4, &major, &minor);
log((CLOG_ERR "server has incompatible version %d.%d", major, minor));
LOG((CLOG_ERR "server has incompatible version %d.%d", major, minor));
failedToConnect = true;
break;
}
else if (memcmp(code, kMsgEBusy, 4) == 0) {
log((CLOG_ERR "server already has a connected client with name \"%s\"", getName().c_str()));
LOG((CLOG_ERR "server already has a connected client with name \"%s\"", getName().c_str()));
failedToConnect = true;
break;
}
else if (memcmp(code, kMsgEUnknown, 4) == 0) {
log((CLOG_ERR "server refused client with name \"%s\"", getName().c_str()));
LOG((CLOG_ERR "server refused client with name \"%s\"", getName().c_str()));
failedToConnect = true;
break;
}
else if (memcmp(code, kMsgEBad, 4) == 0) {
log((CLOG_ERR "server disconnected due to a protocol error"));
LOG((CLOG_ERR "server disconnected due to a protocol error"));
failedToConnect = true;
break;
}
else {
// unknown message
log((CLOG_ERR "unknown message from server"));
LOG((CLOG_ERR "unknown message from server"));
failedToConnect = true;
break;
}
}
}
catch (XBase& e) {
log((CLOG_ERR "error: %s", e.what()));
LOG((CLOG_ERR "error: %s", e.what()));
}
catch (...) {
throw;
@@ -257,7 +257,7 @@ CServerProxy::onInfoChanged(const CClientInfo& info)
bool
CServerProxy::onGrabClipboard(ClipboardID id)
{
log((CLOG_DEBUG1 "sending clipboard %d changed", id));
LOG((CLOG_DEBUG1 "sending clipboard %d changed", id));
CLock lock(&m_mutex);
CProtocolUtil::writef(getOutputStream(), kMsgCClipboard, id, m_seqNum);
return true;
@@ -267,7 +267,7 @@ void
CServerProxy::onClipboardChanged(ClipboardID id, const CString& data)
{
CLock lock(&m_mutex);
log((CLOG_DEBUG1 "sending clipboard %d seqnum=%d, size=%d", id, m_seqNum, data.size()));
LOG((CLOG_DEBUG1 "sending clipboard %d seqnum=%d, size=%d", id, m_seqNum, data.size()));
CProtocolUtil::writef(getOutputStream(), kMsgDClipboard, id, m_seqNum, &data);
}
@@ -295,7 +295,7 @@ void
CServerProxy::sendInfo(const CClientInfo& info)
{
// note -- m_mutex should be locked on entry
log((CLOG_DEBUG1 "sending info shape=%d,%d %dx%d zone=%d pos=%d,%d", info.m_x, info.m_y, info.m_w, info.m_h, info.m_zoneSize, info.m_mx, info.m_my));
LOG((CLOG_DEBUG1 "sending info shape=%d,%d %dx%d zone=%d pos=%d,%d", info.m_x, info.m_y, info.m_w, info.m_h, info.m_zoneSize, info.m_mx, info.m_my));
CProtocolUtil::writef(getOutputStream(), kMsgDInfo,
info.m_x, info.m_y,
info.m_w, info.m_h,
@@ -312,7 +312,7 @@ CServerProxy::enter()
UInt32 seqNum;
CProtocolUtil::readf(getInputStream(),
kMsgCEnter + 4, &x, &y, &seqNum, &mask);
log((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", x, y, seqNum, mask));
LOG((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", x, y, seqNum, mask));
// discard old compressed mouse motion, if any
{
@@ -329,7 +329,7 @@ void
CServerProxy::leave()
{
// parse
log((CLOG_DEBUG1 "recv leave"));
LOG((CLOG_DEBUG1 "recv leave"));
// send last mouse motion
flushCompressedMouse();
@@ -347,7 +347,7 @@ CServerProxy::setClipboard()
CString data;
CProtocolUtil::readf(getInputStream(),
kMsgDClipboard + 4, &id, &seqNum, &data);
log((CLOG_DEBUG "recv clipboard %d size=%d", id, data.size()));
LOG((CLOG_DEBUG "recv clipboard %d size=%d", id, data.size()));
// validate
if (id >= kClipboardEnd) {
@@ -365,7 +365,7 @@ CServerProxy::grabClipboard()
ClipboardID id;
UInt32 seqNum;
CProtocolUtil::readf(getInputStream(), kMsgCClipboard + 4, &id, &seqNum);
log((CLOG_DEBUG "recv grab clipboard %d", id));
LOG((CLOG_DEBUG "recv grab clipboard %d", id));
// validate
if (id >= kClipboardEnd) {
@@ -385,7 +385,7 @@ CServerProxy::keyDown()
// parse
UInt16 id, mask;
CProtocolUtil::readf(getInputStream(), kMsgDKeyDown + 4, &id, &mask);
log((CLOG_DEBUG1 "recv key down id=%d, mask=0x%04x", id, mask));
LOG((CLOG_DEBUG1 "recv key down id=%d, mask=0x%04x", id, mask));
// forward
getClient()->keyDown(static_cast<KeyID>(id),
@@ -402,7 +402,7 @@ CServerProxy::keyRepeat()
UInt16 id, mask, count;
CProtocolUtil::readf(getInputStream(),
kMsgDKeyRepeat + 4, &id, &mask, &count);
log((CLOG_DEBUG1 "recv key repeat id=%d, mask=0x%04x, count=%d", id, mask, count));
LOG((CLOG_DEBUG1 "recv key repeat id=%d, mask=0x%04x, count=%d", id, mask, count));
// forward
getClient()->keyRepeat(static_cast<KeyID>(id),
@@ -419,7 +419,7 @@ CServerProxy::keyUp()
// parse
UInt16 id, mask;
CProtocolUtil::readf(getInputStream(), kMsgDKeyUp + 4, &id, &mask);
log((CLOG_DEBUG1 "recv key up id=%d, mask=0x%04x", id, mask));
LOG((CLOG_DEBUG1 "recv key up id=%d, mask=0x%04x", id, mask));
// forward
getClient()->keyUp(static_cast<KeyID>(id),
@@ -435,7 +435,7 @@ CServerProxy::mouseDown()
// parse
SInt8 id;
CProtocolUtil::readf(getInputStream(), kMsgDMouseDown + 4, &id);
log((CLOG_DEBUG1 "recv mouse down id=%d", id));
LOG((CLOG_DEBUG1 "recv mouse down id=%d", id));
// forward
getClient()->mouseDown(static_cast<ButtonID>(id));
@@ -450,7 +450,7 @@ CServerProxy::mouseUp()
// parse
SInt8 id;
CProtocolUtil::readf(getInputStream(), kMsgDMouseUp + 4, &id);
log((CLOG_DEBUG1 "recv mouse up id=%d", id));
LOG((CLOG_DEBUG1 "recv mouse up id=%d", id));
// forward
getClient()->mouseUp(static_cast<ButtonID>(id));
@@ -481,7 +481,7 @@ CServerProxy::mouseMove()
m_yMouse = y;
}
}
log((CLOG_DEBUG2 "recv mouse move %d,%d", x, y));
LOG((CLOG_DEBUG2 "recv mouse move %d,%d", x, y));
// forward
if (!ignore) {
@@ -498,7 +498,7 @@ CServerProxy::mouseWheel()
// parse
SInt16 delta;
CProtocolUtil::readf(getInputStream(), kMsgDMouseWheel + 4, &delta);
log((CLOG_DEBUG2 "recv mouse wheel %+d", delta));
LOG((CLOG_DEBUG2 "recv mouse wheel %+d", delta));
// forward
getClient()->mouseWheel(delta);
@@ -510,7 +510,7 @@ CServerProxy::screensaver()
// parse
SInt8 on;
CProtocolUtil::readf(getInputStream(), kMsgCScreenSaver + 4, &on);
log((CLOG_DEBUG1 "recv screen saver on=%d", on));
LOG((CLOG_DEBUG1 "recv screen saver on=%d", on));
// forward
getClient()->screensaver(on != 0);
@@ -534,7 +534,7 @@ void
CServerProxy::infoAcknowledgment()
{
// parse
log((CLOG_DEBUG1 "recv info acknowledgment"));
LOG((CLOG_DEBUG1 "recv info acknowledgment"));
// now allow mouse motion
CLock lock(&m_mutex);

View File

@@ -293,7 +293,7 @@ CXWindowsSecondaryScreen::createWindow()
int majorOpcode, firstEvent, firstError;
if (!XQueryExtension(display, XTestExtensionName,
&majorOpcode, &firstEvent, &firstError)) {
log((CLOG_ERR "XTEST extension not available"));
LOG((CLOG_ERR "XTEST extension not available"));
throw XScreenOpenFailure();
}
@@ -317,7 +317,7 @@ CXWindowsSecondaryScreen::createWindow()
if (m_window == None) {
throw XScreenOpenFailure();
}
log((CLOG_DEBUG "window is 0x%08x", m_window));
LOG((CLOG_DEBUG "window is 0x%08x", m_window));
// become impervious to server grabs
XTestGrabControl(display, True);
@@ -490,28 +490,28 @@ CXWindowsSecondaryScreen::mapKey(Keystrokes& keys, KeyCode& keycode,
// keys affected by CapsLock.
bool desireShift = (getBits(desired, ShiftMask) != 0);
bool invertShift = false;
log((CLOG_DEBUG1 "desire shift 1: %s", desireShift?"yes":"no"));
LOG((CLOG_DEBUG1 "desire shift 1: %s", desireShift?"yes":"no"));
if (adjustForNumLock(keysym)) {
log((CLOG_DEBUG1 "num lock sensitive"));
LOG((CLOG_DEBUG1 "num lock sensitive"));
if (m_numLockMask != 0) {
log((CLOG_DEBUG1 "we have num lock"));
LOG((CLOG_DEBUG1 "we have num lock"));
if (getBits(desired, m_numLockMask) != 0) {
log((CLOG_DEBUG1 "num lock desired, invert shift"));
LOG((CLOG_DEBUG1 "num lock desired, invert shift"));
invertShift = true;
}
}
}
else if (adjustForCapsLock(keysym)) {
log((CLOG_DEBUG1 "caps lock sensitive"));
LOG((CLOG_DEBUG1 "caps lock sensitive"));
if (m_capsLockMask != 0) {
log((CLOG_DEBUG1 "we have caps lock"));
LOG((CLOG_DEBUG1 "we have caps lock"));
if (getBits(desired, m_capsLockMask) != 0) {
log((CLOG_DEBUG1 "caps lock desired, invert shift"));
LOG((CLOG_DEBUG1 "caps lock desired, invert shift"));
invertShift = true;
}
}
}
log((CLOG_DEBUG1 "desire shift 2: %s", desireShift?"yes":"no"));
LOG((CLOG_DEBUG1 "desire shift 2: %s", desireShift?"yes":"no"));
if (desireShift != invertShift) {
index[0] ^= 1;
index[1] ^= 1;
@@ -538,7 +538,7 @@ log((CLOG_DEBUG1 "desire shift 2: %s", desireShift?"yes":"no"));
// get the keycode
keycode = entry.m_keycode[bestIndex];
log((CLOG_DEBUG1 "bestIndex = %d, keycode = %d", bestIndex, keycode));
LOG((CLOG_DEBUG1 "bestIndex = %d, keycode = %d", bestIndex, keycode));
// note if the key is a modifier
ModifierMap::const_iterator modIndex = m_keycodeToModifier.find(keycode);
@@ -553,13 +553,13 @@ log((CLOG_DEBUG1 "bestIndex = %d, keycode = %d", bestIndex, keycode));
// though.
if (modifierBit != 0) {
if (action == kRepeat) {
log((CLOG_DEBUG1 "ignore repeating modifier"));
LOG((CLOG_DEBUG1 "ignore repeating modifier"));
return m_mask;
}
if (getBits(m_toggleModifierMask, modifierBit) == 0) {
if ((action == kPress && (m_mask & modifierBit) != 0) ||
(action == kRelease && (m_mask & modifierBit) == 0)) {
log((CLOG_DEBUG1 "modifier in proper state: 0x%04x", m_mask));
LOG((CLOG_DEBUG1 "modifier in proper state: 0x%04x", m_mask));
return m_mask;
}
}
@@ -594,7 +594,7 @@ log((CLOG_DEBUG1 "modifier in proper state: 0x%04x", m_mask));
// the same bit in m_mask, meaning it's already in the right state.
desired = assignBits(desired, modifierBit, m_mask);
required = clearBits(required, modifierBit);
log((CLOG_DEBUG1 "desired = 0x%04x, current = 0x%04x", desired, m_mask));
LOG((CLOG_DEBUG1 "desired = 0x%04x, current = 0x%04x", desired, m_mask));
// add the key events required to get to the modifier state
// necessary to generate an event yielding id. also save the
@@ -607,13 +607,13 @@ log((CLOG_DEBUG1 "desired = 0x%04x, current = 0x%04x", desired, m_mask));
for (unsigned int i = 0; i < 8; ++i) {
unsigned int bit = (1 << i);
if (getBits(desired, bit) != getBits(m_mask, bit)) {
log((CLOG_DEBUG1 "fix modifier %d", i));
LOG((CLOG_DEBUG1 "fix modifier %d", i));
// get the keycode we're using for this modifier. if
// there isn't one then bail if the modifier is required
// or ignore it if not required.
KeyCode modifierKey = m_modifierToKeycode[i];
if (modifierKey == 0) {
log((CLOG_DEBUG1 "no key mapped to modifier 0x%04x", bit));
LOG((CLOG_DEBUG1 "no key mapped to modifier 0x%04x", bit));
if (getBits(required, bit) != 0) {
keys.clear();
return m_mask;
@@ -630,9 +630,9 @@ log((CLOG_DEBUG1 "fix modifier %d", i));
// modifier is a toggle then toggle it on with a
// press/release, otherwise activate it with a
// press. use the first keycode for the modifier.
log((CLOG_DEBUG2 "modifier 0x%04x is not active", bit));
LOG((CLOG_DEBUG2 "modifier 0x%04x is not active", bit));
if (getBits(m_toggleModifierMask, bit) != 0) {
log((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
LOG((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
if ((bit == m_capsLockMask && m_capsLockHalfDuplex) ||
(bit == m_numLockMask && m_numLockHalfDuplex)) {
keystroke.m_press = True;
@@ -664,9 +664,9 @@ log((CLOG_DEBUG1 "fix modifier %d", i));
// press/release, otherwise deactivate it with a
// release. we must check each keycode for the
// modifier if not a toggle.
log((CLOG_DEBUG2 "modifier 0x%04x is active", bit));
LOG((CLOG_DEBUG2 "modifier 0x%04x is active", bit));
if (getBits(m_toggleModifierMask, bit) != 0) {
log((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
LOG((CLOG_DEBUG2 "modifier 0x%04x is a toggle", bit));
if ((bit == m_capsLockMask && m_capsLockHalfDuplex) ||
(bit == m_numLockMask && m_numLockHalfDuplex)) {
keystroke.m_press = False;
@@ -773,7 +773,7 @@ log((CLOG_DEBUG1 "fix modifier %d", i));
}
}
log((CLOG_DEBUG1 "final mask: 0x%04x", mask));
LOG((CLOG_DEBUG1 "final mask: 0x%04x", mask));
return mask;
}
@@ -1308,7 +1308,7 @@ CXWindowsSecondaryScreen::adjustForNumLock(KeySym keysym) const
{
if (IsKeypadKey(keysym) || IsPrivateKeypadKey(keysym)) {
// it's NumLock sensitive
log((CLOG_DEBUG2 "keypad key: NumLock %s", ((m_mask & m_numLockMask) != 0) ? "active" : "inactive"));
LOG((CLOG_DEBUG2 "keypad key: NumLock %s", ((m_mask & m_numLockMask) != 0) ? "active" : "inactive"));
return true;
}
return false;
@@ -1321,7 +1321,7 @@ CXWindowsSecondaryScreen::adjustForCapsLock(KeySym keysym) const
XConvertCase(keysym, &lKey, &uKey);
if (lKey != uKey) {
// it's CapsLock sensitive
log((CLOG_DEBUG2 "case convertible: CapsLock %s", ((m_mask & m_capsLockMask) != 0) ? "active" : "inactive"));
LOG((CLOG_DEBUG2 "case convertible: CapsLock %s", ((m_mask & m_capsLockMask) != 0) ? "active" : "inactive"));
return true;
}
return false;