Commit 1979bf0f authored by Paul Tvete's avatar Paul Tvete
Browse files

Create key events correctly

This still doesn't fix the Wayland issue, but at least now the
events generated from VNC are the same as the local events.
parent 8033c232
......@@ -139,7 +139,7 @@ void QVncItem::createServer()
Qt::Key key,
Qt::KeyboardModifiers keyboardModifiers,
const QChar &text){
QKeyEvent ke(eventType, key, keyboardModifiers, text);
QKeyEvent ke(eventType, key, keyboardModifiers, text.isNull() ? QString{} : QString{text} );
QVncItem::handleKey(&ke);
});
......
......@@ -1078,6 +1078,12 @@ void QVncClient::keyEvent()
QRfbKeyEvent ev;
if (ev.read(m_clientSocket)) {
if (ev.unicode || ev.keycode) {
emit keyEventReceived(ev.down ? QEvent::KeyPress : QEvent::KeyRelease,
Qt::Key(ev.keycode),
m_keymod,
QChar::fromUcs2(ev.unicode));
}
if (ev.keycode == Qt::Key_Shift)
m_keymod = ev.down ? m_keymod | Qt::ShiftModifier :
m_keymod & ~Qt::ShiftModifier;
......@@ -1087,12 +1093,6 @@ void QVncClient::keyEvent()
else if (ev.keycode == Qt::Key_Alt)
m_keymod = ev.down ? m_keymod | Qt::AltModifier :
m_keymod & ~Qt::AltModifier;
if (ev.unicode || ev.keycode) {
emit keyEventReceived(ev.down ? QEvent::KeyPress : QEvent::KeyRelease,
Qt::Key(ev.keycode),
m_keymod,
QChar::fromUcs2(ev.unicode));
}
m_handleMsg = false;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment