]>
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 | |
276320c9 | 16 | index cae2b57..fdae7a2 100644 |
a375b7e5 DC |
17 | --- a/app/ui.js |
18 | +++ b/app/ui.js | |
bf74ff33 | 19 | @@ -1054,6 +1054,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'; | |
bf74ff33 | 27 | @@ -1665,6 +1666,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 | |
bf74ff33 | 45 | index f35d503..7ea2004 100644 |
a375b7e5 DC |
46 | --- a/core/rfb.js |
47 | +++ b/core/rfb.js | |
bf74ff33 | 48 | @@ -2492,6 +2492,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(); |
4cc9ed08 | 63 | } |
2b8dde16 | 64 |