@xterm/addon-webgl 0.17.0-beta.5 → 0.17.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xterm/addon-webgl",
3
- "version": "0.17.0-beta.5",
3
+ "version": "0.17.0-beta.7",
4
4
  "author": {
5
5
  "name": "The xterm.js authors",
6
6
  "url": "https://xtermjs.org/"
package/src/WebglAddon.ts CHANGED
@@ -11,6 +11,7 @@ import { EventEmitter, forwardEvent } from 'common/EventEmitter';
11
11
  import { Disposable, toDisposable } from 'common/Lifecycle';
12
12
  import { getSafariVersion, isSafari } from 'common/Platform';
13
13
  import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
14
+ import { IWebGL2RenderingContext } from './Types';
14
15
  import { WebglRenderer } from './WebglRenderer';
15
16
  import { setTraceLogger } from 'common/services/LogService';
16
17
 
@@ -31,7 +32,16 @@ export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi
31
32
  private _preserveDrawingBuffer?: boolean
32
33
  ) {
33
34
  if (isSafari && getSafariVersion() < 16) {
34
- throw new Error('Webgl2 is only supported on Safari 16 and above');
35
+ // Perform an extra check to determine if Webgl2 is manually enabled in developer settings
36
+ const contextAttributes = {
37
+ antialias: false,
38
+ depth: false,
39
+ preserveDrawingBuffer: true
40
+ };
41
+ const gl = document.createElement('canvas').getContext('webgl2', contextAttributes) as IWebGL2RenderingContext;
42
+ if (!gl) {
43
+ throw new Error('Webgl2 is only supported on Safari 16 and above');
44
+ }
35
45
  }
36
46
  super();
37
47
  }