mirror of
https://github.com/debauchee/barrier.git
synced 2026-07-06 03:46:29 +08:00
Restored lost files and changes in version 1.3.1 to depot.
This commit is contained in:
@@ -503,11 +503,10 @@ CXWindowsClipboard::icccmFillCache()
|
||||
(target != m_atomAtom && target != m_atomTargets)) {
|
||||
LOG((CLOG_DEBUG1 "selection doesn't support TARGETS"));
|
||||
data = "";
|
||||
|
||||
target = XA_STRING;
|
||||
data.append(reinterpret_cast<char*>(&target), sizeof(target));
|
||||
CXWindowsUtil::appendAtomData(data, XA_STRING);
|
||||
}
|
||||
|
||||
CXWindowsUtil::convertAtomProperty(data);
|
||||
const Atom* targets = reinterpret_cast<const Atom*>(data.data());
|
||||
const UInt32 numTargets = data.size() / sizeof(Atom);
|
||||
LOG((CLOG_DEBUG " available targets: %s", CXWindowsUtil::atomsToString(m_display, targets, numTargets).c_str()));
|
||||
@@ -525,12 +524,18 @@ CXWindowsClipboard::icccmFillCache()
|
||||
|
||||
// see if atom is in target list
|
||||
Atom target = None;
|
||||
// XXX -- just ask for the converter's target to see if it's
|
||||
// available rather than checking TARGETS. i've seen clipboard
|
||||
// owners that don't report all the targets they support.
|
||||
target = converter->getAtom();
|
||||
/*
|
||||
for (UInt32 i = 0; i < numTargets; ++i) {
|
||||
if (converter->getAtom() == targets[i]) {
|
||||
target = targets[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (target == None) {
|
||||
continue;
|
||||
}
|
||||
@@ -661,7 +666,7 @@ CXWindowsClipboard::motifOwnsClipboard() const
|
||||
reinterpret_cast<const CMotifClipHeader*>(data.data());
|
||||
if (data.size() >= sizeof(CMotifClipHeader) &&
|
||||
header->m_id == kMotifClipHeader) {
|
||||
if (header->m_selectionOwner == owner) {
|
||||
if (static_cast<Window>(header->m_selectionOwner) == owner) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -835,12 +840,12 @@ CXWindowsClipboard::insertMultipleReply(Window requestor,
|
||||
}
|
||||
|
||||
// fail if the requested targets isn't of the correct form
|
||||
if (format != 32 ||
|
||||
target != m_atomAtomPair) {
|
||||
if (format != 32 || target != m_atomAtomPair) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// data is a list of atom pairs: target, property
|
||||
CXWindowsUtil::convertAtomProperty(data);
|
||||
const Atom* targets = reinterpret_cast<const Atom*>(data.data());
|
||||
const UInt32 numTargets = data.size() / sizeof(Atom);
|
||||
|
||||
@@ -851,10 +856,7 @@ CXWindowsClipboard::insertMultipleReply(Window requestor,
|
||||
const Atom property = targets[i + 1];
|
||||
if (!addSimpleRequest(requestor, target, time, property)) {
|
||||
// note that we can't perform the requested conversion
|
||||
static const Atom none = None;
|
||||
data.replace(i * sizeof(Atom), sizeof(Atom),
|
||||
reinterpret_cast<const char*>(&none),
|
||||
sizeof(Atom));
|
||||
CXWindowsUtil::replaceAtomData(data, i, None);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@@ -900,16 +902,18 @@ CXWindowsClipboard::insertReply(CReply* reply)
|
||||
if (newWindow) {
|
||||
// note errors while we adjust event masks
|
||||
bool error = false;
|
||||
CXWindowsUtil::CErrorLock lock(m_display, &error);
|
||||
{
|
||||
CXWindowsUtil::CErrorLock lock(m_display, &error);
|
||||
|
||||
// get and save the current event mask
|
||||
XWindowAttributes attr;
|
||||
XGetWindowAttributes(m_display, reply->m_requestor, &attr);
|
||||
m_eventMasks[reply->m_requestor] = attr.your_event_mask;
|
||||
// get and save the current event mask
|
||||
XWindowAttributes attr;
|
||||
XGetWindowAttributes(m_display, reply->m_requestor, &attr);
|
||||
m_eventMasks[reply->m_requestor] = attr.your_event_mask;
|
||||
|
||||
// add the events we want
|
||||
XSelectInput(m_display, reply->m_requestor, attr.your_event_mask |
|
||||
StructureNotifyMask | PropertyChangeMask);
|
||||
// add the events we want
|
||||
XSelectInput(m_display, reply->m_requestor, attr.your_event_mask |
|
||||
StructureNotifyMask | PropertyChangeMask);
|
||||
}
|
||||
|
||||
// if we failed then the window has already been destroyed
|
||||
if (error) {
|
||||
@@ -1193,13 +1197,9 @@ CXWindowsClipboard::getTargetsData(CString& data, int* format) const
|
||||
assert(format != NULL);
|
||||
|
||||
// add standard targets
|
||||
Atom atom;
|
||||
atom = m_atomTargets;
|
||||
data.append(reinterpret_cast<char*>(&atom), sizeof(Atom));
|
||||
atom = m_atomMultiple;
|
||||
data.append(reinterpret_cast<char*>(&atom), sizeof(Atom));
|
||||
atom = m_atomTimestamp;
|
||||
data.append(reinterpret_cast<char*>(&atom), sizeof(Atom));
|
||||
CXWindowsUtil::appendAtomData(data, m_atomTargets);
|
||||
CXWindowsUtil::appendAtomData(data, m_atomMultiple);
|
||||
CXWindowsUtil::appendAtomData(data, m_atomTimestamp);
|
||||
|
||||
// add targets we can convert to
|
||||
for (ConverterList::const_iterator index = m_converters.begin();
|
||||
@@ -1208,8 +1208,7 @@ CXWindowsClipboard::getTargetsData(CString& data, int* format) const
|
||||
|
||||
// skip formats we don't have
|
||||
if (m_added[converter->getFormat()]) {
|
||||
atom = converter->getAtom();
|
||||
data.append(reinterpret_cast<char*>(&atom), sizeof(Atom));
|
||||
CXWindowsUtil::appendAtomData(data, converter->getAtom());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1222,9 +1221,8 @@ CXWindowsClipboard::getTimestampData(CString& data, int* format) const
|
||||
{
|
||||
assert(format != NULL);
|
||||
|
||||
assert(sizeof(m_timeOwned) == 4);
|
||||
checkCache();
|
||||
data.append(reinterpret_cast<const char*>(&m_timeOwned), 4);
|
||||
CXWindowsUtil::appendTimeData(data, m_timeOwned);
|
||||
*format = 32;
|
||||
return m_atomInteger;
|
||||
}
|
||||
@@ -1264,6 +1262,9 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display,
|
||||
|
||||
LOG((CLOG_DEBUG1 "request selection=%s, target=%s, window=%x", CXWindowsUtil::atomToString(display, selection).c_str(), CXWindowsUtil::atomToString(display, target).c_str(), m_requestor));
|
||||
|
||||
m_atomNone = XInternAtom(display, "NONE", False);
|
||||
m_atomIncr = XInternAtom(display, "INCR", False);
|
||||
|
||||
// save output pointers
|
||||
m_actualTarget = actualTarget;
|
||||
m_data = data;
|
||||
@@ -1361,7 +1362,8 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
|
||||
case SelectionNotify:
|
||||
if (xevent->xselection.requestor == m_requestor) {
|
||||
// done if we can't convert
|
||||
if (xevent->xselection.property == None) {
|
||||
if (xevent->xselection.property == None ||
|
||||
xevent->xselection.property == m_atomNone) {
|
||||
m_done = true;
|
||||
return true;
|
||||
}
|
||||
@@ -1409,7 +1411,7 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent(
|
||||
// note if incremental. if we're already incremental then the
|
||||
// selection owner is busted. if the INCR property has no size
|
||||
// then the selection owner is busted.
|
||||
if (target == XInternAtom(display, "INCR", False)) {
|
||||
if (target == m_atomIncr) {
|
||||
if (m_incr) {
|
||||
m_failed = true;
|
||||
m_error = true;
|
||||
|
||||
Reference in New Issue
Block a user