Move cursor URI check to RFB object

Keeps the Display object simpler, and avoids having to abuse a
property to transfer the information.
This commit is contained in:
Pierre Ossman
2017-10-14 16:49:07 +02:00
parent 134ec26ee0
commit fdff59eeb4
5 changed files with 2 additions and 45 deletions

View File

@@ -10,7 +10,6 @@
/*jslint browser: true, white: false */
/*global Util, Base64, changeCursor */
import { browserSupportsCursorURIs as cursorURIsSupported } from './util/browsers.js';
import { set_defaults, make_properties } from './util/properties.js';
import * as Log from './util/logging.js';
import Base64 from "./base64.js";
@@ -77,12 +76,6 @@ export default function Display(target, defaults) {
throw new Error("Canvas does not support createImageData");
}
// Determine browser support for setting the cursor via data URI scheme
if (this._cursor_uri || this._cursor_uri === null ||
this._cursor_uri === undefined) {
this._cursor_uri = cursorURIsSupported();
}
Log.Debug("<< Display.constructor");
};
@@ -483,11 +476,6 @@ Display.prototype = {
},
changeCursor: function (pixels, mask, hotx, hoty, w, h) {
if (this._cursor_uri === false) {
Log.Warn("changeCursor called but no cursor data URI support");
return;
}
Display.changeCursor(this._target, pixels, mask, hotx, hoty, w, h);
},
@@ -681,8 +669,6 @@ make_properties(Display, [
['width', 'ro', 'int'], // Display area width
['height', 'ro', 'int'], // Display area height
['cursor_uri', 'rw', 'raw'], // Can we render cursor using data URI
['onFlush', 'rw', 'func'], // onFlush(): A flush request has finished
]);

View File

@@ -14,6 +14,7 @@ import * as Log from './util/logging.js';
import _ from './util/localization.js';
import { decodeUTF8 } from './util/strings.js';
import { set_defaults, make_properties } from './util/properties.js';
import { browserSupportsCursorURIs } from './util/browsers.js';
import Display from "./display.js";
import Keyboard from "./input/keyboard.js";
import Mouse from "./input/mouse.js";
@@ -1470,7 +1471,7 @@ RFB.prototype.set_local_cursor = function (cursor) {
this._local_cursor = false;
this._display.disableLocalCursor(); //Only show server-side cursor
} else {
if (this._display.get_cursor_uri()) {
if (browserSupportsCursorURIs()) {
this._local_cursor = true;
} else {
Log.Warn("Browser does not support local cursor");

View File

@@ -43,11 +43,3 @@ export function browserSupportsCursorURIs () {
return _cursor_uris_supported;
};
export function _forceCursorURIs(enabled) {
if (enabled === undefined || enabled) {
_cursor_uris_supported = true;
} else {
_cursor_uris_supported = false;
}
}