Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4e8b695
Add window services with persisted placement, menus and a page-facing…
ambroise-leclerc Dec 6, 2026
f75115f
Add window control under WebView2 and WKWebView: placement, state, me…
ambroise-leclerc Dec 6, 2026
7bd8015
Add window control under CEF: placement, state, context menu and pers…
ambroise-leclerc Dec 6, 2026
faabb23
Add the window service to @webfront/services (#764)
ambroise-leclerc Dec 6, 2026
3eb6f8a
Test shortcuts, menus, kept placements and the window control default…
ambroise-leclerc Dec 6, 2026
7085a19
Document window control, persistence and the window service (#764)
ambroise-leclerc Dec 6, 2026
c494c09
Fix the source header of the window control tests
ambroise-leclerc Dec 6, 2026
9294bb9
Test the window limits under Wayland with a headless weston (#764)
ambroise-leclerc Dec 6, 2026
f9d13bd
Count the window cases in the frontend selection tests and keep the W…
ambroise-leclerc Dec 6, 2026
4591087
Merge branch '763-hmr' into 764-window-services
ambroise-leclerc Dec 6, 2026
3b22e57
Disable everything under a disabled submenu and free menu handlers wi…
ambroise-leclerc Dec 6, 2026
a1f9757
Number context menu requests across the window service instances of a…
ambroise-leclerc Dec 6, 2026
717242f
Fix the MSVC analysis warnings of the window placement code (#764)
ambroise-leclerc Dec 6, 2026
655f94e
Give the window menu scenario a display of its own and end it cleanly…
ambroise-leclerc Dec 6, 2026
4691c5a
Merge branch '763-hmr' into 764-window-services
ambroise-leclerc Dec 6, 2026
356a1db
Report a minimized window under WebKitGTK and keep the maximized stat…
ambroise-leclerc Dec 6, 2026
d68dd37
Keep the right menu handlers when overlapping updates are refused, an…
ambroise-leclerc Dec 6, 2026
7543fb8
Have the server hold the window-menu scenario's root selection before…
ambroise-leclerc Dec 6, 2026
61f101b
Keep the normal position of a WebKitGTK window that closes maximized …
ambroise-leclerc Dec 6, 2026
f3f8cb9
Do not send a context menu request after the window service is dispos…
ambroise-leclerc Dec 6, 2026
6fdb343
Reject every window service call made after dispose()
ambroise-leclerc Dec 6, 2026
bff2842
Check the reachability of a saved position against the real monitors …
ambroise-leclerc Dec 6, 2026
d48a04d
Detach the CEF window control from its delegate when openWindow is le…
ambroise-leclerc Dec 6, 2026
2bbf258
Sample the WebKitGTK normal position every 100 ms and report CEF posi…
ambroise-leclerc Dec 6, 2026
fadaf8f
Keep the old menu and tray when their replacement is refused (WebView…
ambroise-leclerc Dec 6, 2026
26d2546
Route a menu selection to the generation of the menu that produced it
ambroise-leclerc Dec 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/docker/linux-ci.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Toolchain of the Linux desktop CI job (GCC 16, WebKitGTK, lcov, Xvfb), prebuilt so that a job downloads one image from
# Toolchain of the Linux desktop CI job (GCC 16, WebKitGTK, lcov, Xvfb, weston), prebuilt so that a job downloads one image from
# ghcr.io instead of dozens of packages from an Ubuntu mirror. BuildAndTest.yml tags it with the hash of this file:
# changing the file (for example to refresh the packages) is what rebuilds it. CMake is not part of it: the
# setup-cmake action installs an exact, checksummed release.
FROM ubuntu:26.04@sha256:c098726dd9b9733f3e885f8de0ef375206a311b0a317eadc40d347b1115fb944

LABEL org.opencontainers.image.source="https://github.com/ambroise-leclerc/WebFront"
LABEL org.opencontainers.image.description="WebFront CI: GCC 16, WebKitGTK 6, OpenSSL, lcov and Xvfb on Ubuntu 26.04"
LABEL org.opencontainers.image.description="WebFront CI: GCC 16, WebKitGTK 6, OpenSSL, lcov, Xvfb and weston on Ubuntu 26.04"

ENV DEBIAN_FRONTEND=noninteractive

# sudo: the composite actions of the repository call it, as they do on a hosted runner. build-essential: the CTest
# fixtures configure sub-projects with CMake's default generator and compiler, which a hosted runner also provides.
# weston: the headless Wayland compositor of the WebKitGTKWayland-* tests.
# libssl-dev: the signature verification of the updater tests (OpenSSL libcrypto).
# file: CPackDeb needs it to list the dependencies of the package ApplicationPackageConfiguration builds.
# libjson-xs-perl: a recommendation of lcov, which falls back to a pure-Perl parser about eight times slower without it.
Expand All @@ -19,7 +20,7 @@ RUN apt-get update \
ca-certificates curl git sudo tar xz-utils build-essential \
ninja-build pkg-config python3 \
gcc-16 g++-16 libwebkitgtk-6.0-dev libssl-dev lcov libjson-xs-perl \
xvfb xauth time file \
xvfb xauth weston time file \
&& rm -rf /var/lib/apt/lists/*

# The workspace is mounted from the host runner and owned by another user: let git (and the tests that call it) read it.
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati
- `examples/`: the default build includes Hello World (`hello-world/`), the host loop (`host-loop/`: an application that keeps its own loop, `app.start()` or a host thread beside a native window; it ray-traces a Boing Ball on the CPU or with an optional CUDA unit, see `docs/HOST_LOOP_EXAMPLE.md`) and Game of Life (`life/`, with console, developer and embedded stages, plus the `life/react/` variant with a C++ panel inside React). The standalone [PTY example](docs/PTY.md) has its own CMake entry point.
- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), the wf scripts that build it (`scripts/`), build and publication tools. The repository is itself a `wf` project (`js/developer/webfront.project.json` and its lock, selected with `--manifest-dir js/developer`): the environment builds itself, and its pure JavaScript specs (`test/developer/`) run with `wf test`. Production C++ remains header-only in `include/webfront/`.
- `js/developer/starters/`: the sources of the `app` and `store` starters (`store` receives copies of `js/store/` when the environment is built) and `agent-guide.md`, the `AGENTS.md` that `wf create` puts beside a starter and that `webfront_write_agent_guide()` (`cmake/WebFrontAgentGuide.cmake`) writes in a consuming project.
- `js/services/`: optional `@webfront/services` package, the browser side of the system services (ADR-020; a skeleton so far), built like `@webfront/react` by `wf run services-package`; outside the core's embedded resource list.
- `js/services/`: optional `@webfront/services` package, the browser side of the system services (ADR-020; the window service so far, its C++ side in `include/webfront/services/window/`), built like `@webfront/react` by `wf run services-package`; outside the core's embedded resource list.
- `js/pty/`: optional `@webfront/pty` adapter for native pseudoterminals. `wf run pty-package` assembles the archive used by the browser tests. See `docs/PTY.md`.
- `js/store/`: optional `@webfront/store` package, the browser side of `webfront::store::Store` for any UI library (`docs/STORE.md`), built by `wf run store-package`.
- `js/react/`: optional `@webfront/react` package (`createStore`, `useStore`, `Island`), declarations and package-local license. `wf run react-package` assembles it; tests verify the exact archive installed by the registry. It is outside the core's embedded resource list.
Expand Down
1 change: 1 addition & 0 deletions cmake/Frontends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ function(webfront_add_browser_tests target frontend assets_directory lifecycle_t
endif()
set(lifecycle_modes no-bridge early-close rejected-ready navigation-failure path-encoding content-policy navigation-allow-list view-association stage-report)
list(APPEND lifecycle_modes ui-executor native-window second-open host-close second-window)
list(APPEND lifecycle_modes window-services window-persistence)
# A closed secondary window disconnects at once, window after window: WKWebView's page outlived its window (#702),
# and WebView2's page its controller (#708).
if(frontend MATCHES "^(WKWebView|WebView2)$")
Expand Down
2 changes: 1 addition & 1 deletion cmake/WebKitGTKSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function(webfront_add_webkitgtk_tests)
target_link_libraries(webkitgtk_lifecycle PRIVATE WebFront_test_hardening WebFront WebFront_warnings WebFront_options)
add_dependencies(webtest webkitgtk_lifecycle)
webfront_find_xvfb(display_runner)
foreach(mode sandbox-environment sandbox-recheck no-display worker-thread native-close repeated-show http-error pre-run-failure poll-failure profile-permissions window-title download download-user-dir choose-file cancel-choose close-with-dialog script-dialogs close-with-script-dialog first-frame present-timeout media-scoped)
foreach(mode sandbox-environment sandbox-recheck no-display worker-thread native-close repeated-show http-error pre-run-failure poll-failure profile-permissions window-title window-menu window-normal-position download download-user-dir choose-file cancel-choose close-with-dialog script-dialogs close-with-script-dialog first-frame present-timeout media-scoped)
if(mode MATCHES "^(no-display|worker-thread|pre-run-failure|profile-permissions)$")
add_test(NAME WebKitGTKAdapter-${mode} COMMAND webkitgtk_lifecycle ${mode})
elseif(display_runner)
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ these entries stays in the GitHub releases and the Git history.
- A type that converts to `std::string_view` without being a string is no longer written as text by `info()`, `fail()` and `checkEqual` (it appears as `{?}` without a `Printer`): specialize `webfront::bdd::isString` (or `Printer`) for it (#739, `docs/BDD.md`).

### Added
- Window control under every embedded frontend (`app.windowControl()`): position, size, states, application and context menus with shortcuts, and a notification icon, with `unsupported` where the toolkit cannot; `WindowOptions::rememberAs` reopens a window where it was (#764, `docs/FRONTENDS.md`).
- Optional window service for the page (`webfront::services::Window`, `windowService()` of `@webfront/services`), answering the embedded view only (#764, ADR-020).
- A unit that only registers C++ functions or calls JavaScript can include the light `webfront/Bridge.hpp` and compiles in about a third of the time: pass it `webfront::bridgeFunctions(app)` or `webfront::bridgeUI(ui)` (#766, ADR-029).
- Bundle npm packages that use `#` subpath imports (the `imports` of their `package.json`, naming their own files or a dependency), such as Svelte 5, once an environment with it is published (#767).
- Start an interface without a UI library on a C++ state store with `wf create store`, once an environment with it is published (#767, `docs/STORE.md`).
Expand Down
58 changes: 54 additions & 4 deletions docs/FRONTENDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ on a command line or in a URL.

## Window title and size

`maximized`, `fullscreen`, `frameless`, `minimumWidth` and `minimumHeight` set the initial state, decoration and
smallest size of the window. **Only WebKitGTK and CEF apply them**; WebView2 and WKWebView ignore them, and a window
manager or compositor may not honour them. A frameless window has no close button: the page offers one. Persisted
geometry, menus and tray icons are not provided; use the [native window](#native-window).
`maximized`, `fullscreen`, `frameless`, `alwaysOnTop`, `minimumWidth` and `minimumHeight` set the initial state,
decoration and smallest size of the window. Every embedded frontend applies them; a window manager or compositor may not
honour them, and always-on-top is not available under Wayland. A frameless window has no close button: the page offers
one (under WKWebView the title bar becomes transparent and its buttons are hidden). The system browser ignores all of
this.

`WebFrontConfig::window` (`webfront::WindowOptions`: `title`, `width`, `height`) sets the initial window of the
embedded frontends (WebKitGTK, CEF, WebView2, WKWebView); the system browser ignores it. An empty title selects the
Expand All @@ -81,6 +82,55 @@ frontend shows its window when the first document has loaded or after one second
and WebView2 at their first frame), so that the window does not appear blank; CEF applies the colour to the browser
and to its window, as an opaque colour whatever non-zero alpha is given (CEF accepts only 0x00 or 0xFF; `#rrggbb00` leaves its default), and `media` concerns WebKitGTK only.

## Window control, persistence and menus

`WindowOptions::rememberAs` names the window: when it closes, an embedded frontend writes its position, size, maximized
and full screen state to `<name>.window.json`, and the next window of that name opens there. The folder is
`$XDG_STATE_HOME/webfront` (or `~/.local/state/webfront`), `~/Library/Application Support/webfront` or
`%LOCALAPPDATA%\webfront`; `stateDirectory` replaces it. A position on a screen that is gone is not applied. Only the
application's first window is remembered.

`app.windowControl()` gives C++ the window of the embedded view, on its [interface thread](#interface-thread-executor):
`placement`, `move`, `resize`, `setMaximized`, `setFullscreen`, `minimize`, `setAlwaysOnTop`, `setMinimumSize`, the
application menu (`setMenu`, with shortcuts such as `CmdOrCtrl+S`), a context menu (`showContextMenu`), a notification
icon (`setTray`) and `features()`, which tells beforehand what answers `unsupported`. Secondary windows are not
controlled.

The page reaches the same operations when the application constructs the optional service before `show()`:

```cpp
#include <webfront/services/window/WindowService.hpp>

webfront::services::Window<decltype(app)> windowService(app);
```

The page side is `windowService()` of `@webfront/services`. Only the connection of the embedded view is served: any other
one is rejected with `window.notEmbedded` ([ADR-020](adr/ADR-020-services-systeme.md)). Every script the view admits can
use the service.

| | WebKitGTK | WKWebView | WebView2 | CEF |
|---|---|---|---|---|
| position, always on top | X11 only; `unsupported` under Wayland | yes | yes | not under Wayland |
| size, maximize, full screen, minimize, minimum size | yes | yes | yes | yes |
| application menu and shortcuts | menu bar in the window | the macOS menu bar | menu bar; shortcuts while the page has the keyboard | `unsupported` |
| context menu | yes | yes | yes | yes |
| notification icon | `unsupported` (GTK 4 has none) | status item | notification area | `unsupported` |
| `activate("context", id)` (automation) | yes | `unsupported` | `unsupported` | yes |

Under Wayland the system neither tells nor accepts where a window is: a placement has no position, and a remembered
window reopens with its size and state only (tested with a headless weston where it is installed,
`WebKitGTKWayland-*`). Nor does Wayland
tell a window that it is minimized: WebKitGTK reports `minimized` under X11 only. Positions and sizes are in the units of the toolkit (pixels of the outer window on Windows,
points of the frame on macOS) and are meant to be given back on the same machine.

On Linux, maximizing, full screen and minimizing depend on a window manager; the automated tests, which run without one,
do not verify their effect.

GTK 4 reports no window move, so WebKitGTK samples the position every 100 ms to know where a window was before the window
manager maximized or full-screened it; a sample counts once the next one agrees. A window moved and then maximized within
about 200 ms of that move therefore reopens at its previous normal position, never at a wrong one. CEF reports the
position as unsupported in a Wayland session (`XDG_SESSION_TYPE=wayland`), even though an X server may be reachable.

## Content policy

The [shared content policy](CONTENT_POLICY.md) defines bridge-origin authorization, embedded navigation, popup handling, DevTools and context-menu settings, including defaults and opt-outs. The system browser cannot expose embedded navigation/UI hooks; its bridge is protected by the same server check.
Expand Down
1 change: 1 addition & 0 deletions docs/adr/ADR-007-frontends-explicites.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
| 1.12 | 2026-11-13 | Acceptée | Ambroise Leclerc | Intégration dans une application hôte : contrats facultatifs `launch()`, `requestClose()` et `requiresMainThread` ; `BasicWF::start()`, `BasicWF::requestClose()` et `webfront::UIThread` (#567). | Branche `567-host-integration` |
| 1.13 | 2026-11-16 | Proposée | Ambroise Leclerc | Modes WebKitGTK développement par défaut et distribution exigeant le sandbox ; profil par exécutable généré pour le paquet applicatif, sans runtime (#596/#597). | Branche `596-jetson-native-launch` |
| 1.14 | 2026-12-05 | Proposée | Ambroise Leclerc | État initial, décoration et taille minimale de la fenêtre dans `WindowOptions`, appliqués par WebKitGTK et CEF seulement ; géométrie persistée, menus et zone de notification restent à faire (#764). | Branche `764-window-options` |
| 1.15 | 2026-12-06 | Proposée | Ambroise Leclerc | Contrat facultatif `static WindowControlRef windowControl()` : la fenêtre d'un frontend intégré, contrôlée sur son thread d'interface, publiée pendant `open()`. Les options d'état de la version 1.14 sont appliquées par les quatre moteurs ; `alwaysOnTop`, `rememberAs` (géométrie persistée de la première fenêtre) et `stateDirectory` s'y ajoutent. Les limites par moteur sont dans `docs/FRONTENDS.md` ; les fenêtres secondaires ne sont ni mémorisées ni contrôlées (#764). | Branche `764-window-services` |

## État et chronologie

Expand Down
1 change: 1 addition & 0 deletions docs/adr/ADR-020-services-systeme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| 1.8 | 2026-11-09 | Proposée, partiellement livrée | Ambroise Leclerc | Livraison de #461 (étape 4) : paquet `@webfront/services` (squelette : module de services vide et fonction de test), archive déterministe, registre de test et suite ; l'étape 4 est achevée. | [PR #503](https://github.com/ambroise-leclerc/WebFront/pull/503), [6eb8293](https://github.com/ambroise-leclerc/WebFront/commit/6eb82937896114ad98b72fd5ad0f38b4e18dbe73) |
| 1.9 | 2026-11-09 | Proposée, partiellement livrée | Ambroise Leclerc | Livraison de #462 (étape 5) : exécuteur du thread d'interface (`frontend::UIExecutor`, sender `schedule()` : valeur sur le thread d'interface, arrêté si le jeton part ou si la boucle se ferme, erreur `UIExecutorUnavailable` sans boucle) publié par WKWebView, WebView2, WebKitGTK et CEF, et par `BrowserWithUILoopFrontend`, le navigateur système avec boucle minimale facultative (pompe de messages sur fenêtre de messages, run loop AppKit avec `NSApplication` en politique Accessory, boucle GLib), qui s'arrête par `requestStop()`. **Décision Linux** : le portail XDG passera par GDBus, c'est-à-dire `libgio-2.0` chargée à l'exécution comme GLib et WebKitGTK le sont déjà (aucune dépendance de construction, aucune bibliothèque D-Bus dédiée) ; sans GIO, le backend natif est indisponible. #463 est livré dans la version 1.10. | Branche `462-ui-thread-executor` |
| 1.10 | 2026-11-09 | Proposée, partiellement livrée | Ambroise Leclerc | Livraison de #463 (étape 5, achevée) : accès typé à la fenêtre native (`frontend::NativeWindow`, `NativeWindowHost`) publié par WKWebView (`NSWindow*`), WebView2 (`HWND`), WebKitGTK (`GtkWindow*`) et CEF (`CefBrowser*`) ; `get()` ne répond que sur le thread d'interface (#462) et pendant la session (`notOpen`, `closed`, `wrongThread`, `unsupported`). `UI::nativeWindow()` ajoute la correspondance avec la connexion par l'association de #453 : toute connexion qui n'est pas la vue du frontend reçoit `notEmbedded`, donc le navigateur système reste sans parent. Identifiant de portail sous WebKitGTK : `x11:<XID>` lu à l'ouverture, `wayland:<handle>` exporté par `gdk_wayland_toplevel_export_handle` une fois la fenêtre prête (nouvelles tentatives pendant 5 s) ; vide tant qu'il est inconnu. Écart : la fenêtre reste publiée jusqu'à la fin de la boucle, y compris quand l'utilisateur vient de la fermer. La vérification manuelle d'un dialogue parenté sous chaque plateforme (`docs/FRONTENDS.md`) reste à exécuter avec le premier backend natif. | Branche `463-native-window-access` |
| 1.11 | 2026-12-06 | Proposée, partiellement livrée | Ambroise Leclerc | Premier service livré (#764) : **fenêtre** (`include/webfront/services/window/`, fonctions `webfront.services.window.*`, `windowService()` de `@webfront/services`), natif seulement et réservé à la vue du frontend intégré (`window.notEmbedded` sinon). Position, taille, états, premier plan, taille minimale, menus d'application et contextuels avec raccourcis, icône de notification ; `window.unsupported` là où la boîte à outils ne peut pas (position et premier plan sous Wayland, icône sous GTK 4 et CEF, barre de menus sous CEF). La page ne désigne aucun fichier : l'icône d'une barre système vient de C++ seulement. La persistance de la géométrie (`WindowOptions::rememberAs`) relève de l'ADR-007 1.15. Raccourcis globaux non livrés. | Branche `764-window-services` |

## État et chronologie

Expand Down
Loading
Loading