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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -584,7 +584,7 @@ ServerApp::createScreen()
return new synergy::Screen(new CMSWindowsScreen( return new synergy::Screen(new CMSWindowsScreen(
true, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events); true, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
#elif WINAPI_XWINDOWS #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); args().m_display, true, args().m_disableXInitThreads, 0, m_events), m_events);
#elif WINAPI_CARBON #elif WINAPI_CARBON
return new synergy::Screen(new OSXScreen(m_events, true), m_events); return new synergy::Screen(new OSXScreen(m_events, true), m_events);

View File

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

View File

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