]> git.proxmox.com Git - novnc-pve.git/blob - debian/patches/0002-add-custom-fbresize-event-on-rfb.patch
e88e9747aba61dd69a70884cfe1bb7789bf6572a
[novnc-pve.git] / debian / patches / 0002-add-custom-fbresize-event-on-rfb.patch
1 From 4bf525059741e1bb68e355904fb82e8c1639aff9 Mon Sep 17 00:00:00 2001
2 From: Dominik Csapak <d.csapak@proxmox.com>
3 Date: Wed, 9 May 2018 10:47:53 +0200
4 Subject: [PATCH 02/10] add custom fbresize event on rfb
5
6 this can be use to react to changes of the resolution, like resizing the
7 window
8
9 Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
10 ---
11 app/ui.js | 11 +++++++++++
12 core/rfb.js | 10 ++++++++++
13 2 files changed, 21 insertions(+)
14
15 diff --git a/app/ui.js b/app/ui.js
16 index 59f7cca..d960a12 100644
17 --- a/app/ui.js
18 +++ b/app/ui.js
19 @@ -1050,6 +1050,7 @@ const UI = {
20 UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
21 UI.rfb.addEventListener("bell", UI.bell);
22 UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
23 + UI.rfb.addEventListener("fbresize", UI.updateSessionSize);
24 UI.rfb.clipViewport = UI.getSetting('view_clip');
25 UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
26 UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
27 @@ -1610,6 +1611,16 @@ const UI = {
28 document.getElementById('pve_commands_button').classList.remove("noVNC_selected");
29 },
30
31 + updateSessionSize: function(e) {
32 + var rfb = e.detail.rfb;
33 + var width = e.detail.width;
34 + var height = e.detail.height;
35 + UI.PVE.updateFBSize(rfb, width, height);
36 +
37 + UI.applyResizeMode();
38 + UI.updateViewClip();
39 + },
40 +
41 /* ------^-------
42 * /PVE
43 * ==============
44 diff --git a/core/rfb.js b/core/rfb.js
45 index 3433030..3e0f176 100644
46 --- a/core/rfb.js
47 +++ b/core/rfb.js
48 @@ -1593,6 +1593,16 @@ export default class RFB extends EventTargetMixin {
49 this._updateClip();
50 this._updateScale();
51
52 + // fbresize event
53 + var event = new CustomEvent("fbresize", {
54 + detail: {
55 + rfb: this,
56 + width: width,
57 + height: height }
58 + }
59 + );
60 + this.dispatchEvent(event);
61 +
62 this._timing.fbu_rt_start = (new Date()).getTime();
63 this._updateContinuousUpdates();
64 }
65 --
66 2.11.0
67