fix scroll on primary, fix artifacting on connect, allow force draw of old frames
This commit is contained in:
parent
0603ba9fe4
commit
80b9af1e32
|
@ -405,9 +405,9 @@ export default class Display {
|
|||
}
|
||||
|
||||
const vp = this._screens[0];
|
||||
if (vp.width !== width || vp.height !== height) {
|
||||
vp.width = width;
|
||||
vp.height = height;
|
||||
if (vp.serverWidth !== width || vp.serverHeight !== height) {
|
||||
vp.serverWidth = width;
|
||||
vp.serverHeight = height;
|
||||
|
||||
const canvas = this._target;
|
||||
canvas.width = width;
|
||||
|
@ -470,7 +470,7 @@ export default class Display {
|
|||
// Readjust the viewport as it may be incorrectly sized
|
||||
// and positioned
|
||||
const vp = this._screens[0];
|
||||
this.viewportChangeSize(vp.width, vp.height);
|
||||
this.viewportChangeSize(vp.serverWidth, vp.serverHeight);
|
||||
this.viewportChangePos(0, 0);
|
||||
}
|
||||
|
||||
|
@ -839,6 +839,11 @@ export default class Display {
|
|||
newestFrameID = Math.max(newestFrameID, this._asyncFrameQueue[i][0]);
|
||||
}
|
||||
|
||||
if (!this._firstRect) { //TODO: Remove this
|
||||
this._firstRect = true;
|
||||
Log.Info("First rect received.");
|
||||
}
|
||||
|
||||
if (frameIx >= 0) {
|
||||
if (rect.type == "flip") {
|
||||
//flip rect contains the rect count for the frame
|
||||
|
@ -862,12 +867,21 @@ export default class Display {
|
|||
if (rect.type == "flip") { this._lateFlipRect++; }
|
||||
return;
|
||||
} else if (rect.frame_id > newestFrameID) {
|
||||
//frame is newer than any frame in the queue, drop old frames
|
||||
Log.Warn("Older Rect Dropped");
|
||||
//frame is newer than any frame in the queue, drop old frame
|
||||
if (this._asyncFrameQueue[0][3] == true) {
|
||||
this._pushAsyncFrame(true);
|
||||
Log.Warn("Forced frame to canvas");
|
||||
this._droppedFrames += (rect.frame_id - (newestFrameID + 1));
|
||||
this._forcedFrameCnt++;
|
||||
} else {
|
||||
this._asyncFrameQueue.shift();
|
||||
Log.Warn("Old frame dropped");
|
||||
this._droppedFrames += (rect.frame_id - newestFrameID);
|
||||
}
|
||||
|
||||
let rect_cnt = ((rect.type == "flip") ? rect.rect_cnt : 0);
|
||||
this._asyncFrameQueue.push([ rect.frame_id, rect_cnt, [ rect ], (rect_cnt == 1), 0, 0 ]);
|
||||
this._droppedFrames++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -906,8 +920,6 @@ export default class Display {
|
|||
if (this._asyncFrameQueue[frameIx][2][currentFrameRectIx].img && !this._asyncFrameQueue[frameIx][2][currentFrameRectIx].img.complete) {
|
||||
this._asyncFrameQueue[frameIx][2][currentFrameRectIx].type = 'skip';
|
||||
this._droppedRects++;
|
||||
} else {
|
||||
Log.Warn(`Oh snap, an image rect without an image: ${this._asyncFrameQueue[frameIx][2][currentFrameRectIx]}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
17
core/rfb.js
17
core/rfb.js
|
@ -1492,8 +1492,11 @@ export default class RFB extends EventTargetMixin {
|
|||
//re-register the secondary display with new resolution
|
||||
this._registerSecondaryDisplay();
|
||||
}
|
||||
|
||||
if (this._display.screens.length > 1) {
|
||||
this.dispatchEvent(new CustomEvent("screenregistered", {}));
|
||||
}
|
||||
}
|
||||
|
||||
// Gets the the size of the available screen
|
||||
_screenSize (limited) {
|
||||
|
@ -1671,9 +1674,9 @@ export default class RFB extends EventTargetMixin {
|
|||
switch (event.data.eventType) {
|
||||
case 'register':
|
||||
this._display.addScreen(event.data.screenID, event.data.width, event.data.height, event.data.pixelRatio, event.data.containerHeight, event.data.containerWidth);
|
||||
const size = this._screenSize();
|
||||
RFB.messages.setDesktopSize(this._sock, size, this._screenFlags);
|
||||
this._updateContinuousUpdates();
|
||||
//const size = this._screenSize();
|
||||
//RFB.messages.setDesktopSize(this._sock, size, this._screenFlags);
|
||||
//this._updateContinuousUpdates();
|
||||
this.dispatchEvent(new CustomEvent("screenregistered", {}));
|
||||
Log.Info(`Secondary monitor (${event.data.screenID}) has been registered.`);
|
||||
break;
|
||||
|
@ -1681,8 +1684,8 @@ export default class RFB extends EventTargetMixin {
|
|||
if (this._display.removeScreen(event.data.screenID)) {
|
||||
this.dispatchEvent(new CustomEvent("screenregistered", {}));
|
||||
Log.Info(`Secondary monitor (${event.data.screenID}) has been removed.`);
|
||||
const size = this._screenSize();
|
||||
RFB.messages.setDesktopSize(this._sock, size, this._screenFlags);
|
||||
//const size = this._screenSize();
|
||||
//RFB.messages.setDesktopSize(this._sock, size, this._screenFlags);
|
||||
} else {
|
||||
Log.Info(`Secondary monitor (${event.data.screenID}) not found.`);
|
||||
}
|
||||
|
@ -1714,10 +1717,12 @@ export default class RFB extends EventTargetMixin {
|
|||
break;
|
||||
case 'disconnect':
|
||||
this.disconnect();
|
||||
break;
|
||||
case 'forceResize':
|
||||
this._hiDpi = event.data.args[0];
|
||||
this._updateScale();
|
||||
this._requestRemoteResize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2052,7 +2057,7 @@ export default class RFB extends EventTargetMixin {
|
|||
if (this._rfbConnectionState !== 'connected') { return; }
|
||||
if (this._viewOnly) { return; } // View only, skip mouse events
|
||||
|
||||
if (this.isPrimaryDisplay){
|
||||
if (this._isPrimaryDisplay){
|
||||
RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), 0, dX, dY);
|
||||
} else {
|
||||
this._proxyRFBMessage('pointerEvent', [ this._display.absX(x), this._display.absY(y), 0, dX, dY ]);
|
||||
|
|
Loading…
Reference in New Issue