Don't send mouse events when dragging viewport
We don't want to send any mouse events to the server when dragging the viewport. Instead, we treat them as a client-only operation.
This commit is contained in:
parent
b9230cf23e
commit
d1548c12ec
|
@ -1306,8 +1306,6 @@ export default class RFB extends EventTargetMixin {
|
|||
this._viewportHasMoved = false;
|
||||
this._viewportDragging = true;
|
||||
this._viewportDragPos = {'x': pos.x, 'y': pos.y};
|
||||
|
||||
this._fakeMouseMove(ev, pos.x, pos.y);
|
||||
} else {
|
||||
this._fakeMouseMove(ev, pos.x, pos.y);
|
||||
this._handleMouseButton(pos.x, pos.y, 0x1);
|
||||
|
@ -1320,8 +1318,6 @@ export default class RFB extends EventTargetMixin {
|
|||
// sending any events to the server.
|
||||
this._viewportHasMoved = false;
|
||||
this._viewportDragPos = {'x': pos.x, 'y': pos.y};
|
||||
|
||||
this._fakeMouseMove(ev, pos.x, pos.y);
|
||||
} else {
|
||||
this._fakeMouseMove(ev, pos.x, pos.y);
|
||||
this._handleMouseButton(pos.x, pos.y, 0x4);
|
||||
|
@ -1360,8 +1356,9 @@ export default class RFB extends EventTargetMixin {
|
|||
this._viewportDragPos = {'x': pos.x, 'y': pos.y};
|
||||
this._display.viewportChangePos(deltaX, deltaY);
|
||||
}
|
||||
} else {
|
||||
this._fakeMouseMove(ev, pos.x, pos.y);
|
||||
}
|
||||
this._fakeMouseMove(ev, pos.x, pos.y);
|
||||
break;
|
||||
case 'twodrag':
|
||||
// Always scroll in the same position.
|
||||
|
|
|
@ -808,8 +808,7 @@ describe('Remote Frame Buffer protocol client', function () {
|
|||
gestureStart('drag', 13, 9, client);
|
||||
gestureMove('drag', 43, 9, client);
|
||||
|
||||
// FIXME: We don't want to send a pointer event here
|
||||
// expect(RFB.messages.pointerEvent).to.not.have.been.called;
|
||||
expect(RFB.messages.pointerEvent).to.not.have.been.called;
|
||||
expect(client._display.viewportChangePos).to.have.been.calledOnce;
|
||||
expect(client._display.viewportChangePos).to.have.been.calledWith(-30, 0);
|
||||
|
||||
|
@ -834,8 +833,7 @@ describe('Remote Frame Buffer protocol client', function () {
|
|||
gestureStart('longpress', 13, 9, client);
|
||||
gestureMove('longpress', 14, 9, client);
|
||||
|
||||
// FIXME: We don't want to send a pointer event here
|
||||
// expect(RFB.messages.pointerEvent).to.not.have.been.called;
|
||||
expect(RFB.messages.pointerEvent).to.not.have.been.called;
|
||||
expect(client._display.viewportChangePos).to.not.have.been.called;
|
||||
|
||||
client._display.viewportChangePos.resetHistory();
|
||||
|
@ -845,8 +843,7 @@ describe('Remote Frame Buffer protocol client', function () {
|
|||
gestureEnd('longpress', 43, 9, client);
|
||||
|
||||
expect(RFB.messages.pointerEvent).to.not.have.been.called;
|
||||
// FIXME: We only want to move the viewport once
|
||||
// expect(client._display.viewportChangePos).to.have.been.calledOnce;
|
||||
expect(client._display.viewportChangePos).to.have.been.calledOnce;
|
||||
expect(client._display.viewportChangePos).to.have.been.calledWith(-30, 0);
|
||||
});
|
||||
|
||||
|
@ -857,8 +854,7 @@ describe('Remote Frame Buffer protocol client', function () {
|
|||
gestureStart('longpress', 13, 9, client);
|
||||
gestureMove('longpress', 14, 10, client);
|
||||
|
||||
// FIXME: We don't want to send a pointer event here
|
||||
// expect(RFB.messages.pointerEvent).to.not.have.been.called;
|
||||
expect(RFB.messages.pointerEvent).to.not.have.been.called;
|
||||
expect(client._display.viewportChangePos).to.not.have.been.called;
|
||||
|
||||
client._display.viewportChangePos.resetHistory();
|
||||
|
@ -870,9 +866,9 @@ describe('Remote Frame Buffer protocol client', function () {
|
|||
expect(RFB.messages.pointerEvent.firstCall).to.have.been.calledWith(client._sock,
|
||||
14, 9, 0x0);
|
||||
expect(RFB.messages.pointerEvent.secondCall).to.have.been.calledWith(client._sock,
|
||||
14, 9, 0x4);
|
||||
14, 9, 0x4);
|
||||
expect(RFB.messages.pointerEvent.thirdCall).to.have.been.calledWith(client._sock,
|
||||
14, 9, 0x0);
|
||||
14, 9, 0x0);
|
||||
|
||||
expect(client._display.viewportChangePos).to.not.have.been.called;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue