Fix copying text to non-qt clients

Like we do for pasting, set the mime type of text to "text/plain;charset=utf-8"
too besides "text/plain". This allows copying text to clients such as weston
example clients or Xwayland.

Change-Id: I8a24f32d93e438f16db662e7c09b09ddd7578768
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Giulio Camuffo 2015-02-07 19:29:19 +02:00
parent ccc23106b9
commit b52533db83
2 changed files with 5 additions and 0 deletions

View File

@ -86,6 +86,10 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
if (!inputDevice || !inputDevice->dataDevice())
return;
static const QString plain = QStringLiteral("text/plain");
static const QString utf8 = QStringLiteral("text/plain;charset=utf-8");
if (data && data->hasFormat(plain) && !data->hasFormat(utf8))
data->setData(utf8, data->data(plain));
inputDevice->dataDevice()->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : 0);
emitChanged(mode);

View File

@ -761,6 +761,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease;
QString text;
int qtkey = key + 8; // qt-compositor substracts 8 for some reason
mParent->mSerial = serial;
if (!window) {
// We destroyed the keyboard focus surface, but the server