Only send QEMU Extended Key Event if we have a scan code

Servers will assume that a scan code is present if this message type
is used, so fall back to the standard key event message if we don't
know the scan code.
This commit is contained in:
Pierre Ossman 2017-07-07 15:06:13 +02:00
parent 4093c37f28
commit be70fe0a3d
2 changed files with 10 additions and 9 deletions

View File

@ -335,16 +335,9 @@ RFB.prototype = {
return true; return true;
} }
if (this._qemuExtKeyEventSupported) { var scancode = XtScancode[code];
var scancode = XtScancode[code];
if (scancode === undefined) {
Log.Error('Unable to find a xt scancode for code: ' + code);
// FIXME: not in the spec, but this is what
// gtk-vnc does
scancode = 0;
}
if (this._qemuExtKeyEventSupported && scancode) {
// 0 is NoSymbol // 0 is NoSymbol
keysym = keysym || 0; keysym = keysym || 0;

View File

@ -224,6 +224,14 @@ describe('Remote Frame Buffer Protocol Client', function() {
client.sendKey(0x20, 'Space', true); client.sendKey(0x20, 'Space', true);
expect(client._sock).to.have.sent(expected._sQ); expect(client._sock).to.have.sent(expected._sQ);
}); });
it('should not send QEMU extended events if unknown key code', function () {
client._qemuExtKeyEventSupported = true;
var expected = {_sQ: new Uint8Array(8), _sQlen: 0, flush: function () {}};
RFB.messages.keyEvent(expected, 123, 1);
client.sendKey(123, 'FooBar', true);
expect(client._sock).to.have.sent(expected._sQ);
});
}); });
describe('#clipboardPasteFrom', function () { describe('#clipboardPasteFrom', function () {