refactor: update log calls to LOG_... fixes #8819

This commit is contained in:
sithlord48
2025-08-06 07:54:59 -04:00
committed by Nick Bolton
parent 4f644acbca
commit 2a84ef0ebf
64 changed files with 707 additions and 726 deletions

View File

@ -78,7 +78,7 @@ int ArchDaemonUnix::daemonize(const char *name, DaemonFunc const &func)
// TODO: this is a bit of a hack - can we find a better solution?
if (int chdirErr = chdir("/"); chdirErr)
// NB: file logging actually isn't working at this point!
LOG((CLOG_ERR "chdir error: %i", chdirErr));
LOG_ERR("chdir error: %i", chdirErr);
#endif
// mask off permissions for any but owner
@ -96,7 +96,7 @@ int ArchDaemonUnix::daemonize(const char *name, DaemonFunc const &func)
if (int dupErr = dup(1); dupErr < 0) {
// NB: file logging actually isn't working at this point!
LOG((CLOG_ERR "dup error: %i", dupErr));
LOG_ERR("dup error: %i", dupErr);
}
#ifdef __APPLE__

View File

@ -322,7 +322,7 @@ bool ArchMiscWindows::wasLaunchedAsService()
{
std::string name;
if (!getParentProcessName(name)) {
LOG((CLOG_ERR "cannot determine if process was launched as service"));
LOG_ERR("cannot determine if process was launched as service");
return false;
}
@ -333,7 +333,7 @@ bool ArchMiscWindows::getParentProcessName(std::string &name)
{
PROCESSENTRY32 parentEntry;
if (!getParentProcessEntry(parentEntry)) {
LOG((CLOG_ERR "could not get entry for parent process"));
LOG_ERR("could not get entry for parent process");
return false;
}
@ -364,7 +364,7 @@ BOOL WINAPI ArchMiscWindows::getProcessEntry(PROCESSENTRY32 &entry, DWORD proces
// first we need to take a snapshot of the running processes
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (snapshot == INVALID_HANDLE_VALUE) {
LOG((CLOG_ERR "could not get process snapshot (error: %i)", GetLastError()));
LOG_ERR("could not get process snapshot (error: %i)", GetLastError());
return FALSE;
}
@ -374,7 +374,7 @@ BOOL WINAPI ArchMiscWindows::getProcessEntry(PROCESSENTRY32 &entry, DWORD proces
// unlikely we can go any further
BOOL gotEntry = Process32First(snapshot, &entry);
if (!gotEntry) {
LOG((CLOG_ERR "could not get first process entry (error: %i)", GetLastError()));
LOG_ERR("could not get first process entry (error: %i)", GetLastError());
return FALSE;
}
@ -409,7 +409,7 @@ std::string ArchMiscWindows::getActiveDesktopName()
{
HDESK desk = OpenInputDesktop(0, TRUE, GENERIC_READ);
if (desk == nullptr) {
LOG((CLOG_ERR "could not open input desktop"));
LOG_ERR("could not open input desktop");
throw std::runtime_error(windowsErrorToString(GetLastError()));
}

View File

@ -51,9 +51,9 @@ void EventQueue::loop()
*m_readyCondVar = true;
m_readyCondVar->signal();
}
LOG((CLOG_DEBUG "event queue is ready"));
LOG_DEBUG("event queue is ready");
while (!m_pending.empty()) {
LOG((CLOG_DEBUG "add pending events to buffer"));
LOG_DEBUG("add pending events to buffer");
const Event &event = m_pending.front();
addEventToBuffer(event);
m_pending.pop();
@ -72,12 +72,12 @@ void EventQueue::adoptBuffer(IEventQueueBuffer *buffer)
{
std::scoped_lock lock{m_mutex};
LOG((CLOG_DEBUG "adopting new buffer"));
LOG_DEBUG("adopting new buffer");
if (m_events.size() != 0) {
// this can come as a nasty surprise to programmers expecting
// their events to be raised, only to have them deleted.
LOG((CLOG_DEBUG "discarding %d event(s)", m_events.size()));
LOG_DEBUG("discarding %d event(s)", m_events.size());
}
// discard old buffer and old events

View File

@ -124,7 +124,7 @@ void Client::connect(size_t addressIndex)
m_stream = new PacketStreamFilter(m_events, socket, true);
// connect
LOG((CLOG_DEBUG1 "connecting to server"));
LOG_DEBUG1("connecting to server");
setupConnecting();
setupTimer();
socket->connect(m_serverAddress);
@ -132,7 +132,7 @@ void Client::connect(size_t addressIndex)
cleanupTimer();
cleanupConnecting();
cleanupStream();
LOG((CLOG_DEBUG1 "connection failed"));
LOG_DEBUG1("connection failed");
sendConnectionFailedEvent(e.what());
return;
}
@ -305,7 +305,7 @@ void Client::setOptions(const OptionsList &options)
index++;
if (index != options.end()) {
if (!*index) {
LOG((CLOG_NOTE "clipboard sharing disabled by server"));
LOG_NOTE("clipboard sharing disabled by server");
}
m_enableClipboard = *index;
}
@ -319,8 +319,7 @@ void Client::setOptions(const OptionsList &options)
if (m_enableClipboard && !m_maximumClipboardSize) {
m_enableClipboard = false;
LOG((CLOG_NOTE "clipboard sharing is disabled because the server "
"set the maximum clipboard size to 0"));
LOG_NOTE("clipboard sharing is disabled because the server set the maximum clipboard size to 0");
}
m_screen->setOptions(options);
@ -509,7 +508,7 @@ void Client::cleanupStream()
void Client::handleConnected()
{
LOG((CLOG_DEBUG1 "connected, waiting for hello"));
LOG_DEBUG1("connected, waiting for hello");
cleanupConnecting();
setupConnection();
@ -528,7 +527,7 @@ void Client::handleConnectionFailed(const Event &event)
cleanupTimer();
cleanupConnecting();
cleanupStream();
LOG((CLOG_DEBUG1 "connection failed"));
LOG_DEBUG1("connection failed");
sendConnectionFailedEvent(info->m_what.c_str());
delete info;
}
@ -539,7 +538,7 @@ void Client::handleConnectTimeout()
cleanupConnecting();
cleanupConnection();
cleanupStream();
LOG((CLOG_DEBUG1 "connection timed out"));
LOG_DEBUG1("connection timed out");
sendConnectionFailedEvent("Timed out");
}
@ -548,7 +547,7 @@ void Client::handleOutputError()
cleanupTimer();
cleanupScreen();
cleanupConnection();
LOG((CLOG_WARN "error sending to server"));
LOG_WARN("error sending to server");
sendEvent(EventTypes::ClientDisconnected, nullptr);
}
@ -557,13 +556,13 @@ void Client::handleDisconnected()
cleanupTimer();
cleanupScreen();
cleanupConnection();
LOG((CLOG_DEBUG1 "disconnected"));
LOG_DEBUG1("disconnected");
sendEvent(EventTypes::ClientDisconnected, nullptr);
}
void Client::handleShapeChanged()
{
LOG((CLOG_DEBUG "resolution changed"));
LOG_DEBUG("resolution changed");
m_server->onInfoChanged();
}
@ -609,7 +608,7 @@ void Client::handleHello()
void Client::handleSuspend()
{
if (!m_suspended) {
LOG((CLOG_INFO "suspend"));
LOG_INFO("suspend");
m_suspended = true;
bool wasConnected = isConnected();
disconnect(nullptr);
@ -620,7 +619,7 @@ void Client::handleSuspend()
void Client::handleResume()
{
if (m_suspended) {
LOG((CLOG_INFO "resume"));
LOG_INFO("resume");
m_suspended = false;
if (m_connectOnResume) {
m_connectOnResume = false;
@ -633,7 +632,7 @@ void Client::bindNetworkInterface(IDataSocket *socket) const
{
try {
if (!m_args.m_deskflowAddress.empty()) {
LOG((CLOG_DEBUG1 "bind to network interface: %s", m_args.m_deskflowAddress.c_str()));
LOG_DEBUG1("bind to network interface: %s", m_args.m_deskflowAddress.c_str());
NetworkAddress bindAddress(m_args.m_deskflowAddress);
bindAddress.resolve();
@ -641,7 +640,7 @@ void Client::bindNetworkInterface(IDataSocket *socket) const
socket->bind(bindAddress);
}
} catch (XBase &e) {
LOG((CLOG_WARN "%s", e.what()));
LOG((CLOG_WARN "operating system will select network interface automatically"));
LOG_WARN("%s", e.what());
LOG_WARN("operating system will select network interface automatically");
}
}

View File

@ -65,10 +65,7 @@ void HelloBack::handleHello(deskflow::IStream *stream, const std::string &client
}
// say hello back with same protocol name and version
LOG_DEBUG(
"saying hello back with version %s %d.%d", //
protocolName.c_str(), helloBackMajor, helloBackMinor
);
LOG_DEBUG("saying hello back with version %s %d.%d", protocolName.c_str(), helloBackMajor, helloBackMinor);
// dynamically build write format for hello back since `ProtocolUtil::writef`
// doesn't support formatting fixed length strings yet.

View File

@ -87,13 +87,13 @@ void ServerProxy::handleData()
while (n != 0) {
// verify we got an entire code
if (n != 4) {
LOG((CLOG_ERR "incomplete message from server: %d bytes", n));
LOG_ERR("incomplete message from server: %d bytes", n);
m_client->disconnect("incomplete message from server");
return;
}
// parse message
LOG((CLOG_DEBUG2 "msg from server: %c%c%c%c", code[0], code[1], code[2], code[3]));
LOG_DEBUG2("msg from server: %c%c%c%c", code[0], code[1], code[2], code[3]);
try {
switch ((this->*m_parser)(code)) {
using enum ConnectionResult;
@ -101,7 +101,7 @@ void ServerProxy::handleData()
break;
case Unknown:
LOG((CLOG_ERR "invalid message from server: %c%c%c%c", code[0], code[1], code[2], code[3]));
LOG_ERR("invalid message from server: %c%c%c%c", code[0], code[1], code[2], code[3]);
// not possible to determine message boundaries
// read the whole stream to discard unkonwn data
while (m_stream->read(nullptr, 4))
@ -112,7 +112,7 @@ void ServerProxy::handleData()
return;
}
} catch (const XBadClient &e) {
LOG((CLOG_ERR "protocol error from server: %s", e.what()));
LOG_ERR("protocol error from server: %s", e.what());
ProtocolUtil::writef(m_stream, kMsgEBad);
m_client->disconnect("invalid message from server");
return;
@ -162,7 +162,7 @@ ServerProxy::ConnectionResult ServerProxy::parseHandshakeMessage(const uint8_t *
else if (memcmp(code, kMsgCClose, 4) == 0) {
// server wants us to hangup
LOG((CLOG_DEBUG1 "recv close"));
LOG_DEBUG1("recv close");
m_client->disconnect(nullptr);
return Disconnect;
}
@ -171,25 +171,25 @@ ServerProxy::ConnectionResult ServerProxy::parseHandshakeMessage(const uint8_t *
int32_t major;
int32_t minor;
ProtocolUtil::readf(m_stream, kMsgEIncompatible + 4, &major, &minor);
LOG((CLOG_ERR "server has incompatible version %d.%d", major, minor));
LOG_ERR("server has incompatible version %d.%d", major, minor);
m_client->refuseConnection("server has incompatible version");
return Disconnect;
}
else if (memcmp(code, kMsgEBusy, 4) == 0) {
LOG((CLOG_ERR "server already has a connected client with name \"%s\"", m_client->getName().c_str()));
LOG_ERR("server already has a connected client with name \"%s\"", m_client->getName().c_str());
m_client->refuseConnection("server already has a connected client with our name");
return Disconnect;
}
else if (memcmp(code, kMsgEUnknown, 4) == 0) {
LOG((CLOG_ERR "server refused client with name \"%s\"", m_client->getName().c_str()));
LOG_ERR("server refused client with name \"%s\"", m_client->getName().c_str());
m_client->refuseConnection("server refused client with our name");
return Disconnect;
}
else if (memcmp(code, kMsgEBad, 4) == 0) {
LOG((CLOG_ERR "server disconnected due to a protocol error"));
LOG_ERR("server disconnected due to a protocol error");
m_client->refuseConnection("server reported a protocol error");
return Disconnect;
} else if (memcmp(code, kMsgDLanguageSynchronisation, 4) == 0) {
@ -222,7 +222,7 @@ ServerProxy::ConnectionResult ServerProxy::parseMessage(const uint8_t *code)
uint16_t mask = 0;
uint16_t button = 0;
ProtocolUtil::readf(m_stream, kMsgDKeyDown + 4, &id, &mask, &button);
LOG((CLOG_DEBUG1 "recv key down id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button));
LOG_DEBUG1("recv key down id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button);
keyDown(id, mask, button, "");
}
@ -234,8 +234,7 @@ ServerProxy::ConnectionResult ServerProxy::parseMessage(const uint8_t *code)
uint16_t button = 0;
ProtocolUtil::readf(m_stream, kMsgDKeyDownLang + 4, &id, &mask, &button, &lang);
LOG((CLOG_DEBUG1 "recv key down id=0x%08x, mask=0x%04x, button=0x%04x, lang=\"%s\"", id, mask, button, lang.c_str())
);
LOG_DEBUG1("recv key down id=0x%08x, mask=0x%04x, button=0x%04x, lang=\"%s\"", id, mask, button, lang.c_str());
keyDown(id, mask, button, lang);
}
@ -308,11 +307,11 @@ ServerProxy::ConnectionResult ServerProxy::parseMessage(const uint8_t *code)
else if (memcmp(code, kMsgCClose, 4) == 0) {
// server wants us to hangup
LOG((CLOG_DEBUG1 "recv close"));
LOG_DEBUG1("recv close");
m_client->disconnect(nullptr);
return Disconnect;
} else if (memcmp(code, kMsgEBad, 4) == 0) {
LOG((CLOG_ERR "server disconnected due to a protocol error"));
LOG_ERR("server disconnected due to a protocol error");
m_client->disconnect("server reported a protocol error");
return Disconnect;
} else {
@ -333,7 +332,7 @@ ServerProxy::ConnectionResult ServerProxy::parseMessage(const uint8_t *code)
void ServerProxy::handleKeepAliveAlarm()
{
LOG((CLOG_NOTE "server is dead"));
LOG_NOTE("server is dead");
m_client->disconnect("server is not responding");
}
@ -349,7 +348,7 @@ void ServerProxy::onInfoChanged()
bool ServerProxy::onGrabClipboard(ClipboardID id)
{
LOG((CLOG_DEBUG1 "sending clipboard %d changed", id));
LOG_DEBUG1("sending clipboard %d changed", id);
ProtocolUtil::writef(m_stream, kMsgCClipboard, id, m_seqNum);
return true;
}
@ -357,7 +356,7 @@ bool ServerProxy::onGrabClipboard(ClipboardID id)
void ServerProxy::onClipboardChanged(ClipboardID id, const IClipboard *clipboard)
{
std::string data = IClipboard::marshall(clipboard);
LOG((CLOG_DEBUG "sending clipboard %d seqnum=%d", id, m_seqNum));
LOG_DEBUG("sending clipboard %d seqnum=%d", id, m_seqNum);
StreamChunker::sendClipboard(data, data.size(), id, m_seqNum, m_events, this);
}
@ -378,7 +377,7 @@ void ServerProxy::flushCompressedMouse()
void ServerProxy::sendInfo(const ClientInfo &info)
{
LOG((CLOG_DEBUG1 "sending info shape=%d,%d %dx%d", info.m_x, info.m_y, info.m_w, info.m_h));
LOG_DEBUG1("sending info shape=%d,%d %dx%d", info.m_x, info.m_y, info.m_w, info.m_h);
ProtocolUtil::writef(m_stream, kMsgDInfo, info.m_x, info.m_y, info.m_w, info.m_h, 0, info.m_mx, info.m_my);
}
@ -495,7 +494,7 @@ void ServerProxy::enter()
uint16_t mask;
uint32_t seqNum;
ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask);
LOG((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", x, y, seqNum, mask));
LOG_DEBUG1("recv enter, %d,%d %d %04x", x, y, seqNum, mask);
// discard old compressed mouse motion, if any
m_compressMouse = false;
@ -513,7 +512,7 @@ void ServerProxy::enter()
void ServerProxy::leave()
{
// parse
LOG((CLOG_DEBUG1 "recv leave"));
LOG_DEBUG1("recv leave");
// send last mouse motion
flushCompressedMouse();
@ -533,16 +532,16 @@ void ServerProxy::setClipboard()
if (r == TransferState::Started) {
size_t size = ClipboardChunk::getExpectedSize();
LOG((CLOG_DEBUG "receiving clipboard %d size=%d", id, size));
LOG_DEBUG("receiving clipboard %d size=%d", id, size);
} else if (r == TransferState::Finished) {
LOG((CLOG_DEBUG "received clipboard %d size=%d", id, dataCached.size()));
LOG_DEBUG("received clipboard %d size=%d", id, dataCached.size());
// forward
Clipboard clipboard;
clipboard.unmarshall(dataCached, 0);
m_client->setClipboard(id, &clipboard);
LOG((CLOG_INFO "clipboard was updated"));
LOG_INFO("clipboard was updated");
}
}
@ -552,7 +551,7 @@ void ServerProxy::grabClipboard()
ClipboardID id;
uint32_t seqNum;
ProtocolUtil::readf(m_stream, kMsgCClipboard + 4, &id, &seqNum);
LOG((CLOG_DEBUG "recv grab clipboard %d", id));
LOG_DEBUG("recv grab clipboard %d", id);
// validate
if (id >= kClipboardEnd) {
@ -573,7 +572,7 @@ void ServerProxy::keyDown(uint16_t id, uint16_t mask, uint16_t button, const std
KeyID id2 = translateKey(static_cast<KeyID>(id));
KeyModifierMask mask2 = translateModifierMask(static_cast<KeyModifierMask>(mask));
if (id2 != static_cast<KeyID>(id) || mask2 != static_cast<KeyModifierMask>(mask))
LOG((CLOG_DEBUG1 "key down translated to id=0x%08x, mask=0x%04x", id2, mask2));
LOG_DEBUG1("key down translated to id=0x%08x, mask=0x%04x", id2, mask2);
// forward
m_client->keyDown(id2, mask2, button, lang);
@ -601,7 +600,7 @@ void ServerProxy::keyRepeat()
KeyID id2 = translateKey(static_cast<KeyID>(id));
KeyModifierMask mask2 = translateModifierMask(static_cast<KeyModifierMask>(mask));
if (id2 != static_cast<KeyID>(id) || mask2 != static_cast<KeyModifierMask>(mask))
LOG((CLOG_DEBUG1 "key repeat translated to id=0x%08x, mask=0x%04x", id2, mask2));
LOG_DEBUG1("key repeat translated to id=0x%08x, mask=0x%04x", id2, mask2);
// forward
m_client->keyRepeat(id2, mask2, count, button, lang);
@ -617,13 +616,13 @@ void ServerProxy::keyUp()
uint16_t mask;
uint16_t button;
ProtocolUtil::readf(m_stream, kMsgDKeyUp + 4, &id, &mask, &button);
LOG((CLOG_DEBUG1 "recv key up id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button));
LOG_DEBUG1("recv key up id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button);
// translate
KeyID id2 = translateKey(static_cast<KeyID>(id));
KeyModifierMask mask2 = translateModifierMask(static_cast<KeyModifierMask>(mask));
if (id2 != static_cast<KeyID>(id) || mask2 != static_cast<KeyModifierMask>(mask))
LOG((CLOG_DEBUG1 "key up translated to id=0x%08x, mask=0x%04x", id2, mask2));
LOG_DEBUG1("key up translated to id=0x%08x, mask=0x%04x", id2, mask2);
// forward
m_client->keyUp(id2, mask2, button);
@ -637,7 +636,7 @@ void ServerProxy::mouseDown()
// parse
int8_t id;
ProtocolUtil::readf(m_stream, kMsgDMouseDown + 4, &id);
LOG((CLOG_DEBUG1 "recv mouse down id=%d", id));
LOG_DEBUG1("recv mouse down id=%d", id);
// forward
m_client->mouseDown(static_cast<ButtonID>(id));
@ -651,7 +650,7 @@ void ServerProxy::mouseUp()
// parse
int8_t id;
ProtocolUtil::readf(m_stream, kMsgDMouseUp + 4, &id);
LOG((CLOG_DEBUG1 "recv mouse up id=%d", id));
LOG_DEBUG1("recv mouse up id=%d", id);
// forward
m_client->mouseUp(static_cast<ButtonID>(id));
@ -682,7 +681,7 @@ void ServerProxy::mouseMove()
m_dxMouse = 0;
m_dyMouse = 0;
}
LOG((CLOG_DEBUG2 "recv mouse move %d,%d", x, y));
LOG_DEBUG2("recv mouse move %d,%d", x, y);
// forward
if (!ignore) {
@ -712,7 +711,7 @@ void ServerProxy::mouseRelativeMove()
m_dxMouse += dx;
m_dyMouse += dy;
}
LOG((CLOG_DEBUG2 "recv mouse relative move %d,%d", dx, dy));
LOG_DEBUG2("recv mouse relative move %d,%d", dx, dy);
// forward
if (!ignore) {
@ -729,7 +728,7 @@ void ServerProxy::mouseWheel()
int16_t xDelta;
int16_t yDelta;
ProtocolUtil::readf(m_stream, kMsgDMouseWheel + 4, &xDelta, &yDelta);
LOG((CLOG_DEBUG2 "recv mouse wheel %+d,%+d", xDelta, yDelta));
LOG_DEBUG2("recv mouse wheel %+d,%+d", xDelta, yDelta);
// forward
m_client->mouseWheel(xDelta, yDelta);
@ -740,7 +739,7 @@ void ServerProxy::screensaver()
// parse
int8_t on;
ProtocolUtil::readf(m_stream, kMsgCScreenSaver + 4, &on);
LOG((CLOG_DEBUG1 "recv screen saver on=%d", on));
LOG_DEBUG1("recv screen saver on=%d", on);
// forward
m_client->screensaver(on != 0);
@ -749,7 +748,7 @@ void ServerProxy::screensaver()
void ServerProxy::resetOptions()
{
// parse
LOG((CLOG_DEBUG1 "recv reset options"));
LOG_DEBUG1("recv reset options");
// forward
m_client->resetOptions();
@ -768,7 +767,7 @@ void ServerProxy::setOptions()
// parse
OptionsList options;
ProtocolUtil::readf(m_stream, kMsgDSetOptions + 4, &options);
LOG((CLOG_DEBUG1 "recv set options size=%d", options.size()));
LOG_DEBUG1("recv set options size=%d", options.size());
// forward
m_client->setOptions(options);
@ -795,7 +794,7 @@ void ServerProxy::setOptions()
if (id != kKeyModifierIDNull) {
m_modifierTranslationTable[id] = options[i + 1];
LOG((CLOG_DEBUG1 "modifier %d mapped to %d", id, m_modifierTranslationTable[id]));
LOG_DEBUG1("modifier %d mapped to %d", id, m_modifierTranslationTable[id]);
}
}
}
@ -810,7 +809,7 @@ void ServerProxy::queryInfo()
void ServerProxy::infoAcknowledgment()
{
LOG((CLOG_DEBUG1 "recv info acknowledgment"));
LOG_DEBUG1("recv info acknowledgment");
m_ignoreMouse = false;
}
@ -818,7 +817,7 @@ void ServerProxy::secureInputNotification()
{
std::string app;
ProtocolUtil::readf(m_stream, kMsgDSecureInputNotification + 4, &app);
LOG((CLOG_INFO "application \"%s\" is blocking the keyboard", app.c_str()));
LOG_INFO("application \"%s\" is blocking the keyboard", app.c_str());
}
void ServerProxy::setServerLanguages()
@ -838,14 +837,14 @@ void ServerProxy::setActiveServerLanguage(const std::string_view &language)
if (!m_languageManager.isLanguageInstalled(m_serverLanguage)) {
if (!m_isUserNotifiedAboutLanguageSyncError) {
LOG((CLOG_WARN "current server language is not installed on client"));
LOG_WARN("current server language is not installed on client");
m_isUserNotifiedAboutLanguageSyncError = true;
}
} else {
m_isUserNotifiedAboutLanguageSyncError = false;
}
} else {
LOG((CLOG_DEBUG1 "active server language is empty"));
LOG_DEBUG1("active server language is empty");
}
}

View File

@ -98,17 +98,17 @@ int App::run(int argc, char **argv)
// using the exit(int) function!
result = e.getCode();
} catch (DisplayInvalidException &die) {
LOG((CLOG_CRIT "a display invalid exception error occurred: %s\n", die.what()));
LOG_CRIT("a display invalid exception error occurred: %s\n", die.what());
// display invalid exceptions can occur when going to sleep. When this
// process exits, the UI will restart us instantly. We don't really want
// that behevior, so we quies for a bit
Arch::sleep(10);
} catch (std::runtime_error &re) {
LOG((CLOG_CRIT "a runtime error occurred: %s\n", re.what()));
LOG_CRIT("a runtime error occurred: %s\n", re.what());
} catch (std::exception &e) {
LOG((CLOG_CRIT "an error occurred: %s\n", e.what()));
LOG_CRIT("an error occurred: %s\n", e.what());
} catch (...) {
LOG((CLOG_CRIT "an unknown error occurred\n"));
LOG_CRIT("an unknown error occurred\n");
}
return result;
@ -129,7 +129,7 @@ void App::setupFileLogging()
if (argsBase().m_logFile != nullptr) {
m_fileLog = new FileLogOutputter(argsBase().m_logFile); // NOSONAR - Adopted by `Log`
CLOG->insert(m_fileLog);
LOG((CLOG_DEBUG1 "logging to file (%s) enabled", argsBase().m_logFile));
LOG_DEBUG1("logging to file (%s) enabled", argsBase().m_logFile);
}
}
@ -186,7 +186,7 @@ void App::initApp(int argc, const char **argv)
void App::handleScreenError() const
{
LOG((CLOG_CRIT "error on screen"));
LOG_CRIT("error on screen");
getEvents()->addEvent(Event(EventTypes::Quit));
}

View File

@ -40,7 +40,7 @@ bool ArgParser::parseServerArgs(deskflow::ServerArgs &args, int argc, const char
} else if (isArg(i, argc, argv, nullptr, "--disable-client-cert-check")) {
args.m_chkPeerCert = false;
} else {
LOG((CLOG_CRIT "%s: unrecognized option `%s'" BYE, args.m_pname, argv[i], args.m_pname));
LOG_CRIT("%s: unrecognized option `%s'" BYE, args.m_pname, argv[i], args.m_pname);
return false;
}
++i;
@ -79,7 +79,7 @@ bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char
return true;
}
LOG((CLOG_CRIT "%s: unrecognized option `%s'" BYE, args.m_pname, argv[i], args.m_pname));
LOG_CRIT("%s: unrecognized option `%s'" BYE, args.m_pname, argv[i], args.m_pname);
return false;
}
++i;
@ -87,7 +87,7 @@ bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char
// exactly one non-option argument (server-address)
if (i == argc && !args.m_shouldExitFail && !args.m_shouldExitOk) {
LOG((CLOG_CRIT "%s: a server address or name is required" BYE, args.m_pname, args.m_pname));
LOG_CRIT("%s: a server address or name is required" BYE, args.m_pname, args.m_pname);
return false;
}
@ -181,7 +181,7 @@ bool ArgParser::parseDeprecatedArgs(int argc, const char *const *argv, int &i) c
for (auto &arg : deprecatedArgs) {
if (isArg(i, argc, argv, nullptr, arg)) {
LOG((CLOG_NOTE "%s is deprecated", arg));
LOG_NOTE("%s is deprecated", arg);
i++;
return true;
}
@ -197,7 +197,7 @@ bool ArgParser::isArg(
if ((name1 != nullptr && strcmp(argv[argi], name1) == 0) || (name2 != nullptr && strcmp(argv[argi], name2) == 0)) {
// match. check args left.
if (argi + minRequiredParameters >= argc) {
LOG((CLOG_PRINT "%s: missing arguments for `%s'" BYE, argsBase().m_pname, argv[argi], argsBase().m_pname));
LOG_PRINT("%s: missing arguments for `%s'" BYE, argsBase().m_pname, argv[argi], argsBase().m_pname);
argsBase().m_shouldExitFail = true;
return false;
}

View File

@ -88,7 +88,7 @@ void ClientApp::parseArgs(int argc, const char *const *argv)
// server. a bad port will never get better. patch by Brent
// Priddy.
if (!args().m_restartable || e.getError() == XSocketAddress::SocketError::BadPort) {
LOG((CLOG_CRIT "%s: %s" BYE, args().m_pname, e.what(), args().m_pname));
LOG_CRIT("%s: %s" BYE, args().m_pname, e.what(), args().m_pname);
bye(s_exitFailed);
}
}
@ -130,7 +130,7 @@ void ClientApp::help()
<< "The hostname must be the address or hostname of the server.\n"
<< "The port overrides the default port, " << kDefaultPort << ".\n";
LOG((CLOG_PRINT "%s", help.str().c_str()));
LOG_PRINT("%s", help.str().c_str());
}
const char *ClientApp::daemonName() const
@ -166,7 +166,7 @@ deskflow::Screen *ClientApp::createScreen()
#if defined(WINAPI_XWINDOWS) or defined(WINAPI_LIBEI)
if (deskflow::platform::isWayland()) {
#if WINAPI_LIBEI
LOG((CLOG_INFO "using ei screen for wayland"));
LOG_INFO("using ei screen for wayland");
return new deskflow::Screen(new deskflow::EiScreen(false, getEvents(), true), getEvents());
#else
throw XNoEiSupport();
@ -175,7 +175,7 @@ deskflow::Screen *ClientApp::createScreen()
#endif
#if WINAPI_XWINDOWS
LOG((CLOG_INFO "using legacy x windows screen"));
LOG_INFO("using legacy x windows screen");
return new deskflow::Screen(
new XWindowsScreen(args().m_display, false, args().m_yscroll, getEvents(), args().m_clientScrollDirection),
getEvents()
@ -220,14 +220,14 @@ void ClientApp::handleClientRestart(const Event &, EventQueueTimer *timer)
void ClientApp::scheduleClientRestart(double retryTime)
{
// install a timer and handler to retry later
LOG((CLOG_DEBUG "retry in %.0f seconds", retryTime));
LOG_DEBUG("retry in %.0f seconds", retryTime);
EventQueueTimer *timer = getEvents()->newOneShotTimer(retryTime, nullptr);
getEvents()->addHandler(EventTypes::Timer, timer, [this, timer](const auto &e) { handleClientRestart(e, timer); });
}
void ClientApp::handleClientConnected() const
{
LOG((CLOG_NOTE "connected to server"));
LOG_NOTE("connected to server");
}
void ClientApp::handleClientFailed(const Event &e)
@ -235,7 +235,7 @@ void ClientApp::handleClientFailed(const Event &e)
if ((++m_lastServerAddressIndex) < m_client->getLastResolvedAddressesCount()) {
std::unique_ptr<Client::FailInfo> info(static_cast<Client::FailInfo *>(e.getData()));
LOG((CLOG_WARN "failed to connect to server=%s, trying next address", info->m_what.c_str()));
LOG_WARN("failed to connect to server=%s, trying next address", info->m_what.c_str());
if (!m_suspended) {
scheduleClientRestart(s_retryTime);
}
@ -250,10 +250,10 @@ void ClientApp::handleClientRefused(const Event &e)
std::unique_ptr<Client::FailInfo> info(static_cast<Client::FailInfo *>(e.getData()));
if (!args().m_restartable || !info->m_retry) {
LOG((CLOG_ERR "failed to connect to server: %s", info->m_what.c_str()));
LOG_ERR("failed to connect to server: %s", info->m_what.c_str());
getEvents()->addEvent(Event(EventTypes::Quit));
} else {
LOG((CLOG_WARN "failed to connect to server: %s", info->m_what.c_str()));
LOG_WARN("failed to connect to server: %s", info->m_what.c_str());
if (!m_suspended) {
scheduleClientRestart(s_retryTime);
}
@ -262,7 +262,7 @@ void ClientApp::handleClientRefused(const Event &e)
void ClientApp::handleClientDisconnected()
{
LOG((CLOG_NOTE "disconnected from server"));
LOG_NOTE("disconnected from server");
if (!args().m_restartable) {
getEvents()->addEvent(Event(EventTypes::Quit));
} else if (!m_suspended) {
@ -326,22 +326,22 @@ bool ClientApp::startClient()
clientScreen = openClientScreen();
m_client = openClient(args().m_name, *m_serverAddress, clientScreen);
m_clientScreen = clientScreen;
LOG((CLOG_NOTE "started client"));
LOG_NOTE("started client");
}
m_client->connect(m_lastServerAddressIndex);
return true;
} catch (XScreenUnavailable &e) {
LOG((CLOG_WARN "secondary screen unavailable: %s", e.what()));
LOG_WARN("secondary screen unavailable: %s", e.what());
closeClientScreen(clientScreen);
retryTime = e.getRetryTime();
} catch (XScreenOpenFailure &e) {
LOG((CLOG_CRIT "failed to start client: %s", e.what()));
LOG_CRIT("failed to start client: %s", e.what());
closeClientScreen(clientScreen);
return false;
} catch (XBase &e) {
LOG((CLOG_CRIT "failed to start client: %s", e.what()));
LOG_CRIT("failed to start client: %s", e.what());
closeClientScreen(clientScreen);
return false;
}
@ -393,9 +393,9 @@ int ClientApp::mainLoop()
DAEMON_RUNNING(false);
// close down
LOG((CLOG_DEBUG1 "stopping client"));
LOG_DEBUG1("stopping client");
stopClient();
LOG((CLOG_NOTE "stopped client"));
LOG_NOTE("stopped client");
return s_exitSuccess;
}
@ -440,7 +440,7 @@ void ClientApp::startNode()
{
// start the client. if this return false then we've failed and
// we shouldn't retry.
LOG((CLOG_DEBUG1 "starting client"));
LOG_DEBUG1("starting client");
if (!startClient()) {
bye(s_exitFailed);
}

View File

@ -75,7 +75,7 @@ ClipboardChunk::assemble(deskflow::IStream *stream, std::string &dataCached, Cli
if (mark == ChunkType::DataStart) {
s_expectedSize = deskflow::string::stringToSizeType(data);
LOG((CLOG_DEBUG "start receiving clipboard data"));
LOG_DEBUG("start receiving clipboard data");
dataCached.clear();
return Started;
} else if (mark == ChunkType::DataChunk) {
@ -86,13 +86,13 @@ ClipboardChunk::assemble(deskflow::IStream *stream, std::string &dataCached, Cli
if (id >= kClipboardEnd) {
return Error;
} else if (s_expectedSize != dataCached.size()) {
LOG((CLOG_ERR "corrupted clipboard data, expected size=%d actual size=%d", s_expectedSize, dataCached.size()));
LOG_ERR("corrupted clipboard data, expected size=%d actual size=%d", s_expectedSize, dataCached.size());
return Error;
}
return Finished;
}
LOG((CLOG_ERR "clipboard transmission failed: unknown error"));
LOG_ERR("clipboard transmission failed: unknown error");
return Error;
}
@ -100,7 +100,7 @@ void ClipboardChunk::send(deskflow::IStream *stream, void *data)
{
const auto *clipboardData = static_cast<ClipboardChunk *>(data);
LOG((CLOG_DEBUG1 "sending clipboard chunk"));
LOG_DEBUG1("sending clipboard chunk");
const char *chunk = clipboardData->m_chunk;
ClipboardID id = chunk[0];
@ -111,15 +111,15 @@ void ClipboardChunk::send(deskflow::IStream *stream, void *data)
switch (mark) {
case ChunkType::DataStart:
LOG((CLOG_DEBUG2 "sending clipboard chunk start: size=%s", dataChunk.c_str()));
LOG_DEBUG2("sending clipboard chunk start: size=%s", dataChunk.c_str());
break;
case ChunkType::DataChunk:
LOG((CLOG_DEBUG2 "sending clipboard chunk data: size=%i", dataChunk.size()));
LOG_DEBUG2("sending clipboard chunk data: size=%i", dataChunk.size());
break;
case ChunkType::DataEnd:
LOG((CLOG_DEBUG2 "sending clipboard finished"));
LOG_DEBUG2("sending clipboard finished");
break;
default:

View File

@ -45,32 +45,32 @@ bool Config::load(const std::string &firstArg)
}
if (!std::filesystem::exists(m_filename)) {
LOG((CLOG_ERR "config file not found: %s", m_filename.c_str()));
LOG_ERR("config file not found: %s", m_filename.c_str());
return false;
}
toml::table configTable;
try {
LOG((CLOG_INFO "loading config file: %s", m_filename.c_str()));
LOG_INFO("loading config file: %s", m_filename.c_str());
configTable = toml::parse_file(m_filename);
} catch (const toml::parse_error &err) {
LOG((CLOG_ERR "toml parse error: %s", err.what()));
LOG_ERR("toml parse error: %s", err.what());
throw ParseError();
} catch (const std::exception &err) {
LOG((CLOG_ERR "unknown parse error: %s", err.what()));
LOG_ERR("unknown parse error: %s", err.what());
throw ParseError();
}
if (!configTable.contains(m_section)) {
LOG((CLOG_WARN "no %s section found in config file", m_section.c_str()));
LOG_WARN("no %s section found in config file", m_section.c_str());
return false;
}
const auto &section = configTable[m_section];
const auto args = section["args"];
if (!args.is_table()) {
LOG((CLOG_WARN "no args table found in config file"));
LOG_WARN("no args table found in config file");
return false;
}
@ -96,7 +96,7 @@ bool Config::load(const std::string &firstArg)
}
if (m_args.empty()) {
LOG((CLOG_WARN "no args loaded from config file"));
LOG_WARN("no args loaded from config file");
return false;
}

View File

@ -216,9 +216,9 @@ int DaemonApp::mainLoop()
LOG_INFO("daemon is running");
m_events.loop();
} catch (std::exception &e) { // NOSONAR - Catching all exceptions
LOG((CLOG_CRIT "daemon error: %s", e.what()));
LOG_CRIT("daemon error: %s", e.what());
} catch (...) { // NOSONAR - Catching remaining exceptions
LOG((CLOG_CRIT "daemon unknown error"));
LOG_CRIT("daemon unknown error");
}
LOG_INFO("daemon is stopping");
@ -228,9 +228,9 @@ int DaemonApp::mainLoop()
LOG_DEBUG("stopping process watchdog");
m_pWatchdog->stop();
} catch (std::exception &e) { // NOSONAR - Catching all exceptions
LOG((CLOG_CRIT "daemon stop watchdog error: %s", e.what()));
LOG_CRIT("daemon stop watchdog error: %s", e.what());
} catch (...) { // NOSONAR - Catching remaining exceptions
LOG((CLOG_CRIT "daemon stop watchdog unknown error"));
LOG_CRIT("daemon stop watchdog unknown error");
}
#endif

View File

@ -264,7 +264,7 @@ const KeyMap::KeyItem *KeyMap::mapKey(
case kKeySetModifiers:
if (!keysForModifierState(0, group, activeModifiers, currentState, desiredMask, desiredMask, 0, keys)) {
LOG((CLOG_DEBUG1 "unable to set modifiers %04x", desiredMask));
LOG_DEBUG1("unable to set modifiers %04x", desiredMask);
return nullptr;
}
return &m_modifierKeyItem;
@ -273,7 +273,7 @@ const KeyMap::KeyItem *KeyMap::mapKey(
if (!keysForModifierState(
0, group, activeModifiers, currentState, currentState & ~desiredMask, desiredMask, 0, keys
)) {
LOG((CLOG_DEBUG1 "unable to clear modifiers %04x", desiredMask));
LOG_DEBUG1("unable to clear modifiers %04x", desiredMask);
return nullptr;
}
return &m_modifierKeyItem;
@ -288,7 +288,7 @@ const KeyMap::KeyItem *KeyMap::mapKey(
}
if (item != nullptr) {
LOG((CLOG_DEBUG1 "mapped to %03x, new state %04x", item->m_button, currentState));
LOG_DEBUG1("mapped to %03x, new state %04x", item->m_button, currentState);
}
return item;
}
@ -304,9 +304,9 @@ int32_t KeyMap::getLanguageGroupID(int32_t group, const std::string &lang) const
if (auto it = std::find(m_keyboardLayouts.begin(), m_keyboardLayouts.end(), lang); it != m_keyboardLayouts.end()) {
id = static_cast<int>(std::distance(m_keyboardLayouts.begin(), it));
LOG((CLOG_DEBUG1 "language %s has group id %d", lang.c_str(), id));
LOG_DEBUG1("language %s has group id %d", lang.c_str(), id);
} else {
LOG((CLOG_DEBUG1 "could not found requested language"));
LOG_DEBUG1("could not found requested language");
}
return id;
@ -481,7 +481,7 @@ const KeyMap::KeyItem *KeyMap::mapCommandKey(
KeyIDMap::const_iterator i = m_keyIDMap.find(id);
if (i == m_keyIDMap.end()) {
// unknown key
LOG((CLOG_DEBUG1 "key %04x is not on keyboard", id));
LOG_DEBUG1("key %04x is not on keyboard", id);
return nullptr;
}
const KeyGroupTable &keyGroupTable = i->second;
@ -506,7 +506,7 @@ const KeyMap::KeyItem *KeyMap::mapCommandKey(
KeyModifierMask requiredIgnoreShiftMask = item.m_required & ~KeyModifierShift;
if ((item.m_required & desiredShiftMask) == (item.m_sensitive & desiredShiftMask) &&
((requiredIgnoreShiftMask & desiredMask) == requiredIgnoreShiftMask)) {
LOG((CLOG_DEBUG1 "found key in group %d", effectiveGroup));
LOG_DEBUG1("found key in group %d", effectiveGroup);
keyItem = &item;
break;
}
@ -517,7 +517,7 @@ const KeyMap::KeyItem *KeyMap::mapCommandKey(
}
if (!keyItem) {
// no mapping for this keysym
LOG((CLOG_DEBUG1 "no mapping for key %04x", id));
LOG_DEBUG1("no mapping for key %04x", id);
return nullptr;
}
@ -533,14 +533,14 @@ const KeyMap::KeyItem *KeyMap::mapCommandKey(
if (!keysForKeyItem(
*keyItem, newGroup, newModifiers, newState, desiredMask, s_overrideModifiers, isAutoRepeat, keys, lang
)) {
LOG((CLOG_DEBUG1 "can't map key"));
LOG_DEBUG1("can't map key");
keys.clear();
return nullptr;
}
// add keystrokes to restore modifier keys
if (!keysToRestoreModifiers(*keyItem, group, newModifiers, newState, activeModifiers, keys)) {
LOG((CLOG_DEBUG1 "modifiers were not restored"));
LOG_DEBUG1("modifiers were not restored");
keys.clear();
return nullptr;
}
@ -562,7 +562,7 @@ KeyMap::getKeyItemList(const KeyMap::KeyGroupTable &keyGroupTable, int32_t group
const auto effectiveGroup = getEffectiveGroup(group, groupOffset);
auto keyIndex = findBestKey(keyGroupTable[effectiveGroup], desiredMask);
if (keyIndex != -1) {
LOG((CLOG_DEBUG1 "found key in group %d", effectiveGroup));
LOG_DEBUG1("found key in group %d", effectiveGroup);
itemList = &keyGroupTable[effectiveGroup][keyIndex];
break;
}
@ -580,7 +580,7 @@ const KeyMap::KeyItem *KeyMap::mapCharacterKey(
KeyIDMap::const_iterator i = m_keyIDMap.find(id);
if (i == m_keyIDMap.end()) {
// unknown key
LOG((CLOG_DEBUG1 "key %04x is not on keyboard", id));
LOG_DEBUG1("key %04x is not on keyboard", id);
return nullptr;
}
@ -589,7 +589,7 @@ const KeyMap::KeyItem *KeyMap::mapCharacterKey(
const auto itemList = getKeyItemList(i->second, getLanguageGroupID(group, lang), desiredMask);
if (!itemList || itemList->empty()) {
// no mapping for this keysym
LOG((CLOG_DEBUG1 "no mapping for key %04x", id));
LOG_DEBUG1("no mapping for key %04x", id);
return nullptr;
}
@ -603,7 +603,7 @@ const KeyMap::KeyItem *KeyMap::mapCharacterKey(
// add each key
for (auto &item : *itemList) {
if (!keysForKeyItem(item, newGroup, newModifiers, newState, desiredMask, 0, isAutoRepeat, keys, lang)) {
LOG((CLOG_DEBUG1 "can't map key"));
LOG_DEBUG1("can't map key");
keys.clear();
return nullptr;
}
@ -611,7 +611,7 @@ const KeyMap::KeyItem *KeyMap::mapCharacterKey(
// add keystrokes to restore modifier keys
if (!keysToRestoreModifiers(keyItem, group, newModifiers, newState, activeModifiers, keys)) {
LOG((CLOG_DEBUG1 "modifiers were not restored"));
LOG_DEBUG1("modifiers were not restored");
keys.clear();
return nullptr;
}
@ -644,7 +644,7 @@ int32_t KeyMap::findBestKey(const KeyEntryList &entryList, KeyModifierMask desir
const KeyItem &item = entryList[i].back();
if ((item.m_required & desiredState) == item.m_required &&
(item.m_required & desiredState) == (item.m_sensitive & desiredState)) {
LOG((CLOG_DEBUG1 "best key index %d of %d (exact)", i + 1, entryList.size()));
LOG_DEBUG1("best key index %d of %d (exact)", i + 1, entryList.size());
return i;
}
}
@ -662,7 +662,7 @@ int32_t KeyMap::findBestKey(const KeyEntryList &entryList, KeyModifierMask desir
}
}
if (bestIndex != -1) {
LOG((CLOG_DEBUG1 "best key index %d of %d (%d modifiers)", bestIndex + 1, entryList.size(), bestCount));
LOG_DEBUG1("best key index %d of %d (%d modifiers)", bestIndex + 1, entryList.size(), bestCount);
}
return bestIndex;
@ -708,7 +708,7 @@ bool KeyMap::keysForKeyItem(
keyItem.m_button, group, activeModifiers, currentState, keyItem.m_required, keyItem.m_sensitive, 0,
keystrokes
)) {
LOG((CLOG_DEBUG1 "unable to match modifier state for dead key %d", keyItem.m_button));
LOG_DEBUG1("unable to match modifier state for dead key %d", keyItem.m_button);
return false;
}
@ -726,7 +726,7 @@ bool KeyMap::keysForKeyItem(
// button (any other button) mapped to the shift modifier and then
// the Shift_L button.
// match key's required state
LOG((CLOG_DEBUG1 "state: %04x,%04x,%04x", currentState, keyItem.m_required, sensitive));
LOG_DEBUG1("state: %04x,%04x,%04x", currentState, keyItem.m_required, sensitive);
if (!keysForModifierState(
keyItem.m_button, group, activeModifiers, currentState, keyItem.m_required, sensitive, 0, keystrokes
)) {
@ -847,7 +847,7 @@ bool KeyMap::keysForModifierState(
const KeyItem *keyItem = keyForModifier(button, group, bit);
if (keyItem == nullptr) {
if ((mask & notRequiredMask) == 0) {
LOG((CLOG_DEBUG1 "no key for modifier %04x", mask));
LOG_DEBUG1("no key for modifier %04x", mask);
return false;
} else {
continue;
@ -861,13 +861,13 @@ bool KeyMap::keysForModifierState(
if ((sensitive & mask) != 0) {
// modifier is sensitive to itself. that makes no sense
// so ignore it.
LOG((CLOG_DEBUG1 "modifier %04x modified by itself", mask));
LOG_DEBUG1("modifier %04x modified by itself", mask);
sensitive &= ~mask;
}
if (sensitive != 0) {
if (sensitive > mask) {
// our assumption is incorrect
LOG((CLOG_DEBUG1 "modifier %04x modified by %04x", mask, sensitive));
LOG_DEBUG1("modifier %04x modified by %04x", mask, sensitive);
return false;
}
if (active &&

View File

@ -686,7 +686,7 @@ void KeyState::onKey(KeyButton button, bool down, KeyModifierMask newState)
{
// update modifier state
m_mask = newState;
LOG((CLOG_DEBUG1 "new mask: 0x%04x", m_mask));
LOG_DEBUG1("new mask: 0x%04x", m_mask);
// ignore bogus buttons
button &= kButtonMask;
@ -768,7 +768,7 @@ void KeyState::updateKeyState()
AddActiveModifierContext addModifierContext(pollActiveGroup(), m_mask, m_activeModifiers);
m_keyMap.foreachKey(&KeyState::addActiveModifierCB, &addModifierContext);
LOG((CLOG_DEBUG1 "modifiers on update: 0x%04x", m_mask));
LOG_DEBUG1("modifiers on update: 0x%04x", m_mask);
}
void KeyState::addActiveModifierCB(KeyID, int32_t group, deskflow::KeyMap::KeyItem &keyItem, void *vcontext)
@ -805,7 +805,7 @@ void KeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID, c
// ignore certain keys
if (isIgnoredKey(id, mask)) {
LOG((CLOG_DEBUG1 "ignored key %04x %04x", id, mask));
LOG_DEBUG1("ignored key %04x %04x", id, mask);
return;
}
@ -819,7 +819,7 @@ void KeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID, c
// special way
if (id == kKeyAudioDown || id == kKeyAudioUp || id == kKeyAudioMute || id == kKeyAudioPlay || id == kKeyAudioPrev ||
id == kKeyAudioNext || id == kKeyBrightnessDown || id == kKeyBrightnessUp) {
LOG((CLOG_DEBUG1 "emulating media key"));
LOG_DEBUG1("emulating media key");
fakeMediaKey(id);
}
@ -842,7 +842,7 @@ void KeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID, c
bool KeyState::fakeKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton serverID, const std::string &lang)
{
LOG((CLOG_DEBUG2 "fakeKeyRepeat"));
LOG_DEBUG2("fakeKeyRepeat");
serverID &= kButtonMask;
// if we haven't seen this button go down then ignore it
@ -928,7 +928,7 @@ bool KeyState::fakeKeyUp(KeyButton serverID)
if (!m_activeModifiers.contains(mask)) {
// no key for modifier is down so deactivate modifier
m_mask &= ~mask;
LOG((CLOG_DEBUG1 "new state %04x", m_mask));
LOG_DEBUG1("new state %04x", m_mask);
}
} else {
++i;
@ -1087,7 +1087,7 @@ void KeyState::fakeKeys(const Keystrokes &keys, uint32_t count)
// next key
++k;
} else {
LOG((CLOG_DEBUG1 "skipping keystroke, language sync is disabled"));
LOG_DEBUG1("skipping keystroke, language sync is disabled");
++k;
}
}

View File

@ -71,7 +71,7 @@ void ProtocolUtil::writef(deskflow::IStream *stream, const char *fmt, ...)
{
assert(stream != nullptr);
assert(fmt != nullptr);
LOG((CLOG_DEBUG2 "writef(%s)", fmt));
LOG_DEBUG2("writef(%s)", fmt);
va_list args;
va_start(args, fmt);
@ -87,7 +87,7 @@ bool ProtocolUtil::readf(deskflow::IStream *stream, const char *fmt, ...)
bool result = false;
if (stream && fmt) {
LOG((CLOG_DEBUG2 "readf(%s)", fmt));
LOG_DEBUG2("readf(%s)", fmt);
va_list args;
va_start(args, fmt);
try {
@ -121,9 +121,9 @@ void ProtocolUtil::vwritef(deskflow::IStream *stream, const char *fmt, uint32_t
try {
// write buffer
stream->write(Buffer.data(), size);
LOG((CLOG_DEBUG2 "wrote %d bytes", size));
LOG_DEBUG2("wrote %d bytes", size);
} catch (const XBase &exception) {
LOG((CLOG_DEBUG2 "exception <%s> during wrote %d bytes into stream", exception.what(), size));
LOG_DEBUG2("exception <%s> during wrote %d bytes into stream", exception.what(), size);
throw;
}
}
@ -157,7 +157,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar
break;
default:
// the length is wrong
LOG((CLOG_ERR "read: length to be read is wrong: '%d' should be 1,2, or 4", len));
LOG_ERR("read: length to be read is wrong: '%d' should be 1,2, or 4", len);
assert(false); // assert for debugging
break;
}
@ -181,7 +181,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar
break;
default:
// the length is wrong
LOG((CLOG_ERR "read: length to be read is wrong: '%d' should be 1,2, or 4", len));
LOG_ERR("read: length to be read is wrong: '%d' should be 1,2, or 4", len);
assert(false); // assert for debugging
break;
}
@ -192,7 +192,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar
std::string *destination = va_arg(args, std::string *);
if (len > PROTOCOL_MAX_STRING_LENGTH) {
LOG((CLOG_ERR "read: string length exceeds maximum allowed size: %u", len));
LOG_ERR("read: string length exceeds maximum allowed size: %u", len);
throw XBadClient("Too long message received");
}
@ -217,7 +217,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar
// verify match
if (buffer[0] != *fmt) {
LOG((CLOG_DEBUG2 "readf: format mismatch: %c vs %c", *fmt, buffer[0]));
LOG_DEBUG2("readf: format mismatch: %c vs %c", *fmt, buffer[0]);
throw XIOReadMismatch();
}
@ -257,7 +257,7 @@ uint32_t ProtocolUtil::getLength(const char *fmt, va_list args)
break;
default:
LOG((CLOG_ERR "format specifier %%I%d has invalid length", len));
LOG_ERR("format specifier %%I%d has invalid length", len);
break;
}
break;
@ -429,7 +429,7 @@ void ProtocolUtil::read(deskflow::IStream *stream, void *vbuffer, uint32_t count
// bail if stream has hungup
if (n == 0) {
LOG((CLOG_DEBUG2 "unexpected disconnect in readf(), %d bytes left", count));
LOG_DEBUG2("unexpected disconnect in readf(), %d bytes left", count);
throw XIOEndOfStream();
}
@ -446,7 +446,7 @@ uint8_t ProtocolUtil::read1ByteInt(deskflow::IStream *stream)
read(stream, buffer.data(), BufferSize);
uint8_t Result = buffer[0];
LOG((CLOG_DEBUG2 "readf: read 1 byte integer: %d (0x%x)", Result, Result));
LOG_DEBUG2("readf: read 1 byte integer: %d (0x%x)", Result, Result);
return Result;
}
@ -458,7 +458,7 @@ uint16_t ProtocolUtil::read2BytesInt(deskflow::IStream *stream)
read(stream, buffer.data(), BufferSize);
auto Result = static_cast<uint16_t>((static_cast<uint16_t>(buffer[0]) << 8) | static_cast<uint16_t>(buffer[1]));
LOG((CLOG_DEBUG2 "readf: read 2 byte integer: %d (0x%x)", Result, Result));
LOG_DEBUG2("readf: read 2 byte integer: %d (0x%x)", Result, Result);
return Result;
}
@ -472,7 +472,7 @@ uint32_t ProtocolUtil::read4BytesInt(deskflow::IStream *stream)
uint32_t Result = (static_cast<uint32_t>(buffer[0]) << 24) | (static_cast<uint32_t>(buffer[1]) << 16) |
(static_cast<uint32_t>(buffer[2]) << 8) | (static_cast<uint32_t>(buffer[3]));
LOG((CLOG_DEBUG2 "readf: read 4 byte integer: %d (0x%x)", Result, Result));
LOG_DEBUG2("readf: read 4 byte integer: %d (0x%x)", Result, Result);
return Result;
}
@ -506,7 +506,7 @@ uint32_t ProtocolUtil::readVectorSize(deskflow::IStream *stream)
auto size = read4BytesInt(stream);
if (size > PROTOCOL_MAX_LIST_LENGTH) {
LOG((CLOG_ERR "readVectorSize: vector length exceeds maximum allowed size: %u", size));
LOG_ERR("readVectorSize: vector length exceeds maximum allowed size: %u", size);
throw XBadClient("Too long message received");
}
@ -534,8 +534,8 @@ void ProtocolUtil::readBytes(deskflow::IStream *stream, uint32_t len, std::strin
sBuffer = new uint8_t[len];
} catch (std::bad_alloc &exception) {
// Added try catch due to GHSA-chfm-333q-gfpp
LOG((CLOG_ERR "bad alloc, unable to allocate memory %d bytes", len));
LOG((CLOG_DEBUG "bad_alloc detected: is there enough memory?"));
LOG_ERR("bad alloc, unable to allocate memory %d bytes", len);
LOG_DEBUG("bad_alloc detected: is there enough memory?");
throw exception;
}
}
@ -550,7 +550,7 @@ void ProtocolUtil::readBytes(deskflow::IStream *stream, uint32_t len, std::strin
throw;
}
LOG((CLOG_DEBUG2 "readf: read %d byte string", len));
LOG_DEBUG2("readf: read %d byte string", len);
// save the data

View File

@ -29,7 +29,7 @@ Screen::Screen(IPlatformScreen *platformScreen, IEventQueue *events)
// reset options
resetOptions();
LOG((CLOG_DEBUG "opened display"));
LOG_DEBUG("opened display");
}
Screen::~Screen()
@ -57,14 +57,14 @@ Screen::~Screen()
m_entered ? "yes" : "no", m_isPrimary ? "yes" : "no")
);
if (m_isPrimary) {
LOG((CLOG_WARN "current primary screen is not entered on shutdown"));
LOG_WARN("current primary screen is not entered on shutdown");
} else {
LOG((CLOG_WARN "current secondary screen is entered on shutdown"));
LOG_WARN("current secondary screen is entered on shutdown");
}
}
delete m_screen;
LOG((CLOG_DEBUG "closed display"));
LOG_DEBUG("closed display");
}
void Screen::enable()
@ -106,7 +106,7 @@ void Screen::disable()
void Screen::enter(KeyModifierMask toggleMask)
{
LOG((CLOG_INFO "entering screen"));
LOG_INFO("entering screen");
if (m_entered) {
LOG_WARN("screen already entered");
@ -125,7 +125,7 @@ void Screen::enter(KeyModifierMask toggleMask)
bool Screen::leave()
{
LOG((CLOG_INFO "leaving screen"));
LOG_INFO("leaving screen");
if (!m_entered) {
LOG_WARN("screen already left");
@ -183,7 +183,7 @@ void Screen::keyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std
{
// check for ctrl+alt+del emulation
if (id == kKeyDelete && (mask & (KeyModifierControl | KeyModifierAlt)) == (KeyModifierControl | KeyModifierAlt)) {
LOG((CLOG_DEBUG "emulating ctrl+alt+del press"));
LOG_DEBUG("emulating ctrl+alt+del press");
if (m_screen->fakeCtrlAltDel()) {
return;
}
@ -249,21 +249,21 @@ void Screen::setOptions(const OptionsList &options)
} else {
m_halfDuplex &= ~KeyModifierCapsLock;
}
LOG((CLOG_DEBUG1 "half-duplex caps-lock %s", ((m_halfDuplex & KeyModifierCapsLock) != 0) ? "on" : "off"));
LOG_DEBUG1("half-duplex caps-lock %s", ((m_halfDuplex & KeyModifierCapsLock) != 0) ? "on" : "off");
} else if (options[i] == kOptionHalfDuplexNumLock) {
if (options[i + 1] != 0) {
m_halfDuplex |= KeyModifierNumLock;
} else {
m_halfDuplex &= ~KeyModifierNumLock;
}
LOG((CLOG_DEBUG1 "half-duplex num-lock %s", ((m_halfDuplex & KeyModifierNumLock) != 0) ? "on" : "off"));
LOG_DEBUG1("half-duplex num-lock %s", ((m_halfDuplex & KeyModifierNumLock) != 0) ? "on" : "off");
} else if (options[i] == kOptionHalfDuplexScrollLock) {
if (options[i + 1] != 0) {
m_halfDuplex |= KeyModifierScrollLock;
} else {
m_halfDuplex &= ~KeyModifierScrollLock;
}
LOG((CLOG_DEBUG1 "half-duplex scroll-lock %s", ((m_halfDuplex & KeyModifierScrollLock) != 0) ? "on" : "off"));
LOG_DEBUG1("half-duplex scroll-lock %s", ((m_halfDuplex & KeyModifierScrollLock) != 0) ? "on" : "off");
}
}
@ -313,7 +313,7 @@ bool Screen::isOnScreen() const
bool Screen::isLockedToScreen() const
{
if (uint32_t buttonID = 0; m_screen->isAnyMouseButtonDown(buttonID)) {
LOG((CLOG_DEBUG "locked by mouse buttonID: %d", buttonID));
LOG_DEBUG("locked by mouse buttonID: %d", buttonID);
return true;
}
// not locked

View File

@ -90,7 +90,7 @@ void ServerApp::parseArgs(int argc, const char *const *argv)
*m_deskflowAddress = NetworkAddress(args().m_deskflowAddress, kDefaultPort);
m_deskflowAddress->resolve();
} catch (XSocketAddress &e) {
LOG((CLOG_CRIT "%s: %s" BYE, args().m_pname, e.what(), args().m_pname));
LOG_CRIT("%s: %s" BYE, args().m_pname, e.what(), args().m_pname);
bye(s_exitArgs);
}
}
@ -137,7 +137,7 @@ void ServerApp::help()
<< "The default is to listen on all interfaces. The port overrides the\n"
<< "default port, " << kDefaultPort << ".\n";
LOG((CLOG_PRINT "%s", help.str().c_str()));
LOG_PRINT("%s", help.str().c_str());
}
void ServerApp::reloadSignalHandler(Arch::ThreadSignal, void *)
@ -148,12 +148,12 @@ void ServerApp::reloadSignalHandler(Arch::ThreadSignal, void *)
void ServerApp::reloadConfig()
{
LOG((CLOG_DEBUG "reload configuration"));
LOG_DEBUG("reload configuration");
if (loadConfig(args().m_configFile)) {
if (m_server != nullptr) {
m_server->setConfig(*args().m_config);
}
LOG((CLOG_NOTE "reloaded configuration"));
LOG_NOTE("reloaded configuration");
}
}
@ -161,12 +161,12 @@ void ServerApp::loadConfig()
{
const auto path = args().m_configFile;
if (path.empty()) {
LOG((CLOG_CRIT "no configuration path provided"));
LOG_CRIT("no configuration path provided");
bye(s_exitConfig);
}
if (!loadConfig(path)) {
LOG((CLOG_CRIT "%s: failed to load config: %s", args().m_pname, path.c_str()));
LOG_CRIT("%s: failed to load config: %s", args().m_pname, path.c_str());
bye(s_exitConfig);
}
}
@ -175,18 +175,18 @@ bool ServerApp::loadConfig(const std::string &pathname)
{
try {
// load configuration
LOG((CLOG_DEBUG "opening configuration \"%s\"", pathname.c_str()));
LOG_DEBUG("opening configuration \"%s\"", pathname.c_str());
std::ifstream configStream(deskflow::filesystem::path(pathname));
if (!configStream.is_open()) {
LOG((CLOG_ERR "cannot open configuration \"%s\"", pathname.c_str()));
LOG_ERR("cannot open configuration \"%s\"", pathname.c_str());
return false;
}
configStream >> *args().m_config;
LOG((CLOG_DEBUG "configuration read successfully"));
LOG_DEBUG("configuration read successfully");
return true;
} catch (XConfigRead &e) {
// report error in configuration file
LOG((CLOG_ERR "cannot read configuration \"%s\": %s", pathname.c_str(), e.what()));
LOG_ERR("cannot read configuration \"%s\": %s", pathname.c_str(), e.what());
}
return false;
}
@ -320,7 +320,7 @@ void ServerApp::retryHandler()
break;
case Initializing:
LOG((CLOG_DEBUG1 "retry server initialization"));
LOG_DEBUG1("retry server initialization");
m_serverState = Uninitialized;
if (!initServer()) {
getEvents()->addEvent(Event(EventTypes::Quit));
@ -328,12 +328,12 @@ void ServerApp::retryHandler()
break;
case InitializingToStart:
LOG((CLOG_DEBUG1 "retry server initialization"));
LOG_DEBUG1("retry server initialization");
m_serverState = Uninitialized;
if (!initServer()) {
getEvents()->addEvent(Event(EventTypes::Quit));
} else if (m_serverState == Initialized) {
LOG((CLOG_DEBUG1 "starting server"));
LOG_DEBUG1("starting server");
if (!startServer()) {
getEvents()->addEvent(Event(EventTypes::Quit));
}
@ -341,7 +341,7 @@ void ServerApp::retryHandler()
break;
case Starting:
LOG((CLOG_DEBUG1 "retry starting server"));
LOG_DEBUG1("retry starting server");
m_serverState = Initialized;
if (!startServer()) {
getEvents()->addEvent(Event(EventTypes::Quit));
@ -370,17 +370,17 @@ bool ServerApp::initServer()
m_serverState = Initialized;
return true;
} catch (XScreenUnavailable &e) {
LOG((CLOG_WARN "primary screen unavailable: %s", e.what()));
LOG_WARN("primary screen unavailable: %s", e.what());
closePrimaryClient(primaryClient);
closeServerScreen(serverScreen);
retryTime = e.getRetryTime();
} catch (XScreenOpenFailure &e) {
LOG((CLOG_CRIT "failed to start server: %s", e.what()));
LOG_CRIT("failed to start server: %s", e.what());
closePrimaryClient(primaryClient);
closeServerScreen(serverScreen);
return false;
} catch (XBase &e) {
LOG((CLOG_CRIT "failed to start server: %s", e.what()));
LOG_CRIT("failed to start server: %s", e.what());
closePrimaryClient(primaryClient);
closeServerScreen(serverScreen);
return false;
@ -389,7 +389,7 @@ bool ServerApp::initServer()
if (args().m_restartable) {
// install a timer and handler to retry later
assert(m_timer == nullptr);
LOG((CLOG_DEBUG "retry in %.0f seconds", retryTime));
LOG_DEBUG("retry in %.0f seconds", retryTime);
m_timer = getEvents()->newOneShotTimer(retryTime, nullptr);
getEvents()->addHandler(EventTypes::Timer, m_timer, [this](const auto &) { retryHandler(); });
m_serverState = Initializing;
@ -442,18 +442,18 @@ bool ServerApp::startServer()
listener->setServer(m_server);
m_server->setListener(listener);
m_listener = listener;
LOG((CLOG_NOTE "started server, waiting for clients"));
LOG_NOTE("started server, waiting for clients");
m_serverState = Started;
return true;
} catch (XSocketAddressInUse &e) {
if (args().m_restartable) {
LOG((CLOG_ERR "cannot listen for clients: %s", e.what()));
LOG_ERR("cannot listen for clients: %s", e.what());
} else {
LOG((CLOG_CRIT "cannot listen for clients: %s", e.what()));
LOG_CRIT("cannot listen for clients: %s", e.what());
}
closeClientListener(listener);
} catch (XBase &e) {
LOG((CLOG_CRIT "failed to start server: %s", e.what()));
LOG_CRIT("failed to start server: %s", e.what());
closeClientListener(listener);
return false;
}
@ -462,7 +462,7 @@ bool ServerApp::startServer()
// install a timer and handler to retry later
assert(m_timer == nullptr);
const auto retryTime = 10.0;
LOG((CLOG_DEBUG "retry in %.0f seconds", retryTime));
LOG_DEBUG("retry in %.0f seconds", retryTime);
m_timer = getEvents()->newOneShotTimer(retryTime, nullptr);
getEvents()->addHandler(EventTypes::Timer, m_timer, [this](const auto &) { retryHandler(); });
m_serverState = Starting;
@ -482,7 +482,7 @@ deskflow::Screen *ServerApp::createScreen()
#if defined(WINAPI_XWINDOWS) or defined(WINAPI_LIBEI)
if (deskflow::platform::isWayland()) {
#if WINAPI_LIBEI
LOG((CLOG_INFO "using ei screen for wayland"));
LOG_INFO("using ei screen for wayland");
return new deskflow::Screen(new deskflow::EiScreen(true, getEvents(), true), getEvents());
#else
throw XNoEiSupport();
@ -491,7 +491,7 @@ deskflow::Screen *ServerApp::createScreen()
#endif
#if WINAPI_XWINDOWS
LOG((CLOG_INFO "using legacy x windows screen"));
LOG_INFO("using legacy x windows screen");
return new deskflow::Screen(new XWindowsScreen(args().m_display, true, 0, getEvents()), getEvents());
#elif WINAPI_CARBON
return new deskflow::Screen(new OSXScreen(getEvents(), true), getEvents());
@ -500,14 +500,14 @@ deskflow::Screen *ServerApp::createScreen()
PrimaryClient *ServerApp::openPrimaryClient(const std::string &name, deskflow::Screen *screen)
{
LOG((CLOG_DEBUG1 "creating primary screen"));
LOG_DEBUG1("creating primary screen");
return new PrimaryClient(name, screen);
}
void ServerApp::handleSuspend()
{
if (!m_suspended) {
LOG((CLOG_INFO "suspend"));
LOG_INFO("suspend");
stopServer();
m_suspended = true;
}
@ -516,7 +516,7 @@ void ServerApp::handleSuspend()
void ServerApp::handleResume()
{
if (m_suspended) {
LOG((CLOG_INFO "resume"));
LOG_INFO("resume");
startServer();
m_suspended = false;
}
@ -595,7 +595,7 @@ int ServerApp::mainLoop()
// canonicalize the primary screen name
if (std::string primaryName = args().m_config->getCanonicalName(args().m_name); primaryName.empty()) {
LOG((CLOG_CRIT "unknown screen name `%s'", args().m_name.c_str()));
LOG_CRIT("unknown screen name `%s'", args().m_name.c_str());
return s_exitFailed;
}
@ -641,18 +641,18 @@ int ServerApp::mainLoop()
DAEMON_RUNNING(false);
// close down
LOG((CLOG_DEBUG1 "stopping server"));
LOG_DEBUG1("stopping server");
getEvents()->removeHandler(EventTypes::ServerAppForceReconnect, getEvents()->getSystemTarget());
getEvents()->removeHandler(EventTypes::ServerAppReloadConfig, getEvents()->getSystemTarget());
cleanupServer();
LOG((CLOG_NOTE "stopped server"));
LOG_NOTE("stopped server");
return s_exitSuccess;
}
void ServerApp::resetServer()
{
LOG((CLOG_DEBUG1 "resetting server"));
LOG_DEBUG1("resetting server");
stopServer();
cleanupServer();
startServer();
@ -719,7 +719,7 @@ void ServerApp::startNode()
{
// start the server. if this return false then we've failed and
// we shouldn't retry.
LOG((CLOG_DEBUG1 "starting server"));
LOG_DEBUG1("starting server");
if (!startServer()) {
bye(s_exitFailed);
}

View File

@ -57,5 +57,5 @@ void StreamChunker::sendClipboard(
events->addEvent(Event(EventTypes::ClipboardSending, eventTarget, end));
LOG((CLOG_DEBUG "sent clipboard size=%d", sentLength));
LOG_DEBUG("sent clipboard size=%d", sentLength);
}

View File

@ -29,7 +29,7 @@ namespace deskflow::languages {
LanguageManager::LanguageManager(const std::vector<std::string> &localLanguages) : m_localLanguages(localLanguages)
{
LOG((CLOG_INFO "local languages: %s", vectorToString(m_localLanguages, ", ").c_str()));
LOG_INFO("local languages: %s", vectorToString(m_localLanguages, ", ").c_str());
}
void LanguageManager::setRemoteLanguages(const std::string_view &remoteLanguages)
@ -41,7 +41,7 @@ void LanguageManager::setRemoteLanguages(const std::string_view &remoteLanguages
m_remoteLanguages.emplace_back(rLangs);
}
}
LOG((CLOG_INFO "remote languages: %s", vectorToString(m_remoteLanguages, ", ").c_str()));
LOG_INFO("remote languages: %s", vectorToString(m_remoteLanguages, ", ").c_str());
}
const std::vector<std::string> &LanguageManager::getRemoteLanguages() const

View File

@ -92,13 +92,13 @@ std::string AppUtilUnix::getCurrentLanguageCode()
auto display = XOpenDisplay(nullptr);
if (!display) {
LOG((CLOG_WARN "failed to open x11 default display"));
LOG_WARN("failed to open x11 default display");
return result;
}
auto kbdDescr = XkbAllocKeyboard();
if (!kbdDescr) {
LOG((CLOG_WARN "failed to get x11 keyboard description"));
LOG_WARN("failed to get x11 keyboard description");
return result;
}
XkbGetNames(display, XkbSymbolsNameMask, kbdDescr);

View File

@ -20,10 +20,10 @@ DeskflowXkbKeyboard::DeskflowXkbKeyboard()
if (display) {
if (!XkbRF_GetNamesProp(display.get(), nullptr, &m_data)) {
LOG((CLOG_WARN "error reading keyboard layouts"));
LOG_WARN("error reading keyboard layouts");
}
} else {
LOG((CLOG_WARN "can't open xkb display during reading languages"));
LOG_WARN("can't open xkb display during reading languages");
}
}

View File

@ -36,7 +36,7 @@ bool X11LayoutsParser::readXMLConfigItemElem(const QDomNode &node, std::vector<L
{
auto configItemElem = node.firstChildElement("configItem");
if (configItemElem.isNull()) {
LOG((CLOG_WARN "failed to read \"configItem\" in xml file"));
LOG_WARN("failed to read \"configItem\" in xml file");
return false;
}
@ -60,7 +60,7 @@ std::vector<X11LayoutsParser::Lang> X11LayoutsParser::getAllLanguageData(const s
QFile inFile(QString::fromStdString(pathToEvdevFile));
if (!inFile.open(QIODevice::ReadOnly)) {
LOG((CLOG_WARN "unable to open %s", pathToEvdevFile.c_str()));
LOG_WARN("unable to open %s", pathToEvdevFile.c_str());
return allCodes;
}
@ -69,13 +69,13 @@ std::vector<X11LayoutsParser::Lang> X11LayoutsParser::getAllLanguageData(const s
const auto xkbConfigElem = xmlDoc.firstChildElement("xkbConfigRegistry");
if (xkbConfigElem.isNull()) {
LOG((CLOG_WARN "failed to read xkbConfigRegistry in %s", pathToEvdevFile.c_str()));
LOG_WARN("failed to read xkbConfigRegistry in %s", pathToEvdevFile.c_str());
return allCodes;
}
auto layoutListElem = xkbConfigElem.firstChildElement("layoutList");
if (layoutListElem.isNull()) {
LOG((CLOG_WARN "failed to read layoutList in %s", pathToEvdevFile.c_str()));
LOG_WARN("failed to read layoutList in %s", pathToEvdevFile.c_str());
return allCodes;
}
@ -113,13 +113,13 @@ void X11LayoutsParser::convertLayoutToISO639_2(
for (size_t i = 0; i < layoutNames.size(); i++) {
const auto &layoutName = layoutNames[i];
if (layoutNames[i].empty()) {
LOG((CLOG_DEBUG "skip converting empty layout name"));
LOG_DEBUG("skip converting empty layout name");
continue;
}
auto langIter = std::ranges::find_if(allLang, [&layoutName](const Lang &l) { return l.name == layoutName; });
if (langIter == allLang.end()) {
LOG((CLOG_WARN "language \"%s\" is unknown", layoutNames[i].c_str()));
LOG_WARN("language \"%s\" is unknown", layoutNames[i].c_str());
continue;
}
@ -175,20 +175,20 @@ std::string X11LayoutsParser::convertLayotToISO(
)
{
if (layoutLangCode.empty()) {
LOG((CLOG_DEBUG1 "skip converting empty layout lang code"));
LOG_DEBUG1("skip converting empty layout lang code");
return "";
}
std::vector<std::string> iso639_2Codes;
convertLayoutToISO639_2(pathToEvdevFile, needToReloadFiles, {layoutLangCode}, {""}, iso639_2Codes);
if (iso639_2Codes.empty()) {
LOG((CLOG_WARN "failed to convert layout lang code: \"%s\"", layoutLangCode.c_str()));
LOG_WARN("failed to convert layout lang code: \"%s\"", layoutLangCode.c_str());
return "";
}
auto iso639_1Codes = convertISO639_2ToISO639_1(iso639_2Codes);
if (iso639_1Codes.empty()) {
LOG((CLOG_WARN "failed to convert ISO639/2 lang code to ISO639/1"));
LOG_WARN("failed to convert ISO639/2 lang code to ISO639/1");
return "";
}
@ -203,7 +203,7 @@ std::vector<std::string> X11LayoutsParser::convertISO639_2ToISO639_1(const std::
return c.first == isoCode;
});
if (tableIter == ISO_Table.end()) {
LOG((CLOG_WARN "the ISO 639-2 code \"%s\" is missed in table", isoCode.c_str()));
LOG_WARN("the ISO 639-2 code \"%s\" is missed in table", isoCode.c_str());
continue;
}

View File

@ -50,7 +50,7 @@ AppUtilWindows::~AppUtilWindows()
BOOL WINAPI AppUtilWindows::consoleHandler(DWORD)
{
LOG((CLOG_INFO "got shutdown signal"));
LOG_INFO("got shutdown signal");
IEventQueue *events = AppUtil::instance().app().getEvents();
events->addEvent(Event(EventTypes::Quit));
return TRUE;
@ -181,7 +181,7 @@ HKL AppUtilWindows::getCurrentKeyboardLayout() const
if (GetGUIThreadInfo(0, &gti) && gti.hwndActive) {
layout = GetKeyboardLayout(GetWindowThreadProcessId(gti.hwndActive, nullptr));
} else {
LOG((CLOG_WARN "failed to determine current keyboard layout"));
LOG_WARN("failed to determine current keyboard layout");
}
return layout;

View File

@ -125,28 +125,28 @@ void *Thread::threadFunc(void *vjob)
void *result = nullptr;
try {
// go
LOG((CLOG_DEBUG1 "thread 0x%08x entry", id));
LOG_DEBUG1("thread 0x%08x entry", id);
job->run();
LOG((CLOG_DEBUG1 "thread 0x%08x exit", id));
LOG_DEBUG1("thread 0x%08x exit", id);
} catch (XThreadCancel &) {
// client called cancel()
LOG((CLOG_DEBUG1 "caught cancel on thread 0x%08x", id));
LOG_DEBUG1("caught cancel on thread 0x%08x", id);
delete job;
throw;
} catch (XThreadExit &e) {
// client called exit()
result = e.m_result;
LOG((CLOG_DEBUG1 "caught exit on thread 0x%08x, result %p", id, result));
LOG_DEBUG1("caught exit on thread 0x%08x, result %p", id, result);
} catch (XBase &e) {
LOG((CLOG_ERR "exception on thread 0x%08x: %s", id, e.what()));
LOG_ERR("exception on thread 0x%08x: %s", id, e.what());
delete job;
throw;
} catch (std::exception &e) {
LOG((CLOG_ERR "standard exception on thread 0x%08x: %s", id, e.what()));
LOG_ERR("standard exception on thread 0x%08x: %s", id, e.what());
delete job;
throw;
} catch (...) {
LOG((CLOG_ERR "non-exception throw on thread 0x%08x: <unknown>", id));
LOG_ERR("non-exception throw on thread 0x%08x: <unknown>", id);
delete job;
throw;
}

View File

@ -225,7 +225,7 @@ int SecureSocket::secureRead(void *buffer, int size, int &read)
std::scoped_lock ssl_lock{ssl_mutex_};
if (m_ssl->m_ssl != nullptr) {
LOG((CLOG_DEBUG2 "reading secure socket"));
LOG_DEBUG2("reading secure socket");
read = SSL_read(m_ssl->m_ssl, buffer, size);
static int retry;
@ -252,7 +252,7 @@ int SecureSocket::secureWrite(const void *buffer, int size, int &wrote)
std::scoped_lock ssl_lock{ssl_mutex_};
if (m_ssl->m_ssl != nullptr) {
LOG((CLOG_DEBUG2 "writing secure socket: %p", this));
LOG_DEBUG2("writing secure socket: %p", this);
wrote = SSL_write(m_ssl->m_ssl, buffer, size);
@ -413,7 +413,7 @@ int SecureSocket::secureAccept(int socket)
// set connection socket to SSL state
SSL_set_fd(m_ssl->m_ssl, socket);
LOG((CLOG_DEBUG2 "accepting secure socket"));
LOG_DEBUG2("accepting secure socket");
int r = SSL_accept(m_ssl->m_ssl);
static int retry;
@ -422,8 +422,8 @@ int SecureSocket::secureAccept(int socket)
if (isFatal()) {
// tell user and sleep so the socket isn't hammered.
LOG((CLOG_ERR "failed to accept secure socket"));
LOG((CLOG_WARN "client connection may not be secure"));
LOG_ERR("failed to accept secure socket");
LOG_WARN("client connection may not be secure");
m_secureReady = false;
Arch::sleep(1);
retry = 0;
@ -438,7 +438,7 @@ int SecureSocket::secureAccept(int socket)
return -1; // Fail
}
m_secureReady = true;
LOG((CLOG_INFO "accepted secure socket"));
LOG_INFO("accepted secure socket");
SslLogger::logSecureCipherInfo(m_ssl->m_ssl);
SslLogger::logSecureConnectInfo(m_ssl->m_ssl);
return 1;
@ -446,14 +446,14 @@ int SecureSocket::secureAccept(int socket)
// If not fatal and retry is set, not ready, and return retry
if (retry > 0) {
LOG((CLOG_DEBUG2 "retry accepting secure socket"));
LOG_DEBUG2("retry accepting secure socket");
m_secureReady = false;
Arch::sleep(s_retryDelay);
return 0;
}
// no good state exists here
LOG((CLOG_ERR "unexpected state attempting to accept connection"));
LOG_ERR("unexpected state attempting to accept connection");
return -1;
}
@ -463,7 +463,7 @@ int SecureSocket::secureConnect(int socket)
std::string certDir = Settings::value(Settings::Security::Certificate).toString().toStdString();
if (!loadCertificates(certDir)) {
LOG((CLOG_ERR "could not load client certificates"));
LOG_ERR("could not load client certificates");
disconnect();
return -1;
}
@ -475,7 +475,7 @@ int SecureSocket::secureConnect(int socket)
// attach the socket descriptor
SSL_set_fd(m_ssl->m_ssl, socket);
LOG((CLOG_DEBUG2 "connecting secure socket"));
LOG_DEBUG2("connecting secure socket");
// TODO: S1-1766, enable hostname verification.
// the cert will need to be installed in the trusted store on the client.
@ -487,14 +487,14 @@ int SecureSocket::secureConnect(int socket)
checkResult(r, retry);
if (isFatal()) {
LOG((CLOG_ERR "failed to connect secure socket"));
LOG_ERR("failed to connect secure socket");
retry = 0;
return -1;
}
// If we should retry, not ready and return 0
if (retry > 0) {
LOG((CLOG_DEBUG2 "retry connect secure socket"));
LOG_DEBUG2("retry connect secure socket");
m_secureReady = false;
Arch::sleep(s_retryDelay);
return 0;
@ -504,17 +504,17 @@ int SecureSocket::secureConnect(int socket)
// No error, set ready, process and return ok
m_secureReady = true;
if (verifyCertFingerprint(Settings::tlsTrustedServersDb())) {
LOG((CLOG_INFO "connected to secure socket"));
LOG_INFO("connected to secure socket");
if (!showCertificate()) {
disconnect();
return -1; // Cert fail, error
}
} else {
LOG((CLOG_ERR "failed to verify server certificate fingerprint"));
LOG_ERR("failed to verify server certificate fingerprint");
disconnect();
return -1; // Fingerprint failed, error
}
LOG((CLOG_DEBUG2 "connected secure socket"));
LOG_DEBUG2("connected secure socket");
SslLogger::logSecureCipherInfo(m_ssl->m_ssl);
SslLogger::logSecureConnectInfo(m_ssl->m_ssl);
return 1;
@ -529,7 +529,7 @@ bool SecureSocket::showCertificate() const
cert = SSL_get_peer_certificate(m_ssl->m_ssl);
if (cert != nullptr) {
line = X509_NAME_oneline(X509_get_subject_name(cert), nullptr, 0);
LOG((CLOG_INFO "server tls certificate info: %s", line));
LOG_INFO("server tls certificate info: %s", line);
OPENSSL_free(line);
X509_free(cert);
} else {
@ -553,12 +553,12 @@ void SecureSocket::checkResult(int status, int &retry)
case SSL_ERROR_ZERO_RETURN:
// connection closed
isFatal(true);
LOG((CLOG_DEBUG "tls connection closed"));
LOG_DEBUG("tls connection closed");
break;
case SSL_ERROR_WANT_READ:
retry++;
LOG((CLOG_DEBUG2 "want to read, error=%d, attempt=%d", errorCode, retry));
LOG_DEBUG2("want to read, error=%d, attempt=%d", errorCode, retry);
break;
case SSL_ERROR_WANT_WRITE:
@ -567,30 +567,30 @@ void SecureSocket::checkResult(int status, int &retry)
// m_readable because the socket logic is always readable
setWritable(true);
retry++;
LOG((CLOG_DEBUG2 "want to write, error=%d, attempt=%d", errorCode, retry));
LOG_DEBUG2("want to write, error=%d, attempt=%d", errorCode, retry);
break;
case SSL_ERROR_WANT_CONNECT:
retry++;
LOG((CLOG_DEBUG2 "want to connect, error=%d, attempt=%d", errorCode, retry));
LOG_DEBUG2("want to connect, error=%d, attempt=%d", errorCode, retry);
break;
case SSL_ERROR_WANT_ACCEPT:
retry++;
LOG((CLOG_DEBUG2 "want to accept, error=%d, attempt=%d", errorCode, retry));
LOG_DEBUG2("want to accept, error=%d, attempt=%d", errorCode, retry);
break;
case SSL_ERROR_SYSCALL:
LOG((CLOG_ERR "tls error occurred (system call failure)"));
LOG_ERR("tls error occurred (system call failure)");
if (ERR_peek_error() == 0) {
if (status == 0) {
LOG((CLOG_ERR "eof violates tls protocol"));
LOG_ERR("eof violates tls protocol");
} else if (status == -1) {
// underlying socket I/O reproted an error
try {
ARCH->throwErrorOnSocket(getSocket());
} catch (XArchNetwork &e) {
LOG((CLOG_ERR "%s", e.what()));
LOG_ERR("%s", e.what());
}
}
}
@ -599,12 +599,12 @@ void SecureSocket::checkResult(int status, int &retry)
break;
case SSL_ERROR_SSL:
LOG((CLOG_ERR "tls error occurred (generic failure)"));
LOG_ERR("tls error occurred (generic failure)");
isFatal(true);
break;
default:
LOG((CLOG_ERR "tls error occurred (unknown failure)"));
LOG_ERR("tls error occurred (unknown failure)");
isFatal(true);
break;
}
@ -636,7 +636,7 @@ bool SecureSocket::verifyCertFingerprint(const QString &FingerprintDatabasePath)
return false;
// Gui Must Parse this line, DO NOT CHANGE
LOG((CLOG_NOTE "peer fingerprint: %s", deskflow::formatSSLFingerprint(sha256.data, false).toStdString().c_str()));
LOG_NOTE("peer fingerprint: %s", deskflow::formatSSLFingerprint(sha256.data, false).toStdString().c_str());
QFile file(FingerprintDatabasePath);
@ -646,20 +646,20 @@ bool SecureSocket::verifyCertFingerprint(const QString &FingerprintDatabasePath)
const auto &path = FingerprintDatabasePath;
if (file.exists() && emptyDB) {
LOG((CLOG_ERR "failed to open trusted fingerprints file: %s", path.toStdString().c_str()));
LOG_ERR("failed to open trusted fingerprints file: %s", path.toStdString().c_str());
return false;
}
if (!emptyDB) {
LOG((CLOG_DEBUG "read %d fingerprint(s) from file: %s", db.fingerprints().size(), path.toStdString().c_str()));
LOG_DEBUG("read %d fingerprint(s) from file: %s", db.fingerprints().size(), path.toStdString().c_str());
}
if (!db.isTrusted(sha256)) {
LOG((CLOG_WARN "fingerprint does not match trusted fingerprint"));
LOG_WARN("fingerprint does not match trusted fingerprint");
return false;
}
LOG((CLOG_DEBUG "fingerprint matches trusted fingerprint"));
LOG_DEBUG("fingerprint matches trusted fingerprint");
return true;
}
@ -721,7 +721,7 @@ ISocketMultiplexerJob *SecureSocket::serviceAccept(ISocketMultiplexerJob *job, b
void SecureSocket::handleTCPConnected(const Event &)
{
if (getSocket() == nullptr) {
LOG((CLOG_DEBUG "disregarding stale connect event"));
LOG_DEBUG("disregarding stale connect event");
return;
}
secureConnect();

View File

@ -174,7 +174,7 @@ void SocketMultiplexer::removeSocket(ISocket *socket)
status = 0;
}
} catch (XArchNetwork &e) {
LOG((CLOG_WARN "error in socket multiplexer: %s", e.what()));
LOG_WARN("error in socket multiplexer: %s", e.what());
status = 0;
}

View File

@ -26,7 +26,7 @@ void showCipherStackDesc(STACK_OF(SSL_CIPHER) * stack)
msg[pos] = '\0';
}
LOG((CLOG_DEBUG1 "%s", msg));
LOG_DEBUG1("%s", msg);
}
}
@ -35,10 +35,10 @@ void logLocalSecureCipherInfo(const SSL *ssl)
auto sStack = SSL_get_ciphers(ssl);
if (sStack) {
LOG((CLOG_DEBUG1 "available local ciphers:"));
LOG_DEBUG1("available local ciphers:");
showCipherStackDesc(sStack);
} else {
LOG((CLOG_DEBUG1 "local cipher list not available"));
LOG_DEBUG1("local cipher list not available");
}
}
@ -54,10 +54,10 @@ void logRemoteSecureCipherInfo(const SSL *ssl)
auto cStack = SSL_get_client_ciphers(ssl);
#endif
if (cStack) {
LOG((CLOG_DEBUG1 "available remote ciphers:"));
LOG_DEBUG1("available remote ciphers:");
showCipherStackDesc(cStack);
} else {
LOG((CLOG_DEBUG1 "remote cipher list not available"));
LOG_DEBUG1("remote cipher list not available");
}
}
@ -66,11 +66,11 @@ void logRemoteSecureCipherInfo(const SSL *ssl)
void SslLogger::logSecureLibInfo()
{
if (CLOG->getFilter() >= LogLevel::Debug) {
LOG((CLOG_DEBUG "openssl version: %s", SSLeay_version(SSLEAY_VERSION)));
LOG((CLOG_DEBUG1 "openssl flags: %s", SSLeay_version(SSLEAY_CFLAGS)));
LOG((CLOG_DEBUG1 "openssl built on: %s", SSLeay_version(SSLEAY_BUILT_ON)));
LOG((CLOG_DEBUG1 "openssl platform: %s", SSLeay_version(SSLEAY_PLATFORM)));
LOG((CLOG_DEBUG1 "openssl dir: %s", SSLeay_version(SSLEAY_DIR)));
LOG_DEBUG("openssl version: %s", SSLeay_version(SSLEAY_VERSION));
LOG_DEBUG1("openssl flags: %s", SSLeay_version(SSLEAY_CFLAGS));
LOG_DEBUG1("openssl built on: %s", SSLeay_version(SSLEAY_BUILT_ON));
LOG_DEBUG1("openssl platform: %s", SSLeay_version(SSLEAY_PLATFORM));
LOG_DEBUG1("openssl dir: %s", SSLeay_version(SSLEAY_DIR));
}
}
@ -90,7 +90,7 @@ void SslLogger::logSecureConnectInfo(const SSL *ssl)
if (cipher) {
char msg[128] = {0};
SSL_CIPHER_description(cipher, msg, sizeof(msg));
LOG((CLOG_DEBUG "openssl cipher: %s", msg));
LOG_DEBUG("openssl cipher: %s", msg);
// For some reason SSL_get_version is return mismatching information to
// SSL_CIPHER_description
@ -106,15 +106,15 @@ void SslLogger::logSecureConnectInfo(const SSL *ssl)
};
if (parts.size() > 2) {
// log the section containing the protocol version
LOG((CLOG_INFO "network encryption protocol: %s", parts[1].c_str()));
LOG_INFO("network encryption protocol: %s", parts[1].c_str());
} else {
// log the error in spliting then display the whole description rather
// then nothing
LOG((CLOG_ERR "could not split cipher for protocol"));
LOG((CLOG_INFO "network encryption protocol: %s", msg));
LOG_ERR("could not split cipher for protocol");
LOG_INFO("network encryption protocol: %s", msg);
}
} else {
LOG((CLOG_ERR "could not get secure socket cipher"));
LOG_ERR("could not get secure socket cipher");
}
}
}
@ -122,14 +122,14 @@ void SslLogger::logSecureConnectInfo(const SSL *ssl)
void SslLogger::logError(const std::string &reason)
{
if (!reason.empty()) {
LOG((CLOG_ERR "secure socket error: %s", reason.c_str()));
LOG_ERR("secure socket error: %s", reason.c_str());
}
auto id = ERR_get_error();
if (id) {
char error[65535] = {0};
ERR_error_string_n(id, error, sizeof(error));
LOG((CLOG_ERR "openssl error: %s", error));
LOG_ERR("openssl error: %s", error);
}
}
@ -140,35 +140,35 @@ void SslLogger::logErrorByCode(int code, int retry)
break;
case SSL_ERROR_ZERO_RETURN:
LOG((CLOG_DEBUG "tls connection closed"));
LOG_DEBUG("tls connection closed");
break;
case SSL_ERROR_WANT_READ:
LOG((CLOG_DEBUG2 "want to read, error=%d, attempt=%d", code, retry));
LOG_DEBUG2("want to read, error=%d, attempt=%d", code, retry);
break;
case SSL_ERROR_WANT_WRITE:
LOG((CLOG_DEBUG2 "want to write, error=%d, attempt=%d", code, retry));
LOG_DEBUG2("want to write, error=%d, attempt=%d", code, retry);
break;
case SSL_ERROR_WANT_CONNECT:
LOG((CLOG_DEBUG2 "want to connect, error=%d, attempt=%d", code, retry));
LOG_DEBUG2("want to connect, error=%d, attempt=%d", code, retry);
break;
case SSL_ERROR_WANT_ACCEPT:
LOG((CLOG_DEBUG2 "want to accept, error=%d, attempt=%d", code, retry));
LOG_DEBUG2("want to accept, error=%d, attempt=%d", code, retry);
break;
case SSL_ERROR_SYSCALL:
LOG((CLOG_ERR "tls error occurred (system call failure)"));
LOG_ERR("tls error occurred (system call failure)");
break;
case SSL_ERROR_SSL:
LOG((CLOG_ERR "tls error occurred (generic failure)"));
LOG_ERR("tls error occurred (generic failure)");
break;
default:
LOG((CLOG_ERR "tls error occurred (unknown failure)"));
LOG_ERR("tls error occurred (unknown failure)");
break;
}
}

View File

@ -44,7 +44,7 @@ TCPListenSocket::~TCPListenSocket()
}
} catch (...) {
// ignore
LOG((CLOG_WARN "error while closing TCP socket"));
LOG_WARN("error while closing TCP socket");
}
}

View File

@ -39,7 +39,7 @@ TCPSocket::TCPSocket(IEventQueue *events, SocketMultiplexer *socketMultiplexer,
throw XSocketCreate(e.what());
}
LOG((CLOG_DEBUG "opening new socket: %08X", m_socket));
LOG_DEBUG("opening new socket: %08X", m_socket);
init();
}
@ -53,7 +53,7 @@ TCPSocket::TCPSocket(IEventQueue *events, SocketMultiplexer *socketMultiplexer,
{
assert(m_socket != nullptr);
LOG((CLOG_DEBUG "opening new socket: %08X", m_socket));
LOG_DEBUG("opening new socket: %08X", m_socket);
// socket starts in connected state
init();
@ -67,7 +67,7 @@ TCPSocket::~TCPSocket()
// warning virtual function in destructor is very danger practice
close();
} catch (...) {
LOG((CLOG_DEBUG "error while TCP socket destruction"));
LOG_DEBUG("error while TCP socket destruction");
}
}
@ -84,7 +84,7 @@ void TCPSocket::bind(const NetworkAddress &addr)
void TCPSocket::close()
{
LOG((CLOG_DEBUG "closing socket: %08X", m_socket));
LOG_DEBUG("closing socket: %08X", m_socket);
// remove ourself from the multiplexer
setJob(nullptr);
@ -105,7 +105,7 @@ void TCPSocket::close()
ARCH->closeSocket(socket);
} catch (const XArchNetwork &e) {
// ignore, there's not much we can do
LOG((CLOG_WARN "error closing socket: %s", e.what()));
LOG_WARN("error closing socket: %s", e.what());
}
}
}
@ -186,7 +186,7 @@ void TCPSocket::shutdownInput()
ARCH->closeSocketForRead(m_socket);
} catch (const XArchNetwork &e) {
// ignore, there's not much we can do
LOG((CLOG_WARN "error closing socket: %s", e.what()));
LOG_WARN("error closing socket: %s", e.what());
}
// shutdown buffer for reading
@ -212,7 +212,7 @@ void TCPSocket::shutdownOutput()
ARCH->closeSocketForWrite(m_socket);
} catch (const XArchNetwork &e) {
// ignore, there's not much we can do
LOG((CLOG_WARN "error closing socket: %s", e.what()));
LOG_WARN("error closing socket: %s", e.what());
}
// shutdown buffer for writing
@ -236,7 +236,7 @@ bool TCPSocket::isReady() const
bool TCPSocket::isFatal() const
{
// TCP sockets aren't ever left in a fatal state.
LOG((CLOG_ERR "isFatal() not valid for non-secure connections"));
LOG_ERR("isFatal() not valid for non-secure connections");
return false;
}
@ -290,7 +290,7 @@ void TCPSocket::init()
m_socket = nullptr;
} catch (const XArchNetwork &e) {
// ignore, there's not much we can do
LOG((CLOG_WARN "error closing socket: %s", e.what()));
LOG_WARN("error closing socket: %s", e.what());
}
throw XSocketCreate(e.what());
}
@ -520,7 +520,7 @@ ISocketMultiplexerJob *TCPSocket::serviceConnected(ISocketMultiplexerJob *job, b
writeResult = New;
} catch (XArchNetwork &e) {
// other write error
LOG((CLOG_WARN "error writing socket: %s", e.what()));
LOG_WARN("error writing socket: %s", e.what());
onDisconnected();
sendEvent(StreamOutputError);
sendEvent(SocketDisconnected);
@ -538,7 +538,7 @@ ISocketMultiplexerJob *TCPSocket::serviceConnected(ISocketMultiplexerJob *job, b
readResult = New;
} catch (XArchNetwork &e) {
// ignore other read error
LOG((CLOG_WARN "error reading socket: %s", e.what()));
LOG_WARN("error reading socket: %s", e.what());
}
}

View File

@ -53,13 +53,13 @@ void MSWindowsClipboard::setFacade(IMSWindowsClipboardFacade &facade)
bool MSWindowsClipboard::emptyUnowned()
{
LOG((CLOG_DEBUG "empty clipboard"));
LOG_DEBUG("empty clipboard");
// empty the clipboard (and take ownership)
if (!EmptyClipboard()) {
// unable to cause this in integ tests, but this error has never
// actually been reported by users.
LOG((CLOG_WARN "failed to grab clipboard"));
LOG_WARN("failed to grab clipboard");
return false;
}
@ -75,7 +75,7 @@ bool MSWindowsClipboard::empty()
// mark clipboard as being owned by deskflow
HGLOBAL data = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, 1);
if (nullptr == SetClipboardData(getOwnershipFormat(), data)) {
LOG((CLOG_WARN "failed to set clipboard data"));
LOG_WARN("failed to set clipboard data");
GlobalFree(data);
return false;
}
@ -87,7 +87,7 @@ void MSWindowsClipboard::add(Format format, const std::string &data)
{
// exit early if there is no data to prevent spurious "failed to convert clipboard data" errors
if (data.empty()) {
LOG((CLOG_DEBUG "not adding 0 bytes to clipboard format: %d", format));
LOG_DEBUG("not adding 0 bytes to clipboard format: %d", format);
return;
}
bool isSucceeded = false;
@ -99,27 +99,27 @@ void MSWindowsClipboard::add(Format format, const std::string &data)
if (converter->getFormat() == format) {
HANDLE win32Data = converter->fromIClipboard(data);
if (win32Data != nullptr) {
LOG((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
LOG_DEBUG("add %d bytes to clipboard format: %d", data.size(), format);
m_facade->write(win32Data, converter->getWin32Format());
isSucceeded = true;
break;
} else {
LOG((CLOG_DEBUG "failed to convert clipboard data to platform format"));
LOG_DEBUG("failed to convert clipboard data to platform format");
}
}
}
if (!isSucceeded) {
LOG((CLOG_DEBUG "missed clipboard data convert for format: %d", format));
LOG_DEBUG("missed clipboard data convert for format: %d", format);
}
}
bool MSWindowsClipboard::open(Time time) const
{
LOG((CLOG_DEBUG "open clipboard"));
LOG_DEBUG("open clipboard");
if (!OpenClipboard(m_window)) {
LOG((CLOG_WARN "failed to open clipboard: %d", GetLastError()));
LOG_WARN("failed to open clipboard: %d", GetLastError());
return false;
}
@ -130,7 +130,7 @@ bool MSWindowsClipboard::open(Time time) const
void MSWindowsClipboard::close() const
{
LOG((CLOG_DEBUG "close clipboard"));
LOG_DEBUG("close clipboard");
CloseClipboard();
}
@ -167,7 +167,7 @@ std::string MSWindowsClipboard::get(Format format) const
// if no converter then we don't recognize any formats
if (converter == nullptr) {
LOG((CLOG_WARN "no converter for format %d", format));
LOG_WARN("no converter for format %d", format);
return std::string();
}

View File

@ -67,8 +67,7 @@ std::string MSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const
}
// create a destination DIB section
LOG((CLOG_INFO "convert image from: depth=%d comp=%d", bitmap->bmiHeader.biBitCount, bitmap->bmiHeader.biCompression)
);
LOG_INFO("convert image from: depth=%d comp=%d", bitmap->bmiHeader.biBitCount, bitmap->bmiHeader.biCompression);
void *raw;
BITMAPINFOHEADER info;
LONG w = bitmap->bmiHeader.biWidth;

View File

@ -183,7 +183,7 @@ void MSWindowsDesks::setOptions(const OptionsList &options)
for (uint32_t i = 0, n = (uint32_t)options.size(); i < n; i += 2) {
if (options[i] == kOptionWin32KeepForeground) {
m_leaveForegroundOption = (options[i + 1] != 0);
LOG((CLOG_DEBUG1 "%s the foreground window", m_leaveForegroundOption ? "don\'t grab" : "grab"));
LOG_DEBUG1("%s the foreground window", m_leaveForegroundOption ? "don\'t grab" : "grab");
}
}
}
@ -367,7 +367,7 @@ HWND MSWindowsDesks::createWindow(ATOM windowClass, const char *name) const
MSWindowsScreen::getWindowInstance(), nullptr
);
if (window == nullptr) {
LOG((CLOG_ERR "failed to create window: %d", GetLastError()));
LOG_ERR("failed to create window: %d", GetLastError());
throw XScreenOpenFailure();
}
return window;
@ -611,10 +611,10 @@ void MSWindowsDesks::deskThread(void *vdesk)
// create a window. we use this window to hide the cursor.
try {
desk->m_window = createWindow(m_deskClass, "DeskflowDesk");
LOG((CLOG_DEBUG "desk %s window is 0x%08x", desk->m_name.c_str(), desk->m_window));
LOG_DEBUG("desk %s window is 0x%08x", desk->m_name.c_str(), desk->m_window);
} catch (...) {
// ignore
LOG((CLOG_DEBUG "can't create desk window for %s", desk->m_name.c_str()));
LOG_DEBUG("can't create desk window for %s", desk->m_name.c_str());
}
}
@ -802,15 +802,15 @@ void MSWindowsDesks::checkDesk()
// from an inaccessible desktop so when we switch from an
// inaccessible desktop to an accessible one we have to
// update the keyboard state.
LOG((CLOG_DEBUG "switched to desk \"%s\"", name.c_str()));
LOG_DEBUG("switched to desk \"%s\"", name.c_str());
bool syncKeys = false;
bool isAccessible = isDeskAccessible(desk);
if (isDeskAccessible(m_activeDesk) != isAccessible) {
if (isAccessible) {
LOG((CLOG_DEBUG "desktop is now accessible"));
LOG_DEBUG("desktop is now accessible");
syncKeys = true;
} else {
LOG((CLOG_DEBUG "desktop is now inaccessible"));
LOG_DEBUG("desktop is now inaccessible");
}
}

View File

@ -53,8 +53,8 @@ void MSWindowsHook::loadLibrary()
// initialize library
if (init(GetCurrentThreadId()) == 0) {
LOG((CLOG_ERR "failed to init %s.dll, another program may be using it", g_name));
LOG((CLOG_INFO "restarting your computer may solve this error"));
LOG_ERR("failed to init %s.dll, another program may be using it", g_name);
LOG_INFO("restarting your computer may solve this error");
throw XScreenOpenFailure();
}
}

View File

@ -834,7 +834,7 @@ int32_t MSWindowsKeyState::pollActiveGroup() const
// get group
GroupMap::const_iterator i = m_groupMap.find(hkl);
if (i == m_groupMap.end()) {
LOG((CLOG_DEBUG1 "can't find keyboard layout %08x", hkl));
LOG_DEBUG1("can't find keyboard layout %08x", hkl);
return 0;
}
@ -845,8 +845,8 @@ void MSWindowsKeyState::pollPressedKeys(KeyButtonSet &pressedKeys) const
{
BYTE keyState[256];
if (!GetKeyboardState(keyState)) {
LOG((CLOG_WARN "keyboard state is unexpected"));
LOG((CLOG_DEBUG "function 'GetKeyboardState' returned false on 'pollPressedKeys'"));
LOG_WARN("keyboard state is unexpected");
LOG_DEBUG("function 'GetKeyboardState' returned false on 'pollPressedKeys'");
return;
}
for (KeyButton i = 1; i < 256; ++i) {
@ -1172,7 +1172,7 @@ void MSWindowsKeyState::fakeKey(const Keystroke &keystroke)
// windows doesn't send key ups for key repeats
if (keystroke.m_data.m_button.m_repeat && !keystroke.m_data.m_button.m_press) {
LOG((CLOG_DEBUG1 " discard key repeat release"));
LOG_DEBUG1(" discard key repeat release");
break;
}
@ -1207,10 +1207,10 @@ void MSWindowsKeyState::fakeKey(const Keystroke &keystroke)
// key events.
if (!keystroke.m_data.m_group.m_restore) {
if (keystroke.m_data.m_group.m_absolute) {
LOG((CLOG_DEBUG1 " group %d", keystroke.m_data.m_group.m_group));
LOG_DEBUG1(" group %d", keystroke.m_data.m_group.m_group);
setWindowGroup(keystroke.m_data.m_group.m_group);
} else {
LOG((CLOG_DEBUG1 " group %+d", keystroke.m_data.m_group.m_group));
LOG_DEBUG1(" group %+d", keystroke.m_data.m_group.m_group);
setWindowGroup(getEffectiveGroup(pollActiveGroup(), keystroke.m_data.m_group.m_group));
}
}
@ -1232,13 +1232,13 @@ bool MSWindowsKeyState::getGroups(GroupList &groups) const
// get keyboard layouts
uint32_t newNumLayouts = GetKeyboardLayoutList(0, nullptr);
if (newNumLayouts == 0) {
LOG((CLOG_DEBUG1 "can't get keyboard layouts"));
LOG_DEBUG1("can't get keyboard layouts");
return false;
}
HKL *newLayouts = new HKL[newNumLayouts];
newNumLayouts = GetKeyboardLayoutList(newNumLayouts, newLayouts);
if (newNumLayouts == 0) {
LOG((CLOG_DEBUG1 "can't get keyboard layouts"));
LOG_DEBUG1("can't get keyboard layouts");
delete[] newLayouts;
return false;
}
@ -1258,7 +1258,7 @@ void MSWindowsKeyState::setWindowGroup(int32_t group)
// character set.
if (!PostMessage(targetWindow, WM_INPUTLANGCHANGEREQUEST, sysCharSet ? 1 : 0, (LPARAM)m_groups[group])) {
LOG((CLOG_WARN "failed to post change language message"));
LOG_WARN("failed to post change language message");
}
// XXX -- use a short delay to let the target window process the message

View File

@ -62,7 +62,7 @@ BOOL MSWindowsProcess::startAsUser(HANDLE userToken, LPSECURITY_ATTRIBUTES sa)
LPVOID environment;
if (!CreateEnvironmentBlock(&environment, userToken, FALSE)) {
LOG((CLOG_ERR "could not create environment block"));
LOG_ERR("could not create environment block");
throw std::runtime_error(windowsErrorToString(GetLastError()));
}

View File

@ -114,8 +114,8 @@ MSWindowsScreen::MSWindowsScreen(
m_class = createWindowClass();
m_window = createWindow(m_class, kAppName);
setupMouseKeys();
LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : ""));
LOG((CLOG_DEBUG "window is 0x%08x", m_window));
LOG_DEBUG("screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : "");
LOG_DEBUG("window is 0x%08x", m_window);
if (App::instance().argsBase().m_preventSleep) {
m_powerManager.disableSleep();
@ -186,7 +186,7 @@ void MSWindowsScreen::enable()
// install our clipboard snooper
if (!AddClipboardFormatListener(m_window)) {
LOG((CLOG_WARN "failed to add the clipboard format listener: %d", GetLastError()));
LOG_WARN("failed to add the clipboard format listener: %d", GetLastError());
}
// track the active desk and (re)install the hooks
@ -222,7 +222,7 @@ void MSWindowsScreen::disable()
// stop snooping the clipboard
if (!RemoveClipboardFormatListener(m_window)) {
LOG((CLOG_WARN "failed to remove the clipboard format listener: %d", GetLastError()));
LOG_WARN("failed to remove the clipboard format listener: %d", GetLastError());
}
// uninstall fix timer
@ -310,7 +310,7 @@ void MSWindowsScreen::leave()
for (KeyButton i = 0; i < IKeyState::s_numButtons; ++i) {
if (m_keyState->isKeyDown(i)) {
m_primaryKeyDownList.push_back(i);
LOG((CLOG_DEBUG1 "key button %d is down before leaving to another screen", i));
LOG_DEBUG1("key button %d is down before leaving to another screen", i);
}
}
}
@ -350,7 +350,7 @@ void MSWindowsScreen::checkClipboards()
// won't be reflected on other screens until we leave but at
// least the clipboard itself will work.
if (m_ownClipboard && !MSWindowsClipboard::isOwnedByDeskflow()) {
LOG((CLOG_DEBUG "clipboard changed: lost ownership and no notification received"));
LOG_DEBUG("clipboard changed: lost ownership and no notification received");
m_ownClipboard = false;
sendClipboardEvent(EventTypes::ClipboardGrabbed, kClipboardClipboard);
sendClipboardEvent(EventTypes::ClipboardGrabbed, kClipboardSelection);
@ -457,7 +457,7 @@ bool MSWindowsScreen::getThisCursorPos(LPPOINT pos)
LOG_DEBUG("retrying get cursor pos");
result = GetCursorPos(pos);
if (!result) {
LOG((CLOG_DEBUG "could not get cursor pos, error: %s", windowsErrorToString(GetLastError()).c_str()));
LOG_DEBUG("could not get cursor pos, error: %s", windowsErrorToString(GetLastError()).c_str());
updateDesktopThread();
}
@ -475,7 +475,7 @@ bool MSWindowsScreen::setThisCursorPos(int x, int y)
LOG_DEBUG("retrying to set cursor pos");
result = SetCursorPos(x, y);
if (!result) {
LOG((CLOG_DEBUG "could not set cursor pos, error: %s", windowsErrorToString(GetLastError()).c_str()));
LOG_DEBUG("could not set cursor pos, error: %s", windowsErrorToString(GetLastError()).c_str());
updateDesktopThread();
}
@ -506,7 +506,6 @@ void MSWindowsScreen::updateDesktopThread()
void MSWindowsScreen::reconfigure(uint32_t activeSides)
{
assert(m_isPrimary);
const static auto sidesText = sidesMaskToString(activeSides);
LOG_DEBUG("active sides: %s (0x%02x)", sidesText.c_str(), activeSides);
m_hook.setSides(activeSides);
@ -537,7 +536,7 @@ void MSWindowsScreen::saveMousePosition(int32_t x, int32_t y)
m_xCursor = x;
m_yCursor = y;
LOG((CLOG_DEBUG5 "saved mouse position for next delta: %+d,%+d", x, y));
LOG_DEBUG5("saved mouse position for next delta: %+d,%+d", x, y);
}
uint32_t MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
@ -546,7 +545,7 @@ uint32_t MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
if ((mask & ~(KeyModifierShift | KeyModifierControl | KeyModifierAlt | KeyModifierSuper)) != 0) {
// this should be a warning, but this can confuse users,
// as this warning happens almost always.
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
LOG_DEBUG("could not map hotkey id=%04x mask=%04x", key, mask);
return 0;
}
@ -574,7 +573,7 @@ uint32_t MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
// can't map key
// this should be a warning, but this can confuse users,
// as this warning happens almost always.
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
LOG_DEBUG("could not map hotkey id=%04x mask=%04x", key, mask);
return 0;
}
@ -604,16 +603,15 @@ uint32_t MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
} else {
m_oldHotKeyIDs.push_back(id);
m_hotKeys.erase(id);
LOG(
(CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", deskflow::KeyMap::formatKey(key, mask).c_str(),
key, mask)
LOG_WARN(
"failed to register hotkey %s (id=%04x mask=%04x)", deskflow::KeyMap::formatKey(key, mask).c_str(), key, mask
);
return 0;
}
LOG(
(CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", deskflow::KeyMap::formatKey(key, mask).c_str(),
key, mask, id)
LOG_DEBUG(
"registered hotkey %s (id=%04x mask=%04x) as id=%d", deskflow::KeyMap::formatKey(key, mask).c_str(), key, mask, id
);
return id;
}
@ -634,9 +632,9 @@ void MSWindowsScreen::unregisterHotKey(uint32_t id)
err = false;
}
if (err) {
LOG((CLOG_WARN "failed to unregister hotkey id=%d", id));
LOG_WARN("failed to unregister hotkey id=%d", id);
} else {
LOG((CLOG_DEBUG "unregistered hotkey id=%d", id));
LOG_DEBUG("unregistered hotkey id=%d", id);
}
// discard hot key from map and record old id for reuse
@ -678,7 +676,7 @@ bool MSWindowsScreen::isAnyMouseButtonDown(uint32_t &buttonID) const
for (uint32_t i = 1; i < sizeof(m_buttons) / sizeof(m_buttons[0]); ++i) {
if (m_buttons[i]) {
buttonID = i;
LOG((CLOG_DEBUG "locked by \"%s\"", buttonToName[i]));
LOG_DEBUG("locked by \"%s\"", buttonToName[i]);
return true;
}
}
@ -807,7 +805,7 @@ HWND MSWindowsScreen::createWindow(ATOM windowClass, const char *name) const
nullptr, nullptr, s_windowInstance, nullptr
);
if (window == nullptr) {
LOG((CLOG_ERR "failed to create window: %d", GetLastError()));
LOG_ERR("failed to create window: %d", GetLastError());
throw XScreenOpenFailure();
}
return window;
@ -829,7 +827,7 @@ void MSWindowsScreen::sendClipboardEvent(EventTypes type, ClipboardID id)
{
ClipboardInfo *info = (ClipboardInfo *)malloc(sizeof(ClipboardInfo));
if (info == nullptr) {
LOG((CLOG_ERR "malloc failed on %s:%s", __FILE__, __LINE__));
LOG_ERR("malloc failed on %s:%s", __FILE__, __LINE__);
return;
}
info->m_id = id;
@ -873,7 +871,7 @@ bool MSWindowsScreen::onPreDispatch(HWND hwnd, UINT message, WPARAM wParam, LPAR
return onScreensaver(wParam != 0);
case DESKFLOW_MSG_DEBUG:
LOG((CLOG_DEBUG1 "hook: 0x%08x 0x%08x", wParam, lParam));
LOG_DEBUG1("hook: 0x%08x 0x%08x", wParam, lParam);
return true;
}
@ -886,7 +884,7 @@ bool MSWindowsScreen::onPreDispatch(HWND hwnd, UINT message, WPARAM wParam, LPAR
bool MSWindowsScreen::onPreDispatchPrimary(HWND, UINT message, WPARAM wParam, LPARAM lParam)
{
LOG((CLOG_DEBUG5 "handling pre-dispatch primary"));
LOG_DEBUG5("handling pre-dispatch primary");
// handle event
switch (message) {
@ -923,7 +921,7 @@ bool MSWindowsScreen::onPreDispatchPrimary(HWND, UINT message, WPARAM wParam, LP
return true;
case DESKFLOW_MSG_POST_WARP:
LOG((CLOG_WARN "unmatched post warp"));
LOG_WARN("unmatched post warp");
return true;
case WM_HOTKEY:
@ -943,10 +941,7 @@ bool MSWindowsScreen::onEvent(HWND, UINT msg, WPARAM wParam, LPARAM lParam, LRES
case WM_CLIPBOARDUPDATE: {
DWORD clipboardSequenceNumber = GetClipboardSequenceNumber();
LOG(
(CLOG_DEBUG "clipboard update: sequence number %d, current %d", clipboardSequenceNumber,
m_clipboardSequenceNumber)
);
LOG_DEBUG("clipboard update: sequence number %d, current %d", clipboardSequenceNumber, m_clipboardSequenceNumber);
if (clipboardSequenceNumber && (clipboardSequenceNumber != m_clipboardSequenceNumber)) {
m_clipboardSequenceNumber = clipboardSequenceNumber;
@ -1018,9 +1013,9 @@ bool MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
{
static const KeyModifierMask s_ctrlAlt = KeyModifierControl | KeyModifierAlt;
LOG(
(CLOG_DEBUG1 "event: Key char=%d, vk=0x%02x, nagr=%d, lParam=0x%08x", (wParam & 0xffffu), (wParam >> 16) & 0xffu,
(wParam & 0x1000000u) ? 1 : 0, lParam)
LOG_DEBUG1(
"event: Key char=%d, vk=0x%02x, nagr=%d, lParam=0x%08x", (wParam & 0xffffu), (wParam >> 16) & 0xffu,
(wParam & 0x1000000u) ? 1 : 0, lParam
);
// get event info
@ -1052,7 +1047,7 @@ bool MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
if (!down && m_isPrimary && !m_isOnScreen) {
PrimaryKeyDownList::iterator find = std::find(m_primaryKeyDownList.begin(), m_primaryKeyDownList.end(), button);
if (find != m_primaryKeyDownList.end()) {
LOG((CLOG_DEBUG1 "release key button %d on primary", *find));
LOG_DEBUG1("release key button %d on primary", *find);
m_hook.setMode(kHOOK_WATCH_JUMP_ZONE);
fakeLocalKey(*find, false);
m_primaryKeyDownList.erase(find);
@ -1106,13 +1101,13 @@ bool MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
// client. the user can use ctrl+alt+pause to emulate it.
UINT virtKey = ((wParam >> 16) & 0xffu);
if (virtKey == VK_DELETE && (state & s_ctrlAlt) == s_ctrlAlt) {
LOG((CLOG_DEBUG "discard ctrl+alt+del"));
LOG_DEBUG("discard ctrl+alt+del");
return true;
}
// check for ctrl+alt+del emulation
if ((virtKey == VK_PAUSE || virtKey == VK_CANCEL) && (state & s_ctrlAlt) == s_ctrlAlt) {
LOG((CLOG_DEBUG "emulate ctrl+alt+del"));
LOG_DEBUG("emulate ctrl+alt+del");
// switch wParam and lParam to be as if VK_DELETE was
// pressed or released. when mapping the key we require that
// we not use AltGr (the 0x10000 flag in wParam) and we not
@ -1134,7 +1129,7 @@ bool MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
(int32_t)(lParam & 0xffff), button
);
} else {
LOG((CLOG_DEBUG1 "cannot map key"));
LOG_DEBUG1("cannot map key");
}
}
@ -1199,12 +1194,12 @@ bool MSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
if (!ignore()) {
KeyModifierMask mask = m_keyState->getActiveModifiers();
if (pressed) {
LOG((CLOG_DEBUG1 "event: button press button=%d", button));
LOG_DEBUG1("event: button press button=%d", button);
if (button != kButtonNone) {
sendEvent(EventTypes::PrimaryScreenButtonDown, ButtonInfo::alloc(button, mask));
}
} else {
LOG((CLOG_DEBUG1 "event: button release button=%d", button));
LOG_DEBUG1("event: button release button=%d", button);
if (button != kButtonNone) {
sendEvent(EventTypes::PrimaryScreenButtonUp, ButtonInfo::alloc(button, mask));
}
@ -1231,7 +1226,7 @@ bool MSWindowsScreen::onMouseMove(int32_t mx, int32_t my)
int32_t x = mx - m_xCursor;
int32_t y = my - m_yCursor;
LOG((CLOG_DEBUG3 "mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)", x, mx, m_xCursor, y, my, m_yCursor));
LOG_DEBUG3("mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)", x, mx, m_xCursor, y, my, m_yCursor);
// ignore if the mouse didn't move or if message posted prior
// to last mark change.
@ -1250,7 +1245,7 @@ bool MSWindowsScreen::onMouseMove(int32_t mx, int32_t my)
// center on the server screen. if we don't do this, then the mouse
// will always try to return to the original entry point on the
// secondary screen.
LOG((CLOG_DEBUG5 "centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter));
LOG_DEBUG5("centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter);
warpCursorNoFlush(m_xCenter, m_yCenter);
// examine the motion. if it's about the distance
@ -1262,7 +1257,7 @@ bool MSWindowsScreen::onMouseMove(int32_t mx, int32_t my)
if (-x + bogusZoneSize > m_xCenter - m_x || x + bogusZoneSize > m_x + m_w - m_xCenter ||
-y + bogusZoneSize > m_yCenter - m_y || y + bogusZoneSize > m_y + m_h - m_yCenter) {
LOG((CLOG_DEBUG "dropped bogus delta motion: %+d,%+d", x, y));
LOG_DEBUG("dropped bogus delta motion: %+d,%+d", x, y);
} else {
// send motion
sendEvent(EventTypes::PrimaryScreenMotionOnSecondary, MotionInfo::alloc(x, y));
@ -1276,7 +1271,7 @@ bool MSWindowsScreen::onMouseWheel(int32_t xDelta, int32_t yDelta)
{
// ignore message if posted prior to last mark change
if (!ignore()) {
LOG((CLOG_DEBUG1 "event: button wheel delta=%+d,%+d", xDelta, yDelta));
LOG_DEBUG1("event: button wheel delta=%+d,%+d", xDelta, yDelta);
sendEvent(EventTypes::PrimaryScreenWheel, WheelInfo::alloc(xDelta, yDelta));
}
return true;
@ -1337,7 +1332,7 @@ bool MSWindowsScreen::onDisplayChange()
// send new screen info
sendEvent(EventTypes::ScreenShapeChanged);
LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : ""));
LOG_DEBUG("screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : "");
}
return true;
@ -1349,13 +1344,13 @@ void MSWindowsScreen::onClipboardChange()
// we're the owner).
if (!MSWindowsClipboard::isOwnedByDeskflow()) {
if (m_ownClipboard) {
LOG((CLOG_DEBUG "clipboard changed: lost ownership"));
LOG_DEBUG("clipboard changed: lost ownership");
m_ownClipboard = false;
sendClipboardEvent(EventTypes::ClipboardGrabbed, kClipboardClipboard);
sendClipboardEvent(EventTypes::ClipboardGrabbed, kClipboardSelection);
}
} else if (!m_ownClipboard) {
LOG((CLOG_DEBUG "clipboard changed: %s owned", kAppId));
LOG_DEBUG("clipboard changed: %s owned", kAppId);
m_ownClipboard = true;
}
}
@ -1378,8 +1373,8 @@ void MSWindowsScreen::warpCursorNoFlush(int32_t x, int32_t y)
// since this feature is mainly for client, so only check on client.
if (!isPrimary()) {
if ((cursorPos.x != x) && (cursorPos.y != y)) {
LOG((CLOG_DEBUG "function 'SetCursorPos' failed; trying 'fakeMouseMove'"));
LOG((CLOG_DEBUG "cursor pos %d, %d expected pos %d, %d", cursorPos.x, cursorPos.y, x, y));
LOG_DEBUG("function 'SetCursorPos' failed; trying 'fakeMouseMove'");
LOG_DEBUG("cursor pos %d, %d expected pos %d, %d", cursorPos.x, cursorPos.y, x, y);
// when at Vista/7 login screen, SetCursorPos does not work (which could
// be an MS security feature). instead we can use fakeMouseMove, which
// calls mouse_event. IMPORTANT: as of implementing this function, it has

View File

@ -71,7 +71,7 @@ bool MSWindowsScreenSaver::checkStarted(UINT msg, WPARAM wParam, LPARAM lParam)
// we first check that the screen saver is indeed active
// before watching for it to stop.
if (!isActive()) {
LOG((CLOG_DEBUG2 "can't open screen saver desktop"));
LOG_DEBUG2("can't open screen saver desktop");
return false;
}
@ -171,7 +171,7 @@ void MSWindowsScreenSaver::watchDesktop()
unwatchProcess();
// watch desktop in another thread
LOG((CLOG_DEBUG "watching screen saver desktop"));
LOG_DEBUG("watching screen saver desktop");
m_active = true;
m_watch = new Thread(new TMethodJob<MSWindowsScreenSaver>(this, &MSWindowsScreenSaver::watchDesktopThread));
}
@ -183,7 +183,7 @@ void MSWindowsScreenSaver::watchProcess(HANDLE process)
// watch new process in another thread
if (process != nullptr) {
LOG((CLOG_DEBUG "watching screen saver process"));
LOG_DEBUG("watching screen saver process");
m_process = process;
m_active = true;
m_watch = new Thread(new TMethodJob<MSWindowsScreenSaver>(this, &MSWindowsScreenSaver::watchProcessThread));
@ -193,7 +193,7 @@ void MSWindowsScreenSaver::watchProcess(HANDLE process)
void MSWindowsScreenSaver::unwatchProcess()
{
if (m_watch != nullptr) {
LOG((CLOG_DEBUG "stopped watching screen saver process/desktop"));
LOG_DEBUG("stopped watching screen saver process/desktop");
m_watch->cancel();
m_watch->wait();
delete m_watch;
@ -234,7 +234,7 @@ void MSWindowsScreenSaver::watchProcessThread(void *)
Thread::testCancel();
if (WaitForSingleObject(m_process, 50) == WAIT_OBJECT_0) {
// process terminated
LOG((CLOG_DEBUG "screen saver died"));
LOG_DEBUG("screen saver died");
// send screen saver deactivation message
m_active = false;

View File

@ -21,7 +21,7 @@ bool MSWindowsSession::isProcessInSession(const char *name, PHANDLE process = nu
// first we need to take a snapshot of the running processes
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (snapshot == INVALID_HANDLE_VALUE) {
LOG((CLOG_ERR "could not get process snapshot"));
LOG_ERR("could not get process snapshot");
throw std::runtime_error(windowsErrorToString(GetLastError()));
}
@ -32,7 +32,7 @@ bool MSWindowsSession::isProcessInSession(const char *name, PHANDLE process = nu
// unlikely we can go any further
BOOL gotEntry = Process32First(snapshot, &entry);
if (!gotEntry) {
LOG((CLOG_ERR "could not get first process entry"));
LOG_ERR("could not get first process entry");
throw std::runtime_error(windowsErrorToString(GetLastError()));
}
@ -52,9 +52,8 @@ bool MSWindowsSession::isProcessInSession(const char *name, PHANDLE process = nu
if (!pidToSidRet) {
// if we can not acquire session associated with a specified process,
// simply ignore it
LOG(
(CLOG_DEBUG2 "could not get session id for process: %i %s, code=%i", entry.th32ProcessID, entry.szExeFile,
GetLastError())
LOG_DEBUG2(
"could not get session id for process: %i %s, code=%i", entry.th32ProcessID, entry.szExeFile, GetLastError()
);
gotEntry = nextProcessEntry(snapshot, &entry);
continue;
@ -82,19 +81,19 @@ bool MSWindowsSession::isProcessInSession(const char *name, PHANDLE process = nu
nameListJoin.append(", ");
}
LOG((CLOG_DEBUG2 "processes in session %d: %s", m_activeSessionId, nameListJoin.c_str()));
LOG_DEBUG2("processes in session %d: %s", m_activeSessionId, nameListJoin.c_str());
CloseHandle(snapshot);
if (pid) {
if (process != nullptr) {
// now get the process, which we'll use to get the process token.
LOG((CLOG_DEBUG "found %s in session %i", name, m_activeSessionId));
LOG_DEBUG("found %s in session %i", name, m_activeSessionId);
*process = OpenProcess(MAXIMUM_ALLOWED, FALSE, pid);
}
return true;
} else {
LOG((CLOG_DEBUG "did not find %s in session %i", name, m_activeSessionId));
LOG_DEBUG("did not find %s in session %i", name, m_activeSessionId);
return false;
}
}
@ -104,7 +103,7 @@ MSWindowsSession::getUserToken(LPSECURITY_ATTRIBUTES security)
{
HANDLE sourceToken;
if (!WTSQueryUserToken(m_activeSessionId, &sourceToken)) {
LOG((CLOG_ERR "could not get token from session %d", m_activeSessionId));
LOG_ERR("could not get token from session %d", m_activeSessionId);
throw std::runtime_error(windowsErrorToString(GetLastError()));
}
@ -113,11 +112,11 @@ MSWindowsSession::getUserToken(LPSECURITY_ATTRIBUTES security)
sourceToken, TOKEN_ASSIGN_PRIMARY | TOKEN_ALL_ACCESS, security, SecurityImpersonation, TokenPrimary, &newToken
)) {
LOG((CLOG_ERR "could not duplicate token"));
LOG_ERR("could not duplicate token");
throw std::runtime_error(windowsErrorToString(GetLastError()));
}
LOG((CLOG_DEBUG "duplicated, new token: %i", newToken));
LOG_DEBUG("duplicated, new token: %i", newToken);
return newToken;
}
@ -147,7 +146,7 @@ BOOL MSWindowsSession::nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry)
// only throw if it's not the end of the snapshot, if not the 'no more
// files' error then it's probably something serious.
if (err != ERROR_NO_MORE_FILES) {
LOG((CLOG_ERR "could not get next process entry"));
LOG_ERR("could not get next process entry");
throw std::runtime_error(windowsErrorToString(GetLastError()));
}
}

View File

@ -30,15 +30,15 @@ OSXClipboard::OSXClipboard() : m_time(0), m_pboard(nullptr)
OSStatus createErr = PasteboardCreate(kPasteboardClipboard, &m_pboard);
if (createErr != noErr) {
LOG((CLOG_WARN "failed to create clipboard reference: error %i", createErr));
LOG((CLOG_ERR "unable to connect to pasteboard, clipboard sharing disabled", createErr));
LOG_WARN("failed to create clipboard reference: error %i", createErr);
LOG_ERR("unable to connect to pasteboard, clipboard sharing disabled", createErr);
m_pboard = nullptr;
return;
}
OSStatus syncErr = PasteboardSynchronize(m_pboard);
if (syncErr != noErr) {
LOG((CLOG_WARN "failed to syncronize clipboard: error %i", syncErr));
LOG_WARN("failed to syncronize clipboard: error %i", syncErr);
}
}
@ -49,13 +49,13 @@ OSXClipboard::~OSXClipboard()
bool OSXClipboard::empty()
{
LOG((CLOG_DEBUG "emptying clipboard"));
LOG_DEBUG("emptying clipboard");
if (m_pboard == nullptr)
return false;
OSStatus err = PasteboardClear(m_pboard);
if (err != noErr) {
LOG((CLOG_WARN "failed to clear clipboard: error %i", err));
LOG_WARN("failed to clear clipboard: error %i", err);
return false;
}
@ -68,7 +68,7 @@ bool OSXClipboard::synchronize()
return false;
PasteboardSyncFlags flags = PasteboardSynchronize(m_pboard);
LOG((CLOG_DEBUG2 "flags: %x", flags));
LOG_DEBUG2("flags: %x", flags);
if (flags & kPasteboardModified) {
return true;
@ -81,13 +81,13 @@ void OSXClipboard::add(Format format, const std::string &data)
if (m_pboard == nullptr)
return;
LOG((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
LOG_DEBUG("add %d bytes to clipboard format: %d", data.size(), format);
if (format == IClipboard::Format::Text) {
LOG((CLOG_DEBUG "format of data to be added to clipboard was kText"));
LOG_DEBUG("format of data to be added to clipboard was kText");
} else if (format == IClipboard::Format::Bitmap) {
LOG((CLOG_DEBUG "format of data to be added to clipboard was kBitmap"));
LOG_DEBUG("format of data to be added to clipboard was kBitmap");
} else if (format == IClipboard::Format::HTML) {
LOG((CLOG_DEBUG "format of data to be added to clipboard was kHTML"));
LOG_DEBUG("format of data to be added to clipboard was kHTML");
}
for (ConverterList::const_iterator index = m_converters.begin(); index != m_converters.end(); ++index) {
@ -105,7 +105,7 @@ void OSXClipboard::add(Format format, const std::string &data)
PasteboardPutItemFlavor(m_pboard, itemID, flavorType, dataRef, kPasteboardFlavorNoFlags);
CFRelease(dataRef);
LOG((CLOG_DEBUG "added %d bytes to clipboard format: %d", data.size(), format));
LOG_DEBUG("added %d bytes to clipboard format: %d", data.size(), format);
}
}
}
@ -116,14 +116,14 @@ bool OSXClipboard::open(Time time) const
if (m_pboard == nullptr)
return false;
LOG((CLOG_DEBUG "opening clipboard"));
LOG_DEBUG("opening clipboard");
m_time = time;
return true;
}
void OSXClipboard::close() const
{
LOG((CLOG_DEBUG "closing clipboard"));
LOG_DEBUG("closing clipboard");
/* not needed */
}
@ -184,7 +184,7 @@ std::string OSXClipboard::get(Format format) const
// if no converter then we don't recognize any formats
if (converter == nullptr) {
LOG((CLOG_DEBUG "unable to find converter for data"));
LOG_DEBUG("unable to find converter for data");
return result;
}
@ -199,9 +199,9 @@ std::string OSXClipboard::get(Format format) const
result = std::string((char *)CFDataGetBytePtr(buffer), CFDataGetLength(buffer));
} catch (OSStatus err) {
LOG((CLOG_DEBUG "exception thrown in OSXClipboard::get MacError (%d)", err));
LOG_DEBUG("exception thrown in OSXClipboard::get MacError (%d)", err);
} catch (...) {
LOG((CLOG_DEBUG "unknown exception in OSXClipboard::get"));
LOG_DEBUG("unknown exception in OSXClipboard::get");
RETHROW_XTHREAD
}

View File

@ -61,7 +61,7 @@ CFStringRef OSXClipboardBMPConverter::getOSXFormat() const
std::string OSXClipboardBMPConverter::fromIClipboard(const std::string &bmp) const
{
LOG((CLOG_DEBUG1 "getting data from clipboard"));
LOG_DEBUG1("getting data from clipboard");
// create BMP image
uint8_t header[14];
uint8_t *dst = header;

View File

@ -154,12 +154,12 @@ io_connect_t getEventDriver()
if (!IOServiceGetMatchingServices(masterPort, dict, &iter)) {
sEventDrvrRef = getService(iter);
} else {
LOG((CLOG_WARN, "io service not found"));
LOG_WARN("io service not found");
}
IOObjectRelease(iter);
} else {
LOG((CLOG_WARN, "couldn't get io master port"));
LOG_WARN("couldn't get io master port");
}
}
@ -231,7 +231,7 @@ KeyModifierMask OSXKeyState::mapModifiersFromOSX(uint32_t mask) const
outMask |= KeyModifierNumLock;
}
LOG((CLOG_DEBUG1 "mask=%04x outMask=%04x", mask, outMask));
LOG_DEBUG1("mask=%04x outMask=%04x", mask, outMask);
return outMask;
}
@ -333,7 +333,7 @@ KeyButton OSXKeyState::mapKeyFromEvent(KeyIDs &ids, KeyModifierMask *maskOut, CG
// translate key
UniCharCount count;
UniChar chars[2];
LOG((CLOG_DEBUG2 "modifiers: %08x", modifiers & 0xffu));
LOG_DEBUG2("modifiers: %08x", modifiers & 0xffu);
OSStatus status = UCKeyTranslate(
layout, vkCode & 0xffu, action, (modifiers >> 8) & 0xffu, LMGetKbdType(), 0, &m_deadKeyState,
sizeof(chars) / sizeof(chars[0]), &count, chars
@ -421,7 +421,7 @@ KeyModifierMask OSXKeyState::pollActiveModifiers() const
outMask |= KeyModifierNumLock;
}
LOG((CLOG_DEBUG1 "mask=%04x outMask=%04x", mask, outMask));
LOG_DEBUG1("mask=%04x outMask=%04x", mask, outMask);
return outMask;
}
@ -435,7 +435,7 @@ int32_t OSXKeyState::pollActiveGroup() const
return i->second;
}
LOG((CLOG_WARN "can't get the active group, use the first group instead"));
LOG_WARN("can't get the active group, use the first group instead");
return 0;
}
@ -488,13 +488,13 @@ void OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap)
if (layoutValid) {
OSXUchrKeyResource uchr(resource, keyboardType);
if (uchr.isValid()) {
LOG((CLOG_DEBUG1 "using uchr resource for group %d", g));
LOG_DEBUG1("using uchr resource for group %d", g);
getKeyMap(keyMap, g, uchr);
continue;
}
}
LOG((CLOG_DEBUG1 "no keyboard resource for group %d", g));
LOG_DEBUG1("no keyboard resource for group %d", g);
}
}
@ -553,7 +553,7 @@ void OSXKeyState::setKeyboardModifiers(CGKeyCode virtualKey, bool keyDown)
m_capsPressed = keyDown;
break;
default:
LOG((CLOG_DEBUG1 "the key is not a modifier"));
LOG_DEBUG1("the key is not a modifier");
break;
}
}
@ -587,7 +587,7 @@ void OSXKeyState::postKeyboardKey(CGKeyCode virtualKey, bool keyDown)
CGEventPost(kCGHIDEventTap, event);
CFRelease(event);
} else {
LOG((CLOG_CRIT "unable to create keyboard event for keystroke"));
LOG_CRIT("unable to create keyboard event for keystroke");
}
}
@ -600,14 +600,14 @@ void OSXKeyState::fakeKey(const Keystroke &keystroke)
KeyButton button = keystroke.m_data.m_button.m_button;
CGKeyCode virtualKey = mapKeyButtonToVirtualKey(button);
LOG(
(CLOG_DEBUG1 " button=0x%04x virtualKey=0x%04x keyDown=%s client=0x%04x", button, virtualKey,
keyDown ? "down" : "up", client)
LOG_DEBUG1(
" button=0x%04x virtualKey=0x%04x keyDown=%s client=0x%04x", button, virtualKey, keyDown ? "down" : "up",
client
);
setKeyboardModifiers(virtualKey, keyDown);
if (postHIDVirtualKey(virtualKey, keyDown) != KERN_SUCCESS) {
LOG((CLOG_WARN, "fail to post hid event"));
LOG_WARN("fail to post hid event");
postKeyboardKey(virtualKey, keyDown);
}
@ -618,15 +618,15 @@ void OSXKeyState::fakeKey(const Keystroke &keystroke)
int32_t group = keystroke.m_data.m_group.m_group;
if (!keystroke.m_data.m_group.m_restore) {
if (keystroke.m_data.m_group.m_absolute) {
LOG((CLOG_DEBUG1 " group %d", group));
LOG_DEBUG1(" group %d", group);
setGroup(group);
} else {
LOG((CLOG_DEBUG1 " group %+d", group));
LOG_DEBUG1(" group %+d", group);
setGroup(getEffectiveGroup(pollActiveGroup(), group));
}
if (pollActiveGroup() != group) {
LOG((CLOG_WARN "failed to set new keyboard layout"));
LOG_WARN("failed to set new keyboard layout");
}
}
break;
@ -856,7 +856,7 @@ bool OSXKeyState::getGroups(AutoCFArray &groups) const
if (CFArrayGetCount(kbds.get()) > 0) {
groups = std::move(kbds);
} else {
LOG((CLOG_DEBUG1 "can't get keyboard layouts"));
LOG_DEBUG1("can't get keyboard layouts");
return false;
}
@ -867,21 +867,21 @@ void OSXKeyState::setGroup(int32_t group)
{
TISInputSourceRef keyboardLayout = (TISInputSourceRef)CFArrayGetValueAtIndex(m_groups.get(), group);
if (!keyboardLayout) {
LOG((CLOG_WARN "nedeed keyboard layout is null"));
LOG_WARN("nedeed keyboard layout is null");
return;
}
auto canBeSetted = (CFBooleanRef
)TISGetInputSourceProperty(TISCopyCurrentKeyboardInputSource(), kTISPropertyInputSourceIsEnableCapable);
if (!canBeSetted) {
LOG((CLOG_WARN "nedeed keyboard layout is disabled for programmatically selection"));
LOG_WARN("nedeed keyboard layout is disabled for programmatically selection");
return;
}
if (TISSelectInputSource(keyboardLayout) != noErr) {
LOG((CLOG_WARN "failed to set nedeed keyboard layout"));
LOG_WARN("failed to set nedeed keyboard layout");
}
LOG((CLOG_DEBUG1 "keyboard layout change to %d", group));
LOG_DEBUG1("keyboard layout change to %d", group);
// A minimal delay is needed after a group change because the
// keyboard key event often happens immediately after.

View File

@ -22,7 +22,7 @@ void OSXPowerManager::disableSleep()
);
if (result != kIOReturnSuccess) {
m_sleepPreventionAssertionID = 0;
LOG((CLOG_ERR "failed to disable system idle sleep"));
LOG_ERR("failed to disable system idle sleep");
}
}
}

View File

@ -150,7 +150,7 @@ OSXScreen::OSXScreen(
*m_pmThreadReady = false;
m_carbonLoopMutex = new Mutex();
m_carbonLoopReady = new CondVar<bool>(m_carbonLoopMutex, false);
LOG((CLOG_DEBUG "starting watchSystemPowerThread"));
LOG_DEBUG("starting watchSystemPowerThread");
m_pmWatchThread = new Thread(new TMethodJob<OSXScreen>(this, &OSXScreen::watchSystemPowerThread));
} catch (...) {
m_events->removeHandler(EventTypes::OsxScreenConfirmSleep, getEventTarget());
@ -191,7 +191,7 @@ OSXScreen::~OSXScreen()
}
// now exit the thread's runloop and wait for it to exit
LOG((CLOG_DEBUG "stopping watchSystemPowerThread"));
LOG_DEBUG("stopping watchSystemPowerThread");
CFRunLoopStop(m_pmRunloop);
m_pmWatchThread->wait();
delete m_pmWatchThread;
@ -306,7 +306,7 @@ uint32_t OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask)
// get mac virtual key and modifier mask matching deskflow key and mask
uint32_t macKey, macMask;
if (!m_keyState->mapDeskflowHotKeyToMac(key, mask, macKey, macMask)) {
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
LOG_DEBUG("could not map hotkey id=%04x mask=%04x", key, mask);
return 0;
}
@ -340,18 +340,16 @@ uint32_t OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask)
if (!okay) {
m_oldHotKeyIDs.push_back(id);
m_hotKeyToIDMap.erase(HotKeyItem(macKey, macMask));
LOG(
(CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", deskflow::KeyMap::formatKey(key, mask).c_str(),
key, mask)
LOG_WARN(
"failed to register hotkey %s (id=%04x mask=%04x)", deskflow::KeyMap::formatKey(key, mask).c_str(), key, mask
);
return 0;
}
m_hotKeys.insert(std::make_pair(id, HotKeyItem(ref, macKey, macMask)));
LOG(
(CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", deskflow::KeyMap::formatKey(key, mask).c_str(),
key, mask, id)
LOG_DEBUG(
"registered hotkey %s (id=%04x mask=%04x) as id=%d", deskflow::KeyMap::formatKey(key, mask).c_str(), key, mask, id
);
return id;
}
@ -380,9 +378,9 @@ void OSXScreen::unregisterHotKey(uint32_t id)
}
}
if (!okay) {
LOG((CLOG_WARN "failed to unregister hotkey id=%d", id));
LOG_WARN("failed to unregister hotkey id=%d", id);
} else {
LOG((CLOG_DEBUG "unregistered hotkey id=%d", id));
LOG_DEBUG("unregistered hotkey id=%d", id);
}
// discard hot key from map and record old id for reuse
@ -529,7 +527,7 @@ void OSXScreen::fakeMouseButton(ButtonID id, bool press)
EMouseButtonState state = press ? kMouseButtonDown : kMouseButtonUp;
LOG((CLOG_DEBUG1 "faking mouse button id: %d press: %s", index, press ? "pressed" : "released"));
LOG_DEBUG1("faking mouse button id: %d press: %s", index, press ? "pressed" : "released");
MouseButtonEventMapType thisButtonMap = MouseButtonEventMap[index];
CGEventType type = thisButtonMap[state];
@ -606,7 +604,7 @@ void OSXScreen::fakeMouseWheel(int32_t xDelta, int32_t yDelta) const
void OSXScreen::showCursor()
{
LOG((CLOG_DEBUG "showing cursor"));
LOG_DEBUG("showing cursor");
CFStringRef propertyString = CFStringCreateWithCString(nullptr, "SetsCursorInBackground", kCFStringEncodingMacRoman);
@ -616,7 +614,7 @@ void OSXScreen::showCursor()
CGError error = CGDisplayShowCursor(m_displayID);
if (error != kCGErrorSuccess) {
LOG((CLOG_ERR "failed to show cursor, error=%d", error));
LOG_ERR("failed to show cursor, error=%d", error);
}
// appears to fix "mouse randomly not showing" bug
@ -629,7 +627,7 @@ void OSXScreen::showCursor()
void OSXScreen::hideCursor()
{
LOG((CLOG_DEBUG "hiding cursor"));
LOG_DEBUG("hiding cursor");
CFStringRef propertyString = CFStringCreateWithCString(nullptr, "SetsCursorInBackground", kCFStringEncodingMacRoman);
@ -639,7 +637,7 @@ void OSXScreen::hideCursor()
CGError error = CGDisplayHideCursor(m_displayID);
if (error != kCGErrorSuccess) {
LOG((CLOG_ERR "failed to hide cursor, error=%d", error));
LOG_ERR("failed to hide cursor, error=%d", error);
}
// appears to fix "mouse randomly not hiding" bug
@ -686,10 +684,10 @@ void OSXScreen::enable()
if (m_eventTapRLSR) {
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_eventTapRLSR, kCFRunLoopDefaultMode);
} else {
LOG((CLOG_ERR "failed to create a CFRunLoopSourceRef for the quartz event tap"));
LOG_ERR("failed to create a CFRunLoopSourceRef for the quartz event tap");
}
} else {
LOG((CLOG_ERR "failed to create quartz event tap"));
LOG_ERR("failed to create quartz event tap");
}
}
@ -766,7 +764,7 @@ void OSXScreen::leave()
bool OSXScreen::setClipboard(ClipboardID, const IClipboard *src)
{
if (src != nullptr) {
LOG((CLOG_DEBUG "setting clipboard"));
LOG_DEBUG("setting clipboard");
Clipboard::copy(&m_pasteboard, src);
}
return true;
@ -774,9 +772,9 @@ bool OSXScreen::setClipboard(ClipboardID, const IClipboard *src)
void OSXScreen::checkClipboards()
{
LOG((CLOG_DEBUG2 "checking clipboard"));
LOG_DEBUG2("checking clipboard");
if (m_pasteboard.synchronize()) {
LOG((CLOG_DEBUG "clipboard changed"));
LOG_DEBUG("clipboard changed");
sendClipboardEvent(EventTypes::ClipboardGrabbed, kClipboardClipboard);
sendClipboardEvent(EventTypes::ClipboardGrabbed, kClipboardSelection);
}
@ -892,19 +890,19 @@ void OSXScreen::handleSystemEvent(const Event &event)
SendEventToEventTarget(*carbonEvent, nullptr);
switch (GetEventKind(*carbonEvent)) {
case kEventWindowActivated:
LOG((CLOG_DEBUG1 "window activated"));
LOG_DEBUG1("window activated");
break;
case kEventWindowDeactivated:
LOG((CLOG_DEBUG1 "window deactivated"));
LOG_DEBUG1("window deactivated");
break;
case kEventWindowFocusAcquired:
LOG((CLOG_DEBUG1 "focus acquired"));
LOG_DEBUG1("focus acquired");
break;
case kEventWindowFocusRelinquish:
LOG((CLOG_DEBUG1 "focus released"));
LOG_DEBUG1("focus released");
break;
}
break;
@ -917,7 +915,7 @@ void OSXScreen::handleSystemEvent(const Event &event)
bool OSXScreen::onMouseMove(CGFloat mx, CGFloat my)
{
LOG((CLOG_DEBUG2 "mouse move %+f,%+f", mx, my));
LOG_DEBUG2("mouse move %+f,%+f", mx, my);
CGFloat x = mx - m_xCursor;
CGFloat y = my - m_yCursor;
@ -946,7 +944,7 @@ bool OSXScreen::onMouseMove(CGFloat mx, CGFloat my)
static int32_t bogusZoneSize = 10;
if (-x + bogusZoneSize > m_xCenter - m_x || x + bogusZoneSize > m_x + m_w - m_xCenter ||
-y + bogusZoneSize > m_yCenter - m_y || y + bogusZoneSize > m_y + m_h - m_yCenter) {
LOG((CLOG_DEBUG "dropped bogus motion %+d,%+d", x, y));
LOG_DEBUG("dropped bogus motion %+d,%+d", x, y);
} else {
// send motion
// Accumulate together the move into the running total
@ -976,13 +974,13 @@ bool OSXScreen::onMouseButton(bool pressed, uint16_t macButton)
ButtonID button = mapMacButtonToDeskflow(macButton);
if (pressed) {
LOG((CLOG_DEBUG1 "event: button press button=%d", button));
LOG_DEBUG1("event: button press button=%d", button);
if (button != kButtonNone) {
KeyModifierMask mask = m_keyState->getActiveModifiers();
sendEvent(EventTypes::PrimaryScreenButtonDown, ButtonInfo::alloc(button, mask));
}
} else {
LOG((CLOG_DEBUG1 "event: button release button=%d", button));
LOG_DEBUG1("event: button release button=%d", button);
if (button != kButtonNone) {
KeyModifierMask mask = m_keyState->getActiveModifiers();
sendEvent(EventTypes::PrimaryScreenButtonUp, ButtonInfo::alloc(button, mask));
@ -994,7 +992,7 @@ bool OSXScreen::onMouseButton(bool pressed, uint16_t macButton)
bool OSXScreen::onMouseWheel(int32_t xDelta, int32_t yDelta) const
{
LOG((CLOG_DEBUG1 "event: button wheel delta=%+d,%+d", xDelta, yDelta));
LOG_DEBUG1("event: button wheel delta=%+d,%+d", xDelta, yDelta);
sendEvent(EventTypes::PrimaryScreenWheel, WheelInfo::alloc(xDelta, yDelta));
return true;
}
@ -1012,12 +1010,12 @@ void OSXScreen::displayReconfigurationCallback(
kCGDisplayDisabledFlag | kCGDisplayMirrorFlag | kCGDisplayUnMirrorFlag |
kCGDisplayDesktopShapeChangedFlag;
LOG((CLOG_DEBUG1 "event: display was reconfigured: %x %x %x", flags, mask, flags & mask));
LOG_DEBUG1("event: display was reconfigured: %x %x %x", flags, mask, flags & mask);
if (flags & mask) { /* Something actually did change */
LOG((CLOG_DEBUG1 "event: screen changed shape; refreshing dimensions"));
LOG_DEBUG1("event: screen changed shape; refreshing dimensions");
if (!screen->updateScreenShape(displayID, flags)) {
LOG((CLOG_ERR "failed to update screen shape during display reconfiguration"));
LOG_ERR("failed to update screen shape during display reconfiguration");
}
}
}
@ -1029,7 +1027,7 @@ bool OSXScreen::onKey(CGEventRef event)
// get the key and active modifiers
uint32_t virtualKey = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode);
CGEventFlags macMask = CGEventGetFlags(event);
LOG((CLOG_DEBUG1 "event: Key event kind: %d, keycode=%d", eventKind, virtualKey));
LOG_DEBUG1("event: Key event kind: %d, keycode=%d", eventKind, virtualKey);
// Special handling to track state of modifiers
if (eventKind == kCGEventFlagsChanged) {
@ -1135,14 +1133,11 @@ void OSXScreen::onMediaKey(CGEventRef event)
bool isRepeat;
if (!getMediaKeyEventInfo(event, &keyID, &down, &isRepeat)) {
LOG((CLOG_ERR "Failed to decode media key event"));
LOG_ERR("Failed to decode media key event");
return;
}
LOG(
(CLOG_DEBUG2 "Media key event: keyID=0x%02x, %s, repeat=%s", keyID, (down ? "down" : "up"),
(isRepeat ? "yes" : "no"))
);
LOG_DEBUG2("Media key event: keyID=0x%02x, %s, repeat=%s", keyID, (down ? "down" : "up"), (isRepeat ? "yes" : "no"));
KeyButton button = 0;
KeyModifierMask mask = m_keyState->getActiveModifiers();
@ -1304,9 +1299,9 @@ bool OSXScreen::updateScreenShape()
// We want to notify the peer screen whether we are primary screen or not
sendEvent(EventTypes::ScreenShapeChanged);
LOG(
(CLOG_DEBUG "screen shape: center=%d,%d size=%dx%d on %u %s", m_x, m_y, m_w, m_h, displayCount,
(displayCount == 1) ? "display" : "displays")
LOG_DEBUG(
"screen shape: center=%d,%d size=%dx%d on %u %s", m_x, m_y, m_w, m_h, displayCount,
(displayCount == 1) ? "display" : "displays"
);
return true;
@ -1329,10 +1324,10 @@ pascal OSStatus OSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, E
IEventQueue *events = screen->getEvents();
if (kind == kEventSystemUserSessionDeactivated) {
LOG((CLOG_DEBUG "user session deactivated"));
LOG_DEBUG("user session deactivated");
events->addEvent(Event(EventTypes::ScreenSuspend, screen->getEventTarget()));
} else if (kind == kEventSystemUserSessionActivated) {
LOG((CLOG_DEBUG "user session activated"));
LOG_DEBUG("user session activated");
events->addEvent(Event(EventTypes::ScreenResume, screen->getEventTarget()));
}
return (CallNextEventHandler(nextHandler, theEvent));
@ -1358,7 +1353,7 @@ void OSXScreen::watchSystemPowerThread(void *)
// install system power change callback
m_pmRootPort = IORegisterForSystemPower(this, &notificationPortRef, powerChangeCallback, &notifier);
if (m_pmRootPort == 0) {
LOG((CLOG_WARN "IORegisterForSystemPower failed"));
LOG_WARN("IORegisterForSystemPower failed");
} else {
runloopSourceRef = IONotificationPortGetRunLoopSource(notificationPortRef);
CFRunLoopAddSource(m_pmRunloop, runloopSourceRef, kCFRunLoopCommonModes);
@ -1375,13 +1370,13 @@ void OSXScreen::watchSystemPowerThread(void *)
// setting m_pmThreadReady to true otherwise the parent thread will
// block waiting for it.
if (m_pmRootPort == 0) {
LOG((CLOG_WARN "failed to init watchSystemPowerThread"));
LOG_WARN("failed to init watchSystemPowerThread");
return;
}
LOG((CLOG_DEBUG "started watchSystemPowerThread"));
LOG_DEBUG("started watchSystemPowerThread");
LOG((CLOG_DEBUG "waiting for event loop"));
LOG_DEBUG("waiting for event loop");
m_events->waitForReady();
{
@ -1390,7 +1385,7 @@ void OSXScreen::watchSystemPowerThread(void *)
// we signalling carbon loop ready before starting
// unless we know how to do it within the loop
LOG((CLOG_DEBUG "signalling carbon loop ready"));
LOG_DEBUG("signalling carbon loop ready");
*m_carbonLoopReady = true;
m_carbonLoopReady->signal();
@ -1398,9 +1393,9 @@ void OSXScreen::watchSystemPowerThread(void *)
}
// start the run loop
LOG((CLOG_DEBUG "starting carbon loop"));
LOG_DEBUG("starting carbon loop");
CFRunLoopRun();
LOG((CLOG_DEBUG "carbon loop has stopped"));
LOG_DEBUG("carbon loop has stopped");
// cleanup
if (notificationPortRef) {
@ -1412,7 +1407,7 @@ void OSXScreen::watchSystemPowerThread(void *)
Lock lock(m_pmMutex);
IODeregisterForSystemPower(&notifier);
m_pmRootPort = 0;
LOG((CLOG_DEBUG "stopped watchSystemPowerThread"));
LOG_DEBUG("stopped watchSystemPowerThread");
}
void OSXScreen::powerChangeCallback(void *refcon, io_service_t service, natural_t messageType, void *messageArg)
@ -1434,7 +1429,7 @@ void OSXScreen::handlePowerChangeRequest(natural_t messageType, void *messageArg
return;
case kIOMessageSystemHasPoweredOn:
LOG((CLOG_DEBUG "system wakeup"));
LOG_DEBUG("system wakeup");
m_events->addEvent(Event(EventTypes::ScreenResume, getEventTarget()));
break;
@ -1459,7 +1454,7 @@ void OSXScreen::handleConfirmSleep(const Event &event)
Event(EventTypes::ScreenSuspend, getEventTarget(), nullptr, Event::EventFlags::DeliverImmediately)
);
LOG((CLOG_DEBUG "system will sleep"));
LOG_DEBUG("system will sleep");
IOAllowPowerChange(m_pmRootPort, messageArg);
}
}
@ -1607,7 +1602,7 @@ OSXScreen::handleCGInputEventSecondary(CGEventTapProxy proxy, CGEventType type,
CGPoint pos = CGEventGetLocation(event);
if (pos.x != screen->m_xCenter || pos.y != screen->m_yCenter) {
LOG((CLOG_DEBUG "show cursor on secondary, type=%d pos=%d,%d", type, pos.x, pos.y));
LOG_DEBUG("show cursor on secondary, type=%d pos=%d,%d", type, pos.x, pos.y);
screen->showCursor();
}
}
@ -1658,26 +1653,26 @@ CGEventRef OSXScreen::handleCGInputEvent(CGEventTapProxy proxy, CGEventType type
case kCGEventTapDisabledByTimeout:
// Re-enable our event-tap
CGEventTapEnable(screen->m_eventTapPort, true);
LOG((CLOG_INFO "quartz event tap was disabled by timeout, re-enabling"));
LOG_INFO("quartz event tap was disabled by timeout, re-enabling");
break;
case kCGEventTapDisabledByUserInput:
LOG((CLOG_ERR "quartz event tap was disabled by user input"));
LOG_ERR("quartz event tap was disabled by user input");
break;
case NX_NULLEVENT:
break;
default:
if (type == NX_SYSDEFINED) {
if (isMediaKeyEvent(event)) {
LOG((CLOG_DEBUG2 "detected media key event"));
LOG_DEBUG2("detected media key event");
screen->onMediaKey(event);
} else {
LOG((CLOG_DEBUG2 "ignoring unknown system defined event"));
LOG_DEBUG2("ignoring unknown system defined event");
return event;
}
break;
}
LOG((CLOG_DEBUG3 "unknown quartz event type: 0x%02x", type));
LOG_DEBUG3("unknown quartz event type: 0x%02x", type);
}
if (screen->m_isOnScreen) {
@ -1746,23 +1741,23 @@ char *OSXScreen::CFStringRefToUTF8String(CFStringRef aString)
void OSXScreen::waitForCarbonLoop() const
{
if (*m_carbonLoopReady) {
LOG((CLOG_DEBUG "carbon loop already ready"));
LOG_DEBUG("carbon loop already ready");
return;
}
Lock lock(m_carbonLoopMutex);
LOG((CLOG_DEBUG "waiting for carbon loop"));
LOG_DEBUG("waiting for carbon loop");
double timeout = Arch::time() + kCarbonLoopWaitTimeout;
while (!m_carbonLoopReady->wait()) {
if (Arch::time() > timeout) {
LOG((CLOG_DEBUG "carbon loop not ready, waiting again"));
LOG_DEBUG("carbon loop not ready, waiting again");
timeout = Arch::time() + kCarbonLoopWaitTimeout;
}
}
LOG((CLOG_DEBUG "carbon loop ready"));
LOG_DEBUG("carbon loop ready");
}
std::string OSXScreen::getSecureInputApp() const
@ -1865,7 +1860,7 @@ void logCursorVisibility()
{
// CGCursorIsVisible is probably deprecated because its unreliable.
if (!CGCursorIsVisible()) {
LOG((CLOG_WARN "cursor may not be visible"));
LOG_WARN("cursor may not be visible");
}
}

View File

@ -90,7 +90,7 @@ void OSXScreenSaver::processLaunched(ProcessSerialNumber psn)
{
if (isScreenSaverEngine(psn)) {
m_screenSaverPSN = psn;
LOG((CLOG_DEBUG1 "screen saver engine launched, enabled=%d", m_enabled));
LOG_DEBUG1("screen saver engine launched, enabled=%d", m_enabled);
if (m_enabled) {
m_events->addEvent(Event(EventTypes::PrimaryScreenSaverActivated, m_eventTarget));
}
@ -100,7 +100,7 @@ void OSXScreenSaver::processLaunched(ProcessSerialNumber psn)
void OSXScreenSaver::processTerminated(ProcessSerialNumber psn)
{
if (m_screenSaverPSN.highLongOfPSN == psn.highLongOfPSN && m_screenSaverPSN.lowLongOfPSN == psn.lowLongOfPSN) {
LOG((CLOG_DEBUG1 "screen saver engine terminated, enabled=%d", m_enabled));
LOG_DEBUG1("screen saver engine terminated, enabled=%d", m_enabled);
if (m_enabled) {
m_events->addEvent(Event(EventTypes::PrimaryScreenSaverDeactivated, m_eventTarget));
}

View File

@ -83,7 +83,7 @@ XWindowsClipboard::~XWindowsClipboard()
void XWindowsClipboard::lost(Time time)
{
LOG((CLOG_DEBUG "lost clipboard %d ownership at %d", m_id, time));
LOG_DEBUG("lost clipboard %d ownership at %d", m_id, time);
if (m_owner) {
m_owner = false;
m_timeLost = time;
@ -97,10 +97,10 @@ void XWindowsClipboard::addRequest(Window owner, Window requestor, Atom target,
// at the given time.
bool success = false;
if (owner == m_window) {
LOG(
(CLOG_DEBUG1 "request for clipboard %d, target %s by 0x%08x (property=%s)", m_selection,
XWindowsUtil::atomToString(m_display, target).c_str(), requestor,
XWindowsUtil::atomToString(m_display, property).c_str())
LOG_DEBUG1(
"request for clipboard %d, target %s by 0x%08x (property=%s)", m_selection,
XWindowsUtil::atomToString(m_display, target).c_str(), requestor,
XWindowsUtil::atomToString(m_display, property).c_str()
);
if (wasOwnedAtTime(time)) {
if (target == m_atomMultiple && property != None) {
@ -114,13 +114,13 @@ void XWindowsClipboard::addRequest(Window owner, Window requestor, Atom target,
success = true;
}
} else {
LOG((CLOG_DEBUG1 "clipboard not owned at time %d", time));
LOG_DEBUG1("clipboard not owned at time %d", time);
}
}
if (!success) {
// send failure
LOG((CLOG_DEBUG1 "clipboard request was not added"));
LOG_DEBUG1("clipboard request was not added");
insertReply(new Reply(requestor, target, time));
}
@ -156,7 +156,7 @@ bool XWindowsClipboard::addSimpleRequest(Window requestor, Atom target, ::Time t
type = converter->getAtom();
} catch (...) {
// ignore -- cannot convert
LOG((CLOG_WARN "error while converting clipboard data"));
LOG_WARN("error while converting clipboard data");
}
}
}
@ -164,12 +164,12 @@ bool XWindowsClipboard::addSimpleRequest(Window requestor, Atom target, ::Time t
if (type != None) {
// success
LOG((CLOG_DEBUG1 "clipboard request added"));
LOG_DEBUG1("clipboard request added");
insertReply(new Reply(requestor, target, time, property, data, type, format));
return true;
} else {
// failure
LOG((CLOG_DEBUG1 "clipboard request not added"));
LOG_DEBUG1("clipboard request not added");
insertReply(new Reply(requestor, target, time));
return false;
}
@ -182,9 +182,8 @@ bool XWindowsClipboard::processRequest(Window requestor, ::Time /*time*/, Atom p
// unknown requestor window
return false;
}
LOG(
(CLOG_DEBUG1 "received property %s delete from 0x08%x", XWindowsUtil::atomToString(m_display, property).c_str(),
requestor)
LOG_DEBUG1(
"received property %s delete from 0x08%x", XWindowsUtil::atomToString(m_display, property).c_str(), requestor
);
// find the property in the known requests. it should be the
@ -235,12 +234,12 @@ bool XWindowsClipboard::empty()
{
assert(m_open);
LOG((CLOG_DEBUG "empty clipboard %d", m_id));
LOG_DEBUG("empty clipboard %d", m_id);
// assert ownership of clipboard
XSetSelectionOwner(m_display, m_selection, m_window, m_time);
if (XGetSelectionOwner(m_display, m_selection) != m_window) {
LOG((CLOG_WARN "failed to grab clipboard %d", m_id));
LOG_WARN("failed to grab clipboard %d", m_id);
return false;
}
@ -258,7 +257,7 @@ bool XWindowsClipboard::empty()
// we're the owner now
m_owner = true;
LOG((CLOG_DEBUG "grabbed clipboard %d", m_id));
LOG_DEBUG("grabbed clipboard %d", m_id);
return true;
}
@ -268,7 +267,7 @@ void XWindowsClipboard::add(Format format, const std::string &data)
assert(m_open);
assert(m_owner);
LOG((CLOG_DEBUG "add %d bytes to clipboard %d format: %d", data.size(), m_id, format));
LOG_DEBUG("add %d bytes to clipboard %d format: %d", data.size(), m_id, format);
const auto formatID = static_cast<int>(format);
m_data[formatID] = data;
@ -280,11 +279,11 @@ void XWindowsClipboard::add(Format format, const std::string &data)
bool XWindowsClipboard::open(Time time) const
{
if (m_open) {
LOG((CLOG_WARN "failed to open clipboard: already opened"));
LOG_WARN("failed to open clipboard: already opened");
return false;
}
LOG((CLOG_DEBUG "open clipboard %d", m_id));
LOG_DEBUG("open clipboard %d", m_id);
// assume not motif
m_motif = false;
@ -298,7 +297,7 @@ bool XWindowsClipboard::open(Time time) const
// check if motif owns the selection. unlock motif clipboard
// if it does not.
m_motif = motifOwnsClipboard();
LOG((CLOG_DEBUG1 "motif does %sown clipboard", m_motif ? "" : "not "));
LOG_DEBUG1("motif does %sown clipboard", m_motif ? "" : "not ");
if (!m_motif) {
motifUnlockClipboard();
}
@ -318,7 +317,7 @@ void XWindowsClipboard::close() const
{
assert(m_open);
LOG((CLOG_DEBUG "close clipboard %d", m_id));
LOG_DEBUG("close clipboard %d", m_id);
// unlock clipboard
if (m_motif) {
@ -369,13 +368,13 @@ IXWindowsClipboardConverter *XWindowsClipboard::getConverter(Atom target, bool o
}
}
if (converter == nullptr) {
LOG((CLOG_DEBUG1 " no converter for target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
LOG_DEBUG1(" no converter for target %s", XWindowsUtil::atomToString(m_display, target).c_str());
return nullptr;
}
// optionally skip already handled targets
if (const auto formatID = static_cast<int>(converter->getFormat()); onlyIfNotAdded && m_added[formatID]) {
LOG((CLOG_DEBUG1 " skipping handled format %d", formatID));
LOG_DEBUG1(" skipping handled format %d", formatID);
return nullptr;
}
@ -446,7 +445,7 @@ void XWindowsClipboard::doFillCache()
void XWindowsClipboard::icccmFillCache()
{
LOG((CLOG_DEBUG "icccm fill clipboard %d", m_id));
LOG_DEBUG("icccm fill clipboard %d", m_id);
// see if we can get the list of available formats from the selection.
// if not then use a default list of formats. note that some clipboard
@ -456,7 +455,7 @@ void XWindowsClipboard::icccmFillCache()
Atom target;
std::string data;
if (!icccmGetSelection(atomTargets, &target, &data) || (target != m_atomAtom && target != m_atomTargets)) {
LOG((CLOG_DEBUG1 "selection doesn't support TARGETS"));
LOG_DEBUG1("selection doesn't support TARGETS");
data = "";
XWindowsUtil::appendAtomData(data, XA_STRING);
}
@ -464,7 +463,7 @@ void XWindowsClipboard::icccmFillCache()
XWindowsUtil::convertAtomProperty(data);
auto targets = static_cast<const Atom *>(static_cast<const void *>(data.data()));
const uint32_t numTargets = data.size() / sizeof(Atom);
LOG((CLOG_DEBUG " available targets: %s", XWindowsUtil::atomsToString(m_display, targets, numTargets).c_str()));
LOG_DEBUG(" available targets: %s", XWindowsUtil::atomsToString(m_display, targets, numTargets).c_str());
// try each converter in order (because they're in order of
// preference).
@ -499,7 +498,7 @@ void XWindowsClipboard::icccmFillCache()
Atom actualTarget;
std::string targetData;
if (!icccmGetSelection(target, &actualTarget, &targetData)) {
LOG((CLOG_DEBUG1 " no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
LOG_DEBUG1(" no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str());
continue;
}
@ -522,12 +521,11 @@ bool XWindowsClipboard::icccmGetSelection(Atom target, Atom *actualTarget, std::
// request data conversion
if (CICCCMGetClipboard getter(m_window, m_time, m_atomData);
!getter.readClipboard(m_display, m_selection, target, actualTarget, data)) {
LOG((CLOG_DEBUG1 "can't get data for selection target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
LOG_DEBUG1("can't get data for selection target %s", XWindowsUtil::atomToString(m_display, target).c_str());
LOGC(getter.error(), (CLOG_WARN "icccm violation by clipboard owner"));
return false;
} else if (*actualTarget == None) {
LOG((CLOG_DEBUG1 "selection conversion failed for target %s", XWindowsUtil::atomToString(m_display, target).c_str())
);
LOG_DEBUG1("selection conversion failed for target %s", XWindowsUtil::atomToString(m_display, target).c_str());
return false;
}
return true;
@ -539,11 +537,11 @@ IClipboard::Time XWindowsClipboard::icccmGetTime() const
std::string data;
if (icccmGetSelection(m_atomTimestamp, &actualTarget, &data) && actualTarget == m_atomInteger) {
Time time = *static_cast<const Time *>(static_cast<const void *>(data.data()));
LOG((CLOG_DEBUG1 "got ICCCM time %d", time));
LOG_DEBUG1("got ICCCM time %d", time);
return time;
} else {
// no timestamp
LOG((CLOG_DEBUG1 "can't get ICCCM time"));
LOG_DEBUG1("can't get ICCCM time");
return 0;
}
}
@ -553,7 +551,7 @@ bool XWindowsClipboard::motifLockClipboard() const
// fail if anybody owns the lock (even us, so this is non-recursive)
Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock);
if (lockOwner != None) {
LOG((CLOG_DEBUG1 "motif lock owner 0x%08x", lockOwner));
LOG_DEBUG1("motif lock owner 0x%08x", lockOwner);
return false;
}
@ -565,17 +563,17 @@ bool XWindowsClipboard::motifLockClipboard() const
XSetSelectionOwner(m_display, m_atomMotifClipLock, m_window, time);
lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock);
if (lockOwner != m_window) {
LOG((CLOG_DEBUG1 "motif lock owner 0x%08x", lockOwner));
LOG_DEBUG1("motif lock owner 0x%08x", lockOwner);
return false;
}
LOG((CLOG_DEBUG1 "locked motif clipboard"));
LOG_DEBUG1("locked motif clipboard");
return true;
}
void XWindowsClipboard::motifUnlockClipboard() const
{
LOG((CLOG_DEBUG1 "unlocked motif clipboard"));
LOG_DEBUG1("unlocked motif clipboard");
// fail if we don't own the lock
if (Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock); lockOwner != m_window) {
@ -621,7 +619,7 @@ bool XWindowsClipboard::motifOwnsClipboard() const
void XWindowsClipboard::motifFillCache()
{
LOG((CLOG_DEBUG "motif fill clipboard %d", m_id));
LOG_DEBUG("motif fill clipboard %d", m_id);
// get the Motif clipboard header property from the root window
Atom target;
@ -717,14 +715,14 @@ void XWindowsClipboard::motifFillCache()
Atom actualTarget;
std::string targetData;
if (!motifGetSelection(&motifFormat, &actualTarget, &targetData)) {
LOG((CLOG_DEBUG1 " no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
LOG_DEBUG1(" no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str());
continue;
}
// add to clipboard and note we've done it
m_data[formatID] = converter->toIClipboard(targetData);
m_added[formatID] = true;
LOG((CLOG_DEBUG "added format %d for target %s", format, XWindowsUtil::atomToString(m_display, target).c_str()));
LOG_DEBUG("added format %d for target %s", format, XWindowsUtil::atomToString(m_display, target).c_str());
}
}
@ -987,8 +985,7 @@ bool XWindowsClipboard::sendReply(Reply *reply)
return false;
}
LOG((CLOG_DEBUG1 "clipboard: sending notify to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property)
);
LOG_DEBUG1("clipboard: sending notify to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property);
reply->m_replied = true;
// nothing to log
@ -1008,13 +1005,13 @@ bool XWindowsClipboard::sendReply(Reply *reply)
XWindowsUtil::ErrorLock lock(m_display);
int n;
Atom *props = XListProperties(m_display, reply->m_requestor, &n);
LOG((CLOG_DEBUG2 "properties of 0x%08x:", reply->m_requestor));
LOG_DEBUG2("properties of 0x%08x:", reply->m_requestor);
for (int i = 0; i < n; ++i) {
Atom target;
std::string data;
char *name = XGetAtomName(m_display, props[i]);
if (!XWindowsUtil::getWindowProperty(m_display, reply->m_requestor, props[i], &data, &target, nullptr, False)) {
LOG((CLOG_DEBUG2 " %s: <can't read property>", name));
LOG_DEBUG2(" %s: <can't read property>", name);
} else {
// convert to hex if contains non ascii symbols
if (std::ranges::find_if(data, [](const unsigned char &c) { return c < 32 || c > 126; }) != data.end()) {
@ -1029,7 +1026,7 @@ bool XWindowsClipboard::sendReply(Reply *reply)
data = tmp;
}
char *type = XGetAtomName(m_display, target);
LOG((CLOG_DEBUG2 " %s (%s): %s", name, type, data.c_str()));
LOG_DEBUG2(" %s (%s): %s", name, type, data.c_str());
if (type != nullptr) {
XFree(type);
}
@ -1246,7 +1243,7 @@ bool XWindowsClipboard::CICCCMGetClipboard::readClipboard(
XSelectInput(display, m_requestor, attr.your_event_mask);
// return success or failure
LOG((CLOG_DEBUG1 "request %s after %fs", m_failed ? "failed" : "succeeded", timeout.getTime()));
LOG_DEBUG1("request %s after %fs", m_failed ? "failed" : "succeeded", timeout.getTime());
return !m_failed;
}
@ -1328,14 +1325,14 @@ bool XWindowsClipboard::CICCCMGetClipboard::processEvent(Display *display, const
else if (m_incr) {
// if first incremental chunk then save target
if (oldSize == 0) {
LOG((CLOG_DEBUG1 " INCR first chunk, target %s", XWindowsUtil::atomToString(display, target).c_str()));
LOG_DEBUG1(" INCR first chunk, target %s", XWindowsUtil::atomToString(display, target).c_str());
*m_actualTarget = target;
}
// secondary chunks must have the same target
else {
if (target != *m_actualTarget) {
LOG((CLOG_WARN " INCR target mismatch"));
LOG_WARN(" INCR target mismatch");
m_failed = true;
m_error = true;
}
@ -1343,14 +1340,14 @@ bool XWindowsClipboard::CICCCMGetClipboard::processEvent(Display *display, const
// note if this is the final chunk
if (m_data->size() == oldSize) {
LOG((CLOG_DEBUG1 " INCR final chunk: %d bytes total", m_data->size()));
LOG_DEBUG1(" INCR final chunk: %d bytes total", m_data->size());
m_done = true;
}
}
// not incremental; save the target.
else {
LOG((CLOG_DEBUG1 " target %s", XWindowsUtil::atomToString(display, target).c_str()));
LOG_DEBUG1(" target %s", XWindowsUtil::atomToString(display, target).c_str());
*m_actualTarget = target;
m_done = true;
}

View File

@ -96,12 +96,12 @@ void XWindowsKeyState::setAutoRepeat(const XKeyboardState &state)
KeyModifierMask XWindowsKeyState::mapModifiersFromX(unsigned int state) const
{
LOG((CLOG_DEBUG2 "mapping state: %i", state));
LOG_DEBUG2("mapping state: %i", state);
uint32_t offset = 8 * getGroupFromState(state);
KeyModifierMask mask = 0;
for (int i = 0; i < 8; ++i) {
if ((state & (1u << i)) != 0) {
LOG((CLOG_DEBUG2 "|= modifier: %i", offset + i));
LOG_DEBUG2("|= modifier: %i", offset + i);
if (offset + i >= m_modifierFromX.size()) {
LOG(
(CLOG_ERR "m_modifierFromX is too small (%d) for the "
@ -180,7 +180,7 @@ int32_t XWindowsKeyState::pollActiveGroup() const
return state.group;
}
LOG((CLOG_WARN "failed to poll active group"));
LOG_WARN("failed to poll active group");
}
#endif
return 0;
@ -233,7 +233,7 @@ bool XWindowsKeyState::setCurrentLanguageWithDBus(int32_t group) const
QDBusInterface screenSaverInterface(service, path, service, bus);
if (!screenSaverInterface.isValid()) {
LOG((CLOG_WARN "keyboard layout fail. dbus interface is invalid"));
LOG_WARN("keyboard layout fail. dbus interface is invalid");
return false;
}
@ -250,12 +250,12 @@ bool XWindowsKeyState::setCurrentLanguageWithDBus(int32_t group) const
}
if (reply.isError()) {
LOG((CLOG_WARN "keyboard layout fail. reply contains error"));
LOG_WARN("keyboard layout fail. reply contains error");
return true;
}
if (!reply.argumentAt<0>() || reply.argumentAt<1>() != QString("")) {
LOG((CLOG_WARN "keyboard layout fail. Reply is unexpected!"));
LOG_WARN("keyboard layout fail. Reply is unexpected!");
return true;
}
@ -272,7 +272,7 @@ void XWindowsKeyState::fakeKey(const Keystroke &keystroke)
int b = 1 << (c & 7);
if (m_keyboardState.global_auto_repeat == AutoRepeatModeOff ||
(c != 113 && c != 116 && (m_keyboardState.auto_repeats[i] & b) == 0)) {
LOG((CLOG_DEBUG1 " discard autorepeat"));
LOG_DEBUG1(" discard autorepeat");
break;
}
}
@ -296,12 +296,12 @@ void XWindowsKeyState::fakeKey(const Keystroke &keystroke)
#if HAVE_XKB_EXTENSION
if (m_xkb != nullptr) {
if (XkbLockGroup(m_display, XkbUseCoreKbd, keystroke.m_data.m_group.m_group) == False) {
LOG((CLOG_DEBUG1 "xkb lock group request not sent"));
LOG_DEBUG1("xkb lock group request not sent");
}
} else
#endif
{
LOG((CLOG_DEBUG1 " ignored"));
LOG_DEBUG1(" ignored");
}
} else {
@ -315,12 +315,12 @@ void XWindowsKeyState::fakeKey(const Keystroke &keystroke)
if (XkbLockGroup(
m_display, XkbUseCoreKbd, getEffectiveGroup(pollActiveGroup(), keystroke.m_data.m_group.m_group)
) == False) {
LOG((CLOG_DEBUG1 "xkb lock group request not sent"));
LOG_DEBUG1("xkb lock group request not sent");
}
} else
#endif
{
LOG((CLOG_DEBUG1 " ignored"));
LOG_DEBUG1(" ignored");
}
}
@ -334,7 +334,7 @@ void XWindowsKeyState::updateKeysymMap(deskflow::KeyMap &keyMap)
// there are up to 4 keysyms per keycode
static const int maxKeysyms = 4;
LOG((CLOG_DEBUG1 "non-XKB mapping"));
LOG_DEBUG1("non-XKB mapping");
// prepare map from X modifier to KeyModifierMask. certain bits
// are predefined.
@ -569,7 +569,7 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap)
}
};
LOG((CLOG_DEBUG1 "xkb mapping"));
LOG_DEBUG1("xkb mapping");
// find the number of groups
int maxNumGroups = 0;

View File

@ -20,7 +20,7 @@ namespace {
bool sleepInhibitCall(bool state, XWindowsPowerManager::InhibitScreenServices serviceID)
{
if (std::string error; !XWindowsPowerManager::inhibitScreenCall(serviceID, state, error)) {
LOG((CLOG_DEBUG "dbus inhibit error %s", error.c_str()));
LOG_DEBUG("dbus inhibit error %s", error.c_str());
return false;
}
@ -38,7 +38,7 @@ void XWindowsPowerManager::disableSleep() const
{
if (!sleepInhibitCall(true, XWindowsPowerManager::InhibitScreenServices::kScreenSaver) &&
!sleepInhibitCall(true, XWindowsPowerManager::InhibitScreenServices::kSessionManager)) {
LOG((CLOG_WARN "failed to prevent system from going to sleep"));
LOG_WARN("failed to prevent system from going to sleep");
}
}
@ -46,7 +46,7 @@ void XWindowsPowerManager::enableSleep() const
{
if (!sleepInhibitCall(false, XWindowsPowerManager::InhibitScreenServices::kScreenSaver) &&
!sleepInhibitCall(false, XWindowsPowerManager::InhibitScreenServices::kSessionManager)) {
LOG((CLOG_WARN "failed to enable system idle sleep"));
LOG_WARN("failed to enable system idle sleep");
}
}

View File

@ -111,8 +111,8 @@ XWindowsScreen::XWindowsScreen(
m_window = openWindow();
m_screensaver = new XWindowsScreenSaver(m_display, m_window, getEventTarget(), events);
m_keyState = new XWindowsKeyState(m_display, m_xkb, events, m_keyMap);
LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_xinerama ? "(xinerama)" : ""));
LOG((CLOG_DEBUG "window is 0x%08x", m_window));
LOG_DEBUG("screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_xinerama ? "(xinerama)" : "");
LOG_DEBUG("window is 0x%08x", m_window);
} catch (...) {
if (m_display != nullptr) {
XCloseDisplay(m_display);
@ -406,10 +406,10 @@ void XWindowsScreen::setOptions(const OptionsList &options)
for (uint32_t i = 0, n = options.size(); i < n; i += 2) {
if (options[i] == kOptionXTestXineramaUnaware) {
m_xtestIsXineramaUnaware = (options[i + 1] != 0);
LOG((CLOG_DEBUG1 "library, XTest is Xinerama unaware %s", m_xtestIsXineramaUnaware ? "true" : "false"));
LOG_DEBUG1("library, XTest is Xinerama unaware %s", m_xtestIsXineramaUnaware ? "true" : "false");
} else if (options[i] == kOptionScreenPreserveFocus) {
m_preserveFocus = (options[i + 1] != 0);
LOG((CLOG_DEBUG1 "preserve focus: %s", m_preserveFocus ? "true" : "false"));
LOG_DEBUG1("preserve focus: %s", m_preserveFocus ? "true" : "false");
}
}
}
@ -512,7 +512,7 @@ uint32_t XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
{
// only allow certain modifiers
if ((mask & ~(KeyModifierShift | KeyModifierControl | KeyModifierAlt | KeyModifierSuper)) != 0) {
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
LOG_DEBUG("could not map hotkey id=%04x mask=%04x", key, mask);
return 0;
}
@ -525,14 +525,14 @@ uint32_t XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
unsigned int modifiers;
if (!m_keyState->mapModifiersToX(mask, modifiers)) {
// can't map all modifiers
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
LOG_DEBUG("could not map hotkey id=%04x mask=%04x", key, mask);
return 0;
}
XWindowsKeyState::KeycodeList keycodes;
m_keyState->mapKeyToKeycodes(key, keycodes);
if (key != kKeyNone && keycodes.empty()) {
// can't map key
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
LOG_DEBUG("could not map hotkey id=%04x mask=%04x", key, mask);
return 0;
}
@ -713,9 +713,9 @@ void XWindowsScreen::unregisterHotKey(uint32_t id)
}
}
if (err) {
LOG((CLOG_WARN "failed to unregister hotkey id=%d", id));
LOG_WARN("failed to unregister hotkey id=%d", id);
} else {
LOG((CLOG_DEBUG "unregistered hotkey id=%d", id));
LOG_DEBUG("unregistered hotkey id=%d", id);
}
// discard hot key from map and record old id for reuse
@ -821,7 +821,7 @@ void XWindowsScreen::fakeMouseWheel(int32_t, int32_t yDelta) const
}
if (yDelta < m_mouseScrollDelta) {
LOG((CLOG_WARN "wheel scroll delta (%d) smaller than threshold (%d)", yDelta, m_mouseScrollDelta));
LOG_WARN("wheel scroll delta (%d) smaller than threshold (%d)", yDelta, m_mouseScrollDelta);
}
// send as many clicks as necessary
@ -843,7 +843,7 @@ Display *XWindowsScreen::openDisplay(const char *displayName)
}
// open the display
LOG((CLOG_DEBUG3 "calling XOpenDisplay(\"%s\")", displayName));
LOG_DEBUG3("calling XOpenDisplay(\"%s\")", displayName);
Display *display = XOpenDisplay(displayName);
if (display == nullptr) {
throw XScreenUnavailable(60.0);
@ -855,7 +855,7 @@ Display *XWindowsScreen::openDisplay(const char *displayName)
int firstEvent;
int firstError;
if (!XQueryExtension(display, XTestExtensionName, &majorOpcode, &firstEvent, &firstError)) {
LOG((CLOG_ERR "the XTest extension is not available"));
LOG_ERR("the XTest extension is not available");
XCloseDisplay(display);
throw XScreenOpenFailure();
}
@ -1038,7 +1038,7 @@ void XWindowsScreen::openIM()
// open the input methods
XIM im = XOpenIM(m_display, nullptr, nullptr, nullptr);
if (im == nullptr) {
LOG((CLOG_INFO "no support for IM"));
LOG_INFO("no support for IM");
return;
}
@ -1046,7 +1046,7 @@ void XWindowsScreen::openIM()
// only at the moment.
XIMStyles *styles;
if (XGetIMValues(im, XNQueryInputStyle, &styles, nullptr) != nullptr || styles == nullptr) {
LOG((CLOG_WARN "cannot get IM styles"));
LOG_WARN("cannot get IM styles");
XCloseIM(im);
return;
}
@ -1059,7 +1059,7 @@ void XWindowsScreen::openIM()
}
XFree(styles);
if (style == 0) {
LOG((CLOG_INFO "no supported IM styles"));
LOG_INFO("no supported IM styles");
XCloseIM(im);
return;
}
@ -1067,7 +1067,7 @@ void XWindowsScreen::openIM()
// create an input context for the style and tell it about our window
XIC ic = XCreateIC(im, XNInputStyle, style, XNClientWindow, m_window, nullptr);
if (ic == nullptr) {
LOG((CLOG_WARN "cannot create IC"));
LOG_WARN("cannot create IC");
XCloseIM(im);
return;
}
@ -1075,7 +1075,7 @@ void XWindowsScreen::openIM()
// find out the events we must select for and do so
unsigned long mask;
if (XGetICValues(ic, XNFilterEvents, &mask, nullptr) != nullptr) {
LOG((CLOG_WARN "cannot get IC filter events"));
LOG_WARN("cannot get IC filter events");
XDestroyIC(ic);
XCloseIM(im);
return;
@ -1342,7 +1342,7 @@ void XWindowsScreen::handleSystemEvent(const Event &event)
return;
case XkbStateNotify:
LOG((CLOG_INFO "group change: %d", xkbEvent->state.group));
LOG_INFO("group change: %d", xkbEvent->state.group);
m_keyState->setActiveGroup((int32_t)xkbEvent->state.group);
return;
@ -1357,8 +1357,7 @@ void XWindowsScreen::handleSystemEvent(const Event &event)
if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify ||
xevent->type == m_xrandrEventBase + RRNotify &&
reinterpret_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange) {
LOG((CLOG_INFO "either XRRScreenChangeNotifyEvent or "
"RRNotify_CrtcChange received"));
LOG_INFO("either XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received");
// we're required to call back into XLib so XLib can update its internal
// state
@ -1387,7 +1386,7 @@ void XWindowsScreen::handleSystemEvent(const Event &event)
void XWindowsScreen::onKeyPress(XKeyEvent &xkey)
{
LOG((CLOG_DEBUG1 "event: KeyPress code=%d, state=0x%04x", xkey.keycode, xkey.state));
LOG_DEBUG1("event: KeyPress code=%d, state=0x%04x", xkey.keycode, xkey.state);
const KeyModifierMask mask = m_keyState->mapModifiersFromX(xkey.state);
KeyID key = mapKeyFromX(&xkey);
if (key != kKeyNone) {
@ -1395,7 +1394,7 @@ void XWindowsScreen::onKeyPress(XKeyEvent &xkey)
if ((key == kKeyPause || key == kKeyBreak) &&
(mask & (KeyModifierControl | KeyModifierAlt)) == (KeyModifierControl | KeyModifierAlt)) {
// pretend it's ctrl+alt+del
LOG((CLOG_DEBUG "emulate ctrl+alt+del"));
LOG_DEBUG("emulate ctrl+alt+del");
key = kKeyDelete;
}
@ -1408,7 +1407,7 @@ void XWindowsScreen::onKeyPress(XKeyEvent &xkey)
keycode = static_cast<KeyButton>(m_lastKeycode);
if (keycode == 0) {
// no keycode
LOG((CLOG_DEBUG1 "event: KeyPress no keycode"));
LOG_DEBUG1("event: KeyPress no keycode");
return;
}
}
@ -1421,7 +1420,7 @@ void XWindowsScreen::onKeyPress(XKeyEvent &xkey)
m_keyState->sendKeyEvent(getEventTarget(), false, false, key, mask, 1, keycode);
}
} else {
LOG((CLOG_DEBUG1 "can't map keycode to key id"));
LOG_DEBUG1("can't map keycode to key id");
}
}
@ -1434,7 +1433,7 @@ void XWindowsScreen::onKeyRelease(XKeyEvent &xkey, bool isRepeat)
if ((key == kKeyPause || key == kKeyBreak) &&
(mask & (KeyModifierControl | KeyModifierAlt)) == (KeyModifierControl | KeyModifierAlt)) {
// pretend it's ctrl+alt+del and ignore autorepeat
LOG((CLOG_DEBUG "emulate ctrl+alt+del"));
LOG_DEBUG("emulate ctrl+alt+del");
key = kKeyDelete;
isRepeat = false;
}
@ -1442,14 +1441,14 @@ void XWindowsScreen::onKeyRelease(XKeyEvent &xkey, bool isRepeat)
auto keycode = static_cast<KeyButton>(xkey.keycode);
if (!isRepeat) {
// no press event follows so it's a plain release
LOG((CLOG_DEBUG1 "event: KeyRelease code=%d, state=0x%04x", keycode, xkey.state));
LOG_DEBUG1("event: KeyRelease code=%d, state=0x%04x", keycode, xkey.state);
m_keyState->sendKeyEvent(getEventTarget(), false, false, key, mask, 1, keycode);
} else {
// found a press event following so it's a repeat.
// we could attempt to count the already queued
// repeats but we'll just send a repeat of 1.
// note that we discard the press event.
LOG((CLOG_DEBUG1 "event: repeat code=%d, state=0x%04x", keycode, xkey.state));
LOG_DEBUG1("event: repeat code=%d, state=0x%04x", keycode, xkey.state);
m_keyState->sendKeyEvent(getEventTarget(), false, true, key, mask, 1, keycode);
}
}
@ -1482,7 +1481,7 @@ bool XWindowsScreen::onHotKey(const XKeyEvent &xkey, bool isRepeat)
void XWindowsScreen::onMousePress(const XButtonEvent &xbutton)
{
LOG((CLOG_DEBUG1 "event: ButtonPress button=%d", xbutton.button));
LOG_DEBUG1("event: ButtonPress button=%d", xbutton.button);
ButtonID button = mapButtonFromX(&xbutton);
KeyModifierMask mask = m_keyState->mapModifiersFromX(xbutton.state);
if (button != kButtonNone) {
@ -1493,7 +1492,7 @@ void XWindowsScreen::onMousePress(const XButtonEvent &xbutton)
void XWindowsScreen::onMouseRelease(const XButtonEvent &xbutton)
{
using enum EventTypes;
LOG((CLOG_DEBUG1 "event: ButtonRelease button=%d", xbutton.button));
LOG_DEBUG1("event: ButtonRelease button=%d", xbutton.button);
ButtonID button = mapButtonFromX(&xbutton);
KeyModifierMask mask = m_keyState->mapModifiersFromX(xbutton.state);
if (button != kButtonNone) {
@ -1510,7 +1509,7 @@ void XWindowsScreen::onMouseRelease(const XButtonEvent &xbutton)
void XWindowsScreen::onMouseMove(const XMotionEvent &xmotion)
{
LOG((CLOG_DEBUG2 "event: MotionNotify %d,%d", xmotion.x_root, xmotion.y_root));
LOG_DEBUG2("event: MotionNotify %d,%d", xmotion.x_root, xmotion.y_root);
// compute motion delta (relative to the last known
// mouse position)
@ -1532,7 +1531,7 @@ void XWindowsScreen::onMouseMove(const XMotionEvent &xmotion)
do {
XMaskEvent(m_display, PointerMotionMask, &xevent);
if (cntr++ > 10) {
LOG((CLOG_WARN "too many discarded events! %d", cntr));
LOG_WARN("too many discarded events! %d", cntr);
break;
}
} while (!xevent.xany.send_event);
@ -1665,7 +1664,7 @@ int XWindowsScreen::ioErrorHandler(Display *)
// down. X forces us to exit at this point which is annoying.
// we'll pretend as if we won't exit so we try to make sure we
// don't access the display anymore.
LOG((CLOG_CRIT "x display has unexpectedly disconnected"));
LOG_CRIT("x display has unexpectedly disconnected");
s_screen->onError();
return 0;
}
@ -1765,11 +1764,11 @@ KeyID XWindowsScreen::mapKeyFromX(XKeyEvent *event) const
XLookupString(event, dummy, 0, &keysym, nullptr);
}
LOG((CLOG_DEBUG2 "mapped code=%d to keysym=0x%04x", event->keycode, keysym));
LOG_DEBUG2("mapped code=%d to keysym=0x%04x", event->keycode, keysym);
// convert key
KeyID result = XWindowsUtil::mapKeySymToKeyID(keysym);
LOG((CLOG_DEBUG2 "mapped keysym=0x%04x to keyID=%d", keysym, result));
LOG_DEBUG2("mapped keysym=0x%04x to keyID=%d", keysym, result);
return result;
}
@ -1851,7 +1850,7 @@ void XWindowsScreen::warpCursorNoFlush(int32_t x, int32_t y)
XSendEvent(m_display, m_window, False, 0, &eventAfter);
XSync(m_display, False);
LOG((CLOG_DEBUG2 "warped to %d,%d", x, y));
LOG_DEBUG2("warped to %d,%d", x, y);
}
void XWindowsScreen::updateButtons()
@ -1903,15 +1902,15 @@ bool XWindowsScreen::grabMouseAndKeyboard()
result = XGrabKeyboard(m_display, m_window, True, GrabModeAsync, GrabModeAsync, CurrentTime);
assert(result != GrabNotViewable);
if (result != GrabSuccess) {
LOG((CLOG_DEBUG2 "waiting to grab keyboard"));
LOG_DEBUG2("waiting to grab keyboard");
Arch::sleep(0.05);
if (timer.getTime() >= s_timeout) {
LOG((CLOG_DEBUG2 "grab keyboard timed out"));
LOG_DEBUG2("grab keyboard timed out");
return false;
}
}
} while (result != GrabSuccess);
LOG((CLOG_DEBUG2 "grabbed keyboard"));
LOG_DEBUG2("grabbed keyboard");
// now the mouse --- use event_mask to get EnterNotify, LeaveNotify events
result =
@ -1920,16 +1919,16 @@ bool XWindowsScreen::grabMouseAndKeyboard()
if (result != GrabSuccess) {
// back off to avoid grab deadlock
XUngrabKeyboard(m_display, CurrentTime);
LOG((CLOG_DEBUG2 "ungrabbed keyboard, waiting to grab pointer"));
LOG_DEBUG2("ungrabbed keyboard, waiting to grab pointer");
Arch::sleep(0.05);
if (timer.getTime() >= s_timeout) {
LOG((CLOG_DEBUG2 "grab pointer timed out"));
LOG_DEBUG2("grab pointer timed out");
return false;
}
}
} while (result != GrabSuccess);
LOG((CLOG_DEBUG1 "grabbed pointer and keyboard"));
LOG_DEBUG1("grabbed pointer and keyboard");
return true;
}

View File

@ -66,7 +66,7 @@ XWindowsScreenSaver::XWindowsScreenSaver(Display *display, Window window, void *
XSelectInput(m_display, root, m_rootEventMask | SubstructureNotifyMask);
}
if (error) {
LOG((CLOG_DEBUG "didn't set root event mask"));
LOG_DEBUG("didn't set root event mask");
m_rootEventMask = 0;
}
@ -132,7 +132,7 @@ bool XWindowsScreenSaver::handleXEvent(const XEvent *xevent)
case DestroyNotify:
if (xevent->xdestroywindow.window == m_xscreensaver) {
// xscreensaver is gone
LOG((CLOG_DEBUG "xscreensaver died"));
LOG_DEBUG("xscreensaver died");
setXScreenSaver(None);
return true;
}
@ -289,7 +289,7 @@ bool XWindowsScreenSaver::findXScreenSaver()
void XWindowsScreenSaver::setXScreenSaver(Window window)
{
LOG((CLOG_DEBUG "xscreensaver window: 0x%08x", window));
LOG_DEBUG("xscreensaver window: 0x%08x", window);
// save window
m_xscreensaver = window;
@ -331,7 +331,7 @@ bool XWindowsScreenSaver::isXScreenSaver(Window w) const
void XWindowsScreenSaver::setXScreenSaverActive(bool activated)
{
if (m_xscreensaverActive != activated) {
LOG((CLOG_DEBUG "xscreensaver %s on window 0x%08x", activated ? "activated" : "deactivated", m_xscreensaver));
LOG_DEBUG("xscreensaver %s on window 0x%08x", activated ? "activated" : "deactivated", m_xscreensaver);
m_xscreensaverActive = activated;
// if screen saver was activated forcefully (i.e. against
@ -363,7 +363,7 @@ void XWindowsScreenSaver::sendXScreenSaverCommand(Atom cmd, long arg1, long arg2
event.xclient.data.l[3] = 0;
event.xclient.data.l[4] = 0;
LOG((CLOG_DEBUG "send xscreensaver command: %d %d %d", (long)cmd, arg1, arg2));
LOG_DEBUG("send xscreensaver command: %d %d %d", (long)cmd, arg1, arg2);
bool error = false;
{
XWindowsUtil::ErrorLock lock(m_display, &error);

View File

@ -1586,7 +1586,7 @@ bool XWindowsUtil::getWindowProperty(
);
return true;
} else {
LOG((CLOG_DEBUG2 "can't read property %d on window 0x%08x", property, window));
LOG_DEBUG2("can't read property %d on window 0x%08x", property, window);
return false;
}
}
@ -1949,13 +1949,13 @@ int XWindowsUtil::ErrorLock::internalHandler(Display *display, XErrorEvent *even
void XWindowsUtil::ErrorLock::ignoreHandler(Display *, XErrorEvent *e, void *)
{
LOG((CLOG_DEBUG1 "ignoring X error: %d", e->error_code));
LOG_DEBUG1("ignoring X error: %d", e->error_code);
}
void XWindowsUtil::ErrorLock::saveHandler(Display *display, XErrorEvent *e, void *flag)
{
char errtxt[1024];
XGetErrorText(display, e->error_code, errtxt, 1023);
LOG((CLOG_DEBUG1 "flagging X error: %d - %.1023s", e->error_code, errtxt));
LOG_DEBUG1("flagging X error: %d - %.1023s", e->error_code, errtxt);
*static_cast<bool *>(flag) = true;
}

View File

@ -45,7 +45,7 @@ ClientListener::ClientListener(
m_socketFactory.reset();
throw;
}
LOG((CLOG_DEBUG1 "listening for clients"));
LOG_DEBUG1("listening for clients");
}
ClientListener::~ClientListener()
@ -81,14 +81,14 @@ void ClientListener::start()
});
// bind listen address
LOG((CLOG_DEBUG1 "binding listen socket"));
LOG_DEBUG1("binding listen socket");
m_listen->bind(m_address);
}
void ClientListener::stop()
{
using enum EventTypes;
LOG((CLOG_DEBUG1 "stop listening for clients"));
LOG_DEBUG1("stop listening for clients");
// discard already connected clients
for (auto index = m_newClients.begin(); index != m_newClients.end(); ++index) {
@ -146,7 +146,7 @@ void ClientListener::handleClientConnecting()
void ClientListener::handleClientAccepted(IDataSocket *socket)
{
LOG((CLOG_NOTE "accepted client connection"));
LOG_NOTE("accepted client connection");
// filter socket messages, including a packetizing filter
deskflow::IStream *stream = new PacketStreamFilter(m_events, socket, false);

View File

@ -28,7 +28,7 @@ ClientProxy::~ClientProxy()
void ClientProxy::close(const char *msg) const
{
LOG((CLOG_DEBUG1 "send close \"%s\" to \"%s\"", msg, getName().c_str()));
LOG_DEBUG1("send close \"%s\" to \"%s\"", msg, getName().c_str());
ProtocolUtil::writef(getStream(), msg);
// force the close to be sent before we return

View File

@ -42,7 +42,7 @@ ClientProxy1_0::ClientProxy1_0(const std::string &name, deskflow::IStream *strea
setHeartbeatRate(kHeartRate, kHeartRate * kHeartBeatsUntilDeath);
LOG((CLOG_DEBUG1 "querying client \"%s\" info", getName().c_str()));
LOG_DEBUG1("querying client \"%s\" info", getName().c_str());
ProtocolUtil::writef(getStream(), kMsgQInfo);
}
@ -113,14 +113,14 @@ void ClientProxy1_0::handleData()
while (n != 0) {
// verify we got an entire code
if (n != 4) {
LOG((CLOG_ERR "incomplete message from \"%s\": %d bytes", getName().c_str(), n));
LOG_ERR("incomplete message from \"%s\": %d bytes", getName().c_str(), n);
disconnect();
return;
}
// parse message
try {
LOG((CLOG_DEBUG2 "msg from \"%s\": %c%c%c%c", getName().c_str(), code[0], code[1], code[2], code[3]));
LOG_DEBUG2("msg from \"%s\": %c%c%c%c", getName().c_str(), code[0], code[1], code[2], code[3]);
if (!(this->*m_parser)(code)) {
LOG(
(CLOG_ERR "invalid message from client \"%s\": %c%c%c%c", getName().c_str(), code[0], code[1], code[2],
@ -132,7 +132,7 @@ void ClientProxy1_0::handleData()
;
}
} catch (const XBadClient &e) {
LOG((CLOG_ERR "protocol error from client \"%s\": %s", getName().c_str(), e.what()));
LOG_ERR("protocol error from client \"%s\": %s", getName().c_str(), e.what());
disconnect();
return;
}
@ -149,7 +149,7 @@ bool ClientProxy1_0::parseHandshakeMessage(const uint8_t *code)
{
if (memcmp(code, kMsgCNoop, 4) == 0) {
// discard no-ops
LOG((CLOG_DEBUG2 "no-op from", getName().c_str()));
LOG_DEBUG2("no-op from", getName().c_str());
return true;
} else if (memcmp(code, kMsgDInfo, 4) == 0) {
// future messages get parsed by parseMessage
@ -173,7 +173,7 @@ bool ClientProxy1_0::parseMessage(const uint8_t *code)
return false;
} else if (memcmp(code, kMsgCNoop, 4) == 0) {
// discard no-ops
LOG((CLOG_DEBUG2 "no-op from", getName().c_str()));
LOG_DEBUG2("no-op from", getName().c_str());
return true;
} else if (memcmp(code, kMsgCClipboard, 4) == 0) {
return recvGrabClipboard();
@ -185,20 +185,20 @@ bool ClientProxy1_0::parseMessage(const uint8_t *code)
void ClientProxy1_0::handleDisconnect()
{
LOG((CLOG_NOTE "client \"%s\" has disconnected", getName().c_str()));
LOG_NOTE("client \"%s\" has disconnected", getName().c_str());
disconnect();
}
void ClientProxy1_0::handleWriteError()
{
LOG((CLOG_WARN "error writing to client \"%s\"", getName().c_str()));
LOG_WARN("error writing to client \"%s\"", getName().c_str());
disconnect();
}
void ClientProxy1_0::handleFlatline()
{
// didn't get a heartbeat fast enough. assume client is dead.
LOG((CLOG_NOTE "client \"%s\" is dead", getName().c_str()));
LOG_NOTE("client \"%s\" is dead", getName().c_str());
disconnect();
}
@ -225,13 +225,13 @@ void ClientProxy1_0::getCursorPos(int32_t &x, int32_t &y) const
void ClientProxy1_0::enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool)
{
LOG((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x", getName().c_str(), xAbs, yAbs, seqNum, mask));
LOG_DEBUG1("send enter to \"%s\", %d,%d %d %04x", getName().c_str(), xAbs, yAbs, seqNum, mask);
ProtocolUtil::writef(getStream(), kMsgCEnter, xAbs, yAbs, seqNum, mask);
}
bool ClientProxy1_0::leave()
{
LOG((CLOG_DEBUG1 "send leave to \"%s\"", getName().c_str()));
LOG_DEBUG1("send leave to \"%s\"", getName().c_str());
ProtocolUtil::writef(getStream(), kMsgCLeave);
// we can never prevent the user from leaving
@ -245,7 +245,7 @@ void ClientProxy1_0::setClipboard(ClipboardID id, const IClipboard *clipboard)
void ClientProxy1_0::grabClipboard(ClipboardID id)
{
LOG((CLOG_DEBUG "send grab clipboard %d to \"%s\"", id, getName().c_str()));
LOG_DEBUG("send grab clipboard %d to \"%s\"", id, getName().c_str());
ProtocolUtil::writef(getStream(), kMsgCClipboard, id, 0);
// this clipboard is now dirty
@ -259,37 +259,37 @@ void ClientProxy1_0::setClipboardDirty(ClipboardID id, bool dirty)
void ClientProxy1_0::keyDown(KeyID key, KeyModifierMask mask, KeyButton, const std::string &)
{
LOG((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask));
LOG_DEBUG1("send key down to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask);
ProtocolUtil::writef(getStream(), kMsgDKeyDown1_0, key, mask);
}
void ClientProxy1_0::keyRepeat(KeyID key, KeyModifierMask mask, int32_t count, KeyButton, const std::string &)
{
LOG((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getName().c_str(), key, mask, count));
LOG_DEBUG1("send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getName().c_str(), key, mask, count);
ProtocolUtil::writef(getStream(), kMsgDKeyRepeat1_0, key, mask, count);
}
void ClientProxy1_0::keyUp(KeyID key, KeyModifierMask mask, KeyButton)
{
LOG((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask));
LOG_DEBUG1("send key up to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask);
ProtocolUtil::writef(getStream(), kMsgDKeyUp1_0, key, mask);
}
void ClientProxy1_0::mouseDown(ButtonID button)
{
LOG((CLOG_DEBUG1 "send mouse down to \"%s\" id=%d", getName().c_str(), button));
LOG_DEBUG1("send mouse down to \"%s\" id=%d", getName().c_str(), button);
ProtocolUtil::writef(getStream(), kMsgDMouseDown, button);
}
void ClientProxy1_0::mouseUp(ButtonID button)
{
LOG((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getName().c_str(), button));
LOG_DEBUG1("send mouse up to \"%s\" id=%d", getName().c_str(), button);
ProtocolUtil::writef(getStream(), kMsgDMouseUp, button);
}
void ClientProxy1_0::mouseMove(int32_t xAbs, int32_t yAbs)
{
LOG((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getName().c_str(), xAbs, yAbs));
LOG_DEBUG2("send mouse move to \"%s\" %d,%d", getName().c_str(), xAbs, yAbs);
ProtocolUtil::writef(getStream(), kMsgDMouseMove, xAbs, yAbs);
}
@ -301,44 +301,44 @@ void ClientProxy1_0::mouseRelativeMove(int32_t, int32_t)
void ClientProxy1_0::mouseWheel(int32_t, int32_t yDelta)
{
// clients prior to 1.3 only support the y axis
LOG((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d", getName().c_str(), yDelta));
LOG_DEBUG2("send mouse wheel to \"%s\" %+d", getName().c_str(), yDelta);
ProtocolUtil::writef(getStream(), kMsgDMouseWheel1_0, yDelta);
}
void ClientProxy1_0::sendDragInfo(uint32_t fileCount, const char *info, size_t size)
{
// ignore -- not supported in protocol 1.0
LOG((CLOG_DEBUG "draggingInfoSending not supported"));
LOG_DEBUG("draggingInfoSending not supported");
}
void ClientProxy1_0::fileChunkSending(uint8_t mark, char *data, size_t dataSize)
{
// ignore -- not supported in protocol 1.0
LOG((CLOG_DEBUG "fileChunkSending not supported"));
LOG_DEBUG("fileChunkSending not supported");
}
std::string ClientProxy1_0::getSecureInputApp() const
{
// ignore -- not supported on clients
LOG((CLOG_DEBUG "getSecureInputApp not supported"));
LOG_DEBUG("getSecureInputApp not supported");
return "";
}
void ClientProxy1_0::secureInputNotification(const std::string &app) const
{
// ignore -- not supported in protocol 1.0
LOG((CLOG_DEBUG "secureInputNotification not supported"));
LOG_DEBUG("secureInputNotification not supported");
}
void ClientProxy1_0::screensaver(bool on)
{
LOG((CLOG_DEBUG1 "send screen saver to \"%s\" on=%d", getName().c_str(), on ? 1 : 0));
LOG_DEBUG1("send screen saver to \"%s\" on=%d", getName().c_str(), on ? 1 : 0);
ProtocolUtil::writef(getStream(), kMsgCScreenSaver, on ? 1 : 0);
}
void ClientProxy1_0::resetOptions()
{
LOG((CLOG_DEBUG1 "send reset options to \"%s\"", getName().c_str()));
LOG_DEBUG1("send reset options to \"%s\"", getName().c_str());
ProtocolUtil::writef(getStream(), kMsgCResetOptions);
// reset heart rate and death
@ -349,7 +349,7 @@ void ClientProxy1_0::resetOptions()
void ClientProxy1_0::setOptions(const OptionsList &options)
{
LOG((CLOG_DEBUG1 "send set options to \"%s\" size=%d", getName().c_str(), options.size()));
LOG_DEBUG1("send set options to \"%s\" size=%d", getName().c_str(), options.size());
ProtocolUtil::writef(getStream(), kMsgDSetOptions, &options);
// check options
@ -379,7 +379,7 @@ bool ClientProxy1_0::recvInfo()
if (!ProtocolUtil::readf(getStream(), kMsgDInfo + 4, &x, &y, &w, &h, &dummy1, &mx, &my)) {
return false;
}
LOG((CLOG_DEBUG "received client \"%s\" info shape=%d,%d %dx%d at %d,%d", getName().c_str(), x, y, w, h, mx, my));
LOG_DEBUG("received client \"%s\" info shape=%d,%d %dx%d at %d,%d", getName().c_str(), x, y, w, h, mx, my);
// validate
if (w <= 0 || h <= 0) {
@ -399,7 +399,7 @@ bool ClientProxy1_0::recvInfo()
m_info.m_my = my;
// acknowledge receipt
LOG((CLOG_DEBUG1 "send info ack to \"%s\"", getName().c_str()));
LOG_DEBUG1("send info ack to \"%s\"", getName().c_str());
ProtocolUtil::writef(getStream(), kMsgCInfoAck);
return true;
}
@ -418,7 +418,7 @@ bool ClientProxy1_0::recvGrabClipboard()
if (!ProtocolUtil::readf(getStream(), kMsgCClipboard + 4, &id, &seqNum)) {
return false;
}
LOG((CLOG_DEBUG "received client \"%s\" grabbed clipboard %d seqnum=%d", getName().c_str(), id, seqNum));
LOG_DEBUG("received client \"%s\" grabbed clipboard %d seqnum=%d", getName().c_str(), id, seqNum);
// validate
if (id >= kClipboardEnd) {

View File

@ -25,7 +25,7 @@ ClientProxy1_1::ClientProxy1_1(const std::string &name, deskflow::IStream *strea
void ClientProxy1_1::keyDown(KeyID key, KeyModifierMask mask, KeyButton button, const std::string &)
{
LOG((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button));
LOG_DEBUG1("send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button);
ProtocolUtil::writef(getStream(), kMsgDKeyDown, key, mask, button);
}
@ -43,6 +43,6 @@ void ClientProxy1_1::keyRepeat(
void ClientProxy1_1::keyUp(KeyID key, KeyModifierMask mask, KeyButton button)
{
LOG((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button));
LOG_DEBUG1("send key up to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button);
ProtocolUtil::writef(getStream(), kMsgDKeyUp, key, mask, button);
}

View File

@ -22,6 +22,6 @@ ClientProxy1_2::ClientProxy1_2(const std::string &name, deskflow::IStream *strea
void ClientProxy1_2::mouseRelativeMove(int32_t xRel, int32_t yRel)
{
LOG((CLOG_DEBUG2 "send mouse relative move to \"%s\" %d,%d", getName().c_str(), xRel, yRel));
LOG_DEBUG2("send mouse relative move to \"%s\" %d,%d", getName().c_str(), xRel, yRel);
ProtocolUtil::writef(getStream(), kMsgDMouseRelMove, xRel, yRel);
}

View File

@ -34,7 +34,7 @@ ClientProxy1_3::~ClientProxy1_3()
void ClientProxy1_3::mouseWheel(int32_t xDelta, int32_t yDelta)
{
LOG((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d,%+d", getName().c_str(), xDelta, yDelta));
LOG_DEBUG2("send mouse wheel to \"%s\" %+d,%+d", getName().c_str(), xDelta, yDelta);
ProtocolUtil::writef(getStream(), kMsgDMouseWheel, xDelta, yDelta);
}

View File

@ -37,7 +37,7 @@ void ClientProxy1_6::setClipboard(ClipboardID id, const IClipboard *clipboard)
std::string data = m_clipboard[id].m_clipboard.marshall();
size_t size = data.size();
LOG((CLOG_DEBUG "sending clipboard %d to \"%s\"", id, getName().c_str()));
LOG_DEBUG("sending clipboard %d to \"%s\"", id, getName().c_str());
StreamChunker::sendClipboard(data, size, id, 0, m_events, this);
}
@ -52,7 +52,7 @@ bool ClientProxy1_6::recvClipboard()
if (auto r = ClipboardChunk::assemble(getStream(), dataCached, id, seq); r == TransferState::Started) {
size_t size = ClipboardChunk::getExpectedSize();
LOG((CLOG_DEBUG "receiving clipboard %d size=%d", id, size));
LOG_DEBUG("receiving clipboard %d size=%d", id, size);
} else if (r == TransferState::Finished) {
LOG(
(CLOG_DEBUG "received client \"%s\" clipboard %d seqnum=%d, size=%d", getName().c_str(), id, seq,

View File

@ -23,6 +23,6 @@ ClientProxy1_7::ClientProxy1_7(const std::string &name, deskflow::IStream *strea
void ClientProxy1_7::secureInputNotification(const std::string &app) const
{
LOG((CLOG_DEBUG2 "send secure input notification to \"%s\" %s", getName().c_str(), app.c_str()));
LOG_DEBUG2("send secure input notification to \"%s\" %s", getName().c_str(), app.c_str());
ProtocolUtil::writef(getStream(), kMsgDSecureInputNotification, &app);
}

View File

@ -23,10 +23,10 @@ void ClientProxy1_8::synchronizeLanguages() const
deskflow::languages::LanguageManager languageManager;
auto localLanguages = languageManager.getSerializedLocalLanguages();
if (!localLanguages.empty()) {
LOG((CLOG_DEBUG1 "send server languages to the client: %s", localLanguages.c_str()));
LOG_DEBUG1("send server languages to the client: %s", localLanguages.c_str());
ProtocolUtil::writef(getStream(), kMsgDLanguageSynchronisation, &localLanguages);
} else {
LOG((CLOG_ERR "failed to read server languages"));
LOG_ERR("failed to read server languages");
}
}

View File

@ -195,14 +195,14 @@ void ClientProxyUnknown::initProxy(const std::string &name, int major, int minor
void ClientProxyUnknown::handleData()
{
LOG((CLOG_DEBUG1 "parsing hello reply"));
LOG_DEBUG1("parsing hello reply");
std::string name("<unknown>");
try {
// limit the maximum length of the hello
if (uint32_t n = m_stream->getSize(); n > kMaxHelloLength) {
LOG((CLOG_DEBUG1 "hello reply too long"));
LOG_DEBUG1("hello reply too long");
throw XBadClient();
}
@ -227,7 +227,7 @@ void ClientProxyUnknown::handleData()
initProxy(name, major, minor);
// the proxy is created and now proxy now owns the stream
LOG((CLOG_DEBUG1 "created proxy for client \"%s\" version %d.%d", name.c_str(), major, minor));
LOG_DEBUG1("created proxy for client \"%s\" version %d.%d", name.c_str(), major, minor);
m_stream = nullptr;
// wait until the proxy signals that it's ready or has disconnected
@ -235,33 +235,33 @@ void ClientProxyUnknown::handleData()
return;
} catch (XIncompatibleClient &e) {
// client is incompatible
LOG((CLOG_WARN "client \"%s\" has incompatible version %d.%d)", name.c_str(), e.getMajor(), e.getMinor()));
LOG_WARN("client \"%s\" has incompatible version %d.%d)", name.c_str(), e.getMajor(), e.getMinor());
ProtocolUtil::writef(m_stream, kMsgEIncompatible, kProtocolMajorVersion, kProtocolMinorVersion);
} catch (XBadClient &) {
// client not behaving
LOG((CLOG_WARN "protocol error from client \"%s\"", name.c_str()));
LOG_WARN("protocol error from client \"%s\"", name.c_str());
ProtocolUtil::writef(m_stream, kMsgEBad);
} catch (XBase &e) {
// misc error
LOG((CLOG_WARN "error communicating with client \"%s\": %s", name.c_str(), e.what()));
LOG_WARN("error communicating with client \"%s\": %s", name.c_str(), e.what());
}
sendFailure();
}
void ClientProxyUnknown::handleWriteError()
{
LOG((CLOG_NOTE "error communicating with new client"));
LOG_NOTE("error communicating with new client");
sendFailure();
}
void ClientProxyUnknown::handleTimeout()
{
LOG((CLOG_NOTE "new client is unresponsive"));
LOG_NOTE("new client is unresponsive");
sendFailure();
}
void ClientProxyUnknown::handleDisconnect()
{
LOG((CLOG_NOTE "new client disconnected"));
LOG_NOTE("new client disconnected");
sendFailure();
}

View File

@ -659,18 +659,18 @@ bool InputFilter::Rule::handleEvent(const Event &event)
case Activate:
actions = &m_activateActions;
LOG((CLOG_DEBUG1 "activate actions"));
LOG_DEBUG1("activate actions");
break;
case Deactivate:
actions = &m_deactivateActions;
LOG((CLOG_DEBUG1 "deactivate actions"));
LOG_DEBUG1("deactivate actions");
break;
}
// perform actions
for (auto action : *actions) {
LOG((CLOG_DEBUG1 "hotkey: %s", action->format().c_str()));
LOG_DEBUG1("hotkey: %s", action->format().c_str());
action->perform(event);
}

View File

@ -215,7 +215,7 @@ std::string PrimaryClient::getSecureInputApp() const
void PrimaryClient::secureInputNotification(const std::string &app) const
{
LOG((CLOG_INFO "application \"%s\" is blocking the keyboard", app.c_str()));
LOG_INFO("application \"%s\" is blocking the keyboard", app.c_str());
}
void PrimaryClient::resetOptions()

View File

@ -136,7 +136,7 @@ Server::Server(
// Determine if scroll lock is already set. If so, lock the cursor to the
// primary screen
if (m_primaryClient->getToggleMask() & KeyModifierScrollLock) {
LOG((CLOG_NOTE "scroll lock is on, locking cursor to screen"));
LOG_NOTE("scroll lock is on, locking cursor to screen");
m_lockedToScreen = true;
}
}
@ -164,7 +164,7 @@ Server::~Server()
// force immediate disconnection of secondary clients
disconnect();
} catch (std::exception &e) { // NOSONAR
LOG((CLOG_ERR "failed to disconnect: %s", e.what()));
LOG_ERR("failed to disconnect: %s", e.what());
}
for (auto index = m_oldClients.begin(); index != m_oldClients.end(); ++index) {
@ -234,7 +234,7 @@ void Server::adoptClient(BaseClientProxy *client)
// name must be in our configuration
if (!m_config->isScreen(client->getName())) {
LOG((CLOG_WARN "unrecognised client name \"%s\", check server config", client->getName().c_str()));
LOG_WARN("unrecognised client name \"%s\", check server config", client->getName().c_str());
closeClient(client, kMsgEUnknown);
return;
}
@ -242,11 +242,11 @@ void Server::adoptClient(BaseClientProxy *client)
// add client to client list
if (!addClient(client)) {
// can only have one screen with a given name at any given time
LOG((CLOG_WARN "a client with name \"%s\" is already connected", getName(client).c_str()));
LOG_WARN("a client with name \"%s\" is already connected", getName(client).c_str());
closeClient(client, kMsgEBusy);
return;
}
LOG((CLOG_NOTE "client \"%s\" has connected", getName(client).c_str()));
LOG_NOTE("client \"%s\" has connected", getName(client).c_str());
// send configuration options to client
sendOptions(client);
@ -341,7 +341,7 @@ bool Server::isLockedToScreen() const
// locked if we say we're locked
if (isLockedToScreenServer()) {
LOG((CLOG_NOTE "cursor is locked to screen, check scroll lock key"));
LOG_NOTE("cursor is locked to screen, check scroll lock key");
return true;
}
@ -404,7 +404,7 @@ void Server::switchScreen(BaseClientProxy *dst, int32_t x, int32_t y, bool forSc
assert(m_active != nullptr);
LOG((CLOG_INFO "switch from \"%s\" to \"%s\" at %d,%d", getName(m_active).c_str(), getName(dst).c_str(), x, y));
LOG_INFO("switch from \"%s\" to \"%s\" at %d,%d", getName(m_active).c_str(), getName(dst).c_str(), x, y);
// stop waiting to switch
stopSwitch();
@ -424,7 +424,7 @@ void Server::switchScreen(BaseClientProxy *dst, int32_t x, int32_t y, bool forSc
// leave active screen
if (!m_active->leave()) {
// cannot leave screen
LOG((CLOG_WARN "can't leave screen"));
LOG_WARN("can't leave screen");
return;
}
@ -558,7 +558,7 @@ BaseClientProxy *Server::getNeighbor(const BaseClientProxy *src, Direction dir,
// get source screen name
std::string srcName = getName(src);
assert(!srcName.empty());
LOG((CLOG_DEBUG2 "find neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str()));
LOG_DEBUG2("find neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str());
// convert position to fraction
float t = mapToFraction(src, dir, x, y);
@ -573,20 +573,20 @@ BaseClientProxy *Server::getNeighbor(const BaseClientProxy *src, Direction dir,
// progress in this direction. since we haven't found a
// connected neighbor we return nullptr.
if (dstName.empty()) {
LOG((CLOG_DEBUG2 "no neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str()));
LOG_DEBUG2("no neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str());
return nullptr;
}
// look up neighbor cell. if the screen is connected and
// ready then we can stop.
if (ClientList::const_iterator index = m_clients.find(dstName); index != m_clients.end()) {
LOG((CLOG_DEBUG2 "\"%s\" is on %s of \"%s\" at %f", dstName.c_str(), Config::dirName(dir), srcName.c_str(), t));
LOG_DEBUG2("\"%s\" is on %s of \"%s\" at %f", dstName.c_str(), Config::dirName(dir), srcName.c_str(), t);
mapToPixel(index->second, dir, tTmp, x, y);
return index->second;
}
// skip over unconnected screen
LOG((CLOG_DEBUG2 "ignored \"%s\" on %s of \"%s\"", dstName.c_str(), Config::dirName(dir), srcName.c_str()));
LOG_DEBUG2("ignored \"%s\" on %s of \"%s\"", dstName.c_str(), Config::dirName(dir), srcName.c_str());
srcName = dstName;
// use position on skipped screen
@ -630,7 +630,7 @@ BaseClientProxy *Server::mapToNeighbor(BaseClientProxy *src, Direction srcSide,
if (x >= 0) {
break;
}
LOG((CLOG_DEBUG2 "skipping over screen %s", getName(dst).c_str()));
LOG_DEBUG2("skipping over screen %s", getName(dst).c_str());
dst = getNeighbor(lastGoodScreen, srcSide, x, y);
}
assert(lastGoodScreen != nullptr);
@ -646,7 +646,7 @@ BaseClientProxy *Server::mapToNeighbor(BaseClientProxy *src, Direction srcSide,
if (x < dw) {
break;
}
LOG((CLOG_DEBUG2 "skipping over screen %s", getName(dst).c_str()));
LOG_DEBUG2("skipping over screen %s", getName(dst).c_str());
dst = getNeighbor(lastGoodScreen, srcSide, x, y);
}
assert(lastGoodScreen != nullptr);
@ -662,7 +662,7 @@ BaseClientProxy *Server::mapToNeighbor(BaseClientProxy *src, Direction srcSide,
if (y >= 0) {
break;
}
LOG((CLOG_DEBUG2 "skipping over screen %s", getName(dst).c_str()));
LOG_DEBUG2("skipping over screen %s", getName(dst).c_str());
dst = getNeighbor(lastGoodScreen, srcSide, x, y);
}
assert(lastGoodScreen != nullptr);
@ -678,7 +678,7 @@ BaseClientProxy *Server::mapToNeighbor(BaseClientProxy *src, Direction srcSide,
if (y < dh) {
break;
}
LOG((CLOG_DEBUG2 "skipping over screen %s", getName(dst).c_str()));
LOG_DEBUG2("skipping over screen %s", getName(dst).c_str());
dst = getNeighbor(lastGoodScreen, srcSide, x, y);
}
assert(lastGoodScreen != nullptr);
@ -753,13 +753,13 @@ bool Server::isSwitchOkay(
BaseClientProxy *newScreen, Direction dir, int32_t x, int32_t y, int32_t xActive, int32_t yActive
)
{
LOG((CLOG_DEBUG1 "try to leave \"%s\" on %s", getName(m_active).c_str(), Config::dirName(dir)));
LOG_DEBUG1("try to leave \"%s\" on %s", getName(m_active).c_str(), Config::dirName(dir));
// is there a neighbor?
if (newScreen == nullptr) {
// there's no neighbor. we don't want to switch and we don't
// want to try to switch later.
LOG((CLOG_DEBUG1 "no neighbor %s", Config::dirName(dir)));
LOG_DEBUG1("no neighbor %s", Config::dirName(dir));
stopSwitch();
return false;
}
@ -816,7 +816,7 @@ bool Server::isSwitchOkay(
// see if we're in a locked corner
if ((getCorner(m_active, xActive, yActive, size) & corners) != 0) {
// yep, no switching
LOG((CLOG_DEBUG1 "locked in corner"));
LOG_DEBUG1("locked in corner");
preventSwitch = true;
stopSwitch();
}
@ -824,7 +824,7 @@ bool Server::isSwitchOkay(
// ignore if mouse is locked to screen and don't try to switch later
if (!preventSwitch && isLockedToScreen()) {
LOG((CLOG_DEBUG1 "locked to screen"));
LOG_DEBUG1("locked to screen");
preventSwitch = true;
stopSwitch();
}
@ -834,7 +834,7 @@ bool Server::isSwitchOkay(
!preventSwitch && ((this->m_switchNeedsShift && ((mods & KeyModifierShift) != KeyModifierShift)) ||
(this->m_switchNeedsControl && ((mods & KeyModifierControl) != KeyModifierControl)) ||
(this->m_switchNeedsAlt && ((mods & KeyModifierAlt) != KeyModifierAlt)))) {
LOG((CLOG_DEBUG1 "need modifiers to switch"));
LOG_DEBUG1("need modifiers to switch");
preventSwitch = true;
stopSwitch();
}
@ -863,7 +863,7 @@ void Server::startSwitchTwoTap()
m_switchTwoTapEngaged = true;
m_switchTwoTapArmed = false;
m_switchTwoTapTimer.reset();
LOG((CLOG_DEBUG1 "waiting for second tap"));
LOG_DEBUG1("waiting for second tap");
}
void Server::armSwitchTwoTap(int32_t x, int32_t y)
@ -938,7 +938,7 @@ void Server::startSwitchWait(int32_t x, int32_t y)
m_switchWaitX = x;
m_switchWaitY = y;
m_switchWaitTimer = m_events->newOneShotTimer(m_switchWaitDelay, this);
LOG((CLOG_DEBUG1 "waiting to switch"));
LOG_DEBUG1("waiting to switch");
}
void Server::stopSwitchWait()
@ -1021,7 +1021,7 @@ void Server::stopRelativeMoves()
m_yDelta = 0;
m_xDelta2 = 0;
m_yDelta2 = 0;
LOG((CLOG_DEBUG2 "synchronize move on %s by %d,%d", getName(m_active).c_str(), m_x, m_y));
LOG_DEBUG2("synchronize move on %s by %d,%d", getName(m_active).c_str(), m_x, m_y);
m_active->mouseMove(m_x, m_y);
}
}
@ -1107,13 +1107,15 @@ void Server::processOptions()
} else if (id == kOptionClipboardSharing) {
m_enableClipboard = value;
if (!m_enableClipboard) {
LOG((CLOG_NOTE "clipboard sharing is disabled"));
LOG_NOTE("clipboard sharing is disabled");
}
} else if (id == kOptionClipboardSharingSize) {
if (value <= 0) {
m_maximumClipboardSize = 0;
LOG((CLOG_NOTE "clipboard sharing is disabled because the "
"maximum shared clipboard size is set to 0"));
LOG_NOTE(
"clipboard sharing is disabled because the "
"maximum shared clipboard size is set to 0"
);
} else {
m_maximumClipboardSize = static_cast<size_t>(value);
}
@ -1131,7 +1133,7 @@ void Server::handleShapeChanged(BaseClientProxy *client)
return;
}
LOG((CLOG_DEBUG "screen \"%s\" shape changed", getName(client).c_str()));
LOG_DEBUG("screen \"%s\" shape changed", getName(client).c_str());
// update jump coordinate
int32_t x;
@ -1273,7 +1275,7 @@ void Server::handleSwitchWaitTimeout()
{
// ignore if mouse is locked to screen
if (isLockedToScreen()) {
LOG((CLOG_DEBUG1 "locked to screen"));
LOG_DEBUG1("locked to screen");
stopSwitch();
return;
}
@ -1295,7 +1297,7 @@ void Server::handleClientDisconnected(BaseClientProxy *client)
void Server::handleClientCloseTimeout(BaseClientProxy *client)
{
// client took too long to disconnect. just dump it.
LOG((CLOG_NOTE "forced disconnection of client \"%s\"", getName(client).c_str()));
LOG_NOTE("forced disconnection of client \"%s\"", getName(client).c_str());
removeOldClient(client);
delete client;
@ -1307,7 +1309,7 @@ void Server::handleSwitchToScreenEvent(const Event &event)
ClientList::const_iterator index = m_clients.find(info->m_screen);
if (index == m_clients.end()) {
LOG((CLOG_DEBUG1 "screen \"%s\" not active", info->m_screen));
LOG_DEBUG1("screen \"%s\" not active", info->m_screen);
} else {
jumpToScreen(index->second);
}
@ -1322,7 +1324,7 @@ void Server::handleSwitchInDirectionEvent(const Event &event)
int32_t y = m_y;
BaseClientProxy *newScreen = getNeighbor(m_active, info->m_direction, x, y);
if (newScreen == nullptr) {
LOG((CLOG_DEBUG1 "no neighbor %s", Config::dirName(info->m_direction)));
LOG_DEBUG1("no neighbor %s", Config::dirName(info->m_direction));
} else {
jumpToScreen(newScreen);
}
@ -1384,7 +1386,7 @@ void Server::handleLockCursorToScreenEvent(const Event &event)
// enter new state
if (newState != m_lockedToScreen) {
m_lockedToScreen = newState;
LOG((CLOG_NOTE "cursor %s current screen", m_lockedToScreen ? "locked to" : "unlocked from"));
LOG_NOTE("cursor %s current screen", m_lockedToScreen ? "locked to" : "unlocked from");
m_primaryClient->reconfigure(getActivePrimarySides());
if (!isLockedToScreenServer()) {
@ -1440,7 +1442,7 @@ void Server::onClipboardChanged(const BaseClientProxy *sender, ClipboardID id, u
void Server::onScreensaver(bool activated)
{
LOG((CLOG_DEBUG "onScreenSaver %s", activated ? "activated" : "deactivated"));
LOG_DEBUG("onScreenSaver %s", activated ? "activated" : "deactivated");
if (activated) {
// save current screen and position
@ -1493,7 +1495,7 @@ void Server::onScreensaver(bool activated)
void Server::onKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std::string &lang, const char *screens)
{
LOG((CLOG_DEBUG1 "onKeyDown id=%d mask=0x%04x button=0x%04x lang=%s", id, mask, button, lang.c_str()));
LOG_DEBUG1("onKeyDown id=%d mask=0x%04x button=0x%04x lang=%s", id, mask, button, lang.c_str());
assert(m_active != nullptr);
// relay
@ -1516,7 +1518,7 @@ void Server::onKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const s
void Server::onKeyUp(KeyID id, KeyModifierMask mask, KeyButton button, const char *screens)
{
LOG((CLOG_DEBUG1 "onKeyUp id=%d mask=0x%04x button=0x%04x", id, mask, button));
LOG_DEBUG1("onKeyUp id=%d mask=0x%04x button=0x%04x", id, mask, button);
assert(m_active != nullptr);
// relay
@ -1551,7 +1553,7 @@ void Server::onKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButto
void Server::onMouseDown(ButtonID id)
{
LOG((CLOG_DEBUG1 "onMouseDown id=%d", id));
LOG_DEBUG1("onMouseDown id=%d", id);
assert(m_active != nullptr);
// relay
@ -1560,7 +1562,7 @@ void Server::onMouseDown(ButtonID id)
void Server::onMouseUp(ButtonID id)
{
LOG((CLOG_DEBUG1 "onMouseUp id=%d", id));
LOG_DEBUG1("onMouseUp id=%d", id);
assert(m_active != nullptr);
// relay
@ -1569,7 +1571,7 @@ void Server::onMouseUp(ButtonID id)
bool Server::onMouseMovePrimary(int32_t x, int32_t y)
{
LOG((CLOG_DEBUG4 "onMouseMovePrimary %d,%d", x, y));
LOG_DEBUG4("onMouseMovePrimary %d,%d", x, y);
// mouse move on primary (server's) screen
if (m_active != m_primaryClient) {
@ -1695,7 +1697,7 @@ void Server::onMouseMoveSecondary(int32_t dx, int32_t dy)
// program on the secondary screen to warp the mouse on us, so we
// have no idea where it really is.
if (m_relativeMoves && isLockedToScreenServer()) {
LOG((CLOG_DEBUG2 "relative move on %s by %d,%d", getName(m_active).c_str(), dx, dy));
LOG_DEBUG2("relative move on %s by %d,%d", getName(m_active).c_str(), dx, dy);
m_active->mouseRelativeMove(dx, dy);
return;
}
@ -1815,22 +1817,22 @@ void Server::onMouseMoveSecondary(int32_t dx, int32_t dy)
m_y = yOld + dy;
if (m_x < ax) {
m_x = ax;
LOG((CLOG_DEBUG2 "clamp to left of \"%s\"", getName(m_active).c_str()));
LOG_DEBUG2("clamp to left of \"%s\"", getName(m_active).c_str());
} else if (m_x > ax + aw - 1) {
m_x = ax + aw - 1;
LOG((CLOG_DEBUG2 "clamp to right of \"%s\"", getName(m_active).c_str()));
LOG_DEBUG2("clamp to right of \"%s\"", getName(m_active).c_str());
}
if (m_y < ay) {
m_y = ay;
LOG((CLOG_DEBUG2 "clamp to top of \"%s\"", getName(m_active).c_str()));
LOG_DEBUG2("clamp to top of \"%s\"", getName(m_active).c_str());
} else if (m_y > ay + ah - 1) {
m_y = ay + ah - 1;
LOG((CLOG_DEBUG2 "clamp to bottom of \"%s\"", getName(m_active).c_str()));
LOG_DEBUG2("clamp to bottom of \"%s\"", getName(m_active).c_str());
}
// warp cursor if it moved.
if (m_x != xOld || m_y != yOld) {
LOG((CLOG_DEBUG2 "move on %s to %d,%d", getName(m_active).c_str(), m_x, m_y));
LOG_DEBUG2("move on %s to %d,%d", getName(m_active).c_str(), m_x, m_y);
m_active->mouseMove(m_x, m_y);
}
}
@ -1838,7 +1840,7 @@ void Server::onMouseMoveSecondary(int32_t dx, int32_t dy)
void Server::onMouseWheel(int32_t xDelta, int32_t yDelta)
{
LOG((CLOG_DEBUG1 "onMouseWheel %+d,%+d", xDelta, yDelta));
LOG_DEBUG1("onMouseWheel %+d,%+d", xDelta, yDelta);
assert(m_active != nullptr);
// relay
@ -1913,7 +1915,7 @@ void Server::closeClient(BaseClientProxy *client, const char *msg)
// note that this method also works on clients that are not in
// the m_clients list. adoptClient() may call us with such a
// client.
LOG((CLOG_NOTE "disconnecting client \"%s\"", getName(client).c_str()));
LOG_NOTE("disconnecting client \"%s\"", getName(client).c_str());
// send message
// FIXME -- avoid type cast (kinda hard, though)

View File

@ -123,7 +123,7 @@ bool OSXKeyStateTests::isKeyPressed(const OSXKeyState &keyState, KeyButton butto
IKeyState::KeyButtonSet::const_iterator it;
for (it = pressed.begin(); it != pressed.end(); ++it) {
LOG((CLOG_DEBUG "checking key %d", *it));
LOG_DEBUG("checking key %d", *it);
if (*it == button) {
return true;
}