revert previous changes, cleanup
This commit is contained in:
parent
f19e5a1cdf
commit
b9f5ce3953
14
app/ui.js
14
app/ui.js
|
@ -2831,16 +2831,14 @@ const UI = {
|
|||
console.log('screen registered')
|
||||
// Get the current screen plan
|
||||
// When a new display is added, it is defaulted to be placed to the far right relative to existing displays and to the top
|
||||
let screenPlan = UI.rfb.getScreenPlan();
|
||||
console.log(screenPlan)
|
||||
// Now make adjustments to the screen plan, this is just an example
|
||||
// screenPlan.screens[1].y = 0;
|
||||
if (UI.rfb) {
|
||||
let screenPlan = UI.rfb.getScreenPlan();
|
||||
console.log(screenPlan)
|
||||
|
||||
// Finally apply the screen plan
|
||||
UI.updateMonitors(screenPlan)
|
||||
UI._identify(UI.monitors)
|
||||
}
|
||||
|
||||
// UI.rfb.applyScreenPlan(screenPlan); // applyScreenPlan is triggered in UI.updateMonitors
|
||||
UI.updateMonitors(screenPlan)
|
||||
UI._identify(UI.monitors)
|
||||
},
|
||||
|
||||
//Helper to add options to dropdown.
|
||||
|
|
|
@ -174,10 +174,22 @@ export default class Display {
|
|||
// ===== PUBLIC METHODS =====
|
||||
|
||||
/*
|
||||
Returns the screen index given serverside relative coordinates
|
||||
Returns the screen index and relative coordinates given globally scoped coordinates
|
||||
*/
|
||||
getScreenIndexByServerCoords(x, y) {
|
||||
|
||||
getClientRelativeCoordinates(x, y) {
|
||||
for (let i = 0; i < this._screens.length; i++) {
|
||||
if (
|
||||
(x >= this._screens[i].x && x <= this._screens[i].x + this._screens[i].serverWidth) &&
|
||||
(y >= this._screens[i].y && y <= this._screens[i].y + this._screens[i].serverHeight)
|
||||
)
|
||||
{
|
||||
return {
|
||||
"screenIndex": i,
|
||||
"x": x - this._screens[i].x,
|
||||
"y": y - this._screens[i].y
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -329,6 +341,8 @@ export default class Display {
|
|||
if (this._isPrimaryDisplay) {
|
||||
for (let i=1; i<this._screens.length; i++) {
|
||||
if (this._screens[i].screenID == screenID) {
|
||||
//flush all rects on target screen
|
||||
this._flushRectsScreen(i);
|
||||
this._screens[i].channel.close();
|
||||
this._screens.splice(i, 1);
|
||||
removed = true;
|
||||
|
@ -755,7 +769,7 @@ export default class Display {
|
|||
case 'registered':
|
||||
if (!this._isPrimaryDisplay) {
|
||||
this._screens[0].screenIndex = event.data.screenIndex;
|
||||
Log.Info(`Screen with index (${event.data.screenIndex}) successfully registered with the primary display.`);
|
||||
Log.Error(`Screen with index (${event.data.screenIndex}) successfully registered with the primary display.`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -815,6 +829,21 @@ export default class Display {
|
|||
}
|
||||
}
|
||||
|
||||
_flushRectsScreen(screenIndex) {
|
||||
for (let i=0; i<this._asyncFrameQueue.length; i++) {
|
||||
const frame = this._asyncFrameQueue[i];
|
||||
for (let x=0; x < frame[2].length; x++) {
|
||||
const rect = frame[2][x];
|
||||
for (let y=0; y < rect.screenLocations.length; y++) {
|
||||
if (rect.screenLocations[y].screenIndex === screenIndex) {
|
||||
rect.screenLocations.splice(y, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Process incoming rects into a frame buffer, assume rects are out of order due to either UDP or parallel processing of decoding
|
||||
*/
|
||||
|
|
34
core/rfb.js
34
core/rfb.js
|
@ -1683,9 +1683,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;
|
||||
|
@ -1700,8 +1700,10 @@ 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);
|
||||
this._updateContinuousUpdates();
|
||||
this.dispatchEvent(new CustomEvent("screenregistered", {}));
|
||||
} else {
|
||||
Log.Info(`Secondary monitor (${event.data.screenID}) not found.`);
|
||||
}
|
||||
|
@ -4378,28 +4380,6 @@ RFB.messages = {
|
|||
sock._sQlen += i;
|
||||
sock.flush();
|
||||
|
||||
/*
|
||||
// screen array
|
||||
buff[offset + 8] = id >> 24; // id
|
||||
buff[offset + 9] = id >> 16;
|
||||
buff[offset + 10] = id >> 8;
|
||||
buff[offset + 11] = id;
|
||||
buff[offset + 12] = 0; // x-position
|
||||
buff[offset + 13] = 0;
|
||||
buff[offset + 14] = 0; // y-position
|
||||
buff[offset + 15] = 0;
|
||||
buff[offset + 16] = width >> 8; // width
|
||||
buff[offset + 17] = width;
|
||||
buff[offset + 18] = height >> 8; // height
|
||||
buff[offset + 19] = height;
|
||||
buff[offset + 20] = flags >> 24; // flags
|
||||
buff[offset + 21] = flags >> 16;
|
||||
buff[offset + 22] = flags >> 8;
|
||||
buff[offset + 23] = flags;
|
||||
|
||||
sock._sQlen += 24;
|
||||
sock.flush();
|
||||
*/
|
||||
},
|
||||
|
||||
setMaxVideoResolution(sock, width, height) {
|
||||
|
|
Loading…
Reference in New Issue