| Flutter Linux Embedder |

Functions | Variables
fl_view_accessible.h File Reference
`#include <atk/atk.h>`
`#include "flutter/shell/platform/embedder/embedder.h"`
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"`

Go to the source code of this file.

## Functions
G_BEGIN_DECLS | G_DECLARE_FINAL_TYPE (FlViewAccessible, fl_view_accessible, FL, VIEW_ACCESSIBLE, AtkPlug) FlViewAccessible *fl_view_accessible_new(FlEngine *engine
void | fl_view_accessible_handle_update_semantics (FlViewAccessible *accessible, const FlutterSemanticsUpdate2 *update)
void | fl_view_accessible_send_announcement (FlViewAccessible *accessible, const char *message, gboolean assertive)

## Variables
G_BEGIN_DECLS FlutterViewId | view_id

## Function Documentation

## ◆ fl_view_accessible_handle_update_semantics()

void fl_view_accessible_handle_update_semantics | ( | FlViewAccessible * | accessible,
|  | const FlutterSemanticsUpdate2 * | update
| ) |  |

fl_view_accessible_handle_update_semantics: @accessible: an #FlViewAccessible. @update: semantic update information.

Handle a semantics update from Flutter.

Definition at line 157 of file fl_view_accessible.cc.

159 {
160 g_return_if_fail(FL_IS_VIEW_ACCESSIBLE(self));
161
162 g_autoptr(GHashTable) pending_children =
163 g_hash_table_new_full(g_direct_hash, g_direct_equal, nullptr,
164 reinterpret_cast<GDestroyNotify>(fl_value_unref));
165 for (size_t i = 0; i < update->node_count; i++) {
166 FlutterSemanticsNode2* node = update->nodes[i];
167 FlAccessibleNode* atk_node = get_node(self, node);
168
169 fl_accessible_node_set_flags(atk_node, node->flags2);
170 fl_accessible_node_set_actions(atk_node, node->actions);
171 fl_accessible_node_set_name(atk_node, node->label);
172 fl_accessible_node_set_extents(
173 atk_node, node->rect.left + node->transform.transX,
174 node->rect.top + node->transform.transY,
175 node->rect.right - node->rect.left, node->rect.bottom - node->rect.top);
176 fl_accessible_node_set_value(atk_node, node->value);
177 fl_accessible_node_set_text_selection(atk_node, node->text_selection_base,
178 node->text_selection_extent);
179 fl_accessible_node_set_text_direction(atk_node, node->text_direction);
180
181 FlValue* children = fl_value_new_int32_list(
182 node->children_in_traversal_order, node->child_count);
183 g_hash_table_insert(pending_children, atk_node, children);
184 }
185
186 g_hash_table_foreach_remove(
187 pending_children,
188 [](gpointer key, gpointer value, gpointer user_data) -> gboolean {
189 FlViewAccessible* self = FL_VIEW_ACCESSIBLE(user_data);
190
191 FlAccessibleNode* parent = FL_ACCESSIBLE_NODE(key);
192
193 size_t child_count = fl_value_get_length(static_cast<FlValue*>(value));
194 const int32_t* children_in_traversal_order =
195 fl_value_get_int32_list(static_cast<FlValue*>(value));
196
197 g_autoptr(GPtrArray) children = g_ptr_array_new();
198 for (size_t i = 0; i < child_count; i++) {
199 FlAccessibleNode* child =
200 lookup_node(self, children_in_traversal_order[i]);
201 if (child == nullptr) {
202 continue;
203 }
204 fl_accessible_node_set_parent(child, ATK_OBJECT(parent), i);
205 g_ptr_array_add(children, child);
206 }
207 fl_accessible_node_set_children(parent, children);
208
209 return TRUE;
210 },
211 self);
212 }
g_autoptr
g_autoptr(FlEngine) engine
user_data
const char FlTextDirection FlAssertiveness gpointer user_data
Definition: fl_accessibility_handler.cc:24
fl_accessible_node_set_name
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
Definition: fl_accessible_node.cc:607
fl_accessible_node_set_text_direction
void fl_accessible_node_set_text_direction(FlAccessibleNode *self, FlutterTextDirection direction)
Definition: fl_accessible_node.cc:653
fl_accessible_node_set_text_selection
void fl_accessible_node_set_text_selection(FlAccessibleNode *self, gint base, gint extent)
Definition: fl_accessible_node.cc:644
fl_accessible_node_set_actions
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
Definition: fl_accessible_node.cc:631
fl_accessible_node_set_children
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
Definition: fl_accessible_node.cc:580
fl_accessible_node_set_extents
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
Definition: fl_accessible_node.cc:613
fl_accessible_node_set_value
void fl_accessible_node_set_value(FlAccessibleNode *self, const gchar *value)
Definition: fl_accessible_node.cc:638
fl_accessible_node_set_parent
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent, gint index)
Definition: fl_accessible_node.cc:569
fl_accessible_node_set_flags
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlags *flags)
Definition: fl_accessible_node.cc:624
TRUE
return TRUE
Definition: fl_compositor_software.cc:68
i
int i
Definition: fl_socket_accessible.cc:18
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
fl_value_new_int32_list
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:309
fl_value_unref
G_MODULE_EXPORT void fl_value_unref(FlValue *self)
Definition: fl_value.cc:400
fl_value_get_int32_list
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:696
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
lookup_node
static FlAccessibleNode * lookup_node(FlViewAccessible *self, int32_t id)
Definition: fl_view_accessible.cc:57
get_node
static FlAccessibleNode * get_node(FlViewAccessible *self, FlutterSemanticsNode2 *semantics)
Definition: fl_view_accessible.cc:64

References fl_accessible_node_set_actions(), fl_accessible_node_set_children(), fl_accessible_node_set_extents(), fl_accessible_node_set_flags(), fl_accessible_node_set_name(), fl_accessible_node_set_parent(), fl_accessible_node_set_text_direction(), fl_accessible_node_set_text_selection(), fl_accessible_node_set_value(), fl_value_get_int32_list(), fl_value_get_length(), fl_value_new_int32_list(), fl_value_unref(), g_autoptr(), get_node(), i, lookup_node(), TRUE, user_data, and value.

Referenced by TEST(), and update_semantics_cb().

## ◆ fl_view_accessible_send_announcement()

void fl_view_accessible_send_announcement | ( | FlViewAccessible * | accessible,
|  | const char * | message,
|  | gboolean | assertive
| ) |  |

fl_view_accessible_send_announcement: @accessible: an #FlViewAccessible. @message: text to be announced. @assertive: TRUE if the message should be in an assertive voice.

Sends an annoucement to a screen reader.

Definition at line 214 of file fl_view_accessible.cc.

216 {
217 g_return_if_fail(FL_IS_VIEW_ACCESSIBLE(self));
218 if (atk_get_major_version() == 2 && atk_get_minor_version() >= 50) {
219 g_signal_emit_by_name(
220 self, "notification", message,
221 assertive ? FL_ATK_LIVE_ASSERTIVE : FL_ATK_LIVE_POLITE);
222 } else if (atk_get_major_version() == 2 && atk_get_minor_version() >= 46) {
223 g_signal_emit_by_name(self, "announcement", message);
224 }
225 }
message
const char * message
Definition: fl_accessibility_handler.cc:21
FL_ATK_LIVE_ASSERTIVE
@ FL_ATK_LIVE_ASSERTIVE
Definition: fl_view_accessible.cc:40
FL_ATK_LIVE_POLITE
@ FL_ATK_LIVE_POLITE
Definition: fl_view_accessible.cc:39

References FL_ATK_LIVE_ASSERTIVE, FL_ATK_LIVE_POLITE, and message.

## ◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE | ( | FlViewAccessible | ,
|  | fl_view_accessible | ,
|  | FL | ,
|  | VIEW_ACCESSIBLE | ,
|  | AtkPlug |
| ) |  |

FlViewAccessible:

#FlViewAccessible is an object that exposes accessibility information for an #FlView. fl_view_accessible_new: @engine: the #FlEngine. @view_id: the Flutter view id.

Creates a new accessibility object that exposes Flutter accessibility information to ATK.

Returns: a new #FlViewAccessible.

## Variable Documentation

## ◆ view_id

G_BEGIN_DECLS FlutterViewId view_id

Definition at line 49 of file fl_view_accessible.h.

Referenced by fl_accessible_node_new(), fl_accessible_text_field_new(), fl_engine_add_view(), fl_engine_dispatch_semantics_action(), fl_engine_get_renderable(), fl_engine_remove_view(), fl_engine_send_mouse_pointer_event(), fl_engine_send_pointer_pan_zoom_event(), fl_engine_send_touch_add_event(), fl_engine_send_touch_down_event(), fl_engine_send_touch_move_event(), fl_engine_send_touch_remove_event(), fl_engine_send_touch_up_event(), fl_engine_send_window_metrics_event(), fl_pointer_manager_new(), fl_scrolling_manager_new(), fl_touch_manager_new(), fl_view_accessible_new(), process_announce(), TEST(), and TEST_F().