X11 clipboard logging now also prints atom names, not just numbers.

This commit is contained in:
crs
2004-05-01 16:10:09 +00:00
parent 3758d9d282
commit fddf7d04a3
3 changed files with 57 additions and 14 deletions

View File

@@ -15,6 +15,7 @@
#include "CXWindowsUtil.h"
#include "CThread.h"
#include "CLog.h"
#include "CStringUtil.h"
#include <X11/Xatom.h>
#define XK_XKB_KEYS
#define XK_LATIN1
@@ -1244,6 +1245,32 @@ CXWindowsUtil::decomposeKeySym(KeySym keysym, KeySyms& decomposed)
return true;
}
CString
CXWindowsUtil::atomToString(Display* display, Atom atom)
{
char* name = XGetAtomName(display, atom);
CString msg = CStringUtil::print("%s (%d)", name, (int)atom);
XFree(name);
return msg;
}
CString
CXWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num)
{
char** names = new char*[num];
XGetAtomNames(display, const_cast<Atom*>(atom), (int)num, names);
CString msg;
for (UInt32 i = 0; i < num; ++i) {
msg += CStringUtil::print("%s (%d), ", names[i], (int)atom[i]);
XFree(names[i]);
}
delete[] names;
if (msg.size() > 2) {
msg.erase(msg.size() - 2);
}
return msg;
}
Bool
CXWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg)
{