Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save new expected client size on resize #1801

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ export default class RFB extends EventTargetMixin {
window.requestAnimationFrame(() => {
this._updateClip();
this._updateScale();
this._saveExpectedClientSize();
});

if (this._resizeSession) {
Expand Down
19 changes: 19 additions & 0 deletions tests/test.rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,25 @@ describe('Remote Frame Buffer Protocol Client', function () {
expect(client._display.autoscale).to.have.been.calledWith(40, 50);
});

it('should update the scaling when the container returns to previous size', function () {
client._saveExpectedClientSize();

sinon.spy(client._display, "autoscale");

container.style.width = '40px';
container.style.height = '50px';
fakeResizeObserver.fire();
clock.tick(1000);

container.style.width = '70px';
container.style.height = '80px';
fakeResizeObserver.fire();
clock.tick(1000);

expect(client._display.autoscale).to.have.been.calledTwice;
expect(client._display.autoscale).to.have.been.calledWith(70, 80);
});

it('should update the scaling when the remote session resizes', function () {
// Simple ExtendedDesktopSize FBU message
const incoming = [ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
Expand Down