Add option to select default cursor
This commit is contained in:
parent
0d74223888
commit
65bd696326
|
|
@ -167,6 +167,7 @@ const UI = {
|
||||||
UI.initSetting('view_only', false);
|
UI.initSetting('view_only', false);
|
||||||
UI.initSetting('img_bgrx_mode', false);
|
UI.initSetting('img_bgrx_mode', false);
|
||||||
UI.initSetting('show_dot', false);
|
UI.initSetting('show_dot', false);
|
||||||
|
UI.initSetting('show_pointer', false);
|
||||||
UI.initSetting('path', 'websockify');
|
UI.initSetting('path', 'websockify');
|
||||||
UI.initSetting('repeaterID', '');
|
UI.initSetting('repeaterID', '');
|
||||||
UI.initSetting('reconnect', false);
|
UI.initSetting('reconnect', false);
|
||||||
|
|
@ -359,6 +360,8 @@ const UI = {
|
||||||
UI.addSettingChangeHandler('img_bgrx_mode', UI.applyBGRXMode);
|
UI.addSettingChangeHandler('img_bgrx_mode', UI.applyBGRXMode);
|
||||||
UI.addSettingChangeHandler('show_dot');
|
UI.addSettingChangeHandler('show_dot');
|
||||||
UI.addSettingChangeHandler('show_dot', UI.updateShowDotCursor);
|
UI.addSettingChangeHandler('show_dot', UI.updateShowDotCursor);
|
||||||
|
UI.addSettingChangeHandler('show_pointer');
|
||||||
|
UI.addSettingChangeHandler('show_pointer', UI.updateShowPointerCursor);
|
||||||
UI.addSettingChangeHandler('host');
|
UI.addSettingChangeHandler('host');
|
||||||
UI.addSettingChangeHandler('port');
|
UI.addSettingChangeHandler('port');
|
||||||
UI.addSettingChangeHandler('path');
|
UI.addSettingChangeHandler('path');
|
||||||
|
|
@ -1101,6 +1104,7 @@ const UI = {
|
||||||
UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
|
UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
|
||||||
UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
|
UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
|
||||||
UI.rfb.showDotCursor = UI.getSetting('show_dot');
|
UI.rfb.showDotCursor = UI.getSetting('show_dot');
|
||||||
|
UI.rfb.showPointerCursor = UI.getSetting('show_pointer');
|
||||||
|
|
||||||
UI.trackMouse();
|
UI.trackMouse();
|
||||||
UI.trackClicks();
|
UI.trackClicks();
|
||||||
|
|
@ -1722,6 +1726,11 @@ const UI = {
|
||||||
UI.rfb.showDotCursor = UI.getSetting('show_dot');
|
UI.rfb.showDotCursor = UI.getSetting('show_dot');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateShowPointerCursor() {
|
||||||
|
if (!UI.rfb) return;
|
||||||
|
UI.rfb.showPointerCursor = UI.getSetting('show_pointer');
|
||||||
|
},
|
||||||
|
|
||||||
updateLogging() {
|
updateLogging() {
|
||||||
WebUtil.init_logging(UI.getSetting('logging'));
|
WebUtil.init_logging(UI.getSetting('logging'));
|
||||||
},
|
},
|
||||||
|
|
|
||||||
15
core/rfb.js
15
core/rfb.js
|
|
@ -251,6 +251,10 @@ export default class RFB extends EventTargetMixin {
|
||||||
Log.Warn("Specifying showDotCursor as a RFB constructor argument is deprecated");
|
Log.Warn("Specifying showDotCursor as a RFB constructor argument is deprecated");
|
||||||
this._showDotCursor = options.showDotCursor;
|
this._showDotCursor = options.showDotCursor;
|
||||||
}
|
}
|
||||||
|
this._showPointerCursor = false;
|
||||||
|
if (options.showPointerCursor !== undefined) {
|
||||||
|
this._showPointerCursor = options.showPointerCursor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===== PROPERTIES =====
|
// ===== PROPERTIES =====
|
||||||
|
|
@ -315,6 +319,12 @@ export default class RFB extends EventTargetMixin {
|
||||||
this._refreshCursor();
|
this._refreshCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get showPointerCursor() { return this._showPointerCursor; }
|
||||||
|
set showPointerCursor(show) {
|
||||||
|
this._showPointerCursor = show;
|
||||||
|
this._refreshCursor();
|
||||||
|
}
|
||||||
|
|
||||||
get background() { return this._screen.style.background; }
|
get background() { return this._screen.style.background; }
|
||||||
set background(cssValue) { this._screen.style.background = cssValue; }
|
set background(cssValue) { this._screen.style.background = cssValue; }
|
||||||
|
|
||||||
|
|
@ -1884,12 +1894,17 @@ export default class RFB extends EventTargetMixin {
|
||||||
this._rfb_connection_state !== "connected") {
|
this._rfb_connection_state !== "connected") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this._showPointerCursor) {
|
||||||
|
this._cursor.changeToDefaultCursor();
|
||||||
|
} else {
|
||||||
const image = this._shouldShowDotCursor() ? RFB.cursors.dot : this._cursorImage;
|
const image = this._shouldShowDotCursor() ? RFB.cursors.dot : this._cursorImage;
|
||||||
this._cursor.change(image.rgbaPixels,
|
this._cursor.change(image.rgbaPixels,
|
||||||
image.hotx, image.hoty,
|
image.hotx, image.hoty,
|
||||||
image.w, image.h
|
image.w, image.h
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static genDES(password, challenge) {
|
static genDES(password, challenge) {
|
||||||
const passwordChars = password.split('').map(c => c.charCodeAt(0));
|
const passwordChars = password.split('').map(c => c.charCodeAt(0));
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,10 @@ export default class Cursor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeToDefaultCursor() {
|
||||||
|
this._target.style.cursor = 'default';
|
||||||
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
this._target.style.cursor = 'none';
|
this._target.style.cursor = 'none';
|
||||||
this._canvas.width = 0;
|
this._canvas.width = 0;
|
||||||
|
|
|
||||||
3
vnc.html
3
vnc.html
|
|
@ -243,6 +243,9 @@
|
||||||
<input id="noVNC_setting_reconnect_delay" type="number">
|
<input id="noVNC_setting_reconnect_delay" type="number">
|
||||||
</li>
|
</li>
|
||||||
<li><hr></li>
|
<li><hr></li>
|
||||||
|
<li>
|
||||||
|
<label><input id="noVNC_setting_show_pointer" type="checkbox"> Show Default when No Cursor</label>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label><input id="noVNC_setting_show_dot" type="checkbox"> Show Dot when No Cursor</label>
|
<label><input id="noVNC_setting_show_dot" type="checkbox"> Show Dot when No Cursor</label>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue