Flutter Linux Embedder
fl_accessible_node.cc File Reference

Go to the source code of this file.

Classes

struct  ActionData
 
struct  FlAccessibleNodePrivate
 

Macros

#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)
 

Enumerations

enum  {
  PROP_0 ,
  PROP_ENGINE ,
  PROP_VIEW_ID ,
  PROP_ID ,
  PROP_LAST
}
 

Functions

static void fl_accessible_node_component_interface_init (AtkComponentIface *iface)
 
static void fl_accessible_node_action_interface_init (AtkActionIface *iface)
 
 G_DEFINE_TYPE_WITH_CODE (FlAccessibleNode, fl_accessible_node, ATK_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT, fl_accessible_node_component_interface_init) G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION, fl_accessible_node_action_interface_init)) static gboolean has_action(FlutterSemanticsAction actions
 
static ActionDataget_action (FlAccessibleNodePrivate *priv, gint index)
 
static gboolean has_child (GPtrArray *children, AtkObject *object)
 
static void fl_accessible_node_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 
static void fl_accessible_node_dispose (GObject *object)
 
static const gchar * fl_accessible_node_get_name (AtkObject *accessible)
 
static AtkObject * fl_accessible_node_get_parent (AtkObject *accessible)
 
static gint fl_accessible_node_get_index_in_parent (AtkObject *accessible)
 
static gint fl_accessible_node_get_n_children (AtkObject *accessible)
 
static AtkObject * fl_accessible_node_ref_child (AtkObject *accessible, gint i)
 
static AtkRole fl_accessible_node_get_role (AtkObject *accessible)
 
static AtkStateSet * fl_accessible_node_ref_state_set (AtkObject *accessible)
 
static void fl_accessible_node_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type)
 
static AtkLayer fl_accessible_node_get_layer (AtkComponent *component)
 
static gboolean fl_accessible_node_do_action (AtkAction *action, gint i)
 
static gint fl_accessible_node_get_n_actions (AtkAction *action)
 
static const gchar * fl_accessible_node_get_name (AtkAction *action, gint i)
 
static void fl_accessible_node_set_name_impl (FlAccessibleNode *self, const gchar *name)
 
static void fl_accessible_node_set_extents_impl (FlAccessibleNode *self, gint x, gint y, gint width, gint height)
 
static bool flag_changed (bool old_flag, bool new_flag)
 
static void fl_accessible_node_set_flags_impl (FlAccessibleNode *self, FlutterSemanticsFlags *flags)
 
static void fl_accessible_node_set_actions_impl (FlAccessibleNode *self, FlutterSemanticsAction actions)
 
static void fl_accessible_node_set_value_impl (FlAccessibleNode *self, const gchar *value)
 
static void fl_accessible_node_set_text_selection_impl (FlAccessibleNode *self, gint base, gint extent)
 
static void fl_accessible_node_set_text_direction_impl (FlAccessibleNode *self, FlutterTextDirection direction)
 
static void fl_accessible_node_perform_action_impl (FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
 
static void fl_accessible_node_class_init (FlAccessibleNodeClass *klass)
 
static void fl_accessible_node_init (FlAccessibleNode *self)
 
FlAccessibleNode * fl_accessible_node_new (FlEngine *engine, FlutterViewId view_id, int32_t node_id)
 
void fl_accessible_node_set_parent (FlAccessibleNode *self, AtkObject *parent, gint index)
 
void fl_accessible_node_set_children (FlAccessibleNode *self, GPtrArray *children)
 
void fl_accessible_node_set_name (FlAccessibleNode *self, const gchar *name)
 
void fl_accessible_node_set_extents (FlAccessibleNode *self, gint x, gint y, gint width, gint height)
 
void fl_accessible_node_set_flags (FlAccessibleNode *self, FlutterSemanticsFlags *flags)
 
void fl_accessible_node_set_actions (FlAccessibleNode *self, FlutterSemanticsAction actions)
 
void fl_accessible_node_set_value (FlAccessibleNode *self, const gchar *value)
 
void fl_accessible_node_set_text_selection (FlAccessibleNode *self, gint base, gint extent)
 
void fl_accessible_node_set_text_direction (FlAccessibleNode *self, FlutterTextDirection direction)
 
void fl_accessible_node_perform_action (FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
 

Variables

static ActionData action_mapping []
 
FlutterSemanticsAction action
 

Macro Definition Documentation

◆ FL_ACCESSIBLE_NODE_GET_PRIVATE

#define FL_ACCESSIBLE_NODE_GET_PRIVATE (   node)
Value:
((FlAccessibleNodePrivate*)fl_accessible_node_get_instance_private( \
FL_ACCESSIBLE_NODE(node)))

Definition at line 66 of file fl_accessible_node.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PROP_0 
PROP_ENGINE 
PROP_VIEW_ID 
PROP_ID 
PROP_LAST 

Definition at line 64 of file fl_accessible_node.cc.

Function Documentation

◆ fl_accessible_node_action_interface_init()

static void fl_accessible_node_action_interface_init ( AtkActionIface *  iface)
static

Definition at line 517 of file fl_accessible_node.cc.

517  {
518  iface->do_action = fl_accessible_node_do_action;
519  iface->get_n_actions = fl_accessible_node_get_n_actions;
520  iface->get_name = fl_accessible_node_get_name;
521 }
static gboolean fl_accessible_node_do_action(AtkAction *action, gint i)
static const gchar * fl_accessible_node_get_name(AtkObject *accessible)
static gint fl_accessible_node_get_n_actions(AtkAction *action)

References fl_accessible_node_do_action(), fl_accessible_node_get_n_actions(), and fl_accessible_node_get_name().

◆ fl_accessible_node_class_init()

static void fl_accessible_node_class_init ( FlAccessibleNodeClass *  klass)
static

Definition at line 464 of file fl_accessible_node.cc.

464  {
465  G_OBJECT_CLASS(klass)->set_property = fl_accessible_node_set_property;
466  G_OBJECT_CLASS(klass)->dispose = fl_accessible_node_dispose;
467  ATK_OBJECT_CLASS(klass)->get_name = fl_accessible_node_get_name;
468  ATK_OBJECT_CLASS(klass)->get_parent = fl_accessible_node_get_parent;
469  ATK_OBJECT_CLASS(klass)->get_index_in_parent =
471  ATK_OBJECT_CLASS(klass)->get_n_children = fl_accessible_node_get_n_children;
472  ATK_OBJECT_CLASS(klass)->ref_child = fl_accessible_node_ref_child;
473  ATK_OBJECT_CLASS(klass)->get_role = fl_accessible_node_get_role;
474  ATK_OBJECT_CLASS(klass)->ref_state_set = fl_accessible_node_ref_state_set;
475  FL_ACCESSIBLE_NODE_CLASS(klass)->set_name = fl_accessible_node_set_name_impl;
476  FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
478  FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
480  FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
482  FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
484  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
486  FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
488  FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
490 
491  g_object_class_install_property(
492  G_OBJECT_CLASS(klass), PROP_ENGINE,
493  g_param_spec_object(
494  "engine", "engine", "Flutter engine", fl_engine_get_type(),
495  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
496  G_PARAM_STATIC_STRINGS)));
497  g_object_class_install_property(
498  G_OBJECT_CLASS(klass), PROP_VIEW_ID,
499  g_param_spec_int64(
500  "view-id", "view-id", "View ID that this node belongs to", 0,
501  G_MAXINT64, 0,
502  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
503  g_object_class_install_property(
504  G_OBJECT_CLASS(klass), PROP_ID,
505  g_param_spec_int(
506  "node-id", "node-id", "Accessibility node ID", 0, G_MAXINT, 0,
507  static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
508  G_PARAM_STATIC_STRINGS)));
509 }
static void fl_accessible_node_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
static void fl_accessible_node_set_text_direction_impl(FlAccessibleNode *self, FlutterTextDirection direction)
static AtkRole fl_accessible_node_get_role(AtkObject *accessible)
static void fl_accessible_node_set_value_impl(FlAccessibleNode *self, const gchar *value)
static void fl_accessible_node_set_actions_impl(FlAccessibleNode *self, FlutterSemanticsAction actions)
static void fl_accessible_node_dispose(GObject *object)
static AtkObject * fl_accessible_node_ref_child(AtkObject *accessible, gint i)
static gint fl_accessible_node_get_index_in_parent(AtkObject *accessible)
static AtkObject * fl_accessible_node_get_parent(AtkObject *accessible)
static AtkStateSet * fl_accessible_node_ref_state_set(AtkObject *accessible)
static void fl_accessible_node_perform_action_impl(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
static void fl_accessible_node_set_text_selection_impl(FlAccessibleNode *self, gint base, gint extent)
static gint fl_accessible_node_get_n_children(AtkObject *accessible)
static void fl_accessible_node_set_extents_impl(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
static void fl_accessible_node_set_name_impl(FlAccessibleNode *self, const gchar *name)
static void fl_accessible_node_set_flags_impl(FlAccessibleNode *self, FlutterSemanticsFlags *flags)

References fl_accessible_node_dispose(), fl_accessible_node_get_index_in_parent(), fl_accessible_node_get_n_children(), fl_accessible_node_get_name(), fl_accessible_node_get_parent(), fl_accessible_node_get_role(), fl_accessible_node_perform_action_impl(), fl_accessible_node_ref_child(), fl_accessible_node_ref_state_set(), fl_accessible_node_set_actions_impl(), fl_accessible_node_set_extents_impl(), fl_accessible_node_set_flags_impl(), fl_accessible_node_set_name_impl(), fl_accessible_node_set_property(), fl_accessible_node_set_text_direction_impl(), fl_accessible_node_set_text_selection_impl(), fl_accessible_node_set_value_impl(), PROP_ENGINE, PROP_ID, and PROP_VIEW_ID.

◆ fl_accessible_node_component_interface_init()

static void fl_accessible_node_component_interface_init ( AtkComponentIface *  iface)
static

Definition at line 511 of file fl_accessible_node.cc.

512  {
513  iface->get_extents = fl_accessible_node_get_extents;
514  iface->get_layer = fl_accessible_node_get_layer;
515 }
static AtkLayer fl_accessible_node_get_layer(AtkComponent *component)
static void fl_accessible_node_get_extents(AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type)

References fl_accessible_node_get_extents(), and fl_accessible_node_get_layer().

◆ fl_accessible_node_dispose()

static void fl_accessible_node_dispose ( GObject *  object)
static

Definition at line 133 of file fl_accessible_node.cc.

133  {
135 
136  if (priv->engine != nullptr) {
137  g_object_remove_weak_pointer(object,
138  reinterpret_cast<gpointer*>(&(priv->engine)));
139  priv->engine = nullptr;
140  }
141  if (priv->parent != nullptr) {
142  g_object_remove_weak_pointer(object,
143  reinterpret_cast<gpointer*>(&(priv->parent)));
144  priv->parent = nullptr;
145  }
146  g_clear_pointer(&priv->name, g_free);
147  g_clear_pointer(&priv->actions, g_ptr_array_unref);
148  g_clear_pointer(&priv->children, g_ptr_array_unref);
149 
150  G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(object);
151 }
#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)
FlPixelBufferTexturePrivate * priv

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_do_action()

static gboolean fl_accessible_node_do_action ( AtkAction *  action,
gint  i 
)
static

Definition at line 295 of file fl_accessible_node.cc.

295  {
297 
298  if (priv->engine == nullptr) {
299  return FALSE;
300  }
301 
302  ActionData* data = get_action(priv, i);
303  if (data == nullptr) {
304  return FALSE;
305  }
306 
307  fl_accessible_node_perform_action(FL_ACCESSIBLE_NODE(action), data->action,
308  nullptr);
309  return TRUE;
310 }
void fl_accessible_node_perform_action(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
FlutterSemanticsAction action
static ActionData * get_action(FlAccessibleNodePrivate *priv, gint index)
FlutterSemanticsAction action

References ActionData::action, action, FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_accessible_node_perform_action(), get_action(), i, priv, and TRUE.

Referenced by fl_accessible_node_action_interface_init().

◆ fl_accessible_node_get_extents()

static void fl_accessible_node_get_extents ( AtkComponent *  component,
gint *  x,
gint *  y,
gint *  width,
gint *  height,
AtkCoordType  coord_type 
)
static

Definition at line 268 of file fl_accessible_node.cc.

273  {
275 
276  *x = 0;
277  *y = 0;
278  if (priv->parent != nullptr) {
279  atk_component_get_extents(ATK_COMPONENT(priv->parent), x, y, nullptr,
280  nullptr, coord_type);
281  }
282 
283  *x += priv->x;
284  *y += priv->y;
285  *width = priv->width;
286  *height = priv->height;
287 }
const uint8_t uint32_t uint32_t * height
const uint8_t uint32_t * width

References FL_ACCESSIBLE_NODE_GET_PRIVATE, height, priv, and width.

Referenced by fl_accessible_node_component_interface_init().

◆ fl_accessible_node_get_index_in_parent()

static gint fl_accessible_node_get_index_in_parent ( AtkObject *  accessible)
static

Definition at line 166 of file fl_accessible_node.cc.

166  {
168  return priv->index;
169 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_get_layer()

static AtkLayer fl_accessible_node_get_layer ( AtkComponent *  component)
static

Definition at line 290 of file fl_accessible_node.cc.

290  {
291  return ATK_LAYER_WIDGET;
292 }

Referenced by fl_accessible_node_component_interface_init().

◆ fl_accessible_node_get_n_actions()

static gint fl_accessible_node_get_n_actions ( AtkAction *  action)
static

Definition at line 313 of file fl_accessible_node.cc.

313  {
315  return priv->actions->len;
316 }

References action, FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_action_interface_init().

◆ fl_accessible_node_get_n_children()

static gint fl_accessible_node_get_n_children ( AtkObject *  accessible)
static

Definition at line 172 of file fl_accessible_node.cc.

172  {
174  return priv->children->len;
175 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_get_name() [1/2]

static const gchar* fl_accessible_node_get_name ( AtkAction *  action,
gint  i 
)
static

Definition at line 319 of file fl_accessible_node.cc.

319  {
321 
322  ActionData* data = get_action(priv, i);
323  if (data == nullptr) {
324  return nullptr;
325  }
326 
327  return data->name;
328 }
const gchar * name

References action, FL_ACCESSIBLE_NODE_GET_PRIVATE, get_action(), i, ActionData::name, and priv.

◆ fl_accessible_node_get_name() [2/2]

static const gchar* fl_accessible_node_get_name ( AtkObject *  accessible)
static

Definition at line 154 of file fl_accessible_node.cc.

154  {
156  return priv->name;
157 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_action_interface_init(), and fl_accessible_node_class_init().

◆ fl_accessible_node_get_parent()

static AtkObject* fl_accessible_node_get_parent ( AtkObject *  accessible)
static

Definition at line 160 of file fl_accessible_node.cc.

160  {
162  return priv->parent;
163 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_get_role()

static AtkRole fl_accessible_node_get_role ( AtkObject *  accessible)
static

Definition at line 189 of file fl_accessible_node.cc.

189  {
191  if (priv->flags.is_button) {
192  return ATK_ROLE_PUSH_BUTTON;
193  }
194  if (priv->flags.is_in_mutually_exclusive_group &&
195  priv->flags.is_checked != kFlutterCheckStateNone) {
196  return ATK_ROLE_RADIO_BUTTON;
197  }
198  if (priv->flags.is_checked != kFlutterCheckStateNone) {
199  return ATK_ROLE_CHECK_BOX;
200  }
201  if (priv->flags.is_toggled != kFlutterTristateNone) {
202  return ATK_ROLE_TOGGLE_BUTTON;
203  }
204  if (priv->flags.is_slider) {
205  return ATK_ROLE_SLIDER;
206  }
207  if (priv->flags.is_text_field && priv->flags.is_obscured) {
208  return ATK_ROLE_PASSWORD_TEXT;
209  }
210  if (priv->flags.is_text_field) {
211  return ATK_ROLE_TEXT;
212  }
213  if (priv->flags.is_header) {
214  return ATK_ROLE_HEADER;
215  }
216  if (priv->flags.is_link) {
217  return ATK_ROLE_LINK;
218  }
219  if (priv->flags.is_image) {
220  return ATK_ROLE_IMAGE;
221  }
222 
223  return ATK_ROLE_PANEL;
224 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_init()

static void fl_accessible_node_init ( FlAccessibleNode *  self)
static

Definition at line 523 of file fl_accessible_node.cc.

523  {
525  priv->actions = g_ptr_array_new();
526  priv->children = g_ptr_array_new_with_free_func(g_object_unref);
527 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

◆ fl_accessible_node_new()

FlAccessibleNode* fl_accessible_node_new ( FlEngine *  engine,
FlutterViewId  view_id,
int32_t  node_id 
)

fl_accessible_node_new: @engine: the #FlEngine this node came from. @view_id: the view ID this object represents. @node_id: the semantics node ID this object represents.

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

Returns: a new #FlAccessibleNode.

Definition at line 529 of file fl_accessible_node.cc.

531  {
532  FlAccessibleNode* self = FL_ACCESSIBLE_NODE(
533  g_object_new(fl_accessible_node_get_type(), "engine", engine, "view-id",
534  view_id, "node-id", node_id, nullptr));
535  return self;
536 }
G_BEGIN_DECLS FlutterViewId view_id

References view_id.

Referenced by create_node(), and TEST().

◆ fl_accessible_node_perform_action()

void fl_accessible_node_perform_action ( FlAccessibleNode *  node,
FlutterSemanticsAction  action,
GBytes *  data 
)

fl_accessible_node_dispatch_action: @node: an #FlAccessibleNode. @action: the action being dispatched. @data: (allow-none): data associated with the action.

Performs a semantic action for this node.

Definition at line 630 of file fl_accessible_node.cc.

632  {
633  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
634 
635  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->perform_action(self, action, data);
636 }

References action.

Referenced by fl_accessible_node_do_action(), fl_accessible_text_field_copy_text(), fl_accessible_text_field_cut_text(), fl_accessible_text_field_paste_text(), perform_set_selection_action(), and perform_set_text_action().

◆ fl_accessible_node_perform_action_impl()

static void fl_accessible_node_perform_action_impl ( FlAccessibleNode *  self,
FlutterSemanticsAction  action,
GBytes *  data 
)
static

Definition at line 455 of file fl_accessible_node.cc.

458  {
461  priv->node_id, action, data);
462 }
void fl_engine_dispatch_semantics_action(FlEngine *self, FlutterViewId view_id, uint64_t node_id, FlutterSemanticsAction action, GBytes *data)
Definition: fl_engine.cc:1364

References action, FL_ACCESSIBLE_NODE_GET_PRIVATE, fl_engine_dispatch_semantics_action(), and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_ref_child()

static AtkObject* fl_accessible_node_ref_child ( AtkObject *  accessible,
gint  i 
)
static

Definition at line 178 of file fl_accessible_node.cc.

178  {
180 
181  if (i < 0 || static_cast<guint>(i) >= priv->children->len) {
182  return nullptr;
183  }
184 
185  return ATK_OBJECT(g_object_ref(g_ptr_array_index(priv->children, i)));
186 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, i, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_ref_state_set()

static AtkStateSet* fl_accessible_node_ref_state_set ( AtkObject *  accessible)
static

Definition at line 227 of file fl_accessible_node.cc.

227  {
229 
230  AtkStateSet* state_set = atk_state_set_new();
231 
232  if (!priv->flags.is_obscured) {
233  atk_state_set_add_state(state_set, ATK_STATE_SHOWING);
234  }
235  if (!priv->flags.is_hidden) {
236  atk_state_set_add_state(state_set, ATK_STATE_VISIBLE);
237  }
238  if (priv->flags.is_checked != kFlutterCheckStateNone) {
239  atk_state_set_add_state(state_set, ATK_STATE_CHECKABLE);
240  }
241  if (priv->flags.is_focused != kFlutterTristateNone) {
242  atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE);
243  }
244  if (priv->flags.is_focused == kFlutterTristateTrue) {
245  atk_state_set_add_state(state_set, ATK_STATE_FOCUSED);
246  }
247  if (priv->flags.is_checked || priv->flags.is_toggled) {
248  atk_state_set_add_state(state_set, ATK_STATE_CHECKED);
249  }
250  if (priv->flags.is_selected) {
251  atk_state_set_add_state(state_set, ATK_STATE_SELECTED);
252  }
253  if (priv->flags.is_enabled == kFlutterTristateTrue) {
254  atk_state_set_add_state(state_set, ATK_STATE_ENABLED);
255  atk_state_set_add_state(state_set, ATK_STATE_SENSITIVE);
256  }
257  if (priv->flags.is_read_only) {
258  atk_state_set_add_state(state_set, ATK_STATE_READ_ONLY);
259  }
260  if (priv->flags.is_text_field) {
261  atk_state_set_add_state(state_set, ATK_STATE_EDITABLE);
262  }
263 
264  return state_set;
265 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_actions()

void fl_accessible_node_set_actions ( FlAccessibleNode *  node,
FlutterSemanticsAction  actions 
)

fl_accessible_node_set_actions: @node: an #FlAccessibleNode. @actions: the actions this node can perform.

Sets the actions that this node can perform.

Definition at line 600 of file fl_accessible_node.cc.

601  {
602  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
603 
604  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_actions(self, actions);
605 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_actions_impl()

static void fl_accessible_node_set_actions_impl ( FlAccessibleNode *  self,
FlutterSemanticsAction  actions 
)
static

Definition at line 422 of file fl_accessible_node.cc.

424  {
426 
427  // NOTE(robert-ancell): It appears that AtkAction doesn't have a method of
428  // notifying that actions have changed, and even if it did an ATK client
429  // might access the old IDs before checking for new ones. Keep an eye
430  // out for a case where Flutter changes the actions on an item and see
431  // if we can resolve this in another way.
432  g_ptr_array_remove_range(priv->actions, 0, priv->actions->len);
433  for (int i = 0; action_mapping[i].name != nullptr; i++) {
434  if (has_action(actions, action_mapping[i].action)) {
435  g_ptr_array_add(priv->actions, &action_mapping[i]);
436  }
437  }
438 }
static ActionData action_mapping[]

References action, action_mapping, FL_ACCESSIBLE_NODE_GET_PRIVATE, i, ActionData::name, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_children()

void fl_accessible_node_set_children ( FlAccessibleNode *  node,
GPtrArray *  children 
)

fl_accessible_node_set_children: @node: an #FlAccessibleNode. @children: (transfer none) (element-type AtkObject): a list of #AtkObject.

Sets the children of this node. The children can be changed at any time.

Definition at line 549 of file fl_accessible_node.cc.

550  {
551  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
553 
554  // Remove nodes that are no longer required.
555  for (guint i = 0; i < priv->children->len;) {
556  AtkObject* object = ATK_OBJECT(g_ptr_array_index(priv->children, i));
557  if (has_child(children, object)) {
558  i++;
559  } else {
560  g_signal_emit_by_name(self, "children-changed::remove", i, object,
561  nullptr);
562  g_ptr_array_remove_index(priv->children, i);
563  }
564  }
565 
566  // Add new nodes.
567  for (guint i = 0; i < children->len; i++) {
568  AtkObject* object = ATK_OBJECT(g_ptr_array_index(children, i));
569  if (!has_child(priv->children, object)) {
570  g_ptr_array_add(priv->children, g_object_ref(object));
571  g_signal_emit_by_name(self, "children-changed::add", i, object, nullptr);
572  }
573  }
574 }
static gboolean has_child(GPtrArray *children, AtkObject *object)

References FL_ACCESSIBLE_NODE_GET_PRIVATE, has_child(), i, and priv.

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_extents()

void fl_accessible_node_set_extents ( FlAccessibleNode *  node,
gint  x,
gint  y,
gint  width,
gint  height 
)

fl_accessible_node_set_extents: @node: an #FlAccessibleNode. @x: x co-ordinate of this node relative to its parent. @y: y co-ordinate of this node relative to its parent. @width: width of this node in pixels. @height: height of this node in pixels.

Sets the position and size of this node.

Definition at line 582 of file fl_accessible_node.cc.

586  {
587  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
588 
589  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_extents(self, x, y, width,
590  height);
591 }

References height, and width.

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_extents_impl()

static void fl_accessible_node_set_extents_impl ( FlAccessibleNode *  self,
gint  x,
gint  y,
gint  width,
gint  height 
)
static

Definition at line 339 of file fl_accessible_node.cc.

343  {
345  priv->x = x;
346  priv->y = y;
347  priv->width = width;
348  priv->height = height;
349 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, height, priv, and width.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_flags()

void fl_accessible_node_set_flags ( FlAccessibleNode *  node,
FlutterSemanticsFlags *  flags 
)

fl_accessible_node_set_flags: @node: an #FlAccessibleNode. @flags: the flags for this node.

Sets the flags for this node.

Definition at line 593 of file fl_accessible_node.cc.

594  {
595  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
596 
597  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_flags(self, flags);
598 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_flags_impl()

static void fl_accessible_node_set_flags_impl ( FlAccessibleNode *  self,
FlutterSemanticsFlags *  flags 
)
static

Definition at line 358 of file fl_accessible_node.cc.

359  {
361 
362  FlutterSemanticsFlags old_flags = priv->flags;
363  priv->flags = *flags;
364 
365  if (flag_changed(old_flags.is_obscured, flags->is_obscured)) {
366  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SHOWING,
367  !flags->is_obscured);
368  }
369  if (flag_changed(old_flags.is_hidden, flags->is_hidden)) {
370  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_VISIBLE,
371  !flags->is_hidden);
372  }
373  bool was_checkable = old_flags.is_checked != kFlutterCheckStateNone;
374  bool is_checkable = flags->is_checked != kFlutterCheckStateNone;
375  if (flag_changed(was_checkable, is_checkable)) {
376  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_CHECKABLE,
377  is_checkable);
378  }
379  if (flag_changed(old_flags.is_focused, flags->is_focused)) {
380  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_FOCUSABLE,
381  flags->is_focused != kFlutterTristateNone);
382  }
383  if (flag_changed(old_flags.is_focused, flags->is_focused)) {
384  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_FOCUSED,
385  flags->is_focused == kFlutterTristateTrue);
386  }
387  bool old_is_checked = old_flags.is_checked || old_flags.is_toggled;
388  bool is_checked = flags->is_checked || flags->is_toggled;
389  if (flag_changed(old_is_checked, is_checked)) {
390  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_CHECKED,
391  is_checked);
392  }
393  if (flag_changed(old_flags.is_selected, flags->is_selected)) {
394  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SELECTED,
395  flags->is_selected);
396  }
397  if (flag_changed(old_flags.is_enabled, flags->is_enabled)) {
398  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_ENABLED,
399  flags->is_enabled);
400  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_SENSITIVE,
401  flags->is_enabled);
402  }
403  if (flag_changed(old_flags.is_enabled, flags->is_enabled)) {
404  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_ENABLED,
405  flags->is_enabled);
406  }
407  if (flag_changed(old_flags.is_enabled, flags->is_enabled)) {
408  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_ENABLED,
409  flags->is_enabled);
410  }
411  if (flag_changed(old_flags.is_read_only, flags->is_read_only)) {
412  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_READ_ONLY,
413  flags->is_read_only);
414  }
415  if (flag_changed(old_flags.is_text_field, flags->is_text_field)) {
416  atk_object_notify_state_change(ATK_OBJECT(self), ATK_STATE_EDITABLE,
417  flags->is_text_field);
418  }
419 }
static bool flag_changed(bool old_flag, bool new_flag)

References FL_ACCESSIBLE_NODE_GET_PRIVATE, flag_changed(), and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_name()

void fl_accessible_node_set_name ( FlAccessibleNode *  self,
const gchar *  name 
)

Definition at line 576 of file fl_accessible_node.cc.

576  {
577  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
578 
579  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_name(self, name);
580 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_name_impl()

static void fl_accessible_node_set_name_impl ( FlAccessibleNode *  self,
const gchar *  name 
)
static

Definition at line 331 of file fl_accessible_node.cc.

332  {
334  g_free(priv->name);
335  priv->name = g_strdup(name);
336 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_parent()

void fl_accessible_node_set_parent ( FlAccessibleNode *  node,
AtkObject *  parent,
gint  index 
)

fl_accessible_node_set_parent: @node: an #FlAccessibleNode. @parent: an #AtkObject. @index: the index of this node in the parent.

Sets the parent of this node. The parent can be changed at any time.

Definition at line 538 of file fl_accessible_node.cc.

540  {
541  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
543  priv->parent = parent;
544  priv->index = index;
545  g_object_add_weak_pointer(G_OBJECT(self),
546  reinterpret_cast<gpointer*>(&(priv->parent)));
547 }

References FL_ACCESSIBLE_NODE_GET_PRIVATE, and priv.

Referenced by fl_view_accessible_handle_update_semantics(), get_node(), and TEST().

◆ fl_accessible_node_set_property()

static void fl_accessible_node_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 109 of file fl_accessible_node.cc.

112  {
114  switch (prop_id) {
115  case PROP_ENGINE:
116  g_assert(priv->engine == nullptr);
117  priv->engine = FL_ENGINE(g_value_get_object(value));
118  g_object_add_weak_pointer(object,
119  reinterpret_cast<gpointer*>(&priv->engine));
120  break;
121  case PROP_VIEW_ID:
122  priv->view_id = g_value_get_int64(value);
123  break;
124  case PROP_ID:
125  priv->node_id = g_value_get_int(value);
126  break;
127  default:
128  G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
129  break;
130  }
131 }
uint8_t value
guint prop_id
guint const GValue GParamSpec * pspec

References FL_ACCESSIBLE_NODE_GET_PRIVATE, priv, PROP_ENGINE, PROP_ID, prop_id, PROP_VIEW_ID, pspec, and value.

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_text_direction()

void fl_accessible_node_set_text_direction ( FlAccessibleNode *  node,
FlutterTextDirection  direction 
)

fl_accessible_node_set_text_direction: @node: an #FlAccessibleNode. @direction: the direction of the text.

Sets the text direction of this node.

Definition at line 622 of file fl_accessible_node.cc.

623  {
624  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
625 
626  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_direction(self,
627  direction);
628 }

Referenced by fl_view_accessible_handle_update_semantics().

◆ fl_accessible_node_set_text_direction_impl()

static void fl_accessible_node_set_text_direction_impl ( FlAccessibleNode *  self,
FlutterTextDirection  direction 
)
static

Definition at line 450 of file fl_accessible_node.cc.

452  {}

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_text_selection()

void fl_accessible_node_set_text_selection ( FlAccessibleNode *  node,
gint  base,
gint  extent 
)

fl_accessible_node_set_text_selection: @node: an #FlAccessibleNode. @base: the position at which the text selection originates. @extent: the position at which the text selection terminates.

Sets the text selection of this node.

Definition at line 613 of file fl_accessible_node.cc.

615  {
616  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
617 
618  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_text_selection(self, base,
619  extent);
620 }

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_text_selection_impl()

static void fl_accessible_node_set_text_selection_impl ( FlAccessibleNode *  self,
gint  base,
gint  extent 
)
static

Definition at line 445 of file fl_accessible_node.cc.

447  {}

Referenced by fl_accessible_node_class_init().

◆ fl_accessible_node_set_value()

void fl_accessible_node_set_value ( FlAccessibleNode *  node,
const gchar *  value 
)

fl_accessible_node_set_value: @node: an #FlAccessibleNode. @value: a node value.

Sets the value of this node.

Definition at line 607 of file fl_accessible_node.cc.

607  {
608  g_return_if_fail(FL_IS_ACCESSIBLE_NODE(self));
609 
610  return FL_ACCESSIBLE_NODE_GET_CLASS(self)->set_value(self, value);
611 }

References value.

Referenced by fl_view_accessible_handle_update_semantics(), and TEST().

◆ fl_accessible_node_set_value_impl()

static void fl_accessible_node_set_value_impl ( FlAccessibleNode *  self,
const gchar *  value 
)
static

Definition at line 441 of file fl_accessible_node.cc.

442  {}

Referenced by fl_accessible_node_class_init().

◆ flag_changed()

static bool flag_changed ( bool  old_flag,
bool  new_flag 
)
static

Definition at line 353 of file fl_accessible_node.cc.

353  {
354  return !old_flag != !new_flag;
355 }

Referenced by fl_accessible_node_set_flags_impl().

◆ G_DEFINE_TYPE_WITH_CODE()

G_DEFINE_TYPE_WITH_CODE ( FlAccessibleNode  ,
fl_accessible_node  ,
ATK_TYPE_OBJECT  ,
G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT, fl_accessible_node_component_interface_init) G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION, fl_accessible_node_action_interface_init  
)

◆ get_action()

static ActionData* get_action ( FlAccessibleNodePrivate priv,
gint  index 
)
static

Definition at line 91 of file fl_accessible_node.cc.

91  {
92  if (index < 0 || static_cast<guint>(index) >= priv->actions->len) {
93  return nullptr;
94  }
95  return static_cast<ActionData*>(g_ptr_array_index(priv->actions, index));
96 }

References priv.

Referenced by fl_accessible_node_do_action(), and fl_accessible_node_get_name().

◆ has_child()

static gboolean has_child ( GPtrArray *  children,
AtkObject *  object 
)
static

Definition at line 99 of file fl_accessible_node.cc.

99  {
100  for (guint i = 0; i < children->len; i++) {
101  if (g_ptr_array_index(children, i) == object) {
102  return TRUE;
103  }
104  }
105 
106  return FALSE;
107 }

References i, and TRUE.

Referenced by fl_accessible_node_set_children().

Variable Documentation

◆ action

◆ action_mapping

ActionData action_mapping[]
static
Initial value:
= {
{kFlutterSemanticsActionTap, "Tap"},
{kFlutterSemanticsActionLongPress, "LongPress"},
{kFlutterSemanticsActionScrollLeft, "ScrollLeft"},
{kFlutterSemanticsActionScrollRight, "ScrollRight"},
{kFlutterSemanticsActionScrollUp, "ScrollUp"},
{kFlutterSemanticsActionScrollDown, "ScrollDown"},
{kFlutterSemanticsActionIncrease, "Increase"},
{kFlutterSemanticsActionDecrease, "Decrease"},
{kFlutterSemanticsActionShowOnScreen, "ShowOnScreen"},
{kFlutterSemanticsActionMoveCursorForwardByCharacter,
"MoveCursorForwardByCharacter"},
{kFlutterSemanticsActionMoveCursorBackwardByCharacter,
"MoveCursorBackwardByCharacter"},
{kFlutterSemanticsActionCopy, "Copy"},
{kFlutterSemanticsActionCut, "Cut"},
{kFlutterSemanticsActionPaste, "Paste"},
{kFlutterSemanticsActionDidGainAccessibilityFocus,
"DidGainAccessibilityFocus"},
{kFlutterSemanticsActionDidLoseAccessibilityFocus,
"DidLoseAccessibilityFocus"},
{kFlutterSemanticsActionCustomAction, "CustomAction"},
{kFlutterSemanticsActionDismiss, "Dismiss"},
{kFlutterSemanticsActionMoveCursorForwardByWord, "MoveCursorForwardByWord"},
{kFlutterSemanticsActionMoveCursorBackwardByWord,
"MoveCursorBackwardByWord"},
{kFlutterSemanticsActionFocus, "Focus"},
{static_cast<FlutterSemanticsAction>(0), nullptr}}

Definition at line 13 of file fl_accessible_node.cc.

Referenced by fl_accessible_node_set_actions_impl().