react-x11 2.18.0 → 2.18.1

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": "react-x11",
3
- "version": "2.18.0",
3
+ "version": "2.18.1",
4
4
  "description": "react renderer with X11 as a target",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -28,6 +28,8 @@
28
28
  // so the ladder is visible before it is built. Policy decides, the machine
29
29
  // answers — the same rule the GL policy follows everywhere else.
30
30
 
31
+ import { withoutActions } from './quiet.js';
32
+
31
33
  const RUNGS = ['auto', 'gl'];
32
34
  const KNOWN_RUNGS = ['auto', 'gl', 'gles', 'webgpu'];
33
35
 
@@ -145,8 +147,11 @@ export class CocoaGLArea {
145
147
  this.scale = this.parent.scale ?? app.scale ?? 1;
146
148
  this.destroyed = false;
147
149
  this._reactX11Node = null;
148
- this.layer = this._native.createLayer();
149
- this._native.addSublayer(this.parent._layer, this.layer);
150
+ this.layer = withoutActions(this._native, () => {
151
+ const layer = this._native.createLayer();
152
+ this._native.addSublayer(this.parent._layer, layer);
153
+ return layer;
154
+ });
150
155
  this.rect = null;
151
156
  this.setState({
152
157
  x: options.x ?? 0,
@@ -254,7 +259,9 @@ export class CocoaGLArea {
254
259
  this.destroyed = true;
255
260
  this._context?._destroy();
256
261
  this._context = null;
257
- this._native.removeFromSuperlayer(this.layer);
262
+ withoutActions(this._native, () =>
263
+ this._native.removeFromSuperlayer(this.layer),
264
+ );
258
265
  }
259
266
  }
260
267
 
@@ -15,6 +15,7 @@
15
15
  // was painted on the layer: ntk blits an X window's backing store on its
16
16
  // own, where a layer's contents are a copy the bitmap has to be pushed to.
17
17
  import { BackendContext2D } from '../backend/context2d.js';
18
+ import { withoutActions } from './quiet.js';
18
19
 
19
20
  export const OVERLAY_Z = 1e7 + 1;
20
21
 
@@ -25,8 +26,11 @@ export class CocoaOverlayPane {
25
26
  this._native = app._native;
26
27
  this.scale = this.parent.scale ?? app.scale ?? 1;
27
28
  this.destroyed = false;
28
- this.layer = this._native.createLayer();
29
- this._native.addSublayer(this.parent._layer, this.layer);
29
+ this.layer = withoutActions(this._native, () => {
30
+ const layer = this._native.createLayer();
31
+ this._native.addSublayer(this.parent._layer, layer);
32
+ return layer;
33
+ });
30
34
  this.rect = null;
31
35
  this._surface = null;
32
36
  this._surfaceSize = null;
@@ -154,6 +158,11 @@ export class CocoaOverlayPane {
154
158
  this.destroyed = true;
155
159
  this._release();
156
160
  this._ctx = null;
157
- this._native.removeFromSuperlayer(this.layer);
161
+ // Actions off, or the layer fades out over a quarter of a second, what
162
+ // the children last painted going translucent over a surface still
163
+ // drawing (#638).
164
+ withoutActions(this._native, () =>
165
+ this._native.removeFromSuperlayer(this.layer),
166
+ );
158
167
  }
159
168
  }
@@ -3,13 +3,18 @@
3
3
  // contents are whatever IOSurface the pane process last presented. The pane
4
4
  // owns its buffers and its drawing; this side owns the layer, the layout
5
5
  // and the input — CPU offloading, not isolation (docs/frame.md).
6
+ import { withoutActions } from './quiet.js';
7
+
6
8
  export class CocoaPaneHost {
7
9
  constructor(app, wnd) {
8
10
  this.app = app;
9
11
  this.wnd = wnd;
10
12
  this._native = app._native;
11
- this.layer = this._native.createLayer();
12
- this._native.addSublayer(wnd._layer, this.layer);
13
+ this.layer = withoutActions(this._native, () => {
14
+ const layer = this._native.createLayer();
15
+ this._native.addSublayer(wnd._layer, layer);
16
+ return layer;
17
+ });
13
18
  this.destroyed = false;
14
19
  this._rect = null;
15
20
  }
@@ -73,6 +78,8 @@ export class CocoaPaneHost {
73
78
  destroy() {
74
79
  if (this.destroyed) return;
75
80
  this.destroyed = true;
76
- this._native.removeFromSuperlayer(this.layer);
81
+ withoutActions(this._native, () =>
82
+ this._native.removeFromSuperlayer(this.layer),
83
+ );
77
84
  }
78
85
  }
@@ -0,0 +1,13 @@
1
+ // Layer changes with Core Animation's implicit actions off, for a layer
2
+ // that is ours rather than a presenter's (a <glarea>'s surface and overlay,
3
+ // a frame pane's host): no frame's transaction covers it, so a bare
4
+ // `addSublayer` or `removeFromSuperlayer` takes the default quarter-second
5
+ // order-in or order-out fade, and a bare property set tweens.
6
+ export function withoutActions(native, fn) {
7
+ native.txBegin({ disableActions: true });
8
+ try {
9
+ return fn();
10
+ } finally {
11
+ native.txCommit();
12
+ }
13
+ }