2
* synergy -- mouse and keyboard sharing utility
3
* Copyright (C) 2002 Chris Schoeneman
5
* This package is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* found in the file COPYING that should have accompanied this file.
9
* This package is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
15
#include "CXWindowsClipboardTextConverter.h"
19
// CXWindowsClipboardTextConverter
22
CXWindowsClipboardTextConverter::CXWindowsClipboardTextConverter(
23
Display* display, const char* name) :
24
m_atom(XInternAtom(display, name, False))
29
CXWindowsClipboardTextConverter::~CXWindowsClipboardTextConverter()
35
CXWindowsClipboardTextConverter::getFormat() const
37
return IClipboard::kText;
41
CXWindowsClipboardTextConverter::getAtom() const
47
CXWindowsClipboardTextConverter::getDataSize() const
53
CXWindowsClipboardTextConverter::fromIClipboard(const CString& data) const
55
return CUnicode::UTF8ToText(data);
59
CXWindowsClipboardTextConverter::toIClipboard(const CString& data) const
63
CString utf8 = CUnicode::textToUTF8(data, &errors);
65
// if there were decoding errors then, to support old applications
66
// that don't understand UTF-8 but can report the exact binary
67
// UTF-8 representation, see if the data appears to be UTF-8. if
68
// so then use it as is.
69
if (errors && CUnicode::isUTF8(data)) {