@elurjs/linux 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/host/CMakeLists.txt +203 -0
- package/host/README.md +422 -0
- package/host/ci/tsan.supp +15 -0
- package/host/src/elur_applicator.cpp +5073 -0
- package/host/src/elur_applicator.h +387 -0
- package/host/src/elur_clip.cpp +76 -0
- package/host/src/elur_clip.h +23 -0
- package/host/src/elur_crypto_module.cpp +121 -0
- package/host/src/elur_events.h +57 -0
- package/host/src/elur_fonts.cpp +106 -0
- package/host/src/elur_fonts.h +31 -0
- package/host/src/elur_host.cpp +1041 -0
- package/host/src/elur_host.h +66 -0
- package/host/src/elur_http_module.cpp +437 -0
- package/host/src/elur_js.h +40 -0
- package/host/src/elur_modules.cpp +453 -0
- package/host/src/elur_modules.h +159 -0
- package/host/src/elur_renderer.h +46 -0
- package/host/src/elur_shot.cpp +64 -0
- package/host/src/elur_shot.h +17 -0
- package/host/src/elur_skia_a11y.cpp +987 -0
- package/host/src/elur_skia_a11y.h +146 -0
- package/host/src/elur_skia_app.cpp +1770 -0
- package/host/src/elur_skia_app.h +18 -0
- package/host/src/elur_state_module.cpp +99 -0
- package/host/src/elur_tck_module.cpp +186 -0
- package/host/src/elur_ui_module.cpp +84 -0
- package/host/src/elur_yoga.cpp +452 -0
- package/host/src/elur_yoga.h +95 -0
- package/host/src/main.cpp +294 -0
- package/index.mjs +28 -0
- package/package.json +29 -4
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// elur_skia_a11y.h — árbol AT-SPI virtual del carril Skia (fase 2,
|
|
2
|
+
// ADR-0193 / propuesta skia-renderer-arbol).
|
|
3
|
+
//
|
|
4
|
+
// El carril views materializa la semántica en el GtkAccessible de cada
|
|
5
|
+
// widget real; en el carril Skia no hay widgets — cada nodo obtiene un
|
|
6
|
+
// ElurSkiaA11y: GObject que implementa la interfaz GtkAccessible con
|
|
7
|
+
// padre/hijos/hermanos derivados del árbol virtual (proyección: los
|
|
8
|
+
// ancestros sin acc se aplastan — el padre accesible es el ancestro
|
|
9
|
+
// accesible más cercano, paridad con el aplanado AT de nodos NONE).
|
|
10
|
+
//
|
|
11
|
+
// Injerto con el árbol de widgets: la raíz virtual es el
|
|
12
|
+
// first_accessible_child del área misma (ElurSkiaArea — subclase de
|
|
13
|
+
// GtkDrawingArea que lo resuelve por vfunc pura). NO se usa
|
|
14
|
+
// set_accessible_parent/update_next_accessible_sibling: el unref
|
|
15
|
+
// interno de esas rutas dispara un dispose en cadena que mata el
|
|
16
|
+
// widget bajo bus atspi activo (medido en gdb — use-after-free del
|
|
17
|
+
// área reasignada a un JSContext).
|
|
18
|
+
//
|
|
19
|
+
// Notificaciones: add/remove se emiten alternando
|
|
20
|
+
// GTK_ACCESSIBLE_STATE_HIDDEN por API pública — el contexto atspi
|
|
21
|
+
// deriva ChildrenChanged del cambio de HIDDEN. Los cambios de
|
|
22
|
+
// plataforma (foco) y bounds no tienen emit público en GTK4
|
|
23
|
+
// (gtk_accessible_platform_changed/bounds_changed son privados) —
|
|
24
|
+
// ATs consultan bajo demanda; gap declarado hasta la cadena de foco.
|
|
25
|
+
//
|
|
26
|
+
// Estado semántico por nodo vive aquí (accs_), no en el SkiaTree —
|
|
27
|
+
// el árbol compartido queda puro visual.
|
|
28
|
+
#pragma once
|
|
29
|
+
|
|
30
|
+
#include <gtk/gtk.h>
|
|
31
|
+
|
|
32
|
+
// ElurSkiaArea — GtkDrawingArea cuyo get_first_accessible_child
|
|
33
|
+
// devuelve la raíz virtual del árbol Skia (injerto por vfunc pura —
|
|
34
|
+
// nada de set_accessible_parent/update_next_accessible_sibling: el
|
|
35
|
+
// unref interno de esas rutas dispara un dispose en cadena que mata el
|
|
36
|
+
// widget bajo bus atspi activo). main.cpp la crea en lugar de
|
|
37
|
+
// gtk_drawing_area_new() cuando el carril es Skia. Existe en ambos
|
|
38
|
+
// builds — en el stub devuelve un GtkDrawingArea plano (wantSkia es
|
|
39
|
+
// falso ahí, así que el área ni se usa).
|
|
40
|
+
GtkWidget *elur_skia_area_new(void);
|
|
41
|
+
|
|
42
|
+
// ElurSkiaGlArea — la misma injerta accesible pero sobre GtkGLArea
|
|
43
|
+
// para el backend GPU opt-in (fase 4). Mismo layout de instancia:
|
|
44
|
+
// mgr al final, igual que ElurSkiaArea.
|
|
45
|
+
GtkWidget *elur_skia_glarea_new(void);
|
|
46
|
+
|
|
47
|
+
// Solo existe contenido cuando el carril Skia compila (lib presente)
|
|
48
|
+
// — el manager es un TU vacío en el build stub, igual que
|
|
49
|
+
// elur_skia_app.cpp.
|
|
50
|
+
#if ELUR_HAS_SKIA
|
|
51
|
+
|
|
52
|
+
#include <string>
|
|
53
|
+
#include <unordered_map>
|
|
54
|
+
#include <unordered_set>
|
|
55
|
+
#include <vector>
|
|
56
|
+
|
|
57
|
+
#include "native/skia-tree/elur_skia_tree.h"
|
|
58
|
+
|
|
59
|
+
namespace elur {
|
|
60
|
+
class SkiaA11y;
|
|
61
|
+
} // namespace elur
|
|
62
|
+
|
|
63
|
+
void elur_skia_area_set_a11y(GtkWidget *area, elur::SkiaA11y *mgr);
|
|
64
|
+
|
|
65
|
+
namespace elur {
|
|
66
|
+
|
|
67
|
+
// Manager del árbol virtual — lo posee el SkiaApplicator.
|
|
68
|
+
class SkiaA11y {
|
|
69
|
+
public:
|
|
70
|
+
void init(GtkWidget *area, skia::SkiaTree *tree);
|
|
71
|
+
void shutdown();
|
|
72
|
+
|
|
73
|
+
// Ciclo de vida del acc espejo del nodo (create/delete-node del DL).
|
|
74
|
+
void add(int id);
|
|
75
|
+
// Tras insert/move-child: notifica ChildrenChanged(ADDED) sobre el
|
|
76
|
+
// padre accesible YA enlazado — el registry atspi cachea el árbol y
|
|
77
|
+
// solo refetchea cuando llega el evento; emitirlo en create-node
|
|
78
|
+
// (antes del enlace) dejaba el caché en el esqueleto de widgets.
|
|
79
|
+
void childLinked(int childId);
|
|
80
|
+
// Antes de tree_.removeChild: ChildrenChanged(REMOVED) sobre el
|
|
81
|
+
// padre aún intacto — después ya no se podría resolver.
|
|
82
|
+
void childUnlinked(int childId);
|
|
83
|
+
// Primer acc de una raíz del DL — el first_child del área.
|
|
84
|
+
void *firstRootAcc();
|
|
85
|
+
// Llamar ANTES de tree_.deleteNode — recorre el subárbol intacto
|
|
86
|
+
// para retirar los accs con notificación REMOVED.
|
|
87
|
+
void remove(int id);
|
|
88
|
+
// update-semantics: aplica la clave sobre el acc del nodo con el
|
|
89
|
+
// mismo vocabulario que el carril views (ADR-0117); null retira.
|
|
90
|
+
void apply(int id, const std::string &key, bool isNull,
|
|
91
|
+
const std::string &str, double num, bool b);
|
|
92
|
+
// Prop `as` (set-prop, no semantics): h1–h6 → rol heading +
|
|
93
|
+
// role-description — paridad del aplicador views/Android.
|
|
94
|
+
void applyAs(int id, const std::string &s);
|
|
95
|
+
// update-text: anuncia live regions (gtk_accessible_announce) y
|
|
96
|
+
// refresca el name del nodo text (paridad GtkLabel: name = texto).
|
|
97
|
+
void textChanged(int id);
|
|
98
|
+
// Foco virtual (fase 2): el acc lee FOCUSED bajo demanda desde este
|
|
99
|
+
// flag — platform_changed no tiene emit público en GTK4.
|
|
100
|
+
void setFocused(int id, bool f);
|
|
101
|
+
|
|
102
|
+
// Contenido textual del nodo para la iface GtkAccessibleText:
|
|
103
|
+
// text → n.text, text-input → props["value"], resto → vacío.
|
|
104
|
+
std::string textContent(int id) const;
|
|
105
|
+
// Acceso al nodo del árbol (o nullptr) — para los vfuncs del GObject.
|
|
106
|
+
const skia::SkiaNode *nodeFor(int id) const;
|
|
107
|
+
|
|
108
|
+
// Consultas para los vfuncs del GObject (resolución perezosa sobre
|
|
109
|
+
// el árbol — siempre reflejan el estado actual).
|
|
110
|
+
void *accFor(int id); // ElurSkiaA11y* o nullptr
|
|
111
|
+
void *parentAcc(int id); // acc ancestro o fixed del area
|
|
112
|
+
void *firstChildAcc(int id); // primer acc descendiente
|
|
113
|
+
void *nextSiblingAcc(int id); // siguiente acc en orden doc
|
|
114
|
+
bool bounds(int id, int &x, int &y, int &w, int &h);
|
|
115
|
+
void announceStructure(int id); // toggle HIDDEN → ChildrenChanged
|
|
116
|
+
// La señal state-change del ctx lo llama al primer emit real —
|
|
117
|
+
// certifica que el acc publica eventos por D-Bus (ctx realizado).
|
|
118
|
+
void announced(int id);
|
|
119
|
+
// Re-intenta injerto+flap de los pendientes — callback del timer.
|
|
120
|
+
void drainPending();
|
|
121
|
+
|
|
122
|
+
private:
|
|
123
|
+
GtkWidget *area_ = nullptr; // ElurSkiaArea del carril
|
|
124
|
+
skia::SkiaTree *tree_ = nullptr;
|
|
125
|
+
int focusedId_ = 0; // foco virtual — ensure lo hereda
|
|
126
|
+
std::unordered_map<int, void *> accs_; // id → ElurSkiaA11y* (owned)
|
|
127
|
+
// Nodos injertados cuyo ADDED aún no se confirmó emitido — el
|
|
128
|
+
// flap es no-op mientras el ctx propio no esté realizado, y la
|
|
129
|
+
// realización llega por la cadena padre→hijo o por enumeración
|
|
130
|
+
// del registry; el drenaje reintenta hasta que la señal
|
|
131
|
+
// state-change del propio ctx los certifique.
|
|
132
|
+
std::unordered_set<int> pending_;
|
|
133
|
+
guint drainSrc_ = 0;
|
|
134
|
+
int drainCount_ = 0;
|
|
135
|
+
bool draining_ = false;
|
|
136
|
+
void armDrain();
|
|
137
|
+
|
|
138
|
+
void *ensure(int id);
|
|
139
|
+
int naturalRole(const std::string &type) const;
|
|
140
|
+
bool absPos(int id, float &ax, float &ay) const;
|
|
141
|
+
void collectSubtree(int id, std::vector<int> &out);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
} // namespace elur
|
|
145
|
+
|
|
146
|
+
#endif // ELUR_HAS_SKIA
|