diff --git a/app/ui.js b/app/ui.js index 0a0f3923..ffbb64f1 100644 --- a/app/ui.js +++ b/app/ui.js @@ -167,6 +167,7 @@ const UI = { UI.initSetting('view_only', false); UI.initSetting('img_bgrx_mode', false); UI.initSetting('show_dot', false); + UI.initSetting('show_pointer', false); UI.initSetting('path', 'websockify'); UI.initSetting('repeaterID', ''); UI.initSetting('reconnect', false); @@ -359,6 +360,8 @@ const UI = { UI.addSettingChangeHandler('img_bgrx_mode', UI.applyBGRXMode); UI.addSettingChangeHandler('show_dot'); UI.addSettingChangeHandler('show_dot', UI.updateShowDotCursor); + UI.addSettingChangeHandler('show_pointer'); + UI.addSettingChangeHandler('show_pointer', UI.updateShowPointerCursor); UI.addSettingChangeHandler('host'); UI.addSettingChangeHandler('port'); UI.addSettingChangeHandler('path'); @@ -1101,6 +1104,7 @@ const UI = { UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale'; UI.rfb.resizeSession = UI.getSetting('resize') === 'remote'; UI.rfb.showDotCursor = UI.getSetting('show_dot'); + UI.rfb.showPointerCursor = UI.getSetting('show_pointer'); UI.trackMouse(); UI.trackClicks(); @@ -1722,6 +1726,11 @@ const UI = { UI.rfb.showDotCursor = UI.getSetting('show_dot'); }, + updateShowPointerCursor() { + if (!UI.rfb) return; + UI.rfb.showPointerCursor = UI.getSetting('show_pointer'); + }, + updateLogging() { WebUtil.init_logging(UI.getSetting('logging')); }, diff --git a/core/rfb.js b/core/rfb.js index 82ed141d..3fa940e1 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -251,6 +251,10 @@ export default class RFB extends EventTargetMixin { Log.Warn("Specifying showDotCursor as a RFB constructor argument is deprecated"); this._showDotCursor = options.showDotCursor; } + this._showPointerCursor = false; + if (options.showPointerCursor !== undefined) { + this._showPointerCursor = options.showPointerCursor; + } } // ===== PROPERTIES ===== @@ -315,6 +319,12 @@ export default class RFB extends EventTargetMixin { this._refreshCursor(); } + get showPointerCursor() { return this._showPointerCursor; } + set showPointerCursor(show) { + this._showPointerCursor = show; + this._refreshCursor(); + } + get background() { return this._screen.style.background; } set background(cssValue) { this._screen.style.background = cssValue; } @@ -1884,11 +1894,16 @@ export default class RFB extends EventTargetMixin { this._rfb_connection_state !== "connected") { return; } - const image = this._shouldShowDotCursor() ? RFB.cursors.dot : this._cursorImage; - this._cursor.change(image.rgbaPixels, - image.hotx, image.hoty, - image.w, image.h - ); + + if (this._showPointerCursor) { + this._cursor.changeToDefaultCursor(); + } else { + const image = this._shouldShowDotCursor() ? RFB.cursors.dot : this._cursorImage; + this._cursor.change(image.rgbaPixels, + image.hotx, image.hoty, + image.w, image.h + ); + } } static genDES(password, challenge) { diff --git a/core/util/cursor.js b/core/util/cursor.js index c7a084f0..b5c8b8cd 100644 --- a/core/util/cursor.js +++ b/core/util/cursor.js @@ -121,6 +121,10 @@ export default class Cursor { } } + changeToDefaultCursor() { + this._target.style.cursor = 'default'; + } + clear() { this._target.style.cursor = 'none'; this._canvas.width = 0; diff --git a/vnc.html b/vnc.html index 841b48c8..578e8647 100644 --- a/vnc.html +++ b/vnc.html @@ -243,6 +243,9 @@

  • +
  • + +