5#include "flutter/shell/platform/linux/fl_view_accessible.h"
6#include "flutter/shell/platform/linux/fl_accessible_node.h"
7#include "flutter/shell/platform/linux/fl_accessible_text_field.h"
8#include "flutter/shell/platform/linux/public/flutter_linux/fl_value.h"
9#include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h"
27G_DEFINE_TYPE(FlViewAccessible, fl_view_accessible, ATK_TYPE_PLUG)
39 return FL_ACCESSIBLE_NODE(
40 g_hash_table_lookup(
self->semantics_nodes_by_id, GINT_TO_POINTER(
id)));
48 if (node !=
nullptr) {
56 g_hash_table_insert(
self->semantics_nodes_by_id,
57 GINT_TO_POINTER(semantics->
id),
58 reinterpret_cast<gpointer
>(node));
62 g_signal_emit_by_name(
self,
"children-changed::add", 0, node,
nullptr);
63 self->root_node_created =
true;
71 FlViewAccessible*
self = FL_VIEW_ACCESSIBLE(accessible);
74 if (node ==
nullptr) {
83 FlViewAccessible*
self = FL_VIEW_ACCESSIBLE(accessible);
86 if (
i != 0 || node ==
nullptr) {
90 return ATK_OBJECT(g_object_ref(node));
95 return ATK_ROLE_PANEL;
100 FlViewAccessible*
self = FL_VIEW_ACCESSIBLE(accessible);
102 return node !=
nullptr ? atk_object_ref_state_set(ATK_OBJECT(node)) :
nullptr;
106 FlViewAccessible*
self = FL_VIEW_ACCESSIBLE(
object);
108 g_clear_pointer(&
self->semantics_nodes_by_id, g_hash_table_unref);
110 if (
self->engine !=
nullptr) {
111 g_object_remove_weak_pointer(
object,
112 reinterpret_cast<gpointer*
>(&
self->engine));
113 self->engine =
nullptr;
116 G_OBJECT_CLASS(fl_view_accessible_parent_class)->dispose(
object);
129 self->semantics_nodes_by_id = g_hash_table_new_full(
130 g_direct_hash, g_direct_equal,
nullptr, g_object_unref);
134 FlViewAccessible*
self =
135 FL_VIEW_ACCESSIBLE(g_object_new(fl_view_accessible_get_type(),
nullptr));
137 g_object_add_weak_pointer(G_OBJECT(
self),
138 reinterpret_cast<gpointer*
>(&
self->engine));
143 FlViewAccessible*
self,
145 g_autoptr(GHashTable) pending_children =
146 g_hash_table_new_full(g_direct_hash, g_direct_equal,
nullptr,
148 for (
size_t i = 0;
i <
update->node_count;
i++) {
166 g_hash_table_insert(pending_children, atk_node, children);
169 g_hash_table_foreach_remove(
174 FlAccessibleNode* parent = FL_ACCESSIBLE_NODE(
key);
177 const int32_t* children_in_traversal_order =
180 g_autoptr(GPtrArray) children = g_ptr_array_new();
181 for (
size_t i = 0;
i < child_count;
i++) {
182 FlAccessibleNode* child =
184 g_assert(child !=
nullptr);
186 g_ptr_array_add(children, child);
@ kFlutterSemanticsFlagIsTextField
Whether the semantic node represents a text field.
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
void fl_accessible_node_set_text_direction(FlAccessibleNode *self, FlutterTextDirection direction)
void fl_accessible_node_set_text_selection(FlAccessibleNode *self, gint base, gint extent)
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
void fl_accessible_node_set_value(FlAccessibleNode *self, const gchar *value)
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlag flags)
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent, gint index)
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, int32_t id)
FlAccessibleNode * fl_accessible_text_field_new(FlEngine *engine, int32_t id)
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
G_MODULE_EXPORT void fl_value_unref(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
typedefG_BEGIN_DECLS struct _FlValue FlValue
static void fl_view_accessible_dispose(GObject *object)
static AtkStateSet * fl_view_accessible_ref_state_set(AtkObject *accessible)
static FlAccessibleNode * get_node(FlViewAccessible *self, FlutterSemanticsNode2 *semantics)
static void fl_view_accessible_init(FlViewAccessible *self)
static AtkRole fl_view_accessible_get_role(AtkObject *accessible)
static FlAccessibleNode * create_node(FlViewAccessible *self, FlutterSemanticsNode2 *semantics)
FlViewAccessible * fl_view_accessible_new(FlEngine *engine)
static AtkObject * fl_view_accessible_ref_child(AtkObject *accessible, gint i)
static gint fl_view_accessible_get_n_children(AtkObject *accessible)
static void fl_view_accessible_class_init(FlViewAccessibleClass *klass)
static constexpr int32_t kRootSemanticsNodeId
void fl_view_accessible_handle_update_semantics(FlViewAccessible *self, const FlutterSemanticsUpdate2 *update)
static FlAccessibleNode * lookup_node(FlViewAccessible *self, int32_t id)
const int32_t * children_in_traversal_order
Array of child node IDs in traversal order. Has length child_count.
int32_t text_selection_extent
The position at which the text selection terminates.
FlutterTextDirection text_direction
FlutterSemanticsAction actions
The set of semantics actions applicable to this node.
int32_t id
The unique identifier for this node.
FlutterRect rect
The bounding box for this node in its coordinate system.
FlutterTransformation transform
size_t child_count
The number of children this node has.
const char * label
A textual description of the node.
int32_t text_selection_base
The position at which the text selection originates.
const char * value
A textual description of the current value of the node.
FlutterSemanticsFlag flags
The set of semantics flags associated with this node.
A batch of updates to semantics nodes and custom actions.
GHashTable * semantics_nodes_by_id
gboolean root_node_created