/*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";
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");
};
},
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);
},
['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
]);
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";
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");
return _cursor_uris_supported;
};
-
-export function _forceCursorURIs(enabled) {
- if (enabled === undefined || enabled) {
- _cursor_uris_supported = true;
- } else {
- _cursor_uris_supported = false;
- }
-}
| viewport | bool | RW | false | Use viewport clipping
| width | int | RO | | Display area width
| height | int | RO | | Display area height
-| cursor_uri | raw | RW | | Can we render cursor using data URI
### 2.3.2 Methods
import Base64 from '../core/base64.js';
import Display from '../core/display.js';
-import { _forceCursorURIs, browserSupportsCursorURIs } from '../core/util/browsers.js';
import sinon from '../vendor/sinon.js';
return Base64.decode(data);
}
- describe('checking for cursor uri support', function () {
- it('should disable cursor URIs if there is no support', function () {
- _forceCursorURIs(false);
- var display = new Display(document.createElement('canvas'), { viewport: false });
- expect(display._cursor_uri).to.be.false;
- });
-
- it('should enable cursor URIs if there is support', function () {
- _forceCursorURIs(true);
- var display = new Display(document.createElement('canvas'), { viewport: false });
- expect(display._cursor_uri).to.be.true;
- });
-
- it('respect the cursor_uri option if there is support', function () {
- _forceCursorURIs(false);
- var display = new Display(document.createElement('canvas'), { viewport: false, cursor_uri: false });
- expect(display._cursor_uri).to.be.false;
- });
- });
-
describe('viewport handling', function () {
var display;
beforeEach(function () {