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:
parent
ccc23106b9
commit
b52533db83
@ -86,6 +86,10 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
|
|||||||
if (!inputDevice || !inputDevice->dataDevice())
|
if (!inputDevice || !inputDevice->dataDevice())
|
||||||
return;
|
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);
|
inputDevice->dataDevice()->setSelectionSource(data ? new QWaylandDataSource(mDisplay->dndSelectionHandler(), data) : 0);
|
||||||
|
|
||||||
emitChanged(mode);
|
emitChanged(mode);
|
||||||
|
@ -761,6 +761,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
|
|||||||
QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease;
|
QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease;
|
||||||
QString text;
|
QString text;
|
||||||
int qtkey = key + 8; // qt-compositor substracts 8 for some reason
|
int qtkey = key + 8; // qt-compositor substracts 8 for some reason
|
||||||
|
mParent->mSerial = serial;
|
||||||
|
|
||||||
if (!window) {
|
if (!window) {
|
||||||
// We destroyed the keyboard focus surface, but the server
|
// We destroyed the keyboard focus surface, but the server
|
||||||
|
Loading…
x
Reference in New Issue
Block a user