fixed bug with secondary screen on high dpi screen

This commit is contained in:
matt 2023-12-21 18:14:03 +00:00
parent 88ecc905ef
commit ed83f31384
2 changed files with 9 additions and 6 deletions

View File

@ -62,7 +62,8 @@ const UI = {
{
shared: UI.getSetting('shared', true),
repeaterID: UI.getSetting('repeaterID', false),
credentials: { password: null }
credentials: { password: null },
hiDpi: UI.getSetting('enable_hidpi', true, false)
},
false // Not a primary display
);
@ -96,7 +97,6 @@ const UI = {
UI.rfb.keyboard.enableIME = UI.getSetting('enable_ime', true, false);
UI.rfb.clipboardBinary = supportsBinaryClipboard() && UI.rfb.clipboardSeamless;
UI.rfb.enableWebRTC = UI.getSetting('enable_webrtc', true, false);
UI.rfb.enableHiDpi = UI.getSetting('enable_hidpi', true, false);
UI.rfb.mouseButtonMapper = UI.initMouseButtonMapper();
if (UI.rfb.videoQuality === 5) {
UI.rfb.enableQOI = true;

View File

@ -147,7 +147,7 @@ export default class RFB extends EventTargetMixin {
this._clipboardBinary = true;
this._resendClipboardNextUserDrivenEvent = true;
this._useUdp = true;
this._hiDpi = false;
this._hiDpi = 'hiDpi' in options ? !!options.hiDpi : false;
this._enableQOI = false;
this.TransitConnectionStates = {
Tcp: Symbol("tcp"),
@ -1680,10 +1680,11 @@ export default class RFB extends EventTargetMixin {
_handleControlMessage(event) {
if (this._isPrimaryDisplay) {
// Secondary to Primary screen message
let size;
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();
size = this._screenSize();
RFB.messages.setDesktopSize(this._sock, size, this._screenFlags);
this._sendEncodings();
this._updateContinuousUpdates();
@ -1694,6 +1695,8 @@ export default class RFB extends EventTargetMixin {
console.log('reattach message')
console.log(event.data)
this._display.addScreen(event.data.screenID, event.data.width, event.data.height, event.data.pixelRatio, event.data.containerHeight, event.data.containerWidth);
size = this._screenSize();
RFB.messages.setDesktopSize(this._sock, size, this._screenFlags);
this._sendEncodings();
this._updateContinuousUpdates();
this.dispatchEvent(new CustomEvent("screenregistered", {}));
@ -1772,8 +1775,8 @@ export default class RFB extends EventTargetMixin {
//let screen = this._screenSize().screens[0];
//
let size = this._screenSize();
this._display.resize(size.screens[0].containerWidth, size.screens[0].containerHeight);
this._display.autoscale(size.screens[0].containerWidth, size.screens[0].containerHeight, size.screens[0].scale);
this._display.resize(size.screens[0].serverWidth, size.screens[0].serverHeight);
this._display.autoscale(size.screens[0].serverWidth, size.screens[0].serverHeight, size.screens[0].scale);
screen = this._screenSize().screens[0];
const registertype = (currentScreen) ? 'reattach' : 'register'