Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
49 changes: 49 additions & 0 deletions .github/workflows/macos-appkit-provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ name: macOS AppKit provider checks
type: choice
options: [both, x86_64, arm64]
default: both
scope:
description: provider contract only, or the language-level display contract
type: choice
options: [provider, display]
default: provider

permissions:
contents: read
Expand All @@ -21,6 +26,7 @@ concurrency:
# than a full source campaign.
jobs:
provider:
if: ${{ inputs.scope == 'provider' }}
name: macOS ${{ matrix.host.arch }} AppKit provider
runs-on: ${{ matrix.host.runner }}
timeout-minutes: 30
Expand Down Expand Up @@ -66,3 +72,46 @@ jobs:
- name: Provider contract against a real session
timeout-minutes: 5
run: ./build/ci/bin/nil_ui_runtime_appkit_tests --display

display:
if: ${{ inputs.scope == 'display' }}
name: macOS ${{ matrix.host.arch }} AppKit display contract
runs-on: ${{ matrix.host.runner }}
timeout-minutes: 60
strategy:
fail-fast: false
max-parallel: 2
matrix:
host: ${{ fromJSON(inputs.architecture == 'arm64' && '[{"runner":"macos-15","arch":"arm64"}]' || inputs.architecture == 'x86_64' && '[{"runner":"macos-15-intel","arch":"x86_64"}]' || '[{"runner":"macos-15-intel","arch":"x86_64"},{"runner":"macos-15","arch":"arm64"}]') }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
persist-credentials: false
- name: Report the desktop session
timeout-minutes: 2
run: |
/usr/bin/python3 -c "
import ctypes, ctypes.util
core = ctypes.CDLL(ctypes.util.find_library('CoreGraphics'))
core.CGMainDisplayID.restype = ctypes.c_uint32
print('CGMainDisplayID:', core.CGMainDisplayID())
"
# The language-level contract needs the compiler, interpreter and test
# runner as well as the provider, so this is a whole build; LLVM stays
# off to keep it to one route rather than a full source campaign.
- name: Configure without LLVM
timeout-minutes: 8
run: |
cmake -S . -B build/ci \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON \
-DNIL_ENABLE_LLVM=OFF
- name: Build
timeout-minutes: 40
run: cmake --build build/ci --parallel 3
- name: Language-level desktop contract
timeout-minutes: 15
run: ctest --test-dir build/ci -R 'nil.ui' --output-on-failure
121 changes: 0 additions & 121 deletions .github/workflows/macos-gtk-provider.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ if(BUILD_TESTING)
add_executable(nil_ui_lifecycle_tests tests/ui_lifecycle_tests.cpp)
target_link_libraries(nil_ui_lifecycle_tests PRIVATE nilcompiler_core nilruntime ${CMAKE_DL_LIBS})
target_compile_features(nil_ui_lifecycle_tests PRIVATE cxx_std_17)
if(APPLE)
# Its registry observer asks AppKit for the application's windows, so
# the fixture is Objective-C++ on Darwin. Cocoa arrives with nilruntime.
set_source_files_properties(tests/ui_lifecycle_tests.cpp PROPERTIES
COMPILE_OPTIONS "-x;objective-c++")
endif()

add_executable(ny_native_owned_tests tests/native_owned_tests.cpp)
target_link_libraries(ny_native_owned_tests PRIVATE nilruntime Threads::Threads)
Expand Down
7 changes: 5 additions & 2 deletions docs/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,11 @@ the complete admission rules.
interactive session -- provider contract, lifecycle release observation, the
Matrix desktop suite and the interaction suite that drives real keyboard
input -- while a session without an interactive window station still skips.
macOS UI/provider support and live desktop acceptance remain open; AppKit
replaces the retired GTK-on-macOS work. Both hosted Mac architectures
On macOS the provider is AppKit: its published contract passes against a
real window server session on both hosted architectures, 93 checks each.
Language-level macOS desktop acceptance remains open. GTK on macOS is
retired, because a GTK process there never runs the AppKit event loop and so
has no accessibility hierarchy at all. Both hosted Mac architectures
now pass the prerequisite GLib, Cairo-Quartz and HarfBuzz/CoreText compile,
link and runtime checks, plus exact own-process AppKit key dispatch, view
delivery and window closure. Directed keyboard input to a verified child and
Expand Down
39 changes: 22 additions & 17 deletions docs/standard-library/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,28 @@ prove a desktop is usable. Win32 supplies no box or grid container, so the
provider owns the layout pass for rows, columns and grids; sizes therefore come
from measuring text with the system message font rather than from the toolkit.

The macOS source provider requires `NIL_UI_GTK_DIRECTORY` to name an existing
absolute trusted directory containing `libgtk-4.1.dylib`,
`libgobject-2.0.0.dylib` and `libglib-2.0.0.dylib`. Curated symlinks may point to
the selected external runtime files. Resolved symbols and GTK's direct core
dependency lookups must match those selected files. There is no implicit
current-directory or `PATH` lookup, and the provider does not change loader
settings. GTK remains an external prerequisite; this does not create a portable
GTK bundle or validate every transitive dependency of an embedding host.

On macOS, creation and polling must run on the process main thread, including
the first GTK initialization. The provider requires the native Macos/Quartz
display backend. Ordinary interpreter, JIT and native entry routes use the main
thread; UI behavior through these routes still needs the desktop acceptance
campaign. DAP currently executes the debuggee on a worker, so DAP with macOS UI
is outside this port. Pausing a text/JSON debug session also does not automatically
pump window events. The recorded private toolkit profile uses Cairo rendering;
other renderer and accessibility configurations remain unqualified.
macOS needs no external toolkit either. The provider is AppKit, so
`available with nothing` is always true there and GTK is neither used nor
loaded; `NIL_UI_GTK_DIRECTORY` has no meaning on macOS. Window creation
requires a window server session and returns a display error without one.
Because the provider calls Cocoa and CoreGraphics directly, every linked
program carries those frameworks, which is why they appear in the Darwin link
lines alongside the runtime.

GTK is no longer a macOS provider. A GTK process on macOS never runs
`-[NSApplication run]`, and AppKit answers accessibility requests from the main
run loop, so such a process has no accessibility hierarchy at all: every
accessibility query against it fails, including the application element's own
role, which makes it invisible to assistive technology and to directed input.

On macOS, creation and polling must run on the process main thread, which is
where AppKit requires its windows to be used. Ordinary interpreter, JIT and
native entry routes use the main thread; UI behaviour through these routes
still needs the desktop acceptance campaign. DAP currently executes the
debuggee on a worker, so DAP with macOS UI is outside this port, and pausing a
text or JSON debug session does not automatically pump window events. AppKit
supplies no box or grid container, so, as on Win32, the provider owns the
layout pass and sizes come from each control's fitting size.

## Windows and widgets

Expand Down
Loading
Loading