| Flutter Linux Embedder |

fl_accessibility_plugin.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "flutter/shell/platform/linux/fl_accessibility_plugin.h"
6 #include "flutter/shell/platform/linux/fl_view_accessible.h"
7
8 struct _FlAccessibilityPlugin {
9 GObject parent_instance;
10
11 FlView* view;
12 };
13
14 G_DEFINE_TYPE(FlAccessibilityPlugin, fl_accessibility_plugin, G_TYPE_OBJECT)
15
16 static void fl_accessibility_plugin_dispose(GObject* object) {
17 FlAccessibilityPlugin* self = FL_ACCESSIBILITY_PLUGIN(object);
18
19 if (self->view != nullptr) {
20 g_object_remove_weak_pointer(G_OBJECT(self),
21 reinterpret_cast<gpointer*>(&(self->view)));
22 self->view = nullptr;
23 }
24
25 G_OBJECT_CLASS(fl_accessibility_plugin_parent_class)->dispose(object);
26 }
27
28 static void fl_accessibility_plugin_class_init(
29 FlAccessibilityPluginClass* klass) {
30 G_OBJECT_CLASS(klass)->dispose = fl_accessibility_plugin_dispose;
31 }
32
33 static void fl_accessibility_plugin_init(FlAccessibilityPlugin* self) {}
34
35 FlAccessibilityPlugin* fl_accessibility_plugin_new(FlView* view) {
36 FlAccessibilityPlugin* self = FL_ACCESSIBILITY_PLUGIN(
37 g_object_new(fl_accessibility_plugin_get_type(), nullptr));
38
39 self->view = view;
40 g_object_add_weak_pointer(G_OBJECT(self),
41 reinterpret_cast<gpointer*>(&(self->view)));
42
43 return self;
44 }
45
46 void fl_accessibility_plugin_handle_update_semantics_node(
47 FlAccessibilityPlugin* self,
48 const FlutterSemanticsNode* node) {
49 if (self->view == nullptr) {
50 return;
51 }
52
53 AtkObject* accessible = gtk_widget_get_accessible(GTK_WIDGET(self->view));
54 fl_view_accessible_handle_update_semantics_node(
55 FL_VIEW_ACCESSIBLE(accessible), node);
56 }
fl_accessibility_plugin_new
FlAccessibilityPlugin * fl_accessibility_plugin_new(FlView *view)
Definition: fl_accessibility_plugin.cc:35
fl_view_accessible.h
fl_view_accessible_handle_update_semantics_node
void fl_view_accessible_handle_update_semantics_node(FlViewAccessible *self, const FlutterSemanticsNode *node)
Definition: fl_view_accessible.cc:192
fl_accessibility_plugin_handle_update_semantics_node
void fl_accessibility_plugin_handle_update_semantics_node(FlAccessibilityPlugin *self, const FlutterSemanticsNode *node)
Definition: fl_accessibility_plugin.cc:46
_FlAccessibilityPlugin::parent_instance
GObject parent_instance
Definition: fl_accessibility_plugin.cc:9
fl_accessibility_plugin.h
_FlAccessibilityPlugin
Definition: fl_accessibility_plugin.cc:8
fl_accessibility_plugin_dispose
static void fl_accessibility_plugin_dispose(GObject *object)
Definition: fl_accessibility_plugin.cc:16
G_DEFINE_TYPE
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
Definition: fl_basic_message_channel.cc:37
g_object_add_weak_pointer
g_object_add_weak_pointer(G_OBJECT(self), reinterpret_cast< gpointer * >(&self->engine))
fl_accessibility_plugin_class_init
static void fl_accessibility_plugin_class_init(FlAccessibilityPluginClass *klass)
Definition: fl_accessibility_plugin.cc:28
_FlAccessibilityPlugin::view
FlView * view
Definition: fl_accessibility_plugin.cc:11
self
GdkEvent FlView * self
Definition: fl_view.cc:100
fl_accessibility_plugin_init
static void fl_accessibility_plugin_init(FlAccessibilityPlugin *self)
Definition: fl_accessibility_plugin.cc:33
node
G_BEGIN_DECLS const FlutterSemanticsNode * node
Definition: fl_view_accessible.h:40