diff --git a/app/styles/base.css b/app/styles/base.css index 9a3abcd5..b6e49f9c 100644 --- a/app/styles/base.css +++ b/app/styles/base.css @@ -24,7 +24,7 @@ body { padding:0; font-family: "Poppins", "Helvetica"; letter-spacing: 0.05em; - background: white url('../images/icons/kasm_logo.svg') no-repeat fixed center; + background: white url('../images/splash.jpg') no-repeat fixed center; height:100%; touch-action: none; } diff --git a/app/ui.js b/app/ui.js index 247fc581..10f5a8f3 100644 --- a/app/ui.js +++ b/app/ui.js @@ -1890,7 +1890,7 @@ const UI = { let new_display_url = `${window.location.protocol}//${window.location.host}${new_display_path}screen.html`; Log.Debug(`Opening a secondary display ${new_display_url}`) - window.open(new_display_url); + window.open(new_display_url, '_blank', 'toolbar=0,location=0,menubar=0'); }, initMonitors(screenPlan) { diff --git a/app/ui_screen.js b/app/ui_screen.js index d2b0044f..66bb0e1d 100644 --- a/app/ui_screen.js +++ b/app/ui_screen.js @@ -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; diff --git a/core/rfb.js b/core/rfb.js index f1e63c4f..a8af15ce 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -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,10 @@ 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", {})); Log.Info(`Secondary monitor (${event.data.screenID}) has been reattached.`); break; @@ -1736,6 +1741,11 @@ export default class RFB extends EventTargetMixin { this._mouseLastScreenIndex = event.data.mouseLastScreenIndex; } break; + case 'receivedClipboard': + if (event.data.mouseLastScreenIndex === this._display.screenIndex) { + this._write_binary_clipboard(...event.data.args); + } + break; case 'disconnect': this.disconnect(); break; @@ -1765,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' @@ -2098,6 +2108,9 @@ export default class RFB extends EventTargetMixin { ev.stopPropagation(); ev.preventDefault(); + // Ensure keys down are synced between client and server + this._keyboard.clearKeysDown(ev); + // On MacOs we need to translate zooming CMD+wheel to CTRL+wheel if (isMac() && (this._keyboard._keyDownList["MetaLeft"] || this._keyboard._keyDownList["MetaRight"])) { this._keyboard._sendKeyEvent(this._keyboard._keyDownList["MetaLeft"], "MetaLeft", false); @@ -2868,6 +2881,8 @@ export default class RFB extends EventTargetMixin { // Disable copyrect when using multiple displays if (this._display.screens.length === 1) { encs.push(encodings.encodingCopyRect); + } else { + Log.Debug("Multiple displays detected, disabling copyrect encoding."); } // Only supported with full depth support if (this._fbDepth == 24) { @@ -3212,33 +3227,41 @@ export default class RFB extends EventTargetMixin { if (this.clipboardBinary) { this._clipHash = 0; - navigator.clipboard.write([new ClipboardItem(clipItemData)]).then( - () => { - if (textdata) { - this._clipHash = hashUInt8Array(textdata); - } - }, - (err) => { - Log.Error("Error writing to client clipboard: " + err); - // Lets try writeText - if (textdata.length > 0) { - navigator.clipboard.writeText(textdata).then( - () => { - this._clipHash = hashUInt8Array(textdata); - }, - (err) => { - Log.Error("Error writing text to client clipboard: " + err); - } - ); - } - } - ); + if (this._mouseLastScreenIndex === 0) { + this._write_binary_clipboard(clipItemData, textdata) + } else { + this._proxyRFBMessage('receivedClipboard', [ clipItemData, textdata ]); + } } } return true; } + _write_binary_clipboard(clipItemData, textdata) { + navigator.clipboard.write([new ClipboardItem(clipItemData)]).then( + () => { + if (textdata) { + this._clipHash = hashUInt8Array(textdata); + } + }, + (err) => { + Log.Error("Error writing to client clipboard: " + err); + // Lets try writeText + if (textdata.length > 0) { + navigator.clipboard.writeText(textdata).then( + () => { + this._clipHash = hashUInt8Array(textdata); + }, + (err) => { + Log.Error("Error writing text to client clipboard: " + err); + } + ); + } + } + ); + } + _handle_server_stats_msg() { this._sock.rQskipBytes(3); // Padding const length = this._sock.rQshift32();