5
0
mirror of git://git.proxmox.com/git/novnc-pve.git synced 2025-02-01 09:47:22 +03:00
novnc-pve/debian/patches/0002-add-custom-fbresize-event-on-rfb.patch
Thomas Lamprecht bf74ff330e update patches for 1.2.0
sneak in some cleanups like dropping the manual loading of the
es6-module loader only to remove it again a few patches later

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-17 10:58:10 +02:00

65 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dominik Csapak <d.csapak@proxmox.com>
Date: Wed, 9 May 2018 10:47:53 +0200
Subject: [PATCH] add custom fbresize event on rfb
this can be use to react to changes of the resolution, like resizing the
window
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
app/ui.js | 11 +++++++++++
core/rfb.js | 10 ++++++++++
2 files changed, 21 insertions(+)
diff --git a/app/ui.js b/app/ui.js
index 317f845..91bdcf4 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -1054,6 +1054,7 @@ const UI = {
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
UI.rfb.addEventListener("bell", UI.bell);
UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
+ UI.rfb.addEventListener("fbresize", UI.updateSessionSize);
UI.rfb.clipViewport = UI.getSetting('view_clip');
UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
@@ -1665,6 +1666,16 @@ const UI = {
document.getElementById('pve_commands_button').classList.remove("noVNC_selected");
},
+ updateSessionSize: function(e) {
+ var rfb = e.detail.rfb;
+ var width = e.detail.width;
+ var height = e.detail.height;
+ UI.PVE.updateFBSize(rfb, width, height);
+
+ UI.applyResizeMode();
+ UI.updateViewClip();
+ },
+
/* ------^-------
* /PVE
* ==============
diff --git a/core/rfb.js b/core/rfb.js
index f35d503..7ea2004 100644
--- a/core/rfb.js
+++ b/core/rfb.js
@@ -2492,6 +2492,16 @@ export default class RFB extends EventTargetMixin {
this._updateClip();
this._updateScale();
+ // fbresize event
+ var event = new CustomEvent("fbresize", {
+ detail: {
+ rfb: this,
+ width: width,
+ height: height }
+ }
+ );
+ this.dispatchEvent(event);
+
this._updateContinuousUpdates();
}