react-x11 2.47.1 → 2.47.2
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
|
@@ -41,12 +41,13 @@ export class WindowListeners {
|
|
|
41
41
|
// is theirs. Growing it back under a user who has just made it smaller
|
|
42
42
|
// is the one behaviour worse than not fitting the content.
|
|
43
43
|
//
|
|
44
|
-
// Checked against
|
|
45
|
-
// because our own configures come back as echoes, and
|
|
46
|
-
// them would otherwise read as the user taking over on
|
|
47
|
-
// re-fit
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
// Checked against the sizes we asked for rather than ntk's
|
|
45
|
+
// `ev.resized`, because our own configures come back as echoes, and
|
|
46
|
+
// every one of them would otherwise read as the user taking over on
|
|
47
|
+
// the first re-fit — and against all of them still in flight, not
|
|
48
|
+
// only the latest, because a move echo or an earlier re-fit's can land
|
|
49
|
+
// after the record moved on (#929, `_ownSize`).
|
|
50
|
+
if (this._requestedSize && !this._ownSize(ev)) {
|
|
50
51
|
this._userSized = true;
|
|
51
52
|
}
|
|
52
53
|
// Where the window sits on screen decides where popups anchored to it
|
package/src/nodes/window/size.js
CHANGED
|
@@ -46,6 +46,10 @@ const NO_SCOPED_FLOORS = process.env.REACT_X11_NO_SCOPED_FLOORS === '1';
|
|
|
46
46
|
// …and for the width pass reading only the extents a floor is written from
|
|
47
47
|
// (`markUnreadLeaves`): with it set, every leaf is shaped at no width again.
|
|
48
48
|
const NO_UNREAD_WIDTHS = process.env.REACT_X11_NO_UNREAD_WIDTHS === '1';
|
|
49
|
+
// How many sizes an `'auto'` window keeps as asked for and not yet echoed
|
|
50
|
+
// (`_askSize`). Echoes come back within a round trip, so a re-fit a frame
|
|
51
|
+
// is a handful at most.
|
|
52
|
+
const SIZES_IN_FLIGHT = 8;
|
|
49
53
|
|
|
50
54
|
/** Take a node's extents off, as `collectFloorStale` does a dirty child's:
|
|
51
55
|
* both are measured again, and the minimum yoga holds may no longer be
|
|
@@ -995,7 +999,7 @@ export class WindowSize {
|
|
|
995
999
|
if (asked && next.width === asked.width && next.height === asked.height) {
|
|
996
1000
|
return;
|
|
997
1001
|
}
|
|
998
|
-
this.
|
|
1002
|
+
this._askSize({ width: next.width, height: next.height });
|
|
999
1003
|
// Asked for, not assumed. `window.width` stays what the server last said
|
|
1000
1004
|
// until the ConfigureNotify lands, and this frame lays out against that
|
|
1001
1005
|
// — the echo brings `needsLayout` and an unbounded repaint with it (see
|
|
@@ -1038,6 +1042,57 @@ export class WindowSize {
|
|
|
1038
1042
|
);
|
|
1039
1043
|
}
|
|
1040
1044
|
|
|
1045
|
+
/**
|
|
1046
|
+
* Record a size this window has asked the backend for. `_requestedSize`
|
|
1047
|
+
* is the latest, which `_refit()` compares against to ask only once; the
|
|
1048
|
+
* echoes still to come are kept beside it, because every one of them is
|
|
1049
|
+
* ours and none has to be the latest (`_ownSize`).
|
|
1050
|
+
*/
|
|
1051
|
+
_askSize(size) {
|
|
1052
|
+
this._requestedSize = size;
|
|
1053
|
+
const flight = (this._sizesInFlight ??= []);
|
|
1054
|
+
flight.push(size);
|
|
1055
|
+
// A backend that never echoes — a mock — would grow this for ever, and
|
|
1056
|
+
// a size asked for this many re-fits ago is not coming back.
|
|
1057
|
+
if (flight.length > SIZES_IN_FLIGHT) flight.shift();
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* Whether a resize event's size is one this window chose, as opposed to
|
|
1062
|
+
* the user or the window manager choosing it — the question that ends an
|
|
1063
|
+
* `'auto'` window's tracking for good. Settles the record either way.
|
|
1064
|
+
*
|
|
1065
|
+
* Not "is it the latest size asked for" (#929). Two kinds of echo are ours
|
|
1066
|
+
* and carry another size. A **move** reports the size the window has, and
|
|
1067
|
+
* when it reached the server before a resize that was already asked for —
|
|
1068
|
+
* a popup re-anchored by the same re-fit, an `x` prop moving with the
|
|
1069
|
+
* content — it lands after the record moved on. And a re-fit asked for
|
|
1070
|
+
* before the last one was answered has its echo arrive with the size it
|
|
1071
|
+
* asked for, not the one asked for since. So an event is ours when its
|
|
1072
|
+
* size is the one the server last reported (nothing was resized at all:
|
|
1073
|
+
* a move, or a request the manager refused), or one still in flight —
|
|
1074
|
+
* which spends it, and every one asked for before it, since the server
|
|
1075
|
+
* answers in order. Anything else is somebody else's size: the user and
|
|
1076
|
+
* a window manager can only ever *change* it.
|
|
1077
|
+
*/
|
|
1078
|
+
_ownSize(ev) {
|
|
1079
|
+
const is = (size) =>
|
|
1080
|
+
size && size.width === ev.width && size.height === ev.height;
|
|
1081
|
+
const confirmed = this._confirmedSize;
|
|
1082
|
+
this._confirmedSize = { width: ev.width, height: ev.height };
|
|
1083
|
+
// the confirmed size first: a size that came round again (A → B → A)
|
|
1084
|
+
// is in flight too, and spending it there would spend B with it
|
|
1085
|
+
if (is(confirmed)) return true;
|
|
1086
|
+
const flight = this._sizesInFlight ?? [];
|
|
1087
|
+
const at = flight.findIndex(is);
|
|
1088
|
+
if (at < 0) {
|
|
1089
|
+
flight.length = 0;
|
|
1090
|
+
return false;
|
|
1091
|
+
}
|
|
1092
|
+
flight.splice(0, at + 1);
|
|
1093
|
+
return true;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1041
1096
|
/** One layout pass at the window's size, with the content floors it
|
|
1042
1097
|
* needs: fresh ones when something changed them, the ones in hand during
|
|
1043
1098
|
* a live resize, none when nothing moved them. */
|
|
@@ -271,6 +271,10 @@ export class WindowNode extends Scrollable(Node) {
|
|
|
271
271
|
// the only thing that ever does is the user dragging an edge.
|
|
272
272
|
this._requestedSize = null;
|
|
273
273
|
this._userSized = false;
|
|
274
|
+
// what the server last reported, and the sizes asked for since that it
|
|
275
|
+
// has not echoed yet: both are ours when an echo carries them (_ownSize)
|
|
276
|
+
this._confirmedSize = null;
|
|
277
|
+
this._sizesInFlight = [];
|
|
274
278
|
// the last `WM_NORMAL_HINTS` struct written and the size it was written
|
|
275
279
|
// at, so that a bound measured every frame is only *sent* on the frames
|
|
276
280
|
// it moves (see _sendSizeHints for why the size is part of it)
|
|
@@ -409,6 +413,7 @@ export class WindowNode extends Scrollable(Node) {
|
|
|
409
413
|
// resize echo is compared against, so it has to be the size the echo
|
|
410
414
|
// will carry (#586, `_snapSize`).
|
|
411
415
|
this._requestedSize = { width: wnd.width, height: wnd.height };
|
|
416
|
+
this._confirmedSize = this._requestedSize;
|
|
412
417
|
// Now that the visual is known: settle the capabilities, re-resolve any
|
|
413
418
|
// `@supports` block against them, and start following the compositor.
|
|
414
419
|
// Before the first paint, and before children realize against it.
|
|
@@ -862,10 +867,12 @@ export class WindowNode extends Scrollable(Node) {
|
|
|
862
867
|
const geo = scaleWindowGeometry(newProps, this.scale);
|
|
863
868
|
if (sizeChanged) {
|
|
864
869
|
this._userSized = false;
|
|
865
|
-
this.
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
870
|
+
this._askSize(
|
|
871
|
+
this._snapSize({
|
|
872
|
+
width: isAutoSize(geo.width) ? wnd.width : geo.width,
|
|
873
|
+
height: isAutoSize(geo.height) ? wnd.height : geo.height,
|
|
874
|
+
}),
|
|
875
|
+
);
|
|
869
876
|
}
|
|
870
877
|
if (geometryChanged) {
|
|
871
878
|
if (typeof wnd.setState === 'function') {
|