Drop C prefix on Linux

This commit is contained in:
Xinyu Hou 2014-11-12 11:28:41 +00:00
parent 67377109f3
commit e5e0a3b653
28 changed files with 421 additions and 421 deletions

View File

@ -34,10 +34,10 @@
#include <X11/Xatom.h>
//
// CXWindowsClipboard
// XWindowsClipboard
//
CXWindowsClipboard::CXWindowsClipboard(Display* display,
XWindowsClipboard::XWindowsClipboard(Display* display,
Window window, ClipboardID id) :
m_display(display),
m_window(window),
@ -76,34 +76,34 @@ CXWindowsClipboard::CXWindowsClipboard(Display* display,
}
// add converters, most desired first
m_converters.push_back(new CXWindowsClipboardHTMLConverter(m_display,
m_converters.push_back(new XWindowsClipboardHTMLConverter(m_display,
"text/html"));
m_converters.push_back(new CXWindowsClipboardBMPConverter(m_display));
m_converters.push_back(new CXWindowsClipboardUTF8Converter(m_display,
m_converters.push_back(new XWindowsClipboardBMPConverter(m_display));
m_converters.push_back(new XWindowsClipboardUTF8Converter(m_display,
"text/plain;charset=UTF-8"));
m_converters.push_back(new CXWindowsClipboardUTF8Converter(m_display,
m_converters.push_back(new XWindowsClipboardUTF8Converter(m_display,
"UTF8_STRING"));
m_converters.push_back(new CXWindowsClipboardUCS2Converter(m_display,
m_converters.push_back(new XWindowsClipboardUCS2Converter(m_display,
"text/plain;charset=ISO-10646-UCS-2"));
m_converters.push_back(new CXWindowsClipboardUCS2Converter(m_display,
m_converters.push_back(new XWindowsClipboardUCS2Converter(m_display,
"text/unicode"));
m_converters.push_back(new CXWindowsClipboardTextConverter(m_display,
m_converters.push_back(new XWindowsClipboardTextConverter(m_display,
"text/plain"));
m_converters.push_back(new CXWindowsClipboardTextConverter(m_display,
m_converters.push_back(new XWindowsClipboardTextConverter(m_display,
"STRING"));
// we have no data
clearCache();
}
CXWindowsClipboard::~CXWindowsClipboard()
XWindowsClipboard::~XWindowsClipboard()
{
clearReplies();
clearConverters();
}
void
CXWindowsClipboard::lost(Time time)
XWindowsClipboard::lost(Time time)
{
LOG((CLOG_DEBUG "lost clipboard %d ownership at %d", m_id, time));
if (m_owner) {
@ -114,14 +114,14 @@ CXWindowsClipboard::lost(Time time)
}
void
CXWindowsClipboard::addRequest(Window owner, Window requestor,
XWindowsClipboard::addRequest(Window owner, Window requestor,
Atom target, ::Time time, Atom property)
{
// must be for our window and we must have owned the selection
// 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, CXWindowsUtil::atomToString(m_display, target).c_str(), requestor, CXWindowsUtil::atomToString(m_display, property).c_str()));
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()));
if (wasOwnedAtTime(time)) {
if (target == m_atomMultiple) {
// add a multiple request. property may not be None
@ -153,7 +153,7 @@ CXWindowsClipboard::addRequest(Window owner, Window requestor,
}
bool
CXWindowsClipboard::addSimpleRequest(Window requestor,
XWindowsClipboard::addSimpleRequest(Window requestor,
Atom target, ::Time time, Atom property)
{
// obsolete requestors may supply a None property. in
@ -206,7 +206,7 @@ CXWindowsClipboard::addSimpleRequest(Window requestor,
}
bool
CXWindowsClipboard::processRequest(Window requestor,
XWindowsClipboard::processRequest(Window requestor,
::Time /*time*/, Atom property)
{
ReplyMap::iterator index = m_replies.find(requestor);
@ -214,7 +214,7 @@ CXWindowsClipboard::processRequest(Window requestor,
// unknown requestor window
return false;
}
LOG((CLOG_DEBUG1 "received property %s delete from 0x08%x", CXWindowsUtil::atomToString(m_display, property).c_str(), requestor));
LOG((CLOG_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
// first property but we'll check 'em all if we have to.
@ -234,7 +234,7 @@ CXWindowsClipboard::processRequest(Window requestor,
}
bool
CXWindowsClipboard::destroyRequest(Window requestor)
XWindowsClipboard::destroyRequest(Window requestor)
{
ReplyMap::iterator index = m_replies.find(requestor);
if (index == m_replies.end()) {
@ -253,19 +253,19 @@ CXWindowsClipboard::destroyRequest(Window requestor)
}
Window
CXWindowsClipboard::getWindow() const
XWindowsClipboard::getWindow() const
{
return m_window;
}
Atom
CXWindowsClipboard::getSelection() const
XWindowsClipboard::getSelection() const
{
return m_selection;
}
bool
CXWindowsClipboard::empty()
XWindowsClipboard::empty()
{
assert(m_open);
@ -298,7 +298,7 @@ CXWindowsClipboard::empty()
}
void
CXWindowsClipboard::add(EFormat format, const String& data)
XWindowsClipboard::add(EFormat format, const String& data)
{
assert(m_open);
assert(m_owner);
@ -312,7 +312,7 @@ CXWindowsClipboard::add(EFormat format, const String& data)
}
bool
CXWindowsClipboard::open(Time time) const
XWindowsClipboard::open(Time time) const
{
assert(!m_open);
@ -347,7 +347,7 @@ CXWindowsClipboard::open(Time time) const
}
void
CXWindowsClipboard::close() const
XWindowsClipboard::close() const
{
assert(m_open);
@ -363,14 +363,14 @@ CXWindowsClipboard::close() const
}
IClipboard::Time
CXWindowsClipboard::getTime() const
XWindowsClipboard::getTime() const
{
checkCache();
return m_timeOwned;
}
bool
CXWindowsClipboard::has(EFormat format) const
XWindowsClipboard::has(EFormat format) const
{
assert(m_open);
@ -379,7 +379,7 @@ CXWindowsClipboard::has(EFormat format) const
}
String
CXWindowsClipboard::get(EFormat format) const
XWindowsClipboard::get(EFormat format) const
{
assert(m_open);
@ -388,7 +388,7 @@ CXWindowsClipboard::get(EFormat format) const
}
void
CXWindowsClipboard::clearConverters()
XWindowsClipboard::clearConverters()
{
for (ConverterList::iterator index = m_converters.begin();
index != m_converters.end(); ++index) {
@ -398,7 +398,7 @@ CXWindowsClipboard::clearConverters()
}
IXWindowsClipboardConverter*
CXWindowsClipboard::getConverter(Atom target, bool onlyIfNotAdded) const
XWindowsClipboard::getConverter(Atom target, bool onlyIfNotAdded) const
{
IXWindowsClipboardConverter* converter = NULL;
for (ConverterList::const_iterator index = m_converters.begin();
@ -409,7 +409,7 @@ CXWindowsClipboard::getConverter(Atom target, bool onlyIfNotAdded) const
}
}
if (converter == NULL) {
LOG((CLOG_DEBUG1 " no converter for target %s", CXWindowsUtil::atomToString(m_display, target).c_str()));
LOG((CLOG_DEBUG1 " no converter for target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
return NULL;
}
@ -425,7 +425,7 @@ CXWindowsClipboard::getConverter(Atom target, bool onlyIfNotAdded) const
}
void
CXWindowsClipboard::checkCache() const
XWindowsClipboard::checkCache() const
{
if (!m_checkCache) {
return;
@ -453,13 +453,13 @@ CXWindowsClipboard::checkCache() const
}
void
CXWindowsClipboard::clearCache() const
XWindowsClipboard::clearCache() const
{
const_cast<CXWindowsClipboard*>(this)->doClearCache();
const_cast<XWindowsClipboard*>(this)->doClearCache();
}
void
CXWindowsClipboard::doClearCache()
XWindowsClipboard::doClearCache()
{
m_checkCache = false;
m_cached = false;
@ -470,17 +470,17 @@ CXWindowsClipboard::doClearCache()
}
void
CXWindowsClipboard::fillCache() const
XWindowsClipboard::fillCache() const
{
// get the selection data if not already cached
checkCache();
if (!m_cached) {
const_cast<CXWindowsClipboard*>(this)->doFillCache();
const_cast<XWindowsClipboard*>(this)->doFillCache();
}
}
void
CXWindowsClipboard::doFillCache()
XWindowsClipboard::doFillCache()
{
if (m_motif) {
motifFillCache();
@ -494,7 +494,7 @@ CXWindowsClipboard::doFillCache()
}
void
CXWindowsClipboard::icccmFillCache()
XWindowsClipboard::icccmFillCache()
{
LOG((CLOG_DEBUG "ICCCM fill clipboard %d", m_id));
@ -509,13 +509,13 @@ CXWindowsClipboard::icccmFillCache()
(target != m_atomAtom && target != m_atomTargets)) {
LOG((CLOG_DEBUG1 "selection doesn't support TARGETS"));
data = "";
CXWindowsUtil::appendAtomData(data, XA_STRING);
XWindowsUtil::appendAtomData(data, XA_STRING);
}
CXWindowsUtil::convertAtomProperty(data);
XWindowsUtil::convertAtomProperty(data);
const Atom* targets = reinterpret_cast<const Atom*>(data.data());
const UInt32 numTargets = data.size() / sizeof(Atom);
LOG((CLOG_DEBUG " available targets: %s", CXWindowsUtil::atomsToString(m_display, targets, numTargets).c_str()));
LOG((CLOG_DEBUG " available targets: %s", XWindowsUtil::atomsToString(m_display, targets, numTargets).c_str()));
// try each converter in order (because they're in order of
// preference).
@ -550,7 +550,7 @@ CXWindowsClipboard::icccmFillCache()
Atom actualTarget;
String targetData;
if (!icccmGetSelection(target, &actualTarget, &targetData)) {
LOG((CLOG_DEBUG1 " no data for target %s", CXWindowsUtil::atomToString(m_display, target).c_str()));
LOG((CLOG_DEBUG1 " no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
continue;
}
@ -558,12 +558,12 @@ 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 %s (%u %s)", format, CXWindowsUtil::atomToString(m_display, target).c_str(), targetData.size(), targetData.size() == 1 ? "byte" : "bytes"));
LOG((CLOG_DEBUG " added format %d for target %s (%u %s)", format, XWindowsUtil::atomToString(m_display, target).c_str(), targetData.size(), targetData.size() == 1 ? "byte" : "bytes"));
}
}
bool
CXWindowsClipboard::icccmGetSelection(Atom target,
XWindowsClipboard::icccmGetSelection(Atom target,
Atom* actualTarget, String* data) const
{
assert(actualTarget != NULL);
@ -573,19 +573,19 @@ 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 %s", CXWindowsUtil::atomToString(m_display, target).c_str()));
LOG((CLOG_DEBUG1 "can't get data for selection target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
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 %s", CXWindowsUtil::atomToString(m_display, target).c_str()));
LOG((CLOG_DEBUG1 "selection conversion failed for target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
return false;
}
return true;
}
IClipboard::Time
CXWindowsClipboard::icccmGetTime() const
XWindowsClipboard::icccmGetTime() const
{
Atom actualTarget;
String data;
@ -603,7 +603,7 @@ CXWindowsClipboard::icccmGetTime() const
}
bool
CXWindowsClipboard::motifLockClipboard() const
XWindowsClipboard::motifLockClipboard() const
{
// fail if anybody owns the lock (even us, so this is non-recursive)
Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock);
@ -616,7 +616,7 @@ CXWindowsClipboard::motifLockClipboard() const
// FIXME -- is this right? there's a race condition here --
// A grabs successfully, B grabs successfully, A thinks it
// still has the grab until it gets a SelectionClear.
Time time = CXWindowsUtil::getCurrentTime(m_display, m_window);
Time time = XWindowsUtil::getCurrentTime(m_display, m_window);
XSetSelectionOwner(m_display, m_atomMotifClipLock, m_window, time);
lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock);
if (lockOwner != m_window) {
@ -629,7 +629,7 @@ CXWindowsClipboard::motifLockClipboard() const
}
void
CXWindowsClipboard::motifUnlockClipboard() const
XWindowsClipboard::motifUnlockClipboard() const
{
LOG((CLOG_DEBUG1 "unlocked motif clipboard"));
@ -640,12 +640,12 @@ CXWindowsClipboard::motifUnlockClipboard() const
}
// release lock
Time time = CXWindowsUtil::getCurrentTime(m_display, m_window);
Time time = XWindowsUtil::getCurrentTime(m_display, m_window);
XSetSelectionOwner(m_display, m_atomMotifClipLock, None, time);
}
bool
CXWindowsClipboard::motifOwnsClipboard() const
XWindowsClipboard::motifOwnsClipboard() const
{
// get the current selection owner
// FIXME -- this can't be right. even if the window is destroyed
@ -661,7 +661,7 @@ CXWindowsClipboard::motifOwnsClipboard() const
SInt32 format;
String data;
Window root = RootWindow(m_display, DefaultScreen(m_display));
if (!CXWindowsUtil::getWindowProperty(m_display, root,
if (!XWindowsUtil::getWindowProperty(m_display, root,
m_atomMotifClipHeader,
&data, &target, &format, False)) {
return false;
@ -681,7 +681,7 @@ CXWindowsClipboard::motifOwnsClipboard() const
}
void
CXWindowsClipboard::motifFillCache()
XWindowsClipboard::motifFillCache()
{
LOG((CLOG_DEBUG "Motif fill clipboard %d", m_id));
@ -690,7 +690,7 @@ CXWindowsClipboard::motifFillCache()
SInt32 format;
String data;
Window root = RootWindow(m_display, DefaultScreen(m_display));
if (!CXWindowsUtil::getWindowProperty(m_display, root,
if (!XWindowsUtil::getWindowProperty(m_display, root,
m_atomMotifClipHeader,
&data, &target, &format, False)) {
return;
@ -710,7 +710,7 @@ CXWindowsClipboard::motifFillCache()
sprintf(name, "_MOTIF_CLIP_ITEM_%d", header->m_item);
Atom atomItem = XInternAtom(m_display, name, False);
data = "";
if (!CXWindowsUtil::getWindowProperty(m_display, root,
if (!XWindowsUtil::getWindowProperty(m_display, root,
atomItem, &data,
&target, &format, False)) {
return;
@ -738,7 +738,7 @@ CXWindowsClipboard::motifFillCache()
sprintf(name, "_MOTIF_CLIP_ITEM_%d", formats[i]);
Atom atomFormat = XInternAtom(m_display, name, False);
String data;
if (!CXWindowsUtil::getWindowProperty(m_display, root,
if (!XWindowsUtil::getWindowProperty(m_display, root,
atomFormat, &data,
&target, &format, False)) {
continue;
@ -788,7 +788,7 @@ CXWindowsClipboard::motifFillCache()
Atom actualTarget;
String targetData;
if (!motifGetSelection(motifFormat, &actualTarget, &targetData)) {
LOG((CLOG_DEBUG1 " no data for target %s", CXWindowsUtil::atomToString(m_display, target).c_str()));
LOG((CLOG_DEBUG1 " no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
continue;
}
@ -796,12 +796,12 @@ 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 %s", format, CXWindowsUtil::atomToString(m_display, target).c_str()));
LOG((CLOG_DEBUG " added format %d for target %s", format, XWindowsUtil::atomToString(m_display, target).c_str()));
}
}
bool
CXWindowsClipboard::motifGetSelection(const MotifClipFormat* format,
XWindowsClipboard::motifGetSelection(const MotifClipFormat* format,
Atom* actualTarget, String* data) const
{
// if the current clipboard owner and the owner indicated by the
@ -820,26 +820,26 @@ CXWindowsClipboard::motifGetSelection(const MotifClipFormat* format,
sprintf(name, "_MOTIF_CLIP_ITEM_%d", format->m_data);
Atom target = XInternAtom(m_display, name, False);
Window root = RootWindow(m_display, DefaultScreen(m_display));
return CXWindowsUtil::getWindowProperty(m_display, root,
return XWindowsUtil::getWindowProperty(m_display, root,
target, data,
actualTarget, NULL, False);
}
IClipboard::Time
CXWindowsClipboard::motifGetTime() const
XWindowsClipboard::motifGetTime() const
{
return icccmGetTime();
}
bool
CXWindowsClipboard::insertMultipleReply(Window requestor,
XWindowsClipboard::insertMultipleReply(Window requestor,
::Time time, Atom property)
{
// get the requested targets
Atom target;
SInt32 format;
String data;
if (!CXWindowsUtil::getWindowProperty(m_display, requestor,
if (!XWindowsUtil::getWindowProperty(m_display, requestor,
property, &data, &target, &format, False)) {
// can't get the requested targets
return false;
@ -851,7 +851,7 @@ CXWindowsClipboard::insertMultipleReply(Window requestor,
}
// data is a list of atom pairs: target, property
CXWindowsUtil::convertAtomProperty(data);
XWindowsUtil::convertAtomProperty(data);
const Atom* targets = reinterpret_cast<const Atom*>(data.data());
const UInt32 numTargets = data.size() / sizeof(Atom);
@ -862,14 +862,14 @@ CXWindowsClipboard::insertMultipleReply(Window requestor,
const Atom property = targets[i + 1];
if (!addSimpleRequest(requestor, target, time, property)) {
// note that we can't perform the requested conversion
CXWindowsUtil::replaceAtomData(data, i, None);
XWindowsUtil::replaceAtomData(data, i, None);
changed = true;
}
}
// update the targets property if we changed it
if (changed) {
CXWindowsUtil::setWindowProperty(m_display, requestor,
XWindowsUtil::setWindowProperty(m_display, requestor,
property, data.data(), data.size(),
target, format);
}
@ -882,7 +882,7 @@ CXWindowsClipboard::insertMultipleReply(Window requestor,
}
void
CXWindowsClipboard::insertReply(Reply* reply)
XWindowsClipboard::insertReply(Reply* reply)
{
assert(reply != NULL);
@ -909,7 +909,7 @@ CXWindowsClipboard::insertReply(Reply* reply)
// note errors while we adjust event masks
bool error = false;
{
CXWindowsUtil::ErrorLock lock(m_display, &error);
XWindowsUtil::ErrorLock lock(m_display, &error);
// get and save the current event mask
XWindowAttributes attr;
@ -930,7 +930,7 @@ CXWindowsClipboard::insertReply(Reply* reply)
}
void
CXWindowsClipboard::pushReplies()
XWindowsClipboard::pushReplies()
{
// send the first reply for each window if that reply hasn't
// been sent yet.
@ -953,7 +953,7 @@ CXWindowsClipboard::pushReplies()
}
void
CXWindowsClipboard::pushReplies(ReplyMap::iterator& mapIndex,
XWindowsClipboard::pushReplies(ReplyMap::iterator& mapIndex,
ReplyList& replies, ReplyList::iterator index)
{
Reply* reply = *index;
@ -971,7 +971,7 @@ CXWindowsClipboard::pushReplies(ReplyMap::iterator& mapIndex,
// if there are no more replies in the list then remove the list
// and stop watching the requestor for events.
if (replies.empty()) {
CXWindowsUtil::ErrorLock lock(m_display);
XWindowsUtil::ErrorLock lock(m_display);
Window requestor = mapIndex->first;
XSelectInput(m_display, requestor, m_eventMasks[requestor]);
m_replies.erase(mapIndex++);
@ -983,7 +983,7 @@ CXWindowsClipboard::pushReplies(ReplyMap::iterator& mapIndex,
}
bool
CXWindowsClipboard::sendReply(Reply* reply)
XWindowsClipboard::sendReply(Reply* reply)
{
assert(reply != NULL);
@ -1006,7 +1006,7 @@ CXWindowsClipboard::sendReply(Reply* reply)
// send INCR reply if incremental and we haven't replied yet
if (useINCR && !reply->m_replied) {
UInt32 size = reply->m_data.size();
if (!CXWindowsUtil::setWindowProperty(m_display,
if (!XWindowsUtil::setWindowProperty(m_display,
reply->m_requestor, reply->m_property,
&size, 4, m_atomINCR, 32)) {
failed = true;
@ -1021,7 +1021,7 @@ CXWindowsClipboard::sendReply(Reply* reply)
size = maxRequestSize;
// send it
if (!CXWindowsUtil::setWindowProperty(m_display,
if (!XWindowsUtil::setWindowProperty(m_display,
reply->m_requestor, reply->m_property,
reply->m_data.data() + reply->m_ptr,
size,
@ -1048,7 +1048,7 @@ CXWindowsClipboard::sendReply(Reply* reply)
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::ErrorLock lock(m_display);
XWindowsUtil::ErrorLock lock(m_display);
XDeleteProperty(m_display, reply->m_requestor, reply->m_property);
}
@ -1062,7 +1062,7 @@ CXWindowsClipboard::sendReply(Reply* reply)
}
else {
static const char dummy = 0;
CXWindowsUtil::setWindowProperty(m_display,
XWindowsUtil::setWindowProperty(m_display,
reply->m_requestor, reply->m_property,
&dummy,
0,
@ -1083,7 +1083,7 @@ CXWindowsClipboard::sendReply(Reply* reply)
// knowing the properties may help design a workaround, if
// it becomes necessary.
if (CLOG->getFilter() >= kDEBUG2) {
CXWindowsUtil::ErrorLock lock(m_display);
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));
@ -1091,7 +1091,7 @@ CXWindowsClipboard::sendReply(Reply* reply)
Atom target;
String data;
char* name = XGetAtomName(m_display, props[i]);
if (!CXWindowsUtil::getWindowProperty(m_display,
if (!XWindowsUtil::getWindowProperty(m_display,
reply->m_requestor,
props[i], &data, &target, NULL, False)) {
LOG((CLOG_DEBUG2 " %s: <can't read property>", name));
@ -1139,7 +1139,7 @@ CXWindowsClipboard::sendReply(Reply* reply)
}
void
CXWindowsClipboard::clearReplies()
XWindowsClipboard::clearReplies()
{
for (ReplyMap::iterator index = m_replies.begin();
index != m_replies.end(); ++index) {
@ -1150,7 +1150,7 @@ CXWindowsClipboard::clearReplies()
}
void
CXWindowsClipboard::clearReplies(ReplyList& replies)
XWindowsClipboard::clearReplies(ReplyList& replies)
{
for (ReplyList::iterator index = replies.begin();
index != replies.end(); ++index) {
@ -1160,7 +1160,7 @@ CXWindowsClipboard::clearReplies(ReplyList& replies)
}
void
CXWindowsClipboard::sendNotify(Window requestor,
XWindowsClipboard::sendNotify(Window requestor,
Atom selection, Atom target, Atom property, Time time)
{
XEvent event;
@ -1171,12 +1171,12 @@ CXWindowsClipboard::sendNotify(Window requestor,
event.xselection.target = target;
event.xselection.property = property;
event.xselection.time = time;
CXWindowsUtil::ErrorLock lock(m_display);
XWindowsUtil::ErrorLock lock(m_display);
XSendEvent(m_display, requestor, False, 0, &event);
}
bool
CXWindowsClipboard::wasOwnedAtTime(::Time time) const
XWindowsClipboard::wasOwnedAtTime(::Time time) const
{
// not owned if we've never owned the selection
checkCache();
@ -1194,7 +1194,7 @@ CXWindowsClipboard::wasOwnedAtTime(::Time time) const
return true;
}
else {
lost = CXWindowsUtil::getCurrentTime(m_display, m_window);
lost = XWindowsUtil::getCurrentTime(m_display, m_window);
}
}
else {
@ -1210,14 +1210,14 @@ CXWindowsClipboard::wasOwnedAtTime(::Time time) const
}
Atom
CXWindowsClipboard::getTargetsData(String& data, int* format) const
XWindowsClipboard::getTargetsData(String& data, int* format) const
{
assert(format != NULL);
// add standard targets
CXWindowsUtil::appendAtomData(data, m_atomTargets);
CXWindowsUtil::appendAtomData(data, m_atomMultiple);
CXWindowsUtil::appendAtomData(data, m_atomTimestamp);
XWindowsUtil::appendAtomData(data, m_atomTargets);
XWindowsUtil::appendAtomData(data, m_atomMultiple);
XWindowsUtil::appendAtomData(data, m_atomTimestamp);
// add targets we can convert to
for (ConverterList::const_iterator index = m_converters.begin();
@ -1226,7 +1226,7 @@ CXWindowsClipboard::getTargetsData(String& data, int* format) const
// skip formats we don't have
if (m_added[converter->getFormat()]) {
CXWindowsUtil::appendAtomData(data, converter->getAtom());
XWindowsUtil::appendAtomData(data, converter->getAtom());
}
}
@ -1235,22 +1235,22 @@ CXWindowsClipboard::getTargetsData(String& data, int* format) const
}
Atom
CXWindowsClipboard::getTimestampData(String& data, int* format) const
XWindowsClipboard::getTimestampData(String& data, int* format) const
{
assert(format != NULL);
checkCache();
CXWindowsUtil::appendTimeData(data, m_timeOwned);
XWindowsUtil::appendTimeData(data, m_timeOwned);
*format = 32;
return m_atomInteger;
}
//
// CXWindowsClipboard::CICCCMGetClipboard
// XWindowsClipboard::CICCCMGetClipboard
//
CXWindowsClipboard::CICCCMGetClipboard::CICCCMGetClipboard(
XWindowsClipboard::CICCCMGetClipboard::CICCCMGetClipboard(
Window requestor, Time time, Atom property) :
m_requestor(requestor),
m_time(time),
@ -1266,19 +1266,19 @@ CXWindowsClipboard::CICCCMGetClipboard::CICCCMGetClipboard(
// do nothing
}
CXWindowsClipboard::CICCCMGetClipboard::~CICCCMGetClipboard()
XWindowsClipboard::CICCCMGetClipboard::~CICCCMGetClipboard()
{
// do nothing
}
bool
CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
XWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
Atom selection, Atom target, Atom* actualTarget, String* data)
{
assert(actualTarget != NULL);
assert(data != NULL);
LOG((CLOG_DEBUG1 "request selection=%s, target=%s, window=%x", CXWindowsUtil::atomToString(display, selection).c_str(), CXWindowsUtil::atomToString(display, target).c_str(), m_requestor));
LOG((CLOG_DEBUG1 "request selection=%s, target=%s, window=%x", XWindowsUtil::atomToString(display, selection).c_str(), XWindowsUtil::atomToString(display, target).c_str(), m_requestor));
m_atomNone = XInternAtom(display, "NONE", False);
m_atomIncr = XInternAtom(display, "INCR", False);
@ -1363,7 +1363,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
}
bool
CXWindowsClipboard::CICCCMGetClipboard::processEvent(
XWindowsClipboard::CICCCMGetClipboard::processEvent(
Display* display, XEvent* xevent)
{
// process event
@ -1419,7 +1419,7 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
// get the data from the property
Atom target;
const String::size_type oldSize = m_data->size();
if (!CXWindowsUtil::getWindowProperty(display, m_requestor,
if (!XWindowsUtil::getWindowProperty(display, m_requestor,
m_property, m_data, &target, NULL, True)) {
// unable to read property
m_failed = true;
@ -1450,7 +1450,7 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
else if (m_incr) {
// if first incremental chunk then save target
if (oldSize == 0) {
LOG((CLOG_DEBUG1 " INCR first chunk, target %s", CXWindowsUtil::atomToString(display, target).c_str()));
LOG((CLOG_DEBUG1 " INCR first chunk, target %s", XWindowsUtil::atomToString(display, target).c_str()));
*m_actualTarget = target;
}
@ -1472,7 +1472,7 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
// not incremental; save the target.
else {
LOG((CLOG_DEBUG1 " target %s", CXWindowsUtil::atomToString(display, target).c_str()));
LOG((CLOG_DEBUG1 " target %s", XWindowsUtil::atomToString(display, target).c_str()));
*m_actualTarget = target;
m_done = true;
}
@ -1484,10 +1484,10 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
//
// CXWindowsClipboard::Reply
// XWindowsClipboard::Reply
//
CXWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time) :
XWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time) :
m_requestor(requestor),
m_target(target),
m_time(time),
@ -1502,7 +1502,7 @@ CXWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time) :
// do nothing
}
CXWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time,
XWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time,
Atom property, const String& data, Atom type, int format) :
m_requestor(requestor),
m_target(target),

View File

@ -33,14 +33,14 @@
class IXWindowsClipboardConverter;
//! X11 clipboard implementation
class CXWindowsClipboard : public IClipboard {
class XWindowsClipboard : public IClipboard {
public:
/*!
Use \c window as the window that owns or interacts with the
clipboard identified by \c id.
*/
CXWindowsClipboard(Display*, Window window, ClipboardID id);
virtual ~CXWindowsClipboard();
XWindowsClipboard(Display*, Window window, ClipboardID id);
virtual ~XWindowsClipboard();
//! Notify clipboard was lost
/*!

View File

@ -97,33 +97,33 @@ fromLEU32(const UInt8* data)
//
// CXWindowsClipboardAnyBitmapConverter
// XWindowsClipboardAnyBitmapConverter
//
CXWindowsClipboardAnyBitmapConverter::CXWindowsClipboardAnyBitmapConverter()
XWindowsClipboardAnyBitmapConverter::XWindowsClipboardAnyBitmapConverter()
{
// do nothing
}
CXWindowsClipboardAnyBitmapConverter::~CXWindowsClipboardAnyBitmapConverter()
XWindowsClipboardAnyBitmapConverter::~XWindowsClipboardAnyBitmapConverter()
{
// do nothing
}
IClipboard::EFormat
CXWindowsClipboardAnyBitmapConverter::getFormat() const
XWindowsClipboardAnyBitmapConverter::getFormat() const
{
return IClipboard::kBitmap;
}
int
CXWindowsClipboardAnyBitmapConverter::getDataSize() const
XWindowsClipboardAnyBitmapConverter::getDataSize() const
{
return 8;
}
String
CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const String& bmp) const
XWindowsClipboardAnyBitmapConverter::fromIClipboard(const String& bmp) const
{
// fill BMP info header with native-endian data
CBMPInfoHeader infoHeader;
@ -161,7 +161,7 @@ CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const String& bmp) const
}
String
CXWindowsClipboardAnyBitmapConverter::toIClipboard(const String& image) const
XWindowsClipboardAnyBitmapConverter::toIClipboard(const String& image) const
{
// convert to raw BMP data
UInt32 w, h, depth;

View File

@ -21,11 +21,11 @@
#include "platform/XWindowsClipboard.h"
//! Convert to/from some text encoding
class CXWindowsClipboardAnyBitmapConverter :
class XWindowsClipboardAnyBitmapConverter :
public IXWindowsClipboardConverter {
public:
CXWindowsClipboardAnyBitmapConverter();
virtual ~CXWindowsClipboardAnyBitmapConverter();
XWindowsClipboardAnyBitmapConverter();
virtual ~XWindowsClipboardAnyBitmapConverter();
// IXWindowsClipboardConverter overrides
virtual IClipboard::EFormat

View File

@ -68,41 +68,41 @@ toLE(UInt8*& dst, UInt32 src)
}
//
// CXWindowsClipboardBMPConverter
// XWindowsClipboardBMPConverter
//
CXWindowsClipboardBMPConverter::CXWindowsClipboardBMPConverter(
XWindowsClipboardBMPConverter::XWindowsClipboardBMPConverter(
Display* display) :
m_atom(XInternAtom(display, "image/bmp", False))
{
// do nothing
}
CXWindowsClipboardBMPConverter::~CXWindowsClipboardBMPConverter()
XWindowsClipboardBMPConverter::~XWindowsClipboardBMPConverter()
{
// do nothing
}
IClipboard::EFormat
CXWindowsClipboardBMPConverter::getFormat() const
XWindowsClipboardBMPConverter::getFormat() const
{
return IClipboard::kBitmap;
}
Atom
CXWindowsClipboardBMPConverter::getAtom() const
XWindowsClipboardBMPConverter::getAtom() const
{
return m_atom;
}
int
CXWindowsClipboardBMPConverter::getDataSize() const
XWindowsClipboardBMPConverter::getDataSize() const
{
return 8;
}
String
CXWindowsClipboardBMPConverter::fromIClipboard(const String& bmp) const
XWindowsClipboardBMPConverter::fromIClipboard(const String& bmp) const
{
// create BMP image
UInt8 header[14];
@ -117,7 +117,7 @@ CXWindowsClipboardBMPConverter::fromIClipboard(const String& bmp) const
}
String
CXWindowsClipboardBMPConverter::toIClipboard(const String& bmp) const
XWindowsClipboardBMPConverter::toIClipboard(const String& bmp) const
{
// make sure data is big enough for a BMP file
if (bmp.size() <= 14 + 40) {

View File

@ -21,11 +21,11 @@
#include "platform/XWindowsClipboard.h"
//! Convert to/from some text encoding
class CXWindowsClipboardBMPConverter :
class XWindowsClipboardBMPConverter :
public IXWindowsClipboardConverter {
public:
CXWindowsClipboardBMPConverter(Display* display);
virtual ~CXWindowsClipboardBMPConverter();
XWindowsClipboardBMPConverter(Display* display);
virtual ~XWindowsClipboardBMPConverter();
// IXWindowsClipboardConverter overrides
virtual IClipboard::EFormat

View File

@ -21,47 +21,47 @@
#include "base/Unicode.h"
//
// CXWindowsClipboardHTMLConverter
// XWindowsClipboardHTMLConverter
//
CXWindowsClipboardHTMLConverter::CXWindowsClipboardHTMLConverter(
XWindowsClipboardHTMLConverter::XWindowsClipboardHTMLConverter(
Display* display, const char* name) :
m_atom(XInternAtom(display, name, False))
{
// do nothing
}
CXWindowsClipboardHTMLConverter::~CXWindowsClipboardHTMLConverter()
XWindowsClipboardHTMLConverter::~XWindowsClipboardHTMLConverter()
{
// do nothing
}
IClipboard::EFormat
CXWindowsClipboardHTMLConverter::getFormat() const
XWindowsClipboardHTMLConverter::getFormat() const
{
return IClipboard::kHTML;
}
Atom
CXWindowsClipboardHTMLConverter::getAtom() const
XWindowsClipboardHTMLConverter::getAtom() const
{
return m_atom;
}
int
CXWindowsClipboardHTMLConverter::getDataSize() const
XWindowsClipboardHTMLConverter::getDataSize() const
{
return 8;
}
String
CXWindowsClipboardHTMLConverter::fromIClipboard(const String& data) const
XWindowsClipboardHTMLConverter::fromIClipboard(const String& data) const
{
return Unicode::UTF8ToUTF16(data);
}
String
CXWindowsClipboardHTMLConverter::toIClipboard(const String& data) const
XWindowsClipboardHTMLConverter::toIClipboard(const String& data) const
{
return Unicode::UTF16ToUTF8(data);
}

View File

@ -21,13 +21,13 @@
#include "platform/XWindowsClipboard.h"
//! Convert to/from HTML encoding
class CXWindowsClipboardHTMLConverter : public IXWindowsClipboardConverter {
class XWindowsClipboardHTMLConverter : public IXWindowsClipboardConverter {
public:
/*!
\c name is converted to an atom and that is reported by getAtom().
*/
CXWindowsClipboardHTMLConverter(Display* display, const char* name);
virtual ~CXWindowsClipboardHTMLConverter();
XWindowsClipboardHTMLConverter(Display* display, const char* name);
virtual ~XWindowsClipboardHTMLConverter();
// IXWindowsClipboardConverter overrides
virtual IClipboard::EFormat

View File

@ -21,47 +21,47 @@
#include "base/Unicode.h"
//
// CXWindowsClipboardTextConverter
// XWindowsClipboardTextConverter
//
CXWindowsClipboardTextConverter::CXWindowsClipboardTextConverter(
XWindowsClipboardTextConverter::XWindowsClipboardTextConverter(
Display* display, const char* name) :
m_atom(XInternAtom(display, name, False))
{
// do nothing
}
CXWindowsClipboardTextConverter::~CXWindowsClipboardTextConverter()
XWindowsClipboardTextConverter::~XWindowsClipboardTextConverter()
{
// do nothing
}
IClipboard::EFormat
CXWindowsClipboardTextConverter::getFormat() const
XWindowsClipboardTextConverter::getFormat() const
{
return IClipboard::kText;
}
Atom
CXWindowsClipboardTextConverter::getAtom() const
XWindowsClipboardTextConverter::getAtom() const
{
return m_atom;
}
int
CXWindowsClipboardTextConverter::getDataSize() const
XWindowsClipboardTextConverter::getDataSize() const
{
return 8;
}
String
CXWindowsClipboardTextConverter::fromIClipboard(const String& data) const
XWindowsClipboardTextConverter::fromIClipboard(const String& data) const
{
return Unicode::UTF8ToText(data);
}
String
CXWindowsClipboardTextConverter::toIClipboard(const String& data) const
XWindowsClipboardTextConverter::toIClipboard(const String& data) const
{
// convert to UTF-8
bool errors;

View File

@ -21,13 +21,13 @@
#include "platform/XWindowsClipboard.h"
//! Convert to/from locale text encoding
class CXWindowsClipboardTextConverter : public IXWindowsClipboardConverter {
class XWindowsClipboardTextConverter : public IXWindowsClipboardConverter {
public:
/*!
\c name is converted to an atom and that is reported by getAtom().
*/
CXWindowsClipboardTextConverter(Display* display, const char* name);
virtual ~CXWindowsClipboardTextConverter();
XWindowsClipboardTextConverter(Display* display, const char* name);
virtual ~XWindowsClipboardTextConverter();
// IXWindowsClipboardConverter overrides
virtual IClipboard::EFormat

View File

@ -21,47 +21,47 @@
#include "base/Unicode.h"
//
// CXWindowsClipboardUCS2Converter
// XWindowsClipboardUCS2Converter
//
CXWindowsClipboardUCS2Converter::CXWindowsClipboardUCS2Converter(
XWindowsClipboardUCS2Converter::XWindowsClipboardUCS2Converter(
Display* display, const char* name) :
m_atom(XInternAtom(display, name, False))
{
// do nothing
}
CXWindowsClipboardUCS2Converter::~CXWindowsClipboardUCS2Converter()
XWindowsClipboardUCS2Converter::~XWindowsClipboardUCS2Converter()
{
// do nothing
}
IClipboard::EFormat
CXWindowsClipboardUCS2Converter::getFormat() const
XWindowsClipboardUCS2Converter::getFormat() const
{
return IClipboard::kText;
}
Atom
CXWindowsClipboardUCS2Converter::getAtom() const
XWindowsClipboardUCS2Converter::getAtom() const
{
return m_atom;
}
int
CXWindowsClipboardUCS2Converter::getDataSize() const
XWindowsClipboardUCS2Converter::getDataSize() const
{
return 16;
}
String
CXWindowsClipboardUCS2Converter::fromIClipboard(const String& data) const
XWindowsClipboardUCS2Converter::fromIClipboard(const String& data) const
{
return Unicode::UTF8ToUCS2(data);
}
String
CXWindowsClipboardUCS2Converter::toIClipboard(const String& data) const
XWindowsClipboardUCS2Converter::toIClipboard(const String& data) const
{
return Unicode::UCS2ToUTF8(data);
}

View File

@ -21,13 +21,13 @@
#include "platform/XWindowsClipboard.h"
//! Convert to/from UCS-2 encoding
class CXWindowsClipboardUCS2Converter : public IXWindowsClipboardConverter {
class XWindowsClipboardUCS2Converter : public IXWindowsClipboardConverter {
public:
/*!
\c name is converted to an atom and that is reported by getAtom().
*/
CXWindowsClipboardUCS2Converter(Display* display, const char* name);
virtual ~CXWindowsClipboardUCS2Converter();
XWindowsClipboardUCS2Converter(Display* display, const char* name);
virtual ~XWindowsClipboardUCS2Converter();
// IXWindowsClipboardConverter overrides
virtual IClipboard::EFormat

View File

@ -19,47 +19,47 @@
#include "platform/XWindowsClipboardUTF8Converter.h"
//
// CXWindowsClipboardUTF8Converter
// XWindowsClipboardUTF8Converter
//
CXWindowsClipboardUTF8Converter::CXWindowsClipboardUTF8Converter(
XWindowsClipboardUTF8Converter::XWindowsClipboardUTF8Converter(
Display* display, const char* name) :
m_atom(XInternAtom(display, name, False))
{
// do nothing
}
CXWindowsClipboardUTF8Converter::~CXWindowsClipboardUTF8Converter()
XWindowsClipboardUTF8Converter::~XWindowsClipboardUTF8Converter()
{
// do nothing
}
IClipboard::EFormat
CXWindowsClipboardUTF8Converter::getFormat() const
XWindowsClipboardUTF8Converter::getFormat() const
{
return IClipboard::kText;
}
Atom
CXWindowsClipboardUTF8Converter::getAtom() const
XWindowsClipboardUTF8Converter::getAtom() const
{
return m_atom;
}
int
CXWindowsClipboardUTF8Converter::getDataSize() const
XWindowsClipboardUTF8Converter::getDataSize() const
{
return 8;
}
String
CXWindowsClipboardUTF8Converter::fromIClipboard(const String& data) const
XWindowsClipboardUTF8Converter::fromIClipboard(const String& data) const
{
return data;
}
String
CXWindowsClipboardUTF8Converter::toIClipboard(const String& data) const
XWindowsClipboardUTF8Converter::toIClipboard(const String& data) const
{
return data;
}

View File

@ -21,13 +21,13 @@
#include "platform/XWindowsClipboard.h"
//! Convert to/from UTF-8 encoding
class CXWindowsClipboardUTF8Converter : public IXWindowsClipboardConverter {
class XWindowsClipboardUTF8Converter : public IXWindowsClipboardConverter {
public:
/*!
\c name is converted to an atom and that is reported by getAtom().
*/
CXWindowsClipboardUTF8Converter(Display* display, const char* name);
virtual ~CXWindowsClipboardUTF8Converter();
XWindowsClipboardUTF8Converter(Display* display, const char* name);
virtual ~XWindowsClipboardUTF8Converter();
// IXWindowsClipboardConverter overrides
virtual IClipboard::EFormat

View File

@ -49,10 +49,10 @@ class EventQueueTimer { };
//
// CXWindowsEventQueueBuffer
// XWindowsEventQueueBuffer
//
CXWindowsEventQueueBuffer::CXWindowsEventQueueBuffer(
XWindowsEventQueueBuffer::XWindowsEventQueueBuffer(
Display* display, Window window, IEventQueue* events) :
m_events(events),
m_display(display),
@ -74,7 +74,7 @@ CXWindowsEventQueueBuffer::CXWindowsEventQueueBuffer(
fcntl(m_pipefd[1], F_SETFL, pipeflags | O_NONBLOCK);
}
CXWindowsEventQueueBuffer::~CXWindowsEventQueueBuffer()
XWindowsEventQueueBuffer::~XWindowsEventQueueBuffer()
{
// release pipe hack resources
close(m_pipefd[0]);
@ -82,7 +82,7 @@ CXWindowsEventQueueBuffer::~CXWindowsEventQueueBuffer()
}
void
CXWindowsEventQueueBuffer::waitForEvent(double dtimeout)
XWindowsEventQueueBuffer::waitForEvent(double dtimeout)
{
Thread::testCancel();
@ -106,7 +106,7 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeout)
flush();
}
// calling flush may have queued up a new event.
if (!CXWindowsEventQueueBuffer::isEmpty()) {
if (!XWindowsEventQueueBuffer::isEmpty()) {
Thread::testCancel();
return;
}
@ -198,7 +198,7 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeout)
}
IEventQueueBuffer::Type
CXWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
XWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
{
Lock lock(&m_mutex);
@ -222,7 +222,7 @@ CXWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
}
bool
CXWindowsEventQueueBuffer::addEvent(UInt32 dataID)
XWindowsEventQueueBuffer::addEvent(UInt32 dataID)
{
// prepare a message
XEvent xevent;
@ -259,26 +259,26 @@ CXWindowsEventQueueBuffer::addEvent(UInt32 dataID)
}
bool
CXWindowsEventQueueBuffer::isEmpty() const
XWindowsEventQueueBuffer::isEmpty() const
{
Lock lock(&m_mutex);
return (XPending(m_display) == 0 );
}
EventQueueTimer*
CXWindowsEventQueueBuffer::newTimer(double, bool) const
XWindowsEventQueueBuffer::newTimer(double, bool) const
{
return new EventQueueTimer;
}
void
CXWindowsEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const
XWindowsEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const
{
delete timer;
}
void
CXWindowsEventQueueBuffer::flush()
XWindowsEventQueueBuffer::flush()
{
// note -- m_mutex must be locked on entry

View File

@ -31,10 +31,10 @@
class IEventQueue;
//! Event queue buffer for X11
class CXWindowsEventQueueBuffer : public IEventQueueBuffer {
class XWindowsEventQueueBuffer : public IEventQueueBuffer {
public:
CXWindowsEventQueueBuffer(Display*, Window, IEventQueue* events);
virtual ~CXWindowsEventQueueBuffer();
XWindowsEventQueueBuffer(Display*, Window, IEventQueue* events);
virtual ~XWindowsEventQueueBuffer();
// IEventQueueBuffer overrides
virtual void init() { }

View File

@ -40,7 +40,7 @@
static const size_t ModifiersFromXDefaultSize = 32;
CXWindowsKeyState::CXWindowsKeyState(
XWindowsKeyState::XWindowsKeyState(
Display* display, bool useXKB,
IEventQueue* events) :
KeyState(events),
@ -50,7 +50,7 @@ CXWindowsKeyState::CXWindowsKeyState(
init(display, useXKB);
}
CXWindowsKeyState::CXWindowsKeyState(
XWindowsKeyState::XWindowsKeyState(
Display* display, bool useXKB,
IEventQueue* events, synergy::KeyMap& keyMap) :
KeyState(events, keyMap),
@ -60,7 +60,7 @@ CXWindowsKeyState::CXWindowsKeyState(
init(display, useXKB);
}
CXWindowsKeyState::~CXWindowsKeyState()
XWindowsKeyState::~XWindowsKeyState()
{
#if HAVE_XKB_EXTENSION
if (m_xkb != NULL) {
@ -70,7 +70,7 @@ CXWindowsKeyState::~CXWindowsKeyState()
}
void
CXWindowsKeyState::init(Display* display, bool useXKB)
XWindowsKeyState::init(Display* display, bool useXKB)
{
XGetKeyboardControl(m_display, &m_keyboardState);
#if HAVE_XKB_EXTENSION
@ -86,7 +86,7 @@ CXWindowsKeyState::init(Display* display, bool useXKB)
}
void
CXWindowsKeyState::setActiveGroup(SInt32 group)
XWindowsKeyState::setActiveGroup(SInt32 group)
{
if (group == kGroupPollAndSet) {
// we need to set the group to -1 in order for pollActiveGroup() to
@ -104,13 +104,13 @@ CXWindowsKeyState::setActiveGroup(SInt32 group)
}
void
CXWindowsKeyState::setAutoRepeat(const XKeyboardState& state)
XWindowsKeyState::setAutoRepeat(const XKeyboardState& state)
{
m_keyboardState = state;
}
KeyModifierMask
CXWindowsKeyState::mapModifiersFromX(unsigned int state) const
XWindowsKeyState::mapModifiersFromX(unsigned int state) const
{
LOG((CLOG_DEBUG2 "mapping state: %i", state));
UInt32 offset = 8 * getGroupFromState(state);
@ -130,7 +130,7 @@ CXWindowsKeyState::mapModifiersFromX(unsigned int state) const
}
bool
CXWindowsKeyState::mapModifiersToX(KeyModifierMask mask,
XWindowsKeyState::mapModifiersToX(KeyModifierMask mask,
unsigned int& modifiers) const
{
modifiers = 0;
@ -152,7 +152,7 @@ CXWindowsKeyState::mapModifiersToX(KeyModifierMask mask,
}
void
CXWindowsKeyState::mapKeyToKeycodes(KeyID key, KeycodeList& keycodes) const
XWindowsKeyState::mapKeyToKeycodes(KeyID key, KeycodeList& keycodes) const
{
keycodes.clear();
std::pair<KeyToKeyCodeMap::const_iterator,
@ -165,14 +165,14 @@ CXWindowsKeyState::mapKeyToKeycodes(KeyID key, KeycodeList& keycodes) const
}
bool
CXWindowsKeyState::fakeCtrlAltDel()
XWindowsKeyState::fakeCtrlAltDel()
{
// pass keys through unchanged
return false;
}
KeyModifierMask
CXWindowsKeyState::pollActiveModifiers() const
XWindowsKeyState::pollActiveModifiers() const
{
Window root = DefaultRootWindow(m_display), window;
int xRoot, yRoot, xWindow, yWindow;
@ -185,7 +185,7 @@ CXWindowsKeyState::pollActiveModifiers() const
}
SInt32
CXWindowsKeyState::pollActiveGroup() const
XWindowsKeyState::pollActiveGroup() const
{
// fixed condition where any group < -1 would have undetermined behaviour
if (m_group >= 0) {
@ -204,7 +204,7 @@ CXWindowsKeyState::pollActiveGroup() const
}
void
CXWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
XWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
{
char keys[32];
XQueryKeymap(m_display, keys);
@ -218,7 +218,7 @@ CXWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
}
void
CXWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
XWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
{
// get autorepeat info. we must use the global_auto_repeat told to
// us because it may have modified by synergy.
@ -239,7 +239,7 @@ CXWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
}
void
CXWindowsKeyState::fakeKey(const Keystroke& keystroke)
XWindowsKeyState::fakeKey(const Keystroke& keystroke)
{
switch (keystroke.m_type) {
case Keystroke::kButton:
@ -297,7 +297,7 @@ CXWindowsKeyState::fakeKey(const Keystroke& keystroke)
}
void
CXWindowsKeyState::updateKeysymMap(synergy::KeyMap& keyMap)
XWindowsKeyState::updateKeysymMap(synergy::KeyMap& keyMap)
{
// there are up to 4 keysyms per keycode
static const int maxKeysyms = 4;
@ -462,16 +462,16 @@ CXWindowsKeyState::updateKeysymMap(synergy::KeyMap& keyMap)
// do each keysym (shift level)
for (int j = 0; j < maxKeysyms; ++j) {
item.m_id = CXWindowsUtil::mapKeySymToKeyID(keysyms[j]);
item.m_id = XWindowsUtil::mapKeySymToKeyID(keysyms[j]);
if (item.m_id == kKeyNone) {
if (j != 0 && modifierButtons.count(keycode) > 0) {
// pretend the modifier works in other shift levels
// because it probably does.
if (keysyms[1] == NoSymbol || j != 3) {
item.m_id = CXWindowsUtil::mapKeySymToKeyID(keysyms[0]);
item.m_id = XWindowsUtil::mapKeySymToKeyID(keysyms[0]);
}
else {
item.m_id = CXWindowsUtil::mapKeySymToKeyID(keysyms[1]);
item.m_id = XWindowsUtil::mapKeySymToKeyID(keysyms[1]);
}
}
if (item.m_id == kKeyNone) {
@ -543,7 +543,7 @@ CXWindowsKeyState::updateKeysymMap(synergy::KeyMap& keyMap)
#if HAVE_XKB_EXTENSION
void
CXWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap)
XWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap)
{
static const XkbKTMapEntryRec defMapEntry = {
True, // active
@ -697,7 +697,7 @@ CXWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap)
// for keys that change the group.
item.m_generates = 0;
UInt32 modifierBit =
CXWindowsUtil::getModifierBitForKeySym(keysym);
XWindowsUtil::getModifierBitForKeySym(keysym);
if (isModifier && modifierBit != kKeyModifierBitNone) {
item.m_generates = (1u << modifierBit);
for (SInt32 j = 0; j < 8; ++j) {
@ -737,8 +737,8 @@ CXWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap)
item.m_sensitive |= ShiftMask | LockMask;
KeyID lKeyID = CXWindowsUtil::mapKeySymToKeyID(lKeysym);
KeyID uKeyID = CXWindowsUtil::mapKeySymToKeyID(uKeysym);
KeyID lKeyID = XWindowsUtil::mapKeySymToKeyID(lKeysym);
KeyID uKeyID = XWindowsUtil::mapKeySymToKeyID(uKeysym);
if (lKeyID == kKeyNone || uKeyID == kKeyNone) {
continue;
}
@ -764,7 +764,7 @@ CXWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap)
}
// add entry
item.m_id = CXWindowsUtil::mapKeySymToKeyID(keysym);
item.m_id = XWindowsUtil::mapKeySymToKeyID(keysym);
keyMap.addKeyEntry(item);
if (group == 0) {
m_keyCodeFromKey.insert(std::make_pair(item.m_id, keycode));
@ -774,7 +774,7 @@ CXWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap)
}
// change all modifier masks to synergy masks from X masks
keyMap.foreachKey(&CXWindowsKeyState::remapKeyModifiers, this);
keyMap.foreachKey(&XWindowsKeyState::remapKeyModifiers, this);
// allow composition across groups
keyMap.allowGroupSwitchDuringCompose();
@ -782,10 +782,10 @@ CXWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap)
#endif
void
CXWindowsKeyState::remapKeyModifiers(KeyID id, SInt32 group,
XWindowsKeyState::remapKeyModifiers(KeyID id, SInt32 group,
synergy::KeyMap::KeyItem& item, void* vself)
{
CXWindowsKeyState* self = reinterpret_cast<CXWindowsKeyState*>(vself);
XWindowsKeyState* self = reinterpret_cast<XWindowsKeyState*>(vself);
item.m_required =
self->mapModifiersFromX(XkbBuildCoreState(item.m_required, group));
item.m_sensitive =
@ -793,7 +793,7 @@ CXWindowsKeyState::remapKeyModifiers(KeyID id, SInt32 group,
}
bool
CXWindowsKeyState::hasModifiersXKB() const
XWindowsKeyState::hasModifiersXKB() const
{
#if HAVE_XKB_EXTENSION
// iterate over all keycodes
@ -825,7 +825,7 @@ CXWindowsKeyState::hasModifiersXKB() const
}
int
CXWindowsKeyState::getEffectiveGroup(KeyCode keycode, int group) const
XWindowsKeyState::getEffectiveGroup(KeyCode keycode, int group) const
{
(void)keycode;
#if HAVE_XKB_EXTENSION
@ -856,7 +856,7 @@ CXWindowsKeyState::getEffectiveGroup(KeyCode keycode, int group) const
}
UInt32
CXWindowsKeyState::getGroupFromState(unsigned int state) const
XWindowsKeyState::getGroupFromState(unsigned int state) const
{
#if HAVE_XKB_EXTENSION
if (m_xkb != NULL) {

View File

@ -42,7 +42,7 @@ class IEventQueue;
/*!
A key state for X Windows.
*/
class CXWindowsKeyState : public KeyState {
class XWindowsKeyState : public KeyState {
public:
typedef std::vector<int> KeycodeList;
enum {
@ -50,10 +50,10 @@ public:
kGroupPollAndSet = -2
};
CXWindowsKeyState(Display*, bool useXKB, IEventQueue* events);
CXWindowsKeyState(Display*, bool useXKB,
XWindowsKeyState(Display*, bool useXKB, IEventQueue* events);
XWindowsKeyState(Display*, bool useXKB,
IEventQueue* events, synergy::KeyMap& keyMap);
~CXWindowsKeyState();
~XWindowsKeyState();
//! @name modifiers
//@{

View File

@ -74,11 +74,11 @@
static int xi_opcode;
//
// CXWindowsScreen
// XWindowsScreen
//
// NOTE -- the X display is shared among several objects but is owned
// by the CXWindowsScreen. Xlib is not reentrant so we must ensure
// by the XWindowsScreen. Xlib is not reentrant so we must ensure
// that no two objects can simultaneously call Xlib with the display.
// this is easy since we only make X11 calls from the main thread.
// we must also ensure that these objects do not use the display in
@ -88,9 +88,9 @@ static int xi_opcode;
// display and the X11 event queue buffer, ignore any calls that try
// to use the display, and wait to be destroyed.
CXWindowsScreen* CXWindowsScreen::s_screen = NULL;
XWindowsScreen* XWindowsScreen::s_screen = NULL;
CXWindowsScreen::CXWindowsScreen(
XWindowsScreen::XWindowsScreen(
const char* displayName,
bool isPrimary,
bool disableXInitThreads,
@ -137,16 +137,16 @@ CXWindowsScreen::CXWindowsScreen(
}
// set the X I/O error handler so we catch the display disconnecting
XSetIOErrorHandler(&CXWindowsScreen::ioErrorHandler);
XSetIOErrorHandler(&XWindowsScreen::ioErrorHandler);
try {
m_display = openDisplay(displayName);
m_root = DefaultRootWindow(m_display);
saveShape();
m_window = openWindow();
m_screensaver = new CXWindowsScreenSaver(m_display,
m_screensaver = new XWindowsScreenSaver(m_display,
m_window, getEventTarget(), events);
m_keyState = new CXWindowsKeyState(m_display, m_xkb, events, m_keyMap);
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));
}
@ -183,20 +183,20 @@ CXWindowsScreen::CXWindowsScreen(
// initialize the clipboards
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
m_clipboard[id] = new CXWindowsClipboard(m_display, m_window, id);
m_clipboard[id] = new XWindowsClipboard(m_display, m_window, id);
}
// install event handlers
m_events->adoptHandler(Event::kSystem, m_events->getSystemTarget(),
new TMethodEventJob<CXWindowsScreen>(this,
&CXWindowsScreen::handleSystemEvent));
new TMethodEventJob<XWindowsScreen>(this,
&XWindowsScreen::handleSystemEvent));
// install the platform event queue
m_events->adoptBuffer(new CXWindowsEventQueueBuffer(
m_events->adoptBuffer(new XWindowsEventQueueBuffer(
m_display, m_window, m_events));
}
CXWindowsScreen::~CXWindowsScreen()
XWindowsScreen::~XWindowsScreen()
{
assert(s_screen != NULL);
assert(m_display != NULL);
@ -227,7 +227,7 @@ CXWindowsScreen::~CXWindowsScreen()
}
void
CXWindowsScreen::enable()
XWindowsScreen::enable()
{
if (!m_isPrimary) {
// get the keyboard control state
@ -249,7 +249,7 @@ CXWindowsScreen::enable()
}
void
CXWindowsScreen::disable()
XWindowsScreen::disable()
{
// release input context focus
if (m_ic != NULL) {
@ -267,7 +267,7 @@ CXWindowsScreen::disable()
}
void
CXWindowsScreen::enter()
XWindowsScreen::enter()
{
screensaver(false);
@ -279,7 +279,7 @@ CXWindowsScreen::enter()
// set the input focus to what it had been when we took it
if (m_lastFocus != None) {
// the window may not exist anymore so ignore errors
CXWindowsUtil::ErrorLock lock(m_display);
XWindowsUtil::ErrorLock lock(m_display);
XSetInputFocus(m_display, m_lastFocus, m_lastFocusRevert, CurrentTime);
}
@ -326,7 +326,7 @@ CXWindowsScreen::enter()
}
bool
CXWindowsScreen::leave()
XWindowsScreen::leave()
{
if (!m_isPrimary) {
// restore the previous keyboard auto-repeat state. if the user
@ -383,7 +383,7 @@ CXWindowsScreen::leave()
}
bool
CXWindowsScreen::setClipboard(ClipboardID id, const IClipboard* clipboard)
XWindowsScreen::setClipboard(ClipboardID id, const IClipboard* clipboard)
{
// fail if we don't have the requested clipboard
if (m_clipboard[id] == NULL) {
@ -391,7 +391,7 @@ CXWindowsScreen::setClipboard(ClipboardID id, const IClipboard* clipboard)
}
// get the actual time. ICCCM does not allow CurrentTime.
Time timestamp = CXWindowsUtil::getCurrentTime(
Time timestamp = XWindowsUtil::getCurrentTime(
m_display, m_clipboard[id]->getWindow());
if (clipboard != NULL) {
@ -410,13 +410,13 @@ CXWindowsScreen::setClipboard(ClipboardID id, const IClipboard* clipboard)
}
void
CXWindowsScreen::checkClipboards()
XWindowsScreen::checkClipboards()
{
// do nothing, we're always up to date
}
void
CXWindowsScreen::openScreensaver(bool notify)
XWindowsScreen::openScreensaver(bool notify)
{
m_screensaverNotify = notify;
if (!m_screensaverNotify) {
@ -425,7 +425,7 @@ CXWindowsScreen::openScreensaver(bool notify)
}
void
CXWindowsScreen::closeScreensaver()
XWindowsScreen::closeScreensaver()
{
if (!m_screensaverNotify) {
m_screensaver->enable();
@ -433,7 +433,7 @@ CXWindowsScreen::closeScreensaver()
}
void
CXWindowsScreen::screensaver(bool activate)
XWindowsScreen::screensaver(bool activate)
{
if (activate) {
m_screensaver->activate();
@ -444,14 +444,14 @@ CXWindowsScreen::screensaver(bool activate)
}
void
CXWindowsScreen::resetOptions()
XWindowsScreen::resetOptions()
{
m_xtestIsXineramaUnaware = true;
m_preserveFocus = false;
}
void
CXWindowsScreen::setOptions(const OptionsList& options)
XWindowsScreen::setOptions(const OptionsList& options)
{
for (UInt32 i = 0, n = options.size(); i < n; i += 2) {
if (options[i] == kOptionXTestXineramaUnaware) {
@ -466,25 +466,25 @@ CXWindowsScreen::setOptions(const OptionsList& options)
}
void
CXWindowsScreen::setSequenceNumber(UInt32 seqNum)
XWindowsScreen::setSequenceNumber(UInt32 seqNum)
{
m_sequenceNumber = seqNum;
}
bool
CXWindowsScreen::isPrimary() const
XWindowsScreen::isPrimary() const
{
return m_isPrimary;
}
void*
CXWindowsScreen::getEventTarget() const
XWindowsScreen::getEventTarget() const
{
return const_cast<CXWindowsScreen*>(this);
return const_cast<XWindowsScreen*>(this);
}
bool
CXWindowsScreen::getClipboard(ClipboardID id, IClipboard* clipboard) const
XWindowsScreen::getClipboard(ClipboardID id, IClipboard* clipboard) const
{
assert(clipboard != NULL);
@ -494,7 +494,7 @@ CXWindowsScreen::getClipboard(ClipboardID id, IClipboard* clipboard) const
}
// get the actual time. ICCCM does not allow CurrentTime.
Time timestamp = CXWindowsUtil::getCurrentTime(
Time timestamp = XWindowsUtil::getCurrentTime(
m_display, m_clipboard[id]->getWindow());
// copy the clipboard
@ -502,7 +502,7 @@ CXWindowsScreen::getClipboard(ClipboardID id, IClipboard* clipboard) const
}
void
CXWindowsScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
XWindowsScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
{
x = m_x;
y = m_y;
@ -511,7 +511,7 @@ CXWindowsScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
}
void
CXWindowsScreen::getCursorPos(SInt32& x, SInt32& y) const
XWindowsScreen::getCursorPos(SInt32& x, SInt32& y) const
{
Window root, window;
int mx, my, xWindow, yWindow;
@ -528,13 +528,13 @@ CXWindowsScreen::getCursorPos(SInt32& x, SInt32& y) const
}
void
CXWindowsScreen::reconfigure(UInt32)
XWindowsScreen::reconfigure(UInt32)
{
// do nothing
}
void
CXWindowsScreen::warpCursor(SInt32 x, SInt32 y)
XWindowsScreen::warpCursor(SInt32 x, SInt32 y)
{
// warp mouse
warpCursorNoFlush(x, y);
@ -555,7 +555,7 @@ CXWindowsScreen::warpCursor(SInt32 x, SInt32 y)
}
UInt32
CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
{
// only allow certain modifiers
if ((mask & ~(KeyModifierShift | KeyModifierControl |
@ -576,7 +576,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
return 0;
}
CXWindowsKeyState::KeycodeList keycodes;
XWindowsKeyState::KeycodeList keycodes;
m_keyState->mapKeyToKeycodes(key, keycodes);
if (key != kKeyNone && keycodes.empty()) {
// can't map key
@ -600,7 +600,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
// requested modifiers.
bool err = false;
{
CXWindowsUtil::ErrorLock lock(m_display, &err);
XWindowsUtil::ErrorLock lock(m_display, &err);
if (key == kKeyNone) {
static const KeyModifierMask s_hotKeyModifiers[] = {
KeyModifierShift,
@ -704,7 +704,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
}
for (CXWindowsKeyState::KeycodeList::iterator j = keycodes.begin();
for (XWindowsKeyState::KeycodeList::iterator j = keycodes.begin();
j != keycodes.end() && !err; ++j) {
for (size_t i = 0; i < (1u << numToggleModifiers); ++i) {
// add toggle modifiers for index i
@ -750,7 +750,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
}
void
CXWindowsScreen::unregisterHotKey(UInt32 id)
XWindowsScreen::unregisterHotKey(UInt32 id)
{
// look up hotkey
HotKeyMap::iterator i = m_hotKeys.find(id);
@ -761,7 +761,7 @@ CXWindowsScreen::unregisterHotKey(UInt32 id)
// unregister with OS
bool err = false;
{
CXWindowsUtil::ErrorLock lock(m_display, &err);
XWindowsUtil::ErrorLock lock(m_display, &err);
HotKeyList& hotKeys = i->second;
for (HotKeyList::iterator j = hotKeys.begin();
j != hotKeys.end(); ++j) {
@ -782,25 +782,25 @@ CXWindowsScreen::unregisterHotKey(UInt32 id)
}
void
CXWindowsScreen::fakeInputBegin()
XWindowsScreen::fakeInputBegin()
{
// FIXME -- not implemented
}
void
CXWindowsScreen::fakeInputEnd()
XWindowsScreen::fakeInputEnd()
{
// FIXME -- not implemented
}
SInt32
CXWindowsScreen::getJumpZoneSize() const
XWindowsScreen::getJumpZoneSize() const
{
return 1;
}
bool
CXWindowsScreen::isAnyMouseButtonDown(UInt32& buttonID) const
XWindowsScreen::isAnyMouseButtonDown(UInt32& buttonID) const
{
// query the pointer to get the button state
Window root, window;
@ -816,14 +816,14 @@ CXWindowsScreen::isAnyMouseButtonDown(UInt32& buttonID) const
}
void
CXWindowsScreen::getCursorCenter(SInt32& x, SInt32& y) const
XWindowsScreen::getCursorCenter(SInt32& x, SInt32& y) const
{
x = m_xCenter;
y = m_yCenter;
}
void
CXWindowsScreen::fakeMouseButton(ButtonID button, bool press)
XWindowsScreen::fakeMouseButton(ButtonID button, bool press)
{
const unsigned int xButton = mapButtonToX(button);
if (xButton != 0) {
@ -834,7 +834,7 @@ CXWindowsScreen::fakeMouseButton(ButtonID button, bool press)
}
void
CXWindowsScreen::fakeMouseMove(SInt32 x, SInt32 y)
XWindowsScreen::fakeMouseMove(SInt32 x, SInt32 y)
{
if (m_xinerama && m_xtestIsXineramaUnaware) {
XWarpPointer(m_display, None, m_root, 0, 0, 0, 0, x, y);
@ -847,7 +847,7 @@ CXWindowsScreen::fakeMouseMove(SInt32 x, SInt32 y)
}
void
CXWindowsScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
XWindowsScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
{
// FIXME -- ignore xinerama for now
if (false && m_xinerama && m_xtestIsXineramaUnaware) {
@ -860,7 +860,7 @@ CXWindowsScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
}
void
CXWindowsScreen::fakeMouseWheel(SInt32, SInt32 yDelta) const
XWindowsScreen::fakeMouseWheel(SInt32, SInt32 yDelta) const
{
// XXX -- support x-axis scrolling
if (yDelta == 0) {
@ -906,7 +906,7 @@ CXWindowsScreen::fakeMouseWheel(SInt32, SInt32 yDelta) const
}
Display*
CXWindowsScreen::openDisplay(const char* displayName)
XWindowsScreen::openDisplay(const char* displayName)
{
// get the DISPLAY
if (displayName == NULL) {
@ -967,7 +967,7 @@ CXWindowsScreen::openDisplay(const char* displayName)
}
void
CXWindowsScreen::saveShape()
XWindowsScreen::saveShape()
{
// get shape of default screen
m_x = 0;
@ -1030,7 +1030,7 @@ CXWindowsScreen::saveShape()
}
Window
CXWindowsScreen::openWindow() const
XWindowsScreen::openWindow() const
{
// default window attributes. we don't want the window manager
// messing with our window and we don't want the cursor to be
@ -1082,7 +1082,7 @@ CXWindowsScreen::openWindow() const
}
void
CXWindowsScreen::openIM()
XWindowsScreen::openIM()
{
// open the input methods
XIM im = XOpenIM(m_display, NULL, NULL, NULL);
@ -1145,13 +1145,13 @@ CXWindowsScreen::openIM()
}
void
CXWindowsScreen::sendEvent(Event::Type type, void* data)
XWindowsScreen::sendEvent(Event::Type type, void* data)
{
m_events->addEvent(Event(type, getEventTarget(), data));
}
void
CXWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
XWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
{
ClipboardInfo* info = (ClipboardInfo*)malloc(sizeof(ClipboardInfo));
info->m_id = id;
@ -1160,13 +1160,13 @@ CXWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id)
}
IKeyState*
CXWindowsScreen::getKeyState() const
XWindowsScreen::getKeyState() const
{
return m_keyState;
}
Bool
CXWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
XWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
{
KeyEventFilter* filter = reinterpret_cast<KeyEventFilter*>(arg);
return (xevent->type == filter->m_event &&
@ -1176,7 +1176,7 @@ CXWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg)
}
void
CXWindowsScreen::handleSystemEvent(const Event& event, void*)
XWindowsScreen::handleSystemEvent(const Event& event, void*)
{
XEvent* xevent = reinterpret_cast<XEvent*>(event.getData());
assert(xevent != NULL);
@ -1196,7 +1196,7 @@ CXWindowsScreen::handleSystemEvent(const Event& event, void*)
filter.m_keycode = xevent->xkey.keycode;
XEvent xevent2;
isRepeat = (XCheckIfEvent(m_display, &xevent2,
&CXWindowsScreen::findKeyEvent,
&XWindowsScreen::findKeyEvent,
(XPointer)&filter) == True);
}
@ -1451,7 +1451,7 @@ CXWindowsScreen::handleSystemEvent(const Event& event, void*)
}
void
CXWindowsScreen::onKeyPress(XKeyEvent& xkey)
XWindowsScreen::onKeyPress(XKeyEvent& xkey)
{
LOG((CLOG_DEBUG1 "event: KeyPress code=%d, state=0x%04x", xkey.keycode, xkey.state));
const KeyModifierMask mask = m_keyState->mapModifiersFromX(xkey.state);
@ -1492,7 +1492,7 @@ CXWindowsScreen::onKeyPress(XKeyEvent& xkey)
}
void
CXWindowsScreen::onKeyRelease(XKeyEvent& xkey, bool isRepeat)
XWindowsScreen::onKeyRelease(XKeyEvent& xkey, bool isRepeat)
{
const KeyModifierMask mask = m_keyState->mapModifiersFromX(xkey.state);
KeyID key = mapKeyFromX(&xkey);
@ -1527,7 +1527,7 @@ CXWindowsScreen::onKeyRelease(XKeyEvent& xkey, bool isRepeat)
}
bool
CXWindowsScreen::onHotKey(XKeyEvent& xkey, bool isRepeat)
XWindowsScreen::onHotKey(XKeyEvent& xkey, bool isRepeat)
{
// find the hot key id
HotKeyToIDMap::const_iterator i =
@ -1557,7 +1557,7 @@ CXWindowsScreen::onHotKey(XKeyEvent& xkey, bool isRepeat)
}
void
CXWindowsScreen::onMousePress(const XButtonEvent& xbutton)
XWindowsScreen::onMousePress(const XButtonEvent& xbutton)
{
LOG((CLOG_DEBUG1 "event: ButtonPress button=%d", xbutton.button));
ButtonID button = mapButtonFromX(&xbutton);
@ -1568,7 +1568,7 @@ CXWindowsScreen::onMousePress(const XButtonEvent& xbutton)
}
void
CXWindowsScreen::onMouseRelease(const XButtonEvent& xbutton)
XWindowsScreen::onMouseRelease(const XButtonEvent& xbutton)
{
LOG((CLOG_DEBUG1 "event: ButtonRelease button=%d", xbutton.button));
ButtonID button = mapButtonFromX(&xbutton);
@ -1588,7 +1588,7 @@ CXWindowsScreen::onMouseRelease(const XButtonEvent& xbutton)
}
void
CXWindowsScreen::onMouseMove(const XMotionEvent& xmotion)
XWindowsScreen::onMouseMove(const XMotionEvent& xmotion)
{
LOG((CLOG_DEBUG2 "event: MotionNotify %d,%d", xmotion.x_root, xmotion.y_root));
@ -1657,7 +1657,7 @@ CXWindowsScreen::onMouseMove(const XMotionEvent& xmotion)
}
Cursor
CXWindowsScreen::createBlankCursor() const
XWindowsScreen::createBlankCursor() const
{
// this seems just a bit more complicated than really necessary
@ -1693,7 +1693,7 @@ CXWindowsScreen::createBlankCursor() const
}
ClipboardID
CXWindowsScreen::getClipboardID(Atom selection) const
XWindowsScreen::getClipboardID(Atom selection) const
{
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
if (m_clipboard[id] != NULL &&
@ -1705,7 +1705,7 @@ CXWindowsScreen::getClipboardID(Atom selection) const
}
void
CXWindowsScreen::processClipboardRequest(Window requestor,
XWindowsScreen::processClipboardRequest(Window requestor,
Time time, Atom property)
{
// check every clipboard until one returns success
@ -1718,7 +1718,7 @@ CXWindowsScreen::processClipboardRequest(Window requestor,
}
void
CXWindowsScreen::destroyClipboardRequest(Window requestor)
XWindowsScreen::destroyClipboardRequest(Window requestor)
{
// check every clipboard until one returns success
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
@ -1730,7 +1730,7 @@ CXWindowsScreen::destroyClipboardRequest(Window requestor)
}
void
CXWindowsScreen::onError()
XWindowsScreen::onError()
{
// prevent further access to the X display
m_events->adoptBuffer(NULL);
@ -1752,7 +1752,7 @@ CXWindowsScreen::onError()
}
int
CXWindowsScreen::ioErrorHandler(Display*)
XWindowsScreen::ioErrorHandler(Display*)
{
// the display has disconnected, probably because X is shutting
// down. X forces us to exit at this point which is annoying.
@ -1764,19 +1764,19 @@ CXWindowsScreen::ioErrorHandler(Display*)
}
void
CXWindowsScreen::selectEvents(Window w) const
XWindowsScreen::selectEvents(Window w) const
{
// ignore errors while we adjust event masks. windows could be
// destroyed at any time after the XQueryTree() in doSelectEvents()
// so we must ignore BadWindow errors.
CXWindowsUtil::ErrorLock lock(m_display);
XWindowsUtil::ErrorLock lock(m_display);
// adjust event masks
doSelectEvents(w);
}
void
CXWindowsScreen::doSelectEvents(Window w) const
XWindowsScreen::doSelectEvents(Window w) const
{
// we want to track the mouse everywhere on the display. to achieve
// that we select PointerMotionMask on every window. we also select
@ -1821,7 +1821,7 @@ CXWindowsScreen::doSelectEvents(Window w) const
}
KeyID
CXWindowsScreen::mapKeyFromX(XKeyEvent* event) const
XWindowsScreen::mapKeyFromX(XKeyEvent* event) const
{
// convert to a keysym
KeySym keysym;
@ -1861,11 +1861,11 @@ CXWindowsScreen::mapKeyFromX(XKeyEvent* event) const
}
// convert key
return CXWindowsUtil::mapKeySymToKeyID(keysym);
return XWindowsUtil::mapKeySymToKeyID(keysym);
}
ButtonID
CXWindowsScreen::mapButtonFromX(const XButtonEvent* event) const
XWindowsScreen::mapButtonFromX(const XButtonEvent* event) const
{
unsigned int button = event->button;
@ -1887,7 +1887,7 @@ CXWindowsScreen::mapButtonFromX(const XButtonEvent* event) const
}
unsigned int
CXWindowsScreen::mapButtonToX(ButtonID id) const
XWindowsScreen::mapButtonToX(ButtonID id) const
{
// map button -1 to button 4 (+wheel)
if (id == static_cast<ButtonID>(-1)) {
@ -1916,7 +1916,7 @@ CXWindowsScreen::mapButtonToX(ButtonID id) const
}
void
CXWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
XWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
{
assert(m_window != None);
@ -1949,7 +1949,7 @@ CXWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
}
void
CXWindowsScreen::updateButtons()
XWindowsScreen::updateButtons()
{
// query the button mapping
UInt32 numButtons = XGetPointerMapping(m_display, NULL, 0);
@ -1981,7 +1981,7 @@ CXWindowsScreen::updateButtons()
}
bool
CXWindowsScreen::grabMouseAndKeyboard()
XWindowsScreen::grabMouseAndKeyboard()
{
unsigned int event_mask = ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask;
@ -2030,7 +2030,7 @@ CXWindowsScreen::grabMouseAndKeyboard()
}
void
CXWindowsScreen::refreshKeyboard(XEvent* event)
XWindowsScreen::refreshKeyboard(XEvent* event)
{
if (XPending(m_display) > 0) {
XEvent tmpEvent;
@ -2059,10 +2059,10 @@ CXWindowsScreen::refreshKeyboard(XEvent* event)
//
// CXWindowsScreen::HotKeyItem
// XWindowsScreen::HotKeyItem
//
CXWindowsScreen::HotKeyItem::HotKeyItem(int keycode, unsigned int mask) :
XWindowsScreen::HotKeyItem::HotKeyItem(int keycode, unsigned int mask) :
m_keycode(keycode),
m_mask(mask)
{
@ -2070,14 +2070,14 @@ CXWindowsScreen::HotKeyItem::HotKeyItem(int keycode, unsigned int mask) :
}
bool
CXWindowsScreen::HotKeyItem::operator<(const HotKeyItem& x) const
XWindowsScreen::HotKeyItem::operator<(const HotKeyItem& x) const
{
return (m_keycode < x.m_keycode ||
(m_keycode == x.m_keycode && m_mask < x.m_mask));
}
bool
CXWindowsScreen::detectXI2()
XWindowsScreen::detectXI2()
{
int event, error;
return XQueryExtension(m_display,
@ -2086,7 +2086,7 @@ CXWindowsScreen::detectXI2()
#ifdef HAVE_XI2
void
CXWindowsScreen::selectXIRawMotion()
XWindowsScreen::selectXIRawMotion()
{
XIEventMask mask;

View File

@ -29,17 +29,17 @@
# include <X11/Xlib.h>
#endif
class CXWindowsClipboard;
class CXWindowsKeyState;
class CXWindowsScreenSaver;
class XWindowsClipboard;
class XWindowsKeyState;
class XWindowsScreenSaver;
//! Implementation of IPlatformScreen for X11
class CXWindowsScreen : public PlatformScreen {
class XWindowsScreen : public PlatformScreen {
public:
CXWindowsScreen(const char* displayName, bool isPrimary,
XWindowsScreen(const char* displayName, bool isPrimary,
bool disableXInitThreads, int mouseScrollDelta,
IEventQueue* events);
virtual ~CXWindowsScreen();
virtual ~XWindowsScreen();
//! @name manipulators
//@{
@ -190,7 +190,7 @@ private:
SInt32 m_xCursor, m_yCursor;
// keyboard stuff
CXWindowsKeyState* m_keyState;
XWindowsKeyState* m_keyState;
// hot key stuff
HotKeyMap m_hotKeys;
@ -208,11 +208,11 @@ private:
FilteredKeycodes m_filtered;
// clipboards
CXWindowsClipboard* m_clipboard[kClipboardEnd];
XWindowsClipboard* m_clipboard[kClipboardEnd];
UInt32 m_sequenceNumber;
// screen saver stuff
CXWindowsScreenSaver* m_screensaver;
XWindowsScreenSaver* m_screensaver;
bool m_screensaverNotify;
// logical to physical button mapping. m_buttons[i] gives the
@ -248,5 +248,5 @@ private:
// pointer to (singleton) screen. this is only needed by
// ioErrorHandler().
static CXWindowsScreen* s_screen;
static XWindowsScreen* s_screen;
};

View File

@ -55,10 +55,10 @@ extern Status DPMSInfo(Display *, CARD16 *, BOOL *);
#endif
//
// CXWindowsScreenSaver
// XWindowsScreenSaver
//
CXWindowsScreenSaver::CXWindowsScreenSaver(
XWindowsScreenSaver::XWindowsScreenSaver(
Display* display, Window window, void* eventTarget, IEventQueue* events) :
m_display(display),
m_xscreensaverSink(window),
@ -97,7 +97,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
// watch top-level windows for changes
bool error = false;
{
CXWindowsUtil::ErrorLock lock(m_display, &error);
XWindowsUtil::ErrorLock lock(m_display, &error);
Window root = DefaultRootWindow(m_display);
XWindowAttributes attr;
XGetWindowAttributes(m_display, root, &attr);
@ -123,11 +123,11 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
// install disable timer event handler
m_events->adoptHandler(Event::kTimer, this,
new TMethodEventJob<CXWindowsScreenSaver>(this,
&CXWindowsScreenSaver::handleDisableTimer));
new TMethodEventJob<XWindowsScreenSaver>(this,
&XWindowsScreenSaver::handleDisableTimer));
}
CXWindowsScreenSaver::~CXWindowsScreenSaver()
XWindowsScreenSaver::~XWindowsScreenSaver()
{
// done with disable job
if (m_disableTimer != NULL) {
@ -140,20 +140,20 @@ CXWindowsScreenSaver::~CXWindowsScreenSaver()
XSetScreenSaver(m_display, m_timeout, m_interval,
m_preferBlanking, m_allowExposures);
clearWatchForXScreenSaver();
CXWindowsUtil::ErrorLock lock(m_display);
XWindowsUtil::ErrorLock lock(m_display);
XSelectInput(m_display, DefaultRootWindow(m_display), m_rootEventMask);
}
}
void
CXWindowsScreenSaver::destroy()
XWindowsScreenSaver::destroy()
{
m_display = NULL;
delete this;
}
bool
CXWindowsScreenSaver::handleXEvent(const XEvent* xevent)
XWindowsScreenSaver::handleXEvent(const XEvent* xevent)
{
switch (xevent->type) {
case CreateNotify:
@ -214,7 +214,7 @@ CXWindowsScreenSaver::handleXEvent(const XEvent* xevent)
}
void
CXWindowsScreenSaver::enable()
XWindowsScreenSaver::enable()
{
// for xscreensaver
m_disabled = false;
@ -229,7 +229,7 @@ CXWindowsScreenSaver::enable()
}
void
CXWindowsScreenSaver::disable()
XWindowsScreenSaver::disable()
{
// for xscreensaver
m_disabled = true;
@ -249,7 +249,7 @@ CXWindowsScreenSaver::disable()
}
void
CXWindowsScreenSaver::activate()
XWindowsScreenSaver::activate()
{
// remove disable job timer
m_suppressDisable = true;
@ -275,7 +275,7 @@ CXWindowsScreenSaver::activate()
}
void
CXWindowsScreenSaver::deactivate()
XWindowsScreenSaver::deactivate()
{
// reinstall disable job timer
m_suppressDisable = false;
@ -301,7 +301,7 @@ CXWindowsScreenSaver::deactivate()
}
bool
CXWindowsScreenSaver::isActive() const
XWindowsScreenSaver::isActive() const
{
// check xscreensaver
if (m_xscreensaver != None) {
@ -318,7 +318,7 @@ CXWindowsScreenSaver::isActive() const
}
bool
CXWindowsScreenSaver::findXScreenSaver()
XWindowsScreenSaver::findXScreenSaver()
{
// do nothing if we've already got the xscreensaver window
if (m_xscreensaver == None) {
@ -341,7 +341,7 @@ CXWindowsScreenSaver::findXScreenSaver()
}
void
CXWindowsScreenSaver::setXScreenSaver(Window window)
XWindowsScreenSaver::setXScreenSaver(Window window)
{
LOG((CLOG_DEBUG "xscreensaver window: 0x%08x", window));
@ -356,7 +356,7 @@ CXWindowsScreenSaver::setXScreenSaver(Window window)
bool error = false;
XWindowAttributes attr;
{
CXWindowsUtil::ErrorLock lock(m_display, &error);
XWindowsUtil::ErrorLock lock(m_display, &error);
XGetWindowAttributes(m_display, m_xscreensaver, &attr);
}
setXScreenSaverActive(!error && attr.map_state != IsUnmapped);
@ -374,18 +374,18 @@ CXWindowsScreenSaver::setXScreenSaver(Window window)
}
bool
CXWindowsScreenSaver::isXScreenSaver(Window w) const
XWindowsScreenSaver::isXScreenSaver(Window w) const
{
// check for m_atomScreenSaverVersion string property
Atom type;
return (CXWindowsUtil::getWindowProperty(m_display, w,
return (XWindowsUtil::getWindowProperty(m_display, w,
m_atomScreenSaverVersion,
NULL, &type, NULL, False) &&
type == XA_STRING);
}
void
CXWindowsScreenSaver::setXScreenSaverActive(bool activated)
XWindowsScreenSaver::setXScreenSaverActive(bool activated)
{
if (m_xscreensaverActive != activated) {
LOG((CLOG_DEBUG "xscreensaver %s on window 0x%08x", activated ? "activated" : "deactivated", m_xscreensaver));
@ -412,7 +412,7 @@ CXWindowsScreenSaver::setXScreenSaverActive(bool activated)
}
void
CXWindowsScreenSaver::sendXScreenSaverCommand(Atom cmd, long arg1, long arg2)
XWindowsScreenSaver::sendXScreenSaverCommand(Atom cmd, long arg1, long arg2)
{
XEvent event;
event.xclient.type = ClientMessage;
@ -429,7 +429,7 @@ CXWindowsScreenSaver::sendXScreenSaverCommand(Atom cmd, long arg1, long arg2)
LOG((CLOG_DEBUG "send xscreensaver command: %d %d %d", (long)cmd, arg1, arg2));
bool error = false;
{
CXWindowsUtil::ErrorLock lock(m_display, &error);
XWindowsUtil::ErrorLock lock(m_display, &error);
XSendEvent(m_display, m_xscreensaver, False, 0, &event);
}
if (error) {
@ -438,7 +438,7 @@ CXWindowsScreenSaver::sendXScreenSaverCommand(Atom cmd, long arg1, long arg2)
}
void
CXWindowsScreenSaver::watchForXScreenSaver()
XWindowsScreenSaver::watchForXScreenSaver()
{
// clear old watch list
clearWatchForXScreenSaver();
@ -463,10 +463,10 @@ CXWindowsScreenSaver::watchForXScreenSaver()
}
void
CXWindowsScreenSaver::clearWatchForXScreenSaver()
XWindowsScreenSaver::clearWatchForXScreenSaver()
{
// stop watching all windows
CXWindowsUtil::ErrorLock lock(m_display);
XWindowsUtil::ErrorLock lock(m_display);
for (WatchList::iterator index = m_watchWindows.begin();
index != m_watchWindows.end(); ++index) {
XSelectInput(m_display, index->first, index->second);
@ -475,13 +475,13 @@ CXWindowsScreenSaver::clearWatchForXScreenSaver()
}
void
CXWindowsScreenSaver::addWatchXScreenSaver(Window window)
XWindowsScreenSaver::addWatchXScreenSaver(Window window)
{
// get window attributes
bool error = false;
XWindowAttributes attr;
{
CXWindowsUtil::ErrorLock lock(m_display, &error);
XWindowsUtil::ErrorLock lock(m_display, &error);
XGetWindowAttributes(m_display, window, &attr);
}
@ -490,7 +490,7 @@ CXWindowsScreenSaver::addWatchXScreenSaver(Window window)
if (!error && attr.override_redirect == True) {
error = false;
{
CXWindowsUtil::ErrorLock lock(m_display, &error);
XWindowsUtil::ErrorLock lock(m_display, &error);
XSelectInput(m_display, window,
attr.your_event_mask | PropertyChangeMask);
}
@ -502,7 +502,7 @@ CXWindowsScreenSaver::addWatchXScreenSaver(Window window)
}
void
CXWindowsScreenSaver::updateDisableTimer()
XWindowsScreenSaver::updateDisableTimer()
{
if (m_disabled && !m_suppressDisable && m_disableTimer == NULL) {
// 5 seconds should be plenty often to suppress the screen saver
@ -515,7 +515,7 @@ CXWindowsScreenSaver::updateDisableTimer()
}
void
CXWindowsScreenSaver::handleDisableTimer(const Event&, void*)
XWindowsScreenSaver::handleDisableTimer(const Event&, void*)
{
// send fake mouse motion directly to xscreensaver
if (m_xscreensaver != None) {
@ -534,7 +534,7 @@ CXWindowsScreenSaver::handleDisableTimer(const Event&, void*)
event.xmotion.is_hint = NotifyNormal;
event.xmotion.same_screen = True;
CXWindowsUtil::ErrorLock lock(m_display);
XWindowsUtil::ErrorLock lock(m_display);
XSendEvent(m_display, m_xscreensaver, False, 0, &event);
m_disablePos = 20 - m_disablePos;
@ -542,19 +542,19 @@ CXWindowsScreenSaver::handleDisableTimer(const Event&, void*)
}
void
CXWindowsScreenSaver::activateDPMS(bool activate)
XWindowsScreenSaver::activateDPMS(bool activate)
{
#if HAVE_X11_EXTENSIONS_DPMS_H
if (m_dpms) {
// DPMSForceLevel will generate a BadMatch if DPMS is disabled
CXWindowsUtil::ErrorLock lock(m_display);
XWindowsUtil::ErrorLock lock(m_display);
DPMSForceLevel(m_display, activate ? DPMSModeStandby : DPMSModeOn);
}
#endif
}
void
CXWindowsScreenSaver::enableDPMS(bool enable)
XWindowsScreenSaver::enableDPMS(bool enable)
{
#if HAVE_X11_EXTENSIONS_DPMS_H
if (m_dpms) {
@ -569,7 +569,7 @@ CXWindowsScreenSaver::enableDPMS(bool enable)
}
bool
CXWindowsScreenSaver::isDPMSEnabled() const
XWindowsScreenSaver::isDPMSEnabled() const
{
#if HAVE_X11_EXTENSIONS_DPMS_H
if (m_dpms) {
@ -587,7 +587,7 @@ CXWindowsScreenSaver::isDPMSEnabled() const
}
bool
CXWindowsScreenSaver::isDPMSActivated() const
XWindowsScreenSaver::isDPMSActivated() const
{
#if HAVE_X11_EXTENSIONS_DPMS_H
if (m_dpms) {

View File

@ -32,10 +32,10 @@ class Event;
class EventQueueTimer;
//! X11 screen saver implementation
class CXWindowsScreenSaver : public IScreenSaver {
class XWindowsScreenSaver : public IScreenSaver {
public:
CXWindowsScreenSaver(Display*, Window, void* eventTarget, IEventQueue* events);
virtual ~CXWindowsScreenSaver();
XWindowsScreenSaver(Display*, Window, void* eventTarget, IEventQueue* events);
virtual ~XWindowsScreenSaver();
//! @name manipulators
//@{

View File

@ -1287,13 +1287,13 @@ static const KeySym s_map1008FF[] =
//
// CXWindowsUtil
// XWindowsUtil
//
CXWindowsUtil::KeySymMap CXWindowsUtil::s_keySymToUCS4;
XWindowsUtil::KeySymMap XWindowsUtil::s_keySymToUCS4;
bool
CXWindowsUtil::getWindowProperty(Display* display, Window window,
XWindowsUtil::getWindowProperty(Display* display, Window window,
Atom property, String* data, Atom* type,
SInt32* format, bool deleteProperty)
{
@ -1303,7 +1303,7 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window,
int actualDatumSize;
// ignore errors. XGetWindowProperty() will report failure.
CXWindowsUtil::ErrorLock lock(display);
XWindowsUtil::ErrorLock lock(display);
// read the property
bool okay = true;
@ -1381,7 +1381,7 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window,
}
bool
CXWindowsUtil::setWindowProperty(Display* display, Window window,
XWindowsUtil::setWindowProperty(Display* display, Window window,
Atom property, const void* vdata, UInt32 size,
Atom type, SInt32 format)
{
@ -1395,7 +1395,7 @@ CXWindowsUtil::setWindowProperty(Display* display, Window window,
// save errors
bool error = false;
CXWindowsUtil::ErrorLock lock(display, &error);
XWindowsUtil::ErrorLock lock(display, &error);
// how much data to send in first chunk?
UInt32 chunkSize = size;
@ -1427,7 +1427,7 @@ CXWindowsUtil::setWindowProperty(Display* display, Window window,
}
Time
CXWindowsUtil::getCurrentTime(Display* display, Window window)
XWindowsUtil::getCurrentTime(Display* display, Window window)
{
// select property events on window
XWindowAttributes attr;
@ -1451,7 +1451,7 @@ CXWindowsUtil::getCurrentTime(Display* display, Window window)
// wait for reply
XEvent xevent;
XIfEvent(display, &xevent, &CXWindowsUtil::propertyNotifyPredicate,
XIfEvent(display, &xevent, &XWindowsUtil::propertyNotifyPredicate,
(XPointer)&filter);
assert(xevent.type == PropertyNotify);
assert(xevent.xproperty.window == window);
@ -1464,7 +1464,7 @@ CXWindowsUtil::getCurrentTime(Display* display, Window window)
}
KeyID
CXWindowsUtil::mapKeySymToKeyID(KeySym k)
XWindowsUtil::mapKeySymToKeyID(KeySym k)
{
initKeyMaps();
@ -1558,7 +1558,7 @@ CXWindowsUtil::mapKeySymToKeyID(KeySym k)
}
UInt32
CXWindowsUtil::getModifierBitForKeySym(KeySym keysym)
XWindowsUtil::getModifierBitForKeySym(KeySym keysym)
{
switch (keysym) {
case XK_Shift_L:
@ -1607,14 +1607,14 @@ CXWindowsUtil::getModifierBitForKeySym(KeySym keysym)
}
String
CXWindowsUtil::atomToString(Display* display, Atom atom)
XWindowsUtil::atomToString(Display* display, Atom atom)
{
if (atom == 0) {
return "None";
}
bool error = false;
CXWindowsUtil::ErrorLock lock(display, &error);
XWindowsUtil::ErrorLock lock(display, &error);
char* name = XGetAtomName(display, atom);
if (error) {
return synergy::string::sprintf("<UNKNOWN> (%d)", (int)atom);
@ -1627,11 +1627,11 @@ CXWindowsUtil::atomToString(Display* display, Atom atom)
}
String
CXWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num)
XWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num)
{
char** names = new char*[num];
bool error = false;
CXWindowsUtil::ErrorLock lock(display, &error);
XWindowsUtil::ErrorLock lock(display, &error);
XGetAtomNames(display, const_cast<Atom*>(atom), (int)num, names);
String msg;
if (error) {
@ -1653,7 +1653,7 @@ CXWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num)
}
void
CXWindowsUtil::convertAtomProperty(String& data)
XWindowsUtil::convertAtomProperty(String& data)
{
// as best i can tell, 64-bit systems don't pack Atoms into properties
// as 32-bit numbers but rather as the 64-bit numbers they are. that
@ -1668,13 +1668,13 @@ CXWindowsUtil::convertAtomProperty(String& data)
}
void
CXWindowsUtil::appendAtomData(String& data, Atom atom)
XWindowsUtil::appendAtomData(String& data, Atom atom)
{
data.append(reinterpret_cast<char*>(&atom), sizeof(Atom));
}
void
CXWindowsUtil::replaceAtomData(String& data, UInt32 index, Atom atom)
XWindowsUtil::replaceAtomData(String& data, UInt32 index, Atom atom)
{
data.replace(index * sizeof(Atom), sizeof(Atom),
reinterpret_cast<const char*>(&atom),
@ -1682,13 +1682,13 @@ CXWindowsUtil::replaceAtomData(String& data, UInt32 index, Atom atom)
}
void
CXWindowsUtil::appendTimeData(String& data, Time time)
XWindowsUtil::appendTimeData(String& data, Time time)
{
data.append(reinterpret_cast<char*>(&time), sizeof(Time));
}
Bool
CXWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg)
XWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg)
{
PropertyNotifyPredicateInfo* filter =
reinterpret_cast<PropertyNotifyPredicateInfo*>(arg);
@ -1699,7 +1699,7 @@ CXWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg)
}
void
CXWindowsUtil::initKeyMaps()
XWindowsUtil::initKeyMaps()
{
if (s_keySymToUCS4.empty()) {
for (size_t i =0; i < sizeof(s_keymap) / sizeof(s_keymap[0]); ++i) {
@ -1710,31 +1710,31 @@ CXWindowsUtil::initKeyMaps()
//
// CXWindowsUtil::ErrorLock
// XWindowsUtil::ErrorLock
//
CXWindowsUtil::ErrorLock* CXWindowsUtil::ErrorLock::s_top = NULL;
XWindowsUtil::ErrorLock* XWindowsUtil::ErrorLock::s_top = NULL;
CXWindowsUtil::ErrorLock::ErrorLock(Display* display) :
XWindowsUtil::ErrorLock::ErrorLock(Display* display) :
m_display(display)
{
install(&CXWindowsUtil::ErrorLock::ignoreHandler, NULL);
install(&XWindowsUtil::ErrorLock::ignoreHandler, NULL);
}
CXWindowsUtil::ErrorLock::ErrorLock(Display* display, bool* flag) :
XWindowsUtil::ErrorLock::ErrorLock(Display* display, bool* flag) :
m_display(display)
{
install(&CXWindowsUtil::ErrorLock::saveHandler, flag);
install(&XWindowsUtil::ErrorLock::saveHandler, flag);
}
CXWindowsUtil::ErrorLock::ErrorLock(Display* display,
XWindowsUtil::ErrorLock::ErrorLock(Display* display,
ErrorHandler handler, void* data) :
m_display(display)
{
install(handler, data);
}
CXWindowsUtil::ErrorLock::~ErrorLock()
XWindowsUtil::ErrorLock::~ErrorLock()
{
// make sure everything finishes before uninstalling handler
if (m_display != NULL) {
@ -1747,7 +1747,7 @@ CXWindowsUtil::ErrorLock::~ErrorLock()
}
void
CXWindowsUtil::ErrorLock::install(ErrorHandler handler, void* data)
XWindowsUtil::ErrorLock::install(ErrorHandler handler, void* data)
{
// make sure everything finishes before installing handler
if (m_display != NULL) {
@ -1758,13 +1758,13 @@ CXWindowsUtil::ErrorLock::install(ErrorHandler handler, void* data)
m_handler = handler;
m_userData = data;
m_oldXHandler = XSetErrorHandler(
&CXWindowsUtil::ErrorLock::internalHandler);
&XWindowsUtil::ErrorLock::internalHandler);
m_next = s_top;
s_top = this;
}
int
CXWindowsUtil::ErrorLock::internalHandler(Display* display, XErrorEvent* event)
XWindowsUtil::ErrorLock::internalHandler(Display* display, XErrorEvent* event)
{
if (s_top != NULL && s_top->m_handler != NULL) {
s_top->m_handler(display, event, s_top->m_userData);
@ -1773,13 +1773,13 @@ CXWindowsUtil::ErrorLock::internalHandler(Display* display, XErrorEvent* event)
}
void
CXWindowsUtil::ErrorLock::ignoreHandler(Display*, XErrorEvent* e, void*)
XWindowsUtil::ErrorLock::ignoreHandler(Display*, XErrorEvent* e, void*)
{
LOG((CLOG_DEBUG1 "ignoring X error: %d", e->error_code));
}
void
CXWindowsUtil::ErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag)
XWindowsUtil::ErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag)
{
LOG((CLOG_DEBUG1 "flagging X error: %d", e->error_code));
*reinterpret_cast<bool*>(flag) = true;

View File

@ -30,7 +30,7 @@
#endif
//! X11 utility functions
class CXWindowsUtil {
class XWindowsUtil {
public:
typedef std::vector<KeySym> KeySyms;

View File

@ -176,7 +176,7 @@ ClientApp::createScreen()
return new synergy::Screen(new CMSWindowsScreen(
false, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
#elif WINAPI_XWINDOWS
return new synergy::Screen(new CXWindowsScreen(
return new synergy::Screen(new XWindowsScreen(
args().m_display, false, args().m_disableXInitThreads,
args().m_yscroll, m_events), m_events);
#elif WINAPI_CARBON

View File

@ -584,7 +584,7 @@ ServerApp::createScreen()
return new synergy::Screen(new CMSWindowsScreen(
true, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
#elif WINAPI_XWINDOWS
return new synergy::Screen(new CXWindowsScreen(
return new synergy::Screen(new XWindowsScreen(
args().m_display, true, args().m_disableXInitThreads, 0, m_events), m_events);
#elif WINAPI_CARBON
return new synergy::Screen(new OSXScreen(m_events, true), m_events);

View File

@ -35,15 +35,15 @@
#include "test/global/gmock.h"
#include <errno.h>
class CXWindowsKeyStateTests : public ::testing::Test
class XWindowsKeyStateTests : public ::testing::Test
{
protected:
CXWindowsKeyStateTests() :
XWindowsKeyStateTests() :
m_display(NULL)
{
}
~CXWindowsKeyStateTests()
~XWindowsKeyStateTests()
{
if (m_display != NULL) {
LOG((CLOG_DEBUG "closing display"));
@ -72,35 +72,35 @@ protected:
Display* m_display;
};
TEST_F(CXWindowsKeyStateTests, setActiveGroup_pollAndSet_groupIsZero)
TEST_F(XWindowsKeyStateTests, setActiveGroup_pollAndSet_groupIsZero)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
keyState.setActiveGroup(CXWindowsKeyState::kGroupPollAndSet);
keyState.setActiveGroup(XWindowsKeyState::kGroupPollAndSet);
ASSERT_EQ(0, keyState.group());
}
TEST_F(CXWindowsKeyStateTests, setActiveGroup_poll_groupIsNotSet)
TEST_F(XWindowsKeyStateTests, setActiveGroup_poll_groupIsNotSet)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
keyState.setActiveGroup(CXWindowsKeyState::kGroupPoll);
keyState.setActiveGroup(XWindowsKeyState::kGroupPoll);
ASSERT_LE(-1, keyState.group());
}
TEST_F(CXWindowsKeyStateTests, setActiveGroup_customGroup_groupWasSet)
TEST_F(XWindowsKeyStateTests, setActiveGroup_customGroup_groupWasSet)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
keyState.setActiveGroup(1);
@ -108,11 +108,11 @@ TEST_F(CXWindowsKeyStateTests, setActiveGroup_customGroup_groupWasSet)
ASSERT_EQ(1, keyState.group());
}
TEST_F(CXWindowsKeyStateTests, mapModifiersFromX_zeroState_zeroMask)
TEST_F(XWindowsKeyStateTests, mapModifiersFromX_zeroState_zeroMask)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
int mask = keyState.mapModifiersFromX(0);
@ -120,11 +120,11 @@ TEST_F(CXWindowsKeyStateTests, mapModifiersFromX_zeroState_zeroMask)
ASSERT_EQ(0, mask);
}
TEST_F(CXWindowsKeyStateTests, mapModifiersToX_zeroMask_resultIsTrue)
TEST_F(XWindowsKeyStateTests, mapModifiersToX_zeroMask_resultIsTrue)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
unsigned int modifiers = 0;
@ -133,11 +133,11 @@ TEST_F(CXWindowsKeyStateTests, mapModifiersToX_zeroMask_resultIsTrue)
ASSERT_TRUE(result);
}
TEST_F(CXWindowsKeyStateTests, fakeCtrlAltDel_default_returnsFalse)
TEST_F(XWindowsKeyStateTests, fakeCtrlAltDel_default_returnsFalse)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
bool result = keyState.fakeCtrlAltDel();
@ -145,11 +145,11 @@ TEST_F(CXWindowsKeyStateTests, fakeCtrlAltDel_default_returnsFalse)
ASSERT_FALSE(result);
}
TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_defaultState_returnsZero)
TEST_F(XWindowsKeyStateTests, pollActiveModifiers_defaultState_returnsZero)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
KeyModifierMask actual = keyState.pollActiveModifiers();
@ -158,11 +158,11 @@ TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_defaultState_returnsZero)
}
#if 0 // TODO: fix, causes sigsegv
TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCorrect)
TEST_F(XWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCorrect)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
// set mock modifier mapping
@ -191,11 +191,11 @@ TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCo
}
#endif
TEST_F(CXWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero)
TEST_F(XWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
SInt32 actual = keyState.pollActiveGroup();
@ -203,11 +203,11 @@ TEST_F(CXWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero)
ASSERT_EQ(0, actual);
}
TEST_F(CXWindowsKeyStateTests, pollActiveGroup_positiveGroup_returnsGroup)
TEST_F(XWindowsKeyStateTests, pollActiveGroup_positiveGroup_returnsGroup)
{
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
keyState.group(3);
@ -217,12 +217,12 @@ TEST_F(CXWindowsKeyStateTests, pollActiveGroup_positiveGroup_returnsGroup)
ASSERT_EQ(3, actual);
}
TEST_F(CXWindowsKeyStateTests, pollActiveGroup_xkb_areEqual)
TEST_F(XWindowsKeyStateTests, pollActiveGroup_xkb_areEqual)
{
#if HAVE_XKB_EXTENSION
MockKeyMap keyMap;
MockEventQueue eventQueue;
CXWindowsKeyState keyState(
XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap);
// reset the group

View File

@ -29,7 +29,7 @@ TEST(CXWindowsScreenTests, fakeMouseMove_nonPrimary_getCursorPosValuesCorrect)
EXPECT_CALL(eventQueue, adoptHandler(_, _, _)).Times(2);
EXPECT_CALL(eventQueue, adoptBuffer(_)).Times(2);
EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(2);
CXWindowsScreen screen(
XWindowsScreen screen(
":0.0", false, false, 0, &eventQueue);
screen.fakeMouseMove(10, 20);