]>
Commit | Line | Data |
---|---|---|
2b8dde16 | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
a375b7e5 DC |
2 | From: Dominik Csapak <d.csapak@proxmox.com> |
3 | Date: Wed, 9 May 2018 10:47:53 +0200 | |
bf74ff33 | 4 | Subject: [PATCH] add custom fbresize event on rfb |
a375b7e5 DC |
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 | --- | |
4cc9ed08 | 11 | app/ui.js | 11 +++++++++++ |
a375b7e5 | 12 | core/rfb.js | 10 ++++++++++ |
4cc9ed08 | 13 | 2 files changed, 21 insertions(+) |
a375b7e5 DC |
14 | |
15 | diff --git a/app/ui.js b/app/ui.js | |
f422faae | 16 | index 5ebb134..60f4c00 100644 |
a375b7e5 DC |
17 | --- a/app/ui.js |
18 | +++ b/app/ui.js | |
f422faae | 19 | @@ -1074,6 +1074,7 @@ const UI = { |
a375b7e5 DC |
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'; | |
f422faae | 27 | @@ -1733,6 +1734,16 @@ const UI = { |
a375b7e5 DC |
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; | |
4cc9ed08 | 35 | + UI.PVE.updateFBSize(rfb, width, height); |
a375b7e5 DC |
36 | + |
37 | + UI.applyResizeMode(); | |
38 | + UI.updateViewClip(); | |
39 | + }, | |
40 | + | |
41 | /* ------^------- | |
42 | * /PVE | |
43 | * ============== | |
44 | diff --git a/core/rfb.js b/core/rfb.js | |
f422faae | 45 | index 6afd7c6..2f662ce 100644 |
a375b7e5 DC |
46 | --- a/core/rfb.js |
47 | +++ b/core/rfb.js | |
f422faae | 48 | @@ -2881,6 +2881,16 @@ export default class RFB extends EventTargetMixin { |
a375b7e5 DC |
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 | + | |
a375b7e5 | 62 | this._updateContinuousUpdates(); |
2b8dde16 | 63 | |
f422faae | 64 | // Keep this size until browser client size changes |