mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-23 20:31:47 +08:00
Changed log() and logc() macros to LOG() and LOGC(), respectively.
This avoids a conflict with the standard math library log() function.
This commit is contained in:
@@ -38,10 +38,10 @@ CMSWindowsClipboard::~CMSWindowsClipboard()
|
||||
bool
|
||||
CMSWindowsClipboard::empty()
|
||||
{
|
||||
log((CLOG_DEBUG "empty clipboard"));
|
||||
LOG((CLOG_DEBUG "empty clipboard"));
|
||||
|
||||
if (!EmptyClipboard()) {
|
||||
log((CLOG_DEBUG "failed to grab clipboard"));
|
||||
LOG((CLOG_DEBUG "failed to grab clipboard"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ CMSWindowsClipboard::empty()
|
||||
void
|
||||
CMSWindowsClipboard::add(EFormat format, const CString& data)
|
||||
{
|
||||
log((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
|
||||
LOG((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format));
|
||||
|
||||
// convert data to win32 form
|
||||
for (ConverterList::const_iterator index = m_converters.begin();
|
||||
@@ -76,10 +76,10 @@ CMSWindowsClipboard::add(EFormat format, const CString& data)
|
||||
bool
|
||||
CMSWindowsClipboard::open(Time time) const
|
||||
{
|
||||
log((CLOG_DEBUG "open clipboard"));
|
||||
LOG((CLOG_DEBUG "open clipboard"));
|
||||
|
||||
if (!OpenClipboard(m_window)) {
|
||||
log((CLOG_WARN "failed to open clipboard"));
|
||||
LOG((CLOG_WARN "failed to open clipboard"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ CMSWindowsClipboard::open(Time time) const
|
||||
void
|
||||
CMSWindowsClipboard::close() const
|
||||
{
|
||||
log((CLOG_DEBUG "close clipboard"));
|
||||
LOG((CLOG_DEBUG "close clipboard"));
|
||||
CloseClipboard();
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ CMSWindowsScreen::open()
|
||||
assert(s_instance != NULL);
|
||||
assert(m_class == 0);
|
||||
|
||||
log((CLOG_DEBUG "opening display"));
|
||||
LOG((CLOG_DEBUG "opening display"));
|
||||
|
||||
// create the transparent cursor
|
||||
createBlankCursor();
|
||||
@@ -253,7 +253,7 @@ CMSWindowsScreen::close()
|
||||
m_cursor = NULL;
|
||||
}
|
||||
|
||||
log((CLOG_DEBUG "closed display"));
|
||||
LOG((CLOG_DEBUG "closed display"));
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -349,7 +349,7 @@ CMSWindowsScreen::syncDesktop()
|
||||
// change calling thread's desktop
|
||||
if (!m_is95Family) {
|
||||
if (SetThreadDesktop(m_desk) == 0) {
|
||||
// log((CLOG_WARN "failed to set desktop: %d", GetLastError()));
|
||||
// LOG((CLOG_WARN "failed to set desktop: %d", GetLastError()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ CMSWindowsScreen::updateScreenShape()
|
||||
m_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||
m_w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||
m_h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||
log((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
|
||||
LOG((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
|
||||
|
||||
// check for multiple monitors
|
||||
m_multimon = (m_w != GetSystemMetrics(SM_CXSCREEN) ||
|
||||
@@ -504,7 +504,7 @@ CMSWindowsScreen::onEvent(CEvent* event)
|
||||
return true;
|
||||
|
||||
case WM_DRAWCLIPBOARD:
|
||||
log((CLOG_DEBUG "clipboard was taken"));
|
||||
LOG((CLOG_DEBUG "clipboard was taken"));
|
||||
|
||||
// first pass it on
|
||||
if (m_nextClipboardWindow != NULL) {
|
||||
@@ -615,7 +615,7 @@ CMSWindowsScreen::switchDesktop(HDESK desk)
|
||||
|
||||
// if no new desktop then we're done
|
||||
if (desk == NULL) {
|
||||
log((CLOG_INFO "disconnecting desktop"));
|
||||
LOG((CLOG_INFO "disconnecting desktop"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ CMSWindowsScreen::switchDesktop(HDESK desk)
|
||||
// set the desktop. can only do this when there are no windows
|
||||
// and hooks on the current desktop owned by this thread.
|
||||
if (SetThreadDesktop(desk) == 0) {
|
||||
log((CLOG_ERR "failed to set desktop: %d", GetLastError()));
|
||||
LOG((CLOG_ERR "failed to set desktop: %d", GetLastError()));
|
||||
if (!m_is95Family) {
|
||||
CloseDesktop(desk);
|
||||
}
|
||||
@@ -648,7 +648,7 @@ CMSWindowsScreen::switchDesktop(HDESK desk)
|
||||
getInstance(),
|
||||
NULL);
|
||||
if (m_window == NULL) {
|
||||
log((CLOG_ERR "failed to create window: %d", GetLastError()));
|
||||
LOG((CLOG_ERR "failed to create window: %d", GetLastError()));
|
||||
if (!m_is95Family) {
|
||||
CloseDesktop(desk);
|
||||
}
|
||||
@@ -675,7 +675,7 @@ CMSWindowsScreen::switchDesktop(HDESK desk)
|
||||
// save new desktop
|
||||
m_desk = desk;
|
||||
m_deskName = getDesktopName(m_desk);
|
||||
log((CLOG_INFO "switched to desktop \"%s\"", m_deskName.c_str()));
|
||||
LOG((CLOG_INFO "switched to desktop \"%s\"", m_deskName.c_str()));
|
||||
|
||||
// let client prepare the window
|
||||
m_eventHandler->postCreateWindow(m_window);
|
||||
|
||||
@@ -73,7 +73,7 @@ CMSWindowsScreenSaver::checkStarted(UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
HWND hwnd = findScreenSaver();
|
||||
if (hwnd == NULL) {
|
||||
// didn't start
|
||||
log((CLOG_DEBUG "can't find screen saver window"));
|
||||
LOG((CLOG_DEBUG "can't find screen saver window"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ CMSWindowsScreenSaver::checkStarted(UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, processID);
|
||||
if (process == NULL) {
|
||||
// didn't start
|
||||
log((CLOG_DEBUG "can't open screen saver process"));
|
||||
LOG((CLOG_DEBUG "can't open screen saver process"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ CMSWindowsScreenSaver::watchProcess(HANDLE process)
|
||||
|
||||
// watch new process in another thread
|
||||
if (process != NULL) {
|
||||
log((CLOG_DEBUG "watching screen saver process"));
|
||||
LOG((CLOG_DEBUG "watching screen saver process"));
|
||||
m_process = process;
|
||||
m_watch = new CThread(new TMethodJob<CMSWindowsScreenSaver>(this,
|
||||
&CMSWindowsScreenSaver::watchProcessThread));
|
||||
@@ -284,7 +284,7 @@ void
|
||||
CMSWindowsScreenSaver::unwatchProcess()
|
||||
{
|
||||
if (m_watch != NULL) {
|
||||
log((CLOG_DEBUG "stopped watching screen saver process"));
|
||||
LOG((CLOG_DEBUG "stopped watching screen saver process"));
|
||||
m_watch->cancel();
|
||||
m_watch->wait();
|
||||
delete m_watch;
|
||||
@@ -304,7 +304,7 @@ CMSWindowsScreenSaver::watchProcessThread(void*)
|
||||
if (WaitForSingleObject(m_process, 50) == WAIT_OBJECT_0) {
|
||||
// process terminated. send screen saver deactivation
|
||||
// message.
|
||||
log((CLOG_DEBUG "screen saver died"));
|
||||
LOG((CLOG_DEBUG "screen saver died"));
|
||||
PostThreadMessage(m_threadID, m_msg, m_wParam, m_lParam);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ CWin32Platform::isWindows95Family()
|
||||
OSVERSIONINFO version;
|
||||
version.dwOSVersionInfoSize = sizeof(version);
|
||||
if (GetVersionEx(&version) == 0) {
|
||||
log((CLOG_WARN "cannot determine OS: %d", GetLastError()));
|
||||
LOG((CLOG_WARN "cannot determine OS: %d", GetLastError()));
|
||||
return true;
|
||||
}
|
||||
return (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
|
||||
@@ -103,7 +103,7 @@ CWin32Platform::installDaemon(const char* name, const char* description,
|
||||
HKEY key = isWindows95Family() ? open95ServicesKey() :
|
||||
openUserStartupKey();
|
||||
if (key == NULL) {
|
||||
log((CLOG_ERR "cannot open registry key", GetLastError()));
|
||||
LOG((CLOG_ERR "cannot open registry key", GetLastError()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ CWin32Platform::installDaemon(const char* name, const char* description,
|
||||
// open service manager
|
||||
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_WRITE);
|
||||
if (mgr == NULL) {
|
||||
log((CLOG_ERR "OpenSCManager failed with %d", GetLastError()));
|
||||
LOG((CLOG_ERR "OpenSCManager failed with %d", GetLastError()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ CWin32Platform::installDaemon(const char* name, const char* description,
|
||||
else {
|
||||
// FIXME -- handle ERROR_SERVICE_EXISTS
|
||||
|
||||
log((CLOG_ERR "CreateService failed with %d", GetLastError()));
|
||||
LOG((CLOG_ERR "CreateService failed with %d", GetLastError()));
|
||||
CloseServiceHandle(mgr);
|
||||
return false;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ CWin32Platform::uninstallDaemon(const char* name, bool allUsers)
|
||||
HKEY key = isWindows95Family() ? open95ServicesKey() :
|
||||
openUserStartupKey();
|
||||
if (key == NULL) {
|
||||
log((CLOG_ERR "cannot open registry key", GetLastError()));
|
||||
LOG((CLOG_ERR "cannot open registry key", GetLastError()));
|
||||
return kAlready;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ CWin32Platform::uninstallDaemon(const char* name, bool allUsers)
|
||||
// open service manager
|
||||
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_WRITE);
|
||||
if (mgr == NULL) {
|
||||
log((CLOG_ERR "OpenSCManager failed with %d", GetLastError()));
|
||||
LOG((CLOG_ERR "OpenSCManager failed with %d", GetLastError()));
|
||||
return kFailed;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ CWin32Platform::uninstallDaemon(const char* name, bool allUsers)
|
||||
SC_HANDLE service = OpenService(mgr, name, DELETE);
|
||||
if (service == NULL) {
|
||||
const DWORD e = GetLastError();
|
||||
log((CLOG_ERR "OpenService failed with %d", e));
|
||||
LOG((CLOG_ERR "OpenService failed with %d", e));
|
||||
result = (e == ERROR_SERVICE_DOES_NOT_EXIST) ? kAlready : kFailed;
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ CWin32Platform::daemonize(const char* name, DaemonFunc func)
|
||||
// user logs off.
|
||||
HINSTANCE kernel = LoadLibrary("kernel32.dll");
|
||||
if (kernel == NULL) {
|
||||
log((CLOG_ERR "LoadLibrary failed with %d", GetLastError()));
|
||||
LOG((CLOG_ERR "LoadLibrary failed with %d", GetLastError()));
|
||||
return -1;
|
||||
}
|
||||
RegisterServiceProcessT RegisterServiceProcess =
|
||||
@@ -286,12 +286,12 @@ CWin32Platform::daemonize(const char* name, DaemonFunc func)
|
||||
GetProcAddress(kernel,
|
||||
_T("RegisterServiceProcess")));
|
||||
if (RegisterServiceProcess == NULL) {
|
||||
log((CLOG_ERR "can't lookup RegisterServiceProcess: %d", GetLastError()));
|
||||
LOG((CLOG_ERR "can't lookup RegisterServiceProcess: %d", GetLastError()));
|
||||
FreeLibrary(kernel);
|
||||
return -1;
|
||||
}
|
||||
if (RegisterServiceProcess(NULL, 1) == 0) {
|
||||
log((CLOG_ERR "RegisterServiceProcess failed with %d", GetLastError()));
|
||||
LOG((CLOG_ERR "RegisterServiceProcess failed with %d", GetLastError()));
|
||||
FreeLibrary(kernel);
|
||||
return -1;
|
||||
}
|
||||
@@ -320,7 +320,7 @@ CWin32Platform::daemonize(const char* name, DaemonFunc func)
|
||||
s_daemonPlatform = NULL;
|
||||
return m_daemonResult;
|
||||
}
|
||||
log((CLOG_ERR "StartServiceCtrlDispatcher failed with %d", GetLastError()));
|
||||
LOG((CLOG_ERR "StartServiceCtrlDispatcher failed with %d", GetLastError()));
|
||||
s_daemonPlatform = NULL;
|
||||
return -1;
|
||||
}
|
||||
@@ -943,7 +943,7 @@ CWin32Platform::serviceHandler(DWORD ctrl)
|
||||
break;
|
||||
|
||||
default:
|
||||
log((CLOG_WARN "unknown service command: %d", ctrl));
|
||||
LOG((CLOG_WARN "unknown service command: %d", ctrl));
|
||||
// fall through
|
||||
|
||||
case SERVICE_CONTROL_INTERROGATE:
|
||||
|
||||
@@ -93,7 +93,7 @@ CXWindowsClipboard::~CXWindowsClipboard()
|
||||
void
|
||||
CXWindowsClipboard::lost(Time time)
|
||||
{
|
||||
log((CLOG_DEBUG "lost clipboard %d ownership at %d", m_id, time));
|
||||
LOG((CLOG_DEBUG "lost clipboard %d ownership at %d", m_id, time));
|
||||
if (m_owner) {
|
||||
m_owner = false;
|
||||
m_timeLost = time;
|
||||
@@ -109,7 +109,7 @@ CXWindowsClipboard::addRequest(Window owner, Window requestor,
|
||||
// at the given time.
|
||||
bool success = false;
|
||||
if (owner == m_window) {
|
||||
log((CLOG_DEBUG1 "request for clipboard %d, target %d by 0x%08x (property=%d)", m_selection, target, requestor, property));
|
||||
LOG((CLOG_DEBUG1 "request for clipboard %d, target %d by 0x%08x (property=%d)", m_selection, target, requestor, property));
|
||||
if (wasOwnedAtTime(time)) {
|
||||
if (target == m_atomMultiple) {
|
||||
// add a multiple request. property may not be None
|
||||
@@ -126,13 +126,13 @@ CXWindowsClipboard::addRequest(Window owner, Window requestor,
|
||||
}
|
||||
}
|
||||
else {
|
||||
log((CLOG_DEBUG1 "failed, not owned at time %d", time));
|
||||
LOG((CLOG_DEBUG1 "failed, not owned at time %d", time));
|
||||
}
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
// send failure
|
||||
log((CLOG_DEBUG1 "failed"));
|
||||
LOG((CLOG_DEBUG1 "failed"));
|
||||
insertReply(new CReply(requestor, target, time));
|
||||
}
|
||||
|
||||
@@ -180,14 +180,14 @@ CXWindowsClipboard::addSimpleRequest(Window requestor,
|
||||
|
||||
if (type != None) {
|
||||
// success
|
||||
log((CLOG_DEBUG1 "success"));
|
||||
LOG((CLOG_DEBUG1 "success"));
|
||||
insertReply(new CReply(requestor, target, time,
|
||||
property, data, type, format));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// failure
|
||||
log((CLOG_DEBUG1 "failed"));
|
||||
LOG((CLOG_DEBUG1 "failed"));
|
||||
insertReply(new CReply(requestor, target, time));
|
||||
return false;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ CXWindowsClipboard::processRequest(Window requestor,
|
||||
// unknown requestor window
|
||||
return false;
|
||||
}
|
||||
log((CLOG_DEBUG1 "received property %d delete from 0x08%x", property, requestor));
|
||||
LOG((CLOG_DEBUG1 "received property %d delete from 0x08%x", property, requestor));
|
||||
|
||||
// find the property in the known requests. it should be the
|
||||
// first property but we'll check 'em all if we have to.
|
||||
@@ -257,12 +257,12 @@ CXWindowsClipboard::empty()
|
||||
{
|
||||
assert(m_open);
|
||||
|
||||
log((CLOG_DEBUG "empty clipboard %d", m_id));
|
||||
LOG((CLOG_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_DEBUG "failed to grab clipboard %d", m_id));
|
||||
LOG((CLOG_DEBUG "failed to grab clipboard %d", m_id));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ CXWindowsClipboard::empty()
|
||||
|
||||
// we're the owner now
|
||||
m_owner = true;
|
||||
log((CLOG_DEBUG "grabbed clipboard %d", m_id));
|
||||
LOG((CLOG_DEBUG "grabbed clipboard %d", m_id));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ CXWindowsClipboard::add(EFormat format, const CString& data)
|
||||
assert(m_open);
|
||||
assert(m_owner);
|
||||
|
||||
log((CLOG_DEBUG "add %d bytes to clipboard %d format: %d", data.size(), m_id, format));
|
||||
LOG((CLOG_DEBUG "add %d bytes to clipboard %d format: %d", data.size(), m_id, format));
|
||||
|
||||
m_data[format] = data;
|
||||
m_added[format] = true;
|
||||
@@ -304,7 +304,7 @@ CXWindowsClipboard::open(Time time) const
|
||||
{
|
||||
assert(!m_open);
|
||||
|
||||
log((CLOG_DEBUG "open clipboard %d", m_id));
|
||||
LOG((CLOG_DEBUG "open clipboard %d", m_id));
|
||||
|
||||
// assume not motif
|
||||
m_motif = false;
|
||||
@@ -318,7 +318,7 @@ CXWindowsClipboard::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((CLOG_DEBUG1 "motif does %sown clipboard", m_motif ? "" : "not "));
|
||||
if (!m_motif) {
|
||||
motifUnlockClipboard();
|
||||
}
|
||||
@@ -339,7 +339,7 @@ CXWindowsClipboard::close() const
|
||||
{
|
||||
assert(m_open);
|
||||
|
||||
log((CLOG_DEBUG "close clipboard %d", m_id));
|
||||
LOG((CLOG_DEBUG "close clipboard %d", m_id));
|
||||
|
||||
// unlock clipboard
|
||||
if (m_motif) {
|
||||
@@ -397,14 +397,14 @@ CXWindowsClipboard::getConverter(Atom target, bool onlyIfNotAdded) const
|
||||
}
|
||||
}
|
||||
if (converter == NULL) {
|
||||
log((CLOG_DEBUG1 " no converter for target %d", target));
|
||||
LOG((CLOG_DEBUG1 " no converter for target %d", target));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// optionally skip already handled targets
|
||||
if (onlyIfNotAdded) {
|
||||
if (m_added[converter->getFormat()]) {
|
||||
log((CLOG_DEBUG1 " skipping handled format %d", converter->getFormat()));
|
||||
LOG((CLOG_DEBUG1 " skipping handled format %d", converter->getFormat()));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -484,7 +484,7 @@ CXWindowsClipboard::doFillCache()
|
||||
void
|
||||
CXWindowsClipboard::icccmFillCache()
|
||||
{
|
||||
log((CLOG_DEBUG "ICCCM fill clipboard %d", m_id));
|
||||
LOG((CLOG_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.
|
||||
@@ -493,7 +493,7 @@ CXWindowsClipboard::icccmFillCache()
|
||||
CString data;
|
||||
if (!icccmGetSelection(atomTargets, &target, &data) ||
|
||||
target != m_atomAtom) {
|
||||
log((CLOG_DEBUG1 "selection doesn't support TARGETS"));
|
||||
LOG((CLOG_DEBUG1 "selection doesn't support TARGETS"));
|
||||
data = "";
|
||||
|
||||
target = XA_STRING;
|
||||
@@ -529,7 +529,7 @@ CXWindowsClipboard::icccmFillCache()
|
||||
Atom actualTarget;
|
||||
CString targetData;
|
||||
if (!icccmGetSelection(target, &actualTarget, &targetData)) {
|
||||
log((CLOG_DEBUG1 " no data for target %d", target));
|
||||
LOG((CLOG_DEBUG1 " no data for target %d", target));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ CXWindowsClipboard::icccmFillCache()
|
||||
IClipboard::EFormat format = converter->getFormat();
|
||||
m_data[format] = converter->toIClipboard(targetData);
|
||||
m_added[format] = true;
|
||||
log((CLOG_DEBUG " added format %d for target %d", format, target));
|
||||
LOG((CLOG_DEBUG " added format %d for target %d", format, target));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,12 +552,12 @@ CXWindowsClipboard::icccmGetSelection(Atom target,
|
||||
CICCCMGetClipboard getter(m_window, m_time, m_atomData);
|
||||
if (!getter.readClipboard(m_display, m_selection,
|
||||
target, actualTarget, data)) {
|
||||
log((CLOG_DEBUG1 "can't get data for selection target %d", target));
|
||||
logc(getter.m_error, (CLOG_WARN "ICCCM violation by clipboard owner"));
|
||||
LOG((CLOG_DEBUG1 "can't get data for selection target %d", target));
|
||||
LOGC(getter.m_error, (CLOG_WARN "ICCCM violation by clipboard owner"));
|
||||
return false;
|
||||
}
|
||||
else if (*actualTarget == None) {
|
||||
log((CLOG_DEBUG1 "selection conversion failed for target %d", target));
|
||||
LOG((CLOG_DEBUG1 "selection conversion failed for target %d", target));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -571,12 +571,12 @@ CXWindowsClipboard::icccmGetTime() const
|
||||
if (icccmGetSelection(m_atomTimestamp, &actualTarget, &data) &&
|
||||
actualTarget == m_atomInteger) {
|
||||
Time time = *reinterpret_cast<const Time*>(data.data());
|
||||
log((CLOG_DEBUG1 "got ICCCM time %d", time));
|
||||
LOG((CLOG_DEBUG1 "got ICCCM time %d", time));
|
||||
return time;
|
||||
}
|
||||
else {
|
||||
// no timestamp
|
||||
log((CLOG_DEBUG1 "can't get ICCCM time"));
|
||||
LOG((CLOG_DEBUG1 "can't get ICCCM time"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -587,7 +587,7 @@ CXWindowsClipboard::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((CLOG_DEBUG1 "motif lock owner 0x%08x", lockOwner));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -599,18 +599,18 @@ CXWindowsClipboard::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((CLOG_DEBUG1 "motif lock owner 0x%08x", lockOwner));
|
||||
return false;
|
||||
}
|
||||
|
||||
log((CLOG_DEBUG1 "locked motif clipboard"));
|
||||
LOG((CLOG_DEBUG1 "locked motif clipboard"));
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsClipboard::motifUnlockClipboard() const
|
||||
{
|
||||
log((CLOG_DEBUG1 "unlocked motif clipboard"));
|
||||
LOG((CLOG_DEBUG1 "unlocked motif clipboard"));
|
||||
|
||||
// fail if we don't own the lock
|
||||
Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock);
|
||||
@@ -662,7 +662,7 @@ CXWindowsClipboard::motifOwnsClipboard() const
|
||||
void
|
||||
CXWindowsClipboard::motifFillCache()
|
||||
{
|
||||
log((CLOG_DEBUG "Motif fill clipboard %d", m_id));
|
||||
LOG((CLOG_DEBUG "Motif fill clipboard %d", m_id));
|
||||
|
||||
// get the Motif clipboard header property from the root window
|
||||
Atom target;
|
||||
@@ -767,7 +767,7 @@ CXWindowsClipboard::motifFillCache()
|
||||
Atom actualTarget;
|
||||
CString targetData;
|
||||
if (!motifGetSelection(motifFormat, &actualTarget, &targetData)) {
|
||||
log((CLOG_DEBUG1 " no data for target %d", target));
|
||||
LOG((CLOG_DEBUG1 " no data for target %d", target));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -775,7 +775,7 @@ CXWindowsClipboard::motifFillCache()
|
||||
IClipboard::EFormat format = converter->getFormat();
|
||||
m_data[format] = converter->toIClipboard(targetData);
|
||||
m_added[format] = true;
|
||||
log((CLOG_DEBUG " added format %d for target %d", format, target));
|
||||
LOG((CLOG_DEBUG " added format %d for target %d", format, target));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -957,14 +957,14 @@ CXWindowsClipboard::sendReply(CReply* reply)
|
||||
|
||||
// bail out immediately if reply is done
|
||||
if (reply->m_done) {
|
||||
log((CLOG_DEBUG1 "clipboard: finished reply to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
|
||||
LOG((CLOG_DEBUG1 "clipboard: finished reply to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
|
||||
return true;
|
||||
}
|
||||
|
||||
// start in failed state if property is None
|
||||
bool failed = (reply->m_property == None);
|
||||
if (!failed) {
|
||||
log((CLOG_DEBUG1 "clipboard: setting property on 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
|
||||
LOG((CLOG_DEBUG1 "clipboard: setting property on 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
|
||||
|
||||
// send using INCR if already sending incrementally or if reply
|
||||
// is too large, otherwise just send it.
|
||||
@@ -1013,7 +1013,7 @@ CXWindowsClipboard::sendReply(CReply* reply)
|
||||
// the final zero-length property.
|
||||
// FIXME -- how do you gracefully cancel an incremental transfer?
|
||||
if (failed) {
|
||||
log((CLOG_DEBUG1 "clipboard: sending failure to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
|
||||
LOG((CLOG_DEBUG1 "clipboard: sending failure to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
|
||||
reply->m_done = true;
|
||||
if (reply->m_property != None) {
|
||||
CXWindowsUtil::CErrorLock lock(m_display);
|
||||
@@ -1043,7 +1043,7 @@ CXWindowsClipboard::sendReply(CReply* reply)
|
||||
|
||||
// send notification if we haven't yet
|
||||
if (!reply->m_replied) {
|
||||
log((CLOG_DEBUG1 "clipboard: sending notify to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
|
||||
LOG((CLOG_DEBUG1 "clipboard: sending notify to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property));
|
||||
reply->m_replied = true;
|
||||
|
||||
// HACK -- work around apparent bug in lesstif, which doesn't
|
||||
@@ -1219,7 +1219,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
|
||||
assert(actualTarget != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
log((CLOG_DEBUG1 "request selection=%d, target=%d, window=%x", selection, target, m_requestor));
|
||||
LOG((CLOG_DEBUG1 "request selection=%d, target=%d, window=%x", selection, target, m_requestor));
|
||||
|
||||
// save output pointers
|
||||
m_actualTarget = actualTarget;
|
||||
@@ -1296,7 +1296,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
|
||||
XSelectInput(display, m_requestor, attr.your_event_mask);
|
||||
|
||||
// return success or failure
|
||||
log((CLOG_DEBUG1 "request %s", m_failed ? "failed" : "succeeded"));
|
||||
LOG((CLOG_DEBUG1 "request %s", m_failed ? "failed" : "succeeded"));
|
||||
return !m_failed;
|
||||
}
|
||||
|
||||
@@ -1387,14 +1387,14 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
|
||||
else if (m_incr) {
|
||||
// if first incremental chunk then save target
|
||||
if (oldSize == 0) {
|
||||
log((CLOG_DEBUG1 " INCR first chunk, target %d", target));
|
||||
LOG((CLOG_DEBUG1 " INCR first chunk, target %d", target));
|
||||
*m_actualTarget = target;
|
||||
}
|
||||
|
||||
// secondary chunks must have the same target
|
||||
else {
|
||||
if (target != *m_actualTarget) {
|
||||
log((CLOG_WARN " INCR target mismatch"));
|
||||
LOG((CLOG_WARN " INCR target mismatch"));
|
||||
m_failed = true;
|
||||
m_error = true;
|
||||
}
|
||||
@@ -1402,20 +1402,20 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
|
||||
|
||||
// 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((CLOG_DEBUG1 " INCR final chunk: %d bytes total", m_data->size()));
|
||||
m_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
// not incremental; save the target.
|
||||
else {
|
||||
log((CLOG_DEBUG1 " target %d", target));
|
||||
LOG((CLOG_DEBUG1 " target %d", target));
|
||||
*m_actualTarget = target;
|
||||
m_done = true;
|
||||
}
|
||||
|
||||
// this event has been processed
|
||||
logc(!m_incr, (CLOG_DEBUG1 " got data, %d bytes", m_data->size()));
|
||||
LOGC(!m_incr, (CLOG_DEBUG1 " got data, %d bytes", m_data->size()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ CXWindowsScreen::open()
|
||||
}
|
||||
|
||||
// open the display
|
||||
log((CLOG_DEBUG "XOpenDisplay(\"%s\")", display));
|
||||
LOG((CLOG_DEBUG "XOpenDisplay(\"%s\")", display));
|
||||
m_display = XOpenDisplay(display);
|
||||
if (m_display == NULL) {
|
||||
throw XScreenUnavailable(60.0);
|
||||
@@ -337,7 +337,7 @@ CXWindowsScreen::close()
|
||||
if (m_display != NULL) {
|
||||
XCloseDisplay(m_display);
|
||||
m_display = NULL;
|
||||
log((CLOG_DEBUG "closed display"));
|
||||
LOG((CLOG_DEBUG "closed display"));
|
||||
}
|
||||
XSetIOErrorHandler(NULL);
|
||||
}
|
||||
@@ -495,7 +495,7 @@ CXWindowsScreen::updateScreenShape()
|
||||
m_y = 0;
|
||||
m_w = WidthOfScreen(DefaultScreenOfDisplay(m_display));
|
||||
m_h = HeightOfScreen(DefaultScreenOfDisplay(m_display));
|
||||
log((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
|
||||
LOG((CLOG_INFO "screen shape: %d,%d %dx%d", m_x, m_y, m_w, m_h));
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -519,7 +519,7 @@ CXWindowsScreen::onPreDispatch(CEvent* event)
|
||||
// selection owner. report that to the receiver.
|
||||
ClipboardID id = getClipboardID(xevent->xselectionclear.selection);
|
||||
if (id != kClipboardEnd) {
|
||||
log((CLOG_DEBUG "lost clipboard %d ownership at time %d", id, xevent->xselectionclear.time));
|
||||
LOG((CLOG_DEBUG "lost clipboard %d ownership at time %d", id, xevent->xselectionclear.time));
|
||||
m_clipboard[id]->lost(xevent->xselectionclear.time);
|
||||
m_receiver->onGrabClipboard(id);
|
||||
return true;
|
||||
@@ -724,10 +724,10 @@ CXWindowsScreen::ioErrorHandler(Display*)
|
||||
// handle not having a Display* anymore. we'll simply log the
|
||||
// error, notify the subclass (which must not use the display
|
||||
// so we set it to NULL), and exit.
|
||||
log((CLOG_WARN "X display has unexpectedly disconnected"));
|
||||
LOG((CLOG_WARN "X display has unexpectedly disconnected"));
|
||||
s_screen->m_display = NULL;
|
||||
s_screen->m_receiver->onError();
|
||||
log((CLOG_CRIT "quiting due to X display disconnection"));
|
||||
LOG((CLOG_CRIT "quiting due to X display disconnection"));
|
||||
exit(17);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
|
||||
CWDontPropagate | CWEventMask |
|
||||
CWOverrideRedirect,
|
||||
&attr);
|
||||
log((CLOG_DEBUG "xscreensaver sink window is 0x%08x", m_xscreensaverSink));
|
||||
LOG((CLOG_DEBUG "xscreensaver sink window is 0x%08x", m_xscreensaverSink));
|
||||
|
||||
// watch top-level windows for changes
|
||||
{
|
||||
@@ -77,7 +77,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
|
||||
m_rootEventMask = attr.your_event_mask;
|
||||
XSelectInput(m_display, root, m_rootEventMask | SubstructureNotifyMask);
|
||||
if (error) {
|
||||
log((CLOG_DEBUG "didn't set root event mask"));
|
||||
LOG((CLOG_DEBUG "didn't set root event mask"));
|
||||
m_rootEventMask = 0;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ CXWindowsScreenSaver::onPreDispatch(const XEvent* xevent)
|
||||
case DestroyNotify:
|
||||
if (xevent->xdestroywindow.window == m_xscreensaver) {
|
||||
// xscreensaver is gone
|
||||
log((CLOG_DEBUG "xscreensaver died"));
|
||||
LOG((CLOG_DEBUG "xscreensaver died"));
|
||||
setXScreenSaver(None);
|
||||
return true;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ CXWindowsScreenSaver::findXScreenSaver()
|
||||
void
|
||||
CXWindowsScreenSaver::setXScreenSaver(Window window)
|
||||
{
|
||||
log((CLOG_DEBUG "xscreensaver window: 0x%08x", window));
|
||||
LOG((CLOG_DEBUG "xscreensaver window: 0x%08x", window));
|
||||
|
||||
// save window
|
||||
m_xscreensaver = window;
|
||||
@@ -342,7 +342,7 @@ void
|
||||
CXWindowsScreenSaver::setXScreenSaverActive(bool activated)
|
||||
{
|
||||
if (m_xscreensaverActive != activated) {
|
||||
log((CLOG_DEBUG "xscreensaver %s", activated ? "activated" : "deactivated"));
|
||||
LOG((CLOG_DEBUG "xscreensaver %s", activated ? "activated" : "deactivated"));
|
||||
m_xscreensaverActive = activated;
|
||||
sendNotify(activated);
|
||||
}
|
||||
@@ -363,7 +363,7 @@ CXWindowsScreenSaver::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((CLOG_DEBUG "send xscreensaver command: %d %d %d", (long)cmd, arg1, arg2));
|
||||
bool error = false;
|
||||
CXWindowsUtil::CErrorLock lock(m_display, &error);
|
||||
XSendEvent(m_display, m_xscreensaver, False, 0, &event);
|
||||
|
||||
@@ -99,11 +99,11 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window,
|
||||
}
|
||||
|
||||
if (result == Success) {
|
||||
log((CLOG_DEBUG1 "read property %d on window 0x%08x: bytes=%d", property, window, (data == NULL) ? 0 : data->size()));
|
||||
LOG((CLOG_DEBUG1 "read property %d on window 0x%08x: bytes=%d", property, window, (data == NULL) ? 0 : data->size()));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
log((CLOG_DEBUG1 "can't read property %d on window 0x%08x", property, window));
|
||||
LOG((CLOG_DEBUG1 "can't read property %d on window 0x%08x", property, window));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -265,12 +265,12 @@ CXWindowsUtil::CErrorLock::internalHandler(Display* display, XErrorEvent* event)
|
||||
void
|
||||
CXWindowsUtil::CErrorLock::ignoreHandler(Display*, XErrorEvent* e, void*)
|
||||
{
|
||||
log((CLOG_DEBUG1 "ignoring X error: %d", e->error_code));
|
||||
LOG((CLOG_DEBUG1 "ignoring X error: %d", e->error_code));
|
||||
}
|
||||
|
||||
void
|
||||
CXWindowsUtil::CErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag)
|
||||
{
|
||||
log((CLOG_DEBUG1 "flagging X error: %d", e->error_code));
|
||||
LOG((CLOG_DEBUG1 "flagging X error: %d", e->error_code));
|
||||
*reinterpret_cast<bool*>(flag) = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user