@domicile-desktop/manganese-window-management 1.2.0 → 2.0.0
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 +29 -19
- package/src/AppPopup.tsx +22 -10
- package/src/AppWindow.tsx +146 -68
- package/src/BrowserWindow.tsx +393 -33
- package/src/FocusGlow.tsx +5 -1
- package/src/GroupTitleBar.tsx +80 -0
- package/src/GroupWell.tsx +5 -1
- package/src/SelectionTint.tsx +5 -1
- package/src/Stage.tsx +381 -106
- package/src/StripEnd.tsx +1 -1
- package/src/TabStrip.tsx +16 -1
- package/src/TitleBar.tsx +277 -124
- package/src/WindowFrame.tsx +106 -26
- package/src/WindowTitleBar.tsx +11 -2
- package/src/browser/AddressBar.tsx +46 -37
- package/src/browser/AppMenuBar.tsx +106 -0
- package/src/browser/AppPopupMenu.tsx +45 -0
- package/src/browser/ConnectionIndicator.tsx +2 -2
- package/src/browser/HistoryButton.tsx +150 -0
- package/src/browser/PageMenu.tsx +20 -6
- package/src/browser/PageProblem.tsx +280 -0
- package/src/browser/PageTooltip.tsx +76 -0
- package/src/browser/PageViews.tsx +101 -0
- package/src/browser/ProfileMenu.tsx +332 -0
- package/src/browser/app-window-shape.ts +33 -0
- package/src/browser/page-history.ts +54 -0
- package/src/browser/page-menu.ts +85 -9
- package/src/browser/profile-ink.ts +17 -0
- package/src/browser/useAppMenuBar.ts +51 -0
- package/src/browser/useAppMessageBox.ts +47 -0
- package/src/browser/useAppPopupMenu.ts +49 -0
- package/src/browser/useAppWindowLooks.ts +49 -0
- package/src/browser/useAppWindowState.ts +59 -0
- package/src/browser/useBrowserProfile.ts +230 -0
- package/src/browser/useLongPress.ts +66 -0
- package/src/captured-element.ts +18 -0
- package/src/closing.ts +33 -15
- package/src/crossing.ts +64 -0
- package/src/floating/FloatGrab.tsx +10 -0
- package/src/floating/FloatShadow.tsx +5 -1
- package/src/floating/useFloatBorderDrag.ts +17 -59
- package/src/floating/useFloatDrag.ts +3 -2
- package/src/follow-press.ts +55 -0
- package/src/handed-drag.ts +57 -0
- package/src/keyboard/command.ts +160 -9
- package/src/keyboard/commands.ts +62 -6
- package/src/keyboard/query.ts +94 -0
- package/src/keyboard/useKeybindings.ts +69 -13
- package/src/overview/OverviewBackdrop.tsx +246 -0
- package/src/overview/OverviewPicker.tsx +453 -0
- package/src/overview/fixture.ts +76 -0
- package/src/overview/overview.ts +112 -0
- package/src/overview/seen-styles.ts +132 -0
- package/src/overview/sight.ts +86 -0
- package/src/overview/steering.ts +85 -0
- package/src/overview/tiles.ts +209 -0
- package/src/overview/useOverviewPhase.ts +35 -0
- package/src/own-animation.ts +24 -0
- package/src/panda-preset.ts +91 -3
- package/src/picture-in-picture/PictureInPictureFloats.tsx +865 -0
- package/src/picture-in-picture/page-of.ts +25 -0
- package/src/picture-in-picture/pip-box.ts +156 -0
- package/src/picture-in-picture/playhead.ts +33 -0
- package/src/placement.ts +20 -11
- package/src/pointer-confinement.ts +107 -0
- package/src/pointer-lock.ts +113 -0
- package/src/popup.ts +25 -37
- package/src/recorded-settles.ts +6 -2
- package/src/restacking.ts +4 -3
- package/src/screens/popup-scene.ts +38 -0
- package/src/screens/reading-order.ts +29 -0
- package/src/shown.ts +10 -0
- package/src/sliding-screen.ts +12 -0
- package/src/tab-drop.ts +43 -0
- package/src/tab-switch.ts +5 -1
- package/src/tiled/TileGrab.tsx +11 -1
- package/src/tiled/aim.ts +77 -39
- package/src/tiled/borders.ts +10 -2
- package/src/tiled/tab-targets.ts +37 -0
- package/src/tiled/useBorderDrag.ts +18 -42
- package/src/tiled/useTileDrag.ts +8 -7
- package/src/tree/drop.ts +118 -23
- package/src/tree/frames.ts +2 -2
- package/src/tree/layout.ts +71 -11
- package/src/tree/move.ts +8 -27
- package/src/useHandedPress.ts +25 -0
- package/src/usePageProblem.ts +80 -0
- package/src/usePageTooltip.ts +48 -0
- package/src/usePointerConfinement.ts +103 -0
- package/src/usePointerLock.ts +12 -0
- package/src/useSettling.ts +38 -9
- package/src/useTabDrop.ts +65 -0
- package/src/useWindowMotion.ts +109 -10
- package/src/useWindows.ts +112 -19
- package/src/window-changes.ts +13 -3
- package/src/window-log.ts +106 -0
- package/src/window-motion.ts +34 -0
- package/src/window-state.ts +629 -66
- package/src/window-styles.ts +96 -4
- package/src/window.ts +14 -0
- package/src/workspace.ts +11 -5
- package/src/workspaces-context.ts +6 -1
- package/styled-system/patterns/aspect-ratio.mjs +2 -2
- package/styled-system/patterns/bleed.mjs +1 -2
- package/styled-system/patterns/float.mjs +5 -11
- package/styled-system/patterns/grid-item.mjs +1 -2
- package/styled-system/patterns/grid.mjs +1 -2
- package/styled-system/patterns/link-overlay.mjs +1 -1
- package/styled-system/patterns/spacer.mjs +3 -3
- package/styled-system/patterns/visually-hidden.mjs +1 -1
- package/styled-system/styles.css +2885 -2108
- package/styled-system/tokens/index.mjs +7 -3
- package/styled-system/tokens/tokens.d.ts +2 -2
- package/styled-system/types/prop-type.d.ts +2 -2
package/src/Stage.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Domicile } from "@domicile-desktop/sdk/desktop/desktop";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import { Fragment, memo, useCallback, useMemo, useState } from "react";
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import { AppWindow } from "./AppWindow";
|
|
6
6
|
import { BrowserWindow } from "./BrowserWindow";
|
|
7
|
+
import { useProfileMark } from "./browser/useBrowserProfile";
|
|
7
8
|
import type { Direction } from "./direction";
|
|
8
9
|
import { FocusGlow } from "./FocusGlow";
|
|
9
10
|
import { FloatBorder } from "./floating/FloatBorder";
|
|
@@ -15,8 +16,12 @@ import { floatBordersOf } from "./floating/float-borders";
|
|
|
15
16
|
import { castsFloatShadow, floatCovers } from "./floating/float-covers";
|
|
16
17
|
import { ScratchpadBackdrop } from "./floating/ScratchpadBackdrop";
|
|
17
18
|
import { GrabbingSheet } from "./GrabbingSheet";
|
|
19
|
+
import { GroupTitleBar } from "./GroupTitleBar";
|
|
18
20
|
import { GroupWell } from "./GroupWell";
|
|
21
|
+
import type { HandedDrag } from "./handed-drag";
|
|
19
22
|
import type { Modifiers } from "./keyboard/useModifiers";
|
|
23
|
+
import { seenAt, seenClip, seenStyles } from "./overview/seen-styles";
|
|
24
|
+
import type { OverviewSight, Seen } from "./overview/sight";
|
|
20
25
|
import type {
|
|
21
26
|
Geometry,
|
|
22
27
|
PlacedFocusBox,
|
|
@@ -26,21 +31,22 @@ import type {
|
|
|
26
31
|
} from "./placement";
|
|
27
32
|
import { contentsOf, raised, TILED, wellDepthOf } from "./placement";
|
|
28
33
|
import type { Spot } from "./pointer-warp";
|
|
29
|
-
import type { Popup } from "./popup";
|
|
30
|
-
import {
|
|
34
|
+
import type { Popup, WindowPopup } from "./popup";
|
|
35
|
+
import { popupsOf } from "./popup";
|
|
31
36
|
import type { Rect } from "./rect";
|
|
32
37
|
import type { Restack } from "./restacking";
|
|
33
38
|
import { SelectionTint } from "./SelectionTint";
|
|
34
39
|
import { SettleHandoffs } from "./SettleHandoffs";
|
|
35
40
|
import type { StageScreen } from "./screens/stage-screens";
|
|
36
41
|
import { useShared } from "./screens/useShared";
|
|
42
|
+
import { SlidingScreen } from "./sliding-screen";
|
|
37
43
|
import { TabStrip } from "./TabStrip";
|
|
38
|
-
import { TitleBar } from "./TitleBar";
|
|
39
44
|
import type { Aim, DropTargets, TabTarget, Target } from "./tiled/aim";
|
|
40
45
|
import { bordersOf } from "./tiled/borders";
|
|
41
46
|
import { DropIndicator } from "./tiled/DropIndicator";
|
|
42
47
|
import { TileBorder } from "./tiled/TileBorder";
|
|
43
48
|
import { TileGrab } from "./tiled/TileGrab";
|
|
49
|
+
import { tabTargetsOf } from "./tiled/tab-targets";
|
|
44
50
|
import { titleFocus } from "./title-focus";
|
|
45
51
|
import type { StripPlace } from "./tree/frames";
|
|
46
52
|
import { tabKeyOf } from "./tree/frames";
|
|
@@ -49,6 +55,7 @@ import type { NodeRef } from "./tree/path";
|
|
|
49
55
|
import { focusedWindowIn } from "./tree/tiling";
|
|
50
56
|
import { useCaptured } from "./useCaptured";
|
|
51
57
|
import { keyOf, useFocusGlows } from "./useFocusGlows";
|
|
58
|
+
import { useTabDrop } from "./useTabDrop";
|
|
52
59
|
import type { DrawnWindow, WindowMotions } from "./useWindowMotion";
|
|
53
60
|
import { useWindowMotion } from "./useWindowMotion";
|
|
54
61
|
import { WindowFrame } from "./WindowFrame";
|
|
@@ -57,7 +64,12 @@ import type { ShellWindow } from "./window";
|
|
|
57
64
|
import { browserIdOf, WindowKind } from "./window";
|
|
58
65
|
import type { WindowMotion } from "./window-motion";
|
|
59
66
|
import { barMotion } from "./window-motion";
|
|
60
|
-
import {
|
|
67
|
+
import {
|
|
68
|
+
clippedTo,
|
|
69
|
+
screenClipStyles,
|
|
70
|
+
slidAcross,
|
|
71
|
+
slidingAcross,
|
|
72
|
+
} from "./window-styles";
|
|
61
73
|
|
|
62
74
|
type Props = {
|
|
63
75
|
/** The window the user is working in. */
|
|
@@ -70,6 +82,8 @@ type Props = {
|
|
|
70
82
|
domicile: Domicile;
|
|
71
83
|
/** The floating window being dragged, if any. */
|
|
72
84
|
draggingId: string | undefined;
|
|
85
|
+
/** A client's move or resize, for its window's grab to run. */
|
|
86
|
+
handed?: HandedDrag | undefined;
|
|
73
87
|
/**
|
|
74
88
|
* The window with compositor keyboard focus, or `undefined` when the shell
|
|
75
89
|
* has it. Can differ from `activeId`: see `AppWindow`.
|
|
@@ -121,6 +135,8 @@ type Props = {
|
|
|
121
135
|
onNewTab: (id: string) => void;
|
|
122
136
|
/** Browser window `id`'s page entered or left fullscreen. */
|
|
123
137
|
onPageFullscreen: (id: string, fullscreen: boolean) => void;
|
|
138
|
+
/** A page's text, link or image dropped on a tab strip. See `useTabDrop`. */
|
|
139
|
+
onTabDrop: (target: NodeRef, edge: Direction, url: string) => void;
|
|
124
140
|
/** A float resized to `box`, in the page's pixels, on the screen `on`. */
|
|
125
141
|
onResize: (id: string, box: Rect, on: Geometry) => void;
|
|
126
142
|
/** The user clicked a window or its chrome. */
|
|
@@ -130,12 +146,19 @@ type Props = {
|
|
|
130
146
|
* the tiling of the screen `on`.
|
|
131
147
|
*/
|
|
132
148
|
onStretch: (id: string, edge: Direction, by: number, on: Geometry) => void;
|
|
149
|
+
/**
|
|
150
|
+
* How the overview shows each window, while it is open or closing.
|
|
151
|
+
* `undefined` outside it.
|
|
152
|
+
*/
|
|
153
|
+
overview: OverviewSight | undefined;
|
|
133
154
|
/** Client popups, drawn over their parent windows. */
|
|
134
155
|
popups: readonly Popup[];
|
|
135
156
|
/** Every screen and what it shows. */
|
|
136
157
|
screens: readonly StageScreen[];
|
|
137
158
|
/** The windows hidden in the scratchpad. */
|
|
138
159
|
scratchpad: readonly string[];
|
|
160
|
+
/** The open windows shown as closed. See `Shown.shut`. */
|
|
161
|
+
shut: readonly string[];
|
|
139
162
|
windows: readonly ShellWindow[];
|
|
140
163
|
};
|
|
141
164
|
|
|
@@ -158,6 +181,7 @@ export const Stage = memo(
|
|
|
158
181
|
domicile,
|
|
159
182
|
draggingId,
|
|
160
183
|
focusedId,
|
|
184
|
+
handed,
|
|
161
185
|
modifiers: { meta, shift },
|
|
162
186
|
onBarPress,
|
|
163
187
|
onClose,
|
|
@@ -180,11 +204,14 @@ export const Stage = memo(
|
|
|
180
204
|
onNewTab,
|
|
181
205
|
onPageFullscreen,
|
|
182
206
|
onResize,
|
|
207
|
+
onTabDrop,
|
|
183
208
|
onSelect,
|
|
184
209
|
onStretch,
|
|
210
|
+
overview,
|
|
185
211
|
popups,
|
|
186
212
|
scratchpad,
|
|
187
213
|
screens,
|
|
214
|
+
shut,
|
|
188
215
|
windows,
|
|
189
216
|
}: Props) => {
|
|
190
217
|
const motions = useWindowMotion(
|
|
@@ -192,7 +219,16 @@ export const Stage = memo(
|
|
|
192
219
|
screens.map(
|
|
193
220
|
({ current, geometry, screenful: { placements, tabs } }) => [
|
|
194
221
|
geometry.name,
|
|
195
|
-
{
|
|
222
|
+
{
|
|
223
|
+
activeId,
|
|
224
|
+
current,
|
|
225
|
+
overview: overview !== undefined,
|
|
226
|
+
placements,
|
|
227
|
+
scratchpad,
|
|
228
|
+
shut,
|
|
229
|
+
tabs,
|
|
230
|
+
windows,
|
|
231
|
+
},
|
|
196
232
|
],
|
|
197
233
|
),
|
|
198
234
|
),
|
|
@@ -206,6 +242,25 @@ export const Stage = memo(
|
|
|
206
242
|
() => new Map(windows.map((window) => [window.id, window])),
|
|
207
243
|
[windows],
|
|
208
244
|
);
|
|
245
|
+
// Each client window's popups, looked up once per change.
|
|
246
|
+
const popupsByApp = useMemo(
|
|
247
|
+
() =>
|
|
248
|
+
new Map(
|
|
249
|
+
windows.flatMap((window) =>
|
|
250
|
+
window.kind === WindowKind.App
|
|
251
|
+
? [[window.appId, popupsOf(popups, window.appId)] as const]
|
|
252
|
+
: [],
|
|
253
|
+
),
|
|
254
|
+
),
|
|
255
|
+
[popups, windows],
|
|
256
|
+
);
|
|
257
|
+
// Every window, with a hidden workspace's laid out in its overview tile.
|
|
258
|
+
const drawn = useMemo(
|
|
259
|
+
() => motions.drawn.map((window) => seenIn(window, overview)),
|
|
260
|
+
[motions.drawn, overview],
|
|
261
|
+
);
|
|
262
|
+
// What the overview leaves out: it is for picking, not for working.
|
|
263
|
+
const working = overview === undefined;
|
|
209
264
|
const lit = focusBoxShowing(screens, activeId);
|
|
210
265
|
const { glows, onFaded } = useFocusGlows(lit);
|
|
211
266
|
const active = motions.drawn.find(({ window }) => window.id === activeId);
|
|
@@ -213,21 +268,36 @@ export const Stage = memo(
|
|
|
213
268
|
active === undefined ? "resting" : barMotion(active.motion);
|
|
214
269
|
// Drawn over every window, not by the dragged one: see `DropIndicator`.
|
|
215
270
|
const [aim, setAim] = useState<Aim | undefined>(undefined);
|
|
271
|
+
const tabDrop = useTabDrop({ onAim: setAim, onTabDrop, targets });
|
|
216
272
|
// A border drag or a tiled resize grab resizes in place, so unlike a move
|
|
217
273
|
// it does not fade the window. See `stageStyles`.
|
|
218
274
|
const [stretching, setStretching] = useState(false);
|
|
275
|
+
// The overview takes the grab's handles away before their drop.
|
|
276
|
+
if (!working && stretching) {
|
|
277
|
+
setStretching(false);
|
|
278
|
+
}
|
|
219
279
|
// Whether the running move has been pulled, which shows the grabbing
|
|
220
280
|
// pointer: a click moves nothing, so it shows none. Each grab clears it.
|
|
221
281
|
const [pulled, setPulled] = useState(false);
|
|
222
282
|
const pull = useCallback(() => {
|
|
223
283
|
setPulled(true);
|
|
224
284
|
}, []);
|
|
285
|
+
// The handed drag its grab already started, so a grab remounted mid-drag,
|
|
286
|
+
// such as on another screen, does not start it over.
|
|
287
|
+
const [taken, setTaken] = useState<HandedDrag | undefined>(undefined);
|
|
288
|
+
const handing =
|
|
289
|
+
handed !== taken &&
|
|
290
|
+
handed !== undefined &&
|
|
291
|
+
!desk.fullscreen.has(handed.window)
|
|
292
|
+
? handed
|
|
293
|
+
: undefined;
|
|
225
294
|
const grabbed = useCallback(
|
|
226
295
|
(id: string) => {
|
|
227
296
|
setPulled(false);
|
|
297
|
+
setTaken(handing);
|
|
228
298
|
onGrab(id);
|
|
229
299
|
},
|
|
230
|
-
[onGrab],
|
|
300
|
+
[handing, onGrab],
|
|
231
301
|
);
|
|
232
302
|
const groupGrabbed = useCallback(
|
|
233
303
|
(group: NodeRef) => {
|
|
@@ -245,25 +315,27 @@ export const Stage = memo(
|
|
|
245
315
|
const { onPlayedOut } = motions;
|
|
246
316
|
const tabsShown = motions.tabs.map(({ tab }) => tab);
|
|
247
317
|
return (
|
|
248
|
-
<main>
|
|
318
|
+
<main {...tabDrop}>
|
|
249
319
|
<SettleHandoffs>
|
|
250
320
|
{/*
|
|
251
321
|
Before every window, so each float covers its own shadow by document
|
|
252
322
|
order. See `FloatShadow`. Skipped for fullscreen floats, whose shadow
|
|
253
323
|
would spill onto the next display.
|
|
254
324
|
*/}
|
|
255
|
-
{
|
|
256
|
-
({ motion, placement, restack, rewound, screen, window }) => {
|
|
325
|
+
{drawn.map(
|
|
326
|
+
({ motion, placement, restack, rewound, screen, seen, window }) => {
|
|
257
327
|
const float = desk.floats.get(window.id);
|
|
258
328
|
return placement !== undefined &&
|
|
259
329
|
!desk.fullscreen.has(window.id) &&
|
|
260
330
|
float !== undefined ? (
|
|
261
331
|
<Sliding
|
|
332
|
+
depth={placement.depth}
|
|
262
333
|
frame={placement.frame}
|
|
263
334
|
key={window.id}
|
|
264
335
|
motion={motion}
|
|
265
336
|
on={screenNamed(desk, screen)}
|
|
266
337
|
rewound={rewound}
|
|
338
|
+
seen={seen}
|
|
267
339
|
>
|
|
268
340
|
<FloatShadow
|
|
269
341
|
depth={placement.depth}
|
|
@@ -284,11 +356,13 @@ export const Stage = memo(
|
|
|
284
356
|
{motions.tabs.map(({ motion, restack, screen, tab }) =>
|
|
285
357
|
tab.well === undefined ? undefined : (
|
|
286
358
|
<Sliding
|
|
359
|
+
depth={wellDepthOf(tab.depth)}
|
|
287
360
|
frame={tab.well}
|
|
288
361
|
key={`well-${tabKeyOf(tab)}`}
|
|
289
362
|
motion={motion}
|
|
290
363
|
on={screenNamed(desk, screen)}
|
|
291
364
|
rewound={0}
|
|
365
|
+
seen={overview?.shown.get(screen)}
|
|
292
366
|
>
|
|
293
367
|
<GroupWell
|
|
294
368
|
// None for fullscreen floats, as for `FloatShadow`.
|
|
@@ -311,44 +385,51 @@ export const Stage = memo(
|
|
|
311
385
|
its glow. Only the glow fading in follows the focused window's
|
|
312
386
|
motion.
|
|
313
387
|
*/}
|
|
314
|
-
{
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
on={screenNamed(desk, following?.screen)}
|
|
324
|
-
rewound={following?.rewound ?? 0}
|
|
325
|
-
>
|
|
326
|
-
<FocusGlow
|
|
388
|
+
{working &&
|
|
389
|
+
glows.map(({ box, leaving }) => {
|
|
390
|
+
const following = leaving ? undefined : active;
|
|
391
|
+
const motion =
|
|
392
|
+
following === undefined
|
|
393
|
+
? "resting"
|
|
394
|
+
: barMotion(following.motion);
|
|
395
|
+
return (
|
|
396
|
+
<Sliding
|
|
327
397
|
depth={box.depth}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
(stretching ||
|
|
331
|
-
(activeId !== undefined && held.has(activeId)))
|
|
332
|
-
}
|
|
333
|
-
leaving={leaving}
|
|
398
|
+
frame={following?.placement?.frame}
|
|
399
|
+
key={keyOf(box)}
|
|
334
400
|
motion={motion}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
401
|
+
on={screenNamed(desk, following?.screen)}
|
|
402
|
+
rewound={following?.rewound ?? 0}
|
|
403
|
+
seen={undefined}
|
|
404
|
+
>
|
|
405
|
+
<FocusGlow
|
|
406
|
+
depth={box.depth}
|
|
407
|
+
dragging={
|
|
408
|
+
following !== undefined &&
|
|
409
|
+
(stretching ||
|
|
410
|
+
(activeId !== undefined && held.has(activeId)))
|
|
411
|
+
}
|
|
412
|
+
leaving={leaving}
|
|
413
|
+
motion={motion}
|
|
414
|
+
onFaded={() => {
|
|
415
|
+
onFaded(box);
|
|
416
|
+
}}
|
|
417
|
+
rect={box.rect}
|
|
418
|
+
restack={following?.restack}
|
|
419
|
+
windows={box.windows}
|
|
420
|
+
/>
|
|
421
|
+
</Sliding>
|
|
422
|
+
);
|
|
423
|
+
})}
|
|
424
|
+
{drawn.map(
|
|
346
425
|
({
|
|
426
|
+
crossing,
|
|
347
427
|
focused,
|
|
348
428
|
motion,
|
|
349
429
|
placement,
|
|
350
430
|
restack,
|
|
351
431
|
screen,
|
|
432
|
+
seen,
|
|
352
433
|
shownRewound,
|
|
353
434
|
window,
|
|
354
435
|
}) => (
|
|
@@ -358,15 +439,20 @@ export const Stage = memo(
|
|
|
358
439
|
// grabbable window so it can catch a drag. During a drag it takes
|
|
359
440
|
// it over every window: one that kept the pointer would swallow
|
|
360
441
|
// the moves and the release, leaving the dragged window stuck.
|
|
442
|
+
// An edge drag leaves windows taking the pointer: the edge holds
|
|
443
|
+
// it, and a window takes it back only at the engine's next
|
|
444
|
+
// frame, so the moves and clicks just after the release would
|
|
445
|
+
// reach the desktop instead of the page under them.
|
|
361
446
|
clickThrough={
|
|
362
447
|
draggingId !== undefined ||
|
|
363
|
-
stretching ||
|
|
364
448
|
(meta &&
|
|
365
449
|
(desk.floats.has(window.id) ||
|
|
366
450
|
desk.targeted.has(window.id)))
|
|
367
451
|
}
|
|
452
|
+
crossing={crossing}
|
|
368
453
|
domicile={domicile}
|
|
369
454
|
dragging={stretching || held.has(window.id)}
|
|
455
|
+
fillsScreen={desk.fullscreen.has(window.id)}
|
|
370
456
|
floating={desk.floats.has(window.id)}
|
|
371
457
|
focused={focused}
|
|
372
458
|
fullscreen={desk.fullscreen.get(window.id) === false}
|
|
@@ -381,6 +467,11 @@ export const Stage = memo(
|
|
|
381
467
|
onPlayedOut={onPlayedOut}
|
|
382
468
|
onSelect={onSelect}
|
|
383
469
|
placement={placement}
|
|
470
|
+
popups={
|
|
471
|
+
window.kind === WindowKind.App
|
|
472
|
+
? (popupsByApp.get(window.appId) ?? NO_POPUPS)
|
|
473
|
+
: NO_POPUPS
|
|
474
|
+
}
|
|
384
475
|
// Every window, since a tiled edge resizes the windows on
|
|
385
476
|
// both sides of it. A window whose box stays put is unaffected.
|
|
386
477
|
resizing={stretching}
|
|
@@ -388,6 +479,7 @@ export const Stage = memo(
|
|
|
388
479
|
rewound={shownRewound}
|
|
389
480
|
screen={screen}
|
|
390
481
|
screenBox={screenNamed(desk, screen)?.geometry.screen}
|
|
482
|
+
seen={seen}
|
|
391
483
|
window={window}
|
|
392
484
|
/>
|
|
393
485
|
),
|
|
@@ -397,8 +489,16 @@ export const Stage = memo(
|
|
|
397
489
|
contents and before every bar, so the contents tuck under the strip
|
|
398
490
|
and the tabs lie on it by document order. See `TabStrip`.
|
|
399
491
|
*/}
|
|
400
|
-
{
|
|
401
|
-
({
|
|
492
|
+
{drawn.map(
|
|
493
|
+
({
|
|
494
|
+
motion,
|
|
495
|
+
placement,
|
|
496
|
+
restack,
|
|
497
|
+
screen,
|
|
498
|
+
seen,
|
|
499
|
+
shownRewound,
|
|
500
|
+
window,
|
|
501
|
+
}) =>
|
|
402
502
|
placement?.strip?.open === true &&
|
|
403
503
|
placement.tabbed !== undefined &&
|
|
404
504
|
!leavesStrip(motion) ? (
|
|
@@ -422,11 +522,13 @@ export const Stage = memo(
|
|
|
422
522
|
onGroupFloat={onGroupFloat}
|
|
423
523
|
onGroupFullscreen={onGroupFullscreen}
|
|
424
524
|
onGroupGrab={groupGrabbed}
|
|
525
|
+
onHover={onHover}
|
|
425
526
|
onMove={onMove}
|
|
426
527
|
onNewTab={onNewTab}
|
|
427
528
|
onPull={pull}
|
|
428
529
|
restack={restack}
|
|
429
530
|
rewound={shownRewound}
|
|
531
|
+
seen={seen}
|
|
430
532
|
strip={placement.strip}
|
|
431
533
|
targets={targets}
|
|
432
534
|
/>
|
|
@@ -451,11 +553,13 @@ export const Stage = memo(
|
|
|
451
553
|
onGroupFloat={onGroupFloat}
|
|
452
554
|
onGroupFullscreen={onGroupFullscreen}
|
|
453
555
|
onGroupGrab={groupGrabbed}
|
|
556
|
+
onHover={onHover}
|
|
454
557
|
onMove={onMove}
|
|
455
558
|
onNewTab={onNewTab}
|
|
456
559
|
onPull={pull}
|
|
457
560
|
restack={restack}
|
|
458
561
|
rewound={0}
|
|
562
|
+
seen={overview?.shown.get(screen)}
|
|
459
563
|
strip={tab.strip}
|
|
460
564
|
targets={targets}
|
|
461
565
|
/>
|
|
@@ -468,19 +572,23 @@ export const Stage = memo(
|
|
|
468
572
|
component for tiled and floating, so the bar is not remounted when
|
|
469
573
|
the window floats. See `WindowTitleBar`. A bare float has none.
|
|
470
574
|
*/}
|
|
471
|
-
{
|
|
575
|
+
{drawn.map(
|
|
472
576
|
({
|
|
577
|
+
crossing,
|
|
473
578
|
focused,
|
|
474
579
|
motion,
|
|
475
580
|
placement,
|
|
476
581
|
restack,
|
|
477
582
|
rewound,
|
|
478
583
|
screen,
|
|
584
|
+
seen,
|
|
479
585
|
window,
|
|
480
586
|
}) =>
|
|
481
587
|
placement === undefined || placement.bare ? undefined : (
|
|
482
588
|
<WindowBar
|
|
589
|
+
crossing={crossing}
|
|
483
590
|
description={descriptionOf(window)}
|
|
591
|
+
domicile={domicile}
|
|
484
592
|
dragging={stretching || held.has(window.id)}
|
|
485
593
|
float={desk.floats.get(window.id)}
|
|
486
594
|
focused={focused}
|
|
@@ -505,6 +613,7 @@ export const Stage = memo(
|
|
|
505
613
|
rewound={rewound}
|
|
506
614
|
screen={screen}
|
|
507
615
|
screenBox={screenNamed(desk, screen)?.geometry.screen}
|
|
616
|
+
seen={seen}
|
|
508
617
|
targets={targets}
|
|
509
618
|
window={window}
|
|
510
619
|
/>
|
|
@@ -515,7 +624,7 @@ export const Stage = memo(
|
|
|
515
624
|
order.
|
|
516
625
|
*/}
|
|
517
626
|
{screens.flatMap((on) => {
|
|
518
|
-
const hanging = hangingOn(motions.drawn, on);
|
|
627
|
+
const hanging = working ? hangingOn(motions.drawn, on) : undefined;
|
|
519
628
|
return hanging?.placement === undefined
|
|
520
629
|
? []
|
|
521
630
|
: [
|
|
@@ -537,24 +646,26 @@ export const Stage = memo(
|
|
|
537
646
|
before the grabs, so a modifier grab covers everything but the gaps.
|
|
538
647
|
*/}
|
|
539
648
|
{screens.flatMap((on) =>
|
|
540
|
-
bordersOf(targetsOn(on)).map(
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
onStretch(
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
649
|
+
bordersOf(working ? targetsOn(on) : []).map(
|
|
650
|
+
({ edge, id, rect }) => (
|
|
651
|
+
<TileBorder
|
|
652
|
+
edge={edge}
|
|
653
|
+
id={id}
|
|
654
|
+
key={`${id}-${edge.toString()}`}
|
|
655
|
+
onDrop={() => {
|
|
656
|
+
setStretching(false);
|
|
657
|
+
}}
|
|
658
|
+
onGrab={() => {
|
|
659
|
+
setStretching(true);
|
|
660
|
+
onSelect(id);
|
|
661
|
+
}}
|
|
662
|
+
onStretch={(stretched, by) => {
|
|
663
|
+
onStretch(id, stretched, by, on.geometry);
|
|
664
|
+
}}
|
|
665
|
+
rect={rect}
|
|
666
|
+
/>
|
|
667
|
+
),
|
|
668
|
+
),
|
|
558
669
|
)}
|
|
559
670
|
{/*
|
|
560
671
|
Floating window borders, at each float's depth so windows above cover
|
|
@@ -564,7 +675,8 @@ export const Stage = memo(
|
|
|
564
675
|
{motions.drawn.map(({ placement, screen, window }) => {
|
|
565
676
|
const on = screenNamed(desk, screen);
|
|
566
677
|
const floating = desk.floatsFocusing.get(window.id);
|
|
567
|
-
return
|
|
678
|
+
return !working ||
|
|
679
|
+
placement === undefined ||
|
|
568
680
|
on === undefined ||
|
|
569
681
|
floating === undefined ||
|
|
570
682
|
desk.fullscreen.has(window.id)
|
|
@@ -604,19 +716,25 @@ export const Stage = memo(
|
|
|
604
716
|
const onGrabThis = () => {
|
|
605
717
|
grabbed(window.id);
|
|
606
718
|
};
|
|
719
|
+
const handedHere =
|
|
720
|
+
handing?.window === window.id ? handing : undefined;
|
|
721
|
+
const resizes = handedHere?.resizes ?? shift;
|
|
607
722
|
const onHoverThis = (at: Spot) => {
|
|
608
723
|
onHover(window.id, at);
|
|
609
724
|
};
|
|
610
|
-
if (placement === undefined || on === undefined) {
|
|
725
|
+
if (!working || placement === undefined || on === undefined) {
|
|
611
726
|
return undefined;
|
|
612
727
|
} else {
|
|
613
728
|
return (
|
|
614
729
|
<Fragment key={window.id}>
|
|
615
730
|
{floating === undefined &&
|
|
616
731
|
desk.targeted.has(window.id) &&
|
|
617
|
-
(meta ||
|
|
732
|
+
(meta ||
|
|
733
|
+
window.id === draggingId ||
|
|
734
|
+
handedHere !== undefined) && (
|
|
618
735
|
<TileGrab
|
|
619
736
|
frame={placement.frame}
|
|
737
|
+
handed={handedHere?.press}
|
|
620
738
|
id={window.id}
|
|
621
739
|
onAim={setAim}
|
|
622
740
|
onDrop={() => {
|
|
@@ -635,7 +753,7 @@ export const Stage = memo(
|
|
|
635
753
|
onStretch={(edge, by) => {
|
|
636
754
|
onStretch(window.id, edge, by, on.geometry);
|
|
637
755
|
}}
|
|
638
|
-
resizes={
|
|
756
|
+
resizes={resizes}
|
|
639
757
|
targets={targets}
|
|
640
758
|
/>
|
|
641
759
|
)}
|
|
@@ -644,10 +762,13 @@ export const Stage = memo(
|
|
|
644
762
|
*/}
|
|
645
763
|
{floating !== undefined &&
|
|
646
764
|
focusedWindowIn(floating.root) === window.id &&
|
|
647
|
-
(meta ||
|
|
765
|
+
(meta ||
|
|
766
|
+
window.id === draggingId ||
|
|
767
|
+
handedHere !== undefined) && (
|
|
648
768
|
<FloatGrab
|
|
649
769
|
depth={placement.depth}
|
|
650
770
|
float={floating}
|
|
771
|
+
handed={handedHere?.press}
|
|
651
772
|
onDrop={() => {
|
|
652
773
|
setStretching(false);
|
|
653
774
|
onDrop();
|
|
@@ -664,7 +785,7 @@ export const Stage = memo(
|
|
|
664
785
|
onResize={(box) => {
|
|
665
786
|
onResize(window.id, box, on.geometry);
|
|
666
787
|
}}
|
|
667
|
-
resizes={
|
|
788
|
+
resizes={resizes}
|
|
668
789
|
window={window.id}
|
|
669
790
|
/>
|
|
670
791
|
)}
|
|
@@ -691,14 +812,21 @@ export const Stage = memo(
|
|
|
691
812
|
key={tabKeyOf(tab)}
|
|
692
813
|
motion={motion}
|
|
693
814
|
on={screenNamed(desk, screen)}
|
|
815
|
+
onAim={setAim}
|
|
694
816
|
onClose={onGroupClose}
|
|
817
|
+
onDrop={onDrop}
|
|
818
|
+
onDropOn={onGroupDropOn}
|
|
695
819
|
onFloat={onFloat}
|
|
696
820
|
onFullscreen={onFullscreen}
|
|
821
|
+
onGrab={groupGrabbed}
|
|
697
822
|
onPlayedOut={onPlayedOut}
|
|
823
|
+
onPull={pull}
|
|
698
824
|
onSelect={onSelect}
|
|
699
825
|
restack={restack}
|
|
700
826
|
screen={screen}
|
|
827
|
+
seen={overview?.shown.get(screen)}
|
|
701
828
|
tab={tab}
|
|
829
|
+
targets={targets}
|
|
702
830
|
title={tabbed.title}
|
|
703
831
|
/>
|
|
704
832
|
);
|
|
@@ -708,12 +836,14 @@ export const Stage = memo(
|
|
|
708
836
|
covers the selected container's windows and every tab. It follows
|
|
709
837
|
the focused window as its glow does.
|
|
710
838
|
*/}
|
|
711
|
-
{lit?.selection !== undefined && (
|
|
839
|
+
{working && lit?.selection !== undefined && (
|
|
712
840
|
<Sliding
|
|
841
|
+
depth={raised(lit.depth)}
|
|
713
842
|
frame={active?.placement?.frame}
|
|
714
843
|
motion={activeMotion}
|
|
715
844
|
on={screenNamed(desk, active?.screen)}
|
|
716
845
|
rewound={active?.rewound ?? 0}
|
|
846
|
+
seen={undefined}
|
|
717
847
|
>
|
|
718
848
|
<SelectionTint
|
|
719
849
|
depth={raised(lit.depth)}
|
|
@@ -726,18 +856,8 @@ export const Stage = memo(
|
|
|
726
856
|
/>
|
|
727
857
|
</Sliding>
|
|
728
858
|
)}
|
|
729
|
-
{aim !== undefined && <DropIndicator aim={aim} />}
|
|
859
|
+
{working && aim !== undefined && <DropIndicator aim={aim} />}
|
|
730
860
|
{movingId !== undefined && pulled && <GrabbingSheet />}
|
|
731
|
-
{/*
|
|
732
|
-
Last, so a popup wins the `z-index` tie at its window's depth but
|
|
733
|
-
stays under windows stacked above.
|
|
734
|
-
*/}
|
|
735
|
-
{popupsOver(
|
|
736
|
-
popups,
|
|
737
|
-
screens.flatMap(({ screenful }) => screenful.placements),
|
|
738
|
-
).map((popup) => (
|
|
739
|
-
<AppPopup key={popup.appId} popup={popup} />
|
|
740
|
-
))}
|
|
741
861
|
</SettleHandoffs>
|
|
742
862
|
</main>
|
|
743
863
|
);
|
|
@@ -795,13 +915,20 @@ const deskOf = (screens: readonly StageScreen[]): Desk => {
|
|
|
795
915
|
};
|
|
796
916
|
};
|
|
797
917
|
|
|
918
|
+
/** No popups, shared so a window without any keeps its memoized render. */
|
|
919
|
+
const NO_POPUPS: readonly WindowPopup[] = [];
|
|
920
|
+
|
|
798
921
|
type WindowContentsProps = {
|
|
799
922
|
behindPanel: boolean;
|
|
800
923
|
clickThrough: boolean;
|
|
924
|
+
/** See `DrawnWindow.crossing`. */
|
|
925
|
+
crossing: boolean;
|
|
801
926
|
domicile: Domicile;
|
|
802
927
|
dragging: boolean;
|
|
803
928
|
floating: boolean;
|
|
804
929
|
focused: boolean;
|
|
930
|
+
/** Whether it fills its screen, alone or in its group. */
|
|
931
|
+
fillsScreen: boolean;
|
|
805
932
|
fullscreen: boolean;
|
|
806
933
|
hasKeyboard: boolean;
|
|
807
934
|
motion: WindowMotion;
|
|
@@ -813,6 +940,8 @@ type WindowContentsProps = {
|
|
|
813
940
|
onPlayedOut: WindowMotions["onPlayedOut"];
|
|
814
941
|
onSelect: (id: string) => void;
|
|
815
942
|
placement: Placement | undefined;
|
|
943
|
+
/** Its client's popups. See `AppWindow`. */
|
|
944
|
+
popups: readonly WindowPopup[];
|
|
816
945
|
/** See `AppWindow`. */
|
|
817
946
|
resizing: boolean;
|
|
818
947
|
restack: Restack | undefined;
|
|
@@ -821,6 +950,8 @@ type WindowContentsProps = {
|
|
|
821
950
|
screen: string | undefined;
|
|
822
951
|
/** The box of the screen it is drawn on. */
|
|
823
952
|
screenBox: Rect | undefined;
|
|
953
|
+
/** How the overview shows it, if open. */
|
|
954
|
+
seen: Seen | undefined;
|
|
824
955
|
window: ShellWindow;
|
|
825
956
|
};
|
|
826
957
|
|
|
@@ -832,8 +963,10 @@ const WindowContents = memo(
|
|
|
832
963
|
({
|
|
833
964
|
behindPanel,
|
|
834
965
|
clickThrough,
|
|
966
|
+
crossing,
|
|
835
967
|
domicile,
|
|
836
968
|
dragging,
|
|
969
|
+
fillsScreen,
|
|
837
970
|
floating,
|
|
838
971
|
focused,
|
|
839
972
|
fullscreen,
|
|
@@ -847,11 +980,13 @@ const WindowContents = memo(
|
|
|
847
980
|
onPlayedOut,
|
|
848
981
|
onSelect,
|
|
849
982
|
placement,
|
|
983
|
+
popups,
|
|
850
984
|
resizing,
|
|
851
985
|
restack,
|
|
852
986
|
rewound,
|
|
853
987
|
screen,
|
|
854
988
|
screenBox,
|
|
989
|
+
seen,
|
|
855
990
|
window,
|
|
856
991
|
}: WindowContentsProps) => {
|
|
857
992
|
const { id } = window;
|
|
@@ -875,6 +1010,10 @@ const WindowContents = memo(
|
|
|
875
1010
|
const ended = useCallback(() => {
|
|
876
1011
|
onPlayedOut(id, motion, screen, "contents");
|
|
877
1012
|
}, [id, motion, onPlayedOut, screen]);
|
|
1013
|
+
// A hidden workspace's window coming into the overview draws again, and
|
|
1014
|
+
// the engine would hold the desk for it as a workspace switch's would.
|
|
1015
|
+
// See `isSlidingIn`.
|
|
1016
|
+
const unheld = resizing || seen?.arriving !== undefined;
|
|
878
1017
|
const pageFilled = useCallback(
|
|
879
1018
|
(fullscreen: boolean) => {
|
|
880
1019
|
onPageFullscreen(id, fullscreen);
|
|
@@ -883,19 +1022,23 @@ const WindowContents = memo(
|
|
|
883
1022
|
);
|
|
884
1023
|
return (
|
|
885
1024
|
<WindowFrame
|
|
1025
|
+
depth={contents?.depth ?? 0}
|
|
1026
|
+
fillsScreen={fillsScreen}
|
|
886
1027
|
frame={placement?.frame}
|
|
887
1028
|
motion={motion}
|
|
888
1029
|
onHover={hovered}
|
|
889
1030
|
onReach={reached}
|
|
890
1031
|
rewound={rewound}
|
|
891
1032
|
screen={screenBox}
|
|
1033
|
+
seen={seen}
|
|
892
1034
|
>
|
|
893
1035
|
{window.kind === WindowKind.App ? (
|
|
894
1036
|
<AppWindow
|
|
895
1037
|
appId={window.appId}
|
|
896
1038
|
behindPanel={behindPanel}
|
|
897
1039
|
clickThrough={clickThrough}
|
|
898
|
-
|
|
1040
|
+
crossing={crossing}
|
|
1041
|
+
cursor={window.cursorImage ?? window.cursor}
|
|
899
1042
|
depth={contents?.depth ?? 0}
|
|
900
1043
|
domicile={domicile}
|
|
901
1044
|
dragging={dragging}
|
|
@@ -906,16 +1049,19 @@ const WindowContents = memo(
|
|
|
906
1049
|
hasKeyboard={hasKeyboard}
|
|
907
1050
|
motion={motion}
|
|
908
1051
|
onMotionEnded={ended}
|
|
1052
|
+
popups={popups}
|
|
909
1053
|
rect={contents?.rect}
|
|
910
|
-
resizing={
|
|
1054
|
+
resizing={unheld}
|
|
911
1055
|
restack={restack}
|
|
912
1056
|
syncedFrame={window.syncedFrame}
|
|
1057
|
+
tab={placement?.bar}
|
|
913
1058
|
/>
|
|
914
1059
|
) : (
|
|
915
1060
|
<BrowserWindow
|
|
916
1061
|
behindPanel={behindPanel}
|
|
917
1062
|
clickThrough={clickThrough}
|
|
918
1063
|
covered={placement?.behind !== undefined}
|
|
1064
|
+
crossing={crossing}
|
|
919
1065
|
depth={contents?.depth ?? 0}
|
|
920
1066
|
domicile={domicile}
|
|
921
1067
|
dragging={dragging}
|
|
@@ -933,8 +1079,9 @@ const WindowContents = memo(
|
|
|
933
1079
|
onReach={reached}
|
|
934
1080
|
popupWindow={window.popupWindow}
|
|
935
1081
|
rect={contents?.rect}
|
|
936
|
-
resizing={
|
|
1082
|
+
resizing={unheld}
|
|
937
1083
|
restack={restack}
|
|
1084
|
+
tab={placement?.bar}
|
|
938
1085
|
url={window.url}
|
|
939
1086
|
window={engineWindowOf(id)}
|
|
940
1087
|
/>
|
|
@@ -945,6 +1092,10 @@ const WindowContents = memo(
|
|
|
945
1092
|
);
|
|
946
1093
|
|
|
947
1094
|
type WindowBarProps = {
|
|
1095
|
+
/** See `DrawnWindow.crossing`. */
|
|
1096
|
+
crossing: boolean;
|
|
1097
|
+
/** Where a browser window's page's profile comes from, for its mark. */
|
|
1098
|
+
domicile: Pick<Domicile, "browser">;
|
|
948
1099
|
description: string | undefined;
|
|
949
1100
|
dragging: boolean;
|
|
950
1101
|
float: Float | undefined;
|
|
@@ -971,6 +1122,8 @@ type WindowBarProps = {
|
|
|
971
1122
|
screen: string | undefined;
|
|
972
1123
|
/** The box of the screen it is drawn on. */
|
|
973
1124
|
screenBox: Rect | undefined;
|
|
1125
|
+
/** How the overview shows it, if open. */
|
|
1126
|
+
seen: Seen | undefined;
|
|
974
1127
|
targets: DropTargets;
|
|
975
1128
|
window: ShellWindow;
|
|
976
1129
|
};
|
|
@@ -978,7 +1131,9 @@ type WindowBarProps = {
|
|
|
978
1131
|
/** One window's title bar, memoized as {@link WindowContents} is. */
|
|
979
1132
|
const WindowBar = memo(
|
|
980
1133
|
({
|
|
1134
|
+
crossing,
|
|
981
1135
|
description,
|
|
1136
|
+
domicile,
|
|
982
1137
|
dragging,
|
|
983
1138
|
float,
|
|
984
1139
|
focused,
|
|
@@ -1002,10 +1157,15 @@ const WindowBar = memo(
|
|
|
1002
1157
|
rewound,
|
|
1003
1158
|
screen,
|
|
1004
1159
|
screenBox,
|
|
1160
|
+
seen,
|
|
1005
1161
|
targets,
|
|
1006
1162
|
window,
|
|
1007
1163
|
}: WindowBarProps) => {
|
|
1008
1164
|
const { id } = window;
|
|
1165
|
+
const mark = useProfileMark(
|
|
1166
|
+
domicile,
|
|
1167
|
+
window.kind === WindowKind.Browser ? engineWindowOf(id) : undefined,
|
|
1168
|
+
);
|
|
1009
1169
|
const hovered = useCallback(
|
|
1010
1170
|
(at: Spot) => {
|
|
1011
1171
|
onHover(id, at);
|
|
@@ -1044,14 +1204,18 @@ const WindowBar = memo(
|
|
|
1044
1204
|
);
|
|
1045
1205
|
return (
|
|
1046
1206
|
<WindowFrame
|
|
1207
|
+
depth={placement.depth}
|
|
1208
|
+
fillsScreen={fullscreen}
|
|
1047
1209
|
frame={placement.frame}
|
|
1048
1210
|
motion={motion}
|
|
1049
1211
|
onHover={hovered}
|
|
1050
1212
|
onReach={reached}
|
|
1051
1213
|
rewound={rewound}
|
|
1052
1214
|
screen={screenBox}
|
|
1215
|
+
seen={seen}
|
|
1053
1216
|
>
|
|
1054
1217
|
<WindowTitleBar
|
|
1218
|
+
crossing={crossing}
|
|
1055
1219
|
depth={placement.depth}
|
|
1056
1220
|
description={description}
|
|
1057
1221
|
dragging={dragging}
|
|
@@ -1068,6 +1232,7 @@ const WindowBar = memo(
|
|
|
1068
1232
|
frame={placement.frame}
|
|
1069
1233
|
fullscreen={fullscreen}
|
|
1070
1234
|
icon={icon}
|
|
1235
|
+
mark={mark}
|
|
1071
1236
|
motion={barMotion(motion)}
|
|
1072
1237
|
onAim={onAim}
|
|
1073
1238
|
onClose={closed}
|
|
@@ -1102,15 +1267,25 @@ type ContainerTabProps = {
|
|
|
1102
1267
|
icon: string | undefined;
|
|
1103
1268
|
motion: WindowMotion;
|
|
1104
1269
|
on: StageScreen | undefined;
|
|
1270
|
+
onAim: (aim: Aim | undefined) => void;
|
|
1105
1271
|
/** Closes the tab's group, every window in it. */
|
|
1106
1272
|
onClose: (group: NodeRef) => void;
|
|
1273
|
+
onDrop: () => void;
|
|
1274
|
+
/** The tab's group dropped where it was aimed. */
|
|
1275
|
+
onDropOn: (group: NodeRef, aim: Aim) => void;
|
|
1107
1276
|
onFloat: (id: string) => void;
|
|
1108
1277
|
onFullscreen: (id: string) => void;
|
|
1278
|
+
/** The tab's group taken hold of. */
|
|
1279
|
+
onGrab: (group: NodeRef) => void;
|
|
1109
1280
|
onPlayedOut: WindowMotions["onPlayedOut"];
|
|
1281
|
+
onPull: () => void;
|
|
1110
1282
|
onSelect: (id: string) => void;
|
|
1111
1283
|
restack: Restack | undefined;
|
|
1112
1284
|
screen: string;
|
|
1285
|
+
/** How the overview shows it, if open. */
|
|
1286
|
+
seen: Seen | undefined;
|
|
1113
1287
|
tab: PlacedTab;
|
|
1288
|
+
targets: DropTargets;
|
|
1114
1289
|
/** The title of the window the tab is named after. */
|
|
1115
1290
|
title: string;
|
|
1116
1291
|
};
|
|
@@ -1126,20 +1301,36 @@ const ContainerTab = memo(
|
|
|
1126
1301
|
icon,
|
|
1127
1302
|
motion,
|
|
1128
1303
|
on,
|
|
1304
|
+
onAim,
|
|
1129
1305
|
onClose,
|
|
1306
|
+
onDrop,
|
|
1307
|
+
onDropOn,
|
|
1130
1308
|
onFloat,
|
|
1131
1309
|
onFullscreen,
|
|
1310
|
+
onGrab,
|
|
1132
1311
|
onPlayedOut,
|
|
1312
|
+
onPull,
|
|
1133
1313
|
onSelect,
|
|
1134
1314
|
restack,
|
|
1135
1315
|
screen,
|
|
1316
|
+
seen,
|
|
1136
1317
|
tab,
|
|
1318
|
+
targets,
|
|
1137
1319
|
title,
|
|
1138
1320
|
}: ContainerTabProps) => {
|
|
1139
1321
|
const { id, node } = tab;
|
|
1140
1322
|
const closed = useCallback(() => {
|
|
1141
1323
|
onClose(node);
|
|
1142
1324
|
}, [node, onClose]);
|
|
1325
|
+
const droppedOn = useCallback(
|
|
1326
|
+
(aim: Aim) => {
|
|
1327
|
+
onDropOn(node, aim);
|
|
1328
|
+
},
|
|
1329
|
+
[node, onDropOn],
|
|
1330
|
+
);
|
|
1331
|
+
const grabbed = useCallback(() => {
|
|
1332
|
+
onGrab(node);
|
|
1333
|
+
}, [node, onGrab]);
|
|
1143
1334
|
const floated = useCallback(() => {
|
|
1144
1335
|
onFloat(id);
|
|
1145
1336
|
}, [id, onFloat]);
|
|
@@ -1153,8 +1344,15 @@ const ContainerTab = memo(
|
|
|
1153
1344
|
onSelect(id);
|
|
1154
1345
|
}, [id, onSelect]);
|
|
1155
1346
|
return (
|
|
1156
|
-
<Sliding
|
|
1157
|
-
|
|
1347
|
+
<Sliding
|
|
1348
|
+
depth={tab.depth}
|
|
1349
|
+
frame={undefined}
|
|
1350
|
+
motion={motion}
|
|
1351
|
+
on={on}
|
|
1352
|
+
rewound={0}
|
|
1353
|
+
seen={seen}
|
|
1354
|
+
>
|
|
1355
|
+
<GroupTitleBar
|
|
1158
1356
|
depth={tab.depth}
|
|
1159
1357
|
description={description}
|
|
1160
1358
|
dragging={dragging}
|
|
@@ -1173,16 +1371,23 @@ const ContainerTab = memo(
|
|
|
1173
1371
|
group={{ layout: tab.group, windows: tab.windows }}
|
|
1174
1372
|
icon={icon}
|
|
1175
1373
|
motion={motion}
|
|
1374
|
+
node={node}
|
|
1375
|
+
onAim={onAim}
|
|
1176
1376
|
onClose={closed}
|
|
1377
|
+
onDrop={onDrop}
|
|
1378
|
+
onDropOn={droppedOn}
|
|
1177
1379
|
onFloat={floated}
|
|
1178
1380
|
onFullscreen={filled}
|
|
1381
|
+
onGrab={grabbed}
|
|
1179
1382
|
onMiddleClick={closed}
|
|
1180
1383
|
onMotionEnded={ended}
|
|
1181
|
-
|
|
1384
|
+
onPress={pressed}
|
|
1385
|
+
onPull={onPull}
|
|
1182
1386
|
rect={tab.rect}
|
|
1183
1387
|
restack={restack}
|
|
1184
1388
|
strip={tab.strip}
|
|
1185
1389
|
tabbed={tab.tabbed}
|
|
1390
|
+
targets={targets}
|
|
1186
1391
|
title={title}
|
|
1187
1392
|
window={id}
|
|
1188
1393
|
/>
|
|
@@ -1193,20 +1398,27 @@ const ContainerTab = memo(
|
|
|
1193
1398
|
|
|
1194
1399
|
/**
|
|
1195
1400
|
* Gives its children the distances that slide `frame` off screen `on`, and
|
|
1196
|
-
* clips them to it during a workspace switch
|
|
1401
|
+
* clips them to it during a workspace switch, outside and inside the slide
|
|
1402
|
+
* (see `clippedAlong`). See `screenClipStyles`. In the
|
|
1403
|
+
* overview, shows them through their tile; see `seenAt`.
|
|
1197
1404
|
*/
|
|
1198
1405
|
const Sliding = ({
|
|
1199
1406
|
children,
|
|
1407
|
+
depth,
|
|
1200
1408
|
frame,
|
|
1201
1409
|
motion,
|
|
1202
1410
|
on,
|
|
1203
1411
|
rewound,
|
|
1412
|
+
seen,
|
|
1204
1413
|
}: {
|
|
1205
1414
|
children: ReactNode;
|
|
1415
|
+
/** The depth of the part it holds. */
|
|
1416
|
+
depth: number;
|
|
1206
1417
|
frame: Rect | undefined;
|
|
1207
1418
|
motion: WindowMotion;
|
|
1208
1419
|
on: StageScreen | undefined;
|
|
1209
1420
|
rewound: number;
|
|
1421
|
+
seen: Seen | undefined;
|
|
1210
1422
|
}) => (
|
|
1211
1423
|
<div
|
|
1212
1424
|
className={screenClipStyles}
|
|
@@ -1216,10 +1428,28 @@ const Sliding = ({
|
|
|
1216
1428
|
: {
|
|
1217
1429
|
...slidAcross(on.geometry.screen, frame, motion, rewound),
|
|
1218
1430
|
...clippedTo(on.geometry.screen, motion),
|
|
1431
|
+
...seenClip(seen, on.geometry.screen, depth),
|
|
1219
1432
|
}
|
|
1220
1433
|
}
|
|
1221
1434
|
>
|
|
1222
|
-
|
|
1435
|
+
<div
|
|
1436
|
+
className={seenStyles({
|
|
1437
|
+
arriving: seen?.arriving !== undefined,
|
|
1438
|
+
seen: seen !== undefined,
|
|
1439
|
+
shut: seen?.shut ?? false,
|
|
1440
|
+
})}
|
|
1441
|
+
style={seenAt(seen, on?.geometry.screen)}
|
|
1442
|
+
>
|
|
1443
|
+
<SlidingScreen
|
|
1444
|
+
value={
|
|
1445
|
+
on === undefined
|
|
1446
|
+
? undefined
|
|
1447
|
+
: slidingAcross(on.geometry.screen, motion)
|
|
1448
|
+
}
|
|
1449
|
+
>
|
|
1450
|
+
{children}
|
|
1451
|
+
</SlidingScreen>
|
|
1452
|
+
</div>
|
|
1223
1453
|
</div>
|
|
1224
1454
|
);
|
|
1225
1455
|
|
|
@@ -1258,11 +1488,14 @@ type GroupStripProps = {
|
|
|
1258
1488
|
onGroupFloat: (group: NodeRef) => void;
|
|
1259
1489
|
onGroupFullscreen: (group: NodeRef) => void;
|
|
1260
1490
|
onGroupGrab: (group: NodeRef) => void;
|
|
1491
|
+
onHover: (id: string, at: Spot) => void;
|
|
1261
1492
|
onMove: (id: string, x: number, y: number) => void;
|
|
1262
1493
|
onNewTab: (id: string) => void;
|
|
1263
1494
|
onPull: () => void;
|
|
1264
1495
|
restack: Restack | undefined;
|
|
1265
1496
|
rewound: number;
|
|
1497
|
+
/** How the overview shows it, if open. */
|
|
1498
|
+
seen: Seen | undefined;
|
|
1266
1499
|
strip: StripPlace;
|
|
1267
1500
|
targets: DropTargets;
|
|
1268
1501
|
};
|
|
@@ -1288,11 +1521,13 @@ const GroupStrip = memo(
|
|
|
1288
1521
|
onGroupFloat,
|
|
1289
1522
|
onGroupFullscreen,
|
|
1290
1523
|
onGroupGrab,
|
|
1524
|
+
onHover,
|
|
1291
1525
|
onMove,
|
|
1292
1526
|
onNewTab,
|
|
1293
1527
|
onPull,
|
|
1294
1528
|
restack,
|
|
1295
1529
|
rewound,
|
|
1530
|
+
seen,
|
|
1296
1531
|
strip,
|
|
1297
1532
|
targets,
|
|
1298
1533
|
}: GroupStripProps) => {
|
|
@@ -1318,6 +1553,13 @@ const GroupStrip = memo(
|
|
|
1318
1553
|
onGroupGrab(node);
|
|
1319
1554
|
}
|
|
1320
1555
|
}, [floating, id, node, onGrab, onGroupGrab]);
|
|
1556
|
+
// Focus follows the pointer onto the group's open window.
|
|
1557
|
+
const hovered = useCallback(
|
|
1558
|
+
(at: Spot) => {
|
|
1559
|
+
onHover(id, at);
|
|
1560
|
+
},
|
|
1561
|
+
[id, onHover],
|
|
1562
|
+
);
|
|
1321
1563
|
const moved = useCallback(
|
|
1322
1564
|
(x: number, y: number) => {
|
|
1323
1565
|
onMove(id, x, y);
|
|
@@ -1328,7 +1570,14 @@ const GroupStrip = memo(
|
|
|
1328
1570
|
onNewTab(id);
|
|
1329
1571
|
}, [id, onNewTab]);
|
|
1330
1572
|
return (
|
|
1331
|
-
<Sliding
|
|
1573
|
+
<Sliding
|
|
1574
|
+
depth={depth}
|
|
1575
|
+
frame={frame}
|
|
1576
|
+
motion={motion}
|
|
1577
|
+
on={on}
|
|
1578
|
+
rewound={rewound}
|
|
1579
|
+
seen={seen}
|
|
1580
|
+
>
|
|
1332
1581
|
<TabStrip
|
|
1333
1582
|
box={strip.box}
|
|
1334
1583
|
depth={depth}
|
|
@@ -1347,6 +1596,7 @@ const GroupStrip = memo(
|
|
|
1347
1596
|
onFloat={floated}
|
|
1348
1597
|
onFullscreen={filled}
|
|
1349
1598
|
onGrab={grabbed}
|
|
1599
|
+
onHover={hovered}
|
|
1350
1600
|
onMove={moved}
|
|
1351
1601
|
onNewTab={tabbed}
|
|
1352
1602
|
onPull={onPull}
|
|
@@ -1406,23 +1656,13 @@ const tiledTargets = (placements: Screenful["placements"]): readonly Target[] =>
|
|
|
1406
1656
|
.map(({ frame, id }) => ({ frame, id }));
|
|
1407
1657
|
|
|
1408
1658
|
/**
|
|
1409
|
-
* Every
|
|
1410
|
-
*
|
|
1659
|
+
* Every tab, tiled or floating, hidden ones too, which a window or group can be
|
|
1660
|
+
* dropped beside. Excludes fullscreen screens, whose windows are hidden.
|
|
1411
1661
|
*/
|
|
1412
1662
|
const tabTargets = (screens: readonly StageScreen[]): readonly TabTarget[] =>
|
|
1413
|
-
shownPlacements(screens).flatMap(({ bar, depth, id, strip, tabbed }) =>
|
|
1414
|
-
strip !== undefined && tabbed !== undefined
|
|
1415
|
-
? [{ at: strip.at, depth, id, rect: bar, strip: strip.box, tabbed }]
|
|
1416
|
-
: [],
|
|
1417
|
-
);
|
|
1418
|
-
|
|
1419
|
-
/** The placements of screens with nothing fullscreen. */
|
|
1420
|
-
const shownPlacements = (
|
|
1421
|
-
screens: readonly StageScreen[],
|
|
1422
|
-
): readonly Placement[] =>
|
|
1423
1663
|
screens
|
|
1424
1664
|
.filter(({ fullscreen }) => fullscreen === undefined)
|
|
1425
|
-
.flatMap(({ screenful }) => screenful
|
|
1665
|
+
.flatMap(({ screenful }) => tabTargetsOf(screenful));
|
|
1426
1666
|
|
|
1427
1667
|
/**
|
|
1428
1668
|
* The screens with no tiled window to drop on, which a dropped window fills.
|
|
@@ -1473,8 +1713,9 @@ const windowNamed = (
|
|
|
1473
1713
|
};
|
|
1474
1714
|
|
|
1475
1715
|
/**
|
|
1476
|
-
* A window's icon URL: a client's from its desktop entry,
|
|
1477
|
-
* page icon
|
|
1716
|
+
* A window's icon URL: a client's from its desktop entry, an app window's
|
|
1717
|
+
* from its app's (an Electron app's, whose page icon isn't its own), else a
|
|
1718
|
+
* browser window's page icon.
|
|
1478
1719
|
*/
|
|
1479
1720
|
const iconOf = (
|
|
1480
1721
|
window: ShellWindow,
|
|
@@ -1482,7 +1723,8 @@ const iconOf = (
|
|
|
1482
1723
|
): string | undefined =>
|
|
1483
1724
|
window.kind === WindowKind.App
|
|
1484
1725
|
? clientIcons.get(window.desktopId)
|
|
1485
|
-
: window.
|
|
1726
|
+
: ((window.appId === "" ? undefined : clientIcons.get(window.appId)) ??
|
|
1727
|
+
window.icon);
|
|
1486
1728
|
|
|
1487
1729
|
/** A browser window's page description; a client's window has none. */
|
|
1488
1730
|
const descriptionOf = (window: ShellWindow): string | undefined =>
|
|
@@ -1500,3 +1742,36 @@ const engineWindowOf = (id: string): string => {
|
|
|
1500
1742
|
return engine;
|
|
1501
1743
|
}
|
|
1502
1744
|
};
|
|
1745
|
+
|
|
1746
|
+
/** A window to draw, and how the overview shows it, if open. */
|
|
1747
|
+
type SeenWindow = DrawnWindow & { seen: Seen | undefined };
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
* Window `drawn` as the overview shows it: a shown one through its screen's
|
|
1751
|
+
* tile, a hidden workspace's one laid out in its own tile.
|
|
1752
|
+
*/
|
|
1753
|
+
const seenIn = (
|
|
1754
|
+
drawn: DrawnWindow,
|
|
1755
|
+
overview: OverviewSight | undefined,
|
|
1756
|
+
): SeenWindow => {
|
|
1757
|
+
const hidden =
|
|
1758
|
+
drawn.placement === undefined
|
|
1759
|
+
? overview?.hidden.get(drawn.window.id)
|
|
1760
|
+
: undefined;
|
|
1761
|
+
if (hidden === undefined) {
|
|
1762
|
+
return {
|
|
1763
|
+
...drawn,
|
|
1764
|
+
seen:
|
|
1765
|
+
drawn.screen === undefined
|
|
1766
|
+
? undefined
|
|
1767
|
+
: overview?.shown.get(drawn.screen),
|
|
1768
|
+
};
|
|
1769
|
+
} else {
|
|
1770
|
+
return {
|
|
1771
|
+
...drawn,
|
|
1772
|
+
placement: hidden.placement,
|
|
1773
|
+
screen: hidden.screen,
|
|
1774
|
+
seen: hidden.seen,
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
};
|