This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add accessibility suport to Linux shell. #19634
Merged
robert-ancell
merged 16 commits into
flutter:master
from
robert-ancell:linux-shell-fl-accessibility-channel
Jan 13, 2021
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4741e6d
Add initial accessibility support to the Linux shell
robert-ancell ddb16cb
Merge branch 'master' into linux-shell-fl-accessibility-channel
robert-ancell 049e6e4
Merge branch 'master' into linux-shell-fl-accessibility-channel
robert-ancell a226ced
Comment grammar
robert-ancell a6646fc
Fix variable name
robert-ancell 1dc0fce
Add comments on weak pointers
robert-ancell 8734934
Clear semantics node handler in case the engine remains alive after t…
robert-ancell 4387d0f
Add FlAccessibleNode unit tests
robert-ancell ebf76ea
Merge branch 'master' into linux-shell-fl-accessibility-channel
robert-ancell 67a1498
Fix ordering in licenses list
robert-ancell 645691c
Fix getting semantics action data
robert-ancell 1a51aca
Merge branch 'master' into linux-shell-fl-accessibility-channel
robert-ancell 71dee64
Add some ATK checksto the FlAccessibleNodeTest.BuildTree test
robert-ancell 6d41a75
Merge branch 'master' into linux-shell-fl-accessibility-channel
robert-ancell 4350ff1
Add check around g_object_remove_weak_pointer
robert-ancell e3c665b
Fix assertion clearing update_semantics_node_handler
robert-ancell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include "flutter/shell/platform/linux/fl_accessibility_plugin.h" | ||
| #include "flutter/shell/platform/linux/fl_view_accessible.h" | ||
|
|
||
| struct _FlAccessibilityPlugin { | ||
| GObject parent_instance; | ||
|
|
||
| FlView* view; | ||
| }; | ||
|
|
||
| G_DEFINE_TYPE(FlAccessibilityPlugin, fl_accessibility_plugin, G_TYPE_OBJECT) | ||
|
|
||
| static void fl_accessibility_plugin_dispose(GObject* object) { | ||
| FlAccessibilityPlugin* self = FL_ACCESSIBILITY_PLUGIN(object); | ||
|
|
||
| if (self->view != nullptr) { | ||
| g_object_remove_weak_pointer(G_OBJECT(self), | ||
| reinterpret_cast<gpointer*>(&(self->view))); | ||
| self->view = nullptr; | ||
| } | ||
|
|
||
| G_OBJECT_CLASS(fl_accessibility_plugin_parent_class)->dispose(object); | ||
| } | ||
|
|
||
| static void fl_accessibility_plugin_class_init( | ||
| FlAccessibilityPluginClass* klass) { | ||
| G_OBJECT_CLASS(klass)->dispose = fl_accessibility_plugin_dispose; | ||
| } | ||
|
|
||
| static void fl_accessibility_plugin_init(FlAccessibilityPlugin* self) {} | ||
|
|
||
| FlAccessibilityPlugin* fl_accessibility_plugin_new(FlView* view) { | ||
| FlAccessibilityPlugin* self = FL_ACCESSIBILITY_PLUGIN( | ||
| g_object_new(fl_accessibility_plugin_get_type(), nullptr)); | ||
|
|
||
| self->view = view; | ||
| g_object_add_weak_pointer(G_OBJECT(self), | ||
| reinterpret_cast<gpointer*>(&(self->view))); | ||
|
|
||
| return self; | ||
| } | ||
|
|
||
| void fl_accessibility_plugin_handle_update_semantics_node( | ||
| FlAccessibilityPlugin* self, | ||
| const FlutterSemanticsNode* node) { | ||
| if (self->view == nullptr) { | ||
| return; | ||
| } | ||
|
|
||
| AtkObject* accessible = gtk_widget_get_accessible(GTK_WIDGET(self->view)); | ||
| fl_view_accessible_handle_update_semantics_node( | ||
| FL_VIEW_ACCESSIBLE(accessible), node); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBILITY_PLUGIN_H_ | ||
| #define FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBILITY_PLUGIN_H_ | ||
|
|
||
| #include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h" | ||
|
|
||
| #include "flutter/shell/platform/embedder/embedder.h" | ||
|
|
||
| G_BEGIN_DECLS | ||
|
|
||
| G_DECLARE_FINAL_TYPE(FlAccessibilityPlugin, | ||
| fl_accessibility_plugin, | ||
| FL, | ||
| ACCESSIBILITY_PLUGIN, | ||
| GObject); | ||
|
|
||
| /** | ||
| * FlAccessibilityPlugin: | ||
| * | ||
| * #FlAccessibilityPlugin is a plugin that handles semantic node updates and | ||
| * converts them to ATK events. | ||
| */ | ||
|
|
||
| /** | ||
| * fl_accessibility_plugin_new: | ||
| * @view: an #FlView to export accessibility information to. | ||
| * | ||
| * Creates a new plugin handles semantic node updates. | ||
| * | ||
| * Returns: a new #FlAccessibilityPlugin. | ||
| */ | ||
| FlAccessibilityPlugin* fl_accessibility_plugin_new(FlView* view); | ||
|
|
||
| /** | ||
| * fl_accessibility_plugin_handle_update_semantics_node: | ||
| * @plugin: an #FlAccessibilityPlugin. | ||
| * @node: semantic node information. | ||
| * | ||
| * Handle a semantics node update. | ||
| */ | ||
| void fl_accessibility_plugin_handle_update_semantics_node( | ||
| FlAccessibilityPlugin* plugin, | ||
| const FlutterSemanticsNode* node); | ||
|
|
||
| G_END_DECLS | ||
|
|
||
| #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBILITY_PLUGIN_H_ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.