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:
parent
4093c37f28
commit
be70fe0a3d
|
@ -335,16 +335,9 @@ RFB.prototype = {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (this._qemuExtKeyEventSupported) {
|
||||
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
|
||||
keysym = keysym || 0;
|
||||
|
||||
|
|
|
@ -224,6 +224,14 @@ describe('Remote Frame Buffer Protocol Client', function() {
|
|||
client.sendKey(0x20, 'Space', true);
|
||||
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 () {
|
||||
|
|
Loading…
Reference in New Issue