]> git.proxmox.com Git - novnc-pve.git/blob - debian/patches/0011-add-localCursor-setting-to-rfb.patch
update patches for 1.2.0
[novnc-pve.git] / debian / patches / 0011-add-localCursor-setting-to-rfb.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Dominik Csapak <d.csapak@proxmox.com>
3 Date: Thu, 19 Jul 2018 11:31:51 +0200
4 Subject: [PATCH] add localCursor setting to rfb
5
6 and use it in app.js (default true)
7
8 Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 ---
11 app/ui.js | 10 ++++++++++
12 core/rfb.js | 10 ++++++++++
13 core/util/cursor.js | 15 ++++++++++++++-
14 vnc.html | 3 +++
15 4 files changed, 37 insertions(+), 1 deletion(-)
16
17 diff --git a/app/ui.js b/app/ui.js
18 index d604067..d8126bc 100644
19 --- a/app/ui.js
20 +++ b/app/ui.js
21 @@ -166,6 +166,7 @@ const UI = {
22 UI.initSetting('quality', 6);
23 UI.initSetting('compression', 2);
24 UI.initSetting('autoresize', true);
25 + UI.initSetting('local_cursor', true);
26 UI.initSetting('shared', true);
27 UI.initSetting('view_only', false);
28 UI.initSetting('show_dot', false);
29 @@ -356,6 +357,8 @@ const UI = {
30 UI.addSettingChangeHandler('view_only', UI.updateViewOnly);
31 UI.addSettingChangeHandler('show_dot');
32 UI.addSettingChangeHandler('show_dot', UI.updateShowDotCursor);
33 + UI.addSettingChangeHandler('local_cursor');
34 + UI.addSettingChangeHandler('local_cursor', UI.updateLocalCursor);
35 UI.addSettingChangeHandler('host');
36 UI.addSettingChangeHandler('port');
37 UI.addSettingChangeHandler('path');
38 @@ -1056,6 +1059,7 @@ const UI = {
39 UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
40 UI.rfb.addEventListener("fbresize", UI.updateSessionSize);
41 UI.rfb.clipViewport = UI.getSetting('view_clip');
42 + UI.rfb.localCursor = UI.getSetting('local_cursor');
43 UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
44 UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
45 UI.rfb.qualityLevel = parseInt(UI.getSetting('quality'));
46 @@ -1692,6 +1696,12 @@ const UI = {
47 * ==============
48 * MISC
49 * ------v------*/
50 +
51 + updateLocalCursor() {
52 + if (!UI.rfb) return;
53 + UI.rfb.localCursor = UI.getSetting('local_cursor');
54 + },
55 +
56 updateViewOnly() {
57 if (!UI.rfb) return;
58 UI.rfb.viewOnly = UI.getSetting('view_only');
59 diff --git a/core/rfb.js b/core/rfb.js
60 index 7ea2004..85c7836 100644
61 --- a/core/rfb.js
62 +++ b/core/rfb.js
63 @@ -296,6 +296,7 @@ export default class RFB extends EventTargetMixin {
64 this._clipViewport = false;
65 this._scaleViewport = false;
66 this._resizeSession = false;
67 + this._localCursor = false;
68
69 this._showDotCursor = false;
70 if (options.showDotCursor !== undefined) {
71 @@ -356,6 +357,15 @@ export default class RFB extends EventTargetMixin {
72 }
73 }
74
75 + get localCursor() { return this._localCursor; }
76 + set localCursor(localCursor) {
77 + this._localCursor = localCursor;
78 +
79 + if (this._cursor) {
80 + this._cursor.setLocalCursor(localCursor);
81 + }
82 + }
83 +
84 get showDotCursor() { return this._showDotCursor; }
85 set showDotCursor(show) {
86 this._showDotCursor = show;
87 diff --git a/core/util/cursor.js b/core/util/cursor.js
88 index 4db1dab..e5b1768 100644
89 --- a/core/util/cursor.js
90 +++ b/core/util/cursor.js
91 @@ -12,6 +12,8 @@ export default class Cursor {
92 constructor() {
93 this._target = null;
94
95 + this._showLocalCursor = false;
96 +
97 this._canvas = document.createElement('canvas');
98
99 if (useFallback) {
100 @@ -110,7 +112,7 @@ export default class Cursor {
101 }
102
103 clear() {
104 - this._target.style.cursor = 'none';
105 + this._target.style.cursor = this._showLocalCursor ? 'default' : 'none';
106 this._canvas.width = 0;
107 this._canvas.height = 0;
108 this._position.x = this._position.x + this._hotSpot.x;
109 @@ -140,6 +142,11 @@ export default class Cursor {
110 this._updateVisibility(target);
111 }
112
113 + setLocalCursor(cursor) {
114 + this._showLocalCursor = cursor;
115 + this._updateLocalCursor();
116 + }
117 +
118 _handleMouseOver(event) {
119 // This event could be because we're entering the target, or
120 // moving around amongst its sub elements. Let the move handler
121 @@ -192,6 +199,11 @@ export default class Cursor {
122 }
123 }
124
125 + _updateLocalCursor() {
126 + if (this._target)
127 + this._target.style.cursor = this._showLocalCursor ? 'default' : 'none';
128 + }
129 +
130 _showCursor() {
131 if (this._canvas.style.visibility === 'hidden') {
132 this._canvas.style.visibility = '';
133 @@ -250,4 +262,5 @@ export default class Cursor {
134 return document.captureElement &&
135 document.documentElement.contains(document.captureElement);
136 }
137 +
138 }
139 diff --git a/vnc.html b/vnc.html
140 index 9f594e2..bf1fde5 100644
141 --- a/vnc.html
142 +++ b/vnc.html
143 @@ -157,6 +157,9 @@
144 <li>
145 <label><input id="noVNC_setting_view_clip" type="checkbox"> Clip to Window</label>
146 </li>
147 + <li>
148 + <label><input id="noVNC_setting_local_cursor" type="checkbox" /> Local Cursor</label>
149 + </li>
150 <li>
151 <label><input id="noVNC_setting_autoresize" type="checkbox" /> Autoresize Window</label>
152 </li>