react-x11 2.16.1 → 2.17.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/README.md +38 -23
- package/package.json +3 -1
- package/src/Reconciler.js +82 -23
- package/src/a11y.js +18 -1
- package/src/appcontext.js +8 -0
- package/src/appearance.js +36 -0
- package/src/{cocoa → backend}/context2d.js +27 -7
- package/src/capabilities.js +99 -1
- package/src/cocoa/app.js +17 -9
- package/src/cocoa/fonts.js +1 -1
- package/src/cocoa/glarea.js +48 -10
- package/src/cocoa/overlay.js +2 -2
- package/src/cocoa/panewindow.js +2 -2
- package/src/cocoa/presenter.js +2 -2
- package/src/cocoa/surface.js +3 -3
- package/src/cocoa/window.js +23 -2
- package/src/events.js +21 -0
- package/src/foreignnodes.js +8 -3
- package/src/frame/index.js +30 -4
- package/src/glnodes.js +21 -7
- package/src/idle.js +59 -1
- package/src/index.d.ts +41 -0
- package/src/index.js +30 -3
- package/src/launcher.js +17 -8
- package/src/launcherhooks.js +24 -10
- package/src/node.d.ts +1 -1
- package/src/nodes/cascade.js +9 -0
- package/src/nodes/node.js +6 -1
- package/src/nodes/window/hints.js +21 -2
- package/src/nodes/window/window.js +2 -2
- package/src/notifications.js +39 -14
- package/src/taskbarhooks.js +164 -0
- package/src/transfer.js +20 -1
- package/src/trayhooks.js +1 -1
- package/src/types/capabilities.d.ts +32 -3
- package/src/types/elements.d.ts +23 -1
- package/src/types/events.d.ts +16 -0
- package/src/types/launcher.d.ts +20 -6
- package/src/types/taskbar.d.ts +79 -0
- package/src/wayland/context2d.js +1 -1
- package/src/win32/a11y.js +604 -0
- package/src/win32/app.js +768 -0
- package/src/win32/bezels.js +158 -0
- package/src/win32/dnd.js +283 -0
- package/src/win32/fonts.js +497 -0
- package/src/win32/glarea.js +548 -0
- package/src/win32/ime.js +267 -0
- package/src/win32/keymap.js +116 -0
- package/src/win32/native.js +54 -0
- package/src/win32/panehost.js +106 -0
- package/src/win32/panewindow.js +343 -0
- package/src/win32/shell.js +426 -0
- package/src/win32/surface.js +192 -0
- package/src/win32/window.js +659 -0
- package/src/windowid.js +66 -0
package/src/types/elements.d.ts
CHANGED
|
@@ -371,7 +371,29 @@ export interface WindowProps
|
|
|
371
371
|
y?: number;
|
|
372
372
|
/** Palette that `$token` style values resolve against, for this subtree. */
|
|
373
373
|
theme?: Record<string, string | number>;
|
|
374
|
-
/**
|
|
374
|
+
/**
|
|
375
|
+
* The desktop identity of this window — which application it belongs to,
|
|
376
|
+
* and so which launcher icon it groups under and which `.desktop` entry a
|
|
377
|
+
* launcher matches it to.
|
|
378
|
+
*
|
|
379
|
+
* One name for what every desktop calls something else: ICCCM `WM_CLASS` on
|
|
380
|
+
* X11, `xdg_toplevel.set_app_id` on Wayland, the AppUserModelID on Windows.
|
|
381
|
+
* Normally the same string as `registerApplication({ appId })`, which is
|
|
382
|
+
* what a launcher matches against.
|
|
383
|
+
*
|
|
384
|
+
* A string is the modern single-id form. X11's instance/class pair is still
|
|
385
|
+
* accepted and passed through on that backend; every other backend takes
|
|
386
|
+
* the class, which is the part naming the application.
|
|
387
|
+
*
|
|
388
|
+
* Honoured on X11, on Windows — where it is the window's AppUserModelID,
|
|
389
|
+
* and where the jump list is attached to the same id — and, for windows
|
|
390
|
+
* opened after it is set, on Wayland, whose `app_id` is fixed when the
|
|
391
|
+
* surface is created. The cocoa backend accepts it and does nothing with
|
|
392
|
+
* it: macOS identity is the bundle's, decided at build time.
|
|
393
|
+
*/
|
|
394
|
+
appId?: string | [string, string] | { instance: string; class?: string };
|
|
395
|
+
/** @deprecated Renamed to {@link WindowProps.appId} — `wmClass` is X11's
|
|
396
|
+
* word for an identity every desktop has. Still accepted. */
|
|
375
397
|
wmClass?: string | [string, string] | { instance: string; class?: string };
|
|
376
398
|
/** EWMH `_NET_WM_WINDOW_TYPE`, or a list of fallbacks. */
|
|
377
399
|
windowType?: WindowType | WindowType[];
|
package/src/types/events.d.ts
CHANGED
|
@@ -39,6 +39,22 @@ export interface SyntheticEvent<T = DrawnNode> {
|
|
|
39
39
|
* what a node's `abs` is in (docs/scale.md). */
|
|
40
40
|
x: number;
|
|
41
41
|
y: number;
|
|
42
|
+
/**
|
|
43
|
+
* Where the pointer is on the **virtual screen**, in the same logical
|
|
44
|
+
* pixels `x`/`y` are in — what to reach for when placing something outside
|
|
45
|
+
* the window, such as a context menu at the pointer.
|
|
46
|
+
*
|
|
47
|
+
* Present exactly where the backend reported a position. That is most
|
|
48
|
+
* events, including keys on X11, whose KeyPress carries where the pointer
|
|
49
|
+
* was; it is undefined rather than `0` where a backend reported none, since
|
|
50
|
+
* zero is the screen's top-left corner and not an absence.
|
|
51
|
+
*
|
|
52
|
+
* `nativeEvent.rootx`/`rooty` is X11's name for the same point and is still
|
|
53
|
+
* there, in *device* pixels — the same split as `x` against
|
|
54
|
+
* `nativeEvent.x`.
|
|
55
|
+
*/
|
|
56
|
+
screenX?: number;
|
|
57
|
+
screenY?: number;
|
|
42
58
|
/** Coordinates relative to `target`'s box. */
|
|
43
59
|
localX: number;
|
|
44
60
|
localY: number;
|
package/src/types/launcher.d.ts
CHANGED
|
@@ -35,17 +35,23 @@ export declare function setBadge(
|
|
|
35
35
|
export declare function useBadge(value: BadgeValue): void;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* The menu behind a right-click on the app's icon
|
|
39
|
-
* from the same item vocabulary `MenuBar`
|
|
40
|
-
* when picked. Installed while mounted,
|
|
41
|
-
* down on unmount.
|
|
38
|
+
* The menu behind a right-click on the app's **launcher icon** — the Dock on
|
|
39
|
+
* macOS, the launcher on Linux — from the same item vocabulary `MenuBar`
|
|
40
|
+
* takes; an item's `onSelect` fires when picked. Installed while mounted,
|
|
41
|
+
* replaced when `items` changes, taken down on unmount.
|
|
42
42
|
*
|
|
43
43
|
* `NSDockTile`'s menu on the cocoa backend; the launcher protocol's
|
|
44
44
|
* **quicklist** on Linux — a `com.canonical.dbusmenu` tree, the same menu
|
|
45
45
|
* protocol the tray and the global menu speak. Needs the identity
|
|
46
46
|
* `registerApplication({ appId })` establishes and a `.desktop` file of that
|
|
47
47
|
* name, like the badge.
|
|
48
|
+
*
|
|
49
|
+
* Reads `useDesktopCapability('launcher').features.menu`.
|
|
48
50
|
*/
|
|
51
|
+
export declare function useLauncherMenu(items: MenuItem[] | null): void;
|
|
52
|
+
|
|
53
|
+
/** @deprecated Renamed to {@link useLauncherMenu} — "Dock" is one desktop's
|
|
54
|
+
* word for the icon every desktop has. Still exported and still works. */
|
|
49
55
|
export declare function useDockMenu(items: MenuItem[] | null): void;
|
|
50
56
|
|
|
51
57
|
/**
|
|
@@ -80,9 +86,17 @@ export declare function setUrgent(
|
|
|
80
86
|
): Promise<boolean>;
|
|
81
87
|
|
|
82
88
|
/**
|
|
83
|
-
* {@link
|
|
84
|
-
* takes the menu down.
|
|
89
|
+
* {@link useLauncherMenu}'s imperative twin, for code with no component.
|
|
90
|
+
* `null` takes the menu down.
|
|
85
91
|
*/
|
|
92
|
+
export declare function setLauncherMenu(
|
|
93
|
+
items: MenuItem[] | null,
|
|
94
|
+
options?: SetBadgeOptions,
|
|
95
|
+
): Promise<boolean>;
|
|
96
|
+
|
|
97
|
+
/** @deprecated Renamed to {@link setLauncherMenu} — "quicklist" is the Unity
|
|
98
|
+
* launcher's word for the menu macOS calls the Dock menu, and this drove
|
|
99
|
+
* both all along. Still exported and still works. */
|
|
86
100
|
export declare function setQuicklist(
|
|
87
101
|
items: MenuItem[] | null,
|
|
88
102
|
options?: SetBadgeOptions,
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Windows taskbar's own surfaces. See docs/windows-integrations.md.
|
|
3
|
+
*
|
|
4
|
+
* Three things the taskbar has that no other desktop does, so none of them is
|
|
5
|
+
* a rung on an existing ladder. They are reported as features of the
|
|
6
|
+
* **launcher** — `useDesktopCapability('launcher').features.thumbnailToolbar`
|
|
7
|
+
* and its two siblings — because all of them hang off the one icon the
|
|
8
|
+
* desktop shows for this app, beside the badge and the progress bar. The
|
|
9
|
+
* hooks do nothing where the backend has none, so they are safe to call
|
|
10
|
+
* unconditionally and an app needs no platform check.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* An icon for a toolbar button: raw RGBA with its size, an ntk `Image`, or a
|
|
15
|
+
* path to a file. The shell tints it for the theme, so the shape is the whole
|
|
16
|
+
* of it and a white glyph on transparent is the usual choice.
|
|
17
|
+
*/
|
|
18
|
+
export type TaskbarIcon =
|
|
19
|
+
| string
|
|
20
|
+
| { data: Uint8Array; width: number; height: number }
|
|
21
|
+
| { width: number; height: number };
|
|
22
|
+
|
|
23
|
+
export interface ThumbnailToolbarButton {
|
|
24
|
+
/** What a click is reported as. Not the shell's index. */
|
|
25
|
+
id: string;
|
|
26
|
+
/** The hover tooltip; `label` is accepted as a synonym. */
|
|
27
|
+
tooltip?: string;
|
|
28
|
+
label?: string;
|
|
29
|
+
icon?: TaskbarIcon | null;
|
|
30
|
+
/** Default true. A disabled button is shown greyed rather than hidden. */
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
/** Close the hover preview when this one is clicked. */
|
|
33
|
+
dismissOnClick?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Up to seven buttons under this window's taskbar hover preview — where a
|
|
38
|
+
* media player puts play and skip. `null` hides them, which is as far down as
|
|
39
|
+
* the shell allows: a window that has had a toolbar keeps one.
|
|
40
|
+
*
|
|
41
|
+
* The eighth button and beyond are dropped rather than refused, because the
|
|
42
|
+
* shell refuses the whole call for an eighth.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useThumbnailToolbar(
|
|
45
|
+
buttons: readonly ThumbnailToolbarButton[] | null | undefined,
|
|
46
|
+
onClick?: (id: string, event: unknown) => void,
|
|
47
|
+
): void;
|
|
48
|
+
|
|
49
|
+
export interface JumpListTask {
|
|
50
|
+
title: string;
|
|
51
|
+
/** Passed to a **new** process; nothing calls back into this one. */
|
|
52
|
+
arguments?: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The Tasks category of this application's jump list — the menu on a right
|
|
58
|
+
* click of its taskbar button. `null` deletes the category.
|
|
59
|
+
*
|
|
60
|
+
* Each entry **relaunches this executable** with the arguments given, which
|
|
61
|
+
* is what a jump-list task is. That is why this is not `useLauncherMenu`, whose
|
|
62
|
+
* items carry a callback: reported as `features.tasks` rather than
|
|
63
|
+
* `features.menu`, so an app cannot mistake one for the other.
|
|
64
|
+
*/
|
|
65
|
+
export declare function useJumpList(
|
|
66
|
+
tasks: readonly JumpListTask[] | null | undefined,
|
|
67
|
+
): void;
|
|
68
|
+
|
|
69
|
+
/** Notes `path` for the shell's Recent lists whenever it changes. */
|
|
70
|
+
export declare function useRecentDocument(path?: string | null): void;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The imperative form of {@link useRecentDocument}. Returns false where the
|
|
74
|
+
* backend has no Recent list, rather than throwing.
|
|
75
|
+
*/
|
|
76
|
+
export declare function noteRecentDocument(
|
|
77
|
+
path: string | null,
|
|
78
|
+
options?: { app?: unknown },
|
|
79
|
+
): boolean;
|
package/src/wayland/context2d.js
CHANGED
|
@@ -206,7 +206,7 @@ function scaleOf(m) {
|
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
208
|
* The Render ops a `drawGlyphs` call can name, numbered as XRender numbers
|
|
209
|
-
* them — the same table the
|
|
209
|
+
* them — the same table the native backends answer (`src/backend/context2d.js`),
|
|
210
210
|
* so `ctx.Render.PictOp.Over` reads the same on every backend. The op is
|
|
211
211
|
* ignored here: text composites Over, and for the opaque inks text uses Src
|
|
212
212
|
* and Over agree.
|