Commit Graph

87 Commits

Author SHA1 Message Date
Caolán McNamara
20c41dce80 fix docs for gtk_accessible_update_relation example 2022-03-09 16:24:47 +00:00
Matthias Clasen
91f7b9663f gtk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
8ba16eb4f1 Documentation fixes
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Matthias Clasen
1a504feab9 accessible: Tweak docs 2021-03-11 16:37:36 +00:00
Matthias Clasen
6ff78c99fa accessible: Annotate properties 2021-03-11 16:37:32 +00:00
Matthias Clasen
3549914d0f accessible: Convert docs
Change link syntax.
2021-03-11 16:37:31 +00:00
Emmanuele Bassi
e8b6e6cad0 docs: Clean up the first paragraph for various symbols
The documentation engine will use the first paragraph as the summary for
a type or constant.
2021-03-11 16:37:30 +00:00
Timm Bäder
b1c8613dbe accessible: Fix memory leak if context is unset
Unref the acessible values
2021-01-17 04:39:26 +01:00
Emmanuele Bassi
8fa58c2e17 a11y: Get the accessible role once
Simplify getting the accessible role when checking if an accessible
implementation should present itself; this avoids going through
GtkAccessible twice to get the same data.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
292576f312 a11y: Defer to the GtkAccessible's implementation
Since GtkATContexts are now lazily realized, we need to go through the
GtkAccessible's implementation to access the :accessible-role property,
in case there are fallbacks.
2020-11-11 19:45:43 +00:00
Emmanuele Bassi
877a7f98ca a11y: Protect should_present() from empty contexts
If the GtkAccessible implementation returns a NULL context, we should
not be calling methods on it.
2020-11-11 18:33:15 +00:00
Emmanuele Bassi
2229d7f66c docs: Add example of relations with lists of references 2020-11-10 14:38:09 +00:00
Matthias Clasen
8df883ed71 Merge branch 'matthiasc/atspi-child' into 'master'
Emit ChildrenChanged signal on hierarchy updates

See merge request GNOME/gtk!2752
2020-10-27 18:24:43 +00:00
Matthias Clasen
374a451eeb a11y: Don't present HIDDEN accessibles
The ARIA spec is clear on this: when an element has the
HIDDEN state, it should not be presented in the accessible
tree.

This change is incomplete, we also need to emit child-added/
removed signals when the state changes, but that needs to
wait for the child added infrastructure to land.
2020-10-24 11:17:56 -04:00
Matthias Clasen
5b2b2feb9f a11y: Fix up state / change enum confusion 2020-10-24 11:17:56 -04:00
Matthias Clasen
48bb9200d9 a11y: Treat PRESENTATION like NONE
This is what ARIA tells us to do. NONE is just another
name for PRESENTATION.
2020-10-21 14:40:34 -04:00
Emmanuele Bassi
fbb08a30e2 a11y: Add child state change to GtkATContext
And the required private API in GtkAccessible to notify AT contexts of
changes in the children list.
2020-10-21 14:04:49 +01:00
Matthias Clasen
d50ebd947c a11y: Add bounds change api
Add a way for GTK to pass bounds change information
to the AT context.
2020-10-19 12:19:55 -04:00
Matthias Clasen
2370429752 accessible: Avoid realizing the context prematurely
platform change is called from gtk_widget_set_focusable
which is likely to be called early on in init(). We don't
want to create an AT context that early if we can help
it, e.g. since it makes it impossible to override the
accessible-role with a construct property.
2020-10-14 21:04:25 -04:00
Matthias Clasen
63dd0405c7 accessible: Add some docs
Explain briefly how a11y works for entry wrappers
(since I won't remember a few months from now).
2020-10-12 21:58:49 -04:00
Matthias Clasen
ade9e4b82a accessible: Add gtk_accessible_get_platform_state
As a companion to go with the platform_change api,
add a gtk_accessible_get_platform_state() function
that can be used by backends to get the platform
state.

This is in preparation for making entries inherit
their focus states from the text widget within.
2020-10-12 21:45:41 -04:00
Matthias Clasen
d9adc1b5aa accessible: Add a way to hide accessibles
Similar to gtk_widget_should_layout(), add a
gtk_accessible_should_present() function that backends can
use to determine whether an accessible should be presented
or not.

Ways to make a widget not presented in a11y:
- hide the widget
- set its role to NONE
- make it have a NULL AT context

We will use this in future to hide the GtkText inside
an entry, since the Text implementation will be done
by the wrapper.
2020-10-12 21:43:17 -04:00
Matthias Clasen
b5ee73d299 a11y: Pass on platform changes
Add an enum for 'platform changes' to the at context
change notification mechanism. This will let us pass
along things that ARIA considers 'platform state' such
as focus or editability. The difference between the
platform state and other ARIA states is that we don't
keep the platform state separately in the at context
- backends are expected to just query the widgets.

This is just about avoiding notify listeners for
change notification.
2020-10-12 15:10:40 -04:00
Emmanuele Bassi
b85b1f5b51 a11y: Turn accessible roles to string
Add a simple utility function to turn GtkAccessibleRole values into the
appropriate string, including localization.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
256c9c9873 Annotate GValue-variants methods of GtkAccessible
The variadic arguments methods cannot be used by language bindings,
which means we can let them use their names when calling the
GValue-based methods.
2020-08-25 16:36:08 +01:00
Emmanuele Bassi
fd568e63c2 Properly document GtkAccessible:accessible-role
Use a gtk-doc stanza, instead of the GParamSpec strings.
2020-08-25 16:36:08 +01:00
Emmanuele Bassi
911a71c705 a11y: Allow bulk attribute update with the GValue API
Like we do for the varargs API.
2020-08-25 16:36:08 +01:00
Emmanuele Bassi
470349c902 a11y: Add an explicit "reset to default" method
In some cases we explicitly want to unset an accessible attribute; for
instance, an accessible property is gated on a widget property, and if
the widget property gets unset, the accessible property should be reset.
2020-07-28 16:49:13 +01:00
Emmanuele Bassi
bf06cad5d9 a11y: Add proper error reporting to value collection
We're currently overloading NULL to mean both "this value is undefined,
and should be reset to its default" and "the value collection failed".
Let's do error reporting right, by using GError to mean "the collection
failed, for this specific reason"; then, we can use a NULL return value
to signal that the accessible attribute should be reset to its default
value.

This is only relevant for pointer-sized attribute values: strings,
references, and reference lists; numeric, boolean, tristate, and token
values either cannot be undefined, or have a specific "undefined" value.
2020-07-28 16:49:13 +01:00
Matthias Clasen
2ce6ac00cf docs: Expand GtkAccessible documentation
Add some hints and examples.
2020-07-26 22:39:47 -04:00
Matthias Clasen
81c8a2bb4b docs: Update a11y docs
Add some missing functions.
2020-07-26 21:23:48 -04:00
Emmanuele Bassi
82664003c0 a11y: Allow setting the role post-construction
Some widgets have different roles after they are constructed, so we need
to allow changing the role defined by the class. We should still avoid
setting a role after the GtkATContext has been created.
2020-07-26 21:27:03 +01:00
Emmanuele Bassi
03b773f45a a11y: Change default accessible role
Only GtkWidget should use GTK_ACCESSIBLE_ROLE_WIDGET as its default
accessible role; the default for GtkAccessible and GtkATContext should
be GTK_ACCESSIBLE_ROLE_NONE, meaning "an element whose implicit native
role semantics will not be mapped to the accessibility API", according
to the WAI-ARIA specification.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
1124f2507d a11y: Add relations API
Since we split relation attributes from the generic properties, we need
to add API for setting and retrieving their values.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
ae446e8f4a Remove GTK_ACCESSIBLE_STATE_NONE
It's pointless, we can use an explicit value of `-1` everywhere.
Additionally, it complicates all code that uses the state enumeration as
an array index, since now we need to guard against a negative offset.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
c56e9b2031 a11y: Add binding-friendly accessible property setter
Matching the one for the accessible state.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
da1ce01a6f Add accessible properties to GtkAccessible
We propagate the accessible state and properties to each ATContext in
the same virtual function, since they are functionally similar.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
572861be27 Allow setting the accessible role at construction
Some widgets have different accessible roles depending on some
parameter, so we cannot set the role at class init time. For those
widgets, we add an "accessible-role" property to GtkAccessible, and we
allow setting it (only) at construction time.
2020-07-26 20:31:15 +01:00
Emmanuele Bassi
566f75af82 Plug GtkATContext into GtkAccessible
An Accessible implementation must create an ATContext object. UI
elements are supposed to interact with the GtkAccessible API, but we
expose GtkATContext to allow patterns like delegation.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
14faec3ce2 Introduce GtkAccessible
GtkAccessible is an interface for accessible UI elements.

Currently, it doesn't do much except exist as a type; in the future, it
will be the entry point for all accessible state in GTK.
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Emmanuele Bassi
9ac1eacdc8 Use modern GObject macros for GtkAccessible 2020-06-05 20:32:26 +01:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Rico Tzschichholz
614079ffb0 accessible: Fix compile warnings 2016-10-23 19:09:27 +02:00
Rico Tzschichholz
5d41103750 accessible: Drop deprecated connect_widget_destroyed 2016-10-23 11:12:08 +02:00
Alberto Ruiz
496f0892fc introspection: This patch fixes nullable return values fixes for the following symbols in gtk
gtk_accel_group_query
  gtk_accel_group_from_accel_closure
  gtk_accel_label_get_accel_widget
  gtk_accessible_get_widget
  gtk_actionable_get_action_name
  gtk_app_chooser_get_app_info
  gtk_app_chooser_button_get_heading
  gtk_app_chooser_dialog_get_heading
  gtk_application_get_window_by_id
  gtk_assistant_get_nth_page
  gtk_binding_set_find
  gtk_builder_get_object
  gtk_builder_lookup_callback_symbol
  gtk_builder_get_application
  gtk_button_get_image
  gtk_cell_area_get_focus_from_sibling
  gtk_cell_renderer_start_editing
  gtk_cell_view_get_model
  gtk_cell_view_get_displayed_row
  gtk_clipboard_get_owner
  gtk_container_get_focus_child
  gtk_container_get_focus_vadjustment
  gtk_container_get_focus_hadjustment
  gtk_dialog_get_widget_for_response
  gtk_drag_get_source_widget
  gtk_drag_dest_get_target_list
  gtk_drag_source_get_target_list
  gtk_entry_completion_get_model
  gtk_entry_completion_compute_prefix
  gtk_expander_get_label_widget
  gtk_file_chooser_get_filename
  gtk_file_chooser_get_current_folder
  gtk_file_chooser_get_uri
  gtk_file_chooser_get_current_folder_uri
  gtk_file_chooser_get_preview_widget
  gtk_file_chooser_get_preview_file
  gtk_file_chooser_get_preview_filename
  gtk_file_chooser_get_preview_uri
  gtk_file_chooser_get_extra_widget
  gtk_file_chooser_get_filter
  gtk_file_chooser_native_get_accept_label
  gtk_file_chooser_native_get_cancel_label
  gtk_file_filter_get_name
  gtk_font_chooser_get_font_family
  gtk_font_chooser_get_font_face
  gtk_font_chooser_get_font
  gtk_font_chooser_get_font_desc
  gtk_font_chooser_get_font_map
  gtk_frame_get_label
  gtk_gesture_get_device
  gtk_gesture_get_window
  gtk_gl_area_get_error
  gtk_header_bar_get_title
  gtk_header_bar_get_subtitle
  gtk_header_bar_get_custom_title
  gtk_icon_info_get_filename
  gtk_icon_view_get_path_at_pos
  gtk_icon_view_get_model
  gtk_image_get_pixbuf
  gtk_image_get_animation
  gtk_label_get_mnemonic_widget
  gtk_label_get_attributes
  gtk_check_version
  gtk_menu_button_get_popup
  gtk_menu_button_get_menu_model
  gtk_menu_button_get_align_widget
  gtk_menu_button_get_popover
  gtk_menu_item_get_submenu
  gtk_menu_item_get_accel_path
  gtk_native_dialog_get_title
  gtk_native_dialog_get_transient_for
  gtk_notebook_get_nth_page
  gtk_notebook_get_tab_label_text
  gtk_notebook_get_menu_label
  gtk_notebook_get_menu_label_text
  gtk_notebook_get_group_name
  gtk_notebook_get_action_widget
  gtk_offscreen_window_get_surface
  gtk_offscreen_window_get_pixbuf
  gtk_paned_get_child1
  gtk_paned_get_child2
  gtk_places_sidebar_get_location
  gtk_places_sidebar_get_nth_bookmark
  gtk_plug_get_socket_window
  gtk_popover_get_default_widget
  gtk_progress_bar_get_text
  gtk_recent_filter_get_name
  gtk_recent_manager_lookup_item
  gtk_settings_get_default
  gtk_socket_get_plug_window
  gtk_stack_sidebar_get_stack
  gtk_stack_switcher_get_stack
  gtk_style_context_get_section
  gtk_style_context_get_parent
  gtk_style_context_get_frame_clock
  gtk_test_find_widget
  gtk_text_buffer_get_mark
  gtk_text_tag_table_lookup
  gtk_text_view_get_tabs
  gtk_text_view_toggle_cursor_visible
  gtk_text_view_get_window
  gtk_toolbar_get_nth_item
  gtk_tool_button_get_label
  gtk_tool_button_get_icon_name
  gtk_tool_button_get_label_widget
  gtk_tool_button_get_icon_widget
  gtk_tool_palette_get_drop_item
  gtk_tool_palette_get_drop_group
  gtk_tree_model_filter_convert_child_path_to_path
  gtk_tree_model_filter_convert_path_to_child_path
  gtk_tree_model_sort_convert_child_path_to_path
  gtk_tree_model_sort_convert_path_to_child_path
  gtk_tree_view_get_column
  gtk_tree_view_get_bin_window
  gtk_tree_view_column_get_widget
  gtk_tree_view_column_get_tree_view
  gtk_widget_get_frame_clock
  gtk_window_group_get_current_device_grab
  GtkTextBufferSerializeFunc
2016-01-08 12:18:23 +00:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
Matthias Clasen
245c385ae7 Docs: Don't use note elements
In most cases, the text itself makes the message clear enough.
2014-02-02 01:22:14 -05:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00