Reaktor, and seven functions nobody was calling
The project is renamed. Curie becomes Reaktor everywhere it appeared: 1462
occurrences across 41 files, in three spellings, plus five files whose names
carried it - the root sentinel, src/curie.h, and the three branding marks. The
CMake targets go with them, so the binary is reaktor.exe and the page is
reaktor.html, and so do the environment variables, which are REAKTOR_TAB and
the rest now. Nothing under third_party/ was touched; the submodules are
upstream's and stay that way.
The replacement was case-preserving and checked before it ran rather than
after: the only place "curie" appeared adjacent to another letter was
CurieElement in the macOS bridge, which is ours, so there were no words to
break. Afterwards the tree was swept for any spelling that survived, including
inside the binaries, and none did.
Ahead of that, the dead code. Seven functions were defined, declared in a
header, and called by nothing:
curie_glyph and curie_link one-line pass-throughs to icon() and
text_link(), which every caller uses directly
curie_snap_shutdown the snapshot's teardown, from a design where
the platform API had one; it has init, push
and drain and never grew a fourth
curie_css_flatten_text the from-memory twin of curie_css_flatten,
which is the one the app actually uses
curie_unpx and curie_px_rect the unused half of the scale helpers
curie_svg_surface a convenience wrapper naming an Ionicon,
where every caller has a path already
The web bridge's two exported functions look the same to a search and are not:
curie_a11y_web_activate and curie_a11y_web_focus are EMSCRIPTEN_KEEPALIVE and
called from JavaScript. They stay.
Two documented claims had gone stale and were corrected rather than renamed
around: ACCESSIBILITY.md listed curie_link among the wrappers a page uses, and
the README described branding/ as holding two inks when it holds one mark in
three formats.
Off disk: the .obj files and the gen/ directory left at the root by the
hand-rolled cl.exe build that CMakeLists.txt replaced - flatdump.obj outlived
the source file it was built from. .claude/settings.local.json is local
configuration and is now ignored rather than sitting untracked forever.
Checked, not assumed. Both builds run clean from scratch: the native binary
links and starts, and its accessibility tree dumps twenty-seven nodes with the
window and its title now reading Reaktor, which is the end-to-end proof that
the renamed .reaktor-root sentinel still resolves and the assets under it still
load. The model's golden test passes. The web build links reaktor.html with an
86 KB data package, so the asset and icon globs still match at their new paths
- that number is the one that went to 903 KB the last time they did not.
One cosmetic consequence, left alone on purpose. "reaktor" is two characters
longer than "curie", which pushed 55 lines from 80 to 83 columns in a tree that
otherwise wraps at 79. Rewrapping them would have meant reflowing whole comment
paragraphs and hand-breaking half the code lines, which would bury a rename
that is currently reviewable by reading one substitution. It is a separate
pass if it is wanted.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
# Marker for curie_root(): identifies the repository root at runtime.
|
||||
# Do not delete. See src/util.c.
|
||||
@@ -6,3 +6,4 @@ gen/
|
||||
*.pdb
|
||||
*.ilk
|
||||
build-wasm/
|
||||
.claude/settings.local.json
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# Marker for reaktor_root(): identifies the repository root at runtime.
|
||||
# Do not delete. See src/util.c.
|
||||
+36
-36
@@ -1,10 +1,10 @@
|
||||
# Curie - one build for Windows, macOS, Linux, the BSDs and (via emcmake) WASM.
|
||||
# Reaktor - one build for Windows, macOS, Linux, the BSDs and (via emcmake) WASM.
|
||||
#
|
||||
# This replaces the hand-rolled cl.exe command lines that build.ps1 used to
|
||||
# assemble. Everything is built from the vendored submodules; nothing is
|
||||
# expected to be installed on the system.
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(curie C CXX)
|
||||
project(reaktor C CXX)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
@@ -135,11 +135,11 @@ target_link_libraries(plutosvg PUBLIC plutovg)
|
||||
# ------------------------------------------------------------- shared -------
|
||||
# Asset loading and the SVG->raster path, used by both the app and the icon
|
||||
# generator. Deliberately free of SDL and Nuklear so the tool stays small.
|
||||
add_library(curie_core STATIC
|
||||
add_library(reaktor_core STATIC
|
||||
src/util.c
|
||||
src/appicon.c)
|
||||
target_include_directories(curie_core PUBLIC src)
|
||||
target_link_libraries(curie_core PUBLIC plutosvg)
|
||||
target_include_directories(reaktor_core PUBLIC src)
|
||||
target_link_libraries(reaktor_core PUBLIC plutosvg)
|
||||
|
||||
# ------------------------------------------------------------ icon ----------
|
||||
# Explorer reads the icon from a linked Win32 resource, so it has to exist
|
||||
@@ -147,11 +147,11 @@ target_link_libraries(curie_core PUBLIC plutosvg)
|
||||
# .svg beside it is the authored mark and the .ico is derived from it, by a
|
||||
# tool that is not part of the build.
|
||||
# cmake --build build --target mkicon && build/mkicon
|
||||
set(APP_ICON branding/curie-icon.ico)
|
||||
set(APP_ICON branding/reaktor-icon.ico)
|
||||
set(APP_RESOURCES "")
|
||||
|
||||
add_executable(mkicon EXCLUDE_FROM_ALL tools/mkicon.c)
|
||||
target_link_libraries(mkicon PRIVATE curie_core)
|
||||
target_link_libraries(mkicon PRIVATE reaktor_core)
|
||||
set_target_properties(mkicon PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
|
||||
@@ -183,10 +183,10 @@ if(WIN32)
|
||||
set(GEN "${CMAKE_BINARY_DIR}/gen")
|
||||
file(MAKE_DIRECTORY "${GEN}")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${APP_ICON}"
|
||||
"${GEN}/curie.ico" COPYONLY)
|
||||
file(WRITE "${GEN}/curie.rc" "1 ICON \"curie.ico\"
|
||||
"${GEN}/reaktor.ico" COPYONLY)
|
||||
file(WRITE "${GEN}/reaktor.rc" "1 ICON \"reaktor.ico\"
|
||||
")
|
||||
set(APP_RESOURCES "${GEN}/curie.rc")
|
||||
set(APP_RESOURCES "${GEN}/reaktor.rc")
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------- app -------
|
||||
@@ -219,7 +219,7 @@ elseif(UNIX AND NOT APPLE AND NOT EMSCRIPTEN)
|
||||
if(DBUS_FOUND)
|
||||
list(APPEND SYS_SRC src/sys/a11y_snapshot.c src/sys/a11y_atspi.c)
|
||||
list(APPEND SYS_LIBS ${DBUS_LIBRARIES})
|
||||
list(APPEND SYS_DEFS CURIE_HAVE_ATSPI)
|
||||
list(APPEND SYS_DEFS REAKTOR_HAVE_ATSPI)
|
||||
message(STATUS "a11y: AT-SPI over libdbus ${DBUS_VERSION}")
|
||||
else()
|
||||
message(STATUS "a11y: no dbus-1; the AT-SPI bridge is not built")
|
||||
@@ -232,13 +232,13 @@ elseif(APPLE AND NOT EMSCRIPTEN)
|
||||
# not worth the retain counting.
|
||||
enable_language(OBJC)
|
||||
list(APPEND SYS_SRC src/sys/a11y_snapshot.c src/sys/a11y_macos.m)
|
||||
list(APPEND SYS_DEFS CURIE_HAVE_NSACCESSIBILITY)
|
||||
list(APPEND SYS_DEFS REAKTOR_HAVE_NSACCESSIBILITY)
|
||||
set_source_files_properties(src/sys/a11y_macos.m PROPERTIES
|
||||
COMPILE_OPTIONS "-fobjc-arc")
|
||||
list(APPEND SYS_LIBS "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
add_executable(curie WIN32
|
||||
add_executable(reaktor WIN32
|
||||
src/a11y.c
|
||||
src/a11y_web.c
|
||||
${SYS_SRC}
|
||||
@@ -251,34 +251,34 @@ add_executable(curie WIN32
|
||||
src/showcase.c
|
||||
${APP_RESOURCES})
|
||||
|
||||
target_include_directories(curie PRIVATE
|
||||
target_include_directories(reaktor PRIVATE
|
||||
"${TP}/nuklear"
|
||||
"${TP}/nuklear/demo/sdl3_renderer")
|
||||
|
||||
target_link_libraries(curie PRIVATE
|
||||
curie_core
|
||||
target_link_libraries(reaktor PRIVATE
|
||||
reaktor_core
|
||||
SDL3::SDL3-static
|
||||
lcui)
|
||||
# uiautomationcore is the UIA provider API (phase 4b); ole32 and oleaut32 are
|
||||
# the COM and BSTR halves of it.
|
||||
if(WIN32 AND NOT EMSCRIPTEN)
|
||||
target_link_libraries(curie PRIVATE uiautomationcore ole32 oleaut32)
|
||||
target_link_libraries(reaktor PRIVATE uiautomationcore ole32 oleaut32)
|
||||
endif()
|
||||
if(SYS_LIBS)
|
||||
target_link_libraries(curie PRIVATE ${SYS_LIBS})
|
||||
target_link_libraries(reaktor PRIVATE ${SYS_LIBS})
|
||||
endif()
|
||||
if(DBUS_FOUND)
|
||||
target_include_directories(curie PRIVATE ${DBUS_INCLUDE_DIRS})
|
||||
target_include_directories(reaktor PRIVATE ${DBUS_INCLUDE_DIRS})
|
||||
endif()
|
||||
if(SYS_DEFS)
|
||||
target_compile_definitions(curie PRIVATE ${SYS_DEFS})
|
||||
target_compile_definitions(reaktor PRIVATE ${SYS_DEFS})
|
||||
endif()
|
||||
|
||||
# dxguid supplies IID_IDXGIDevice, which is how the app asks the renderer SDL
|
||||
# gave it whether Direct3D is talking to a real GPU - see renderer_is_software
|
||||
# in src/main.c. Nothing else in the tree touches Direct3D.
|
||||
if(WIN32 AND NOT EMSCRIPTEN)
|
||||
target_link_libraries(curie PRIVATE dxguid)
|
||||
target_link_libraries(reaktor PRIVATE dxguid)
|
||||
endif()
|
||||
|
||||
# ------------------------------------------------------------- wasm --------
|
||||
@@ -287,9 +287,9 @@ endif()
|
||||
# Two things have to change and only two. The assets are read from the
|
||||
# submodules at runtime by path, so they are packaged into Emscripten's
|
||||
# virtual filesystem at exactly the paths the code already asks for - see
|
||||
# curie_root() in src/util.c, which answers "" here for that reason. And the
|
||||
# reaktor_root() in src/util.c, which answers "" here for that reason. And the
|
||||
# window is a canvas, so there is no frame to remove and no frame to draw:
|
||||
# main.c defaults CURIE_BORDERLESS off under __EMSCRIPTEN__.
|
||||
# main.c defaults REAKTOR_BORDERLESS off under __EMSCRIPTEN__.
|
||||
#
|
||||
# Everything else - SDL3, libcss, plutovg, Nuklear, the CSS seam - is portable
|
||||
# C and comes across untouched, which was the point of the callback main loop
|
||||
@@ -297,11 +297,11 @@ endif()
|
||||
if(EMSCRIPTEN)
|
||||
# -Oz on the compile side too; CMAKE_BUILD_TYPE=Release would otherwise
|
||||
# hand every translation unit -O3, which optimises for speed.
|
||||
target_compile_options(curie PRIVATE -Oz)
|
||||
target_compile_options(reaktor PRIVATE -Oz)
|
||||
target_compile_options(lcui PRIVATE -Oz)
|
||||
target_compile_options(plutovg PRIVATE -Oz)
|
||||
target_compile_options(plutosvg PRIVATE -Oz)
|
||||
target_compile_options(curie_core PRIVATE -Oz)
|
||||
target_compile_options(reaktor_core PRIVATE -Oz)
|
||||
|
||||
# Every asset the app opens is named by a string literal in src/, so
|
||||
# the package is built from those rather than from a directory: assets/fonts
|
||||
@@ -309,9 +309,9 @@ if(EMSCRIPTEN)
|
||||
# list would go stale the first time a path changed. The branding SVG comes
|
||||
# along the same way - it is the window icon.
|
||||
set(WASM_ASSETS "")
|
||||
file(GLOB _curie_srcs "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
|
||||
file(GLOB _reaktor_srcs "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.h")
|
||||
foreach(_s IN LISTS _curie_srcs)
|
||||
foreach(_s IN LISTS _reaktor_srcs)
|
||||
# \. and not \. : CMake unescapes a quoted argument before the regex
|
||||
# engine sees it, so \. arrives as a bare dot, which matches anything.
|
||||
# That was harmless while the extensions were css|ttf|otf, and stopped
|
||||
@@ -342,10 +342,10 @@ if(EMSCRIPTEN)
|
||||
# nothing, which is what one pattern alone cost. The second picks up a few
|
||||
# literals that happen to share a name with an icon - "list", "menu",
|
||||
# "card" - about two kilobytes of glyphs nobody draws.
|
||||
file(GLOB _curie_srcs "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
|
||||
file(GLOB _reaktor_srcs "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.h")
|
||||
set(WASM_ICONS "")
|
||||
foreach(_s IN LISTS _curie_srcs)
|
||||
foreach(_s IN LISTS _reaktor_srcs)
|
||||
file(STRINGS "${_s}" _lines REGEX "[a-z0-9-]+-outline")
|
||||
foreach(_l IN LISTS _lines)
|
||||
string(REGEX MATCHALL "[a-z0-9]+(-[a-z0-9]+)*-outline" _n "${_l}")
|
||||
@@ -384,8 +384,8 @@ if(EMSCRIPTEN)
|
||||
endforeach()
|
||||
message(STATUS "wasm: packaging ${_asset_count} assets and ${_icon_count} icons")
|
||||
|
||||
set_target_properties(curie PROPERTIES SUFFIX ".html")
|
||||
target_link_options(curie PRIVATE
|
||||
set_target_properties(reaktor PROPERTIES SUFFIX ".html")
|
||||
target_link_options(reaktor PRIVATE
|
||||
${WASM_PRELOAD}
|
||||
# The font atlas and the SVG rasters are allocated as the UI is first
|
||||
# drawn, so the heap has to be able to grow past whatever is reserved.
|
||||
@@ -402,19 +402,19 @@ if(EMSCRIPTEN)
|
||||
-Oz
|
||||
--closure 1
|
||||
"SHELL:--shell-file ${CMAKE_CURRENT_SOURCE_DIR}/tools/shell.html")
|
||||
set_property(TARGET curie APPEND PROPERTY LINK_DEPENDS
|
||||
set_property(TARGET reaktor APPEND PROPERTY LINK_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tools/shell.html")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# C5287/C4101 are Nuklear's; C4244/C4267 are plutovg's narrowing warnings.
|
||||
target_compile_options(curie PRIVATE /wd5287 /wd4101)
|
||||
target_compile_options(reaktor PRIVATE /wd5287 /wd4101)
|
||||
target_compile_options(plutovg PRIVATE /wd4244 /wd4267 /wd4018)
|
||||
target_compile_definitions(curie PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_definitions(curie_core PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_definitions(reaktor PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_definitions(reaktor_core PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# The app finds assets by walking up from the executable to the directory
|
||||
# containing third_party/, so keep the binary inside the tree.
|
||||
set_target_properties(curie PROPERTIES
|
||||
set_target_properties(reaktor PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
# Contributing to Curie
|
||||
# Contributing to Reaktor
|
||||
|
||||
Pull requests are welcome, and so is an issue that just says "this looks
|
||||
wrong" with a screenshot — a good half of the work in this repository has come
|
||||
@@ -39,7 +39,7 @@ like, and expect a conversation rather than a checklist.
|
||||
- **Comments say why, not what.** The code already says what it does. A
|
||||
comment earns its place by recording the reason, the measurement, or the
|
||||
thing that was tried first and failed.
|
||||
- **`curie_` prefixes** anything crossing a translation unit. Anything that
|
||||
- **`reaktor_` prefixes** anything crossing a translation unit. Anything that
|
||||
does not cross one is `static`.
|
||||
- **No new dependency without a licence check.** See below.
|
||||
|
||||
@@ -84,11 +84,11 @@ case for changing one.
|
||||
|
||||
## Security
|
||||
|
||||
Curie reads files at startup and while running: stylesheets through libcss,
|
||||
Reaktor reads files at startup and while running: stylesheets through libcss,
|
||||
SVG through plutosvg, fonts through Nuklear's baker. All of them are parsers,
|
||||
and all of them are pointed at paths derived from the application root.
|
||||
|
||||
- Keep every path going through `curie_path()`. It resolves against the root
|
||||
- Keep every path going through `reaktor_path()`. It resolves against the root
|
||||
marker, which is what stops a relative path escaping the install.
|
||||
- Do not add a code path that loads a stylesheet, font or image from a
|
||||
location the user has not chosen, and do not add a network fetch.
|
||||
@@ -107,8 +107,8 @@ For a change of any size, say in the pull request:
|
||||
- which tabs you drove, and what you clicked;
|
||||
- what the Diagnostics tab said before and after, if you touched anything that
|
||||
could affect frame time or memory;
|
||||
- a screenshot, if the change is visible. Set `CURIE_TAB`, `CURIE_SCROLL` and
|
||||
`CURIE_THEME` to land on the same view every time rather than clicking your
|
||||
- a screenshot, if the change is visible. Set `REAKTOR_TAB`, `REAKTOR_SCROLL` and
|
||||
`REAKTOR_THEME` to land on the same view every time rather than clicking your
|
||||
way there — see [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md).
|
||||
|
||||
Claims about performance want a number from the Diagnostics tab or from the
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Curie
|
||||
# Reaktor - a Nuklear-powered (graphical) engine
|
||||
|
||||
A desktop application in C where none of the styling is compiled in.
|
||||
|
||||

|
||||
|
||||
@@ -12,7 +12,7 @@ controls](docs/screenshot.png)
|
||||
- **SDL3** supplies the window, the input and the renderer.
|
||||
|
||||
The stylesheet is [tiny.css](https://github.com/ihsan6133/tiny.css), which is
|
||||
classless and written for HTML. Curie reads the rules that have a counterpart
|
||||
classless and written for HTML. Reaktor reads the rules that have a counterpart
|
||||
in Nuklear — `button`, `input`, `select`, `details`, `summary`, `dialog` — and
|
||||
the palette in `:root`, and maps them onto the widget styles. Edit a colour in
|
||||
`third_party/tinycss/src/`, restart, and the app follows: nothing under `src/`
|
||||
@@ -92,7 +92,7 @@ A `file://` page cannot fetch the `.wasm`, so serve the output directory:
|
||||
| `src/metrics.c` | The display scale, in one place |
|
||||
| `src/theme.c` | Which colour scheme the desktop is using |
|
||||
| `src/util.c` | Paths, whole-file reads, the resident set |
|
||||
| `branding/` | The project's mark: two inks, each as SVG, PNG and `.ico` |
|
||||
| `branding/` | The project's mark, as SVG, PNG and `.ico` |
|
||||
| `assets/fonts/` | Aileron, the CC0 typeface the UI is set in — vendored rather than submoduled, the one exception to the rule |
|
||||
|
||||
## Documentation
|
||||
|
||||
@@ -20,7 +20,7 @@ terms come from. Two independent sources, both from the designer:
|
||||
|
||||
It is also listed as CC-0 at https://fontlibrary.org/en/font/aileron
|
||||
|
||||
This file was assembled by the Curie project from those sources. It is not a
|
||||
This file was assembled by the Reaktor project from those sources. It is not a
|
||||
document supplied by the designer. The CC0 1.0 Universal legal code that the
|
||||
declaration above refers to is reproduced in full below, from
|
||||
https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
||||
|
||||
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
@@ -1,4 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-label="Curie" viewBox="0 0 512 512">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-label="Reaktor" viewBox="0 0 512 512">
|
||||
<path fill="#face00" stroke="#face00" stroke-linejoin="round" stroke-width="40" d="m256 40 187.06 108v216L256 472 68.94 364V148Z"/>
|
||||
<path fill="#1b1b1b" d="M379.36 367.08a166 166 0 1 1 0-222.16l-38.64 34.8a114 114 0 1 0 0 152.56Z"/>
|
||||
<g fill="#1b1b1b">
|
||||
|
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 620 B |
+2
-2
@@ -7,7 +7,7 @@
|
||||
# source /path/to/emsdk/emsdk_env.sh
|
||||
# emcmake cmake -S . -B build-wasm && cmake --build build-wasm --parallel
|
||||
#
|
||||
# Output: build-wasm/curie.html plus its .js, .wasm and .data.
|
||||
# Output: build-wasm/reaktor.html plus its .js, .wasm and .data.
|
||||
param([switch]$Serve)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
@@ -55,7 +55,7 @@ $ErrorActionPreference = $prev
|
||||
if ($rc -ne 0) { throw "wasm build failed ($rc)" }
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "built: $outDir\curie.html"
|
||||
Write-Host "built: $outDir\reaktor.html"
|
||||
Write-Host "a file:// page cannot fetch the .wasm, so serve it:"
|
||||
Write-Host " python -m http.server -d build-wasm 8000"
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ if (-not (Test-Path (Join-Path $root "third_party\SDL\CMakeLists.txt"))) {
|
||||
|
||||
# A temp .bat keeps vcvars and cmake in one cmd session, and avoids PowerShell
|
||||
# mangling the quoting of paths that contain spaces.
|
||||
$bat = Join-Path $env:TEMP "curie_build.bat"
|
||||
$bat = Join-Path $env:TEMP "reaktor_build.bat"
|
||||
@(
|
||||
'@echo off',
|
||||
('call "' + $vcvars + '" >nul 2>&1'),
|
||||
@@ -55,4 +55,4 @@ $ErrorActionPreference = $prev
|
||||
if ($rc -ne 0) { throw "build failed ($rc)" }
|
||||
Write-Host ""
|
||||
if ($Target) { Write-Host "built target: $Target" }
|
||||
else { Write-Host "built: $outDir\curie.exe" }
|
||||
else { Write-Host "built: $outDir\reaktor.exe" }
|
||||
|
||||
+25
-25
@@ -44,7 +44,7 @@ platform APIs want, then swap.
|
||||
The immediate-mode loop stays immediate. The tree is a by-product of it.
|
||||
|
||||
```c
|
||||
typedef struct curie_a11y_node {
|
||||
typedef struct reaktor_a11y_node {
|
||||
unsigned id; /* stable across frames - see below */
|
||||
unsigned parent;
|
||||
unsigned char role; /* BUTTON, CHECKBOX, TAB, TABLIST, EDIT, ... */
|
||||
@@ -52,7 +52,7 @@ typedef struct curie_a11y_node {
|
||||
const char *name; /* interned; the label a reader speaks */
|
||||
const char *value; /* field contents, slider value as text */
|
||||
struct nk_rect bounds; /* window coordinates, post render scale */
|
||||
} curie_a11y_node;
|
||||
} reaktor_a11y_node;
|
||||
```
|
||||
|
||||
**Identity is the one hard part.** An id must name the same button on
|
||||
@@ -66,14 +66,14 @@ call order, so adding a widget above does not rename everything below it.
|
||||
|
||||
Platform-independent, and testable on its own.
|
||||
|
||||
- `src/a11y.c` / `a11y.h`: two `curie_a11y_node` arenas, front and back, sized
|
||||
- `src/a11y.c` / `a11y.h`: two `reaktor_a11y_node` arenas, front and back, sized
|
||||
once (the busiest page draws on the order of a hundred widgets; 512 is
|
||||
generous). Names interned into a per-frame string arena so the tree owns no
|
||||
heap churn.
|
||||
- `curie_a11y_begin()` / `curie_a11y_node()` / `curie_a11y_push()` /
|
||||
`curie_a11y_pop()` / `curie_a11y_end()`. Push and pop maintain the parent
|
||||
- `reaktor_a11y_begin()` / `reaktor_a11y_node()` / `reaktor_a11y_push()` /
|
||||
`reaktor_a11y_pop()` / `reaktor_a11y_end()`. Push and pop maintain the parent
|
||||
stack for containers.
|
||||
- `curie_a11y_end()` diffs back against front and produces a change list:
|
||||
- `reaktor_a11y_end()` diffs back against front and produces a change list:
|
||||
added, removed, name/value changed, state changed, focus moved. Swap.
|
||||
- Cost control: skip the diff entirely when the frame was not dirty, which is
|
||||
most frames — see the frame loop in [DEVELOPMENT.md](DEVELOPMENT.md).
|
||||
@@ -89,8 +89,8 @@ once to confirm the test fails when it should.
|
||||
|
||||
The mechanical bulk of the work, and the part that had to be got right once.
|
||||
|
||||
The pages already funnel some widgets through shell helpers — `curie_button`,
|
||||
`curie_button_accent`, `curie_button_icon`, `curie_link`, `curie_field` — and
|
||||
The pages already funnel some widgets through shell helpers — `reaktor_button`,
|
||||
`reaktor_button_accent`, `reaktor_button_icon`, `reaktor_field` — and
|
||||
those are one added call each. The rest of `src/showcase.c` calls Nuklear
|
||||
directly: roughly **190 distinct `nk_*` entry points**, of which about 60 call
|
||||
sites are interactive widgets (14 `nk_button_label`, 11 `nk_group_begin`, 7
|
||||
@@ -99,7 +99,7 @@ sites are interactive widgets (14 `nk_button_label`, 11 `nk_group_begin`, 7
|
||||
|
||||
Two ways to cover them, and the choice matters:
|
||||
|
||||
1. **Wrap each in a `curie_*` helper** that draws and reports. Verbose, but the
|
||||
1. **Wrap each in a `reaktor_*` helper** that draws and reports. Verbose, but the
|
||||
report cannot be forgotten, and the showcase is already half-way there.
|
||||
2. **Report inline at each call site.** Less code to add, but a new widget added
|
||||
later is silently absent from the tree.
|
||||
@@ -110,7 +110,7 @@ register the pointer cursor — 34 sites, always immediately before the widget.
|
||||
signature now carries role, name and state as well, so one call does both: a
|
||||
widget worth a cursor is worth a name, and they cannot drift apart. The shell's
|
||||
own `css_button`, `css_button_accent`, `css_button_icon`, `text_link`,
|
||||
`curie_field` and `css_field` report from inside, so every page gets it free.
|
||||
`reaktor_field` and `css_field` report from inside, so every page gets it free.
|
||||
Static prose goes through `heading`, `caption` and `api`, which report inline.
|
||||
|
||||
Two things came out of doing it that the plan had not foreseen:
|
||||
@@ -119,7 +119,7 @@ Two things came out of doing it that the plan had not foreseen:
|
||||
container came out as 0,0 960x680. Containers now capture `nk_widget_bounds`
|
||||
*before* `nk_group_begin`, which is the slot the group will fill.
|
||||
- **A page scrolls, so much of it is off-window.** Those nodes stay in the tree
|
||||
— a reader should be able to find and scroll to them — but `curie_a11y_end`
|
||||
— a reader should be able to find and scroll to them — but `reaktor_a11y_end`
|
||||
marks them `offscreen` against the window node's rect, so a magnifier is not
|
||||
sent chasing bounds nobody can see.
|
||||
|
||||
@@ -160,7 +160,7 @@ Two things worth keeping in mind if this is ever revisited:
|
||||
|
||||
Containers need mapping too, and this is where the roles come from:
|
||||
|
||||
| Curie | Role |
|
||||
| Reaktor | Role |
|
||||
| --- | --- |
|
||||
| tab strip / a tab | `tablist` / `tab` |
|
||||
| `nk_group_begin` | `group` |
|
||||
@@ -189,7 +189,7 @@ because every one of them asks "what has focus".
|
||||
|
||||
How it came out, and where it differs from the sketch above:
|
||||
|
||||
- **Focus is a field of the tree, not beside it.** `curie_a11y_set_focus`
|
||||
- **Focus is a field of the tree, not beside it.** `reaktor_a11y_set_focus`
|
||||
names an id; the node is stamped `focused` as it is emitted, so focus moving
|
||||
reaches the diff as two ordinary state changes, and the test checks exactly
|
||||
that. The shell learns where the focused node landed through the same
|
||||
@@ -225,7 +225,7 @@ How it came out, and where it differs from the sketch above:
|
||||
down, on a slider or a spinner; every other role still lets them move focus
|
||||
among siblings. The shell cannot apply the step itself — it knows a node's
|
||||
value as the text a reader would hear and nothing of its bounds or its grain
|
||||
— so it counts the presses and the widget takes them (`curie_focus_step`).
|
||||
— so it counts the presses and the widget takes them (`reaktor_focus_step`).
|
||||
They accumulate, because key repeat outruns the frame rate, and they are
|
||||
dropped at the end of a frame whether or not the range was drawn.
|
||||
- **The ring is clipped to the page's band** when the focused node is in the
|
||||
@@ -239,9 +239,9 @@ How it came out, and where it differs from the sketch above:
|
||||
One thin interface, four implementations, each independently shippable:
|
||||
|
||||
```c
|
||||
int curie_a11y_platform_init(SDL_Window *win);
|
||||
void curie_a11y_platform_push(const curie_a11y_change *list, int n);
|
||||
void curie_a11y_platform_shutdown(void);
|
||||
int reaktor_a11y_platform_init(SDL_Window *win);
|
||||
void reaktor_a11y_platform_push(const reaktor_a11y_change *list, int n);
|
||||
void reaktor_a11y_platform_shutdown(void);
|
||||
```
|
||||
|
||||
**Web first — done.** Emscripten draws into a canvas, and a canvas is invisible
|
||||
@@ -266,7 +266,7 @@ all):
|
||||
mirror, and `aria-activedescendant` names the focused node. That is what the
|
||||
ARIA application pattern is for.
|
||||
- **A reader's press is a key's press.** Every mirror node is answered by two
|
||||
exported functions, `curie_a11y_web_activate` and `curie_a11y_web_focus`,
|
||||
exported functions, `reaktor_a11y_web_activate` and `reaktor_a11y_web_focus`,
|
||||
which the shell turns into exactly the click and the focus that Enter and Tab
|
||||
make — so a node reached through the platform behaves as one reached through
|
||||
the keyboard, and nothing at any call site knows the difference.
|
||||
@@ -275,7 +275,7 @@ all):
|
||||
stops that default and nothing else, so SDL still sees the key and the app
|
||||
walks its widgets as it does on the desktop. The "native titlebar" switch is
|
||||
not drawn on the web — there is no frame to switch to.
|
||||
- **Three roles translate.** Curie's vocabulary is the one every platform
|
||||
- **Three roles translate.** Reaktor's vocabulary is the one every platform
|
||||
shares; in ARIA `progress` is `progressbar`, `listitem` is `option`, and a
|
||||
label has no role at all — it is text.
|
||||
- **Checked in the browser, not in the pixels**: the page is served from
|
||||
@@ -306,7 +306,7 @@ Three things the sketch above got wrong or did not know:
|
||||
no bridge touches the model: a drawn frame copies it — strings and all, since
|
||||
the model's arena is reused — into a snapshot under a lock, and the bridge
|
||||
answers from that. A request goes the other way by the same rule: it records
|
||||
an id, pushes an SDL event to wake the loop, and `curie_a11y_platform_drain`
|
||||
an id, pushes an SDL event to wake the loop, and `reaktor_a11y_platform_drain`
|
||||
runs it on the app's thread before the next frame is built.
|
||||
|
||||
None of that is Windows's problem, so it is not in the Windows file. It is
|
||||
@@ -332,7 +332,7 @@ a tab resolves to the tab.
|
||||
`IToggleProvider`, `ISelectionItemProvider` and `IRangeValueProvider` are
|
||||
there too. The range one needed the model to carry numbers: a node's `value` is
|
||||
the text a reader hears, and neither `IRangeValueProvider` nor ARIA's
|
||||
`valuemin`/`valuemax` can be got out of that, so `curie_a11y_set_range` puts
|
||||
`valuemin`/`valuemax` can be got out of that, so `reaktor_a11y_set_range` puts
|
||||
`num`, `lo`, `hi` and `step` on the node the widget just reported. The web
|
||||
bridge uses them too — it had been running `parseFloat` over the value text,
|
||||
which happened to work for "40" and would not have for "3 of 8". Verified
|
||||
@@ -350,7 +350,7 @@ on, press-versus-release semantics, and routing the steps through SDL's event
|
||||
queue — that last one is *worse*, and breaks the keyboard too).
|
||||
|
||||
Rather than keep chasing it, the shell now tells the widget directly. A press
|
||||
records an id; `curie_focus_activated` hands it to the widget that owns it,
|
||||
records an id; `reaktor_focus_activated` hands it to the widget that owns it,
|
||||
once; the widget changes its own state, which it is better placed to do than
|
||||
anything simulating a pointer. Checkboxes, radios, tabs and buttons take it.
|
||||
Anything that has not been taught to listen still gets the synthetic click, as
|
||||
@@ -371,7 +371,7 @@ belongs with `ITextProvider` and the caret.
|
||||
freedesktop standard rather than a Linux one, `at-spi2-core` and Orca are in
|
||||
FreeBSD ports, OpenBSD ports and pkgsrc, and nothing in the bridge is
|
||||
Linux-specific. The build reaches it through `UNIX AND NOT APPLE` and the
|
||||
source through `CURIE_HAVE_ATSPI`, so no `__linux__` appears anywhere in it and
|
||||
source through `REAKTOR_HAVE_ATSPI`, so no `__linux__` appears anywhere in it and
|
||||
the BSDs are covered by construction rather than by luck.
|
||||
|
||||
`src/sys/a11y_atspi.c` speaks the
|
||||
@@ -515,7 +515,7 @@ after it unobservable.
|
||||
#### macOS
|
||||
|
||||
1. **Whether the tree is grafted on at all.** Accessibility Inspector should
|
||||
show Curie's nodes under the window. *Why first:* the whole bridge rests on
|
||||
show Reaktor's nodes under the window. *Why first:* the whole bridge rests on
|
||||
one assumption — that setting `accessibilityChildren` on SDL's content view
|
||||
is enough, with no subclass and no swizzle. If AppKit ignores it for that
|
||||
view, nothing is exposed and there is no error to see. Everything else is
|
||||
@@ -592,7 +592,7 @@ and reaches the most readers.
|
||||
- ~~**Live regions.**~~ The Diagnostics page turned out to have the opposite
|
||||
problem: its readings were not in the tree at all, so a reader got the prose
|
||||
and not one number. Each row is now a `label` node carrying the name and the
|
||||
value and spanning both columns, marked `CURIE_A11Y_VOLATILE` — it changes on
|
||||
value and spanning both columns, marked `REAKTOR_A11Y_VOLATILE` — it changes on
|
||||
its own and the change is not news. The web bridge writes that out as
|
||||
`aria-live="off"`, which is the default for anything that is not a live
|
||||
region and so says only what was intended; it earns its keep at 4b, where a
|
||||
|
||||
+42
-42
@@ -39,7 +39,7 @@ somewhere else works right up until a theme change reloads the sheets and
|
||||
undoes it.
|
||||
|
||||
**Style lookups are cached, and the rule store is rebuilt per load.** A
|
||||
resolved selector is kept in a small fixed cache; `curie_style_init()` destroys
|
||||
resolved selector is kept in a small fixed cache; `reaktor_style_init()` destroys
|
||||
and re-creates libcss's rule store on every call, because parsing adds rules to
|
||||
a global store and nothing takes the previous sheet's rules back out. Without
|
||||
that, switching schemes stacked another copy of tiny.css each time.
|
||||
@@ -54,7 +54,7 @@ What sets `dirty`:
|
||||
|
||||
- a widget the shell knows about being clicked, typed into or dragged;
|
||||
- the pointer crossing one of the **hot rectangles** registered during the
|
||||
previous frame (`curie_hot()` and friends) — that is how hover states repaint
|
||||
previous frame (`reaktor_hot()` and friends) — that is how hover states repaint
|
||||
without polling;
|
||||
- the window moving, resizing or changing scheme.
|
||||
|
||||
@@ -75,7 +75,7 @@ reads stale for exactly as long as the app is quiet.
|
||||
|
||||
Five sizes are baked — 12, 13, 14, 16 and 19px — at the display scale, into a
|
||||
single Nuklear atlas texture, plus one face of `Aileron-Bold.otf` at 16px for
|
||||
the titlebar's name. `curie_font(app, px, bold)` returns the nearest baked
|
||||
the titlebar's name. `reaktor_font(app, px, bold)` returns the nearest baked
|
||||
size; `bold` is honoured only at that one size, because a bold at all five
|
||||
would put a second set of faces in the atlas and roughly double the largest
|
||||
allocation the app makes. The one extra face left the atlas where it was:
|
||||
@@ -114,7 +114,7 @@ in `src/nk_sdl3_renderer.h`, which was vendored for this: the format is chosen
|
||||
inside `nk_sdl_font_stash_end`. It has since picked up the rest of what the
|
||||
renderer section below describes — a white texel of its own, vertices on the
|
||||
grid for the software path, glyph quads on the grid for hardware, and fills and
|
||||
strokes feathered separately — every hunk marked `CURIE`.
|
||||
strokes feathered separately — every hunk marked `REAKTOR`.
|
||||
|
||||
Three things were verified before taking it, and are worth re-checking after
|
||||
any re-vendor:
|
||||
@@ -125,7 +125,7 @@ any re-vendor:
|
||||
glyph would render white. Check a screen with text in several colours.
|
||||
- **Fractional display scales still look right.** D3D11 forces
|
||||
`SDL_SCALEMODE_NEAREST` for indexed textures and does linear filtering in the
|
||||
palette shader instead. Checked at `CURIE_SCALE=1.5`.
|
||||
palette shader instead. Checked at `REAKTOR_SCALE=1.5`.
|
||||
|
||||
It buys about 0.4 MB on the reference machine and nothing on a GPU, where the
|
||||
atlas is VRAM.
|
||||
@@ -145,8 +145,8 @@ a hexagon with the radiation trefoil in its counter. It is authored art, checked
|
||||
in as SVG, PNG and `.ico` in two inks — six files, none of them generated at
|
||||
build time.
|
||||
|
||||
**The app uses one of them: `curie-icon.png`, the dark ink**, named once as
|
||||
`CURIE_MARK` in `src/curie.h`. The mark carries its own colours and sits on a
|
||||
**The app uses one of them: `reaktor-icon.png`, the dark ink**, named once as
|
||||
`REAKTOR_MARK` in `src/reaktor.h`. The mark carries its own colours and sits on a
|
||||
yellow ground, so it reads on either theme; a title bar that swapped inks with
|
||||
the theme just made the same logo look like two logos. The light-ink files stay
|
||||
in `branding/` for whatever needs a mark on a dark ground — a slide, a README on
|
||||
@@ -157,13 +157,13 @@ circle, where SVG says it starts at three o'clock. The mark's C is a ring with
|
||||
an 84° wedge left out by `stroke-dasharray`, so plutosvg renders it a quarter
|
||||
turn off — the opening lands at the top and the C reads as a U. Nothing else in
|
||||
the app hits this, because the Ionicons draw arcs as path data rather than as
|
||||
dashes, and the PNG has no argument with any renderer. `curie_image_surface`
|
||||
dashes, and the PNG has no argument with any renderer. `reaktor_image_surface`
|
||||
loads it through plutovg's own image reader and box-filters it down: bilinear
|
||||
would sample four texels out of the 28×28 block that 1024px collapses into at
|
||||
title-bar size.
|
||||
|
||||
The dash bug is not a reason to change renderer, and the field was surveyed
|
||||
before deciding that. What Curie needs is small — the 22 Ionicons it draws use
|
||||
before deciding that. What Reaktor needs is small — the 22 Ionicons it draws use
|
||||
`path`, `line`, `circle`, `polyline` and `rect` with stroke width, cap, join and
|
||||
miterlimit, nothing else — so the question is not features but rasteriser
|
||||
quality at 16-18px, licence, and whether anyone still maintains it.
|
||||
@@ -180,7 +180,7 @@ quality at 16-18px, licence, and whether anyone still maintains it.
|
||||
|
||||
**ThorVG is the one that would work.** MIT, actively maintained, a C API
|
||||
(`tvg_swcanvas_set_target` renders into a caller-owned buffer),
|
||||
`TVG_COLORSPACE_ARGB8888S` gives straight alpha directly so `curie_unpremultiply`
|
||||
`TVG_COLORSPACE_ARGB8888S` gives straight alpha directly so `reaktor_unpremultiply`
|
||||
could go, it loads PNG as well as SVG so it would cover the mark too, and it
|
||||
builds for WebAssembly. Its SVG Tiny 1.2 coverage is a superset of what the
|
||||
icons use. The cost is that the core is C++ — though this build already links as
|
||||
@@ -195,7 +195,7 @@ Three places consume the mark, and one constant keeps them from drifting apart:
|
||||
|
||||
- the title bar, at `MARK_SIZE`;
|
||||
- `SDL_SetWindowIcon`, at 64px, for the task bar and Alt-Tab;
|
||||
- `curie-icon.ico`, copied into the build directory and named by a two-line
|
||||
- `reaktor-icon.ico`, copied into the build directory and named by a two-line
|
||||
generated `.rc` — Explorer takes the icon from a linked Win32 resource, so it
|
||||
has to exist before the linker runs.
|
||||
|
||||
@@ -216,8 +216,8 @@ constants, CSS lengths, hit tests and mouse coordinates are all one unit;
|
||||
|
||||
Three pieces make that hold:
|
||||
|
||||
- `curie_scale()` (`src/metrics.c`) is the one place the scale is known. It
|
||||
reads `SDL_GetWindowDisplayScale`, or `CURIE_SCALE` when that is set.
|
||||
- `reaktor_scale()` (`src/metrics.c`) is the one place the scale is known. It
|
||||
reads `SDL_GetWindowDisplayScale`, or `REAKTOR_SCALE` when that is set.
|
||||
- `apply_render_scale()` pushes it into the renderer once per scale change.
|
||||
Everything drawn afterwards is in logical units.
|
||||
- Fonts are the exception that proves it. They are **baked** at the device size
|
||||
@@ -228,10 +228,10 @@ Three pieces make that hold:
|
||||
|
||||
The window is created at `WINDOW_WIDTH × scale` rather than at the logical
|
||||
size, because `SDL_WINDOW_HIGH_PIXEL_DENSITY` gives a backbuffer in device
|
||||
pixels and a forced `CURIE_SCALE` would otherwise get a window too small for
|
||||
pixels and a forced `REAKTOR_SCALE` would otherwise get a window too small for
|
||||
its own contents.
|
||||
|
||||
Verified at `CURIE_SCALE=1`, `1.5` and `2`. What has **not** been checked is a
|
||||
Verified at `REAKTOR_SCALE=1`, `1.5` and `2`. What has **not** been checked is a
|
||||
window dragged between monitors of different scale mid-run: the event is
|
||||
handled and the font rebakes, but nobody has watched it happen — the reference
|
||||
machine is a VM with one display.
|
||||
@@ -244,7 +244,7 @@ Each is done as far as it can be, and the part that is not is named.
|
||||
**File dialogs — done.** File > Open on the Popups page calls
|
||||
`SDL_ShowOpenFileDialog`, so it is the platform's own picker, not a drawn
|
||||
imitation. SDL runs it on its own thread and calls back from there, which is
|
||||
the whole shape of `curie_file_open` / `curie_file_taken`: the callback fills
|
||||
the whole shape of `reaktor_file_open` / `reaktor_file_taken`: the callback fills
|
||||
in a buffer, publishes it with an atomic store and pushes a registered event to
|
||||
wake a loop that may be parked in `SDL_WaitEvent`; the main thread collects it
|
||||
during the next frame. Nothing else in the app is touched from that thread.
|
||||
@@ -280,9 +280,9 @@ reader on the web build gets every widget, its state and its position.
|
||||
|
||||
Underneath, every widget now reports itself as it is drawn, into the shadow tree
|
||||
in `src/a11y.c` — role, name, value, state, bounds — which is diffed against the
|
||||
previous frame. `CURIE_A11Y_DUMP=<path>` writes it out, and that is how the
|
||||
previous frame. `REAKTOR_A11Y_DUMP=<path>` writes it out, and that is how the
|
||||
instrumentation is checked, because none of it shows on screen. The seam is
|
||||
`hot()` in `showcase.c` and the `curie_*` helpers in the shell: a widget that
|
||||
`hot()` in `showcase.c` and the `reaktor_*` helpers in the shell: a widget that
|
||||
takes a cursor reports a name in the same call, which is what stops the tree
|
||||
falling behind the screen.
|
||||
|
||||
@@ -317,20 +317,20 @@ same view every time instead of being clicked into place.
|
||||
|
||||
| Variable | Effect |
|
||||
| --- | --- |
|
||||
| `CURIE_TAB` | Which tab opens (0 = Login … 6 = Diagnostics) |
|
||||
| `CURIE_SCROLL` | How far that page starts scrolled |
|
||||
| `CURIE_THEME` | 0 system, 1 light, 2 dark |
|
||||
| `CURIE_SCALE` | Overrides the display scale, in the spirit of `GDK_SCALE` |
|
||||
| `CURIE_ROOT` | Where the assets are, if not found by walking up to `.curie-root` |
|
||||
| `CURIE_VSYNC` | `0` turns vsync off |
|
||||
| `CURIE_AA` | `0` turns Nuklear's anti-aliasing off |
|
||||
| `CURIE_SW_NOAA` | `1` turns stroke feathering off too on the software renderer, which feathers no fills — see the renderer section |
|
||||
| `CURIE_FRAME_RATE` | A frame cap, or `0` for uncapped, instead of `waitevent` |
|
||||
| `CURIE_REDRAW` | `always` draws every callback — for profiling, not for use |
|
||||
| `CURIE_A11Y_DUMP` | A path to write the accessibility tree to, once, after the first frame |
|
||||
| `CURIE_HOVER_GAP_MS` | Pins the pointer-redraw gap and skips its calibration — for measuring, not for use |
|
||||
| `CURIE_RENDERER` | `auto`, `cpu`, `gpu`, `list`, or a driver name — see the renderer section |
|
||||
| `CURIE_STATS` | Logs frame timings once a second |
|
||||
| `REAKTOR_TAB` | Which tab opens (0 = Login … 6 = Diagnostics) |
|
||||
| `REAKTOR_SCROLL` | How far that page starts scrolled |
|
||||
| `REAKTOR_THEME` | 0 system, 1 light, 2 dark |
|
||||
| `REAKTOR_SCALE` | Overrides the display scale, in the spirit of `GDK_SCALE` |
|
||||
| `REAKTOR_ROOT` | Where the assets are, if not found by walking up to `.reaktor-root` |
|
||||
| `REAKTOR_VSYNC` | `0` turns vsync off |
|
||||
| `REAKTOR_AA` | `0` turns Nuklear's anti-aliasing off |
|
||||
| `REAKTOR_SW_NOAA` | `1` turns stroke feathering off too on the software renderer, which feathers no fills — see the renderer section |
|
||||
| `REAKTOR_FRAME_RATE` | A frame cap, or `0` for uncapped, instead of `waitevent` |
|
||||
| `REAKTOR_REDRAW` | `always` draws every callback — for profiling, not for use |
|
||||
| `REAKTOR_A11Y_DUMP` | A path to write the accessibility tree to, once, after the first frame |
|
||||
| `REAKTOR_HOVER_GAP_MS` | Pins the pointer-redraw gap and skips its calibration — for measuring, not for use |
|
||||
| `REAKTOR_RENDERER` | `auto`, `cpu`, `gpu`, `list`, or a driver name — see the renderer section |
|
||||
| `REAKTOR_STATS` | Logs frame timings once a second |
|
||||
|
||||
The Diagnostics tab reports all of it, plus where each frame's milliseconds
|
||||
went and where the memory went. Prefer it to a guess: several plausible
|
||||
@@ -372,7 +372,7 @@ Same sources, same `CMakeLists.txt`. The Emscripten-specific parts:
|
||||
The reference machine has no GPU. Left to Direct3D, every presented frame is
|
||||
rasterised in software by the display driver's user-mode part, which runs
|
||||
*inside this process* on Windows thread-pool threads — measured at **about 78 ms
|
||||
of CPU per frame**, of which Curie, Nuklear and SDL together are 4–5 ms on the
|
||||
of CPU per frame**, of which Reaktor, Nuklear and SDL together are 4–5 ms on the
|
||||
main thread. `auto` now sidesteps that by taking SDL's own software renderer
|
||||
when the adapter is WARP (renderer section above), which draws the same frame
|
||||
for **7–12 ms**. That is still a frame every time the pointer crosses something,
|
||||
@@ -400,11 +400,11 @@ cores, this machine:
|
||||
|
||||
`calibrate_hover_gap` skips the first three drawn frames after startup (font
|
||||
bake, stylesheet parse), then averages the process's CPU time — every thread,
|
||||
via `curie_process_cpu_ms` — over the next eight, and sets the gap from the
|
||||
via `reaktor_process_cpu_ms` — over the next eight, and sets the gap from the
|
||||
result: 150 ms above 40 ms a frame, 100 ms above 15, 50 ms otherwise. Here it
|
||||
measures ~62–78 ms and picks 150; on a GPU it will measure well under a
|
||||
millisecond and keep 50, which is there only to bound a hover storm. The
|
||||
Diagnostics page shows both numbers. `CURIE_HOVER_GAP_MS` pins the gap and
|
||||
Diagnostics page shows both numbers. `REAKTOR_HOVER_GAP_MS` pins the gap and
|
||||
skips the calibration, which is how the table above was taken.
|
||||
|
||||
Why measure rather than detect the adapter: the same binary has to do the
|
||||
@@ -461,7 +461,7 @@ getting for free from the event whitelist.
|
||||
|
||||
## The renderer, and the one that was six times cheaper
|
||||
|
||||
`CURIE_RENDERER` takes `auto` (the default), `cpu`, `gpu`, `list`, or the name
|
||||
`REAKTOR_RENDERER` takes `auto` (the default), `cpu`, `gpu`, `list`, or the name
|
||||
of any driver this SDL build has — on Windows `direct3d11`, `opengl`,
|
||||
`opengles2`, `software`. A name that is not in the list, or one that is listed
|
||||
but will not create (both GL drivers fail on a VM with no 3D), logs a line and
|
||||
@@ -471,7 +471,7 @@ falls back rather than refusing to start.
|
||||
`direct3d11` backend falls back to WARP, Microsoft's software implementation,
|
||||
so the app pays for a full D3D11 pipeline and a WDDM swapchain present to draw
|
||||
a few hundred flat triangles. The adapter says so plainly:
|
||||
`Microsoft Basic Render Driver`, vendor `0x1414`, 0 MB dedicated. Curie asks
|
||||
`Microsoft Basic Render Driver`, vendor `0x1414`, 0 MB dedicated. Reaktor asks
|
||||
the device SDL gave it and reports it — Diagnostics shows `auto (no GPU)` —
|
||||
because it is most of the explanation for every CPU figure in
|
||||
[PERFORMANCE.md](PERFORMANCE.md).
|
||||
@@ -508,7 +508,7 @@ separately (`nk_sdl_render_ex`) and the software renderer runs **strokes
|
||||
feathered, fills not.** Measured across a popup's edge it then matches the
|
||||
hardware profile pixel for pixel — `53 53 53 53…` on both — and the profile
|
||||
between menu items is flat. Both on gives the column and the rule; both off
|
||||
gives corners that step in twos. `CURIE_SW_NOAA=1` is both off, and 6% cheaper.
|
||||
gives corners that step in twos. `REAKTOR_SW_NOAA=1` is both off, and 6% cheaper.
|
||||
|
||||
One consequence to know about when adding a widget: Nuklear draws most borders
|
||||
as two *fills* — the border colour, then the background shrunk by the width —
|
||||
@@ -523,7 +523,7 @@ rim there at the final height — anything drawn inside it earlier is painted
|
||||
over — and a 1px rim reaches only half a pixel either side of the arc, which is
|
||||
exactly where the unfeathered fill's corner steps are.
|
||||
|
||||
A colour swatch (`curie_button_color`) is the button rule with the fill
|
||||
A colour swatch (`reaktor_button_color`) is the button rule with the fill
|
||||
replaced and the border tinted to match. The border is a *fill band* here, so
|
||||
the swatch's own arc would otherwise sit at `rounding - border` — measurably
|
||||
identical to its neighbour on the outside, and visibly tighter, because a grey
|
||||
@@ -534,7 +534,7 @@ band puts the visible edge back on the button's outer arc.
|
||||
footprint is the older remedy and still what the text fields use, but it only
|
||||
grades the step by a fixed half: the snapping pass quantises the stroke's
|
||||
feather onto the same staircase the fill made, so a large radius reads as
|
||||
stairs with a halo rather than a curve. `curie_fill_round` computes the
|
||||
stairs with a halo rather than a curve. `reaktor_fill_round` computes the
|
||||
coverage instead — one white disc of 2r whose alpha is the circle sampled four
|
||||
by four, each quadrant drawn into a corner as a sub-image, three plain rects
|
||||
for the rest — so the corner is exact at any radius and identical on both
|
||||
@@ -553,7 +553,7 @@ texel on both backends, so every circle on a page — a radio's rim and dot, a
|
||||
combo's leading symbol, a selectable's — is an Ionicon drawn into the slot
|
||||
Nuklear sized, with `NK_SYMBOL_NONE` handed to the widget. Two details make or
|
||||
break it. The icon is rasterised **1:1** with the rect it is drawn in
|
||||
(`curie_ionicon_exact`, against `icon`'s usual 2×): a downscale re-samples
|
||||
(`reaktor_ionicon_exact`, against `icon`'s usual 2×): a downscale re-samples
|
||||
plutovg's antialiasing, and on a rim one pixel wide that reads as a smear three
|
||||
pixels across. And `nk_draw_option` fills the whole selector with
|
||||
`border_color` before the background, without asking whether there is a border,
|
||||
@@ -614,7 +614,7 @@ when the Direct3D device turns out to be WARP — and reports itself as
|
||||
fills unfeathered, what separates it from hardware is the accepted stroke
|
||||
feather above, and six times the CPU is not worth that. A machine with a GPU
|
||||
keeps it: there the hardware path is both cheaper and the better picture. A
|
||||
driver named in `CURIE_RENDERER` is never swapped.
|
||||
driver named in `REAKTOR_RENDERER` is never swapped.
|
||||
|
||||
## A held button that changes nothing
|
||||
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
# Third-party notices
|
||||
|
||||
Curie itself is MIT (see [LICENSE](../LICENSE)). Everything it is built on is
|
||||
Reaktor itself is MIT (see [LICENSE](../LICENSE)). Everything it is built on is
|
||||
a git submodule under `third_party/`, used as it ships. Each licence below was
|
||||
read from that project's own licence file in the pinned revision, not from its
|
||||
README or its website.
|
||||
@@ -43,7 +43,7 @@ same way.
|
||||
`src/nk_sdl3_renderer.h` is Nuklear's SDL3 backend, copied from
|
||||
`third_party/nuklear/demo/sdl3_renderer/` and covered by Nuklear's licence
|
||||
above — MIT or public domain, at your option. It differs from upstream in a
|
||||
handful of hunks, each marked `CURIE`: the font atlas is baked and uploaded
|
||||
handful of hunks, each marked `REAKTOR`: the font atlas is baked and uploaded
|
||||
8-bit indexed rather than RGBA32; untextured geometry samples a 1x1 white
|
||||
texture of its own instead of a texel in the atlas; on the software renderer
|
||||
every vertex is put on the pixel grid; on hardware, glyph quads are; and
|
||||
@@ -103,7 +103,7 @@ MIT terms above, all of which are satisfied by shipping this file with it.
|
||||
|
||||
The application does **not** embed the stylesheet, the icons, the mark or the
|
||||
font: it opens them at runtime from the submodule checkout, resolved relative to the
|
||||
`.curie-root` marker. A distributable build has to ship those files alongside
|
||||
`.reaktor-root` marker. A distributable build has to ship those files alongside
|
||||
the binary. The WebAssembly build is the exception — Emscripten packages the
|
||||
handful of files actually referenced into `curie.data`, which is why that
|
||||
handful of files actually referenced into `reaktor.data`, which is why that
|
||||
bundle needs no checkout beside it.
|
||||
|
||||
+15
-15
@@ -16,11 +16,11 @@ Reproduce any of it from the **Diagnostics** tab.
|
||||
|
||||
| Artefact | Bytes |
|
||||
| --- | --- |
|
||||
| `curie.exe` | 2,406,400 |
|
||||
| `curie.wasm` | 1,205,355 |
|
||||
| `curie.js` | 76,228 |
|
||||
| `curie.data` | 47,263 |
|
||||
| `curie.html` | 1,019 |
|
||||
| `reaktor.exe` | 2,406,400 |
|
||||
| `reaktor.wasm` | 1,205,355 |
|
||||
| `reaktor.js` | 76,228 |
|
||||
| `reaktor.data` | 47,263 |
|
||||
| `reaktor.html` | 1,019 |
|
||||
| **Web bundle, total** | **1,329,865** |
|
||||
|
||||
SDL, libcss, yutil, plutosvg and plutovg link statically and Nuklear compiles
|
||||
@@ -29,7 +29,7 @@ the subsystems this app uses, and dropping the render backends it can never
|
||||
select, took it from 3.39 MB.
|
||||
|
||||
The web bundle was 3.55 MB before `-Oz` with `--closure 1` and packaging only
|
||||
the asset files the sources actually name — `curie.data` alone fell from
|
||||
the asset files the sources actually name — `reaktor.data` alone fell from
|
||||
1,868,661 bytes.
|
||||
|
||||
## Memory
|
||||
@@ -74,7 +74,7 @@ The four reasons they died:
|
||||
list inside pages that stay committed. Only allocations above the NT heap's
|
||||
~512 KB threshold are genuinely returned.
|
||||
2. **`.text`, `.rdata`, `.rsrc` and untouched `.bss` cost zero private bytes.**
|
||||
They are clean and file-backed. The entire writable section of `curie.exe`
|
||||
They are clean and file-backed. The entire writable section of `reaktor.exe`
|
||||
is 53,616 bytes, which caps what any code-size change could move.
|
||||
3. **GPU allocations are not process heap** — on hardware. Here they are, per
|
||||
the note at the top, which is why the atlas work paid at all.
|
||||
@@ -120,7 +120,7 @@ Three things that settles:
|
||||
window size. Not slop: it is what `PrivateUsage` counts and `VirtualQuery`
|
||||
does not expose — page tables and per-process structures.
|
||||
- **1.25 MB is copy-on-write image pages** over about fifty DLLs, 8–105 KB
|
||||
each; `curie.exe` contributes 47 KB. Loader cost, and nothing here reduces it.
|
||||
each; `reaktor.exe` contributes 47 KB. Loader cost, and nothing here reduces it.
|
||||
- **Twelve threads, none of them ours.** SDL, COM and the graphics stack create
|
||||
them. 0.30 MB of stack commit against 11.7 MB of reserve — the number to
|
||||
quote whenever someone proposes `/STACK`.
|
||||
@@ -171,7 +171,7 @@ costs 1.4–2.0% — the loop itself is nearly free.)
|
||||
**A drawn frame costs 7–12 ms of CPU on this machine** — 7 on the login card,
|
||||
12 on the busiest page — now that `auto` takes SDL's software renderer when the
|
||||
adapter is WARP. Left to Direct3D it was **78 ms**, and almost none of that was
|
||||
Curie's: with no GPU, `direct3d11` runs on WARP and the frame is rasterised in
|
||||
Reaktor's: with no GPU, `direct3d11` runs on WARP and the frame is rasterised in
|
||||
software by the display stack, inside this process, on Windows thread-pool
|
||||
threads — the main thread was 3.6–4.7% of it and `ntdll`'s threads ~83%.
|
||||
The renderer section of [DEVELOPMENT.md](DEVELOPMENT.md) is the account of
|
||||
@@ -185,8 +185,8 @@ fixed rates:
|
||||
| 5–10 fps | | | 38–85%, 75–85 ms/frame |
|
||||
|
||||
Linear in frames either way. (An earlier note here read "the same with
|
||||
`CURIE_RENDERER=software`, 83 vs 85 ms, which rules the SDL renderer out"; that
|
||||
was wrong — `CURIE_RENDERER` did not accept `software` at the time, so both arms
|
||||
`REAKTOR_RENDERER=software`, 83 vs 85 ms, which rules the SDL renderer out"; that
|
||||
was wrong — `REAKTOR_RENDERER` did not accept `software` at the time, so both arms
|
||||
measured WARP twice.)
|
||||
|
||||
The consequence is still that **CPU is a count of frames**: a pointer swept
|
||||
@@ -235,7 +235,7 @@ Parsing both stylesheets takes 1.5–4.0 ms, at startup and on each scheme chang
|
||||
Modest by construction: one atlas texture plus one per rasterised icon, nothing
|
||||
uploaded per frame, a few hundred triangles. No shader, no framebuffer of its
|
||||
own, no compute — everything goes through `SDL_Renderer`. Anti-aliasing is
|
||||
Nuklear's, on the CPU, and `CURIE_AA=0` turns it off.
|
||||
Nuklear's, on the CPU, and `REAKTOR_AA=0` turns it off.
|
||||
|
||||
On hardware this should mean lower private bytes, a smaller present time, the
|
||||
texture rows leaving the memory table — and the 78 ms of CPU per frame above
|
||||
@@ -264,7 +264,7 @@ platform's graphics driver takes. A machine that can run a browser can run it.
|
||||
Two things a deployment needs:
|
||||
|
||||
- **The asset files.** A native build reads tiny.css and the Ionicons SVGs from
|
||||
disk at runtime, resolved against the `.curie-root` marker, so they ship
|
||||
beside the binary or `CURIE_ROOT` points at them. The web build packages them
|
||||
into `curie.data`.
|
||||
disk at runtime, resolved against the `.reaktor-root` marker, so they ship
|
||||
beside the binary or `REAKTOR_ROOT` points at them. The web build packages them
|
||||
into `reaktor.data`.
|
||||
- **A served web build.** A `file://` page cannot fetch the `.wasm`.
|
||||
|
||||
+52
-52
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "a11y.h"
|
||||
|
||||
static const char *const g_role_names[CURIE_A11Y_ROLE_COUNT] = {
|
||||
static const char *const g_role_names[REAKTOR_A11Y_ROLE_COUNT] = {
|
||||
"none", "window", "group", "tablist", "tab", "button", "link",
|
||||
"checkbox", "radio", "textbox", "slider", "spinbutton", "progress",
|
||||
"combobox", "listitem", "treeitem", "menubar", "menu", "menuitem",
|
||||
@@ -16,9 +16,9 @@ static const char *const g_role_names[CURIE_A11Y_ROLE_COUNT] = {
|
||||
};
|
||||
|
||||
const char *
|
||||
curie_a11y_role_name(unsigned char role)
|
||||
reaktor_a11y_role_name(unsigned char role)
|
||||
{
|
||||
return role < CURIE_A11Y_ROLE_COUNT ? g_role_names[role] : "?";
|
||||
return role < REAKTOR_A11Y_ROLE_COUNT ? g_role_names[role] : "?";
|
||||
}
|
||||
|
||||
/* FNV-1a. The id has to be stable across frames and cheap enough to run per
|
||||
@@ -45,22 +45,22 @@ hash_str(unsigned h, const char *s)
|
||||
* matters - two equal strings are one pointer, which is what lets the diff
|
||||
* compare names with == instead of strcmp. */
|
||||
static const char *
|
||||
intern(curie_a11y *a, const char *s, unsigned h)
|
||||
intern(reaktor_a11y *a, const char *s, unsigned h)
|
||||
{
|
||||
const unsigned mask = CURIE_A11Y_SLOTS * 2 - 1;
|
||||
const unsigned mask = REAKTOR_A11Y_SLOTS * 2 - 1;
|
||||
unsigned i = h & mask;
|
||||
|
||||
if (!s) return NULL;
|
||||
for (;;) {
|
||||
curie_a11y_slot *sl = &a->strings[i];
|
||||
reaktor_a11y_slot *sl = &a->strings[i];
|
||||
|
||||
if (sl->gen != a->pool_gen) { /* stale means empty */
|
||||
size_t n = strlen(s) + 1;
|
||||
/* Refuse rather than probe forever. The reset at the top of the
|
||||
* next frame is what actually recovers the room; this is the
|
||||
* guard for a single frame that floods it. */
|
||||
if (a->pool_entries >= CURIE_A11Y_SLOTS ||
|
||||
a->pool_used + (int)n > CURIE_A11Y_POOL) {
|
||||
if (a->pool_entries >= REAKTOR_A11Y_SLOTS ||
|
||||
a->pool_used + (int)n > REAKTOR_A11Y_POOL) {
|
||||
a->overflow_strings++;
|
||||
return NULL;
|
||||
}
|
||||
@@ -89,13 +89,13 @@ intern(curie_a11y *a, const char *s, unsigned h)
|
||||
* without clearing anything. Load never passes half - the tables are twice the
|
||||
* node arena - so a probe is one or two slots. Answers the slot for `key`,
|
||||
* fresh if it was not there. Never NULL: the arena cannot fill. */
|
||||
static curie_a11y_slot *
|
||||
slot_of(curie_a11y_slot *tab, unsigned gen, unsigned key)
|
||||
static reaktor_a11y_slot *
|
||||
slot_of(reaktor_a11y_slot *tab, unsigned gen, unsigned key)
|
||||
{
|
||||
unsigned i = key & (CURIE_A11Y_SLOTS - 1);
|
||||
unsigned i = key & (REAKTOR_A11Y_SLOTS - 1);
|
||||
|
||||
for (;;) {
|
||||
curie_a11y_slot *sl = &tab[i];
|
||||
reaktor_a11y_slot *sl = &tab[i];
|
||||
if (sl->gen != gen) { /* stale means empty */
|
||||
sl->gen = gen;
|
||||
sl->key = key;
|
||||
@@ -103,7 +103,7 @@ slot_of(curie_a11y_slot *tab, unsigned gen, unsigned key)
|
||||
return sl;
|
||||
}
|
||||
if (sl->key == key) return sl;
|
||||
i = (i + 1) & (CURIE_A11Y_SLOTS - 1);
|
||||
i = (i + 1) & (REAKTOR_A11Y_SLOTS - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,15 +112,15 @@ slot_of(curie_a11y_slot *tab, unsigned gen, unsigned key)
|
||||
* two passes over 512 nodes each fill a 1024-slot table and probe forever.
|
||||
* Answers 0 for absent, which is why the index stores i + 1. */
|
||||
static int
|
||||
slot_get(const curie_a11y_slot *tab, unsigned gen, unsigned key)
|
||||
slot_get(const reaktor_a11y_slot *tab, unsigned gen, unsigned key)
|
||||
{
|
||||
unsigned i = key & (CURIE_A11Y_SLOTS - 1);
|
||||
unsigned i = key & (REAKTOR_A11Y_SLOTS - 1);
|
||||
|
||||
for (;;) {
|
||||
const curie_a11y_slot *sl = &tab[i];
|
||||
const reaktor_a11y_slot *sl = &tab[i];
|
||||
if (sl->gen != gen) return 0;
|
||||
if (sl->key == key) return sl->val;
|
||||
i = (i + 1) & (CURIE_A11Y_SLOTS - 1);
|
||||
i = (i + 1) & (REAKTOR_A11Y_SLOTS - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,16 +131,16 @@ same_rect(struct nk_rect x, struct nk_rect y)
|
||||
}
|
||||
|
||||
static unsigned
|
||||
emit(curie_a11y *a, unsigned char role, const char *name, const char *value,
|
||||
emit(reaktor_a11y *a, unsigned char role, const char *name, const char *value,
|
||||
unsigned state, struct nk_rect bounds)
|
||||
{
|
||||
int f = a->front;
|
||||
curie_a11y_node *n;
|
||||
curie_a11y_slot *sl;
|
||||
reaktor_a11y_node *n;
|
||||
reaktor_a11y_slot *sl;
|
||||
unsigned parent, id, base, nh;
|
||||
|
||||
if (!a->building) return 0;
|
||||
if (a->count[f] >= CURIE_A11Y_MAX_NODES) {
|
||||
if (a->count[f] >= REAKTOR_A11Y_MAX_NODES) {
|
||||
a->overflow_nodes++;
|
||||
return 0;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ emit(curie_a11y *a, unsigned char role, const char *name, const char *value,
|
||||
id = base ^ ((unsigned)sl->val * 0x85ebca6bu);
|
||||
sl->val++;
|
||||
if (id == 0) id = 1; /* 0 is the window's parent, so it cannot be a node */
|
||||
if (id == a->focus_id) state |= CURIE_A11Y_FOCUSED;
|
||||
if (id == a->focus_id) state |= REAKTOR_A11Y_FOCUSED;
|
||||
|
||||
n = &a->node[f][a->count[f]++];
|
||||
n->id = id;
|
||||
@@ -182,7 +182,7 @@ emit(curie_a11y *a, unsigned char role, const char *name, const char *value,
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_set_range(curie_a11y *a, unsigned id, float num, float lo, float hi,
|
||||
reaktor_a11y_set_range(reaktor_a11y *a, unsigned id, float num, float lo, float hi,
|
||||
float step)
|
||||
{
|
||||
int f = a->front, i;
|
||||
@@ -191,7 +191,7 @@ curie_a11y_set_range(curie_a11y *a, unsigned id, float num, float lo, float hi,
|
||||
/* Backwards: the caller is decorating the node it has just reported, so
|
||||
* this is the last entry or close to it. */
|
||||
for (i = a->count[f] - 1; i >= 0; i--) {
|
||||
curie_a11y_node *n = &a->node[f][i];
|
||||
reaktor_a11y_node *n = &a->node[f][i];
|
||||
|
||||
if (n->id != id) continue;
|
||||
n->num = num; n->lo = lo; n->hi = hi; n->step = step;
|
||||
@@ -200,13 +200,13 @@ curie_a11y_set_range(curie_a11y *a, unsigned id, float num, float lo, float hi,
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_set_focus(curie_a11y *a, unsigned id)
|
||||
reaktor_a11y_set_focus(reaktor_a11y *a, unsigned id)
|
||||
{
|
||||
a->focus_id = id;
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_begin(curie_a11y *a, const char *window_name, struct nk_rect bounds)
|
||||
reaktor_a11y_begin(reaktor_a11y *a, const char *window_name, struct nk_rect bounds)
|
||||
{
|
||||
int f = a->front;
|
||||
|
||||
@@ -227,8 +227,8 @@ curie_a11y_begin(curie_a11y *a, const char *window_name, struct nk_rect bounds)
|
||||
* paid only by a page that churns thousands of distinct strings. Done here
|
||||
* rather than mid-frame, where nodes already emitted would be left holding
|
||||
* offsets about to be overwritten. */
|
||||
if (a->pool_used > CURIE_A11Y_POOL - CURIE_A11Y_POOL / 4 ||
|
||||
a->pool_entries >= CURIE_A11Y_SLOTS) {
|
||||
if (a->pool_used > REAKTOR_A11Y_POOL - REAKTOR_A11Y_POOL / 4 ||
|
||||
a->pool_entries >= REAKTOR_A11Y_SLOTS) {
|
||||
a->pool_used = 0;
|
||||
a->pool_entries = 0;
|
||||
a->pool_gen++;
|
||||
@@ -237,18 +237,18 @@ curie_a11y_begin(curie_a11y *a, const char *window_name, struct nk_rect bounds)
|
||||
|
||||
/* The window is the root, emitted here so no caller has to remember to,
|
||||
* and pushed so everything after it has a parent. */
|
||||
curie_a11y_push(a, CURIE_A11Y_WINDOW, window_name, NULL, 0, bounds);
|
||||
reaktor_a11y_push(a, REAKTOR_A11Y_WINDOW, window_name, NULL, 0, bounds);
|
||||
}
|
||||
|
||||
unsigned
|
||||
curie_a11y_add(curie_a11y *a, unsigned char role, const char *name,
|
||||
reaktor_a11y_add(reaktor_a11y *a, unsigned char role, const char *name,
|
||||
const char *value, unsigned state, struct nk_rect bounds)
|
||||
{
|
||||
return emit(a, role, name, value, state, bounds);
|
||||
}
|
||||
|
||||
unsigned
|
||||
curie_a11y_push(curie_a11y *a, unsigned char role, const char *name,
|
||||
reaktor_a11y_push(reaktor_a11y *a, unsigned char role, const char *name,
|
||||
const char *value, unsigned state, struct nk_rect bounds)
|
||||
{
|
||||
unsigned id = emit(a, role, name, value, state, bounds);
|
||||
@@ -256,14 +256,14 @@ curie_a11y_push(curie_a11y *a, unsigned char role, const char *name,
|
||||
/* Past the limit the node is still emitted flat rather than dropped, and
|
||||
* the pop that follows is absorbed below. Nesting deeper than this means a
|
||||
* bug, not a page. */
|
||||
if (a->depth < CURIE_A11Y_MAX_DEPTH)
|
||||
if (a->depth < REAKTOR_A11Y_MAX_DEPTH)
|
||||
a->parent[a->depth] = id;
|
||||
a->depth++;
|
||||
return id;
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_pop(curie_a11y *a)
|
||||
reaktor_a11y_pop(reaktor_a11y *a)
|
||||
{
|
||||
if (a->depth > 0) a->depth--;
|
||||
}
|
||||
@@ -271,9 +271,9 @@ curie_a11y_pop(curie_a11y *a)
|
||||
/* --- the diff ----------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
change(curie_a11y *a, unsigned char kind, unsigned id, int index)
|
||||
change(reaktor_a11y *a, unsigned char kind, unsigned id, int index)
|
||||
{
|
||||
if (a->change_count >= CURIE_A11Y_MAX_CHANGES) return;
|
||||
if (a->change_count >= REAKTOR_A11Y_MAX_CHANGES) return;
|
||||
a->change[a->change_count].kind = kind;
|
||||
a->change[a->change_count].id = id;
|
||||
a->change[a->change_count].index = index;
|
||||
@@ -281,10 +281,10 @@ change(curie_a11y *a, unsigned char kind, unsigned id, int index)
|
||||
}
|
||||
|
||||
int
|
||||
curie_a11y_end(curie_a11y *a)
|
||||
reaktor_a11y_end(reaktor_a11y *a)
|
||||
{
|
||||
int f = a->front, b = 1 - a->front;
|
||||
const curie_a11y_node *cur = a->node[f], *old = a->node[b];
|
||||
const reaktor_a11y_node *cur = a->node[f], *old = a->node[b];
|
||||
int ncur = a->count[f], nold = a->count[b];
|
||||
int i;
|
||||
|
||||
@@ -315,7 +315,7 @@ curie_a11y_end(curie_a11y *a)
|
||||
unsigned up = cur[i].parent;
|
||||
int guard = 0;
|
||||
|
||||
while (guard++ <= CURIE_A11Y_MAX_DEPTH) {
|
||||
while (guard++ <= REAKTOR_A11Y_MAX_DEPTH) {
|
||||
int k = up ? slot_get(a->index, a->index_gen, up) - 1 : 0;
|
||||
struct nk_rect v;
|
||||
|
||||
@@ -323,7 +323,7 @@ curie_a11y_end(curie_a11y *a)
|
||||
v = cur[k].bounds;
|
||||
if (b.x + b.w <= v.x || b.x >= v.x + v.w ||
|
||||
b.y + b.h <= v.y || b.y >= v.y + v.h) {
|
||||
a->node[f][i].state |= CURIE_A11Y_OFFSCREEN;
|
||||
a->node[f][i].state |= REAKTOR_A11Y_OFFSCREEN;
|
||||
break;
|
||||
}
|
||||
if (!up) break; /* reached the window */
|
||||
@@ -348,19 +348,19 @@ curie_a11y_end(curie_a11y *a)
|
||||
* hundred unrelated additions where it is one. */
|
||||
if (!cur[i].parent ||
|
||||
slot_get(a->index, a->index_gen, cur[i].parent) > 0)
|
||||
change(a, CURIE_A11Y_ADDED, cur[i].id, i);
|
||||
change(a, REAKTOR_A11Y_ADDED, cur[i].id, i);
|
||||
continue;
|
||||
}
|
||||
a->matched[j] = 1;
|
||||
if (!same_str(cur[i].name, old[j].name) ||
|
||||
!same_str(cur[i].value, old[j].value))
|
||||
change(a, CURIE_A11Y_RENAMED, cur[i].id, i);
|
||||
change(a, REAKTOR_A11Y_RENAMED, cur[i].id, i);
|
||||
if (cur[i].state != old[j].state)
|
||||
change(a, CURIE_A11Y_RESTATED, cur[i].id, i);
|
||||
change(a, REAKTOR_A11Y_RESTATED, cur[i].id, i);
|
||||
else if (!same_rect(cur[i].bounds, old[j].bounds))
|
||||
/* Only when nothing more interesting happened: a client that has
|
||||
* to re-read a node for its state will re-read its bounds too. */
|
||||
change(a, CURIE_A11Y_MOVED, cur[i].id, i);
|
||||
change(a, REAKTOR_A11Y_MOVED, cur[i].id, i);
|
||||
}
|
||||
for (i = 0; i < nold; i++) {
|
||||
if (a->matched[i]) continue;
|
||||
@@ -371,7 +371,7 @@ curie_a11y_end(curie_a11y *a)
|
||||
int up = slot_get(a->index, a->index_gen, old[i].parent) - 1;
|
||||
if (up >= 0 && !a->matched[up]) continue;
|
||||
}
|
||||
change(a, CURIE_A11Y_REMOVED, old[i].id, i);
|
||||
change(a, REAKTOR_A11Y_REMOVED, old[i].id, i);
|
||||
}
|
||||
|
||||
a->front = b;
|
||||
@@ -380,19 +380,19 @@ curie_a11y_end(curie_a11y *a)
|
||||
|
||||
/* --- reading it back ---------------------------------------------------- */
|
||||
|
||||
/* After the swap in curie_a11y_end the frame just described is the back half,
|
||||
/* After the swap in reaktor_a11y_end the frame just described is the back half,
|
||||
* so both of these read 1 - front. Between begin and end they read the half
|
||||
* being filled, which is what a caller mid-frame means. */
|
||||
const curie_a11y_node *
|
||||
curie_a11y_tree(const curie_a11y *a, int *count)
|
||||
const reaktor_a11y_node *
|
||||
reaktor_a11y_tree(const reaktor_a11y *a, int *count)
|
||||
{
|
||||
int f = a->building ? a->front : 1 - a->front;
|
||||
if (count) *count = a->count[f];
|
||||
return a->node[f];
|
||||
}
|
||||
|
||||
const curie_a11y_change *
|
||||
curie_a11y_changes(const curie_a11y *a, int *count)
|
||||
const reaktor_a11y_change *
|
||||
reaktor_a11y_changes(const reaktor_a11y *a, int *count)
|
||||
{
|
||||
if (count) *count = a->change_count;
|
||||
return a->change;
|
||||
@@ -424,17 +424,17 @@ state_text(unsigned state, char *out, size_t cap)
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_dump(const curie_a11y *a, FILE *out)
|
||||
reaktor_a11y_dump(const reaktor_a11y *a, FILE *out)
|
||||
{
|
||||
int n = 0, i;
|
||||
const curie_a11y_node *t = curie_a11y_tree(a, &n);
|
||||
const reaktor_a11y_node *t = reaktor_a11y_tree(a, &n);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
char st[128];
|
||||
int pad = t[i].level * 2;
|
||||
|
||||
state_text(t[i].state, st, sizeof(st));
|
||||
fprintf(out, "%*s%s", pad, "", curie_a11y_role_name(t[i].role));
|
||||
fprintf(out, "%*s%s", pad, "", reaktor_a11y_role_name(t[i].role));
|
||||
if (t[i].name) fprintf(out, " \"%s\"", t[i].name);
|
||||
if (t[i].value) fprintf(out, " = \"%s\"", t[i].value);
|
||||
if (st[0]) fprintf(out, " [%s]", st + 1);
|
||||
|
||||
+80
-80
@@ -10,14 +10,14 @@
|
||||
*
|
||||
* Phases 1 and 2 of docs/ACCESSIBILITY.md: the model, the diff, and every
|
||||
* widget reporting into it. No platform reads it yet - that is phase 4 - so
|
||||
* for now it is verified by curie_a11y_dump, which writes the tree as text.
|
||||
* for now it is verified by reaktor_a11y_dump, which writes the tree as text.
|
||||
*
|
||||
* It runs unconditionally. Describing the busiest page costs about four
|
||||
* microseconds against a frame that takes 1.3 ms to build, which is below what
|
||||
* the app's own frame timer can even resolve, so there is nothing here worth
|
||||
* making optional. */
|
||||
#ifndef CURIE_A11Y_H
|
||||
#define CURIE_A11Y_H
|
||||
#ifndef REAKTOR_A11Y_H
|
||||
#define REAKTOR_A11Y_H
|
||||
|
||||
#include "nk_common.h"
|
||||
#include <stdio.h>
|
||||
@@ -26,40 +26,40 @@
|
||||
* role that cannot be mapped onto UIA, AT-SPI and ARIA alike is not worth
|
||||
* carrying. */
|
||||
enum {
|
||||
CURIE_A11Y_NONE = 0,
|
||||
CURIE_A11Y_WINDOW,
|
||||
CURIE_A11Y_GROUP,
|
||||
CURIE_A11Y_TABLIST,
|
||||
CURIE_A11Y_TAB,
|
||||
CURIE_A11Y_BUTTON,
|
||||
CURIE_A11Y_LINK,
|
||||
CURIE_A11Y_CHECKBOX,
|
||||
CURIE_A11Y_RADIO,
|
||||
CURIE_A11Y_TEXTBOX,
|
||||
CURIE_A11Y_SLIDER,
|
||||
CURIE_A11Y_SPINBUTTON,
|
||||
CURIE_A11Y_PROGRESS,
|
||||
CURIE_A11Y_COMBOBOX,
|
||||
CURIE_A11Y_LISTITEM,
|
||||
CURIE_A11Y_TREEITEM,
|
||||
CURIE_A11Y_MENUBAR,
|
||||
CURIE_A11Y_MENU,
|
||||
CURIE_A11Y_MENUITEM,
|
||||
CURIE_A11Y_DIALOG,
|
||||
CURIE_A11Y_LABEL,
|
||||
CURIE_A11Y_ROLE_COUNT
|
||||
REAKTOR_A11Y_NONE = 0,
|
||||
REAKTOR_A11Y_WINDOW,
|
||||
REAKTOR_A11Y_GROUP,
|
||||
REAKTOR_A11Y_TABLIST,
|
||||
REAKTOR_A11Y_TAB,
|
||||
REAKTOR_A11Y_BUTTON,
|
||||
REAKTOR_A11Y_LINK,
|
||||
REAKTOR_A11Y_CHECKBOX,
|
||||
REAKTOR_A11Y_RADIO,
|
||||
REAKTOR_A11Y_TEXTBOX,
|
||||
REAKTOR_A11Y_SLIDER,
|
||||
REAKTOR_A11Y_SPINBUTTON,
|
||||
REAKTOR_A11Y_PROGRESS,
|
||||
REAKTOR_A11Y_COMBOBOX,
|
||||
REAKTOR_A11Y_LISTITEM,
|
||||
REAKTOR_A11Y_TREEITEM,
|
||||
REAKTOR_A11Y_MENUBAR,
|
||||
REAKTOR_A11Y_MENU,
|
||||
REAKTOR_A11Y_MENUITEM,
|
||||
REAKTOR_A11Y_DIALOG,
|
||||
REAKTOR_A11Y_LABEL,
|
||||
REAKTOR_A11Y_ROLE_COUNT
|
||||
};
|
||||
|
||||
/* State bits. Absent means the state does not apply, not that it is false -
|
||||
* a button is neither checked nor unchecked. */
|
||||
enum {
|
||||
CURIE_A11Y_FOCUSED = 1u << 0,
|
||||
CURIE_A11Y_CHECKED = 1u << 1,
|
||||
CURIE_A11Y_EXPANDED = 1u << 2,
|
||||
CURIE_A11Y_SELECTED = 1u << 3,
|
||||
CURIE_A11Y_DISABLED = 1u << 4,
|
||||
CURIE_A11Y_READONLY = 1u << 5,
|
||||
CURIE_A11Y_OFFSCREEN = 1u << 6, /* scrolled or clipped out of reach */
|
||||
REAKTOR_A11Y_FOCUSED = 1u << 0,
|
||||
REAKTOR_A11Y_CHECKED = 1u << 1,
|
||||
REAKTOR_A11Y_EXPANDED = 1u << 2,
|
||||
REAKTOR_A11Y_SELECTED = 1u << 3,
|
||||
REAKTOR_A11Y_DISABLED = 1u << 4,
|
||||
REAKTOR_A11Y_READONLY = 1u << 5,
|
||||
REAKTOR_A11Y_OFFSCREEN = 1u << 6, /* scrolled or clipped out of reach */
|
||||
/* Changes on its own, and a reader must not read the change out. The
|
||||
* Diagnostics page is a page of these: every reading moves as the pointer
|
||||
* does, and a platform that turned each into an announcement would talk
|
||||
@@ -68,13 +68,13 @@ enum {
|
||||
* news. ARIA spells it aria-live="off"; UIA is the reason it exists,
|
||||
* since a provider raises a property-changed event per change unless
|
||||
* something says not to. */
|
||||
CURIE_A11Y_VOLATILE = 1u << 7
|
||||
REAKTOR_A11Y_VOLATILE = 1u << 7
|
||||
};
|
||||
|
||||
/* One element. `name` and `value` point into the frame's string arena, so they
|
||||
* are valid until the frame after next - long enough for the diff, which is
|
||||
* the only thing that reads the previous frame's copy. */
|
||||
typedef struct curie_a11y_node {
|
||||
typedef struct reaktor_a11y_node {
|
||||
unsigned id;
|
||||
unsigned parent;
|
||||
unsigned char role;
|
||||
@@ -88,23 +88,23 @@ typedef struct curie_a11y_node {
|
||||
* neither can get them out of the text a reader hears. `lo == hi` means
|
||||
* the node is not a range, which is every node nothing reports one for. */
|
||||
float num, lo, hi, step;
|
||||
} curie_a11y_node;
|
||||
} reaktor_a11y_node;
|
||||
|
||||
enum {
|
||||
CURIE_A11Y_ADDED = 0,
|
||||
CURIE_A11Y_REMOVED,
|
||||
CURIE_A11Y_RENAMED, /* name or value */
|
||||
CURIE_A11Y_RESTATED, /* state bits */
|
||||
CURIE_A11Y_MOVED /* bounds only */
|
||||
REAKTOR_A11Y_ADDED = 0,
|
||||
REAKTOR_A11Y_REMOVED,
|
||||
REAKTOR_A11Y_RENAMED, /* name or value */
|
||||
REAKTOR_A11Y_RESTATED, /* state bits */
|
||||
REAKTOR_A11Y_MOVED /* bounds only */
|
||||
};
|
||||
|
||||
typedef struct curie_a11y_change {
|
||||
typedef struct reaktor_a11y_change {
|
||||
unsigned char kind;
|
||||
unsigned id;
|
||||
/* Into the tree the change is about: the new one for everything except
|
||||
* REMOVED, which points into the old. -1 when the node is gone. */
|
||||
int index;
|
||||
} curie_a11y_change;
|
||||
} reaktor_a11y_change;
|
||||
|
||||
/* Sized once, from measurement rather than from a round number: the busiest
|
||||
* page in the app (Buttons) reports 80 nodes and interns 77 strings taking
|
||||
@@ -116,29 +116,29 @@ typedef struct curie_a11y_change {
|
||||
* They were four times larger. That put the struct at 135 KB, which was enough
|
||||
* to push the CRT heap over a segment boundary and cost the process most of a
|
||||
* megabyte of commit for arenas that were 84% empty. */
|
||||
#define CURIE_A11Y_MAX_NODES 256
|
||||
#define CURIE_A11Y_MAX_CHANGES 256
|
||||
#define REAKTOR_A11Y_MAX_NODES 256
|
||||
#define REAKTOR_A11Y_MAX_CHANGES 256
|
||||
/* One pool for both frames, so a name that survives a frame is not copied
|
||||
* again. Holds the whole app's vocabulary three times over. */
|
||||
#define CURIE_A11Y_POOL 8192
|
||||
#define CURIE_A11Y_MAX_DEPTH 32
|
||||
#define REAKTOR_A11Y_POOL 8192
|
||||
#define REAKTOR_A11Y_MAX_DEPTH 32
|
||||
/* Power of two, twice the node arena, so the open-addressed tables below never
|
||||
* pass half load and probing stays short. */
|
||||
#define CURIE_A11Y_SLOTS 512
|
||||
#define REAKTOR_A11Y_SLOTS 512
|
||||
|
||||
/* One slot of the scratch tables. Stamped with a generation rather than
|
||||
* cleared, so starting a frame costs nothing: a slot whose gen is stale is
|
||||
* empty by definition. */
|
||||
typedef struct curie_a11y_slot {
|
||||
typedef struct reaktor_a11y_slot {
|
||||
unsigned key;
|
||||
unsigned gen;
|
||||
int val;
|
||||
} curie_a11y_slot;
|
||||
} reaktor_a11y_slot;
|
||||
|
||||
typedef struct curie_a11y {
|
||||
typedef struct reaktor_a11y {
|
||||
/* Front is the frame just described, back is the one before it. They swap
|
||||
* at curie_a11y_end, so the diff has both. */
|
||||
curie_a11y_node node[2][CURIE_A11Y_MAX_NODES];
|
||||
* at reaktor_a11y_end, so the diff has both. */
|
||||
reaktor_a11y_node node[2][REAKTOR_A11Y_MAX_NODES];
|
||||
int count[2];
|
||||
int front; /* which half is being filled */
|
||||
|
||||
@@ -146,15 +146,15 @@ typedef struct curie_a11y {
|
||||
* Two equal names are therefore one pointer, which is what lets the diff
|
||||
* compare them with == instead of strcmp, and a name that was already
|
||||
* here is not copied at all. */
|
||||
char pool[CURIE_A11Y_POOL];
|
||||
char pool[REAKTOR_A11Y_POOL];
|
||||
int pool_used;
|
||||
int pool_entries; /* to keep the index below half load */
|
||||
unsigned pool_gen;
|
||||
|
||||
unsigned parent[CURIE_A11Y_MAX_DEPTH];
|
||||
unsigned parent[REAKTOR_A11Y_MAX_DEPTH];
|
||||
int depth;
|
||||
|
||||
curie_a11y_change change[CURIE_A11Y_MAX_CHANGES];
|
||||
reaktor_a11y_change change[REAKTOR_A11Y_MAX_CHANGES];
|
||||
int change_count;
|
||||
|
||||
/* Both are counters rather than flags, because a page that overflows once
|
||||
@@ -165,90 +165,90 @@ typedef struct curie_a11y {
|
||||
* is what makes an id stable; `index` maps id to array position for the
|
||||
* diff; `strings` maps a name's hash to its offset in the pool. All three
|
||||
* were linear scans once, which made a frame quadratic in widgets. */
|
||||
curie_a11y_slot bucket[CURIE_A11Y_SLOTS];
|
||||
curie_a11y_slot index[CURIE_A11Y_SLOTS];
|
||||
curie_a11y_slot strings[CURIE_A11Y_SLOTS * 2];
|
||||
reaktor_a11y_slot bucket[REAKTOR_A11Y_SLOTS];
|
||||
reaktor_a11y_slot index[REAKTOR_A11Y_SLOTS];
|
||||
reaktor_a11y_slot strings[REAKTOR_A11Y_SLOTS * 2];
|
||||
unsigned bucket_gen, index_gen;
|
||||
/* Which old node the forward pass matched, so the removal pass is a scan
|
||||
* of a byte array rather than a second table. */
|
||||
unsigned char matched[CURIE_A11Y_MAX_NODES];
|
||||
unsigned char matched[REAKTOR_A11Y_MAX_NODES];
|
||||
|
||||
int building;
|
||||
|
||||
/* Keyboard focus, phase 3: the id the shell says has it, 0 for none.
|
||||
* Stamped CURIE_A11Y_FOCUSED onto that node as it is emitted, so focus
|
||||
* Stamped REAKTOR_A11Y_FOCUSED onto that node as it is emitted, so focus
|
||||
* moving reaches the diff as two state changes like anything else. */
|
||||
unsigned focus_id;
|
||||
} curie_a11y;
|
||||
} reaktor_a11y;
|
||||
|
||||
/* --- building, once per frame ------------------------------------------ */
|
||||
|
||||
/* Starts a frame. The window node is emitted here, so every later node has a
|
||||
* parent without the caller pushing one. */
|
||||
void curie_a11y_begin(curie_a11y *a, const char *window_name,
|
||||
void reaktor_a11y_begin(reaktor_a11y *a, const char *window_name,
|
||||
struct nk_rect bounds);
|
||||
|
||||
/* Reports one element. `name` may be NULL for something unlabelled - a group,
|
||||
* an icon-only button whose meaning comes from its position. `value` may be
|
||||
* NULL for anything that does not hold one. Answers the node's id, which is
|
||||
* what a caller passes to curie_a11y_push to make it a container.
|
||||
* what a caller passes to reaktor_a11y_push to make it a container.
|
||||
*
|
||||
* The id is a hash of the parent's id, the role, the name and an occurrence
|
||||
* counter, so it names the same element on consecutive frames: adding a widget
|
||||
* above does not renumber everything below it. */
|
||||
unsigned curie_a11y_add(curie_a11y *a, unsigned char role, const char *name,
|
||||
unsigned reaktor_a11y_add(reaktor_a11y *a, unsigned char role, const char *name,
|
||||
const char *value, unsigned state,
|
||||
struct nk_rect bounds);
|
||||
|
||||
/* The same, and then makes it the parent of everything up to the matching pop.
|
||||
* Unbalanced pushes are clamped rather than trapped: an accessibility tree that
|
||||
* is slightly wrong is better than a frame that does not draw. */
|
||||
unsigned curie_a11y_push(curie_a11y *a, unsigned char role, const char *name,
|
||||
unsigned reaktor_a11y_push(reaktor_a11y *a, unsigned char role, const char *name,
|
||||
const char *value, unsigned state,
|
||||
struct nk_rect bounds);
|
||||
void curie_a11y_pop(curie_a11y *a);
|
||||
void reaktor_a11y_pop(reaktor_a11y *a);
|
||||
|
||||
/* Ends the frame: diffs against the previous one and swaps. Answers how many
|
||||
* changes it found, which is 0 for a frame that drew the same thing. */
|
||||
int curie_a11y_end(curie_a11y *a);
|
||||
int reaktor_a11y_end(reaktor_a11y *a);
|
||||
|
||||
/* Names the node with keyboard focus, by id, 0 for none. Takes effect on the
|
||||
* next frame built. */
|
||||
void curie_a11y_set_focus(curie_a11y *a, unsigned id);
|
||||
void reaktor_a11y_set_focus(reaktor_a11y *a, unsigned id);
|
||||
|
||||
/* Puts numbers on a node already emitted this frame, named by the id its own
|
||||
* report answered with. Separate from the report because three roles want it
|
||||
* and the rest would carry four arguments they have no use for. */
|
||||
void curie_a11y_set_range(curie_a11y *a, unsigned id, float num, float lo,
|
||||
void reaktor_a11y_set_range(reaktor_a11y *a, unsigned id, float num, float lo,
|
||||
float hi, float step);
|
||||
|
||||
/* --- reading it back --------------------------------------------------- */
|
||||
|
||||
const curie_a11y_node *curie_a11y_tree(const curie_a11y *a, int *count);
|
||||
const curie_a11y_change *curie_a11y_changes(const curie_a11y *a, int *count);
|
||||
const char *curie_a11y_role_name(unsigned char role);
|
||||
const reaktor_a11y_node *reaktor_a11y_tree(const reaktor_a11y *a, int *count);
|
||||
const reaktor_a11y_change *reaktor_a11y_changes(const reaktor_a11y *a, int *count);
|
||||
const char *reaktor_a11y_role_name(unsigned char role);
|
||||
|
||||
/* The tree as text, one line per node, indented by depth. This is what the
|
||||
* golden-file test compares, so the format is deliberately dull and stable:
|
||||
*
|
||||
* window "Curie" 0,0 960x680
|
||||
* window "Reaktor" 0,0 960x680
|
||||
* tablist 0,40 960x34
|
||||
* tab "Login" [selected] 8,40 68x34
|
||||
*/
|
||||
void curie_a11y_dump(const curie_a11y *a, FILE *out);
|
||||
void reaktor_a11y_dump(const reaktor_a11y *a, FILE *out);
|
||||
|
||||
/* --- a platform bridge (phase 4) ---------------------------------------- */
|
||||
|
||||
/* Called back when a reader presses a node, or moves to one. */
|
||||
typedef void (*curie_a11y_action)(void *user, unsigned id);
|
||||
typedef void (*reaktor_a11y_action)(void *user, unsigned id);
|
||||
|
||||
/* Hands the tree to the platform after each drawn frame. On the web it is
|
||||
* mirrored into hidden DOM beside the canvas (a11y_web.c); elsewhere it is a
|
||||
* no-op until phases 4b-d. push is cheap when nothing changed: it looks at the
|
||||
* change count and returns. */
|
||||
void curie_a11y_platform_init(curie_a11y_action activate,
|
||||
curie_a11y_action focus, void *user);
|
||||
void curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id);
|
||||
void reaktor_a11y_platform_init(reaktor_a11y_action activate,
|
||||
reaktor_a11y_action focus, void *user);
|
||||
void reaktor_a11y_platform_push(const reaktor_a11y *a, unsigned focus_id);
|
||||
|
||||
/* Runs whatever a client asked for since the last call, on the thread that
|
||||
* owns the tree. A bridge whose client calls it on another thread - UIA does,
|
||||
@@ -257,6 +257,6 @@ void curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id);
|
||||
* records the request, wakes the loop with an event, and the shell calls this
|
||||
* before it builds the next frame. On the web it is a no-op; there is one
|
||||
* thread there and the request arrives on it. */
|
||||
void curie_a11y_platform_drain(void);
|
||||
void reaktor_a11y_platform_drain(void);
|
||||
|
||||
#endif /* CURIE_A11Y_H */
|
||||
#endif /* REAKTOR_A11Y_H */
|
||||
|
||||
+18
-18
@@ -24,20 +24,20 @@
|
||||
* the bridges that are still missing. */
|
||||
#include "a11y.h"
|
||||
|
||||
static curie_a11y_action g_activate, g_focus;
|
||||
static reaktor_a11y_action g_activate, g_focus;
|
||||
static void *g_user;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void
|
||||
curie_a11y_web_activate(unsigned id)
|
||||
reaktor_a11y_web_activate(unsigned id)
|
||||
{
|
||||
if (g_activate) g_activate(g_user, id);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void
|
||||
curie_a11y_web_focus(unsigned id)
|
||||
reaktor_a11y_web_focus(unsigned id)
|
||||
{
|
||||
if (g_focus) g_focus(g_user, id);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ EM_JS(void, web_a11y_init, (void), {
|
||||
'overflow:visible;pointer-events:none;opacity:0;';
|
||||
document.body.appendChild(root);
|
||||
canvas.setAttribute('role', 'application');
|
||||
canvas.setAttribute('aria-label', 'Curie');
|
||||
canvas.setAttribute('aria-label', 'Reaktor');
|
||||
canvas.setAttribute('aria-owns', 'a11y');
|
||||
Module['a11y'] = { root: root, nodes: {}, gen: 0 };
|
||||
});
|
||||
@@ -77,10 +77,10 @@ EM_JS(void, web_a11y_node, (unsigned id, unsigned parent, const char *role,
|
||||
el.id = 'a11y-' + id;
|
||||
el.style.cssText = 'position:absolute;pointer-events:none;';
|
||||
el.addEventListener('click', function () {
|
||||
Module['_curie_a11y_web_activate'](id);
|
||||
Module['_reaktor_a11y_web_activate'](id);
|
||||
});
|
||||
el.addEventListener('focus', function () {
|
||||
Module['_curie_a11y_web_focus'](id);
|
||||
Module['_reaktor_a11y_web_focus'](id);
|
||||
});
|
||||
a.nodes[id] = el;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ EM_JS(void, web_a11y_node, (unsigned id, unsigned parent, const char *role,
|
||||
var CHECKED = 2, EXPANDED = 4, SELECTED = 8, DISABLED = 16, READONLY = 32,
|
||||
VOLATILE = 128;
|
||||
|
||||
/* Curie's vocabulary is the one every platform shares; three names
|
||||
/* Reaktor's vocabulary is the one every platform shares; three names
|
||||
differ in ARIA. A label has no role - it is text. */
|
||||
var aria = r === 'progress' ? 'progressbar'
|
||||
: r === 'listitem' ? 'option'
|
||||
@@ -165,7 +165,7 @@ EM_JS(void, web_a11y_end, (unsigned focus), {
|
||||
});
|
||||
|
||||
void
|
||||
curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
reaktor_a11y_platform_init(reaktor_a11y_action activate, reaktor_a11y_action focus,
|
||||
void *user)
|
||||
{
|
||||
g_activate = activate;
|
||||
@@ -175,27 +175,27 @@ curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_drain(void)
|
||||
reaktor_a11y_platform_drain(void)
|
||||
{
|
||||
/* The browser calls the exported functions on the main thread, so the
|
||||
* action has already run by the time anything asks. */
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
reaktor_a11y_platform_push(const reaktor_a11y *a, unsigned focus_id)
|
||||
{
|
||||
static unsigned last_focus;
|
||||
int n, m, i;
|
||||
const curie_a11y_node *t = curie_a11y_tree(a, &n);
|
||||
const reaktor_a11y_node *t = reaktor_a11y_tree(a, &n);
|
||||
|
||||
curie_a11y_changes(a, &m);
|
||||
reaktor_a11y_changes(a, &m);
|
||||
if (m == 0 && focus_id == last_focus) return;
|
||||
last_focus = focus_id;
|
||||
|
||||
web_a11y_begin();
|
||||
for (i = 0; i < n; i++) {
|
||||
const curie_a11y_node *nd = &t[i];
|
||||
web_a11y_node(nd->id, nd->parent, curie_a11y_role_name(nd->role),
|
||||
const reaktor_a11y_node *nd = &t[i];
|
||||
web_a11y_node(nd->id, nd->parent, reaktor_a11y_role_name(nd->role),
|
||||
nd->name ? nd->name : "", nd->value ? nd->value : "",
|
||||
nd->state, nd->bounds.x, nd->bounds.y, nd->bounds.w,
|
||||
nd->bounds.h, nd->num, nd->lo, nd->hi);
|
||||
@@ -208,10 +208,10 @@ curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
* Anything else - a Linux or BSD without dbus - falls through to the no-op
|
||||
* below, which is also what a desktop with no accessibility stack running
|
||||
* amounts to. */
|
||||
#elif !defined(_WIN32) && !defined(CURIE_HAVE_ATSPI) && !defined(CURIE_HAVE_NSACCESSIBILITY)
|
||||
#elif !defined(_WIN32) && !defined(REAKTOR_HAVE_ATSPI) && !defined(REAKTOR_HAVE_NSACCESSIBILITY)
|
||||
|
||||
void
|
||||
curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
reaktor_a11y_platform_init(reaktor_a11y_action activate, reaktor_a11y_action focus,
|
||||
void *user)
|
||||
{
|
||||
g_activate = activate;
|
||||
@@ -220,13 +220,13 @@ curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
reaktor_a11y_platform_push(const reaktor_a11y *a, unsigned focus_id)
|
||||
{
|
||||
(void)a; (void)focus_id;
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_drain(void)
|
||||
reaktor_a11y_platform_drain(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+9
-24
@@ -9,12 +9,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "curie.h"
|
||||
#include "reaktor.h"
|
||||
#include "appicon.h"
|
||||
#include "plutosvg.h"
|
||||
|
||||
/* Was MAX_PATH; kept local so this file needs no platform header. */
|
||||
#define CURIE_PATH_MAX 1024
|
||||
#define REAKTOR_PATH_MAX 1024
|
||||
|
||||
/* Appends src to dst, respecting cap. Returns 0 if it would overflow. */
|
||||
static int str_append(char *dst, size_t cap, size_t *len, const char *src,
|
||||
@@ -86,7 +86,7 @@ static int str_scale_stroke(const char *in, char *out, size_t cap, float k)
|
||||
|
||||
/* Un-premultiplies plutovg's ARGB32 output. Windows icon bitmaps are sampled
|
||||
* as straight alpha, so premultiplied pixels would render too dark. */
|
||||
void curie_unpremultiply(unsigned char *px, int w, int h, int stride)
|
||||
void reaktor_unpremultiply(unsigned char *px, int w, int h, int stride)
|
||||
{
|
||||
int x, y;
|
||||
for (y = 0; y < h; y++) {
|
||||
@@ -105,30 +105,15 @@ void curie_unpremultiply(unsigned char *px, int w, int h, int stride)
|
||||
}
|
||||
}
|
||||
|
||||
/* Convenience wrapper: turns an Ionicons glyph name into a path. */
|
||||
plutovg_surface_t *curie_svg_surface(const char *name, int size,
|
||||
const char *outline_colour,
|
||||
const char *inside_colour)
|
||||
{
|
||||
char rel[CURIE_PATH_MAX];
|
||||
|
||||
if (snprintf(rel, sizeof(rel),
|
||||
"third_party/ionicons/src/svg/%s.svg", name) < 0)
|
||||
return NULL;
|
||||
rel[sizeof(rel) - 1] = '\0';
|
||||
return curie_svg_surface_path(rel, size, outline_colour, inside_colour,
|
||||
0.0f);
|
||||
}
|
||||
|
||||
/* Loads any SVG under the repo root, optionally recolours it from
|
||||
* Open-Color, and rasterises to a surface the caller owns. A NULL family
|
||||
* leaves that channel as the artwork has it. */
|
||||
plutovg_surface_t *curie_svg_surface_path(const char *rel_path, int size,
|
||||
plutovg_surface_t *reaktor_svg_surface_path(const char *rel_path, int size,
|
||||
const char *outline_colour,
|
||||
const char *inside_colour,
|
||||
float stroke_scale)
|
||||
{
|
||||
char path[CURIE_PATH_MAX];
|
||||
char path[REAKTOR_PATH_MAX];
|
||||
char outline_hex[16] = "#000000", inside_hex[16] = "none";
|
||||
char fill_decl[32], stroke_decl[32], path_open[48];
|
||||
char *svg;
|
||||
@@ -138,12 +123,12 @@ plutovg_surface_t *curie_svg_surface_path(const char *rel_path, int size,
|
||||
plutosvg_document_t *doc = NULL;
|
||||
plutovg_surface_t *surf = NULL;
|
||||
|
||||
if (!curie_path(path, sizeof(path), rel_path)) {
|
||||
fprintf(stderr, "svg: curie_path failed for %s\n", rel_path);
|
||||
if (!reaktor_path(path, sizeof(path), rel_path)) {
|
||||
fprintf(stderr, "svg: reaktor_path failed for %s\n", rel_path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
svg = curie_read_file(path, NULL);
|
||||
svg = reaktor_read_file(path, NULL);
|
||||
if (!svg) { fprintf(stderr, "svg: cannot read %s\n", path); return NULL; }
|
||||
|
||||
/* A channel is a literal "#rrggbb", which is what lets an icon follow the
|
||||
@@ -209,6 +194,6 @@ done:
|
||||
free(stage2);
|
||||
free(stage1);
|
||||
free(stage0);
|
||||
curie_free(svg);
|
||||
reaktor_free(svg);
|
||||
return surf;
|
||||
}
|
||||
|
||||
+5
-10
@@ -3,8 +3,8 @@
|
||||
* Portable: no windows.h, no HICON. The window icon is applied through
|
||||
* SDL_SetWindowIcon; the Windows executable resource is a committed .ico that
|
||||
* the build links, not something rendered here. */
|
||||
#ifndef CURIE_APPICON_H
|
||||
#define CURIE_APPICON_H
|
||||
#ifndef REAKTOR_APPICON_H
|
||||
#define REAKTOR_APPICON_H
|
||||
|
||||
#include "plutovg.h"
|
||||
|
||||
@@ -20,19 +20,14 @@
|
||||
* leaves it alone. Ionicons set a stroke of 6.25% of the glyph, which below
|
||||
* about 20px is a hairline that anti-aliases to grey, so a glyph drawn small
|
||||
* needs a heavier line to read as solid. */
|
||||
plutovg_surface_t *curie_svg_surface_path(const char *rel_path, int size,
|
||||
plutovg_surface_t *reaktor_svg_surface_path(const char *rel_path, int size,
|
||||
const char *outline_colour,
|
||||
const char *inside_colour,
|
||||
float stroke_scale);
|
||||
|
||||
/* The same, for a glyph named inside the Ionicons submodule. */
|
||||
plutovg_surface_t *curie_svg_surface(const char *name, int size,
|
||||
const char *outline_colour,
|
||||
const char *inside_colour);
|
||||
|
||||
/* Converts plutovg's premultiplied ARGB32 to straight alpha in place.
|
||||
* Both SDL surfaces and Windows icon bitmaps sample straight alpha;
|
||||
* premultiplied pixels would render too dark. */
|
||||
void curie_unpremultiply(unsigned char *px, int w, int h, int stride);
|
||||
void reaktor_unpremultiply(unsigned char *px, int w, int h, int stride);
|
||||
|
||||
#endif /* CURIE_APPICON_H */
|
||||
#endif /* REAKTOR_APPICON_H */
|
||||
|
||||
+16
-34
@@ -45,12 +45,12 @@ typedef struct var_entry {
|
||||
char *value;
|
||||
} var_entry;
|
||||
|
||||
struct curie_cssvars {
|
||||
struct reaktor_cssvars {
|
||||
var_entry *v;
|
||||
size_t n, cap;
|
||||
};
|
||||
|
||||
static var_entry *vars_find(curie_cssvars *m, const char *name, size_t nlen)
|
||||
static var_entry *vars_find(reaktor_cssvars *m, const char *name, size_t nlen)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -62,7 +62,7 @@ static var_entry *vars_find(curie_cssvars *m, const char *name, size_t nlen)
|
||||
|
||||
/* Later declarations replace earlier ones, which is what makes the theme block
|
||||
* override :root simply by appearing after it in the file. */
|
||||
static int vars_set(curie_cssvars *m, const char *name, size_t nlen,
|
||||
static int vars_set(reaktor_cssvars *m, const char *name, size_t nlen,
|
||||
const char *value, size_t vlen)
|
||||
{
|
||||
var_entry *e = vars_find(m, name, nlen);
|
||||
@@ -95,7 +95,7 @@ static int vars_set(curie_cssvars *m, const char *name, size_t nlen,
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *curie_cssvars_get(const curie_cssvars *m, const char *name)
|
||||
const char *reaktor_cssvars_get(const reaktor_cssvars *m, const char *name)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -113,10 +113,10 @@ static int hex1(int c)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int curie_cssvars_color(const curie_cssvars *m, const char *name,
|
||||
int reaktor_cssvars_color(const reaktor_cssvars *m, const char *name,
|
||||
unsigned char rgba[4])
|
||||
{
|
||||
const char *v = curie_cssvars_get(m, name);
|
||||
const char *v = reaktor_cssvars_get(m, name);
|
||||
int h[8], i, n;
|
||||
|
||||
if (!v) return 0;
|
||||
@@ -141,7 +141,7 @@ int curie_cssvars_color(const curie_cssvars *m, const char *name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void curie_cssvars_free(curie_cssvars *m)
|
||||
void reaktor_cssvars_free(reaktor_cssvars *m)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -157,7 +157,7 @@ void curie_cssvars_free(curie_cssvars *m)
|
||||
* Returns 0 if a reference resolves to nothing and has no fallback, which is
|
||||
* the caller's cue to drop the declaration entirely - the same thing a browser
|
||||
* does with an unresolvable var, and better than emitting a broken value. */
|
||||
static int subst_vars(const curie_cssvars *m, const char *src, size_t len,
|
||||
static int subst_vars(const reaktor_cssvars *m, const char *src, size_t len,
|
||||
buf *out)
|
||||
{
|
||||
size_t i = 0;
|
||||
@@ -200,7 +200,7 @@ static int subst_vars(const curie_cssvars *m, const char *src, size_t len,
|
||||
|
||||
val = NULL;
|
||||
if (name_e > name_s) {
|
||||
const var_entry *e = vars_find((curie_cssvars *)m,
|
||||
const var_entry *e = vars_find((reaktor_cssvars *)m,
|
||||
src + name_s, name_e - name_s);
|
||||
if (e) val = e->value;
|
||||
}
|
||||
@@ -396,7 +396,7 @@ static void each_decl(const char *s, size_t start, size_t end,
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct collect_ctx { curie_cssvars *m; } collect_ctx;
|
||||
typedef struct collect_ctx { reaktor_cssvars *m; } collect_ctx;
|
||||
|
||||
static void collect_one(void *c, const char *p, size_t plen,
|
||||
const char *v, size_t vlen)
|
||||
@@ -426,7 +426,7 @@ static void root_one(void *c, const char *p, size_t plen,
|
||||
}
|
||||
|
||||
typedef struct emit_ctx {
|
||||
const curie_cssvars *m;
|
||||
const reaktor_cssvars *m;
|
||||
buf *out;
|
||||
int wrote;
|
||||
float root_px;
|
||||
@@ -468,9 +468,9 @@ static void emit_one(void *c, const char *p, size_t plen,
|
||||
|
||||
/* --- the pass ------------------------------------------------------------- */
|
||||
|
||||
static char *flatten(char *src, const char *theme, curie_cssvars **out_vars)
|
||||
static char *flatten(char *src, const char *theme, reaktor_cssvars **out_vars)
|
||||
{
|
||||
curie_cssvars *m = (curie_cssvars *)calloc(1, sizeof(*m));
|
||||
reaktor_cssvars *m = (reaktor_cssvars *)calloc(1, sizeof(*m));
|
||||
buf out;
|
||||
size_t i, len, pass;
|
||||
root_ctx root;
|
||||
@@ -613,30 +613,12 @@ static char *flatten(char *src, const char *theme, curie_cssvars **out_vars)
|
||||
}
|
||||
|
||||
free(src);
|
||||
if (out_vars) *out_vars = m; else curie_cssvars_free(m);
|
||||
if (out_vars) *out_vars = m; else reaktor_cssvars_free(m);
|
||||
return out.p;
|
||||
}
|
||||
|
||||
char *curie_css_flatten_text(const char *const *texts, int count,
|
||||
const char *theme, curie_cssvars **out_vars)
|
||||
{
|
||||
buf all;
|
||||
int i;
|
||||
|
||||
memset(&all, 0, sizeof(all));
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!texts[i]) continue;
|
||||
if (!buf_str(&all, texts[i]) || !buf_str(&all, "\n")) {
|
||||
free(all.p);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (!all.p) all.p = (char *)calloc(1, 1);
|
||||
return flatten(all.p, theme, out_vars);
|
||||
}
|
||||
|
||||
char *curie_css_flatten(const char *const *paths, int count,
|
||||
const char *theme, curie_cssvars **out_vars)
|
||||
char *reaktor_css_flatten(const char *const *paths, int count,
|
||||
const char *theme, reaktor_cssvars **out_vars)
|
||||
{
|
||||
buf all;
|
||||
int i;
|
||||
|
||||
+9
-13
@@ -24,32 +24,28 @@
|
||||
* rule this engine can apply - the surfaces the application paints itself, and
|
||||
* anything behind a selector dropped above - so those tokens are read straight
|
||||
* from the map instead. */
|
||||
#ifndef CURIE_CSSFLAT_H
|
||||
#define CURIE_CSSFLAT_H
|
||||
#ifndef REAKTOR_CSSFLAT_H
|
||||
#define REAKTOR_CSSFLAT_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct curie_cssvars curie_cssvars;
|
||||
typedef struct reaktor_cssvars reaktor_cssvars;
|
||||
|
||||
/* Reads and flattens `count` stylesheets in order. `theme` selects which
|
||||
* [data-theme="..."] block contributes its custom properties ("light" or
|
||||
* "dark"). Returns malloc'd CSS text the caller frees, or NULL on failure.
|
||||
* When `out_vars` is non-NULL it receives the resolved custom properties. */
|
||||
char *curie_css_flatten(const char *const *paths, int count,
|
||||
const char *theme, curie_cssvars **out_vars);
|
||||
|
||||
/* Same, but from text already in memory. `names` is used only in messages. */
|
||||
char *curie_css_flatten_text(const char *const *texts, int count,
|
||||
const char *theme, curie_cssvars **out_vars);
|
||||
char *reaktor_css_flatten(const char *const *paths, int count,
|
||||
const char *theme, reaktor_cssvars **out_vars);
|
||||
|
||||
/* Resolved value of a custom property, e.g. "--background-body", or NULL. */
|
||||
const char *curie_cssvars_get(const curie_cssvars *vars, const char *name);
|
||||
const char *reaktor_cssvars_get(const reaktor_cssvars *vars, const char *name);
|
||||
|
||||
/* Resolved custom property parsed as #rgb/#rrggbb. Returns 0 if absent or
|
||||
* not a hex colour. */
|
||||
int curie_cssvars_color(const curie_cssvars *vars, const char *name,
|
||||
int reaktor_cssvars_color(const reaktor_cssvars *vars, const char *name,
|
||||
unsigned char rgba[4]);
|
||||
|
||||
void curie_cssvars_free(curie_cssvars *vars);
|
||||
void reaktor_cssvars_free(reaktor_cssvars *vars);
|
||||
|
||||
#endif /* CURIE_CSSFLAT_H */
|
||||
#endif /* REAKTOR_CSSFLAT_H */
|
||||
|
||||
+233
-245
File diff suppressed because it is too large
Load Diff
+7
-20
@@ -13,17 +13,17 @@
|
||||
|
||||
static float g_scale = 1.0f;
|
||||
|
||||
float curie_scale(void)
|
||||
float reaktor_scale(void)
|
||||
{
|
||||
return g_scale;
|
||||
}
|
||||
|
||||
/* Honours a CURIE_SCALE override, in the spirit of GDK_SCALE / QT_SCALE_FACTOR.
|
||||
/* Honours a REAKTOR_SCALE override, in the spirit of GDK_SCALE / QT_SCALE_FACTOR.
|
||||
* Useful for testing HiDPI on a 96-DPI display, and a genuine escape hatch on
|
||||
* systems that report the wrong density. Returns 0 when unset or malformed. */
|
||||
static float scale_from_env(void)
|
||||
{
|
||||
const char *s = getenv("CURIE_SCALE");
|
||||
const char *s = getenv("REAKTOR_SCALE");
|
||||
double v;
|
||||
char *end;
|
||||
|
||||
@@ -33,7 +33,7 @@ static float scale_from_env(void)
|
||||
return (float)v;
|
||||
}
|
||||
|
||||
void curie_set_scale(float scale)
|
||||
void reaktor_set_scale(float scale)
|
||||
{
|
||||
/* Guard against a zero or negative scale from a misbehaving display
|
||||
* query, which would collapse the whole UI to nothing. */
|
||||
@@ -41,32 +41,19 @@ void curie_set_scale(float scale)
|
||||
g_scale = scale;
|
||||
}
|
||||
|
||||
int curie_px(float logical)
|
||||
int reaktor_px(float logical)
|
||||
{
|
||||
return (int)(logical * g_scale + 0.5f);
|
||||
}
|
||||
|
||||
float curie_unpx(int device)
|
||||
{
|
||||
return (float)device / g_scale;
|
||||
}
|
||||
|
||||
void curie_px_rect(const float *logical_xywh, int *device_xywh)
|
||||
{
|
||||
device_xywh[0] = curie_px(logical_xywh[0]);
|
||||
device_xywh[1] = curie_px(logical_xywh[1]);
|
||||
device_xywh[2] = curie_px(logical_xywh[2]);
|
||||
device_xywh[3] = curie_px(logical_xywh[3]);
|
||||
}
|
||||
|
||||
void curie_dpi_enable_awareness(void)
|
||||
void reaktor_dpi_enable_awareness(void)
|
||||
{
|
||||
/* SDL_Init opts the process into per-monitor DPI awareness on the
|
||||
* platforms where that is a concept. Kept as a no-op so callers do not
|
||||
* need to know that. */
|
||||
}
|
||||
|
||||
float curie_dpi_query_scale(void *native_window)
|
||||
float reaktor_dpi_query_scale(void *native_window)
|
||||
{
|
||||
float forced = scale_from_env();
|
||||
float scale;
|
||||
|
||||
+10
-16
@@ -2,36 +2,30 @@
|
||||
*
|
||||
* The rule: **lay out in logical (CSS) pixels; apply scale only at the paint
|
||||
* and input boundary.** Layout code never sees the scale factor. Everything
|
||||
* that crosses into device pixels goes through curie_px().
|
||||
* that crosses into device pixels goes through reaktor_px().
|
||||
*
|
||||
* Only curie_dpi_enable_awareness() and curie_dpi_query_scale() are
|
||||
* Only reaktor_dpi_enable_awareness() and reaktor_dpi_query_scale() are
|
||||
* platform-specific; both become one SDL3 call once the backend lands
|
||||
* (SDL_GetWindowDisplayScale), so the rest of this module never changes. */
|
||||
#ifndef CURIE_METRICS_H
|
||||
#define CURIE_METRICS_H
|
||||
#ifndef REAKTOR_METRICS_H
|
||||
#define REAKTOR_METRICS_H
|
||||
|
||||
/* Current device-pixel ratio. 1.0 = 96 DPI, 1.5 = 144 DPI, 2.0 = 192 DPI. */
|
||||
float curie_scale(void);
|
||||
void curie_set_scale(float scale);
|
||||
float reaktor_scale(void);
|
||||
void reaktor_set_scale(float scale);
|
||||
|
||||
/* Logical pixels -> device pixels. Rounds rather than truncates: truncation
|
||||
* accumulates a half-pixel of drift across nested boxes. */
|
||||
int curie_px(float logical);
|
||||
|
||||
/* Device pixels -> logical. Used on input coordinates, which arrive scaled. */
|
||||
float curie_unpx(int device);
|
||||
|
||||
/* Scales a logical rect into device space in one call. */
|
||||
void curie_px_rect(const float *logical_xywh, int *device_xywh);
|
||||
int reaktor_px(float logical);
|
||||
|
||||
/* --- platform seam (the only part that changes per backend) --- */
|
||||
|
||||
/* Opt the process into per-monitor DPI awareness. Call once, before any
|
||||
* window exists. No-op where the concept does not apply. */
|
||||
void curie_dpi_enable_awareness(void);
|
||||
void reaktor_dpi_enable_awareness(void);
|
||||
|
||||
/* Reads the scale for the display hosting `native_window` (HWND today,
|
||||
* SDL_Window* later). Returns 1.0f if it cannot be determined. */
|
||||
float curie_dpi_query_scale(void *native_window);
|
||||
float reaktor_dpi_query_scale(void *native_window);
|
||||
|
||||
#endif /* CURIE_METRICS_H */
|
||||
#endif /* REAKTOR_METRICS_H */
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
/* nk_common.h - shared Nuklear configuration.
|
||||
* Included by every TU. The implementation lives in nk_impl.c only. */
|
||||
#ifndef CURIE_NK_COMMON_H
|
||||
#define CURIE_NK_COMMON_H
|
||||
#ifndef REAKTOR_NK_COMMON_H
|
||||
#define REAKTOR_NK_COMMON_H
|
||||
|
||||
#define NK_INCLUDE_FIXED_TYPES
|
||||
#define NK_INCLUDE_STANDARD_IO
|
||||
@@ -29,4 +29,4 @@
|
||||
|
||||
#include "../third_party/nuklear/nuklear.h"
|
||||
|
||||
#endif /* CURIE_NK_COMMON_H */
|
||||
#endif /* REAKTOR_NK_COMMON_H */
|
||||
|
||||
+11
-11
@@ -7,7 +7,7 @@
|
||||
* RGBA32. It could not stay an include: the format is chosen inside
|
||||
* nk_sdl_font_stash_end, and this project does not edit submodules.
|
||||
*
|
||||
* Grep CURIE for the changed hunks. Re-vendoring means re-applying them.
|
||||
* Grep REAKTOR for the changed hunks. Re-vendoring means re-applying them.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -48,7 +48,7 @@ NK_API void nk_sdl_font_stash_end(struct nk_context* ctx);
|
||||
#endif
|
||||
NK_API int nk_sdl_handle_event(struct nk_context* ctx, SDL_Event *evt);
|
||||
NK_API void nk_sdl_render(struct nk_context* ctx, enum nk_anti_aliasing);
|
||||
/* CURIE: fills and strokes feathered independently - see nk_sdl_render_ex. */
|
||||
/* REAKTOR: fills and strokes feathered independently - see nk_sdl_render_ex. */
|
||||
NK_API void nk_sdl_render_ex(struct nk_context* ctx, enum nk_anti_aliasing shape_AA, enum nk_anti_aliasing line_AA);
|
||||
NK_API void nk_sdl_update_TextInput(struct nk_context* ctx);
|
||||
NK_API void nk_sdl_shutdown(struct nk_context* ctx);
|
||||
@@ -78,7 +78,7 @@ struct nk_sdl_device {
|
||||
struct nk_buffer cmds;
|
||||
struct nk_draw_null_texture tex_null;
|
||||
SDL_Texture *font_tex;
|
||||
/* CURIE: the white texel Nuklear multiplies untextured geometry by.
|
||||
/* REAKTOR: the white texel Nuklear multiplies untextured geometry by.
|
||||
*
|
||||
* nk_font_atlas_end points tex_null at the atlas, so every draw command -
|
||||
* shapes as much as text - arrives carrying font_tex and the two cannot be
|
||||
@@ -161,7 +161,7 @@ nk_sdl_allocator()
|
||||
return allocator;
|
||||
}
|
||||
|
||||
/* CURIE: the palette that makes an INDEX8 atlas equal the RGBA32 one -
|
||||
/* REAKTOR: the palette that makes an INDEX8 atlas equal the RGBA32 one -
|
||||
* entry i is white at alpha i. SDL keeps its own reference, so this frees
|
||||
* ours. */
|
||||
static bool
|
||||
@@ -201,7 +201,7 @@ nk_sdl_device_upload_atlas(struct nk_context* ctx, const void *image, int width,
|
||||
sdl->ogl.font_tex = NULL;
|
||||
}
|
||||
|
||||
/* CURIE: 8-bit indexed, not ARGB8888.
|
||||
/* REAKTOR: 8-bit indexed, not ARGB8888.
|
||||
*
|
||||
* A baked glyph is coverage: nk_font_bake_convert writes
|
||||
* ((alpha << 24) | 0x00FFFFFF) per pixel, so three of four bytes are a
|
||||
@@ -298,7 +298,7 @@ nk_sdl_render(struct nk_context* ctx, enum nk_anti_aliasing AA)
|
||||
nk_sdl_render_ex(ctx, AA, AA);
|
||||
}
|
||||
|
||||
/* CURIE: Nuklear feathers fills (shape_AA) and strokes (line_AA) separately,
|
||||
/* REAKTOR: Nuklear feathers fills (shape_AA) and strokes (line_AA) separately,
|
||||
* and on a rasteriser with no partial coverage they fail differently. A fill's
|
||||
* feather is a ring half a pixel outside a fill shrunk by half a pixel; landed
|
||||
* whole it is a half-tone column between a panel's border and its fill, and a
|
||||
@@ -349,7 +349,7 @@ nk_sdl_render_ex(struct nk_context* ctx, enum nk_anti_aliasing shape_AA,
|
||||
config.vertex_size = sizeof(struct nk_sdl_vertex);
|
||||
config.vertex_alignment = NK_ALIGNOF(struct nk_sdl_vertex);
|
||||
config.tex_null = sdl->ogl.tex_null;
|
||||
/* CURIE: 22 was upstream's, and at that count a small circle is a
|
||||
/* REAKTOR: 22 was upstream's, and at that count a small circle is a
|
||||
* visible polygon on the software renderer, which cannot feather a
|
||||
* fill. The circles a page draws are Ionicons now (see showcase.c),
|
||||
* so this only reaches what Nuklear still draws itself and the
|
||||
@@ -367,7 +367,7 @@ nk_sdl_render_ex(struct nk_context* ctx, enum nk_anti_aliasing shape_AA,
|
||||
nk_buffer_init(&ebuf, &sdl->allocator, NK_BUFFER_DEFAULT_INITIAL_SIZE);
|
||||
nk_convert(&sdl->ctx, &sdl->ogl.cmds, &vbuf, &ebuf, &config);
|
||||
|
||||
/* CURIE: on the software renderer, every vertex goes on the grid.
|
||||
/* REAKTOR: on the software renderer, every vertex goes on the grid.
|
||||
*
|
||||
* SDL's software backend turns each vertex into a whole pixel by
|
||||
* truncation - SDL_render_sw.c does (int)(x * scale), and the
|
||||
@@ -411,7 +411,7 @@ nk_sdl_render_ex(struct nk_context* ctx, enum nk_anti_aliasing shape_AA,
|
||||
{
|
||||
if (!cmd->elem_count) continue;
|
||||
|
||||
/* CURIE: glyph quads land on whole pixels here too.
|
||||
/* REAKTOR: glyph quads land on whole pixels here too.
|
||||
*
|
||||
* A glyph is a quad sampling the atlas. Nuklear advances the pen
|
||||
* by fractional widths, so a quad can start mid-pixel; hardware
|
||||
@@ -590,13 +590,13 @@ nk_sdl_font_stash_end(struct nk_context* ctx)
|
||||
NK_ASSERT(ctx);
|
||||
sdl = (struct nk_sdl*)ctx->userdata.ptr;
|
||||
NK_ASSERT(sdl);
|
||||
/* CURIE: alpha8, to match the upload. Also keeps the 4x RGBA buffer out
|
||||
/* REAKTOR: alpha8, to match the upload. Also keeps the 4x RGBA buffer out
|
||||
* of the startup peak - the bake holds it live alongside the alpha8 one. */
|
||||
image = nk_font_atlas_bake(&sdl->atlas, &w, &h, NK_FONT_ATLAS_ALPHA8);
|
||||
NK_ASSERT(image);
|
||||
nk_sdl_device_upload_atlas(&sdl->ctx, image, w, h);
|
||||
nk_font_atlas_end(&sdl->atlas, nk_handle_ptr(sdl->ogl.font_tex), &sdl->ogl.tex_null);
|
||||
/* CURIE: see white_tex in struct nk_sdl_device. If it cannot be made,
|
||||
/* REAKTOR: see white_tex in struct nk_sdl_device. If it cannot be made,
|
||||
* tex_null keeps pointing at the atlas and everything still draws - only
|
||||
* the glyph test in nk_sdl_render loses its precision. */
|
||||
if (!sdl->ogl.white_tex) {
|
||||
|
||||
+13
-13
@@ -1,31 +1,31 @@
|
||||
/* curie.h - shared helpers.
|
||||
/* reaktor.h - shared helpers.
|
||||
*
|
||||
* Everything here reads from third_party/ submodules at *runtime*; no upstream
|
||||
* value is ever copied into this source tree. */
|
||||
#ifndef CURIE_H
|
||||
#define CURIE_H
|
||||
#ifndef REAKTOR_H
|
||||
#define REAKTOR_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Locates the repository root by walking up from the executable until a
|
||||
* directory containing "third_party" is found. Returns 0 on failure. */
|
||||
int curie_root(char *out, size_t cap);
|
||||
int reaktor_root(char *out, size_t cap);
|
||||
|
||||
/* Joins the repo root and a relative path. Returns 0 on failure. */
|
||||
int curie_path(char *out, size_t cap, const char *rel);
|
||||
int reaktor_path(char *out, size_t cap, const char *rel);
|
||||
|
||||
/* Reads a whole file. Caller frees with curie_free. Returns NULL on failure;
|
||||
/* Reads a whole file. Caller frees with reaktor_free. Returns NULL on failure;
|
||||
* *len receives the byte count (excluding the NUL terminator it appends). */
|
||||
char *curie_read_file(const char *path, size_t *len);
|
||||
char *reaktor_read_file(const char *path, size_t *len);
|
||||
|
||||
/* Both memory counters, in bytes, or 0 where the platform will not say.
|
||||
* `rss` is the resident set, the shared pages of every mapped DLL and driver
|
||||
* included; `priv` is private commit, what Task Manager calls "commit size".
|
||||
* They answer different questions. */
|
||||
void curie_process_memory(size_t *rss, size_t *priv);
|
||||
void reaktor_process_memory(size_t *rss, size_t *priv);
|
||||
/* CPU time used so far by this process, every thread, in milliseconds. */
|
||||
double curie_process_cpu_ms(void);
|
||||
void curie_free(void *p);
|
||||
double reaktor_process_cpu_ms(void);
|
||||
void reaktor_free(void *p);
|
||||
|
||||
/* The app's own colour, for the window icon and the .ico in the executable.
|
||||
*
|
||||
@@ -34,10 +34,10 @@ void curie_free(void *p);
|
||||
* loaded and regardless of which theme the app is set to, so there is nothing
|
||||
* upstream to read it from. The mark *inside* the window is a different thing
|
||||
* and does follow tiny.css - see --links in main.c. */
|
||||
#define CURIE_BRAND "#6b4ee6"
|
||||
#define REAKTOR_BRAND "#6b4ee6"
|
||||
|
||||
/* The application mark. One file, so the title bar, the window icon and the
|
||||
* linked .ico cannot drift apart. */
|
||||
#define CURIE_MARK "branding/curie-icon.svg"
|
||||
#define REAKTOR_MARK "branding/reaktor-icon.svg"
|
||||
|
||||
#endif /* CURIE_H */
|
||||
#endif /* REAKTOR_H */
|
||||
+177
-177
@@ -4,7 +4,7 @@
|
||||
* rules for `button`, `input`, `select`, `textarea`, `table` and little else,
|
||||
* so a slider, a knob, a chart or a tree has no rule to read and must be
|
||||
* styled from the palette tokens instead. Drawing all of them is what shows
|
||||
* where that line falls - see curie_style_widgets() in main.c, which is the
|
||||
* where that line falls - see reaktor_style_widgets() in main.c, which is the
|
||||
* whole of the token half of the seam.
|
||||
*
|
||||
* Layout is Nuklear's. Every page here is rows and groups; nothing computes a
|
||||
@@ -29,12 +29,12 @@
|
||||
#define ROW_TALL 34.0f /* one control with a label inside it */
|
||||
#define ROW_SMALL 22.0f
|
||||
|
||||
const char *const curie_rss_names[RSS_STEPS] = {
|
||||
const char *const reaktor_rss_names[RSS_STEPS] = {
|
||||
"before any of it", "SDL_Init(VIDEO)", "window and renderer",
|
||||
"window icon", "Nuklear context", "font atlas", "stylesheets"
|
||||
};
|
||||
|
||||
const char *const curie_tab_names[TAB_COUNT] = {
|
||||
const char *const reaktor_tab_names[TAB_COUNT] = {
|
||||
"Login", "Buttons", "Inputs", "Display", "Layout", "Popups", "Diagnostics"
|
||||
};
|
||||
|
||||
@@ -49,11 +49,11 @@ content_w(struct nk_context *ctx)
|
||||
static void
|
||||
heading(App *app, struct nk_context *ctx, const char *text)
|
||||
{
|
||||
struct nk_color c = curie_token("--text-bright", ctx->style.text.color);
|
||||
struct nk_color c = reaktor_token("--text-bright", ctx->style.text.color);
|
||||
|
||||
nk_layout_row_dynamic(ctx, 30.0f, 1);
|
||||
nk_style_push_font(ctx, curie_font(app, 19, 1));
|
||||
curie_note_here(app, ctx, CURIE_A11Y_LABEL, text, 0);
|
||||
nk_style_push_font(ctx, reaktor_font(app, 19, 1));
|
||||
reaktor_note_here(app, ctx, REAKTOR_A11Y_LABEL, text, 0);
|
||||
nk_label_colored(ctx, text, NK_TEXT_LEFT, c);
|
||||
nk_style_pop_font(ctx);
|
||||
}
|
||||
@@ -65,8 +65,8 @@ heading(App *app, struct nk_context *ctx, const char *text)
|
||||
static void
|
||||
caption(App *app, struct nk_context *ctx, const char *text)
|
||||
{
|
||||
const struct nk_user_font *f = curie_font(app, 16, 0);
|
||||
struct nk_color c = curie_token("--text-muted", ctx->style.text.color);
|
||||
const struct nk_user_font *f = reaktor_font(app, 16, 0);
|
||||
struct nk_color c = reaktor_token("--text-muted", ctx->style.text.color);
|
||||
float avail = content_w(ctx) - 4.0f;
|
||||
float tw = f->width(f->userdata, f->height, text, (int)strlen(text));
|
||||
int lines = 1;
|
||||
@@ -75,7 +75,7 @@ caption(App *app, struct nk_context *ctx, const char *text)
|
||||
|
||||
nk_style_push_font(ctx, f);
|
||||
nk_layout_row_dynamic(ctx, (f->height + 3.0f) * (float)lines, 1);
|
||||
curie_note_here(app, ctx, CURIE_A11Y_LABEL, text, 0);
|
||||
reaktor_note_here(app, ctx, REAKTOR_A11Y_LABEL, text, 0);
|
||||
nk_label_colored_wrap(ctx, text, c);
|
||||
nk_style_pop_font(ctx);
|
||||
nk_layout_row_dynamic(ctx, 6.0f, 1);
|
||||
@@ -91,7 +91,7 @@ rule(struct nk_context *ctx)
|
||||
nk_layout_row_dynamic(ctx, 14.0f, 1);
|
||||
nk_spacer(ctx);
|
||||
nk_layout_row_dynamic(ctx, 1.0f, 1);
|
||||
nk_rule_horizontal(ctx, curie_token("--background-hover",
|
||||
nk_rule_horizontal(ctx, reaktor_token("--background-hover",
|
||||
nk_rgba(128, 128, 128, 90)), nk_false);
|
||||
nk_layout_row_dynamic(ctx, 6.0f, 1);
|
||||
nk_spacer(ctx);
|
||||
@@ -130,11 +130,11 @@ compact_pop(struct nk_context *ctx)
|
||||
static void
|
||||
api(App *app, struct nk_context *ctx, const char *text)
|
||||
{
|
||||
nk_style_push_font(ctx, curie_font(app, 12, 0));
|
||||
nk_style_push_font(ctx, reaktor_font(app, 12, 0));
|
||||
nk_layout_row_dynamic(ctx, 18.0f, 1);
|
||||
curie_note_here(app, ctx, CURIE_A11Y_LABEL, text, 0);
|
||||
reaktor_note_here(app, ctx, REAKTOR_A11Y_LABEL, text, 0);
|
||||
nk_label_colored(ctx, text, NK_TEXT_LEFT,
|
||||
curie_token("--links", ctx->style.text.color));
|
||||
reaktor_token("--links", ctx->style.text.color));
|
||||
nk_style_pop_font(ctx);
|
||||
nk_layout_row_dynamic(ctx, 4.0f, 1);
|
||||
nk_spacer(ctx);
|
||||
@@ -159,10 +159,10 @@ popup_style_push(struct nk_context *ctx)
|
||||
{
|
||||
nk_style_push_style_item(ctx, &ctx->style.window.fixed_background,
|
||||
nk_style_item_color(
|
||||
curie_token("--background",
|
||||
reaktor_token("--background",
|
||||
nk_rgb(53, 53, 53))));
|
||||
nk_style_push_float(ctx, &ctx->style.window.rounding,
|
||||
curie_popup_rounding());
|
||||
reaktor_popup_rounding());
|
||||
/* Nuklear's default leaves a dialog's text hard against its own frame. */
|
||||
nk_style_push_vec2(ctx, &ctx->style.window.popup_padding,
|
||||
nk_vec2(16.0f, 12.0f));
|
||||
@@ -246,7 +246,7 @@ combo_chrome(App *app, struct nk_context *ctx, struct nk_rect h, float border)
|
||||
r.x = h.x + h.w - COMBO_MARGIN - px;
|
||||
r.y = h.y + (h.h - px) * 0.5f;
|
||||
r.w = r.h = px;
|
||||
im = curie_ionicon(app, "chevron-down-outline", (int)px);
|
||||
im = reaktor_ionicon(app, "chevron-down-outline", (int)px);
|
||||
nk_draw_image(canvas, r, &im, nk_rgb(255, 255, 255));
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ glyph_at(App *app, struct nk_context *ctx, struct nk_rect slot,
|
||||
struct nk_image im;
|
||||
|
||||
if (px < 1) return;
|
||||
im = curie_ionicon_exact(app, name, px, col, sw);
|
||||
im = reaktor_ionicon_exact(app, name, px, col, sw);
|
||||
/* A glyph the cache could not load has no handle, and nk_draw_image would
|
||||
* paint the null texture - a white quad, which is worse than nothing. */
|
||||
if (!im.handle.ptr) return;
|
||||
@@ -284,7 +284,7 @@ chevron_at(App *app, struct nk_context *ctx, struct nk_rect slot,
|
||||
const char *name, struct nk_color col)
|
||||
{
|
||||
struct nk_rect r;
|
||||
struct nk_image im = curie_ionicon_col(app, name, CHEVRON_PX, col);
|
||||
struct nk_image im = reaktor_ionicon_col(app, name, CHEVRON_PX, col);
|
||||
|
||||
r.w = r.h = (float)CHEVRON_PX;
|
||||
r.x = slot.x + (slot.w - r.w) * 0.5f;
|
||||
@@ -318,7 +318,7 @@ shaded(struct nk_color c, float amount)
|
||||
unsigned char rgba[4];
|
||||
|
||||
rgba[0] = c.r; rgba[1] = c.g; rgba[2] = c.b; rgba[3] = c.a;
|
||||
curie_style_darken(rgba, amount);
|
||||
reaktor_style_darken(rgba, amount);
|
||||
return nk_rgba(rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ slider_cell(App *app, struct nk_context *ctx, unsigned id, float *val,
|
||||
/* The arrows, if this is what has focus: applied here rather than in the
|
||||
* shell, which knows neither the bounds nor the grain of the value. */
|
||||
{
|
||||
int steps = curie_focus_step(app, id);
|
||||
int steps = reaktor_focus_step(app, id);
|
||||
|
||||
if (steps) {
|
||||
*val += step * (float)steps;
|
||||
@@ -379,7 +379,7 @@ slider_cell(App *app, struct nk_context *ctx, unsigned id, float *val,
|
||||
}
|
||||
/* And the same three numbers to the tree, after the arrows rather than
|
||||
* before, so a client reads the value it has just been given. */
|
||||
curie_note_range(app, id, *val, lo, hi, step);
|
||||
reaktor_note_range(app, id, *val, lo, hi, step);
|
||||
|
||||
in = nk_rect(b.x + st->padding.x, b.y + st->padding.y,
|
||||
b.w - 2.0f * st->padding.x, b.h - 2.0f * st->padding.y);
|
||||
@@ -392,8 +392,8 @@ slider_cell(App *app, struct nk_context *ctx, unsigned id, float *val,
|
||||
in.y + in.h * 0.5f - st->cursor_size.y * 0.5f,
|
||||
st->cursor_size.x, st->cursor_size.y);
|
||||
|
||||
curie_fill_round(app, cv, bar, cap, track);
|
||||
if (fl.w >= 1.0f) curie_fill_round(app, cv, fl, cap, filled);
|
||||
reaktor_fill_round(app, cv, bar, cap, track);
|
||||
if (fl.w >= 1.0f) reaktor_fill_round(app, cv, fl, cap, filled);
|
||||
glyph_at(app, ctx, kn, DISC_ROUND, knob,
|
||||
(int)(st->cursor_size.x < st->cursor_size.y ? st->cursor_size.x
|
||||
: st->cursor_size.y),
|
||||
@@ -413,7 +413,7 @@ slider_cell_int(App *app, struct nk_context *ctx, unsigned id, int *val,
|
||||
}
|
||||
|
||||
/* Nuklear draws neither of the bar's two rounded rects: they are the shape
|
||||
* curie_fill_round exists for, and its corners are the only ones on the page
|
||||
* reaktor_fill_round exists for, and its corners are the only ones on the page
|
||||
* that are actually curves rather than stairs. So the style items go
|
||||
* transparent for the call - which keeps the geometry, the drag and the
|
||||
* value - and the track and the fill are drawn here.
|
||||
@@ -459,9 +459,9 @@ progress_cell(App *app, struct nk_context *ctx, nk_size *cur, nk_size max,
|
||||
nk_style_pop_style_item(ctx);
|
||||
|
||||
if (track_it.type == NK_STYLE_ITEM_COLOR)
|
||||
curie_fill_round(app, cv, b, track_r, track_it.data.color);
|
||||
reaktor_fill_round(app, cv, b, track_r, track_it.data.color);
|
||||
if (fill.w >= 1.0f && fill_it.type == NK_STYLE_ITEM_COLOR)
|
||||
curie_fill_round(app, cv, fill, r, fill_it.data.color);
|
||||
reaktor_fill_round(app, cv, fill, r, fill_it.data.color);
|
||||
}
|
||||
|
||||
/* The knob is the same again, and the widget the stylesheet reaches least:
|
||||
@@ -533,7 +533,7 @@ knob_cell(App *app, struct nk_context *ctx, float *val, float lo, float hi,
|
||||
|
||||
/* A stepper's hover wash, round rather than the square Nuklear draws: the
|
||||
* slot is a square the height of the font, so half of it is a circle, and
|
||||
* curie_fill_round makes it one that is actually round. Nuklear draws none -
|
||||
* reaktor_fill_round makes it one that is actually round. Nuklear draws none -
|
||||
* see stepper_push. */
|
||||
static void
|
||||
stepper_wash(App *app, struct nk_context *ctx, struct nk_rect sq)
|
||||
@@ -541,11 +541,11 @@ stepper_wash(App *app, struct nk_context *ctx, struct nk_rect sq)
|
||||
struct nk_color wash;
|
||||
|
||||
if (!nk_input_is_mouse_hovering_rect(&ctx->input, sq)) return;
|
||||
wash = curie_token("--background-hover", ctx->style.property.hover.type
|
||||
wash = reaktor_token("--background-hover", ctx->style.property.hover.type
|
||||
== NK_STYLE_ITEM_COLOR
|
||||
? ctx->style.property.hover.data.color
|
||||
: ctx->style.text.color);
|
||||
curie_fill_round(app, nk_window_get_canvas(ctx), sq, sq.w * 0.5f, wash);
|
||||
reaktor_fill_round(app, nk_window_get_canvas(ctx), sq, sq.w * 0.5f, wash);
|
||||
}
|
||||
|
||||
/* The two steppers of a property, placed the way nk_do_property places
|
||||
@@ -624,17 +624,17 @@ static void
|
||||
draw_tooltip(App *app, struct nk_context *ctx, const char *const *lines,
|
||||
int n, float bar)
|
||||
{
|
||||
const struct nk_user_font *f = curie_font(app, 13, 0);
|
||||
const struct nk_user_font *f = reaktor_font(app, 13, 0);
|
||||
struct nk_command_buffer *canvas = nk_window_get_canvas(ctx);
|
||||
/* --background-hover, not --background: a tooltip floats above whatever
|
||||
* it is describing, and against a panel of the very same colour it read
|
||||
* as though it were half transparent. This is the palette's next step up
|
||||
* and sits clear of both the page and a panel. */
|
||||
struct nk_color fill = curie_token("--background-hover",
|
||||
struct nk_color fill = reaktor_token("--background-hover",
|
||||
nk_rgb(69, 69, 69));
|
||||
struct nk_color ink = curie_token("--text-main", nk_rgb(247, 247, 247));
|
||||
struct nk_color edge = curie_token("--text-muted", nk_rgb(192, 192, 192));
|
||||
struct nk_color acc = curie_token("--links", nk_rgb(86, 199, 255));
|
||||
struct nk_color ink = reaktor_token("--text-main", nk_rgb(247, 247, 247));
|
||||
struct nk_color edge = reaktor_token("--text-muted", nk_rgb(192, 192, 192));
|
||||
struct nk_color acc = reaktor_token("--links", nk_rgb(86, 199, 255));
|
||||
float pad = 10.0f, line = f->height + 6.0f;
|
||||
float w = 0.0f, h = 2.0f * pad + (float)n * line;
|
||||
struct nk_rect r;
|
||||
@@ -667,7 +667,7 @@ draw_tooltip(App *app, struct nk_context *ctx, const char *const *lines,
|
||||
struct nk_rect track = nk_rect(r.x + pad, r.y + h - pad - 6.0f,
|
||||
r.w - 2.0f * pad, 6.0f);
|
||||
nk_fill_rect(canvas, track, 3.0f,
|
||||
curie_token("--background-body", nk_rgb(37, 37, 37)));
|
||||
reaktor_token("--background-body", nk_rgb(37, 37, 37)));
|
||||
track.w *= bar;
|
||||
nk_fill_rect(canvas, track, 3.0f, acc);
|
||||
}
|
||||
@@ -695,13 +695,13 @@ item_with_icon(App *app, struct nk_context *ctx, const char *label,
|
||||
struct nk_image im;
|
||||
int hit;
|
||||
|
||||
curie_hot_top(app, b, 1, 1);
|
||||
curie_note(app, CURIE_A11Y_MENUITEM, label, NULL, 0, b);
|
||||
reaktor_hot_top(app, b, 1, 1);
|
||||
reaktor_note(app, REAKTOR_A11Y_MENUITEM, label, NULL, 0, b);
|
||||
hit = contextual ? nk_contextual_item_label(ctx, label, NK_TEXT_LEFT)
|
||||
: nk_menu_item_label(ctx, label, NK_TEXT_LEFT);
|
||||
|
||||
r = nk_rect(b.x + b.w - px - 8.0f, b.y + (b.h - px) * 0.5f, px, px);
|
||||
im = curie_ionicon(app, ionicon, (int)px);
|
||||
im = reaktor_ionicon(app, ionicon, (int)px);
|
||||
nk_draw_image(nk_window_get_canvas(ctx), r, &im, nk_rgb(255, 255, 255));
|
||||
return hit;
|
||||
}
|
||||
@@ -712,8 +712,8 @@ menu_item(App *app, struct nk_context *ctx, const char *label, int contextual)
|
||||
{
|
||||
{
|
||||
struct nk_rect b = nk_widget_bounds(ctx);
|
||||
curie_hot_top(app, b, 1, 1);
|
||||
curie_note(app, CURIE_A11Y_MENUITEM, label, NULL, 0, b);
|
||||
reaktor_hot_top(app, b, 1, 1);
|
||||
reaktor_note(app, REAKTOR_A11Y_MENUITEM, label, NULL, 0, b);
|
||||
}
|
||||
return contextual ? nk_contextual_item_label(ctx, label, NK_TEXT_LEFT)
|
||||
: nk_menu_item_label(ctx, label, NK_TEXT_LEFT);
|
||||
@@ -733,14 +733,14 @@ hot(App *app, struct nk_context *ctx, unsigned char role, const char *name,
|
||||
{
|
||||
struct nk_rect b = nk_widget_bounds(ctx);
|
||||
|
||||
curie_hot(app, b, 1, 1);
|
||||
/* CURIE_A11Y_NONE means the caller has already reported it - a widget
|
||||
reaktor_hot(app, b, 1, 1);
|
||||
/* REAKTOR_A11Y_NONE means the caller has already reported it - a widget
|
||||
* whose value has to be formatted first reports itself, then asks for the
|
||||
* cursor. Reporting it twice would give a reader two of it. Answers with
|
||||
* the node's id, which a widget that takes its own activation needs and
|
||||
* every other caller ignores. */
|
||||
if (role == CURIE_A11Y_NONE) return 0;
|
||||
return curie_note(app, role, name, NULL, state, b);
|
||||
if (role == REAKTOR_A11Y_NONE) return 0;
|
||||
return reaktor_note(app, role, name, NULL, state, b);
|
||||
}
|
||||
|
||||
/* Checkboxes and radios sit the way the Edit menu sits them: label at the
|
||||
@@ -772,12 +772,12 @@ check_row(struct nk_context *ctx, int cells)
|
||||
static void
|
||||
check_cell(App *app, struct nk_context *ctx, const char *label, nk_bool *on)
|
||||
{
|
||||
unsigned id = hot(app, ctx, CURIE_A11Y_CHECKBOX, label,
|
||||
*on ? CURIE_A11Y_CHECKED : 0u);
|
||||
unsigned id = hot(app, ctx, REAKTOR_A11Y_CHECKBOX, label,
|
||||
*on ? REAKTOR_A11Y_CHECKED : 0u);
|
||||
|
||||
/* Enter, or a screen reader's press, taken here rather than delivered as
|
||||
* a click on the box - see curie_focus_activated. */
|
||||
if (curie_focus_activated(app, id)) *on = !*on;
|
||||
* a click on the box - see reaktor_focus_activated. */
|
||||
if (reaktor_focus_activated(app, id)) *on = !*on;
|
||||
nk_checkbox_label_align(ctx, label, on, CHECK_ALIGN);
|
||||
nk_spacer(ctx);
|
||||
}
|
||||
@@ -789,10 +789,10 @@ flags_cell(App *app, struct nk_context *ctx, const char *label,
|
||||
unsigned *flags, unsigned value)
|
||||
{
|
||||
nk_bool on = (*flags & value) != 0;
|
||||
unsigned id = hot(app, ctx, CURIE_A11Y_CHECKBOX, label,
|
||||
on ? CURIE_A11Y_CHECKED : 0u);
|
||||
unsigned id = hot(app, ctx, REAKTOR_A11Y_CHECKBOX, label,
|
||||
on ? REAKTOR_A11Y_CHECKED : 0u);
|
||||
|
||||
if (curie_focus_activated(app, id)) on = !on;
|
||||
if (reaktor_focus_activated(app, id)) on = !on;
|
||||
if (nk_checkbox_label_align(ctx, label, &on, CHECK_ALIGN) ||
|
||||
(*flags & value) != (on ? value : 0u)) {
|
||||
if (on) *flags |= value;
|
||||
@@ -821,10 +821,10 @@ radio_cell(App *app, struct nk_context *ctx, const char *label, int *sel,
|
||||
int on = *sel == value;
|
||||
|
||||
{
|
||||
unsigned id = hot(app, ctx, CURIE_A11Y_RADIO, label,
|
||||
on ? CURIE_A11Y_CHECKED : 0u);
|
||||
unsigned id = hot(app, ctx, REAKTOR_A11Y_RADIO, label,
|
||||
on ? REAKTOR_A11Y_CHECKED : 0u);
|
||||
|
||||
if (curie_focus_activated(app, id)) { *sel = value; on = 1; }
|
||||
if (reaktor_focus_activated(app, id)) { *sel = value; on = 1; }
|
||||
}
|
||||
|
||||
/* Nuklear draws nothing for the circle: its fills are pushed transparent
|
||||
@@ -872,12 +872,12 @@ radio_cell(App *app, struct nk_context *ctx, const char *label, int *sel,
|
||||
static int
|
||||
demo_button(App *app, struct nk_context *ctx, const char *label)
|
||||
{
|
||||
unsigned id = hot(app, ctx, CURIE_A11Y_BUTTON, label, 0);
|
||||
unsigned id = hot(app, ctx, REAKTOR_A11Y_BUTTON, label, 0);
|
||||
int hit = nk_button_label(ctx, label);
|
||||
|
||||
/* Both, always: `||` would short-circuit and leave the activation for the
|
||||
* frame to turn into a second press. */
|
||||
if (curie_focus_activated(app, id)) hit = 1;
|
||||
if (reaktor_focus_activated(app, id)) hit = 1;
|
||||
return hit;
|
||||
}
|
||||
|
||||
@@ -967,9 +967,9 @@ page_buttons(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
api(app, ctx, "nk_button_label / nk_button_image_label");
|
||||
|
||||
nk_layout_row_dynamic(ctx, 38.0f, 3);
|
||||
if (curie_button(app, ctx, "Default")) s->presses++;
|
||||
if (curie_button_accent(app, ctx, "Primary")) s->presses++;
|
||||
if (curie_button_icon(app, ctx, "key-outline", "With icon")) s->presses++;
|
||||
if (reaktor_button(app, ctx, "Default")) s->presses++;
|
||||
if (reaktor_button_accent(app, ctx, "Primary")) s->presses++;
|
||||
if (reaktor_button_icon(app, ctx, "key-outline", "With icon")) s->presses++;
|
||||
|
||||
section(app, ctx, "Icons",
|
||||
"Every icon is an Ionicon, read out of the submodule and "
|
||||
@@ -978,19 +978,19 @@ page_buttons(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
"before it is parsed, which is how an icon follows the "
|
||||
"stylesheet: CSS cannot reach inside an SVG. The label is the "
|
||||
"icon's name to a reader as well as to the eye.");
|
||||
api(app, ctx, "nk_button_image_label / curie_button_icon");
|
||||
api(app, ctx, "nk_button_image_label / reaktor_button_icon");
|
||||
|
||||
nk_layout_row_dynamic(ctx, 38.0f, 4);
|
||||
for (i = 0; i < ICON_N; i++)
|
||||
if (curie_button_icon(app, ctx, g_icons[i].icon, g_icons[i].label))
|
||||
if (reaktor_button_icon(app, ctx, g_icons[i].icon, g_icons[i].label))
|
||||
s->presses++;
|
||||
|
||||
nk_layout_row_dynamic(ctx, 38.0f, 3);
|
||||
if (curie_button_icon(app, ctx, "chevron-back-outline", "Back"))
|
||||
if (reaktor_button_icon(app, ctx, "chevron-back-outline", "Back"))
|
||||
s->presses++;
|
||||
if (curie_button_icon(app, ctx, "chevron-forward-outline", "Forward"))
|
||||
if (reaktor_button_icon(app, ctx, "chevron-forward-outline", "Forward"))
|
||||
s->presses++;
|
||||
if (curie_button_icon(app, ctx, "menu-outline", "Menu"))
|
||||
if (reaktor_button_icon(app, ctx, "menu-outline", "Menu"))
|
||||
s->presses++;
|
||||
|
||||
section(app, ctx, "Colour, image, repeat and disabled",
|
||||
@@ -1015,32 +1015,32 @@ page_buttons(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
nk_layout_row_template_push_dynamic(ctx);
|
||||
nk_layout_row_template_end(ctx);
|
||||
compact_push(ctx);
|
||||
if (curie_button_color(app, ctx, "Tint swatch", nk_rgb_cf(s->tint)))
|
||||
if (reaktor_button_color(app, ctx, "Tint swatch", nk_rgb_cf(s->tint)))
|
||||
s->presses++;
|
||||
hot(app, ctx, CURIE_A11Y_BUTTON, "Download", 0);
|
||||
if (nk_button_image(ctx, curie_ionicon(app, "cloud-download-outline", 24)))
|
||||
hot(app, ctx, REAKTOR_A11Y_BUTTON, "Download", 0);
|
||||
if (nk_button_image(ctx, reaktor_ionicon(app, "cloud-download-outline", 24)))
|
||||
s->presses++;
|
||||
compact_pop(ctx);
|
||||
|
||||
nk_button_set_behavior(ctx, NK_BUTTON_REPEATER);
|
||||
hot(app, ctx, CURIE_A11Y_BUTTON, "Hold me", 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_BUTTON, "Hold me", 0);
|
||||
if (nk_button_label(ctx, "Hold me")) s->repeats++;
|
||||
nk_button_set_behavior(ctx, NK_BUTTON_DEFAULT);
|
||||
|
||||
nk_widget_disable_begin(ctx);
|
||||
/* Not through hot(): a disabled control takes no pointer, but a reader
|
||||
* should still find it and be told why it cannot be used. */
|
||||
curie_note_here(app, ctx, CURIE_A11Y_BUTTON, "Disabled",
|
||||
CURIE_A11Y_DISABLED);
|
||||
reaktor_note_here(app, ctx, REAKTOR_A11Y_BUTTON, "Disabled",
|
||||
REAKTOR_A11Y_DISABLED);
|
||||
nk_button_label(ctx, "Disabled");
|
||||
nk_widget_disable_end(ctx);
|
||||
|
||||
nk_layout_row_dynamic(ctx, ROW_SMALL, 1);
|
||||
SDL_snprintf(line, sizeof(line), "%d presses, %d repeat ticks",
|
||||
s->presses, s->repeats);
|
||||
nk_style_push_font(ctx, curie_font(app, 13, 0));
|
||||
nk_style_push_font(ctx, reaktor_font(app, 13, 0));
|
||||
nk_label_colored(ctx, line, NK_TEXT_LEFT,
|
||||
curie_token("--text-muted", ctx->style.text.color));
|
||||
reaktor_token("--text-muted", ctx->style.text.color));
|
||||
nk_style_pop_font(ctx);
|
||||
|
||||
section(app, ctx, "Checkboxes and radios",
|
||||
@@ -1068,9 +1068,9 @@ page_buttons(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
|
||||
nk_layout_row_dynamic(ctx, ROW_SMALL, 1);
|
||||
SDL_snprintf(line, sizeof(line), "flags = 0x%02x", s->flags);
|
||||
nk_style_push_font(ctx, curie_font(app, 13, 0));
|
||||
nk_style_push_font(ctx, reaktor_font(app, 13, 0));
|
||||
nk_label_colored(ctx, line, NK_TEXT_LEFT,
|
||||
curie_token("--text-muted", ctx->style.text.color));
|
||||
reaktor_token("--text-muted", ctx->style.text.color));
|
||||
nk_style_pop_font(ctx);
|
||||
|
||||
check_row(ctx, 3);
|
||||
@@ -1091,8 +1091,8 @@ page_buttons(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
for (i = 0; i < 4; i++) {
|
||||
char lab[16];
|
||||
SDL_snprintf(lab, sizeof(lab), "Tile %d", i + 1);
|
||||
hot(app, ctx, CURIE_A11Y_LISTITEM, lab,
|
||||
s->sel_tile[i] ? CURIE_A11Y_SELECTED : 0u);
|
||||
hot(app, ctx, REAKTOR_A11Y_LISTITEM, lab,
|
||||
s->sel_tile[i] ? REAKTOR_A11Y_SELECTED : 0u);
|
||||
nk_selectable_label(ctx, lab, NK_TEXT_CENTERED, &s->sel_tile[i]);
|
||||
}
|
||||
|
||||
@@ -1106,8 +1106,8 @@ page_buttons(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
* left with the label centred is the arrangement that reads as one
|
||||
* control rather than two things at opposite ends. */
|
||||
nk_layout_row_static(ctx, 32.0f, 190, 2);
|
||||
hot(app, ctx, CURIE_A11Y_LISTITEM, "With a symbol",
|
||||
s->sel_row ? CURIE_A11Y_SELECTED : 0u);
|
||||
hot(app, ctx, REAKTOR_A11Y_LISTITEM, "With a symbol",
|
||||
s->sel_row ? REAKTOR_A11Y_SELECTED : 0u);
|
||||
{
|
||||
/* NK_SYMBOL_NONE and the disc drawn into the slot Nuklear sized for
|
||||
* it - nk_do_selectable_symbol's icon rect, which for any alignment
|
||||
@@ -1129,19 +1129,19 @@ page_buttons(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
s->sel_row ? st->text_pressed : st->text_normal,
|
||||
(int)(icon.w < icon.h ? icon.w : icon.h), 0.0f);
|
||||
}
|
||||
hot(app, ctx, CURIE_A11Y_LISTITEM, "With an image",
|
||||
s->toggle ? CURIE_A11Y_SELECTED : 0u);
|
||||
hot(app, ctx, REAKTOR_A11Y_LISTITEM, "With an image",
|
||||
s->toggle ? REAKTOR_A11Y_SELECTED : 0u);
|
||||
{
|
||||
/* Selected, the row is filled with the accent and the label switches
|
||||
* to whatever reads on it; the icon has to make the same move or it
|
||||
* is the one thing on the row that does not. */
|
||||
struct nk_color accent = curie_token("--links", ctx->style.text.color);
|
||||
struct nk_color accent = reaktor_token("--links", ctx->style.text.color);
|
||||
struct nk_color ink = s->toggle
|
||||
? curie_on(accent)
|
||||
: curie_token("--text-muted", ctx->style.text.color);
|
||||
? reaktor_on(accent)
|
||||
: reaktor_token("--text-muted", ctx->style.text.color);
|
||||
|
||||
nk_selectable_image_label(ctx,
|
||||
curie_ionicon_col(app, "star-outline", 16, ink),
|
||||
reaktor_ionicon_col(app, "star-outline", 16, ink),
|
||||
"With an image", NK_TEXT_CENTERED, &s->toggle);
|
||||
}
|
||||
|
||||
@@ -1170,19 +1170,19 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
api(app, ctx, "nk_edit_string with nk_filter_default / _decimal / _hex");
|
||||
|
||||
nk_layout_row_dynamic(ctx, 36.0f, 1);
|
||||
curie_field(app, ctx, NK_EDIT_FIELD, s->name, &s->name_len,
|
||||
reaktor_field(app, ctx, NK_EDIT_FIELD, s->name, &s->name_len,
|
||||
SC_TEXT_CAP, "Full name", nk_filter_default);
|
||||
|
||||
nk_layout_row_dynamic(ctx, 36.0f, 2);
|
||||
curie_field(app, ctx, NK_EDIT_FIELD, s->digits, &s->digits_len,
|
||||
reaktor_field(app, ctx, NK_EDIT_FIELD, s->digits, &s->digits_len,
|
||||
SC_TEXT_CAP, "Digits only", nk_filter_decimal);
|
||||
curie_field(app, ctx, NK_EDIT_FIELD, s->hex, &s->hex_len,
|
||||
reaktor_field(app, ctx, NK_EDIT_FIELD, s->hex, &s->hex_len,
|
||||
SC_TEXT_CAP, "Hex only", nk_filter_hex);
|
||||
|
||||
api(app, ctx, "nk_edit_string with NK_EDIT_BOX "
|
||||
"(Nuklear breaks lines on newlines only - there is no wrap)");
|
||||
nk_layout_row_dynamic(ctx, 92.0f, 1);
|
||||
curie_field(app, ctx, NK_EDIT_BOX, s->note, &s->note_len,
|
||||
reaktor_field(app, ctx, NK_EDIT_BOX, s->note, &s->note_len,
|
||||
SC_BOX_CAP, NULL, nk_filter_default);
|
||||
|
||||
section(app, ctx, "Ranges",
|
||||
@@ -1196,33 +1196,33 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
|
||||
nk_layout_row_dynamic(ctx, ROW, 2);
|
||||
SDL_snprintf(line, sizeof(line), "%.2f", (double)s->slider_f);
|
||||
id = curie_note(app, CURIE_A11Y_SLIDER, "Float", line, 0,
|
||||
id = reaktor_note(app, REAKTOR_A11Y_SLIDER, "Float", line, 0,
|
||||
nk_widget_bounds(ctx));
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
slider_cell(app, ctx, id, &s->slider_f, 0.0f, 1.0f, 0.01f);
|
||||
nk_label(ctx, line, NK_TEXT_LEFT);
|
||||
|
||||
nk_layout_row_dynamic(ctx, ROW, 2);
|
||||
SDL_snprintf(line, sizeof(line), "%d", s->slider_i);
|
||||
id = curie_note(app, CURIE_A11Y_SLIDER, "Integer", line, 0,
|
||||
id = reaktor_note(app, REAKTOR_A11Y_SLIDER, "Integer", line, 0,
|
||||
nk_widget_bounds(ctx));
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
slider_cell_int(app, ctx, id, &s->slider_i, 0, 100, 1);
|
||||
nk_label(ctx, line, NK_TEXT_LEFT);
|
||||
|
||||
nk_layout_row_dynamic(ctx, ROW, 2);
|
||||
SDL_snprintf(line, sizeof(line), "%d", (int)s->progress);
|
||||
curie_note(app, CURIE_A11Y_PROGRESS, "Progress", line, 0,
|
||||
reaktor_note(app, REAKTOR_A11Y_PROGRESS, "Progress", line, 0,
|
||||
nk_widget_bounds(ctx));
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
progress_cell(app, ctx, &s->progress, 100, NK_MODIFIABLE);
|
||||
nk_label(ctx, "modifiable - drag it", NK_TEXT_LEFT);
|
||||
|
||||
nk_layout_row_static(ctx, 62.0f, 62, 2);
|
||||
SDL_snprintf(line, sizeof(line), "%.2f", (double)s->knob);
|
||||
curie_note(app, CURIE_A11Y_SLIDER, "Knob", line, 0,
|
||||
reaktor_note(app, REAKTOR_A11Y_SLIDER, "Knob", line, 0,
|
||||
nk_widget_bounds(ctx));
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
knob_cell(app, ctx, &s->knob, 0.0f, 1.0f, NK_DOWN);
|
||||
nk_spacer(ctx);
|
||||
|
||||
@@ -1239,8 +1239,8 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
|
||||
pb = nk_widget_bounds(ctx);
|
||||
SDL_snprintf(line, sizeof(line), "%d", s->prop_i);
|
||||
curie_note(app, CURIE_A11Y_SPINBUTTON, "Columns:", line, 0, pb);
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
reaktor_note(app, REAKTOR_A11Y_SPINBUTTON, "Columns:", line, 0, pb);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
stepper_push(ctx);
|
||||
nk_property_int(ctx, "Columns:", 1, &s->prop_i, 24, 1, 0.25f);
|
||||
stepper_pop(ctx);
|
||||
@@ -1248,8 +1248,8 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
|
||||
pb = nk_widget_bounds(ctx);
|
||||
SDL_snprintf(line, sizeof(line), "%.2f", (double)s->prop_f);
|
||||
curie_note(app, CURIE_A11Y_SPINBUTTON, "Stroke:", line, 0, pb);
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
reaktor_note(app, REAKTOR_A11Y_SPINBUTTON, "Stroke:", line, 0, pb);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
stepper_push(ctx);
|
||||
nk_property_float(ctx, "Stroke:", 0.25f, &s->prop_f, 8.0f, 0.05f,
|
||||
0.01f);
|
||||
@@ -1258,8 +1258,8 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
|
||||
pb = nk_widget_bounds(ctx);
|
||||
SDL_snprintf(line, sizeof(line), "%.2f", s->prop_d);
|
||||
curie_note(app, CURIE_A11Y_SPINBUTTON, "Ratio:", line, 0, pb);
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
reaktor_note(app, REAKTOR_A11Y_SPINBUTTON, "Ratio:", line, 0, pb);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
stepper_push(ctx);
|
||||
nk_property_double(ctx, "Ratio:", 0.0, &s->prop_d, 100.0, 0.25,
|
||||
0.05f);
|
||||
@@ -1281,7 +1281,7 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
* number of pixels makes the frame even. */
|
||||
popup_style_push(ctx);
|
||||
nk_layout_row_static(ctx, ROW_TALL, 440, 2);
|
||||
hot(app, ctx, CURIE_A11Y_COMBOBOX, "Size", 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_COMBOBOX, "Size", 0);
|
||||
{
|
||||
/* The popup takes an explicit size, so "as wide as the box" has to
|
||||
* be asked for - nk_widget_width is the box that is about to be
|
||||
@@ -1299,7 +1299,7 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
* the only handle on it. */
|
||||
nk_style_push_vec2(ctx, &ctx->style.combo.content_padding,
|
||||
nk_vec2(ctx->style.combo.content_padding.x, 9.0f));
|
||||
hot(app, ctx, CURIE_A11Y_COMBOBOX, "Size, with a symbol", 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_COMBOBOX, "Size, with a symbol", 0);
|
||||
{
|
||||
struct nk_rect h = nk_widget_bounds(ctx);
|
||||
|
||||
@@ -1319,9 +1319,9 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
nk_layout_row_dynamic(ctx, 26.0f, 1);
|
||||
for (i = 0; i < 3; i++) {
|
||||
struct nk_rect ib = nk_widget_bounds(ctx);
|
||||
curie_hot_top(app, ib, 1, 1);
|
||||
curie_note(app, CURIE_A11Y_LISTITEM, sizes[i], NULL,
|
||||
i == s->combo_size ? CURIE_A11Y_SELECTED : 0u, ib);
|
||||
reaktor_hot_top(app, ib, 1, 1);
|
||||
reaktor_note(app, REAKTOR_A11Y_LISTITEM, sizes[i], NULL,
|
||||
i == s->combo_size ? REAKTOR_A11Y_SELECTED : 0u, ib);
|
||||
if (nk_combo_item_label(ctx, sizes[i], NK_TEXT_LEFT))
|
||||
s->combo_size = i;
|
||||
}
|
||||
@@ -1334,7 +1334,7 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
nk_style_pop_vec2(ctx);
|
||||
|
||||
nk_layout_row_static(ctx, ROW_TALL, 440, 2);
|
||||
hot(app, ctx, CURIE_A11Y_COMBOBOX, "Tint", 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_COMBOBOX, "Tint", 0);
|
||||
{
|
||||
/* nk_combo_begin_label with an empty label, and the swatch painted
|
||||
* here.
|
||||
@@ -1361,7 +1361,7 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
combo_chrome(app, ctx, h, 2.0f);
|
||||
}
|
||||
|
||||
hot(app, ctx, CURIE_A11Y_COMBOBOX, "Anything at all", 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_COMBOBOX, "Anything at all", 0);
|
||||
{
|
||||
struct nk_rect h = nk_widget_bounds(ctx);
|
||||
|
||||
@@ -1385,7 +1385,7 @@ page_inputs(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
api(app, ctx, "nk_color_pick");
|
||||
|
||||
nk_layout_row_static(ctx, 132.0f, 210, 2);
|
||||
hot(app, ctx, CURIE_A11Y_GROUP, "Colour picker", 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_GROUP, "Colour picker", 0);
|
||||
nk_color_pick(ctx, &s->tint, NK_RGB);
|
||||
if (nk_group_begin(ctx, "swatch", NK_WINDOW_NO_SCROLLBAR)) {
|
||||
struct nk_color c = nk_rgb_cf(s->tint);
|
||||
@@ -1431,7 +1431,7 @@ grid_row(App *app, struct nk_context *ctx, const char *const *cells, int n,
|
||||
0.0f, bg);
|
||||
}
|
||||
|
||||
nk_style_push_font(ctx, curie_font(app, 13, header));
|
||||
nk_style_push_font(ctx, reaktor_font(app, 13, header));
|
||||
nk_style_push_color(ctx, &ctx->style.text.color, fg);
|
||||
nk_style_push_vec2(ctx, &ctx->style.text.padding, nk_vec2(pad, 0.0f));
|
||||
for (i = 0; i < n; i++) {
|
||||
@@ -1461,7 +1461,7 @@ section_grid(App *app, struct nk_context *ctx)
|
||||
};
|
||||
static const float weights[3] = { 0.24f, 0.16f, 0.60f };
|
||||
|
||||
curie_style tbl, head_s, cell;
|
||||
reaktor_style tbl, head_s, cell;
|
||||
struct nk_color odd, even, head_bg, head_fg;
|
||||
float pad;
|
||||
int i;
|
||||
@@ -1474,12 +1474,12 @@ section_grid(App *app, struct nk_context *ctx)
|
||||
"read straight out of tiny.css.");
|
||||
api(app, ctx, "nk_layout_row_begin(NK_DYNAMIC) + nk_fill_rect per row");
|
||||
|
||||
curie_style_get("table", &tbl);
|
||||
curie_style_get("thead", &head_s);
|
||||
curie_style_get("th", &cell);
|
||||
reaktor_style_get("table", &tbl);
|
||||
reaktor_style_get("thead", &head_s);
|
||||
reaktor_style_get("th", &cell);
|
||||
|
||||
odd = curie_token("--table-bg", nk_rgb(53, 53, 53));
|
||||
even = curie_token("--table-bg-alt", nk_rgb(37, 37, 37));
|
||||
odd = reaktor_token("--table-bg", nk_rgb(53, 53, 53));
|
||||
even = reaktor_token("--table-bg-alt", nk_rgb(37, 37, 37));
|
||||
|
||||
{
|
||||
/* thead asks for --table, and in the light palette that is #0070E0 -
|
||||
@@ -1492,15 +1492,15 @@ section_grid(App *app, struct nk_context *ctx)
|
||||
* colour the stylesheet itself uses for this in the theme where the
|
||||
* chain resolves, which makes it the sheet's own intent rather than
|
||||
* ours. */
|
||||
struct nk_color page = curie_token("--background-body", nk_rgb(37, 37, 37));
|
||||
struct nk_color accent = curie_token("--links", nk_rgb(0, 112, 224));
|
||||
struct nk_color page = reaktor_token("--background-body", nk_rgb(37, 37, 37));
|
||||
struct nk_color accent = reaktor_token("--links", nk_rgb(0, 112, 224));
|
||||
struct nk_color want = head_s.matched && head_s.bg[3]
|
||||
? curie_col(head_s.bg)
|
||||
: curie_token("--table", accent);
|
||||
? reaktor_col(head_s.bg)
|
||||
: reaktor_token("--table", accent);
|
||||
|
||||
head_bg = curie_visible(want, page, accent);
|
||||
head_bg = curie_visible(head_bg, odd, accent);
|
||||
head_fg = curie_on(head_bg);
|
||||
head_bg = reaktor_visible(want, page, accent);
|
||||
head_bg = reaktor_visible(head_bg, odd, accent);
|
||||
head_fg = reaktor_on(head_bg);
|
||||
}
|
||||
pad = cell.matched && cell.pad_x > 0.0f ? cell.pad_x : 8.0f;
|
||||
|
||||
@@ -1534,11 +1534,11 @@ page_display(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
|
||||
nk_layout_row_dynamic(ctx, ROW_SMALL, 3);
|
||||
nk_label_colored(ctx, "--text-main", NK_TEXT_LEFT,
|
||||
curie_token("--text-main", ctx->style.text.color));
|
||||
reaktor_token("--text-main", ctx->style.text.color));
|
||||
nk_label_colored(ctx, "--text-muted", NK_TEXT_CENTERED,
|
||||
curie_token("--text-muted", ctx->style.text.color));
|
||||
reaktor_token("--text-muted", ctx->style.text.color));
|
||||
nk_label_colored(ctx, "--links", NK_TEXT_RIGHT,
|
||||
curie_token("--links", ctx->style.text.color));
|
||||
reaktor_token("--links", ctx->style.text.color));
|
||||
|
||||
nk_layout_row_dynamic(ctx, 40.0f, 1);
|
||||
nk_label_wrap(ctx, "nk_label_wrap breaks on words inside the row it was "
|
||||
@@ -1563,7 +1563,7 @@ page_display(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
|
||||
nk_layout_row_static(ctx, 30.0f, 30, 8);
|
||||
for (k = 0; k < 8; k++)
|
||||
curie_image(app, ctx, curie_ionicon(app, names[k], 22), 22);
|
||||
reaktor_image(app, ctx, reaktor_ionicon(app, names[k], 22), 22);
|
||||
}
|
||||
|
||||
section(app, ctx, "Charts",
|
||||
@@ -1630,40 +1630,40 @@ page_display(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
struct nk_rect hb = nk_widget_bounds(ctx);
|
||||
int open;
|
||||
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
open = nk_tree_push(ctx, NK_TREE_TAB, "A tab-style tree", NK_MAXIMIZED);
|
||||
tree_chevron(app, ctx, hb, open);
|
||||
curie_note_push(app, CURIE_A11Y_TREEITEM, "A tab-style tree", NULL,
|
||||
open ? CURIE_A11Y_EXPANDED : 0u, hb);
|
||||
reaktor_note_push(app, REAKTOR_A11Y_TREEITEM, "A tab-style tree", NULL,
|
||||
open ? REAKTOR_A11Y_EXPANDED : 0u, hb);
|
||||
if (open) {
|
||||
nk_layout_row_dynamic(ctx, ROW_SMALL, 1);
|
||||
nk_label(ctx, "Its children are indented under it.", NK_TEXT_LEFT);
|
||||
|
||||
hb = nk_widget_bounds(ctx);
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
open = nk_tree_push(ctx, NK_TREE_NODE, "A node inside it",
|
||||
NK_MINIMIZED);
|
||||
tree_chevron(app, ctx, hb, open);
|
||||
curie_note_push(app, CURIE_A11Y_TREEITEM, "A node inside it", NULL,
|
||||
open ? CURIE_A11Y_EXPANDED : 0u, hb);
|
||||
reaktor_note_push(app, REAKTOR_A11Y_TREEITEM, "A node inside it", NULL,
|
||||
open ? REAKTOR_A11Y_EXPANDED : 0u, hb);
|
||||
if (open) {
|
||||
nk_layout_row_dynamic(ctx, ROW_SMALL, 1);
|
||||
nk_label(ctx, "Nesting is unlimited.", NK_TEXT_LEFT);
|
||||
nk_tree_pop(ctx);
|
||||
}
|
||||
curie_note_pop(app);
|
||||
reaktor_note_pop(app);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
char lab[32];
|
||||
SDL_snprintf(lab, sizeof(lab), "Selectable branch %d", i + 1);
|
||||
hb = nk_widget_bounds(ctx);
|
||||
hot(app, ctx, CURIE_A11Y_NONE, NULL, 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_NONE, NULL, 0);
|
||||
open = nk_tree_element_push(ctx, NK_TREE_NODE, lab,
|
||||
NK_MINIMIZED, &s->tree_leaf[i]);
|
||||
tree_chevron(app, ctx, hb, open);
|
||||
curie_note_push(app, CURIE_A11Y_TREEITEM, lab, NULL,
|
||||
(open ? CURIE_A11Y_EXPANDED : 0u) |
|
||||
(s->tree_leaf[i] ? CURIE_A11Y_CHECKED : 0u),
|
||||
reaktor_note_push(app, REAKTOR_A11Y_TREEITEM, lab, NULL,
|
||||
(open ? REAKTOR_A11Y_EXPANDED : 0u) |
|
||||
(s->tree_leaf[i] ? REAKTOR_A11Y_CHECKED : 0u),
|
||||
hb);
|
||||
if (open) {
|
||||
nk_layout_row_dynamic(ctx, ROW_SMALL, 1);
|
||||
@@ -1671,11 +1671,11 @@ page_display(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
NK_TEXT_LEFT);
|
||||
nk_tree_pop(ctx);
|
||||
}
|
||||
curie_note_pop(app);
|
||||
reaktor_note_pop(app);
|
||||
}
|
||||
nk_tree_pop(ctx);
|
||||
}
|
||||
curie_note_pop(app);
|
||||
reaktor_note_pop(app);
|
||||
}
|
||||
|
||||
nk_layout_row_dynamic(ctx, 10.0f, 1);
|
||||
@@ -1695,8 +1695,8 @@ page_display(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
char lab[40];
|
||||
nk_bool on = (s->list_sel == i);
|
||||
SDL_snprintf(lab, sizeof(lab), "Row %d of %d", i + 1, SC_LIST_N);
|
||||
hot(app, ctx, CURIE_A11Y_LISTITEM, lab,
|
||||
on ? CURIE_A11Y_SELECTED : 0u);
|
||||
hot(app, ctx, REAKTOR_A11Y_LISTITEM, lab,
|
||||
on ? REAKTOR_A11Y_SELECTED : 0u);
|
||||
if (nk_selectable_label(ctx, lab, NK_TEXT_LEFT, &on) && on)
|
||||
s->list_sel = i;
|
||||
}
|
||||
@@ -1872,11 +1872,11 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
ok = nk_group_begin(ctx, "menubar", NK_WINDOW_NO_SCROLLBAR);
|
||||
nk_style_pop_vec2(ctx);
|
||||
if (ok) {
|
||||
curie_note_push(app, CURIE_A11Y_MENUBAR, "Menu bar", NULL, 0, bar);
|
||||
reaktor_note_push(app, REAKTOR_A11Y_MENUBAR, "Menu bar", NULL, 0, bar);
|
||||
nk_menubar_begin(ctx);
|
||||
nk_layout_row_begin(ctx, NK_STATIC, 26.0f, 3);
|
||||
nk_layout_row_push(ctx, 60.0f);
|
||||
hot(app, ctx, CURIE_A11Y_MENU, "File", 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_MENU, "File", 0);
|
||||
if (nk_menu_begin_label(ctx, "File", NK_TEXT_LEFT,
|
||||
nk_vec2(150.0f, MENU_H(3)))) {
|
||||
menu_rows_push(ctx);
|
||||
@@ -1888,7 +1888,7 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
* imitation - and the answer comes back on a later frame. */
|
||||
if (item_with_icon(app, ctx, "Open...", "folder-open-outline", 0)) {
|
||||
SDL_strlcpy(s->menu_pick, "File > Open", sizeof(s->menu_pick));
|
||||
if (curie_file_open(app))
|
||||
if (reaktor_file_open(app))
|
||||
SDL_strlcpy(s->file_pick, "waiting for the picker...",
|
||||
sizeof(s->file_pick));
|
||||
}
|
||||
@@ -1898,7 +1898,7 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
nk_menu_end(ctx);
|
||||
}
|
||||
nk_layout_row_push(ctx, 60.0f);
|
||||
hot(app, ctx, CURIE_A11Y_MENU, "Edit", 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_MENU, "Edit", 0);
|
||||
if (nk_menu_begin_label(ctx, "Edit", NK_TEXT_LEFT,
|
||||
nk_vec2(190.0f, MENU_H(4)))) {
|
||||
menu_rows_push(ctx);
|
||||
@@ -1931,7 +1931,7 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
nk_menu_end(ctx);
|
||||
}
|
||||
nk_layout_row_push(ctx, 60.0f);
|
||||
hot(app, ctx, CURIE_A11Y_MENU, "View", 0);
|
||||
hot(app, ctx, REAKTOR_A11Y_MENU, "View", 0);
|
||||
if (nk_menu_begin_label(ctx, "View", NK_TEXT_LEFT,
|
||||
nk_vec2(170.0f, MENU_H(2)))) {
|
||||
menu_rows_push(ctx);
|
||||
@@ -1944,7 +1944,7 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
}
|
||||
nk_layout_row_end(ctx);
|
||||
nk_menubar_end(ctx);
|
||||
curie_note_pop(app);
|
||||
reaktor_note_pop(app);
|
||||
nk_group_end(ctx);
|
||||
}
|
||||
/* The bar's frame, at the rounding its fill was drawn with - still
|
||||
@@ -1971,20 +1971,20 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
|
||||
nk_layout_row_dynamic(ctx, ROW_SMALL, 1);
|
||||
SDL_snprintf(line, sizeof(line), "last chosen: %s", s->menu_pick);
|
||||
nk_style_push_font(ctx, curie_font(app, 13, 0));
|
||||
curie_note(app, CURIE_A11Y_LABEL, "Last chosen", s->menu_pick, 0,
|
||||
nk_style_push_font(ctx, reaktor_font(app, 13, 0));
|
||||
reaktor_note(app, REAKTOR_A11Y_LABEL, "Last chosen", s->menu_pick, 0,
|
||||
nk_widget_bounds(ctx));
|
||||
nk_label_colored(ctx, line, NK_TEXT_LEFT,
|
||||
curie_token("--text-muted", ctx->style.text.color));
|
||||
reaktor_token("--text-muted", ctx->style.text.color));
|
||||
|
||||
/* File > Open opens the platform's picker, which answers on its own
|
||||
* schedule; the shell drains the answer into file_pick each frame. */
|
||||
nk_layout_row_dynamic(ctx, ROW_SMALL, 1);
|
||||
SDL_snprintf(line, sizeof(line), "file picker: %s", s->file_pick);
|
||||
curie_note(app, CURIE_A11Y_LABEL, "File picker", s->file_pick, 0,
|
||||
reaktor_note(app, REAKTOR_A11Y_LABEL, "File picker", s->file_pick, 0,
|
||||
nk_widget_bounds(ctx));
|
||||
nk_label_colored(ctx, line, NK_TEXT_LEFT,
|
||||
curie_token("--text-muted", ctx->style.text.color));
|
||||
reaktor_token("--text-muted", ctx->style.text.color));
|
||||
nk_style_pop_font(ctx);
|
||||
|
||||
section(app, ctx, "Context menu",
|
||||
@@ -1997,7 +1997,7 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
nk_layout_row_dynamic(ctx, 54.0f, 1);
|
||||
{
|
||||
struct nk_rect trigger = nk_widget_bounds(ctx);
|
||||
hot(app, ctx, CURIE_A11Y_BUTTON,
|
||||
hot(app, ctx, REAKTOR_A11Y_BUTTON,
|
||||
"Right-click anywhere on this button", 0);
|
||||
nk_button_label(ctx, "Right-click anywhere on this button");
|
||||
/* The same width and the same three-row height as the File menu
|
||||
@@ -2047,7 +2047,7 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
static const char *const one[1] = { "A one-line tooltip." };
|
||||
struct nk_rect b = nk_widget_bounds(ctx);
|
||||
|
||||
curie_hot_follow(app, b, 1);
|
||||
reaktor_hot_follow(app, b, 1);
|
||||
nk_button_label(ctx, "Hover for a plain tooltip");
|
||||
if (nk_input_is_mouse_hovering_rect(&ctx->input, b))
|
||||
draw_tooltip(app, ctx, one, 1, -1.0f);
|
||||
@@ -2060,7 +2060,7 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
};
|
||||
struct nk_rect b = nk_widget_bounds(ctx);
|
||||
|
||||
curie_hot_follow(app, b, 1);
|
||||
reaktor_hot_follow(app, b, 1);
|
||||
nk_button_label(ctx, "Hover for a laid-out one");
|
||||
if (nk_input_is_mouse_hovering_rect(&ctx->input, b))
|
||||
draw_tooltip(app, ctx, many, 2, (float)s->progress / 100.0f);
|
||||
@@ -2079,7 +2079,7 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
nk_layout_row_template_push_static(ctx, 14.0f);
|
||||
nk_layout_row_template_push_dynamic(ctx);
|
||||
nk_layout_row_template_end(ctx);
|
||||
if (curie_button(app, ctx, "Open a dialog")) s->popup_open = 1;
|
||||
if (reaktor_button(app, ctx, "Open a dialog")) s->popup_open = 1;
|
||||
nk_spacer(ctx);
|
||||
nk_label(ctx, s->popup_open ? "open" : "closed", NK_TEXT_LEFT);
|
||||
|
||||
@@ -2109,9 +2109,9 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR, at)) {
|
||||
menu_rows_push(ctx);
|
||||
nk_layout_row_dynamic(ctx, 22.0f, 1);
|
||||
nk_style_push_font(ctx, curie_font(app, 16, 1));
|
||||
nk_style_push_font(ctx, reaktor_font(app, 16, 1));
|
||||
nk_label_colored(ctx, "Close without saving?", NK_TEXT_LEFT,
|
||||
curie_token("--text-bright",
|
||||
reaktor_token("--text-bright",
|
||||
ctx->style.text.color));
|
||||
nk_style_pop_font(ctx);
|
||||
|
||||
@@ -2119,11 +2119,11 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
nk_spacer(ctx);
|
||||
|
||||
nk_layout_row_dynamic(ctx, 44.0f, 1);
|
||||
nk_style_push_font(ctx, curie_font(app, 13, 0));
|
||||
nk_style_push_font(ctx, reaktor_font(app, 13, 0));
|
||||
nk_label_colored_wrap(ctx,
|
||||
"Everything behind this is inert until the popup is closed - "
|
||||
"which is what makes it modal, with no modality machinery.",
|
||||
curie_token("--text-muted", ctx->style.text.color));
|
||||
reaktor_token("--text-muted", ctx->style.text.color));
|
||||
nk_style_pop_font(ctx);
|
||||
|
||||
nk_layout_row_dynamic(ctx, 12.0f, 1);
|
||||
@@ -2137,11 +2137,11 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
nk_layout_row_template_push_static(ctx, 96.0f);
|
||||
nk_layout_row_template_end(ctx);
|
||||
nk_spacer(ctx);
|
||||
if (curie_button(app, ctx, "Cancel")) {
|
||||
if (reaktor_button(app, ctx, "Cancel")) {
|
||||
s->popup_open = 0;
|
||||
nk_popup_close(ctx);
|
||||
}
|
||||
if (curie_button_accent(app, ctx, "OK")) {
|
||||
if (reaktor_button_accent(app, ctx, "OK")) {
|
||||
s->popup_open = 0;
|
||||
nk_popup_close(ctx);
|
||||
}
|
||||
@@ -2166,7 +2166,7 @@ page_popups(App *app, struct nk_context *ctx, showcase_state *s)
|
||||
* reader would otherwise meet as unrelated runs of text: a reading is a name
|
||||
* and a value, which is what the tree is shaped to say. Marked volatile,
|
||||
* because every one of them moves as the pointer does and none of that is
|
||||
* worth announcing - see CURIE_A11Y_VOLATILE. */
|
||||
* worth announcing - see REAKTOR_A11Y_VOLATILE. */
|
||||
static void
|
||||
diag_row(App *app, struct nk_context *ctx, const char *name, const char *value)
|
||||
{
|
||||
@@ -2178,9 +2178,9 @@ diag_row(App *app, struct nk_context *ctx, const char *name, const char *value)
|
||||
nk_layout_row_template_end(ctx);
|
||||
|
||||
a = nk_widget_bounds(ctx);
|
||||
nk_style_push_font(ctx, curie_font(app, 13, 0));
|
||||
nk_style_push_font(ctx, reaktor_font(app, 13, 0));
|
||||
nk_label_colored(ctx, name, NK_TEXT_LEFT,
|
||||
curie_token("--text-muted", ctx->style.text.color));
|
||||
reaktor_token("--text-muted", ctx->style.text.color));
|
||||
nk_style_pop_font(ctx);
|
||||
b = nk_widget_bounds(ctx);
|
||||
nk_label(ctx, value, NK_TEXT_LEFT);
|
||||
@@ -2188,27 +2188,27 @@ diag_row(App *app, struct nk_context *ctx, const char *name, const char *value)
|
||||
* after them because the second column's bounds are only known once the
|
||||
* first is drawn; the node still falls between its neighbours, which is
|
||||
* what reading order is. */
|
||||
curie_note(app, CURIE_A11Y_LABEL, name, value, CURIE_A11Y_VOLATILE,
|
||||
reaktor_note(app, REAKTOR_A11Y_LABEL, name, value, REAKTOR_A11Y_VOLATILE,
|
||||
nk_rect(a.x, a.y, (b.x + b.w) - a.x, a.h));
|
||||
}
|
||||
|
||||
static void
|
||||
page_diagnostics(App *app, struct nk_context *ctx, showcase_state *st)
|
||||
{
|
||||
curie_diag d;
|
||||
reaktor_diag d;
|
||||
char v[192];
|
||||
|
||||
(void)st;
|
||||
curie_diagnostics(app, &d);
|
||||
reaktor_diagnostics(app, &d);
|
||||
|
||||
section(app, ctx, "Rendering",
|
||||
"Which backend SDL settled on, and what the app asked for. "
|
||||
"CURIE_RENDERER picks between auto, gpu and software; "
|
||||
"CURIE_VSYNC and CURIE_AA turn the other two off. Anti-aliasing "
|
||||
"REAKTOR_RENDERER picks between auto, gpu and software; "
|
||||
"REAKTOR_VSYNC and REAKTOR_AA turn the other two off. Anti-aliasing "
|
||||
"reads what the frame is drawn with: the software rasteriser has "
|
||||
"no partial coverage, so it feathers strokes, which grades a "
|
||||
"curve, and not fills, which would only draw a hairline. "
|
||||
"CURIE_SW_NOAA=1 drops both.");
|
||||
"REAKTOR_SW_NOAA=1 drops both.");
|
||||
|
||||
diag_row(app, ctx, "backend", d.renderer);
|
||||
SDL_snprintf(v, sizeof(v), "%s", d.mode);
|
||||
@@ -2324,13 +2324,13 @@ page_diagnostics(App *app, struct nk_context *ctx, showcase_state *st)
|
||||
SDL_snprintf(v, sizeof(v), "%.1f MB private, %.1f MB resident",
|
||||
d.priv_at[RSS_ENTRY] / 1048576.0,
|
||||
d.rss_at[RSS_ENTRY] / 1048576.0);
|
||||
diag_row(app, ctx, curie_rss_names[RSS_ENTRY], v);
|
||||
diag_row(app, ctx, reaktor_rss_names[RSS_ENTRY], v);
|
||||
for (i = RSS_ENTRY + 1; i < RSS_STEPS; i++) {
|
||||
double dp = (d.priv_at[i] - (double)d.priv_at[i - 1]) / 1048576.0;
|
||||
double dr = (d.rss_at[i] - (double)d.rss_at[i - 1]) / 1048576.0;
|
||||
SDL_snprintf(v, sizeof(v), "%+.1f MB private %+.1f MB resident",
|
||||
dp, dr);
|
||||
diag_row(app, ctx, curie_rss_names[i], v);
|
||||
diag_row(app, ctx, reaktor_rss_names[i], v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2341,10 +2341,10 @@ page_diagnostics(App *app, struct nk_context *ctx, showcase_state *st)
|
||||
/* --- dispatch ------------------------------------------------------------ */
|
||||
|
||||
void
|
||||
curie_showcase_page(App *app, struct nk_context *ctx, int tab,
|
||||
reaktor_showcase_page(App *app, struct nk_context *ctx, int tab,
|
||||
float w, float h)
|
||||
{
|
||||
showcase_state *s = curie_showcase(app);
|
||||
showcase_state *s = reaktor_showcase(app);
|
||||
|
||||
(void)w; (void)h;
|
||||
if (!s->seeded) seed(s);
|
||||
|
||||
+13
-13
@@ -21,7 +21,7 @@
|
||||
|
||||
typedef struct cache_entry {
|
||||
char selector[64];
|
||||
curie_style style;
|
||||
reaktor_style style;
|
||||
} cache_entry;
|
||||
|
||||
static struct {
|
||||
@@ -29,7 +29,7 @@ static struct {
|
||||
cache_entry cache[CACHE_MAX];
|
||||
int cache_n;
|
||||
css_metrics_t metrics;
|
||||
curie_cssvars *vars; /* the palette, kept for curie_style_token */
|
||||
reaktor_cssvars *vars; /* the palette, kept for reaktor_style_token */
|
||||
} g;
|
||||
|
||||
static void rgba_of(css_color_value_t c, unsigned char out[4])
|
||||
@@ -40,7 +40,7 @@ static void rgba_of(css_color_value_t c, unsigned char out[4])
|
||||
out[3] = (unsigned char)((c >> 24) & 0xff);
|
||||
}
|
||||
|
||||
int curie_style_init(const char *const *css_paths, int count)
|
||||
int reaktor_style_init(const char *const *css_paths, int count)
|
||||
{
|
||||
char *flat;
|
||||
css_parser_t *parser;
|
||||
@@ -70,12 +70,12 @@ int curie_style_init(const char *const *css_paths, int count)
|
||||
*
|
||||
* No [data-theme] block to select: tiny.css ships light and dark as two
|
||||
* :root files, so the theme is chosen by which one the caller passes. */
|
||||
curie_cssvars_free(g.vars);
|
||||
reaktor_cssvars_free(g.vars);
|
||||
g.vars = NULL;
|
||||
flat = curie_css_flatten(css_paths, count, NULL, &g.vars);
|
||||
flat = reaktor_css_flatten(css_paths, count, NULL, &g.vars);
|
||||
if (!flat) return 0;
|
||||
|
||||
parser = css_parser_create("curie");
|
||||
parser = css_parser_create("reaktor");
|
||||
if (!parser) { free(flat); return 0; }
|
||||
/* css_parser_parse consumes at most its buffer per call and returns how
|
||||
* much it took, so it is driven to the end of the string. */
|
||||
@@ -92,22 +92,22 @@ int curie_style_init(const char *const *css_paths, int count)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void curie_style_shutdown(void)
|
||||
void reaktor_style_shutdown(void)
|
||||
{
|
||||
if (!g.ready) return;
|
||||
curie_cssvars_free(g.vars);
|
||||
reaktor_cssvars_free(g.vars);
|
||||
g.vars = NULL;
|
||||
css_destroy();
|
||||
g.ready = 0;
|
||||
g.cache_n = 0;
|
||||
}
|
||||
|
||||
int curie_style_token(const char *name, unsigned char rgba[4])
|
||||
int reaktor_style_token(const char *name, unsigned char rgba[4])
|
||||
{
|
||||
return curie_cssvars_color(g.vars, name, rgba);
|
||||
return reaktor_cssvars_color(g.vars, name, rgba);
|
||||
}
|
||||
|
||||
void curie_style_darken(unsigned char rgba[4], float amount)
|
||||
void reaktor_style_darken(unsigned char rgba[4], float amount)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -117,7 +117,7 @@ void curie_style_darken(unsigned char rgba[4], float amount)
|
||||
rgba[i] = (unsigned char)(rgba[i] * (1.0f - amount) + 0.5f);
|
||||
}
|
||||
|
||||
static void resolve(const char *selector, curie_style *out)
|
||||
static void resolve(const char *selector, reaktor_style *out)
|
||||
{
|
||||
css_selector_t *sel;
|
||||
css_style_decl_t *decl;
|
||||
@@ -170,7 +170,7 @@ static void resolve(const char *selector, curie_style *out)
|
||||
css_computed_style_destroy(&computed);
|
||||
}
|
||||
|
||||
void curie_style_get(const char *selector, curie_style *out)
|
||||
void reaktor_style_get(const char *selector, reaktor_style *out)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
+10
-10
@@ -12,14 +12,14 @@
|
||||
* Deliberately free of nuklear.h. Nothing below names a Nuklear type, so the
|
||||
* mapping into nk_style lives with the widget calls in main.c and this file
|
||||
* stays a plain CSS query. */
|
||||
#ifndef CURIE_STYLE_H
|
||||
#define CURIE_STYLE_H
|
||||
#ifndef REAKTOR_STYLE_H
|
||||
#define REAKTOR_STYLE_H
|
||||
|
||||
/* The properties this UI actually styles. These are exactly the ones LCUI
|
||||
* implements well - colour, border, radius, padding, font - which is the point
|
||||
* of the arrangement: layout and typography CSS, where its gaps are, never
|
||||
* comes up because Nuklear owns layout. */
|
||||
typedef struct curie_style {
|
||||
typedef struct reaktor_style {
|
||||
unsigned char bg[4]; /* background-color */
|
||||
unsigned char fg[4]; /* color */
|
||||
unsigned char border_col[4]; /* border-*-color */
|
||||
@@ -29,24 +29,24 @@ typedef struct curie_style {
|
||||
int font_px; /* font-size, px */
|
||||
int bold; /* font-weight >= 700 */
|
||||
int matched; /* 0 when the selector matched no rule */
|
||||
} curie_style;
|
||||
} reaktor_style;
|
||||
|
||||
/* Reads and parses `count` stylesheets, in order. Returns 0 on failure. The
|
||||
* text goes through cssflat.c first: LCUI's length parser accepts px, %, dp,
|
||||
* sp and pt only, and no custom properties. */
|
||||
int curie_style_init(const char *const *css_paths, int count);
|
||||
void curie_style_shutdown(void);
|
||||
int reaktor_style_init(const char *const *css_paths, int count);
|
||||
void reaktor_style_shutdown(void);
|
||||
|
||||
/* Computed values behind a CSS selector. `selector` is what a stylesheet
|
||||
* would write - "button", "input:focus" - matched by LCUI against everything
|
||||
* loaded. Never fails: an unmatched selector yields zeroed values with
|
||||
* `matched` clear, so a caller can fall back to Nuklear's defaults. */
|
||||
void curie_style_get(const char *selector, curie_style *out);
|
||||
void reaktor_style_get(const char *selector, reaktor_style *out);
|
||||
|
||||
/* Darkens an already-resolved colour by `amount` (0..1). Kept for stylesheets
|
||||
* that express a hover as an overlay rather than a colour; tiny.css states
|
||||
* --button-hover outright, so nothing on this screen needs it. */
|
||||
void curie_style_darken(unsigned char rgba[4], float amount);
|
||||
void reaktor_style_darken(unsigned char rgba[4], float amount);
|
||||
|
||||
/* A resolved custom property, as an RGBA quad. Returns 0 if the stylesheets
|
||||
* define no such name or its value is not a colour.
|
||||
@@ -56,6 +56,6 @@ void curie_style_darken(unsigned char rgba[4], float amount);
|
||||
* are the same declarations its own rules are written against. Reading them
|
||||
* here means the surfaces Nuklear paints directly come from the stylesheet
|
||||
* rather than from constants that would have to be kept in step with it. */
|
||||
int curie_style_token(const char *name, unsigned char rgba[4]);
|
||||
int reaktor_style_token(const char *name, unsigned char rgba[4]);
|
||||
|
||||
#endif /* CURIE_STYLE_H */
|
||||
#endif /* REAKTOR_STYLE_H */
|
||||
|
||||
+89
-89
@@ -33,7 +33,7 @@
|
||||
* out of a vendored header. */
|
||||
#include "a11y.h"
|
||||
|
||||
#ifdef CURIE_HAVE_ATSPI
|
||||
#ifdef REAKTOR_HAVE_ATSPI
|
||||
|
||||
#include "a11y_snapshot.h"
|
||||
|
||||
@@ -140,26 +140,26 @@ static unsigned
|
||||
role_of(unsigned char role)
|
||||
{
|
||||
switch (role) {
|
||||
case CURIE_A11Y_WINDOW: return ATSPI_ROLE_FRAME;
|
||||
case CURIE_A11Y_GROUP: return ATSPI_ROLE_PANEL;
|
||||
case CURIE_A11Y_TABLIST: return ATSPI_ROLE_PAGE_TAB_LIST;
|
||||
case CURIE_A11Y_TAB: return ATSPI_ROLE_PAGE_TAB;
|
||||
case CURIE_A11Y_BUTTON: return ATSPI_ROLE_PUSH_BUTTON;
|
||||
case CURIE_A11Y_LINK: return ATSPI_ROLE_LINK;
|
||||
case CURIE_A11Y_CHECKBOX: return ATSPI_ROLE_CHECK_BOX;
|
||||
case CURIE_A11Y_RADIO: return ATSPI_ROLE_RADIO_BUTTON;
|
||||
case CURIE_A11Y_TEXTBOX: return ATSPI_ROLE_TEXT;
|
||||
case CURIE_A11Y_SLIDER: return ATSPI_ROLE_SLIDER;
|
||||
case CURIE_A11Y_SPINBUTTON: return ATSPI_ROLE_SPIN_BUTTON;
|
||||
case CURIE_A11Y_PROGRESS: return ATSPI_ROLE_PROGRESS_BAR;
|
||||
case CURIE_A11Y_COMBOBOX: return ATSPI_ROLE_COMBO_BOX;
|
||||
case CURIE_A11Y_LISTITEM: return ATSPI_ROLE_LIST_ITEM;
|
||||
case CURIE_A11Y_TREEITEM: return ATSPI_ROLE_TREE_ITEM;
|
||||
case CURIE_A11Y_MENUBAR: return ATSPI_ROLE_MENU_BAR;
|
||||
case CURIE_A11Y_MENU: return ATSPI_ROLE_MENU;
|
||||
case CURIE_A11Y_MENUITEM: return ATSPI_ROLE_MENU_ITEM;
|
||||
case CURIE_A11Y_DIALOG: return ATSPI_ROLE_DIALOG;
|
||||
case CURIE_A11Y_LABEL: return ATSPI_ROLE_LABEL;
|
||||
case REAKTOR_A11Y_WINDOW: return ATSPI_ROLE_FRAME;
|
||||
case REAKTOR_A11Y_GROUP: return ATSPI_ROLE_PANEL;
|
||||
case REAKTOR_A11Y_TABLIST: return ATSPI_ROLE_PAGE_TAB_LIST;
|
||||
case REAKTOR_A11Y_TAB: return ATSPI_ROLE_PAGE_TAB;
|
||||
case REAKTOR_A11Y_BUTTON: return ATSPI_ROLE_PUSH_BUTTON;
|
||||
case REAKTOR_A11Y_LINK: return ATSPI_ROLE_LINK;
|
||||
case REAKTOR_A11Y_CHECKBOX: return ATSPI_ROLE_CHECK_BOX;
|
||||
case REAKTOR_A11Y_RADIO: return ATSPI_ROLE_RADIO_BUTTON;
|
||||
case REAKTOR_A11Y_TEXTBOX: return ATSPI_ROLE_TEXT;
|
||||
case REAKTOR_A11Y_SLIDER: return ATSPI_ROLE_SLIDER;
|
||||
case REAKTOR_A11Y_SPINBUTTON: return ATSPI_ROLE_SPIN_BUTTON;
|
||||
case REAKTOR_A11Y_PROGRESS: return ATSPI_ROLE_PROGRESS_BAR;
|
||||
case REAKTOR_A11Y_COMBOBOX: return ATSPI_ROLE_COMBO_BOX;
|
||||
case REAKTOR_A11Y_LISTITEM: return ATSPI_ROLE_LIST_ITEM;
|
||||
case REAKTOR_A11Y_TREEITEM: return ATSPI_ROLE_TREE_ITEM;
|
||||
case REAKTOR_A11Y_MENUBAR: return ATSPI_ROLE_MENU_BAR;
|
||||
case REAKTOR_A11Y_MENU: return ATSPI_ROLE_MENU;
|
||||
case REAKTOR_A11Y_MENUITEM: return ATSPI_ROLE_MENU_ITEM;
|
||||
case REAKTOR_A11Y_DIALOG: return ATSPI_ROLE_DIALOG;
|
||||
case REAKTOR_A11Y_LABEL: return ATSPI_ROLE_LABEL;
|
||||
default: return ATSPI_ROLE_FILLER;
|
||||
}
|
||||
}
|
||||
@@ -168,26 +168,26 @@ static const char *
|
||||
role_name(unsigned char role)
|
||||
{
|
||||
switch (role) {
|
||||
case CURIE_A11Y_WINDOW: return "frame";
|
||||
case CURIE_A11Y_GROUP: return "panel";
|
||||
case CURIE_A11Y_TABLIST: return "page tab list";
|
||||
case CURIE_A11Y_TAB: return "page tab";
|
||||
case CURIE_A11Y_BUTTON: return "push button";
|
||||
case CURIE_A11Y_LINK: return "link";
|
||||
case CURIE_A11Y_CHECKBOX: return "check box";
|
||||
case CURIE_A11Y_RADIO: return "radio button";
|
||||
case CURIE_A11Y_TEXTBOX: return "text";
|
||||
case CURIE_A11Y_SLIDER: return "slider";
|
||||
case CURIE_A11Y_SPINBUTTON: return "spin button";
|
||||
case CURIE_A11Y_PROGRESS: return "progress bar";
|
||||
case CURIE_A11Y_COMBOBOX: return "combo box";
|
||||
case CURIE_A11Y_LISTITEM: return "list item";
|
||||
case CURIE_A11Y_TREEITEM: return "tree item";
|
||||
case CURIE_A11Y_MENUBAR: return "menu bar";
|
||||
case CURIE_A11Y_MENU: return "menu";
|
||||
case CURIE_A11Y_MENUITEM: return "menu item";
|
||||
case CURIE_A11Y_DIALOG: return "dialog";
|
||||
case CURIE_A11Y_LABEL: return "label";
|
||||
case REAKTOR_A11Y_WINDOW: return "frame";
|
||||
case REAKTOR_A11Y_GROUP: return "panel";
|
||||
case REAKTOR_A11Y_TABLIST: return "page tab list";
|
||||
case REAKTOR_A11Y_TAB: return "page tab";
|
||||
case REAKTOR_A11Y_BUTTON: return "push button";
|
||||
case REAKTOR_A11Y_LINK: return "link";
|
||||
case REAKTOR_A11Y_CHECKBOX: return "check box";
|
||||
case REAKTOR_A11Y_RADIO: return "radio button";
|
||||
case REAKTOR_A11Y_TEXTBOX: return "text";
|
||||
case REAKTOR_A11Y_SLIDER: return "slider";
|
||||
case REAKTOR_A11Y_SPINBUTTON: return "spin button";
|
||||
case REAKTOR_A11Y_PROGRESS: return "progress bar";
|
||||
case REAKTOR_A11Y_COMBOBOX: return "combo box";
|
||||
case REAKTOR_A11Y_LISTITEM: return "list item";
|
||||
case REAKTOR_A11Y_TREEITEM: return "tree item";
|
||||
case REAKTOR_A11Y_MENUBAR: return "menu bar";
|
||||
case REAKTOR_A11Y_MENU: return "menu";
|
||||
case REAKTOR_A11Y_MENUITEM: return "menu item";
|
||||
case REAKTOR_A11Y_DIALOG: return "dialog";
|
||||
case REAKTOR_A11Y_LABEL: return "label";
|
||||
default: return "filler";
|
||||
}
|
||||
}
|
||||
@@ -198,10 +198,10 @@ role_name(unsigned char role)
|
||||
static int
|
||||
has_action(unsigned char role)
|
||||
{
|
||||
return role == CURIE_A11Y_BUTTON || role == CURIE_A11Y_LINK ||
|
||||
role == CURIE_A11Y_TAB || role == CURIE_A11Y_MENUITEM ||
|
||||
role == CURIE_A11Y_CHECKBOX || role == CURIE_A11Y_RADIO ||
|
||||
role == CURIE_A11Y_LISTITEM;
|
||||
return role == REAKTOR_A11Y_BUTTON || role == REAKTOR_A11Y_LINK ||
|
||||
role == REAKTOR_A11Y_TAB || role == REAKTOR_A11Y_MENUITEM ||
|
||||
role == REAKTOR_A11Y_CHECKBOX || role == REAKTOR_A11Y_RADIO ||
|
||||
role == REAKTOR_A11Y_LISTITEM;
|
||||
}
|
||||
|
||||
/* --- writing the little types AT-SPI uses -------------------------------- */
|
||||
@@ -278,7 +278,7 @@ append_variant_ref(DBusMessageIter *it, unsigned id)
|
||||
|
||||
/* The state set: two 32-bit words of bit flags, sent as an array. */
|
||||
static void
|
||||
append_state(DBusMessageIter *it, const curie_snap_node *n)
|
||||
append_state(DBusMessageIter *it, const reaktor_snap_node *n)
|
||||
{
|
||||
DBusMessageIter arr;
|
||||
dbus_uint32_t w[2];
|
||||
@@ -287,18 +287,18 @@ append_state(DBusMessageIter *it, const curie_snap_node *n)
|
||||
w[0] = w[1] = 0;
|
||||
#define SET(bit) (w[(bit) / 32] |= 1u << ((bit) % 32))
|
||||
SET(ATSPI_STATE_VISIBLE);
|
||||
if (!(n->state & CURIE_A11Y_OFFSCREEN)) SET(ATSPI_STATE_SHOWING);
|
||||
if (!(n->state & CURIE_A11Y_DISABLED)) {
|
||||
if (!(n->state & REAKTOR_A11Y_OFFSCREEN)) SET(ATSPI_STATE_SHOWING);
|
||||
if (!(n->state & REAKTOR_A11Y_DISABLED)) {
|
||||
SET(ATSPI_STATE_ENABLED);
|
||||
SET(ATSPI_STATE_SENSITIVE);
|
||||
}
|
||||
if (curie_snap_focusable(n->role, n->state)) SET(ATSPI_STATE_FOCUSABLE);
|
||||
if (n->state & CURIE_A11Y_FOCUSED) SET(ATSPI_STATE_FOCUSED);
|
||||
if (n->state & CURIE_A11Y_CHECKED) SET(ATSPI_STATE_CHECKED);
|
||||
if (n->state & CURIE_A11Y_EXPANDED) SET(ATSPI_STATE_EXPANDED);
|
||||
if (n->role == CURIE_A11Y_TAB || n->role == CURIE_A11Y_LISTITEM) {
|
||||
if (reaktor_snap_focusable(n->role, n->state)) SET(ATSPI_STATE_FOCUSABLE);
|
||||
if (n->state & REAKTOR_A11Y_FOCUSED) SET(ATSPI_STATE_FOCUSED);
|
||||
if (n->state & REAKTOR_A11Y_CHECKED) SET(ATSPI_STATE_CHECKED);
|
||||
if (n->state & REAKTOR_A11Y_EXPANDED) SET(ATSPI_STATE_EXPANDED);
|
||||
if (n->role == REAKTOR_A11Y_TAB || n->role == REAKTOR_A11Y_LISTITEM) {
|
||||
SET(ATSPI_STATE_SELECTABLE);
|
||||
if (n->state & CURIE_A11Y_SELECTED) SET(ATSPI_STATE_SELECTED);
|
||||
if (n->state & REAKTOR_A11Y_SELECTED) SET(ATSPI_STATE_SELECTED);
|
||||
}
|
||||
#undef SET
|
||||
|
||||
@@ -309,7 +309,7 @@ append_state(DBusMessageIter *it, const curie_snap_node *n)
|
||||
}
|
||||
|
||||
static void
|
||||
append_interfaces(DBusMessageIter *it, const curie_snap_node *n, int is_root)
|
||||
append_interfaces(DBusMessageIter *it, const reaktor_snap_node *n, int is_root)
|
||||
{
|
||||
DBusMessageIter arr;
|
||||
const char *s;
|
||||
@@ -343,11 +343,11 @@ append_interfaces(DBusMessageIter *it, const curie_snap_node *n, int is_root)
|
||||
static unsigned
|
||||
child_at(unsigned parent, int index)
|
||||
{
|
||||
unsigned id = curie_snap_child(parent, 0);
|
||||
unsigned id = reaktor_snap_child(parent, 0);
|
||||
int i = 0;
|
||||
|
||||
while (id && i < index) {
|
||||
id = curie_snap_sibling(id, 0);
|
||||
id = reaktor_snap_sibling(id, 0);
|
||||
i++;
|
||||
}
|
||||
return i == index ? id : 0;
|
||||
@@ -356,12 +356,12 @@ child_at(unsigned parent, int index)
|
||||
static int
|
||||
child_count(unsigned parent)
|
||||
{
|
||||
unsigned id = curie_snap_child(parent, 0);
|
||||
unsigned id = reaktor_snap_child(parent, 0);
|
||||
int n = 0;
|
||||
|
||||
while (id) {
|
||||
n++;
|
||||
id = curie_snap_sibling(id, 0);
|
||||
id = reaktor_snap_sibling(id, 0);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
@@ -369,13 +369,13 @@ child_count(unsigned parent)
|
||||
static int
|
||||
index_in_parent(unsigned id)
|
||||
{
|
||||
unsigned parent = curie_snap_parent(id);
|
||||
unsigned it = curie_snap_child(parent, 0);
|
||||
unsigned parent = reaktor_snap_parent(id);
|
||||
unsigned it = reaktor_snap_child(parent, 0);
|
||||
int i = 0;
|
||||
|
||||
while (it) {
|
||||
if (it == id) return i;
|
||||
it = curie_snap_sibling(it, 0);
|
||||
it = reaktor_snap_sibling(it, 0);
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
@@ -406,7 +406,7 @@ reply_unknown(DBusConnection *c, DBusMessage *m)
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_properties(DBusConnection *c, DBusMessage *m, unsigned id, int is_root,
|
||||
const curie_snap_node *n)
|
||||
const reaktor_snap_node *n)
|
||||
{
|
||||
const char *iface = NULL, *prop = NULL;
|
||||
DBusMessage *r;
|
||||
@@ -440,7 +440,7 @@ handle_properties(DBusConnection *c, DBusMessage *m, unsigned id, int is_root,
|
||||
|
||||
if (strcmp(iface, IF_ACCESSIBLE) == 0) {
|
||||
if (strcmp(prop, "Name") == 0)
|
||||
append_variant_string(&it, is_root ? "Curie"
|
||||
append_variant_string(&it, is_root ? "Reaktor"
|
||||
: (n->name ? n->name : ""));
|
||||
else if (strcmp(prop, "Description") == 0)
|
||||
append_variant_string(&it, "");
|
||||
@@ -463,7 +463,7 @@ handle_properties(DBusConnection *c, DBusMessage *m, unsigned id, int is_root,
|
||||
append_null_ref(&v);
|
||||
dbus_message_iter_close_container(&it, &v);
|
||||
} else {
|
||||
append_variant_ref(&it, curie_snap_parent(id));
|
||||
append_variant_ref(&it, reaktor_snap_parent(id));
|
||||
}
|
||||
} else {
|
||||
dbus_message_unref(r);
|
||||
@@ -471,7 +471,7 @@ handle_properties(DBusConnection *c, DBusMessage *m, unsigned id, int is_root,
|
||||
}
|
||||
} else if (strcmp(iface, IF_APPLICATION) == 0) {
|
||||
if (strcmp(prop, "ToolkitName") == 0)
|
||||
append_variant_string(&it, "Curie");
|
||||
append_variant_string(&it, "Reaktor");
|
||||
else if (strcmp(prop, "Version") == 0)
|
||||
append_variant_string(&it, "1");
|
||||
else if (strcmp(prop, "AtspiVersion") == 0)
|
||||
@@ -513,7 +513,7 @@ handle_properties(DBusConnection *c, DBusMessage *m, unsigned id, int is_root,
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_accessible(DBusConnection *c, DBusMessage *m, unsigned id, int is_root,
|
||||
const curie_snap_node *n)
|
||||
const reaktor_snap_node *n)
|
||||
{
|
||||
DBusMessage *r = dbus_message_new_method_return(m);
|
||||
DBusMessageIter it;
|
||||
@@ -556,12 +556,12 @@ handle_accessible(DBusConnection *c, DBusMessage *m, unsigned id, int is_root,
|
||||
}
|
||||
} else if (dbus_message_has_member(m, "GetChildren")) {
|
||||
DBusMessageIter arr;
|
||||
unsigned kid = curie_snap_child(id, 0);
|
||||
unsigned kid = reaktor_snap_child(id, 0);
|
||||
|
||||
dbus_message_iter_open_container(&it, DBUS_TYPE_ARRAY, "(so)", &arr);
|
||||
while (kid) {
|
||||
append_node_ref(&arr, kid);
|
||||
kid = curie_snap_sibling(kid, 0);
|
||||
kid = reaktor_snap_sibling(kid, 0);
|
||||
}
|
||||
dbus_message_iter_close_container(&it, &arr);
|
||||
} else if (dbus_message_has_member(m, "GetIndexInParent")) {
|
||||
@@ -591,7 +591,7 @@ handle_accessible(DBusConnection *c, DBusMessage *m, unsigned id, int is_root,
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_component(DBusConnection *c, DBusMessage *m, unsigned id,
|
||||
const curie_snap_node *n)
|
||||
const reaktor_snap_node *n)
|
||||
{
|
||||
DBusMessage *r = dbus_message_new_method_return(m);
|
||||
DBusMessageIter it;
|
||||
@@ -640,13 +640,13 @@ handle_component(DBusConnection *c, DBusMessage *m, unsigned id,
|
||||
|
||||
dbus_message_get_args(m, NULL, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32,
|
||||
&y, DBUS_TYPE_UINT32, &coord, DBUS_TYPE_INVALID);
|
||||
hit = curie_snap_hit((float)x, (float)y);
|
||||
hit = reaktor_snap_hit((float)x, (float)y);
|
||||
if (hit) append_node_ref(&it, hit);
|
||||
else append_null_ref(&it);
|
||||
} else if (dbus_message_has_member(m, "GrabFocus")) {
|
||||
dbus_bool_t ok = TRUE;
|
||||
|
||||
curie_snap_request_focus(id);
|
||||
reaktor_snap_request_focus(id);
|
||||
dbus_message_iter_append_basic(&it, DBUS_TYPE_BOOLEAN, &ok);
|
||||
} else if (dbus_message_has_member(m, "GetLayer")) {
|
||||
dbus_uint32_t layer = 3; /* ATSPI_LAYER_WIDGET */
|
||||
@@ -668,7 +668,7 @@ handle_component(DBusConnection *c, DBusMessage *m, unsigned id,
|
||||
|
||||
static DBusHandlerResult
|
||||
handle_action(DBusConnection *c, DBusMessage *m, unsigned id,
|
||||
const curie_snap_node *n)
|
||||
const reaktor_snap_node *n)
|
||||
{
|
||||
DBusMessage *r = dbus_message_new_method_return(m);
|
||||
DBusMessageIter it;
|
||||
@@ -684,7 +684,7 @@ handle_action(DBusConnection *c, DBusMessage *m, unsigned id,
|
||||
|
||||
/* The same request a reader's press makes everywhere else: recorded,
|
||||
* the loop woken, and the widget takes it on the app's own thread. */
|
||||
if (ok) curie_snap_request_activate(id);
|
||||
if (ok) reaktor_snap_request_activate(id);
|
||||
dbus_message_iter_append_basic(&it, DBUS_TYPE_BOOLEAN, &ok);
|
||||
} else if (dbus_message_has_member(m, "GetName") ||
|
||||
dbus_message_has_member(m, "GetLocalizedName")) {
|
||||
@@ -736,8 +736,8 @@ on_message(DBusConnection *c, DBusMessage *m, void *user)
|
||||
{
|
||||
const char *iface = dbus_message_get_interface(m);
|
||||
long id = id_of(dbus_message_get_path(m));
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
int is_root;
|
||||
|
||||
(void)user;
|
||||
@@ -745,7 +745,7 @@ on_message(DBusConnection *c, DBusMessage *m, void *user)
|
||||
is_root = id == 0;
|
||||
|
||||
memset(&n, 0, sizeof(n));
|
||||
if (!is_root && !curie_snap_get((unsigned)id, &n, buf, sizeof(buf))) {
|
||||
if (!is_root && !reaktor_snap_get((unsigned)id, &n, buf, sizeof(buf))) {
|
||||
/* A node a client is still holding after the page it was on went
|
||||
* away. An error is the honest answer; a stale one is not. */
|
||||
DBusMessage *r = dbus_message_new_error(m, DBUS_ERROR_UNKNOWN_OBJECT,
|
||||
@@ -889,7 +889,7 @@ embed(void)
|
||||
/* --- the seam ------------------------------------------------------------ */
|
||||
|
||||
void
|
||||
curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
reaktor_a11y_platform_init(reaktor_a11y_action activate, reaktor_a11y_action focus,
|
||||
void *user)
|
||||
{
|
||||
static const DBusObjectPathVTable vtable = { NULL, on_message,
|
||||
@@ -898,7 +898,7 @@ curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
char *addr;
|
||||
const char *unique;
|
||||
|
||||
if (!curie_snap_init(activate, focus, user)) return;
|
||||
if (!reaktor_snap_init(activate, focus, user)) return;
|
||||
|
||||
/* libdbus is used from the pump thread and from the frame, so it has to
|
||||
* be told there is more than one. */
|
||||
@@ -945,7 +945,7 @@ curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
|
||||
g.running = 1;
|
||||
g.ready = 1;
|
||||
g.pump = SDL_CreateThread(pump, "curie-atspi", NULL);
|
||||
g.pump = SDL_CreateThread(pump, "reaktor-atspi", NULL);
|
||||
if (!g.pump) {
|
||||
g.running = 0;
|
||||
g.ready = 0;
|
||||
@@ -954,31 +954,31 @@ curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_drain(void)
|
||||
reaktor_a11y_platform_drain(void)
|
||||
{
|
||||
curie_snap_drain();
|
||||
reaktor_snap_drain();
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
reaktor_a11y_platform_push(const reaktor_a11y *a, unsigned focus_id)
|
||||
{
|
||||
int m;
|
||||
|
||||
if (!curie_snap_update(a, focus_id)) return;
|
||||
if (!reaktor_snap_update(a, focus_id)) return;
|
||||
if (!g.ready) return;
|
||||
|
||||
/* Structure first, for the same reason as on Windows: a client that has
|
||||
* not re-walked cannot be told which element took focus. AT-SPI has no
|
||||
* "children invalidated", so a change is announced on the root and the
|
||||
* client re-reads from there. */
|
||||
curie_a11y_changes(a, &m);
|
||||
reaktor_a11y_changes(a, &m);
|
||||
{
|
||||
int i, structural = 0;
|
||||
const curie_a11y_change *c = curie_a11y_changes(a, &m);
|
||||
const reaktor_a11y_change *c = reaktor_a11y_changes(a, &m);
|
||||
|
||||
for (i = 0; i < m; i++)
|
||||
if (c[i].kind == CURIE_A11Y_ADDED ||
|
||||
c[i].kind == CURIE_A11Y_REMOVED) {
|
||||
if (c[i].kind == REAKTOR_A11Y_ADDED ||
|
||||
c[i].kind == REAKTOR_A11Y_REMOVED) {
|
||||
structural = 1;
|
||||
break;
|
||||
}
|
||||
@@ -996,4 +996,4 @@ curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CURIE_HAVE_ATSPI */
|
||||
#endif /* REAKTOR_HAVE_ATSPI */
|
||||
|
||||
+76
-76
@@ -31,20 +31,20 @@
|
||||
* answer, and post what a client asks for back to the app's own thread. */
|
||||
#include "a11y.h"
|
||||
|
||||
#ifdef CURIE_HAVE_NSACCESSIBILITY
|
||||
#ifdef REAKTOR_HAVE_NSACCESSIBILITY
|
||||
|
||||
#include "a11y_snapshot.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
@class CurieElement;
|
||||
@class ReaktorElement;
|
||||
|
||||
static struct {
|
||||
int ready;
|
||||
__strong NSMutableDictionary<NSNumber *, CurieElement *> *cache;
|
||||
__strong NSMutableDictionary<NSNumber *, ReaktorElement *> *cache;
|
||||
__weak NSView *view;
|
||||
__strong CurieElement *root;
|
||||
__strong ReaktorElement *root;
|
||||
unsigned shape; /* bumped when the tree's structure changed */
|
||||
} g;
|
||||
|
||||
@@ -54,28 +54,28 @@ static NSAccessibilityRole
|
||||
role_of(unsigned char role)
|
||||
{
|
||||
switch (role) {
|
||||
case CURIE_A11Y_WINDOW: return NSAccessibilityWindowRole;
|
||||
case CURIE_A11Y_GROUP: return NSAccessibilityGroupRole;
|
||||
case CURIE_A11Y_TABLIST: return NSAccessibilityTabGroupRole;
|
||||
case REAKTOR_A11Y_WINDOW: return NSAccessibilityWindowRole;
|
||||
case REAKTOR_A11Y_GROUP: return NSAccessibilityGroupRole;
|
||||
case REAKTOR_A11Y_TABLIST: return NSAccessibilityTabGroupRole;
|
||||
/* A tab is a radio button in a tab group, which is what AppKit's own tab
|
||||
* views report and what VoiceOver's tab wording keys off. */
|
||||
case CURIE_A11Y_TAB: return NSAccessibilityRadioButtonRole;
|
||||
case CURIE_A11Y_BUTTON: return NSAccessibilityButtonRole;
|
||||
case CURIE_A11Y_LINK: return NSAccessibilityLinkRole;
|
||||
case CURIE_A11Y_CHECKBOX: return NSAccessibilityCheckBoxRole;
|
||||
case CURIE_A11Y_RADIO: return NSAccessibilityRadioButtonRole;
|
||||
case CURIE_A11Y_TEXTBOX: return NSAccessibilityTextFieldRole;
|
||||
case CURIE_A11Y_SLIDER: return NSAccessibilitySliderRole;
|
||||
case CURIE_A11Y_SPINBUTTON: return NSAccessibilityIncrementorRole;
|
||||
case CURIE_A11Y_PROGRESS: return NSAccessibilityProgressIndicatorRole;
|
||||
case CURIE_A11Y_COMBOBOX: return NSAccessibilityPopUpButtonRole;
|
||||
case CURIE_A11Y_LISTITEM: return NSAccessibilityRowRole;
|
||||
case CURIE_A11Y_TREEITEM: return NSAccessibilityRowRole;
|
||||
case CURIE_A11Y_MENUBAR: return NSAccessibilityMenuBarRole;
|
||||
case CURIE_A11Y_MENU: return NSAccessibilityMenuRole;
|
||||
case CURIE_A11Y_MENUITEM: return NSAccessibilityMenuItemRole;
|
||||
case CURIE_A11Y_DIALOG: return NSAccessibilityWindowRole;
|
||||
case CURIE_A11Y_LABEL: return NSAccessibilityStaticTextRole;
|
||||
case REAKTOR_A11Y_TAB: return NSAccessibilityRadioButtonRole;
|
||||
case REAKTOR_A11Y_BUTTON: return NSAccessibilityButtonRole;
|
||||
case REAKTOR_A11Y_LINK: return NSAccessibilityLinkRole;
|
||||
case REAKTOR_A11Y_CHECKBOX: return NSAccessibilityCheckBoxRole;
|
||||
case REAKTOR_A11Y_RADIO: return NSAccessibilityRadioButtonRole;
|
||||
case REAKTOR_A11Y_TEXTBOX: return NSAccessibilityTextFieldRole;
|
||||
case REAKTOR_A11Y_SLIDER: return NSAccessibilitySliderRole;
|
||||
case REAKTOR_A11Y_SPINBUTTON: return NSAccessibilityIncrementorRole;
|
||||
case REAKTOR_A11Y_PROGRESS: return NSAccessibilityProgressIndicatorRole;
|
||||
case REAKTOR_A11Y_COMBOBOX: return NSAccessibilityPopUpButtonRole;
|
||||
case REAKTOR_A11Y_LISTITEM: return NSAccessibilityRowRole;
|
||||
case REAKTOR_A11Y_TREEITEM: return NSAccessibilityRowRole;
|
||||
case REAKTOR_A11Y_MENUBAR: return NSAccessibilityMenuBarRole;
|
||||
case REAKTOR_A11Y_MENU: return NSAccessibilityMenuRole;
|
||||
case REAKTOR_A11Y_MENUITEM: return NSAccessibilityMenuItemRole;
|
||||
case REAKTOR_A11Y_DIALOG: return NSAccessibilityWindowRole;
|
||||
case REAKTOR_A11Y_LABEL: return NSAccessibilityStaticTextRole;
|
||||
default: return NSAccessibilityUnknownRole;
|
||||
}
|
||||
}
|
||||
@@ -83,27 +83,27 @@ role_of(unsigned char role)
|
||||
static BOOL
|
||||
takes_press(unsigned char role)
|
||||
{
|
||||
return role == CURIE_A11Y_BUTTON || role == CURIE_A11Y_LINK ||
|
||||
role == CURIE_A11Y_TAB || role == CURIE_A11Y_MENUITEM ||
|
||||
role == CURIE_A11Y_CHECKBOX || role == CURIE_A11Y_RADIO ||
|
||||
role == CURIE_A11Y_LISTITEM;
|
||||
return role == REAKTOR_A11Y_BUTTON || role == REAKTOR_A11Y_LINK ||
|
||||
role == REAKTOR_A11Y_TAB || role == REAKTOR_A11Y_MENUITEM ||
|
||||
role == REAKTOR_A11Y_CHECKBOX || role == REAKTOR_A11Y_RADIO ||
|
||||
role == REAKTOR_A11Y_LISTITEM;
|
||||
}
|
||||
|
||||
/* --- one node ------------------------------------------------------------ */
|
||||
|
||||
@interface CurieElement : NSAccessibilityElement
|
||||
@interface ReaktorElement : NSAccessibilityElement
|
||||
@property (nonatomic) unsigned nodeId;
|
||||
@end
|
||||
|
||||
static CurieElement *element_for(unsigned id);
|
||||
static ReaktorElement *element_for(unsigned id);
|
||||
|
||||
@implementation CurieElement
|
||||
@implementation ReaktorElement
|
||||
|
||||
/* Every answer starts here: the node as of the last drawn frame, copied out
|
||||
* of the snapshot. NO means it has gone, and the caller answers emptily. */
|
||||
- (BOOL)node:(curie_snap_node *)out buffer:(char *)buf
|
||||
- (BOOL)node:(reaktor_snap_node *)out buffer:(char *)buf
|
||||
{
|
||||
return curie_snap_get(self.nodeId, out, buf, CURIE_SNAP_TEXT) ? YES : NO;
|
||||
return reaktor_snap_get(self.nodeId, out, buf, REAKTOR_SNAP_TEXT) ? YES : NO;
|
||||
}
|
||||
|
||||
- (BOOL)isAccessibilityElement
|
||||
@@ -113,8 +113,8 @@ static CurieElement *element_for(unsigned id);
|
||||
|
||||
- (NSAccessibilityRole)accessibilityRole
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
if (![self node:&n buffer:buf]) return NSAccessibilityGroupRole;
|
||||
return role_of(n.role);
|
||||
@@ -122,8 +122,8 @@ static CurieElement *element_for(unsigned id);
|
||||
|
||||
- (NSString *)accessibilityLabel
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
if (![self node:&n buffer:buf] || !n.name) return nil;
|
||||
return [NSString stringWithUTF8String:n.name];
|
||||
@@ -131,25 +131,25 @@ static CurieElement *element_for(unsigned id);
|
||||
|
||||
- (id)accessibilityValue
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
if (![self node:&n buffer:buf]) return nil;
|
||||
/* A range answers with a number, which is what the slider and the
|
||||
* progress bar are asked for; anything else answers with its text. A
|
||||
* checkbox and a radio answer with their state, which AppKit wants as
|
||||
* 0 or 1 rather than as words. */
|
||||
if (n.role == CURIE_A11Y_CHECKBOX || n.role == CURIE_A11Y_RADIO ||
|
||||
n.role == CURIE_A11Y_TAB)
|
||||
return @((n.state & (CURIE_A11Y_CHECKED | CURIE_A11Y_SELECTED)) ? 1 : 0);
|
||||
if (n.role == REAKTOR_A11Y_CHECKBOX || n.role == REAKTOR_A11Y_RADIO ||
|
||||
n.role == REAKTOR_A11Y_TAB)
|
||||
return @((n.state & (REAKTOR_A11Y_CHECKED | REAKTOR_A11Y_SELECTED)) ? 1 : 0);
|
||||
if (n.hi > n.lo) return @(n.num);
|
||||
return n.value ? [NSString stringWithUTF8String:n.value] : nil;
|
||||
}
|
||||
|
||||
- (id)accessibilityMinValue
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
if (![self node:&n buffer:buf] || n.hi <= n.lo) return nil;
|
||||
return @(n.lo);
|
||||
@@ -157,8 +157,8 @@ static CurieElement *element_for(unsigned id);
|
||||
|
||||
- (id)accessibilityMaxValue
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
if (![self node:&n buffer:buf] || n.hi <= n.lo) return nil;
|
||||
return @(n.hi);
|
||||
@@ -167,19 +167,19 @@ static CurieElement *element_for(unsigned id);
|
||||
- (NSArray *)accessibilityChildren
|
||||
{
|
||||
NSMutableArray *kids = [NSMutableArray array];
|
||||
unsigned kid = curie_snap_child(self.nodeId, 0);
|
||||
unsigned kid = reaktor_snap_child(self.nodeId, 0);
|
||||
|
||||
while (kid) {
|
||||
CurieElement *e = element_for(kid);
|
||||
ReaktorElement *e = element_for(kid);
|
||||
if (e) [kids addObject:e];
|
||||
kid = curie_snap_sibling(kid, 0);
|
||||
kid = reaktor_snap_sibling(kid, 0);
|
||||
}
|
||||
return kids;
|
||||
}
|
||||
|
||||
- (id)accessibilityParent
|
||||
{
|
||||
unsigned up = curie_snap_parent(self.nodeId);
|
||||
unsigned up = reaktor_snap_parent(self.nodeId);
|
||||
|
||||
/* A node with no parent hangs off the view, which is what grafts the
|
||||
* whole tree onto the window. */
|
||||
@@ -192,8 +192,8 @@ static CurieElement *element_for(unsigned id);
|
||||
* main display. View, then window, then screen. */
|
||||
- (NSRect)accessibilityFrame
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
NSView *v = g.view;
|
||||
NSRect r;
|
||||
|
||||
@@ -206,32 +206,32 @@ static CurieElement *element_for(unsigned id);
|
||||
|
||||
- (BOOL)isAccessibilityFocused
|
||||
{
|
||||
return curie_snap_focus() == self.nodeId;
|
||||
return reaktor_snap_focus() == self.nodeId;
|
||||
}
|
||||
|
||||
- (void)setAccessibilityFocused:(BOOL)focused
|
||||
{
|
||||
if (focused) curie_snap_request_focus(self.nodeId);
|
||||
if (focused) reaktor_snap_request_focus(self.nodeId);
|
||||
}
|
||||
|
||||
- (BOOL)isAccessibilityEnabled
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
if (![self node:&n buffer:buf]) return NO;
|
||||
return (n.state & CURIE_A11Y_DISABLED) ? NO : YES;
|
||||
return (n.state & REAKTOR_A11Y_DISABLED) ? NO : YES;
|
||||
}
|
||||
|
||||
- (BOOL)accessibilityPerformPress
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
if (![self node:&n buffer:buf] || !takes_press(n.role)) return NO;
|
||||
/* The same request every other bridge makes: recorded here, run on the
|
||||
* app's own thread, taken by the widget itself. */
|
||||
curie_snap_request_activate(self.nodeId);
|
||||
reaktor_snap_request_activate(self.nodeId);
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ static CurieElement *element_for(unsigned id);
|
||||
inView = [v convertPoint:inWindow fromView:nil];
|
||||
if (!v.isFlipped) inView.y = v.bounds.size.height - inView.y;
|
||||
|
||||
hit = curie_snap_hit((float)inView.x, (float)inView.y);
|
||||
hit = reaktor_snap_hit((float)inView.x, (float)inView.y);
|
||||
if (!hit) return self;
|
||||
return element_for(hit);
|
||||
}
|
||||
@@ -260,16 +260,16 @@ static CurieElement *element_for(unsigned id);
|
||||
/* One element per live node, made when a client first asks for it. AppKit
|
||||
* keeps what it is handed, so identity has to hold across frames or a reader
|
||||
* loses its place - which the model's ids already guarantee. */
|
||||
static CurieElement *
|
||||
static ReaktorElement *
|
||||
element_for(unsigned id)
|
||||
{
|
||||
NSNumber *key = @(id);
|
||||
CurieElement *e;
|
||||
ReaktorElement *e;
|
||||
|
||||
if (!g.cache) return nil;
|
||||
e = g.cache[key];
|
||||
if (!e) {
|
||||
e = [[CurieElement alloc] init];
|
||||
e = [[ReaktorElement alloc] init];
|
||||
e.nodeId = id;
|
||||
g.cache[key] = e;
|
||||
}
|
||||
@@ -279,14 +279,14 @@ element_for(unsigned id)
|
||||
/* --- the seam ------------------------------------------------------------ */
|
||||
|
||||
void
|
||||
curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
reaktor_a11y_platform_init(reaktor_a11y_action activate, reaktor_a11y_action focus,
|
||||
void *user)
|
||||
{
|
||||
SDL_Window **wins;
|
||||
int count = 0;
|
||||
NSWindow *window = nil;
|
||||
|
||||
if (!curie_snap_init(activate, focus, user)) return;
|
||||
if (!reaktor_snap_init(activate, focus, user)) return;
|
||||
|
||||
wins = SDL_GetWindows(&count);
|
||||
if (wins && count > 0)
|
||||
@@ -308,31 +308,31 @@ curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
* subclass, no category, nothing of SDL's overridden. */
|
||||
g.view.accessibilityElement = YES;
|
||||
g.view.accessibilityRole = NSAccessibilityGroupRole;
|
||||
g.view.accessibilityLabel = @"Curie";
|
||||
g.view.accessibilityLabel = @"Reaktor";
|
||||
g.view.accessibilityChildren = @[ g.root ];
|
||||
|
||||
g.ready = 1;
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_drain(void)
|
||||
reaktor_a11y_platform_drain(void)
|
||||
{
|
||||
curie_snap_drain();
|
||||
reaktor_snap_drain();
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
reaktor_a11y_platform_push(const reaktor_a11y *a, unsigned focus_id)
|
||||
{
|
||||
static unsigned last_focus;
|
||||
int m, i, structural = 0;
|
||||
const curie_a11y_change *c;
|
||||
const reaktor_a11y_change *c;
|
||||
|
||||
if (!curie_snap_update(a, focus_id)) return;
|
||||
if (!reaktor_snap_update(a, focus_id)) return;
|
||||
if (!g.ready) return;
|
||||
|
||||
c = curie_a11y_changes(a, &m);
|
||||
c = reaktor_a11y_changes(a, &m);
|
||||
for (i = 0; i < m; i++)
|
||||
if (c[i].kind == CURIE_A11Y_ADDED || c[i].kind == CURIE_A11Y_REMOVED) {
|
||||
if (c[i].kind == REAKTOR_A11Y_ADDED || c[i].kind == REAKTOR_A11Y_REMOVED) {
|
||||
structural = 1;
|
||||
break;
|
||||
}
|
||||
@@ -352,7 +352,7 @@ curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
if (focus_id != last_focus) {
|
||||
last_focus = focus_id;
|
||||
if (focus_id) {
|
||||
CurieElement *e = element_for(focus_id);
|
||||
ReaktorElement *e = element_for(focus_id);
|
||||
if (e)
|
||||
NSAccessibilityPostNotification(
|
||||
e, NSAccessibilityFocusedUIElementChangedNotification);
|
||||
@@ -360,4 +360,4 @@ curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CURIE_HAVE_NSACCESSIBILITY */
|
||||
#endif /* REAKTOR_HAVE_NSACCESSIBILITY */
|
||||
|
||||
+26
-34
@@ -19,13 +19,13 @@ typedef struct snap_node {
|
||||
/* Twice the model's own arena: the same strings, and the model interns while
|
||||
* this does not - two nodes with the same name cost it twice. Overflowing
|
||||
* loses a name rather than a node, which is the right way round. */
|
||||
#define SNAP_POOL (CURIE_A11Y_POOL * 2)
|
||||
#define SNAP_POOL (REAKTOR_A11Y_POOL * 2)
|
||||
|
||||
static struct {
|
||||
SDL_Mutex *lock;
|
||||
int ready;
|
||||
|
||||
snap_node node[CURIE_A11Y_MAX_NODES];
|
||||
snap_node node[REAKTOR_A11Y_MAX_NODES];
|
||||
int count;
|
||||
char str[SNAP_POOL];
|
||||
int str_used;
|
||||
@@ -34,7 +34,7 @@ static struct {
|
||||
unsigned want_focus, want_activate;
|
||||
Uint32 wake;
|
||||
|
||||
curie_a11y_action activate, focus_action;
|
||||
reaktor_a11y_action activate, focus_action;
|
||||
void *user;
|
||||
} g;
|
||||
|
||||
@@ -66,7 +66,7 @@ find(unsigned id)
|
||||
}
|
||||
|
||||
int
|
||||
curie_snap_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
reaktor_snap_init(reaktor_a11y_action activate, reaktor_a11y_action focus,
|
||||
void *user)
|
||||
{
|
||||
g.activate = activate;
|
||||
@@ -81,29 +81,21 @@ curie_snap_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
return g.ready;
|
||||
}
|
||||
|
||||
void
|
||||
curie_snap_shutdown(void)
|
||||
{
|
||||
if (g.lock) SDL_DestroyMutex(g.lock);
|
||||
g.lock = NULL;
|
||||
g.ready = 0;
|
||||
}
|
||||
|
||||
int
|
||||
curie_snap_update(const curie_a11y *a, unsigned focus_id)
|
||||
reaktor_snap_update(const reaktor_a11y *a, unsigned focus_id)
|
||||
{
|
||||
int n, m, i;
|
||||
const curie_a11y_node *t;
|
||||
const reaktor_a11y_node *t;
|
||||
|
||||
if (!g.ready) return 0;
|
||||
curie_a11y_changes(a, &m);
|
||||
t = curie_a11y_tree(a, &n);
|
||||
reaktor_a11y_changes(a, &m);
|
||||
t = reaktor_a11y_tree(a, &n);
|
||||
if (m == 0 && focus_id == g.focus) return 0;
|
||||
|
||||
SDL_LockMutex(g.lock);
|
||||
g.str_used = 0;
|
||||
g.count = 0;
|
||||
for (i = 0; i < n && i < CURIE_A11Y_MAX_NODES; i++) {
|
||||
for (i = 0; i < n && i < REAKTOR_A11Y_MAX_NODES; i++) {
|
||||
snap_node *s = &g.node[g.count++];
|
||||
|
||||
s->id = t[i].id;
|
||||
@@ -145,7 +137,7 @@ copy_text(int at, char **buf, size_t *left)
|
||||
}
|
||||
|
||||
int
|
||||
curie_snap_get(unsigned id, curie_snap_node *out, char *buf, size_t cap)
|
||||
reaktor_snap_get(unsigned id, reaktor_snap_node *out, char *buf, size_t cap)
|
||||
{
|
||||
int i, ok = 0;
|
||||
|
||||
@@ -173,7 +165,7 @@ curie_snap_get(unsigned id, curie_snap_node *out, char *buf, size_t cap)
|
||||
}
|
||||
|
||||
unsigned
|
||||
curie_snap_child(unsigned parent, int last)
|
||||
reaktor_snap_child(unsigned parent, int last)
|
||||
{
|
||||
unsigned found = 0;
|
||||
int i;
|
||||
@@ -190,7 +182,7 @@ curie_snap_child(unsigned parent, int last)
|
||||
}
|
||||
|
||||
unsigned
|
||||
curie_snap_sibling(unsigned id, int back)
|
||||
reaktor_snap_sibling(unsigned id, int back)
|
||||
{
|
||||
unsigned parent, prev = 0, found = 0;
|
||||
int i, k, seen = 0;
|
||||
@@ -218,7 +210,7 @@ curie_snap_sibling(unsigned id, int back)
|
||||
}
|
||||
|
||||
unsigned
|
||||
curie_snap_parent(unsigned id)
|
||||
reaktor_snap_parent(unsigned id)
|
||||
{
|
||||
unsigned found = 0;
|
||||
int i;
|
||||
@@ -232,7 +224,7 @@ curie_snap_parent(unsigned id)
|
||||
}
|
||||
|
||||
unsigned
|
||||
curie_snap_hit(float x, float y)
|
||||
reaktor_snap_hit(float x, float y)
|
||||
{
|
||||
unsigned hit = 0;
|
||||
unsigned char best = 0;
|
||||
@@ -243,7 +235,7 @@ curie_snap_hit(float x, float y)
|
||||
for (i = 0; i < g.count; i++) {
|
||||
const snap_node *n = &g.node[i];
|
||||
|
||||
if (n->state & CURIE_A11Y_OFFSCREEN) continue;
|
||||
if (n->state & REAKTOR_A11Y_OFFSCREEN) continue;
|
||||
if (x < n->x || x >= n->x + n->w) continue;
|
||||
if (y < n->y || y >= n->y + n->h) continue;
|
||||
if (!hit || n->level >= best) { hit = n->id; best = n->level; }
|
||||
@@ -253,7 +245,7 @@ curie_snap_hit(float x, float y)
|
||||
}
|
||||
|
||||
unsigned
|
||||
curie_snap_focus(void)
|
||||
reaktor_snap_focus(void)
|
||||
{
|
||||
unsigned id = 0;
|
||||
|
||||
@@ -265,15 +257,15 @@ curie_snap_focus(void)
|
||||
}
|
||||
|
||||
int
|
||||
curie_snap_focusable(unsigned char role, unsigned state)
|
||||
reaktor_snap_focusable(unsigned char role, unsigned state)
|
||||
{
|
||||
if (state & CURIE_A11Y_DISABLED) return 0;
|
||||
if (state & REAKTOR_A11Y_DISABLED) return 0;
|
||||
switch (role) {
|
||||
case CURIE_A11Y_TAB: case CURIE_A11Y_BUTTON: case CURIE_A11Y_LINK:
|
||||
case CURIE_A11Y_CHECKBOX: case CURIE_A11Y_RADIO: case CURIE_A11Y_TEXTBOX:
|
||||
case CURIE_A11Y_SLIDER: case CURIE_A11Y_SPINBUTTON:
|
||||
case CURIE_A11Y_COMBOBOX: case CURIE_A11Y_LISTITEM: case CURIE_A11Y_TREEITEM:
|
||||
case CURIE_A11Y_MENUITEM:
|
||||
case REAKTOR_A11Y_TAB: case REAKTOR_A11Y_BUTTON: case REAKTOR_A11Y_LINK:
|
||||
case REAKTOR_A11Y_CHECKBOX: case REAKTOR_A11Y_RADIO: case REAKTOR_A11Y_TEXTBOX:
|
||||
case REAKTOR_A11Y_SLIDER: case REAKTOR_A11Y_SPINBUTTON:
|
||||
case REAKTOR_A11Y_COMBOBOX: case REAKTOR_A11Y_LISTITEM: case REAKTOR_A11Y_TREEITEM:
|
||||
case REAKTOR_A11Y_MENUITEM:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
@@ -298,11 +290,11 @@ request(unsigned *slot, unsigned id)
|
||||
SDL_PushEvent(&e);
|
||||
}
|
||||
|
||||
void curie_snap_request_focus(unsigned id) { request(&g.want_focus, id); }
|
||||
void curie_snap_request_activate(unsigned id) { request(&g.want_activate, id); }
|
||||
void reaktor_snap_request_focus(unsigned id) { request(&g.want_focus, id); }
|
||||
void reaktor_snap_request_activate(unsigned id) { request(&g.want_activate, id); }
|
||||
|
||||
void
|
||||
curie_snap_drain(void)
|
||||
reaktor_snap_drain(void)
|
||||
{
|
||||
unsigned focus, activate;
|
||||
|
||||
|
||||
+19
-20
@@ -17,14 +17,14 @@
|
||||
* id. A bridge therefore never takes the lock, never holds a pointer into the
|
||||
* snapshot, and cannot get either wrong - which matters most for the bridges
|
||||
* that are written on one platform and run on another. */
|
||||
#ifndef CURIE_A11Y_SNAPSHOT_H
|
||||
#define CURIE_A11Y_SNAPSHOT_H
|
||||
#ifndef REAKTOR_A11Y_SNAPSHOT_H
|
||||
#define REAKTOR_A11Y_SNAPSHOT_H
|
||||
|
||||
#include "a11y.h"
|
||||
|
||||
/* One node, copied out. `name` and `value` point into the buffer the caller
|
||||
* passed, or are NULL; everything else is by value. */
|
||||
typedef struct curie_snap_node {
|
||||
typedef struct reaktor_snap_node {
|
||||
unsigned id, parent;
|
||||
unsigned char role, level;
|
||||
unsigned state;
|
||||
@@ -32,51 +32,50 @@ typedef struct curie_snap_node {
|
||||
float x, y, w, h; /* window coordinates */
|
||||
/* Zero-width - lo == hi - means the node is not a range. */
|
||||
float num, lo, hi, step;
|
||||
} curie_snap_node;
|
||||
} reaktor_snap_node;
|
||||
|
||||
/* Enough for any name or value the app produces; a longer one is truncated
|
||||
* rather than refused, because a clipped label reads better than none. */
|
||||
#define CURIE_SNAP_TEXT 512
|
||||
#define REAKTOR_SNAP_TEXT 512
|
||||
|
||||
/* Called once, from the app's thread, with the callbacks a client's press and
|
||||
* a client's focus move turn into. Answers 0 if the lock could not be made,
|
||||
* in which case every call below is a no-op and the bridge should stand down. */
|
||||
int curie_snap_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
int reaktor_snap_init(reaktor_a11y_action activate, reaktor_a11y_action focus,
|
||||
void *user);
|
||||
void curie_snap_shutdown(void);
|
||||
|
||||
/* Takes the copy. From the app's thread, after each drawn frame. Cheap when
|
||||
* nothing changed: it looks at the change count and returns. Answers whether
|
||||
* it copied, which is what a bridge waits for before raising an event. */
|
||||
int curie_snap_update(const curie_a11y *a, unsigned focus_id);
|
||||
int reaktor_snap_update(const reaktor_a11y *a, unsigned focus_id);
|
||||
|
||||
/* Copies the node `id` names. Answers 0 if it is not in the snapshot - a node
|
||||
* a client is still holding after the page it was on went away. */
|
||||
int curie_snap_get(unsigned id, curie_snap_node *out, char *buf, size_t cap);
|
||||
int reaktor_snap_get(unsigned id, reaktor_snap_node *out, char *buf, size_t cap);
|
||||
|
||||
/* Navigation, in the tree's own order, which is draw order and so reading
|
||||
* order. `parent` of 0 means the roots. All answer an id, or 0. */
|
||||
unsigned curie_snap_child(unsigned parent, int last);
|
||||
unsigned curie_snap_sibling(unsigned id, int back);
|
||||
unsigned curie_snap_parent(unsigned id);
|
||||
unsigned reaktor_snap_child(unsigned parent, int last);
|
||||
unsigned reaktor_snap_sibling(unsigned id, int back);
|
||||
unsigned reaktor_snap_parent(unsigned id);
|
||||
|
||||
/* The innermost node containing a point in window coordinates, or 0. Depth
|
||||
* first, and among equals the last drawn: a group's bounds cover its children,
|
||||
* so the last containing node is not the same as the deepest one. */
|
||||
unsigned curie_snap_hit(float x, float y);
|
||||
unsigned reaktor_snap_hit(float x, float y);
|
||||
|
||||
unsigned curie_snap_focus(void);
|
||||
unsigned reaktor_snap_focus(void);
|
||||
|
||||
/* Whether a role takes the keyboard - the same set the shell tabs through, so
|
||||
* what a platform reports focusable is what Tab actually reaches. */
|
||||
int curie_snap_focusable(unsigned char role, unsigned state);
|
||||
int reaktor_snap_focusable(unsigned char role, unsigned state);
|
||||
|
||||
/* A client's request, from the client's thread. Records it and wakes the
|
||||
* loop; the app's thread runs it in curie_snap_drain before the next frame.
|
||||
* loop; the app's thread runs it in reaktor_snap_drain before the next frame.
|
||||
* One of each is enough - a second before the first is served is the client
|
||||
* changing its mind, and the last one is what it wants. */
|
||||
void curie_snap_request_focus(unsigned id);
|
||||
void curie_snap_request_activate(unsigned id);
|
||||
void curie_snap_drain(void);
|
||||
void reaktor_snap_request_focus(unsigned id);
|
||||
void reaktor_snap_request_activate(unsigned id);
|
||||
void reaktor_snap_drain(void);
|
||||
|
||||
#endif /* CURIE_A11Y_SNAPSHOT_H */
|
||||
#endif /* REAKTOR_A11Y_SNAPSHOT_H */
|
||||
|
||||
+85
-85
@@ -54,32 +54,32 @@ static struct {
|
||||
} g;
|
||||
|
||||
/* --- roles ---------------------------------------------------------------
|
||||
* Curie's vocabulary onto UIA's. Every one of these is a control type UIA has
|
||||
* Reaktor's vocabulary onto UIA's. Every one of these is a control type UIA has
|
||||
* had since Windows 7; nothing here needs a newer client. */
|
||||
static long
|
||||
control_type(unsigned char role)
|
||||
{
|
||||
switch (role) {
|
||||
case CURIE_A11Y_WINDOW: return UIA_WindowControlTypeId;
|
||||
case CURIE_A11Y_GROUP: return UIA_GroupControlTypeId;
|
||||
case CURIE_A11Y_TABLIST: return UIA_TabControlTypeId;
|
||||
case CURIE_A11Y_TAB: return UIA_TabItemControlTypeId;
|
||||
case CURIE_A11Y_BUTTON: return UIA_ButtonControlTypeId;
|
||||
case CURIE_A11Y_LINK: return UIA_HyperlinkControlTypeId;
|
||||
case CURIE_A11Y_CHECKBOX: return UIA_CheckBoxControlTypeId;
|
||||
case CURIE_A11Y_RADIO: return UIA_RadioButtonControlTypeId;
|
||||
case CURIE_A11Y_TEXTBOX: return UIA_EditControlTypeId;
|
||||
case CURIE_A11Y_SLIDER: return UIA_SliderControlTypeId;
|
||||
case CURIE_A11Y_SPINBUTTON: return UIA_SpinnerControlTypeId;
|
||||
case CURIE_A11Y_PROGRESS: return UIA_ProgressBarControlTypeId;
|
||||
case CURIE_A11Y_COMBOBOX: return UIA_ComboBoxControlTypeId;
|
||||
case CURIE_A11Y_LISTITEM: return UIA_ListItemControlTypeId;
|
||||
case CURIE_A11Y_TREEITEM: return UIA_TreeItemControlTypeId;
|
||||
case CURIE_A11Y_MENUBAR: return UIA_MenuBarControlTypeId;
|
||||
case CURIE_A11Y_MENU: return UIA_MenuControlTypeId;
|
||||
case CURIE_A11Y_MENUITEM: return UIA_MenuItemControlTypeId;
|
||||
case CURIE_A11Y_DIALOG: return UIA_WindowControlTypeId;
|
||||
case CURIE_A11Y_LABEL: return UIA_TextControlTypeId;
|
||||
case REAKTOR_A11Y_WINDOW: return UIA_WindowControlTypeId;
|
||||
case REAKTOR_A11Y_GROUP: return UIA_GroupControlTypeId;
|
||||
case REAKTOR_A11Y_TABLIST: return UIA_TabControlTypeId;
|
||||
case REAKTOR_A11Y_TAB: return UIA_TabItemControlTypeId;
|
||||
case REAKTOR_A11Y_BUTTON: return UIA_ButtonControlTypeId;
|
||||
case REAKTOR_A11Y_LINK: return UIA_HyperlinkControlTypeId;
|
||||
case REAKTOR_A11Y_CHECKBOX: return UIA_CheckBoxControlTypeId;
|
||||
case REAKTOR_A11Y_RADIO: return UIA_RadioButtonControlTypeId;
|
||||
case REAKTOR_A11Y_TEXTBOX: return UIA_EditControlTypeId;
|
||||
case REAKTOR_A11Y_SLIDER: return UIA_SliderControlTypeId;
|
||||
case REAKTOR_A11Y_SPINBUTTON: return UIA_SpinnerControlTypeId;
|
||||
case REAKTOR_A11Y_PROGRESS: return UIA_ProgressBarControlTypeId;
|
||||
case REAKTOR_A11Y_COMBOBOX: return UIA_ComboBoxControlTypeId;
|
||||
case REAKTOR_A11Y_LISTITEM: return UIA_ListItemControlTypeId;
|
||||
case REAKTOR_A11Y_TREEITEM: return UIA_TreeItemControlTypeId;
|
||||
case REAKTOR_A11Y_MENUBAR: return UIA_MenuBarControlTypeId;
|
||||
case REAKTOR_A11Y_MENU: return UIA_MenuControlTypeId;
|
||||
case REAKTOR_A11Y_MENUITEM: return UIA_MenuItemControlTypeId;
|
||||
case REAKTOR_A11Y_DIALOG: return UIA_WindowControlTypeId;
|
||||
case REAKTOR_A11Y_LABEL: return UIA_TextControlTypeId;
|
||||
default: return UIA_CustomControlTypeId;
|
||||
}
|
||||
}
|
||||
@@ -132,16 +132,16 @@ provider_is_root(const Provider *p)
|
||||
* object, which would go stale the moment a page changed under a client that
|
||||
* was still holding it. */
|
||||
static int
|
||||
node_of(unsigned id, curie_snap_node *out, char *buf, size_t cap)
|
||||
node_of(unsigned id, reaktor_snap_node *out, char *buf, size_t cap)
|
||||
{
|
||||
return curie_snap_get(id, out, buf, cap);
|
||||
return reaktor_snap_get(id, out, buf, cap);
|
||||
}
|
||||
|
||||
static int
|
||||
node_role_is(unsigned id, unsigned char a, unsigned char b, unsigned char c)
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
if (!node_of(id, &n, buf, sizeof(buf))) return 0;
|
||||
return n.role == a || (b && n.role == b) || (c && n.role == c);
|
||||
@@ -150,8 +150,8 @@ node_role_is(unsigned id, unsigned char a, unsigned char b, unsigned char c)
|
||||
static int
|
||||
node_is_range(unsigned id)
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
return node_of(id, &n, buf, sizeof(buf)) && n.hi > n.lo;
|
||||
}
|
||||
@@ -169,25 +169,25 @@ provider_qi(Provider *p, REFIID iid, void **out)
|
||||
provider_is_root(p))
|
||||
*out = &p->root;
|
||||
else if (IsEqualIID(iid, &IID_IInvokeProvider)) {
|
||||
if (!node_role_is(p->id, CURIE_A11Y_BUTTON, CURIE_A11Y_LINK,
|
||||
CURIE_A11Y_MENUITEM) &&
|
||||
!node_role_is(p->id, CURIE_A11Y_TAB, 0, 0))
|
||||
if (!node_role_is(p->id, REAKTOR_A11Y_BUTTON, REAKTOR_A11Y_LINK,
|
||||
REAKTOR_A11Y_MENUITEM) &&
|
||||
!node_role_is(p->id, REAKTOR_A11Y_TAB, 0, 0))
|
||||
return E_NOINTERFACE;
|
||||
*out = &p->invoke;
|
||||
} else if (IsEqualIID(iid, &IID_IValueProvider)) {
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
if (!node_of(p->id, &n, buf, sizeof(buf)) || !n.value)
|
||||
return E_NOINTERFACE;
|
||||
*out = &p->value;
|
||||
} else if (IsEqualIID(iid, &IID_IToggleProvider)) {
|
||||
if (!node_role_is(p->id, CURIE_A11Y_CHECKBOX, 0, 0))
|
||||
if (!node_role_is(p->id, REAKTOR_A11Y_CHECKBOX, 0, 0))
|
||||
return E_NOINTERFACE;
|
||||
*out = &p->toggle;
|
||||
} else if (IsEqualIID(iid, &IID_ISelectionItemProvider)) {
|
||||
if (!node_role_is(p->id, CURIE_A11Y_TAB, CURIE_A11Y_LISTITEM,
|
||||
CURIE_A11Y_RADIO))
|
||||
if (!node_role_is(p->id, REAKTOR_A11Y_TAB, REAKTOR_A11Y_LISTITEM,
|
||||
REAKTOR_A11Y_RADIO))
|
||||
return E_NOINTERFACE;
|
||||
*out = &p->selection;
|
||||
} else if (IsEqualIID(iid, &IID_IRangeValueProvider)) {
|
||||
@@ -299,15 +299,15 @@ simple_GetPropertyValue(IRawElementProviderSimple *self, PROPERTYID prop,
|
||||
VARIANT *out)
|
||||
{
|
||||
Provider *p = FROM_SIMPLE(self);
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
VariantInit(out);
|
||||
if (provider_is_root(p)) {
|
||||
/* if rather than switch throughout: the SDK spells a property id
|
||||
* `const long`, which C does not accept as a case label. */
|
||||
if (prop == UIA_NamePropertyId) {
|
||||
str_variant(out, "Curie");
|
||||
str_variant(out, "Reaktor");
|
||||
} else if (prop == UIA_ControlTypePropertyId) {
|
||||
out->vt = VT_I4;
|
||||
out->lVal = UIA_WindowControlTypeId;
|
||||
@@ -331,13 +331,13 @@ simple_GetPropertyValue(IRawElementProviderSimple *self, PROPERTYID prop,
|
||||
sprintf(id, "%u", n.id);
|
||||
str_variant(out, id);
|
||||
} else if (prop == UIA_IsEnabledPropertyId) {
|
||||
bool_variant(out, !(n.state & CURIE_A11Y_DISABLED));
|
||||
bool_variant(out, !(n.state & REAKTOR_A11Y_DISABLED));
|
||||
} else if (prop == UIA_IsKeyboardFocusablePropertyId) {
|
||||
bool_variant(out, curie_snap_focusable(n.role, n.state));
|
||||
bool_variant(out, reaktor_snap_focusable(n.role, n.state));
|
||||
} else if (prop == UIA_HasKeyboardFocusPropertyId) {
|
||||
bool_variant(out, (n.state & CURIE_A11Y_FOCUSED) != 0);
|
||||
bool_variant(out, (n.state & REAKTOR_A11Y_FOCUSED) != 0);
|
||||
} else if (prop == UIA_IsOffscreenPropertyId) {
|
||||
bool_variant(out, (n.state & CURIE_A11Y_OFFSCREEN) != 0);
|
||||
bool_variant(out, (n.state & REAKTOR_A11Y_OFFSCREEN) != 0);
|
||||
} else if (prop == UIA_IsControlElementPropertyId ||
|
||||
prop == UIA_IsContentElementPropertyId) {
|
||||
bool_variant(out, 1);
|
||||
@@ -348,14 +348,14 @@ simple_GetPropertyValue(IRawElementProviderSimple *self, PROPERTYID prop,
|
||||
* there; one that asks for the property directly, which several do,
|
||||
* gets the same answer here. */
|
||||
} else if (prop == UIA_ToggleToggleStatePropertyId) {
|
||||
if (n.role == CURIE_A11Y_CHECKBOX || n.role == CURIE_A11Y_RADIO) {
|
||||
if (n.role == REAKTOR_A11Y_CHECKBOX || n.role == REAKTOR_A11Y_RADIO) {
|
||||
out->vt = VT_I4;
|
||||
out->lVal = (n.state & CURIE_A11Y_CHECKED) ? ToggleState_On
|
||||
out->lVal = (n.state & REAKTOR_A11Y_CHECKED) ? ToggleState_On
|
||||
: ToggleState_Off;
|
||||
}
|
||||
} else if (prop == UIA_SelectionItemIsSelectedPropertyId) {
|
||||
if (n.role == CURIE_A11Y_TAB || n.role == CURIE_A11Y_LISTITEM)
|
||||
bool_variant(out, (n.state & CURIE_A11Y_SELECTED) != 0);
|
||||
if (n.role == REAKTOR_A11Y_TAB || n.role == REAKTOR_A11Y_LISTITEM)
|
||||
bool_variant(out, (n.state & REAKTOR_A11Y_SELECTED) != 0);
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
@@ -393,14 +393,14 @@ fragment_Navigate(IRawElementProviderFragment *self,
|
||||
*out = NULL;
|
||||
if (provider_is_root(p)) {
|
||||
/* The root's children are the model's roots - nodes with no parent. */
|
||||
if (dir == NavigateDirection_FirstChild) to = curie_snap_child(0, 0);
|
||||
else if (dir == NavigateDirection_LastChild) to = curie_snap_child(0, 1);
|
||||
if (dir == NavigateDirection_FirstChild) to = reaktor_snap_child(0, 0);
|
||||
else if (dir == NavigateDirection_LastChild) to = reaktor_snap_child(0, 1);
|
||||
} else {
|
||||
switch (dir) {
|
||||
case NavigateDirection_Parent:
|
||||
/* A node whose parent is 0 is a child of the fragment root, and
|
||||
* the root is what Parent has to answer with - not nothing. */
|
||||
to = curie_snap_parent(p->id);
|
||||
to = reaktor_snap_parent(p->id);
|
||||
if (!to) {
|
||||
Provider *r = provider_new(0);
|
||||
if (!r) return E_OUTOFMEMORY;
|
||||
@@ -408,11 +408,11 @@ fragment_Navigate(IRawElementProviderFragment *self,
|
||||
return S_OK;
|
||||
}
|
||||
break;
|
||||
case NavigateDirection_FirstChild: to = curie_snap_child(p->id, 0); break;
|
||||
case NavigateDirection_LastChild: to = curie_snap_child(p->id, 1); break;
|
||||
case NavigateDirection_NextSibling: to = curie_snap_sibling(p->id, 0); break;
|
||||
case NavigateDirection_FirstChild: to = reaktor_snap_child(p->id, 0); break;
|
||||
case NavigateDirection_LastChild: to = reaktor_snap_child(p->id, 1); break;
|
||||
case NavigateDirection_NextSibling: to = reaktor_snap_sibling(p->id, 0); break;
|
||||
case NavigateDirection_PreviousSibling:
|
||||
to = curie_snap_sibling(p->id, 1);
|
||||
to = reaktor_snap_sibling(p->id, 1);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@@ -453,8 +453,8 @@ fragment_get_BoundingRectangle(IRawElementProviderFragment *self,
|
||||
struct UiaRect *out)
|
||||
{
|
||||
Provider *p = FROM_FRAGMENT(self);
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
POINT origin;
|
||||
|
||||
out->left = out->top = out->width = out->height = 0.0;
|
||||
@@ -488,7 +488,7 @@ fragment_SetFocus(IRawElementProviderFragment *self)
|
||||
{
|
||||
Provider *p = FROM_FRAGMENT(self);
|
||||
|
||||
if (!provider_is_root(p)) curie_snap_request_focus(p->id);
|
||||
if (!provider_is_root(p)) reaktor_snap_request_focus(p->id);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ root_ElementProviderFromPoint(IRawElementProviderFragmentRoot *self,
|
||||
*out = NULL;
|
||||
origin.x = origin.y = 0;
|
||||
if (!ClientToScreen(g.hwnd, &origin)) return S_OK;
|
||||
hit = curie_snap_hit((float)(x - origin.x), (float)(y - origin.y));
|
||||
hit = reaktor_snap_hit((float)(x - origin.x), (float)(y - origin.y));
|
||||
if (!hit) return S_OK;
|
||||
{
|
||||
Provider *q = provider_new(hit);
|
||||
@@ -545,7 +545,7 @@ root_GetFocus(IRawElementProviderFragmentRoot *self,
|
||||
|
||||
(void)self;
|
||||
*out = NULL;
|
||||
id = curie_snap_focus();
|
||||
id = reaktor_snap_focus();
|
||||
if (!id) return S_OK;
|
||||
{
|
||||
Provider *q = provider_new(id);
|
||||
@@ -565,7 +565,7 @@ static IRawElementProviderFragmentRootVtbl g_root_vtbl = {
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
invoke_Invoke(IInvokeProvider *self)
|
||||
{
|
||||
curie_snap_request_activate(FROM_INVOKE(self)->id);
|
||||
reaktor_snap_request_activate(FROM_INVOKE(self)->id);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -623,19 +623,19 @@ static IValueProviderVtbl g_value_vtbl = {
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
toggle_Toggle(IToggleProvider *self)
|
||||
{
|
||||
curie_snap_request_activate(FROM_TOGGLE(self)->id);
|
||||
reaktor_snap_request_activate(FROM_TOGGLE(self)->id);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
toggle_get_ToggleState(IToggleProvider *self, enum ToggleState *out)
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
*out = ToggleState_Indeterminate;
|
||||
if (node_of(FROM_TOGGLE(self)->id, &n, buf, sizeof(buf)))
|
||||
*out = (n.state & CURIE_A11Y_CHECKED) ? ToggleState_On
|
||||
*out = (n.state & REAKTOR_A11Y_CHECKED) ? ToggleState_On
|
||||
: ToggleState_Off;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -648,7 +648,7 @@ static IToggleProviderVtbl g_toggle_vtbl = {
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
select_Select(ISelectionItemProvider *self)
|
||||
{
|
||||
curie_snap_request_activate(FROM_SELECT(self)->id);
|
||||
reaktor_snap_request_activate(FROM_SELECT(self)->id);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -671,12 +671,12 @@ select_RemoveFromSelection(ISelectionItemProvider *self)
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
select_get_IsSelected(ISelectionItemProvider *self, BOOL *out)
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
*out = FALSE;
|
||||
if (node_of(FROM_SELECT(self)->id, &n, buf, sizeof(buf)))
|
||||
*out = (n.state & (CURIE_A11Y_SELECTED | CURIE_A11Y_CHECKED))
|
||||
*out = (n.state & (REAKTOR_A11Y_SELECTED | REAKTOR_A11Y_CHECKED))
|
||||
? TRUE : FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -685,7 +685,7 @@ static HRESULT STDMETHODCALLTYPE
|
||||
select_get_SelectionContainer(ISelectionItemProvider *self,
|
||||
IRawElementProviderSimple **out)
|
||||
{
|
||||
unsigned parent = curie_snap_parent(FROM_SELECT(self)->id);
|
||||
unsigned parent = reaktor_snap_parent(FROM_SELECT(self)->id);
|
||||
|
||||
*out = NULL;
|
||||
if (!parent) return S_OK;
|
||||
@@ -704,7 +704,7 @@ static ISelectionItemProviderVtbl g_select_vtbl = {
|
||||
};
|
||||
|
||||
/* The range is the one of the three that can be set without a press: the
|
||||
* widget takes steps from the shell already (curie_focus_step), so a client
|
||||
* widget takes steps from the shell already (reaktor_focus_step), so a client
|
||||
* asking for a value becomes focus plus that many steps. */
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
range_SetValue(IRangeValueProvider *self, double val)
|
||||
@@ -719,8 +719,8 @@ range_SetValue(IRangeValueProvider *self, double val)
|
||||
static HRESULT
|
||||
range_field(IRangeValueProvider *self, size_t off, double *out)
|
||||
{
|
||||
curie_snap_node n;
|
||||
char buf[CURIE_SNAP_TEXT];
|
||||
reaktor_snap_node n;
|
||||
char buf[REAKTOR_SNAP_TEXT];
|
||||
|
||||
*out = 0.0;
|
||||
if (node_of(FROM_RANGE(self)->id, &n, buf, sizeof(buf)))
|
||||
@@ -730,24 +730,24 @@ range_field(IRangeValueProvider *self, size_t off, double *out)
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
range_get_Value(IRangeValueProvider *self, double *out)
|
||||
{ return range_field(self, offsetof(curie_snap_node, num), out); }
|
||||
{ return range_field(self, offsetof(reaktor_snap_node, num), out); }
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
range_get_Maximum(IRangeValueProvider *self, double *out)
|
||||
{ return range_field(self, offsetof(curie_snap_node, hi), out); }
|
||||
{ return range_field(self, offsetof(reaktor_snap_node, hi), out); }
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
range_get_Minimum(IRangeValueProvider *self, double *out)
|
||||
{ return range_field(self, offsetof(curie_snap_node, lo), out); }
|
||||
{ return range_field(self, offsetof(reaktor_snap_node, lo), out); }
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
range_get_SmallChange(IRangeValueProvider *self, double *out)
|
||||
{ return range_field(self, offsetof(curie_snap_node, step), out); }
|
||||
{ return range_field(self, offsetof(reaktor_snap_node, step), out); }
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
range_get_LargeChange(IRangeValueProvider *self, double *out)
|
||||
{
|
||||
HRESULT hr = range_field(self, offsetof(curie_snap_node, step), out);
|
||||
HRESULT hr = range_field(self, offsetof(reaktor_snap_node, step), out);
|
||||
|
||||
*out *= 10.0; /* what Page Up would be worth, if it were bound */
|
||||
return hr;
|
||||
@@ -814,13 +814,13 @@ wnd_proc(HWND h, UINT msg, WPARAM wp, LPARAM lp)
|
||||
/* --- the seam ----------------------------------------------------------- */
|
||||
|
||||
void
|
||||
curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
reaktor_a11y_platform_init(reaktor_a11y_action activate, reaktor_a11y_action focus,
|
||||
void *user)
|
||||
{
|
||||
SDL_Window **wins;
|
||||
int count = 0;
|
||||
|
||||
if (!curie_snap_init(activate, focus, user)) return;
|
||||
if (!reaktor_snap_init(activate, focus, user)) return;
|
||||
|
||||
/* Asked for rather than guessed: the shell has exactly one window by the
|
||||
* time this runs, but its id is SDL's business. */
|
||||
@@ -842,15 +842,15 @@ curie_a11y_platform_init(curie_a11y_action activate, curie_a11y_action focus,
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_drain(void)
|
||||
reaktor_a11y_platform_drain(void)
|
||||
{
|
||||
curie_snap_drain();
|
||||
reaktor_snap_drain();
|
||||
}
|
||||
|
||||
void
|
||||
curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
reaktor_a11y_platform_push(const reaktor_a11y *a, unsigned focus_id)
|
||||
{
|
||||
if (!curie_snap_update(a, focus_id)) return;
|
||||
if (!reaktor_snap_update(a, focus_id)) return;
|
||||
|
||||
/* Events only once a client has asked for the tree, and only while one is
|
||||
* listening. Structure first, because a client that has not walked the
|
||||
@@ -858,11 +858,11 @@ curie_a11y_platform_push(const curie_a11y *a, unsigned focus_id)
|
||||
if (!g.wanted || !UiaClientsAreListening()) return;
|
||||
{
|
||||
int m, i, structural = 0;
|
||||
const curie_a11y_change *c = curie_a11y_changes(a, &m);
|
||||
const reaktor_a11y_change *c = reaktor_a11y_changes(a, &m);
|
||||
|
||||
for (i = 0; i < m; i++)
|
||||
if (c[i].kind == CURIE_A11Y_ADDED ||
|
||||
c[i].kind == CURIE_A11Y_REMOVED) {
|
||||
if (c[i].kind == REAKTOR_A11Y_ADDED ||
|
||||
c[i].kind == REAKTOR_A11Y_REMOVED) {
|
||||
structural = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
int curie_prefers_dark(void)
|
||||
int reaktor_prefers_dark(void)
|
||||
{
|
||||
switch (SDL_GetSystemTheme()) {
|
||||
case SDL_SYSTEM_THEME_DARK: return 1;
|
||||
@@ -35,7 +35,7 @@ int curie_prefers_dark(void)
|
||||
* Elsewhere this stays a no-op: macOS themes the frame from NSAppearance,
|
||||
* which SDL already follows, and on Linux and the BSDs the frame belongs to
|
||||
* the window manager. */
|
||||
int curie_window_set_dark(void *native_window, int dark)
|
||||
int reaktor_window_set_dark(void *native_window, int dark)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
typedef long(__stdcall * set_attr_fn)(void *, unsigned long, void *,
|
||||
|
||||
+5
-5
@@ -5,14 +5,14 @@
|
||||
* calls below are the whole portable surface; `native_window` is an opaque
|
||||
* handle (HWND on Windows, NSWindow* on macOS, an X11 Window on Unix), which
|
||||
* keeps this header free of platform includes. */
|
||||
#ifndef CURIE_THEME_H
|
||||
#define CURIE_THEME_H
|
||||
#ifndef REAKTOR_THEME_H
|
||||
#define REAKTOR_THEME_H
|
||||
|
||||
/* 1 = system is in dark mode, 0 = light, -1 = could not determine. */
|
||||
int curie_prefers_dark(void);
|
||||
int reaktor_prefers_dark(void);
|
||||
|
||||
/* Applies a dark or light window frame. Returns 1 if the platform applied it,
|
||||
* 0 if unsupported or it failed. */
|
||||
int curie_window_set_dark(void *native_window, int dark);
|
||||
int reaktor_window_set_dark(void *native_window, int dark);
|
||||
|
||||
#endif /* CURIE_THEME_H */
|
||||
#endif /* REAKTOR_THEME_H */
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* CSS -> nk_style translation. A page needs none of those directly, only the
|
||||
* handful of calls below, so App stays an opaque pointer and a page stays
|
||||
* about layout. */
|
||||
#ifndef CURIE_UI_H
|
||||
#define CURIE_UI_H
|
||||
#ifndef REAKTOR_UI_H
|
||||
#define REAKTOR_UI_H
|
||||
|
||||
#include "nk_common.h"
|
||||
#include "a11y.h"
|
||||
@@ -27,9 +27,9 @@ enum {
|
||||
TAB_DIAG,
|
||||
TAB_COUNT
|
||||
};
|
||||
extern const char *const curie_tab_names[TAB_COUNT];
|
||||
extern const char *const reaktor_tab_names[TAB_COUNT];
|
||||
|
||||
/* Startup milestones, sampled into curie_diag::rss_at so the diagnostics page
|
||||
/* Startup milestones, sampled into reaktor_diag::rss_at so the diagnostics page
|
||||
* can report what each step of the startup cost. They live here rather than
|
||||
* in the shell because the page indexes the same list: adding a milestone is
|
||||
* one edit, and the array below sizes itself from it. */
|
||||
@@ -43,7 +43,7 @@ enum {
|
||||
RSS_STYLE,
|
||||
RSS_STEPS
|
||||
};
|
||||
extern const char *const curie_rss_names[RSS_STEPS];
|
||||
extern const char *const reaktor_rss_names[RSS_STEPS];
|
||||
|
||||
#define SC_TEXT_CAP 64
|
||||
#define SC_BOX_CAP 512
|
||||
@@ -97,69 +97,67 @@ typedef struct showcase_state {
|
||||
|
||||
/* --- what a page may ask of the shell ---------------------------------- */
|
||||
|
||||
struct nk_color curie_col(const unsigned char rgba[4]);
|
||||
struct nk_color reaktor_col(const unsigned char rgba[4]);
|
||||
/* A palette token as a colour, falling back to `def` when the stylesheet has
|
||||
* no such custom property. */
|
||||
struct nk_color curie_token(const char *name, struct nk_color def);
|
||||
struct nk_color reaktor_token(const char *name, struct nk_color def);
|
||||
/* A colour, unless it is indistinguishable from `behind` - then `fallback`.
|
||||
* tiny.css's dark palette gives thead and details the page's own background,
|
||||
* which makes them invisible. */
|
||||
struct nk_color curie_visible(struct nk_color want,
|
||||
struct nk_color reaktor_visible(struct nk_color want,
|
||||
struct nk_color behind,
|
||||
struct nk_color fallback);
|
||||
const struct nk_user_font *curie_font(App *app, int px, int bold);
|
||||
const struct nk_user_font *reaktor_font(App *app, int px, int bold);
|
||||
|
||||
/* An SVG from the repo, and the common case: an Ionicon stroked in the
|
||||
* theme's muted text colour, so a page never spells out a path. */
|
||||
struct nk_image curie_glyph(App *app, const char *rel_src, int px);
|
||||
struct nk_image curie_ionicon(App *app, const char *name, int px);
|
||||
/* The common case: an Ionicon stroked in the theme's muted text colour, so a
|
||||
* page never spells out a path. */
|
||||
struct nk_image reaktor_ionicon(App *app, const char *name, int px);
|
||||
/* The same, stroked in a colour of the caller's choosing - for an icon that
|
||||
* sits on something other than the page, such as a row filled with the
|
||||
* accent. curie_on gives the colour that reads on a given background. */
|
||||
struct nk_image curie_ionicon_exact(App *app, const char *name, int px,
|
||||
* accent. reaktor_on gives the colour that reads on a given background. */
|
||||
struct nk_image reaktor_ionicon_exact(App *app, const char *name, int px,
|
||||
struct nk_color stroke, float sw);
|
||||
|
||||
/* A filled rounded rect whose corners are anti-aliased on every backend -
|
||||
* nk_fill_rect's are not, on the software one. See the definition. */
|
||||
void curie_fill_round(App *app, struct nk_command_buffer *cv, struct nk_rect b,
|
||||
void reaktor_fill_round(App *app, struct nk_command_buffer *cv, struct nk_rect b,
|
||||
float rounding, struct nk_color col);
|
||||
struct nk_image curie_ionicon_col(App *app, const char *name, int px,
|
||||
struct nk_image reaktor_ionicon_col(App *app, const char *name, int px,
|
||||
struct nk_color stroke);
|
||||
struct nk_color curie_on(struct nk_color bg);
|
||||
struct nk_color reaktor_on(struct nk_color bg);
|
||||
|
||||
/* Records what the pointer is over: the cursor it wants, and whether hovering
|
||||
* it changes anything on screen. See the hot-region note in main.c. */
|
||||
/* Draws an image at exactly px, centred in the current widget slot. nk_image
|
||||
* stretches to fill its slot instead, so the size asked for is ignored. */
|
||||
void curie_image(App *app, struct nk_context *ctx, struct nk_image im, int px);
|
||||
void reaktor_image(App *app, struct nk_context *ctx, struct nk_image im, int px);
|
||||
|
||||
void curie_hot(App *app, struct nk_rect r, int cursor, int repaint);
|
||||
void reaktor_hot(App *app, struct nk_rect r, int cursor, int repaint);
|
||||
/* The same, for something emitted inside a popup: it is drawn over the page,
|
||||
* so it outranks whatever it covers however the two were recorded. */
|
||||
void curie_hot_top(App *app, struct nk_rect r, int cursor, int repaint);
|
||||
void reaktor_hot_top(App *app, struct nk_rect r, int cursor, int repaint);
|
||||
/* The same, but redrawing on every move inside it rather than only on
|
||||
* crossing into it - for anything drawn at the pointer. */
|
||||
void curie_hot_follow(App *app, struct nk_rect r, int cursor);
|
||||
void reaktor_hot_follow(App *app, struct nk_rect r, int cursor);
|
||||
|
||||
int curie_button(App *app, struct nk_context *ctx, const char *label);
|
||||
int curie_button_accent(App *app, struct nk_context *ctx, const char *label);
|
||||
int curie_button_icon(App *app, struct nk_context *ctx,
|
||||
int reaktor_button(App *app, struct nk_context *ctx, const char *label);
|
||||
int reaktor_button_accent(App *app, struct nk_context *ctx, const char *label);
|
||||
int reaktor_button_icon(App *app, struct nk_context *ctx,
|
||||
const char *ionicon, const char *label);
|
||||
/* The button rule with no label and the given fill: a colour swatch that is
|
||||
* otherwise a button. `name` is what a reader is told it is. */
|
||||
int curie_button_color(App *app, struct nk_context *ctx, const char *name,
|
||||
int reaktor_button_color(App *app, struct nk_context *ctx, const char *name,
|
||||
struct nk_color fill);
|
||||
int curie_link(App *app, struct nk_context *ctx, const char *label, int active);
|
||||
|
||||
/* A text field styled from tiny.css's `input` rule, with `hint` painted into
|
||||
* it while it is empty. Nuklear has no placeholder of its own. */
|
||||
nk_flags curie_field(App *app, struct nk_context *ctx, nk_flags flags,
|
||||
nk_flags reaktor_field(App *app, struct nk_context *ctx, nk_flags flags,
|
||||
char *buf, int *len, int cap, const char *hint,
|
||||
nk_plugin_filter filter);
|
||||
|
||||
/* The radius for a popup, tooltip or menu. Nuklear has a single rounding for
|
||||
* every panel, so it cannot be set globally without rounding the window. */
|
||||
float curie_popup_rounding(void);
|
||||
float reaktor_popup_rounding(void);
|
||||
|
||||
/* --- describing the frame ----------------------------------------------
|
||||
* What a screen reader will eventually be handed. A page reports each widget
|
||||
@@ -170,50 +168,50 @@ float curie_popup_rounding(void);
|
||||
* phase 4 - so an unreported widget is not a visible bug today, which is
|
||||
* exactly why the widgets go through helpers that report for you. */
|
||||
/* Answers the node's id, which a widget that takes the keyboard needs -
|
||||
* see curie_focus_step. Most callers ignore it. */
|
||||
unsigned curie_note(App *app, unsigned char role, const char *name,
|
||||
* see reaktor_focus_step. Most callers ignore it. */
|
||||
unsigned reaktor_note(App *app, unsigned char role, const char *name,
|
||||
const char *value, unsigned state, struct nk_rect bounds);
|
||||
/* The same, and everything until curie_note_pop is a child of it. */
|
||||
unsigned curie_note_push(App *app, unsigned char role, const char *name,
|
||||
/* The same, and everything until reaktor_note_pop is a child of it. */
|
||||
unsigned reaktor_note_push(App *app, unsigned char role, const char *name,
|
||||
const char *value, unsigned state, struct nk_rect bounds);
|
||||
void curie_note_pop(App *app);
|
||||
void reaktor_note_pop(App *app);
|
||||
|
||||
/* How many steps the arrows asked this node for, taken once and only while it
|
||||
* has focus. A range answers its own arrows: the shell knows a node's value
|
||||
* only as the text a reader would hear, and nothing of its bounds or its
|
||||
* grain. Every other role lets the arrows move focus instead. */
|
||||
int curie_focus_step(App *app, unsigned id);
|
||||
int reaktor_focus_step(App *app, unsigned id);
|
||||
|
||||
/* Whether this node was asked to activate - by Enter, or by a screen reader
|
||||
* pressing it - taken once. A widget that answers it acts on itself, which is
|
||||
* the reliable path; one that does not still gets the synthetic click the
|
||||
* shell falls back to. See the definition. */
|
||||
int curie_focus_activated(App *app, unsigned id);
|
||||
int reaktor_focus_activated(App *app, unsigned id);
|
||||
|
||||
/* The numbers behind a range's value text, for the node `id` names - what a
|
||||
* platform needs to offer a slider as something to set rather than only to
|
||||
* read. See curie_a11y_set_range. */
|
||||
void curie_note_range(App *app, unsigned id, float num, float lo, float hi,
|
||||
* read. See reaktor_a11y_set_range. */
|
||||
void reaktor_note_range(App *app, unsigned id, float num, float lo, float hi,
|
||||
float step);
|
||||
/* Convenience for the common case: the widget just drawn, at the bounds the
|
||||
* layout gave it, with no value. */
|
||||
unsigned curie_note_here(App *app, struct nk_context *ctx, unsigned char role,
|
||||
unsigned reaktor_note_here(App *app, struct nk_context *ctx, unsigned char role,
|
||||
const char *name, unsigned state);
|
||||
|
||||
/* The platform's own Open dialog. Answers 0 if one is already up. The choice
|
||||
* arrives on SDL's thread, so it is not a return value: call curie_file_taken
|
||||
* arrives on SDL's thread, so it is not a return value: call reaktor_file_taken
|
||||
* on a later frame, which answers non-zero once - when there is a fresh
|
||||
* result - and writes it into `out`. A cancel and a platform with no picker
|
||||
* both come back as text, because a page that shows the answer should show
|
||||
* those too. */
|
||||
int curie_file_open(App *app);
|
||||
int curie_file_taken(App *app, char *out, int cap);
|
||||
int reaktor_file_open(App *app);
|
||||
int reaktor_file_taken(App *app, char *out, int cap);
|
||||
|
||||
/* What the shell knows about itself, for the page that reports it. Copied
|
||||
* out rather than reached for, so App stays opaque. */
|
||||
typedef struct curie_diag {
|
||||
typedef struct reaktor_diag {
|
||||
const char *renderer; /* SDL's name for the backend in use */
|
||||
const char *mode; /* what CURIE_RENDERER asked for */
|
||||
const char *mode; /* what REAKTOR_RENDERER asked for */
|
||||
const char *frame_rate; /* SDL_HINT_MAIN_CALLBACK_RATE at rest */
|
||||
const char *drag_rate; /* and while a button is held */
|
||||
const char *font;
|
||||
@@ -241,15 +239,15 @@ typedef struct curie_diag {
|
||||
int atlas_w, atlas_h, atlas_bpp;
|
||||
unsigned long rss_at[RSS_STEPS]; /* working set, one per milestone */
|
||||
unsigned long priv_at[RSS_STEPS]; /* private commit, the same milestones */
|
||||
} curie_diag;
|
||||
} reaktor_diag;
|
||||
|
||||
void curie_diagnostics(App *app, curie_diag *out);
|
||||
void reaktor_diagnostics(App *app, reaktor_diag *out);
|
||||
|
||||
showcase_state *curie_showcase(App *app);
|
||||
showcase_state *reaktor_showcase(App *app);
|
||||
|
||||
/* Drawn by showcase.c, one page per tab above TAB_LOGIN. w and h are the
|
||||
* content region of the group it is being drawn into. */
|
||||
void curie_showcase_page(App *app, struct nk_context *ctx, int tab,
|
||||
void reaktor_showcase_page(App *app, struct nk_context *ctx, int tab,
|
||||
float w, float h);
|
||||
|
||||
#endif /* CURIE_UI_H */
|
||||
#endif /* REAKTOR_UI_H */
|
||||
|
||||
+17
-17
@@ -22,9 +22,9 @@
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include "curie.h"
|
||||
#include "reaktor.h"
|
||||
|
||||
#define CURIE_PATH_CAP 1024
|
||||
#define REAKTOR_PATH_CAP 1024
|
||||
|
||||
static int copy_out(char *out, size_t cap, const char *src)
|
||||
{
|
||||
@@ -34,23 +34,23 @@ static int copy_out(char *out, size_t cap, const char *src)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int curie_root(char *out, size_t cap)
|
||||
int reaktor_root(char *out, size_t cap)
|
||||
{
|
||||
/* Explicit override wins: needed for installed layouts, and for running
|
||||
* the binary from anywhere. */
|
||||
const char *env = getenv("CURIE_ROOT");
|
||||
const char *env = getenv("REAKTOR_ROOT");
|
||||
if (env && *env) return copy_out(out, cap, env);
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
/* There is no executable to walk up from, and no ambiguity to resolve:
|
||||
* the assets are packaged into the virtual filesystem at exactly the
|
||||
* paths the rest of the code already asks for, so the root is its root.
|
||||
* "" rather than "/" because curie_path inserts the separator. */
|
||||
* "" rather than "/" because reaktor_path inserts the separator. */
|
||||
return copy_out(out, cap, "");
|
||||
#else
|
||||
{
|
||||
char exe[CURIE_PATH_CAP];
|
||||
char probe[CURIE_PATH_CAP];
|
||||
char exe[REAKTOR_PATH_CAP];
|
||||
char probe[REAKTOR_PATH_CAP];
|
||||
int i;
|
||||
|
||||
# if defined(_WIN32)
|
||||
@@ -60,12 +60,12 @@ int curie_root(char *out, size_t cap)
|
||||
for (i = 0; exe[i]; i++) if (exe[i] == '\\') exe[i] = '/';
|
||||
# else
|
||||
/* No executable path without a platform call; the working directory
|
||||
* is the honest fallback, and CURIE_ROOT covers the rest. */
|
||||
* is the honest fallback, and REAKTOR_ROOT covers the rest. */
|
||||
if (!getcwd(exe, sizeof(exe))) return 0;
|
||||
(void)i;
|
||||
# endif
|
||||
|
||||
/* Walk up looking for the .curie-root sentinel.
|
||||
/* Walk up looking for the .reaktor-root sentinel.
|
||||
*
|
||||
* This used to probe for a "third_party" directory, which broke under
|
||||
* CMake: add_subdirectory(third_party/SDL) mirrors that path into the
|
||||
@@ -76,7 +76,7 @@ int curie_root(char *out, size_t cap)
|
||||
if (!slash) return 0;
|
||||
*slash = '\0';
|
||||
|
||||
if (snprintf(probe, sizeof(probe), "%s/.curie-root", exe) < 0)
|
||||
if (snprintf(probe, sizeof(probe), "%s/.reaktor-root", exe) < 0)
|
||||
return 0;
|
||||
probe[sizeof(probe) - 1] = '\0';
|
||||
{
|
||||
@@ -90,17 +90,17 @@ int curie_root(char *out, size_t cap)
|
||||
#endif
|
||||
}
|
||||
|
||||
int curie_path(char *out, size_t cap, const char *rel)
|
||||
int reaktor_path(char *out, size_t cap, const char *rel)
|
||||
{
|
||||
char root[CURIE_PATH_CAP];
|
||||
char root[REAKTOR_PATH_CAP];
|
||||
|
||||
if (!curie_root(root, sizeof(root))) return 0;
|
||||
if (!reaktor_root(root, sizeof(root))) return 0;
|
||||
if (snprintf(out, cap, "%s/%s", root, rel) < 0) return 0;
|
||||
out[cap - 1] = '\0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *curie_read_file(const char *path, size_t *len)
|
||||
char *reaktor_read_file(const char *path, size_t *len)
|
||||
{
|
||||
FILE *f;
|
||||
char *buf;
|
||||
@@ -126,7 +126,7 @@ char *curie_read_file(const char *path, size_t *len)
|
||||
return buf;
|
||||
}
|
||||
|
||||
void curie_free(void *p) { free(p); }
|
||||
void reaktor_free(void *p) { free(p); }
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* Both counters come from one call. <psapi.h> maps GetProcessMemoryInfo to
|
||||
@@ -146,7 +146,7 @@ static int win_mem(PROCESS_MEMORY_COUNTERS_EX *out)
|
||||
* only honest measure of what a frame costs on a machine that rasterises in
|
||||
* software: the work lands on threads the app never created, so wall-clock
|
||||
* on the main thread misses nearly all of it. */
|
||||
double curie_process_cpu_ms(void)
|
||||
double reaktor_process_cpu_ms(void)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
FILETIME c, e, k, u;
|
||||
@@ -165,7 +165,7 @@ double curie_process_cpu_ms(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void curie_process_memory(size_t *rss, size_t *priv)
|
||||
void reaktor_process_memory(size_t *rss, size_t *priv)
|
||||
{
|
||||
*rss = *priv = 0;
|
||||
|
||||
|
||||
+80
-80
@@ -38,14 +38,14 @@ check(const char *what, int got, int want)
|
||||
|
||||
/* The dump, into a buffer, so it can be compared rather than eyeballed. */
|
||||
static void
|
||||
dump_to(curie_a11y *a, char *out, size_t cap)
|
||||
dump_to(reaktor_a11y *a, char *out, size_t cap)
|
||||
{
|
||||
FILE *f = tmpfile();
|
||||
long n;
|
||||
|
||||
out[0] = '\0';
|
||||
if (!f) { printf("FAIL cannot open tmpfile\n"); failures++; return; }
|
||||
curie_a11y_dump(a, f);
|
||||
reaktor_a11y_dump(a, f);
|
||||
fflush(f);
|
||||
n = ftell(f);
|
||||
if (n < 0 || (size_t)n >= cap) {
|
||||
@@ -72,34 +72,34 @@ check_text(const char *what, const char *got, const char *want)
|
||||
* says which tab is selected; `with_link` adds a node above the button, to
|
||||
* test that inserting one does not renumber the ones below. */
|
||||
static void
|
||||
build(curie_a11y *a, int tab, int with_link, int checked)
|
||||
build(reaktor_a11y *a, int tab, int with_link, int checked)
|
||||
{
|
||||
static const char *const names[3] = { "Login", "Buttons", "Inputs" };
|
||||
int i;
|
||||
|
||||
curie_a11y_begin(a, "Curie", r(0, 0, 960, 680));
|
||||
reaktor_a11y_begin(a, "Reaktor", r(0, 0, 960, 680));
|
||||
|
||||
curie_a11y_push(a, CURIE_A11Y_TABLIST, NULL, NULL, 0, r(0, 40, 960, 34));
|
||||
reaktor_a11y_push(a, REAKTOR_A11Y_TABLIST, NULL, NULL, 0, r(0, 40, 960, 34));
|
||||
for (i = 0; i < 3; i++)
|
||||
curie_a11y_add(a, CURIE_A11Y_TAB, names[i], NULL,
|
||||
i == tab ? CURIE_A11Y_SELECTED : 0u,
|
||||
reaktor_a11y_add(a, REAKTOR_A11Y_TAB, names[i], NULL,
|
||||
i == tab ? REAKTOR_A11Y_SELECTED : 0u,
|
||||
r((float)(8 + i * 72), 40, 68, 34));
|
||||
curie_a11y_pop(a);
|
||||
reaktor_a11y_pop(a);
|
||||
|
||||
curie_a11y_push(a, CURIE_A11Y_GROUP, "Buttons", NULL, 0,
|
||||
reaktor_a11y_push(a, REAKTOR_A11Y_GROUP, "Buttons", NULL, 0,
|
||||
r(0, 74, 960, 606));
|
||||
if (with_link)
|
||||
curie_a11y_add(a, CURIE_A11Y_LINK, "contact", NULL, 0,
|
||||
reaktor_a11y_add(a, REAKTOR_A11Y_LINK, "contact", NULL, 0,
|
||||
r(16, 82, 60, 20));
|
||||
curie_a11y_add(a, CURIE_A11Y_BUTTON, "Continue", NULL, 0,
|
||||
reaktor_a11y_add(a, REAKTOR_A11Y_BUTTON, "Continue", NULL, 0,
|
||||
r(16, 110, 200, 38));
|
||||
curie_a11y_add(a, CURIE_A11Y_CHECKBOX, "Wrap lines", NULL,
|
||||
checked ? CURIE_A11Y_CHECKED : 0u, r(16, 158, 160, 24));
|
||||
curie_a11y_add(a, CURIE_A11Y_TEXTBOX, "E-mail", "you@example.com",
|
||||
CURIE_A11Y_FOCUSED, r(16, 190, 380, 38));
|
||||
curie_a11y_pop(a);
|
||||
reaktor_a11y_add(a, REAKTOR_A11Y_CHECKBOX, "Wrap lines", NULL,
|
||||
checked ? REAKTOR_A11Y_CHECKED : 0u, r(16, 158, 160, 24));
|
||||
reaktor_a11y_add(a, REAKTOR_A11Y_TEXTBOX, "E-mail", "you@example.com",
|
||||
REAKTOR_A11Y_FOCUSED, r(16, 190, 380, 38));
|
||||
reaktor_a11y_pop(a);
|
||||
|
||||
curie_a11y_end(a);
|
||||
reaktor_a11y_end(a);
|
||||
}
|
||||
|
||||
/* The same shape with the page group under a given name. The app names that
|
||||
@@ -107,30 +107,30 @@ build(curie_a11y *a, int tab, int with_link, int checked)
|
||||
* replaces the whole page rather than restating it, which is the case the
|
||||
* subtree rule exists for. */
|
||||
static void
|
||||
build_page(curie_a11y *a, const char *group)
|
||||
build_page(reaktor_a11y *a, const char *group)
|
||||
{
|
||||
curie_a11y_begin(a, "Curie", r(0, 0, 960, 680));
|
||||
curie_a11y_push(a, CURIE_A11Y_GROUP, group, NULL, 0, r(0, 74, 960, 606));
|
||||
curie_a11y_add(a, CURIE_A11Y_BUTTON, "Continue", NULL, 0,
|
||||
reaktor_a11y_begin(a, "Reaktor", r(0, 0, 960, 680));
|
||||
reaktor_a11y_push(a, REAKTOR_A11Y_GROUP, group, NULL, 0, r(0, 74, 960, 606));
|
||||
reaktor_a11y_add(a, REAKTOR_A11Y_BUTTON, "Continue", NULL, 0,
|
||||
r(16, 110, 200, 38));
|
||||
curie_a11y_add(a, CURIE_A11Y_CHECKBOX, "Wrap lines", NULL, 0,
|
||||
reaktor_a11y_add(a, REAKTOR_A11Y_CHECKBOX, "Wrap lines", NULL, 0,
|
||||
r(16, 158, 160, 24));
|
||||
curie_a11y_pop(a);
|
||||
curie_a11y_end(a);
|
||||
reaktor_a11y_pop(a);
|
||||
reaktor_a11y_end(a);
|
||||
}
|
||||
|
||||
/* Ids of the nodes after the insertion point, so two frames can be compared. */
|
||||
static void
|
||||
ids_of(curie_a11y *a, unsigned out[3])
|
||||
ids_of(reaktor_a11y *a, unsigned out[3])
|
||||
{
|
||||
int n = 0, i, k = 0;
|
||||
const curie_a11y_node *t = curie_a11y_tree(a, &n);
|
||||
const reaktor_a11y_node *t = reaktor_a11y_tree(a, &n);
|
||||
|
||||
out[0] = out[1] = out[2] = 0;
|
||||
for (i = 0; i < n && k < 3; i++)
|
||||
if (t[i].role == CURIE_A11Y_BUTTON ||
|
||||
t[i].role == CURIE_A11Y_CHECKBOX ||
|
||||
t[i].role == CURIE_A11Y_TEXTBOX)
|
||||
if (t[i].role == REAKTOR_A11Y_BUTTON ||
|
||||
t[i].role == REAKTOR_A11Y_CHECKBOX ||
|
||||
t[i].role == REAKTOR_A11Y_TEXTBOX)
|
||||
out[k++] = t[i].id;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ ids_of(curie_a11y *a, unsigned out[3])
|
||||
static void
|
||||
bench(void)
|
||||
{
|
||||
static curie_a11y a;
|
||||
static reaktor_a11y a;
|
||||
static const char *const labels[8] = {
|
||||
"Default", "Primary", "With icon", "Back", "Forward", "Menu",
|
||||
"Hold me", "Disabled"
|
||||
@@ -158,47 +158,47 @@ bench(void)
|
||||
for (run = 0; run < runs; run++) {
|
||||
t0 = clock();
|
||||
for (f = 0; f < frames; f++) {
|
||||
curie_a11y_begin(&a, "Curie", r(0, 0, 960, 680));
|
||||
curie_a11y_push(&a, CURIE_A11Y_TABLIST, "Pages", NULL, 0,
|
||||
reaktor_a11y_begin(&a, "Reaktor", r(0, 0, 960, 680));
|
||||
reaktor_a11y_push(&a, REAKTOR_A11Y_TABLIST, "Pages", NULL, 0,
|
||||
r(0, 36, 960, 34));
|
||||
for (i = 0; i < 7; i++)
|
||||
curie_a11y_add(&a, CURIE_A11Y_TAB, labels[i % 8], NULL,
|
||||
i == (f & 3) ? CURIE_A11Y_SELECTED : 0u,
|
||||
reaktor_a11y_add(&a, REAKTOR_A11Y_TAB, labels[i % 8], NULL,
|
||||
i == (f & 3) ? REAKTOR_A11Y_SELECTED : 0u,
|
||||
r((float)(i * 72), 40, 68, 28));
|
||||
curie_a11y_pop(&a);
|
||||
curie_a11y_push(&a, CURIE_A11Y_GROUP, "Buttons", NULL, 0,
|
||||
reaktor_a11y_pop(&a);
|
||||
reaktor_a11y_push(&a, REAKTOR_A11Y_GROUP, "Buttons", NULL, 0,
|
||||
r(0, 70, 960, 610));
|
||||
for (i = 0; i < 24; i++)
|
||||
curie_a11y_add(&a, CURIE_A11Y_BUTTON, labels[i % 8], NULL, 0,
|
||||
reaktor_a11y_add(&a, REAKTOR_A11Y_BUTTON, labels[i % 8], NULL, 0,
|
||||
r(20, (float)(100 + i * 40), 298, 38));
|
||||
/* Twenty-one identically-roled, differently-named buttons and a run of
|
||||
* unnamed ones: the two shapes the id scheme has to tell apart. */
|
||||
for (i = 0; i < 21; i++)
|
||||
curie_a11y_add(&a, CURIE_A11Y_BUTTON, NULL, NULL, 0,
|
||||
reaktor_a11y_add(&a, REAKTOR_A11Y_BUTTON, NULL, NULL, 0,
|
||||
r((float)(20 + i * 42), 507, 34, 34));
|
||||
for (i = 0; i < 27; i++)
|
||||
curie_a11y_add(&a, CURIE_A11Y_LABEL, labels[i % 8], "v", 0,
|
||||
reaktor_a11y_add(&a, REAKTOR_A11Y_LABEL, labels[i % 8], "v", 0,
|
||||
r(20, (float)(600 + i * 30), 910, 30));
|
||||
curie_a11y_pop(&a);
|
||||
curie_a11y_end(&a);
|
||||
reaktor_a11y_pop(&a);
|
||||
reaktor_a11y_end(&a);
|
||||
}
|
||||
ms = 1000.0 * (double)(clock() - t0) / (double)CLOCKS_PER_SEC;
|
||||
if (run == 0 || ms < best) best = ms;
|
||||
}
|
||||
curie_a11y_tree(&a, &n);
|
||||
reaktor_a11y_tree(&a, &n);
|
||||
printf("a11y bench: %d nodes, best of %d x %d frames, %.2f us/frame\n",
|
||||
n, runs, frames, best * 1000.0 / (double)frames);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
static curie_a11y a; /* 600 KB of arenas; not a stack object */
|
||||
static reaktor_a11y a; /* 600 KB of arenas; not a stack object */
|
||||
static char text[8192];
|
||||
unsigned before[3], after[3];
|
||||
int n, i, added, removed, restated, renamed;
|
||||
|
||||
static const char *const want =
|
||||
"window \"Curie\" 0,0 960x680\n"
|
||||
"window \"Reaktor\" 0,0 960x680\n"
|
||||
" tablist 0,40 960x34\n"
|
||||
" tab \"Login\" [selected] 8,40 68x34\n"
|
||||
" tab \"Buttons\" 80,40 68x34\n"
|
||||
@@ -215,33 +215,33 @@ int main(int argc, char **argv)
|
||||
dump_to(&a, text, sizeof(text));
|
||||
check_text("dump", text, want);
|
||||
|
||||
curie_a11y_tree(&a, &n);
|
||||
reaktor_a11y_tree(&a, &n);
|
||||
check("node count", n, 9);
|
||||
|
||||
/* Everything is new on the first frame, and that is one change, not nine:
|
||||
* a subtree is reported by its root and a client re-reads what hangs off
|
||||
* it. The whole tree arriving is the largest case of that. */
|
||||
curie_a11y_changes(&a, &n);
|
||||
reaktor_a11y_changes(&a, &n);
|
||||
check("first frame changes", n, 1);
|
||||
|
||||
/* 2. The same screen again changes nothing at all. This is the property
|
||||
* the whole design rests on: a reader must not hear the screen rebuild
|
||||
* itself every frame. */
|
||||
build(&a, 0, 0, 0);
|
||||
curie_a11y_changes(&a, &n);
|
||||
reaktor_a11y_changes(&a, &n);
|
||||
check("identical frame changes", n, 0);
|
||||
|
||||
/* 3. Selecting another tab is two state changes and nothing else - not a
|
||||
* removal and an addition, which is what an unstable id would give. */
|
||||
build(&a, 1, 0, 0);
|
||||
{
|
||||
const curie_a11y_change *c = curie_a11y_changes(&a, &n);
|
||||
const reaktor_a11y_change *c = reaktor_a11y_changes(&a, &n);
|
||||
added = removed = restated = renamed = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
if (c[i].kind == CURIE_A11Y_ADDED) added++;
|
||||
if (c[i].kind == CURIE_A11Y_REMOVED) removed++;
|
||||
if (c[i].kind == CURIE_A11Y_RESTATED) restated++;
|
||||
if (c[i].kind == CURIE_A11Y_RENAMED) renamed++;
|
||||
if (c[i].kind == REAKTOR_A11Y_ADDED) added++;
|
||||
if (c[i].kind == REAKTOR_A11Y_REMOVED) removed++;
|
||||
if (c[i].kind == REAKTOR_A11Y_RESTATED) restated++;
|
||||
if (c[i].kind == REAKTOR_A11Y_RENAMED) renamed++;
|
||||
}
|
||||
check("tab switch: added", added, 0);
|
||||
check("tab switch: removed", removed, 0);
|
||||
@@ -252,10 +252,10 @@ int main(int argc, char **argv)
|
||||
/* 4. Ticking a checkbox is one state change. */
|
||||
build(&a, 1, 0, 1);
|
||||
{
|
||||
const curie_a11y_change *c = curie_a11y_changes(&a, &n);
|
||||
const reaktor_a11y_change *c = reaktor_a11y_changes(&a, &n);
|
||||
restated = 0;
|
||||
for (i = 0; i < n; i++)
|
||||
if (c[i].kind == CURIE_A11Y_RESTATED) restated++;
|
||||
if (c[i].kind == REAKTOR_A11Y_RESTATED) restated++;
|
||||
check("checkbox: total changes", n, 1);
|
||||
check("checkbox: restated", restated, 1);
|
||||
}
|
||||
@@ -264,7 +264,7 @@ int main(int argc, char **argv)
|
||||
* state change on the next frame, moving it is two, clearing it one.
|
||||
* Phase 3 hangs off this. */
|
||||
{
|
||||
const curie_a11y_node *t = curie_a11y_tree(&a, &n);
|
||||
const reaktor_a11y_node *t = reaktor_a11y_tree(&a, &n);
|
||||
unsigned btn = 0, box = 0;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
@@ -273,24 +273,24 @@ int main(int argc, char **argv)
|
||||
}
|
||||
check("focus: nodes found", btn != 0 && box != 0, 1);
|
||||
|
||||
curie_a11y_set_focus(&a, btn);
|
||||
reaktor_a11y_set_focus(&a, btn);
|
||||
build(&a, 1, 0, 1);
|
||||
curie_a11y_changes(&a, &n);
|
||||
reaktor_a11y_changes(&a, &n);
|
||||
check("focus: set is one change", n, 1);
|
||||
t = curie_a11y_tree(&a, &n);
|
||||
t = reaktor_a11y_tree(&a, &n);
|
||||
for (i = 0; i < n; i++)
|
||||
if (t[i].id == btn)
|
||||
check("focus: bit on the node",
|
||||
(t[i].state & CURIE_A11Y_FOCUSED) != 0, 1);
|
||||
(t[i].state & REAKTOR_A11Y_FOCUSED) != 0, 1);
|
||||
|
||||
curie_a11y_set_focus(&a, box);
|
||||
reaktor_a11y_set_focus(&a, box);
|
||||
build(&a, 1, 0, 1);
|
||||
curie_a11y_changes(&a, &n);
|
||||
reaktor_a11y_changes(&a, &n);
|
||||
check("focus: move is two changes", n, 2);
|
||||
|
||||
curie_a11y_set_focus(&a, 0);
|
||||
reaktor_a11y_set_focus(&a, 0);
|
||||
build(&a, 1, 0, 1);
|
||||
curie_a11y_changes(&a, &n);
|
||||
reaktor_a11y_changes(&a, &n);
|
||||
check("focus: clear is one change", n, 1);
|
||||
}
|
||||
|
||||
@@ -307,10 +307,10 @@ int main(int argc, char **argv)
|
||||
|
||||
/* And the insertion itself is reported, once. */
|
||||
{
|
||||
const curie_a11y_change *c = curie_a11y_changes(&a, &n);
|
||||
const reaktor_a11y_change *c = reaktor_a11y_changes(&a, &n);
|
||||
added = 0;
|
||||
for (i = 0; i < n; i++)
|
||||
if (c[i].kind == CURIE_A11Y_ADDED) added++;
|
||||
if (c[i].kind == REAKTOR_A11Y_ADDED) added++;
|
||||
check("insertion: added", added, 1);
|
||||
check("insertion: total changes", n, 1);
|
||||
}
|
||||
@@ -318,10 +318,10 @@ int main(int argc, char **argv)
|
||||
/* 6. Removing it again is one removal. */
|
||||
build(&a, 1, 0, 1);
|
||||
{
|
||||
const curie_a11y_change *c = curie_a11y_changes(&a, &n);
|
||||
const reaktor_a11y_change *c = reaktor_a11y_changes(&a, &n);
|
||||
removed = 0;
|
||||
for (i = 0; i < n; i++)
|
||||
if (c[i].kind == CURIE_A11Y_REMOVED) removed++;
|
||||
if (c[i].kind == REAKTOR_A11Y_REMOVED) removed++;
|
||||
check("removal: removed", removed, 1);
|
||||
check("removal: total changes", n, 1);
|
||||
}
|
||||
@@ -333,11 +333,11 @@ int main(int argc, char **argv)
|
||||
build_page(&a, "Buttons");
|
||||
build_page(&a, "Popups");
|
||||
{
|
||||
const curie_a11y_change *c = curie_a11y_changes(&a, &n);
|
||||
const reaktor_a11y_change *c = reaktor_a11y_changes(&a, &n);
|
||||
added = removed = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
if (c[i].kind == CURIE_A11Y_ADDED) added++;
|
||||
if (c[i].kind == CURIE_A11Y_REMOVED) removed++;
|
||||
if (c[i].kind == REAKTOR_A11Y_ADDED) added++;
|
||||
if (c[i].kind == REAKTOR_A11Y_REMOVED) removed++;
|
||||
}
|
||||
check("page swap: added", added, 1);
|
||||
check("page swap: removed", removed, 1);
|
||||
@@ -348,13 +348,13 @@ int main(int argc, char **argv)
|
||||
* is the documented limit of the scheme: they keep their identities
|
||||
* frame to frame, but inserting another one above them does shift the
|
||||
* rest. Asserted so the limit is known rather than discovered. */
|
||||
curie_a11y_begin(&a, "w", r(0, 0, 10, 10));
|
||||
reaktor_a11y_begin(&a, "w", r(0, 0, 10, 10));
|
||||
for (i = 0; i < 4; i++)
|
||||
curie_a11y_add(&a, CURIE_A11Y_BUTTON, NULL, NULL, 0, r(0, 0, 1, 1));
|
||||
curie_a11y_end(&a);
|
||||
reaktor_a11y_add(&a, REAKTOR_A11Y_BUTTON, NULL, NULL, 0, r(0, 0, 1, 1));
|
||||
reaktor_a11y_end(&a);
|
||||
{
|
||||
int m = 0, j, dup = 0;
|
||||
const curie_a11y_node *t = curie_a11y_tree(&a, &m);
|
||||
const reaktor_a11y_node *t = reaktor_a11y_tree(&a, &m);
|
||||
for (i = 0; i < m; i++)
|
||||
for (j = i + 1; j < m; j++)
|
||||
if (t[i].id == t[j].id) dup++;
|
||||
@@ -364,12 +364,12 @@ int main(int argc, char **argv)
|
||||
/* 8. Overflow is counted and survived, not trapped. A tree that is
|
||||
* slightly wrong beats a frame that does not draw. */
|
||||
a.overflow_nodes = 0;
|
||||
curie_a11y_begin(&a, "w", r(0, 0, 10, 10));
|
||||
for (i = 0; i < CURIE_A11Y_MAX_NODES + 64; i++)
|
||||
curie_a11y_add(&a, CURIE_A11Y_BUTTON, "x", NULL, 0, r(0, 0, 1, 1));
|
||||
curie_a11y_end(&a);
|
||||
curie_a11y_tree(&a, &n);
|
||||
check("overflow clamps at the arena size", n, CURIE_A11Y_MAX_NODES);
|
||||
reaktor_a11y_begin(&a, "w", r(0, 0, 10, 10));
|
||||
for (i = 0; i < REAKTOR_A11Y_MAX_NODES + 64; i++)
|
||||
reaktor_a11y_add(&a, REAKTOR_A11Y_BUTTON, "x", NULL, 0, r(0, 0, 1, 1));
|
||||
reaktor_a11y_end(&a);
|
||||
reaktor_a11y_tree(&a, &n);
|
||||
check("overflow clamps at the arena size", n, REAKTOR_A11Y_MAX_NODES);
|
||||
check("overflow is counted", a.overflow_nodes > 0, 1);
|
||||
|
||||
if (failures) {
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
/* mkicon.c - branding/curie-icon.ico, rasterised from branding/curie-icon.svg.
|
||||
/* mkicon.c - branding/reaktor-icon.ico, rasterised from branding/reaktor-icon.svg.
|
||||
*
|
||||
* The .svg is the authored mark; the .ico is derived from it, and this is what
|
||||
* derives it. It is not part of the build: Explorer reads the icon from a
|
||||
@@ -19,17 +19,17 @@
|
||||
* So every entry here is 32-bit BGRA with a zeroed mask, except 256, which
|
||||
* stays a PNG because at four bytes a pixel it is a quarter-megabyte on its
|
||||
* own. plutovg renders premultiplied; Windows wants straight alpha, which is
|
||||
* what curie_unpremultiply is for. */
|
||||
* what reaktor_unpremultiply is for. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "curie.h"
|
||||
#include "reaktor.h"
|
||||
#include "appicon.h"
|
||||
|
||||
#define ICON_SVG "branding/curie-icon.svg"
|
||||
#define ICON_ICO "branding/curie-icon.ico"
|
||||
#define ICON_TMP "branding/curie-icon.png.tmp"
|
||||
#define ICON_SVG "branding/reaktor-icon.svg"
|
||||
#define ICON_ICO "branding/reaktor-icon.ico"
|
||||
#define ICON_TMP "branding/reaktor-icon.png.tmp"
|
||||
|
||||
/* Every size Explorer, the taskbar and the Alt-Tab switcher ask for. */
|
||||
static const int g_sizes[] = { 16, 24, 32, 48, 64, 128, 256 };
|
||||
@@ -115,8 +115,8 @@ main(void)
|
||||
int i, ok = 1;
|
||||
|
||||
memset(e, 0, sizeof(e));
|
||||
if (!curie_path(tmp, sizeof(tmp), ICON_TMP) ||
|
||||
!curie_path(out_path, sizeof(out_path), ICON_ICO)) {
|
||||
if (!reaktor_path(tmp, sizeof(tmp), ICON_TMP) ||
|
||||
!reaktor_path(out_path, sizeof(out_path), ICON_ICO)) {
|
||||
fprintf(stderr, "mkicon: cannot resolve the repo root\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -124,14 +124,14 @@ main(void)
|
||||
for (i = 0; i < SIZE_N && ok; i++) {
|
||||
int n = g_sizes[i];
|
||||
plutovg_surface_t *surf =
|
||||
curie_svg_surface_path(ICON_SVG, n, NULL, NULL, 0.0f);
|
||||
reaktor_svg_surface_path(ICON_SVG, n, NULL, NULL, 0.0f);
|
||||
|
||||
if (!surf) {
|
||||
fprintf(stderr, "mkicon: %s did not render at %d\n", ICON_SVG, n);
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
||||
curie_unpremultiply(plutovg_surface_get_data(surf), n, n,
|
||||
reaktor_unpremultiply(plutovg_surface_get_data(surf), n, n,
|
||||
plutovg_surface_get_stride(surf));
|
||||
e[i].size = n;
|
||||
if (n >= 256) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<!-- shell.html - the page Emscripten links curie.wasm into.
|
||||
<!-- shell.html - the page Emscripten links reaktor.wasm into.
|
||||
Emscripten's stock shell carries a logo, a link and two debug checkboxes;
|
||||
this is the canvas and nothing else, on the same background the app
|
||||
clears to, so the page and the app are one surface. -->
|
||||
@@ -7,7 +7,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Curie</title>
|
||||
<title>Reaktor</title>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/* vmwalk.c - what a running process's private bytes are actually made of.
|
||||
*
|
||||
* A memory audit of Curie accounted for 0.45 MB of a 9.6 MB process, and runs
|
||||
* A memory audit of Reaktor accounted for 0.45 MB of a 9.6 MB process, and runs
|
||||
* of the same binary vary by ~2 MB - so nothing under a megabyte is
|
||||
* measurable by launching and reading a counter. This walks another process's
|
||||
* address space and buckets every committed region. Read-only and
|
||||
|
||||
Reference in New Issue
Block a user