Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
91c836f
Feat: Open the toolkit-free AppKit window by default on macOS (NFR-14)
b-re-w Oct 4, 2026
6939926
Fix: Carry on when the process manager refuses the foreground request…
b-re-w Oct 4, 2026
8c8d5f8
Feat: Wire the window's clipboard and take the icon as pixels (NFR-14)
b-re-w Oct 4, 2026
2375b05
Fix: Send the first text edit to the Host at once instead of after a …
b-re-w Oct 4, 2026
4183ef2
Fix: Draw inside a live resize of the AppKit window so the picture is…
b-re-w Oct 4, 2026
4a2eddc
Chore: Restage the Android Kotlin after the renderer changed
b-re-w Oct 4, 2026
92e1fad
Merge remote-tracking branch 'origin/develop' into feat/appkit-window…
b-re-w Oct 4, 2026
b45d766
Fix: Send one TextChanged a frame, with the latest text, instead of a…
b-re-w Oct 4, 2026
e2cb949
Merge remote-tracking branch 'origin/develop' into feat/appkit-window…
b-re-w Oct 4, 2026
65ad014
Chore: Keep a GraalVM renderer test workflow until the window code mo…
b-re-w Oct 4, 2026
ec7d36a
Docs: List the GraalVM renderer test workflow in the CI section
b-re-w Oct 4, 2026
0a4ce6e
Fix: Send TextChanged from inside the frame callback (FR-5)
b-re-w Oct 4, 2026
82c4ce7
Merge remote-tracking branch 'origin/feat/graalvm-renderer-test' into…
b-re-w Oct 4, 2026
df68608
Feat: Bring the Kotlin/Native macOS window to parity and add the text…
b-re-w Oct 4, 2026
7f50cc4
Refactor: Put the macOS window decisions in one shared source (FR-5, …
b-re-w Oct 4, 2026
8ab8844
Fix: Link the text menu model into the Linux renderer, which compiles…
b-re-w Oct 4, 2026
20af89f
Fix: Link the shared window parity source into the Linux renderer
b-re-w Oct 4, 2026
8bfdc1c
Fix: Observe the system theme notification instead of key-value obser…
b-re-w Oct 4, 2026
11b861b
Fix: Import the key-value coding accessor the appearance read uses
b-re-w Oct 4, 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
199 changes: 199 additions & 0 deletions .github/workflows/test-graalvm-renderer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# GraalVM renderer test: builds the GraalVM native-image renderer and smoke tests it.
#
# Kotlin/Native is the default renderer now, and the macOS and Linux native-image jobs were
# removed from test-native-renderer.yml with it. The GraalVM window code
# (renderer/desktop/c/appkit_window.m, x11_window.c and the shared C and Kotlin files that
# path uses) still lives in this repository, so this workflow keeps building and starting it.
#
# This file exists until the window code moves to the Compose fork. It then moves to the
# fork's CI and is deleted here. The Windows native-image job stays in
# test-native-renderer.yml and is not repeated here.

name: GraalVM renderer test

on:
pull_request:
paths:
- 'renderer/desktop/**'
- 'renderer/libs.versions.toml'
- 'renderer/kotlin'
- 'renderer/**/module.yaml'
- 'scripts/install-nik.sh'
- 'scripts/tests/renderer/**'
- '.github/workflows/test-graalvm-renderer.yml'
push:
branches: [develop]
paths:
- 'renderer/desktop/**'
- 'renderer/libs.versions.toml'
- 'renderer/kotlin'
- 'renderer/**/module.yaml'
- 'scripts/install-nik.sh'
- 'scripts/tests/renderer/**'
- '.github/workflows/test-graalvm-renderer.yml'
workflow_dispatch:

concurrency:
group: test-graalvm-renderer-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

jobs:
macos:
name: Build and smoke test the GraalVM renderer (macOS, arm64)
runs-on: macos-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v4

- name: Cache Liberica NIK
uses: actions/cache@v4
with:
path: ~/.cache/compose-rust/nik
key: nik-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/install-nik.sh') }}

- name: Install Liberica NIK 25 Full
run: ./scripts/install-nik.sh --github-env

- name: Cache the Kotlin toolchain and Maven dependencies
uses: actions/cache@v4
with:
path: |
~/Library/Caches/JetBrains/Kotlin
~/.m2/repository
key: kotlin-${{ runner.os }}-${{ hashFiles('renderer/kotlin', 'renderer/libs.versions.toml', 'renderer/**/module.yaml') }}
restore-keys: |
kotlin-${{ runner.os }}-

- name: Build the renderer shared library
run: ./renderer/desktop/scripts/build-native.sh

- name: Accessibility classes are linked in
run: ./scripts/tests/renderer/accessibility-link.test.sh

- name: Smoke test
env:
COMPOSE_RUST_AUTOEXIT_MS: '5000'
run: ./renderer/desktop/scripts/smoke-test.sh

- name: Report the distribution size
run: du -sh renderer/build/native-image/dist/lib

- name: Upload the renderer for inspection
uses: actions/upload-artifact@v4
with:
name: graalvm-renderer-macos-arm64
path: renderer/build/native-image/dist/
retention-days: 7

linux-x64:
name: Build and smoke test the GraalVM renderer (Linux, x64)
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4

- name: Install upstream GraalVM Community for JDK 25
uses: graalvm/setup-graalvm@v1
with:
java-version: '25.0.1'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Linux AWT, Skia, font, and virtual-display dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev unzip pkg-config fontconfig \
libx11-dev libxext-dev libxi-dev libxrender-dev libxtst-dev libxrandr-dev \
libfontconfig1-dev libfreetype6-dev libgl1 libgl1-mesa-dri libegl1 \
libgl1-mesa-dev fonts-noto-cjk xvfb xauth dbus-x11

- name: Cache the Kotlin toolchain and Maven dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/JetBrains/Kotlin
~/.m2/repository
key: kotlin-linux-${{ hashFiles('renderer/kotlin', 'renderer/libs.versions.toml', 'renderer/**/module.yaml') }}
restore-keys: |
kotlin-linux-

- name: Run Linux script contract tests
run: bash scripts/tests/renderer/linux-build.test.sh

- name: Run the Linux metadata contract test
run: bash scripts/tests/renderer/linux-metadata.test.sh

- name: Build the Linux renderer under Xvfb
run: xvfb-run -a ./renderer/desktop/scripts/build-native-linux.sh

- name: Inspect staged dynamic dependencies
run: |
find renderer/build/native-image-linux/dist/lib -maxdepth 1 -type f -print | sort
ldd renderer/build/native-image-linux/dist/lib/*.so

- name: Headless startup smoke only
env:
COMPOSE_RUST_AUTOEXIT_MS: '5000'
run: xvfb-run -a ./renderer/desktop/scripts/smoke-test-linux.sh

- name: Upload the Linux renderer for inspection
uses: actions/upload-artifact@v4
with:
name: graalvm-renderer-linux-x64
path: renderer/build/native-image-linux/dist/
retention-days: 7

linux-arm64:
name: Build and smoke test the GraalVM renderer (Linux, arm64)
runs-on: ubuntu-24.04-arm
timeout-minutes: 90
steps:
- uses: actions/checkout@v4

- name: Install upstream GraalVM Community for JDK 25
uses: graalvm/setup-graalvm@v1
with:
java-version: '25.0.1'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Linux AWT, Skia, font, and virtual-display dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev unzip pkg-config fontconfig \
libx11-dev libxext-dev libxi-dev libxrender-dev libxtst-dev libxrandr-dev \
libfontconfig1-dev libfreetype6-dev libgl1 libgl1-mesa-dri libegl1 \
libgl1-mesa-dev fonts-noto-cjk xvfb xauth dbus-x11

- name: Cache the Kotlin toolchain and Maven dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/JetBrains/Kotlin
~/.m2/repository
key: kotlin-linux-${{ hashFiles('renderer/kotlin', 'renderer/libs.versions.toml', 'renderer/**/module.yaml') }}
restore-keys: |
kotlin-linux-

- name: Build the Linux renderer under Xvfb
run: xvfb-run -a ./renderer/desktop/scripts/build-native-linux.sh

- name: Inspect staged dynamic dependencies
run: |
find renderer/build/native-image-linux/dist/lib -maxdepth 1 -type f -print | sort
ldd renderer/build/native-image-linux/dist/lib/*.so

- name: Headless startup smoke only
env:
COMPOSE_RUST_AUTOEXIT_MS: '5000'
run: xvfb-run -a ./renderer/desktop/scripts/smoke-test-linux.sh

- name: Upload the Linux renderer for inspection
uses: actions/upload-artifact@v4
with:
name: graalvm-renderer-linux-arm64
path: renderer/build/native-image-linux/dist/
retention-days: 7
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Workflow files and names, in `.github/workflows/`:
- `publish-crates.yml`, "Publish to crates.io": the tag release, started by `workflow_run` once the renderer workflow has succeeded.
- `pages.yml`, "Pages": docs.
- `test-<target>.yml`, "<Target> test": a special check for one target.
- `test-graalvm-renderer.yml`, "GraalVM renderer test": builds and smoke tests the GraalVM native-image renderer on macOS and Linux. It exists until the window code moves to the fork, then moves to the fork's CI and is deleted here.

Job names are English sentence case and say briefly what the job does. Matrix jobs read "<what> (<os>, <version>)". The same role keeps the same name across repos.

Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

## Unreleased

### The native-image renderer opens its own window on macOS

On the GraalVM native-image path, macOS now opens the AppKit window the renderer makes
itself, with no environment variable and no toolkit between the scene and the screen. It
carries what the toolkit's window did: the application's title, size, minimum size and
resizable choice, the system or the transparent title bar, the icon, the material behind a
glass design, files dropped on a drop target, and the window closing by itself for unattended
runs. Pointer positions and accessibility rectangles are now converted between points and
pixels, which they were not at 200% before. Korean input, VoiceOver and the feel of a live
resize at 100% and 200% still need a person on a Mac.

### The Dioxus path lives in dioxus-compose

The Dioxus adapter, the Dioxus baseline and the twelve `rsx!` samples moved to
Expand Down
54 changes: 34 additions & 20 deletions compose-rust/android-kotlin/shared/HostTextField.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.input.key.type
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.TextFieldValue
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.Job
import kotlinx.coroutines.coroutineScope
import androidx.compose.runtime.withFrameNanos
import kotlinx.coroutines.launch
import dev.darkpyonix.composerust.protocol.ColorRole
import dev.darkpyonix.composerust.protocol.HostEvent
import dev.darkpyonix.composerust.protocol.PropertyKind
Expand All @@ -48,21 +50,11 @@ import dev.darkpyonix.composerust.ui.textStyle
import dev.darkpyonix.composerust.ui.node.HostText
import dev.darkpyonix.composerust.design.LocalGlassDepth

/**
* Quiet period before a `TextChanged` notification is sent.
*
* The Host is told about edits, but not once per keystroke: `TextChanged` is a notification,
* not the mechanism that keeps the field's value, so it can wait for typing to pause. The
* interval is chosen here rather than negotiated; 120 ms is short enough to feel immediate
* and long enough to collapse a burst of typing into one event.
*/
const val TEXT_CHANGED_DEBOUNCE_MILLIS: Long = 120

/**
* The uncontrolled TextField.
*
* The editing value and the IME composition live in `remember` and never round-trip through
* the Host. The Host learns about edits through debounced `TextChanged` and through the
* the Host. The Host learns about edits through coalesced `TextChanged` and through the
* commit events `TextSubmitted` and `FocusLost`; it changes the value only with `SetText`,
* which is held back while a composition is in progress.
*
Expand Down Expand Up @@ -104,16 +96,38 @@ internal fun HostTextField(node: Node, modifier: Modifier, dispatcher: EventDisp
}
}

// Debounced change notification. The Host is told what the field now shows; it never
// sends the value back, so the composition cannot be reset by the round trip.
// Change notification, at most one a frame.
//
// An edit is told to the Host on the next frame, carrying the latest text, so keys that
// arrive within one frame cost it one event and a key is never held back by a timer: the
// line that echoes what was typed follows the key by a frame. The last text is always
// sent, because the frame that follows an edit sends whatever the field holds then, and
// a later edit starts another. The Host is told what the field now shows; it never sends
// the value back, so the composition cannot be reset by the round trip.
if (changeHandler != null) {
LaunchedEffect(nodeId, changeHandler) {
var lastSent = value.text
snapshotFlow { value.text }.collectLatest { text ->
if (text == lastSent) return@collectLatest
delay(TEXT_CHANGED_DEBOUNCE_MILLIS)
lastSent = text
dispatcher.dispatch(HostEvent.TextChanged(nodeId, changeHandler, text))
var latest = lastSent
var sending: Job? = null
coroutineScope {
snapshotFlow { value.text }.collect { text ->
latest = text
if (text == lastSent || sending?.isActive == true) return@collect
sending = launch {
do {
// Sent from inside the frame callback, not after it. Resuming
// from withFrameNanos goes back through the scene's dispatcher,
// which on the desktop windows runs what is waiting at the start
// of the next frame, so the send and the recomposition that
// follows it each cost a frame. In the callback the Host's batch
// is applied before this frame is composed and drawn.
withFrameNanos {
lastSent = latest
dispatcher.dispatch(HostEvent.TextChanged(nodeId, changeHandler, lastSent))
}
} while (latest != lastSent)
}
}
}
}
}
Expand Down
58 changes: 58 additions & 0 deletions renderer/desktop/c/appkit_resize.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// What a live resize shows, counted.
//
// A drag of the window's edge is a run of sizes the view takes. For the picture to follow
// the edge, a frame has to be presented at each of those sizes before the next one
// arrives; a size that was left without one is shown as the previous frame scaled to fit,
// which is the stretch a reader sees. This keeps the count of both, with no AppKit in it,
// so a test can feed it the sequence of sizes and presents a drag produces and ask the
// same question the window asks of itself.
#ifndef DXC_APPKIT_RESIZE_H
#define DXC_APPKIT_RESIZE_H

#include <stdint.h>
#include <string.h>

struct dxc_resize_stats {
int64_t steps; // sizes the view took
int64_t presented; // frames handed to the screen
int64_t stale; // presented frames whose texture was not the view's size
int64_t stretched; // sizes that were left without a frame of their own
int64_t callback_ticks;
int64_t callback_max_ticks;
int32_t view_width;
int32_t view_height;
int32_t step_unanswered;
};

static inline void dxc_resize_reset(struct dxc_resize_stats *stats) {
memset(stats, 0, sizeof *stats);
}

/** The view took a new size, in pixels. */
static inline void dxc_resize_step(struct dxc_resize_stats *stats, int32_t width, int32_t height) {
if (stats->step_unanswered) {
stats->stretched++;
}
stats->steps++;
stats->step_unanswered = 1;
stats->view_width = width;
stats->view_height = height;
}

/** A frame whose texture is this size was handed to the screen. */
static inline void dxc_resize_present(struct dxc_resize_stats *stats, int32_t width,
int32_t height) {
stats->presented++;
if (width != stats->view_width || height != stats->view_height) {
stats->stale++;
} else {
stats->step_unanswered = 0;
}
}

/** Sizes left without a frame, counting the last one, which has no successor to say so. */
static inline int64_t dxc_resize_stretched(const struct dxc_resize_stats *stats) {
return stats->stretched + (stats->step_unanswered ? 1 : 0);
}

#endif
Loading
Loading