2020-07-08 15:51:57 +00:00
|
|
|
/* gtkatcontext.c: Assistive technology context
|
|
|
|
*
|
|
|
|
* Copyright 2020 GNOME Foundation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2021-02-28 00:43:26 +00:00
|
|
|
* GtkATContext:
|
2020-07-08 15:51:57 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* `GtkATContext` is an abstract class provided by GTK to communicate to
|
2020-07-08 15:51:57 +00:00
|
|
|
* platform-specific assistive technologies API.
|
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Each platform supported by GTK implements a `GtkATContext` subclass, and
|
2020-07-08 15:51:57 +00:00
|
|
|
* is responsible for updating the accessible state in response to state
|
2021-02-28 00:43:26 +00:00
|
|
|
* changes in `GtkAccessible`.
|
2020-07-08 15:51:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gtkatcontextprivate.h"
|
|
|
|
|
|
|
|
#include "gtkaccessiblevalueprivate.h"
|
2020-10-12 17:05:43 +00:00
|
|
|
#include "gtkaccessibleprivate.h"
|
2020-09-29 17:18:36 +00:00
|
|
|
#include "gtkdebug.h"
|
2022-09-23 14:11:59 +00:00
|
|
|
#include "gtkprivate.h"
|
2020-07-08 15:51:57 +00:00
|
|
|
#include "gtktestatcontextprivate.h"
|
|
|
|
#include "gtktypebuiltins.h"
|
|
|
|
|
2020-09-29 17:18:36 +00:00
|
|
|
#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
|
|
|
|
#include "a11y/gtkatspicontextprivate.h"
|
|
|
|
#endif
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
G_DEFINE_ABSTRACT_TYPE (GtkATContext, gtk_at_context, G_TYPE_OBJECT)
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_ACCESSIBLE_ROLE = 1,
|
|
|
|
PROP_ACCESSIBLE,
|
2020-09-29 17:40:44 +00:00
|
|
|
PROP_DISPLAY,
|
2020-07-08 15:51:57 +00:00
|
|
|
|
|
|
|
N_PROPS
|
|
|
|
};
|
|
|
|
|
2020-07-28 02:51:34 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
STATE_CHANGE,
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
static GParamSpec *obj_props[N_PROPS];
|
|
|
|
|
2020-07-28 02:51:34 +00:00
|
|
|
static guint obj_signals[LAST_SIGNAL];
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
static void
|
|
|
|
gtk_at_context_finalize (GObject *gobject)
|
|
|
|
{
|
|
|
|
GtkATContext *self = GTK_AT_CONTEXT (gobject);
|
|
|
|
|
2020-07-17 11:49:59 +00:00
|
|
|
gtk_accessible_attribute_set_unref (self->properties);
|
|
|
|
gtk_accessible_attribute_set_unref (self->relations);
|
|
|
|
gtk_accessible_attribute_set_unref (self->states);
|
2020-07-08 15:51:57 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_at_context_parent_class)->finalize (gobject);
|
|
|
|
}
|
|
|
|
|
2020-11-04 16:40:59 +00:00
|
|
|
static void
|
|
|
|
gtk_at_context_dispose (GObject *gobject)
|
|
|
|
{
|
|
|
|
GtkATContext *self = GTK_AT_CONTEXT (gobject);
|
|
|
|
|
|
|
|
gtk_at_context_unrealize (self);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_at_context_parent_class)->dispose (gobject);
|
|
|
|
}
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
static void
|
|
|
|
gtk_at_context_set_property (GObject *gobject,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkATContext *self = GTK_AT_CONTEXT (gobject);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_ACCESSIBLE_ROLE:
|
2020-11-04 14:35:16 +00:00
|
|
|
if (!self->realized)
|
|
|
|
self->accessible_role = g_value_get_enum (value);
|
|
|
|
else
|
|
|
|
g_critical ("The accessible role cannot be set on a realized AT context");
|
2020-07-08 15:51:57 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_ACCESSIBLE:
|
|
|
|
self->accessible = g_value_get_object (value);
|
|
|
|
break;
|
|
|
|
|
2020-09-29 17:40:44 +00:00
|
|
|
case PROP_DISPLAY:
|
2020-11-11 18:17:41 +00:00
|
|
|
gtk_at_context_set_display (self, g_value_get_object (value));
|
2020-09-29 17:40:44 +00:00
|
|
|
break;
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_at_context_get_property (GObject *gobject,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkATContext *self = GTK_AT_CONTEXT (gobject);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_ACCESSIBLE_ROLE:
|
|
|
|
g_value_set_enum (value, self->accessible_role);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_ACCESSIBLE:
|
|
|
|
g_value_set_object (value, self->accessible);
|
|
|
|
break;
|
|
|
|
|
2020-09-29 17:40:44 +00:00
|
|
|
case PROP_DISPLAY:
|
|
|
|
g_value_set_object (value, self->display);
|
|
|
|
break;
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-07-13 14:51:39 +00:00
|
|
|
gtk_at_context_real_state_change (GtkATContext *self,
|
|
|
|
GtkAccessibleStateChange changed_states,
|
2020-07-17 11:00:31 +00:00
|
|
|
GtkAccessiblePropertyChange changed_properties,
|
|
|
|
GtkAccessibleRelationChange changed_relations,
|
2020-07-17 11:49:59 +00:00
|
|
|
GtkAccessibleAttributeSet *states,
|
|
|
|
GtkAccessibleAttributeSet *properties,
|
|
|
|
GtkAccessibleAttributeSet *relations)
|
2020-07-08 15:51:57 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-19 15:19:57 +00:00
|
|
|
static void
|
|
|
|
gtk_at_context_real_platform_change (GtkATContext *self,
|
|
|
|
GtkAccessiblePlatformChange change)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-19 15:33:38 +00:00
|
|
|
static void
|
|
|
|
gtk_at_context_real_bounds_change (GtkATContext *self)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-15 13:49:14 +00:00
|
|
|
static void
|
|
|
|
gtk_at_context_real_child_change (GtkATContext *self,
|
|
|
|
GtkAccessibleChildChange change,
|
|
|
|
GtkAccessible *child)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-19 16:44:50 +00:00
|
|
|
static void
|
|
|
|
gtk_at_context_real_realize (GtkATContext *self)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_at_context_real_unrealize (GtkATContext *self)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
static void
|
|
|
|
gtk_at_context_class_init (GtkATContextClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
gobject_class->set_property = gtk_at_context_set_property;
|
|
|
|
gobject_class->get_property = gtk_at_context_get_property;
|
2020-11-04 16:40:59 +00:00
|
|
|
gobject_class->dispose = gtk_at_context_dispose;
|
2020-07-08 15:51:57 +00:00
|
|
|
gobject_class->finalize = gtk_at_context_finalize;
|
|
|
|
|
2020-10-19 16:44:50 +00:00
|
|
|
klass->realize = gtk_at_context_real_realize;
|
|
|
|
klass->unrealize = gtk_at_context_real_unrealize;
|
2020-07-08 15:51:57 +00:00
|
|
|
klass->state_change = gtk_at_context_real_state_change;
|
2020-10-19 15:19:57 +00:00
|
|
|
klass->platform_change = gtk_at_context_real_platform_change;
|
2020-10-19 15:33:38 +00:00
|
|
|
klass->bounds_change = gtk_at_context_real_bounds_change;
|
2020-10-15 13:49:14 +00:00
|
|
|
klass->child_change = gtk_at_context_real_child_change;
|
2020-07-08 15:51:57 +00:00
|
|
|
|
|
|
|
/**
|
2021-02-28 00:43:26 +00:00
|
|
|
* GtkATContext:accessible-role: (attributes org.gtk.Property.get=gtk_at_context_get_accessible_role)
|
2020-07-08 15:51:57 +00:00
|
|
|
*
|
|
|
|
* The accessible role used by the AT context.
|
|
|
|
*
|
|
|
|
* Depending on the given role, different states and properties can be
|
|
|
|
* set or retrieved.
|
|
|
|
*/
|
|
|
|
obj_props[PROP_ACCESSIBLE_ROLE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
g_param_spec_enum ("accessible-role", NULL, NULL,
|
2020-07-08 15:51:57 +00:00
|
|
|
GTK_TYPE_ACCESSIBLE_ROLE,
|
2020-07-17 16:43:01 +00:00
|
|
|
GTK_ACCESSIBLE_ROLE_NONE,
|
2020-07-08 15:51:57 +00:00
|
|
|
G_PARAM_READWRITE |
|
2020-11-04 14:35:16 +00:00
|
|
|
G_PARAM_CONSTRUCT |
|
2020-07-08 15:51:57 +00:00
|
|
|
G_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
/**
|
2021-02-28 00:43:26 +00:00
|
|
|
* GtkATContext:accessible: (attributes org.gtk.Property.get=gtk_at_context_get_accessible)
|
2020-07-08 15:51:57 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* The `GtkAccessible` that created the `GtkATContext` instance.
|
2020-07-08 15:51:57 +00:00
|
|
|
*/
|
|
|
|
obj_props[PROP_ACCESSIBLE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
g_param_spec_object ("accessible", NULL, NULL,
|
2020-07-08 15:51:57 +00:00
|
|
|
GTK_TYPE_ACCESSIBLE,
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY |
|
|
|
|
G_PARAM_STATIC_STRINGS);
|
|
|
|
|
2020-09-29 17:40:44 +00:00
|
|
|
/**
|
|
|
|
* GtkATContext:display:
|
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* The `GdkDisplay` for the `GtkATContext`.
|
2020-09-29 17:40:44 +00:00
|
|
|
*/
|
|
|
|
obj_props[PROP_DISPLAY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
g_param_spec_object ("display", NULL, NULL,
|
2020-09-29 17:40:44 +00:00
|
|
|
GDK_TYPE_DISPLAY,
|
|
|
|
G_PARAM_READWRITE |
|
2020-11-11 18:17:41 +00:00
|
|
|
G_PARAM_STATIC_STRINGS |
|
|
|
|
G_PARAM_EXPLICIT_NOTIFY);
|
2020-09-29 17:40:44 +00:00
|
|
|
|
2020-07-29 02:19:35 +00:00
|
|
|
/**
|
|
|
|
* GtkATContext::state-change:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: the `GtkATContext`
|
2020-07-29 02:19:35 +00:00
|
|
|
*
|
|
|
|
* Emitted when the attributes of the accessible for the
|
2021-02-28 00:43:26 +00:00
|
|
|
* `GtkATContext` instance change.
|
2020-07-29 02:19:35 +00:00
|
|
|
*/
|
2020-07-28 02:51:34 +00:00
|
|
|
obj_signals[STATE_CHANGE] =
|
|
|
|
g_signal_new ("state-change",
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
2020-08-25 15:34:04 +00:00
|
|
|
0,
|
2020-07-28 02:51:34 +00:00
|
|
|
NULL, NULL,
|
|
|
|
NULL,
|
2020-08-25 15:34:04 +00:00
|
|
|
G_TYPE_NONE, 0);
|
2020-07-28 02:51:34 +00:00
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
g_object_class_install_properties (gobject_class, N_PROPS, obj_props);
|
|
|
|
}
|
|
|
|
|
2020-07-17 11:49:59 +00:00
|
|
|
#define N_PROPERTIES (GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT + 1)
|
|
|
|
#define N_RELATIONS (GTK_ACCESSIBLE_RELATION_SET_SIZE + 1)
|
|
|
|
#define N_STATES (GTK_ACCESSIBLE_STATE_SELECTED + 1)
|
|
|
|
|
|
|
|
static const char *property_attrs[] = {
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE] = "autocomplete",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_DESCRIPTION] = "description",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_HAS_POPUP] = "haspopup",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_KEY_SHORTCUTS] = "keyshortcuts",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_LABEL] = "label",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_LEVEL] = "level",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_MODAL] = "modal",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_MULTI_LINE] = "multiline",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE] = "multiselectable",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_ORIENTATION] = "orientation",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER] = "placeholder",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_READ_ONLY] = "readonly",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_REQUIRED] = "required",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_ROLE_DESCRIPTION] = "roledescription",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_SORT] = "sort",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_VALUE_MAX] = "valuemax",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_VALUE_MIN] = "valuemin",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_VALUE_NOW] = "valuenow",
|
|
|
|
[GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT] = "valuetext",
|
|
|
|
};
|
|
|
|
|
2020-07-17 13:39:56 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_accessible_property_get_attribute_name:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @property: a `GtkAccessibleProperty`
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the name of a `GtkAccessibleProperty`.
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer none): the name of the accessible property
|
|
|
|
*/
|
|
|
|
const char *
|
|
|
|
gtk_accessible_property_get_attribute_name (GtkAccessibleProperty property)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (property >= GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE &&
|
|
|
|
property <= GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT,
|
|
|
|
"<none>");
|
|
|
|
|
|
|
|
return property_attrs[property];
|
|
|
|
}
|
|
|
|
|
2020-07-17 11:49:59 +00:00
|
|
|
static const char *relation_attrs[] = {
|
|
|
|
[GTK_ACCESSIBLE_RELATION_ACTIVE_DESCENDANT] = "activedescendant",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_COL_COUNT] = "colcount",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_COL_INDEX] = "colindex",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_COL_INDEX_TEXT] = "colindextext",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_COL_SPAN] = "colspan",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_CONTROLS] = "controls",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_DESCRIBED_BY] = "describedby",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_DETAILS] = "details",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE] = "errormessage",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_FLOW_TO] = "flowto",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_LABELLED_BY] = "labelledby",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_OWNS] = "owns",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_POS_IN_SET] = "posinset",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_ROW_COUNT] = "rowcount",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_ROW_INDEX] = "rowindex",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_ROW_INDEX_TEXT] = "rowindextext",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_ROW_SPAN] = "rowspan",
|
|
|
|
[GTK_ACCESSIBLE_RELATION_SET_SIZE] = "setsize",
|
|
|
|
};
|
|
|
|
|
2020-07-17 13:39:56 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_accessible_relation_get_attribute_name:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @relation: a `GtkAccessibleRelation`
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the name of a `GtkAccessibleRelation`.
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer none): the name of the accessible relation
|
|
|
|
*/
|
|
|
|
const char *
|
|
|
|
gtk_accessible_relation_get_attribute_name (GtkAccessibleRelation relation)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (relation >= GTK_ACCESSIBLE_RELATION_ACTIVE_DESCENDANT &&
|
|
|
|
relation <= GTK_ACCESSIBLE_RELATION_SET_SIZE,
|
|
|
|
"<none>");
|
|
|
|
|
|
|
|
return relation_attrs[relation];
|
|
|
|
}
|
|
|
|
|
2020-07-17 11:49:59 +00:00
|
|
|
static const char *state_attrs[] = {
|
|
|
|
[GTK_ACCESSIBLE_STATE_BUSY] = "busy",
|
|
|
|
[GTK_ACCESSIBLE_STATE_CHECKED] = "checked",
|
|
|
|
[GTK_ACCESSIBLE_STATE_DISABLED] = "disabled",
|
|
|
|
[GTK_ACCESSIBLE_STATE_EXPANDED] = "expanded",
|
|
|
|
[GTK_ACCESSIBLE_STATE_HIDDEN] = "hidden",
|
|
|
|
[GTK_ACCESSIBLE_STATE_INVALID] = "invalid",
|
|
|
|
[GTK_ACCESSIBLE_STATE_PRESSED] = "pressed",
|
|
|
|
[GTK_ACCESSIBLE_STATE_SELECTED] = "selected",
|
|
|
|
};
|
|
|
|
|
2020-07-17 13:39:56 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_accessible_state_get_attribute_name:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @state: a `GtkAccessibleState`
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the name of a `GtkAccessibleState`.
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer none): the name of the accessible state
|
|
|
|
*/
|
|
|
|
const char *
|
|
|
|
gtk_accessible_state_get_attribute_name (GtkAccessibleState state)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (state >= GTK_ACCESSIBLE_STATE_BUSY &&
|
|
|
|
state <= GTK_ACCESSIBLE_STATE_SELECTED,
|
|
|
|
"<none>");
|
|
|
|
|
|
|
|
return state_attrs[state];
|
|
|
|
}
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
static void
|
|
|
|
gtk_at_context_init (GtkATContext *self)
|
|
|
|
{
|
2020-07-17 16:43:01 +00:00
|
|
|
self->accessible_role = GTK_ACCESSIBLE_ROLE_NONE;
|
2020-07-08 15:51:57 +00:00
|
|
|
|
2020-07-17 11:49:59 +00:00
|
|
|
self->properties =
|
2020-11-11 18:17:41 +00:00
|
|
|
gtk_accessible_attribute_set_new (G_N_ELEMENTS (property_attrs),
|
2021-03-19 21:00:04 +00:00
|
|
|
(GtkAccessibleAttributeNameFunc) gtk_accessible_property_get_attribute_name,
|
2020-07-17 11:49:59 +00:00
|
|
|
(GtkAccessibleAttributeDefaultFunc) gtk_accessible_value_get_default_for_property);
|
|
|
|
self->relations =
|
2020-11-11 18:17:41 +00:00
|
|
|
gtk_accessible_attribute_set_new (G_N_ELEMENTS (relation_attrs),
|
2021-03-19 21:00:04 +00:00
|
|
|
(GtkAccessibleAttributeNameFunc) gtk_accessible_relation_get_attribute_name,
|
2020-07-17 11:49:59 +00:00
|
|
|
(GtkAccessibleAttributeDefaultFunc) gtk_accessible_value_get_default_for_relation);
|
|
|
|
self->states =
|
2020-11-11 18:17:41 +00:00
|
|
|
gtk_accessible_attribute_set_new (G_N_ELEMENTS (state_attrs),
|
2021-03-19 21:00:04 +00:00
|
|
|
(GtkAccessibleAttributeNameFunc) gtk_accessible_state_get_attribute_name,
|
2020-07-17 11:49:59 +00:00
|
|
|
(GtkAccessibleAttributeDefaultFunc) gtk_accessible_value_get_default_for_state);
|
2020-07-08 15:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-02-28 00:43:26 +00:00
|
|
|
* gtk_at_context_get_accessible: (attributes org.gtk.Method.get_property=accessible)
|
|
|
|
* @self: a `GtkATContext`
|
2020-07-08 15:51:57 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the `GtkAccessible` using this context.
|
2020-07-08 15:51:57 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Returns: (transfer none): a `GtkAccessible`
|
2020-07-08 15:51:57 +00:00
|
|
|
*/
|
|
|
|
GtkAccessible *
|
|
|
|
gtk_at_context_get_accessible (GtkATContext *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
|
|
|
|
|
|
|
|
return self->accessible;
|
|
|
|
}
|
|
|
|
|
2020-11-11 18:17:41 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_set_accessible_role:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
2020-11-11 18:17:41 +00:00
|
|
|
* @role: the accessible role for the context
|
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Sets the accessible role for the given `GtkATContext`.
|
2020-11-11 18:17:41 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* This function can only be called if the `GtkATContext` is unrealized.
|
2020-11-11 18:17:41 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_at_context_set_accessible_role (GtkATContext *self,
|
|
|
|
GtkAccessibleRole role)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_AT_CONTEXT (self));
|
|
|
|
g_return_if_fail (!self->realized);
|
|
|
|
|
|
|
|
if (self->accessible_role == role)
|
|
|
|
return;
|
|
|
|
|
|
|
|
self->accessible_role = role;
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACCESSIBLE_ROLE]);
|
|
|
|
}
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
/**
|
2021-02-28 00:43:26 +00:00
|
|
|
* gtk_at_context_get_accessible_role: (attributes org.gtk.Method.get_property=accessible-role)
|
|
|
|
* @self: a `GtkATContext`
|
2020-07-08 15:51:57 +00:00
|
|
|
*
|
|
|
|
* Retrieves the accessible role of this context.
|
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Returns: a `GtkAccessibleRole`
|
2020-07-08 15:51:57 +00:00
|
|
|
*/
|
|
|
|
GtkAccessibleRole
|
|
|
|
gtk_at_context_get_accessible_role (GtkATContext *self)
|
|
|
|
{
|
2020-07-17 16:43:01 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), GTK_ACCESSIBLE_ROLE_NONE);
|
2020-07-08 15:51:57 +00:00
|
|
|
|
|
|
|
return self->accessible_role;
|
|
|
|
}
|
|
|
|
|
2020-11-11 18:17:41 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_set_display:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @display: a `GdkDisplay`
|
2020-11-11 18:17:41 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Sets the `GdkDisplay` used by the `GtkATContext`.
|
2020-11-11 18:17:41 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* This function can only be called if the `GtkATContext` is
|
2020-11-11 18:17:41 +00:00
|
|
|
* not realized.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_at_context_set_display (GtkATContext *self,
|
|
|
|
GdkDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_AT_CONTEXT (self));
|
|
|
|
g_return_if_fail (display == NULL || GDK_IS_DISPLAY (display));
|
|
|
|
|
|
|
|
if (self->display == display)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (self->realized)
|
|
|
|
return;
|
|
|
|
|
|
|
|
self->display = display;
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_DISPLAY]);
|
|
|
|
}
|
|
|
|
|
2020-09-29 17:40:44 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_get_display:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
2020-09-29 17:40:44 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the `GdkDisplay` used to create the context.
|
2020-09-29 17:40:44 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Returns: (transfer none): a `GdkDisplay`
|
2020-09-29 17:40:44 +00:00
|
|
|
*/
|
|
|
|
GdkDisplay *
|
|
|
|
gtk_at_context_get_display (GtkATContext *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
|
|
|
|
|
|
|
|
return self->display;
|
|
|
|
}
|
|
|
|
|
2020-09-29 17:18:36 +00:00
|
|
|
static const struct {
|
|
|
|
const char *name;
|
2020-11-07 12:50:11 +00:00
|
|
|
const char *env_name;
|
2020-09-29 17:18:36 +00:00
|
|
|
GtkATContext * (* create_context) (GtkAccessibleRole accessible_role,
|
2020-09-29 17:40:44 +00:00
|
|
|
GtkAccessible *accessible,
|
|
|
|
GdkDisplay *display);
|
2020-09-29 17:18:36 +00:00
|
|
|
} a11y_backends[] = {
|
|
|
|
#if defined(GDK_WINDOWING_WAYLAND)
|
2020-11-07 12:50:11 +00:00
|
|
|
{ "AT-SPI (Wayland)", "atspi", gtk_at_spi_create_context },
|
2020-09-29 17:18:36 +00:00
|
|
|
#endif
|
|
|
|
#if defined(GDK_WINDOWING_X11)
|
2020-11-07 12:50:11 +00:00
|
|
|
{ "AT-SPI (X11)", "atspi", gtk_at_spi_create_context },
|
2020-09-29 17:18:36 +00:00
|
|
|
#endif
|
2020-11-07 12:50:11 +00:00
|
|
|
{ "Test", "test", gtk_test_at_context_new },
|
|
|
|
{ NULL, NULL, NULL },
|
2020-09-29 17:18:36 +00:00
|
|
|
};
|
|
|
|
|
2020-07-27 10:46:52 +00:00
|
|
|
/**
|
|
|
|
* gtk_at_context_create: (constructor)
|
2021-02-28 00:43:26 +00:00
|
|
|
* @accessible_role: the accessible role used by the `GtkATContext`
|
|
|
|
* @accessible: the `GtkAccessible` implementation using the `GtkATContext`
|
|
|
|
* @display: the `GdkDisplay` used by the `GtkATContext`
|
2020-07-08 15:51:57 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Creates a new `GtkATContext` instance for the given accessible role,
|
2020-09-29 17:40:44 +00:00
|
|
|
* accessible instance, and display connection.
|
2020-07-08 15:51:57 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* The `GtkATContext` implementation being instantiated will depend on the
|
2020-07-08 15:51:57 +00:00
|
|
|
* platform.
|
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Returns: (nullable) (transfer full): the `GtkATContext`
|
2020-07-08 15:51:57 +00:00
|
|
|
*/
|
|
|
|
GtkATContext *
|
|
|
|
gtk_at_context_create (GtkAccessibleRole accessible_role,
|
2020-09-29 17:40:44 +00:00
|
|
|
GtkAccessible *accessible,
|
|
|
|
GdkDisplay *display)
|
2020-07-08 15:51:57 +00:00
|
|
|
{
|
2020-11-07 12:50:11 +00:00
|
|
|
static const char *gtk_a11y_env;
|
2020-07-08 15:51:57 +00:00
|
|
|
|
2020-11-07 12:50:11 +00:00
|
|
|
if (gtk_a11y_env == NULL)
|
2020-07-08 15:51:57 +00:00
|
|
|
{
|
2020-11-07 12:50:11 +00:00
|
|
|
gtk_a11y_env = g_getenv ("GTK_A11Y");
|
|
|
|
if (gtk_a11y_env == NULL)
|
|
|
|
gtk_a11y_env = "0";
|
|
|
|
|
2021-01-05 16:15:33 +00:00
|
|
|
if (g_ascii_strcasecmp (gtk_a11y_env, "help") == 0)
|
|
|
|
{
|
|
|
|
g_print ("Supported arguments for GTK_A11Y environment variable:\n");
|
2020-07-08 15:51:57 +00:00
|
|
|
|
2020-11-07 12:50:11 +00:00
|
|
|
#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
|
2021-01-05 16:15:33 +00:00
|
|
|
g_print (" atspi - Use the AT-SPI accessibility backend\n");
|
2020-11-07 12:50:11 +00:00
|
|
|
#endif
|
2021-01-05 16:15:33 +00:00
|
|
|
g_print (" test - Use the test accessibility backend\n");
|
|
|
|
g_print (" none - Disable the accessibility backend\n");
|
|
|
|
g_print (" help - Print this help\n\n");
|
|
|
|
g_print ("Other arguments will cause a warning and be ignored.\n");
|
|
|
|
|
|
|
|
gtk_a11y_env = "0";
|
|
|
|
}
|
2020-07-08 15:51:57 +00:00
|
|
|
}
|
|
|
|
|
2021-01-05 16:15:33 +00:00
|
|
|
/* Short-circuit disabling the accessibility support */
|
|
|
|
if (g_ascii_strcasecmp (gtk_a11y_env, "none") == 0)
|
|
|
|
return NULL;
|
|
|
|
|
2020-09-29 17:18:36 +00:00
|
|
|
GtkATContext *res = NULL;
|
|
|
|
|
|
|
|
for (guint i = 0; i < G_N_ELEMENTS (a11y_backends); i++)
|
|
|
|
{
|
2020-09-29 17:40:44 +00:00
|
|
|
if (a11y_backends[i].name == NULL)
|
|
|
|
break;
|
|
|
|
|
2020-11-07 12:50:11 +00:00
|
|
|
if (a11y_backends[i].create_context != NULL &&
|
|
|
|
(*gtk_a11y_env == '0' || g_ascii_strcasecmp (a11y_backends[i].env_name, gtk_a11y_env) == 0))
|
2020-09-29 17:18:36 +00:00
|
|
|
{
|
2020-09-29 17:40:44 +00:00
|
|
|
res = a11y_backends[i].create_context (accessible_role, accessible, display);
|
|
|
|
if (res != NULL)
|
|
|
|
break;
|
2020-09-29 17:18:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-07 12:50:11 +00:00
|
|
|
if (*gtk_a11y_env != '0' && res == NULL)
|
|
|
|
g_warning ("Unrecognized accessibility backend \"%s\". Try GTK_A11Y=help", gtk_a11y_env);
|
|
|
|
|
2020-09-29 17:40:44 +00:00
|
|
|
/* Fall back to the test context, so we can get debugging data */
|
2020-09-29 17:18:36 +00:00
|
|
|
if (res == NULL)
|
2020-09-29 17:40:44 +00:00
|
|
|
res = g_object_new (GTK_TYPE_TEST_AT_CONTEXT,
|
|
|
|
"accessible_role", accessible_role,
|
|
|
|
"accessible", accessible,
|
|
|
|
"display", display,
|
|
|
|
NULL);
|
2020-09-29 17:18:36 +00:00
|
|
|
|
|
|
|
return res;
|
2020-07-08 15:51:57 +00:00
|
|
|
}
|
|
|
|
|
2020-11-10 14:19:32 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_clone: (constructor)
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: the `GtkATContext` to clone
|
2020-11-10 14:19:32 +00:00
|
|
|
* @role: the accessible role of the clone, or %GTK_ACCESSIBLE_ROLE_NONE to
|
|
|
|
* use the same accessible role of @self
|
|
|
|
* @accessible: (nullable): the accessible creating the context, or %NULL to
|
2021-05-20 13:17:04 +00:00
|
|
|
* use the same `GtkAccessible` of @self
|
2020-11-10 14:19:32 +00:00
|
|
|
* @display: (nullable): the display connection, or %NULL to use the same
|
2021-05-20 13:17:04 +00:00
|
|
|
* `GdkDisplay` of @self
|
2020-11-10 14:19:32 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Clones the state of the given `GtkATContext`, using @role, @accessible,
|
2020-11-10 14:19:32 +00:00
|
|
|
* and @display.
|
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* If @self is realized, the returned `GtkATContext` will also be realized.
|
2020-11-10 14:19:32 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Returns: (transfer full): the newly created `GtkATContext`
|
2020-11-10 14:19:32 +00:00
|
|
|
*/
|
|
|
|
GtkATContext *
|
|
|
|
gtk_at_context_clone (GtkATContext *self,
|
|
|
|
GtkAccessibleRole role,
|
|
|
|
GtkAccessible *accessible,
|
|
|
|
GdkDisplay *display)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (self == NULL || GTK_IS_AT_CONTEXT (self), NULL);
|
|
|
|
g_return_val_if_fail (accessible == NULL || GTK_IS_ACCESSIBLE (accessible), NULL);
|
|
|
|
g_return_val_if_fail (display == NULL || GDK_IS_DISPLAY (display), NULL);
|
|
|
|
|
|
|
|
if (self != NULL && role == GTK_ACCESSIBLE_ROLE_NONE)
|
|
|
|
role = self->accessible_role;
|
|
|
|
|
|
|
|
if (self != NULL && accessible == NULL)
|
|
|
|
accessible = self->accessible;
|
|
|
|
|
|
|
|
if (self != NULL && display == NULL)
|
|
|
|
display = self->display;
|
|
|
|
|
|
|
|
GtkATContext *res = gtk_at_context_create (role, accessible, display);
|
|
|
|
|
|
|
|
if (self != NULL)
|
|
|
|
{
|
|
|
|
g_clear_pointer (&res->states, gtk_accessible_attribute_set_unref);
|
|
|
|
g_clear_pointer (&res->properties, gtk_accessible_attribute_set_unref);
|
|
|
|
g_clear_pointer (&res->relations, gtk_accessible_attribute_set_unref);
|
|
|
|
|
|
|
|
res->states = gtk_accessible_attribute_set_ref (self->states);
|
|
|
|
res->properties = gtk_accessible_attribute_set_ref (self->properties);
|
|
|
|
res->relations = gtk_accessible_attribute_set_ref (self->relations);
|
|
|
|
|
|
|
|
if (self->realized)
|
|
|
|
gtk_at_context_realize (res);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2020-10-19 16:44:50 +00:00
|
|
|
gboolean
|
|
|
|
gtk_at_context_is_realized (GtkATContext *self)
|
|
|
|
{
|
|
|
|
return self->realized;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_at_context_realize (GtkATContext *self)
|
|
|
|
{
|
|
|
|
if (self->realized)
|
|
|
|
return;
|
|
|
|
|
2022-09-23 14:11:59 +00:00
|
|
|
GTK_DEBUG (A11Y, "Realizing AT context '%s'", G_OBJECT_TYPE_NAME (self));
|
2020-10-19 16:44:50 +00:00
|
|
|
GTK_AT_CONTEXT_GET_CLASS (self)->realize (self);
|
|
|
|
|
|
|
|
self->realized = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_at_context_unrealize (GtkATContext *self)
|
|
|
|
{
|
|
|
|
if (!self->realized)
|
|
|
|
return;
|
|
|
|
|
2022-09-23 14:11:59 +00:00
|
|
|
GTK_DEBUG (A11Y, "Unrealizing AT context '%s'", G_OBJECT_TYPE_NAME (self));
|
2020-10-19 16:44:50 +00:00
|
|
|
GTK_AT_CONTEXT_GET_CLASS (self)->unrealize (self);
|
|
|
|
|
|
|
|
self->realized = FALSE;
|
|
|
|
}
|
|
|
|
|
2020-07-08 15:51:57 +00:00
|
|
|
/*< private >
|
2020-07-13 14:51:39 +00:00
|
|
|
* gtk_at_context_update:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
2020-07-08 15:51:57 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Notifies the AT connected to this `GtkATContext` that the accessible
|
2020-07-13 14:51:39 +00:00
|
|
|
* state and its properties have changed.
|
2020-07-08 15:51:57 +00:00
|
|
|
*/
|
|
|
|
void
|
2020-07-13 14:51:39 +00:00
|
|
|
gtk_at_context_update (GtkATContext *self)
|
2020-07-08 15:51:57 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_AT_CONTEXT (self));
|
|
|
|
|
2020-10-19 16:44:50 +00:00
|
|
|
if (!self->realized)
|
|
|
|
return;
|
|
|
|
|
2020-08-05 17:05:46 +00:00
|
|
|
/* There's no point in notifying of state changes if there weren't any */
|
|
|
|
if (self->updated_properties == 0 &&
|
|
|
|
self->updated_relations == 0 &&
|
2020-10-19 15:19:57 +00:00
|
|
|
self->updated_states == 0)
|
2020-08-05 17:05:46 +00:00
|
|
|
return;
|
|
|
|
|
2020-08-25 15:34:04 +00:00
|
|
|
GTK_AT_CONTEXT_GET_CLASS (self)->state_change (self,
|
2021-04-23 01:05:35 +00:00
|
|
|
self->updated_states, self->updated_properties, self->updated_relations,
|
2020-08-25 15:34:04 +00:00
|
|
|
self->states, self->properties, self->relations);
|
|
|
|
g_signal_emit (self, obj_signals[STATE_CHANGE], 0);
|
2020-08-05 17:05:46 +00:00
|
|
|
|
|
|
|
self->updated_properties = 0;
|
|
|
|
self->updated_relations = 0;
|
|
|
|
self->updated_states = 0;
|
2020-07-08 15:51:57 +00:00
|
|
|
}
|
|
|
|
|
2020-07-13 14:51:39 +00:00
|
|
|
/*< private >
|
2020-07-17 13:39:56 +00:00
|
|
|
* gtk_at_context_set_accessible_state:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @state: a `GtkAccessibleState`
|
2021-05-20 13:17:04 +00:00
|
|
|
* @value: (nullable): `GtkAccessibleValue`
|
2020-07-13 14:51:39 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Sets the @value for the given @state of a `GtkATContext`.
|
2020-07-13 14:51:39 +00:00
|
|
|
*
|
|
|
|
* If @value is %NULL, the state is unset.
|
|
|
|
*
|
2020-08-05 14:05:06 +00:00
|
|
|
* This function will accumulate state changes until gtk_at_context_update()
|
2020-07-13 14:51:39 +00:00
|
|
|
* is called.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_at_context_set_accessible_state (GtkATContext *self,
|
|
|
|
GtkAccessibleState state,
|
|
|
|
GtkAccessibleValue *value)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_AT_CONTEXT (self));
|
|
|
|
|
2020-08-05 17:05:46 +00:00
|
|
|
gboolean res = FALSE;
|
|
|
|
|
2020-07-13 14:51:39 +00:00
|
|
|
if (value != NULL)
|
2020-08-05 17:05:46 +00:00
|
|
|
res = gtk_accessible_attribute_set_add (self->states, state, value);
|
2020-07-13 14:51:39 +00:00
|
|
|
else
|
2020-08-05 17:05:46 +00:00
|
|
|
res = gtk_accessible_attribute_set_remove (self->states, state);
|
|
|
|
|
|
|
|
if (res)
|
|
|
|
self->updated_states |= (1 << state);
|
2020-07-13 14:51:39 +00:00
|
|
|
}
|
|
|
|
|
2020-07-17 13:39:56 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_has_accessible_state:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @state: a `GtkAccessibleState`
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Checks whether a `GtkATContext` has the given @state set.
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
|
|
|
* Returns: %TRUE, if the accessible state is set
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gtk_at_context_has_accessible_state (GtkATContext *self,
|
|
|
|
GtkAccessibleState state)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), FALSE);
|
|
|
|
|
|
|
|
return gtk_accessible_attribute_set_contains (self->states, state);
|
|
|
|
}
|
|
|
|
|
2020-07-26 14:50:55 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_get_accessible_state:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @state: a `GtkAccessibleState`
|
2020-07-26 14:50:55 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the value for the accessible state of a `GtkATContext`.
|
2020-07-26 14:50:55 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer none): the value for the given state
|
|
|
|
*/
|
|
|
|
GtkAccessibleValue *
|
|
|
|
gtk_at_context_get_accessible_state (GtkATContext *self,
|
|
|
|
GtkAccessibleState state)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
|
|
|
|
|
|
|
|
return gtk_accessible_attribute_set_get_value (self->states, state);
|
|
|
|
}
|
|
|
|
|
2020-07-13 14:51:39 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_set_accessible_property:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @property: a `GtkAccessibleProperty`
|
|
|
|
* @value: (nullable): `GtkAccessibleValue`
|
2020-07-13 14:51:39 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Sets the @value for the given @property of a `GtkATContext`.
|
2020-07-13 14:51:39 +00:00
|
|
|
*
|
|
|
|
* If @value is %NULL, the property is unset.
|
|
|
|
*
|
2020-08-05 14:05:06 +00:00
|
|
|
* This function will accumulate property changes until gtk_at_context_update()
|
2020-07-13 14:51:39 +00:00
|
|
|
* is called.
|
|
|
|
*/
|
2020-07-08 15:51:57 +00:00
|
|
|
void
|
2020-07-13 14:51:39 +00:00
|
|
|
gtk_at_context_set_accessible_property (GtkATContext *self,
|
|
|
|
GtkAccessibleProperty property,
|
|
|
|
GtkAccessibleValue *value)
|
2020-07-08 15:51:57 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_AT_CONTEXT (self));
|
|
|
|
|
2020-08-05 17:05:46 +00:00
|
|
|
gboolean res = FALSE;
|
|
|
|
|
2020-07-13 14:51:39 +00:00
|
|
|
if (value != NULL)
|
2020-08-05 17:05:46 +00:00
|
|
|
res = gtk_accessible_attribute_set_add (self->properties, property, value);
|
2020-07-13 14:51:39 +00:00
|
|
|
else
|
2020-08-05 17:05:46 +00:00
|
|
|
res = gtk_accessible_attribute_set_remove (self->properties, property);
|
|
|
|
|
|
|
|
if (res)
|
|
|
|
self->updated_properties |= (1 << property);
|
2020-07-08 15:51:57 +00:00
|
|
|
}
|
2020-07-17 11:00:31 +00:00
|
|
|
|
2020-07-17 13:39:56 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_has_accessible_property:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @property: a `GtkAccessibleProperty`
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Checks whether a `GtkATContext` has the given @property set.
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
|
|
|
* Returns: %TRUE, if the accessible property is set
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gtk_at_context_has_accessible_property (GtkATContext *self,
|
|
|
|
GtkAccessibleProperty property)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), FALSE);
|
|
|
|
|
|
|
|
return gtk_accessible_attribute_set_contains (self->properties, property);
|
|
|
|
}
|
|
|
|
|
2020-07-26 14:50:55 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_get_accessible_property:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @property: a `GtkAccessibleProperty`
|
2020-07-26 14:50:55 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the value for the accessible property of a `GtkATContext`.
|
2020-07-26 14:50:55 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer none): the value for the given property
|
|
|
|
*/
|
|
|
|
GtkAccessibleValue *
|
|
|
|
gtk_at_context_get_accessible_property (GtkATContext *self,
|
|
|
|
GtkAccessibleProperty property)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
|
|
|
|
|
|
|
|
return gtk_accessible_attribute_set_get_value (self->properties, property);
|
|
|
|
}
|
|
|
|
|
2020-07-17 11:00:31 +00:00
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_set_accessible_relation:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @relation: a `GtkAccessibleRelation`
|
|
|
|
* @value: (nullable): `GtkAccessibleValue`
|
2020-07-17 11:00:31 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Sets the @value for the given @relation of a `GtkATContext`.
|
2020-07-17 11:00:31 +00:00
|
|
|
*
|
|
|
|
* If @value is %NULL, the relation is unset.
|
|
|
|
*
|
2020-08-05 14:05:06 +00:00
|
|
|
* This function will accumulate relation changes until gtk_at_context_update()
|
2020-07-17 11:00:31 +00:00
|
|
|
* is called.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_at_context_set_accessible_relation (GtkATContext *self,
|
|
|
|
GtkAccessibleRelation relation,
|
|
|
|
GtkAccessibleValue *value)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_AT_CONTEXT (self));
|
|
|
|
|
2020-08-05 17:05:46 +00:00
|
|
|
gboolean res = FALSE;
|
|
|
|
|
2020-07-17 11:00:31 +00:00
|
|
|
if (value != NULL)
|
2020-08-05 17:05:46 +00:00
|
|
|
res = gtk_accessible_attribute_set_add (self->relations, relation, value);
|
2020-07-17 11:00:31 +00:00
|
|
|
else
|
2020-08-05 17:05:46 +00:00
|
|
|
res = gtk_accessible_attribute_set_remove (self->relations, relation);
|
|
|
|
|
|
|
|
if (res)
|
|
|
|
self->updated_relations |= (1 << relation);
|
2020-07-17 11:00:31 +00:00
|
|
|
}
|
2020-07-17 13:39:56 +00:00
|
|
|
|
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_has_accessible_relation:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @relation: a `GtkAccessibleRelation`
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Checks whether a `GtkATContext` has the given @relation set.
|
2020-07-17 13:39:56 +00:00
|
|
|
*
|
|
|
|
* Returns: %TRUE, if the accessible relation is set
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gtk_at_context_has_accessible_relation (GtkATContext *self,
|
|
|
|
GtkAccessibleRelation relation)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), FALSE);
|
|
|
|
|
|
|
|
return gtk_accessible_attribute_set_contains (self->relations, relation);
|
|
|
|
}
|
2020-07-26 14:50:55 +00:00
|
|
|
|
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_get_accessible_relation:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
|
|
|
* @relation: a `GtkAccessibleRelation`
|
2020-07-26 14:50:55 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the value for the accessible relation of a `GtkATContext`.
|
2020-07-26 14:50:55 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer none): the value for the given relation
|
|
|
|
*/
|
|
|
|
GtkAccessibleValue *
|
|
|
|
gtk_at_context_get_accessible_relation (GtkATContext *self,
|
|
|
|
GtkAccessibleRelation relation)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
|
|
|
|
|
|
|
|
return gtk_accessible_attribute_set_get_value (self->relations, relation);
|
|
|
|
}
|
2020-10-09 20:23:19 +00:00
|
|
|
|
2020-11-11 17:50:42 +00:00
|
|
|
static gboolean
|
|
|
|
is_structural_role (GtkAccessibleRole role)
|
|
|
|
{
|
|
|
|
/* Keep the switch small while avoiding the compiler warning for
|
|
|
|
* unhandled enumeration values
|
|
|
|
*/
|
|
|
|
switch ((int) role)
|
|
|
|
{
|
|
|
|
case GTK_ACCESSIBLE_ROLE_FORM:
|
|
|
|
case GTK_ACCESSIBLE_ROLE_GROUP:
|
|
|
|
case GTK_ACCESSIBLE_ROLE_GENERIC:
|
2020-11-12 14:38:01 +00:00
|
|
|
case GTK_ACCESSIBLE_ROLE_LANDMARK:
|
|
|
|
case GTK_ACCESSIBLE_ROLE_LIST_ITEM:
|
2020-11-11 17:50:42 +00:00
|
|
|
case GTK_ACCESSIBLE_ROLE_REGION:
|
2020-11-12 14:38:01 +00:00
|
|
|
case GTK_ACCESSIBLE_ROLE_SEARCH:
|
|
|
|
case GTK_ACCESSIBLE_ROLE_SEPARATOR:
|
2020-11-11 17:50:42 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-10-16 16:03:50 +00:00
|
|
|
/* See the WAI-ARIA § 4.3, "Accessible Name and Description Computation" */
|
|
|
|
static void
|
|
|
|
gtk_at_context_get_name_accumulate (GtkATContext *self,
|
|
|
|
GPtrArray *names,
|
|
|
|
gboolean recurse)
|
2020-10-09 20:23:19 +00:00
|
|
|
{
|
|
|
|
GtkAccessibleValue *value = NULL;
|
|
|
|
|
2020-10-16 16:03:50 +00:00
|
|
|
if (gtk_accessible_attribute_set_contains (self->properties, GTK_ACCESSIBLE_PROPERTY_LABEL))
|
|
|
|
{
|
|
|
|
value = gtk_accessible_attribute_set_get_value (self->properties, GTK_ACCESSIBLE_PROPERTY_LABEL);
|
|
|
|
|
|
|
|
g_ptr_array_add (names, (char *) gtk_string_accessible_value_get (value));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (recurse && gtk_accessible_attribute_set_contains (self->relations, GTK_ACCESSIBLE_RELATION_LABELLED_BY))
|
|
|
|
{
|
|
|
|
value = gtk_accessible_attribute_set_get_value (self->relations, GTK_ACCESSIBLE_RELATION_LABELLED_BY);
|
|
|
|
|
|
|
|
GList *list = gtk_reference_list_accessible_value_get (value);
|
|
|
|
|
2020-10-21 01:27:39 +00:00
|
|
|
for (GList *l = list; l != NULL; l = l->next)
|
2020-10-16 16:03:50 +00:00
|
|
|
{
|
|
|
|
GtkAccessible *rel = GTK_ACCESSIBLE (l->data);
|
|
|
|
GtkATContext *rel_context = gtk_accessible_get_at_context (rel);
|
|
|
|
|
|
|
|
gtk_at_context_get_name_accumulate (rel_context, names, FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkAccessibleRole role = gtk_at_context_get_accessible_role (self);
|
|
|
|
|
|
|
|
switch ((int) role)
|
|
|
|
{
|
|
|
|
case GTK_ACCESSIBLE_ROLE_RANGE:
|
|
|
|
{
|
|
|
|
int range_attrs[] = {
|
|
|
|
GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT,
|
|
|
|
GTK_ACCESSIBLE_PROPERTY_VALUE_NOW,
|
|
|
|
};
|
|
|
|
|
|
|
|
value = NULL;
|
|
|
|
for (int i = 0; i < G_N_ELEMENTS (range_attrs); i++)
|
|
|
|
{
|
|
|
|
if (gtk_accessible_attribute_set_contains (self->properties, range_attrs[i]))
|
|
|
|
{
|
|
|
|
value = gtk_accessible_attribute_set_get_value (self->properties, range_attrs[i]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (value != NULL)
|
|
|
|
g_ptr_array_add (names, (char *) gtk_string_accessible_value_get (value));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If there is no label or labelled-by attribute, hidden elements
|
|
|
|
* have no name
|
|
|
|
*/
|
2020-10-09 20:23:19 +00:00
|
|
|
if (gtk_accessible_attribute_set_contains (self->states, GTK_ACCESSIBLE_STATE_HIDDEN))
|
|
|
|
{
|
|
|
|
value = gtk_accessible_attribute_set_get_value (self->states, GTK_ACCESSIBLE_STATE_HIDDEN);
|
|
|
|
|
|
|
|
if (gtk_boolean_accessible_value_get (value))
|
2020-10-16 16:03:50 +00:00
|
|
|
return;
|
2020-10-09 20:23:19 +00:00
|
|
|
}
|
|
|
|
|
2020-10-16 16:03:50 +00:00
|
|
|
/* This fallback is in place only for unlabelled elements */
|
|
|
|
if (names->len != 0)
|
|
|
|
return;
|
|
|
|
|
2020-11-11 17:50:42 +00:00
|
|
|
/* Ignore structural elements, namely: generic containers */
|
|
|
|
if (self->accessible != NULL && !is_structural_role (role))
|
2020-10-19 18:58:34 +00:00
|
|
|
g_ptr_array_add (names, (char *)G_OBJECT_TYPE_NAME (self->accessible));
|
2020-10-16 16:03:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_at_context_get_description_accumulate (GtkATContext *self,
|
|
|
|
GPtrArray *labels,
|
|
|
|
gboolean recurse)
|
|
|
|
{
|
|
|
|
GtkAccessibleValue *value = NULL;
|
|
|
|
|
|
|
|
if (gtk_accessible_attribute_set_contains (self->properties, GTK_ACCESSIBLE_PROPERTY_DESCRIPTION))
|
2020-10-09 20:23:19 +00:00
|
|
|
{
|
2020-10-16 16:03:50 +00:00
|
|
|
value = gtk_accessible_attribute_set_get_value (self->properties, GTK_ACCESSIBLE_PROPERTY_DESCRIPTION);
|
2020-10-09 20:23:19 +00:00
|
|
|
|
2020-10-16 16:03:50 +00:00
|
|
|
g_ptr_array_add (labels, (char *) gtk_string_accessible_value_get (value));
|
2020-10-09 20:23:19 +00:00
|
|
|
}
|
|
|
|
|
2020-10-16 16:03:50 +00:00
|
|
|
if (recurse && gtk_accessible_attribute_set_contains (self->relations, GTK_ACCESSIBLE_RELATION_DESCRIBED_BY))
|
2020-10-09 20:23:19 +00:00
|
|
|
{
|
2020-10-16 16:03:50 +00:00
|
|
|
value = gtk_accessible_attribute_set_get_value (self->relations, GTK_ACCESSIBLE_RELATION_DESCRIBED_BY);
|
2020-10-09 20:23:19 +00:00
|
|
|
|
2020-10-10 16:12:03 +00:00
|
|
|
GList *list = gtk_reference_list_accessible_value_get (value);
|
2020-10-09 20:23:19 +00:00
|
|
|
|
2021-09-14 12:33:30 +00:00
|
|
|
for (GList *l = list; l != NULL; l = l->next)
|
2020-10-16 16:03:50 +00:00
|
|
|
{
|
|
|
|
GtkAccessible *rel = GTK_ACCESSIBLE (l->data);
|
|
|
|
GtkATContext *rel_context = gtk_accessible_get_at_context (rel);
|
|
|
|
|
|
|
|
gtk_at_context_get_description_accumulate (rel_context, labels, FALSE);
|
|
|
|
}
|
2020-10-09 20:23:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkAccessibleRole role = gtk_at_context_get_accessible_role (self);
|
|
|
|
|
|
|
|
switch ((int) role)
|
|
|
|
{
|
|
|
|
case GTK_ACCESSIBLE_ROLE_RANGE:
|
|
|
|
{
|
|
|
|
int range_attrs[] = {
|
|
|
|
GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT,
|
|
|
|
GTK_ACCESSIBLE_PROPERTY_VALUE_NOW,
|
|
|
|
};
|
|
|
|
|
2020-10-16 16:03:50 +00:00
|
|
|
value = NULL;
|
2020-10-09 20:23:19 +00:00
|
|
|
for (int i = 0; i < G_N_ELEMENTS (range_attrs); i++)
|
|
|
|
{
|
|
|
|
if (gtk_accessible_attribute_set_contains (self->properties, range_attrs[i]))
|
|
|
|
{
|
|
|
|
value = gtk_accessible_attribute_set_get_value (self->properties, range_attrs[i]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (value != NULL)
|
2020-10-16 16:03:50 +00:00
|
|
|
g_ptr_array_add (labels, (char *) gtk_string_accessible_value_get (value));
|
2020-10-09 20:23:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-10-19 18:58:34 +00:00
|
|
|
/* If there is no description or described-by attribute, hidden elements
|
|
|
|
* have no description
|
2020-10-16 16:03:50 +00:00
|
|
|
*/
|
|
|
|
if (gtk_accessible_attribute_set_contains (self->states, GTK_ACCESSIBLE_STATE_HIDDEN))
|
|
|
|
{
|
|
|
|
value = gtk_accessible_attribute_set_get_value (self->states, GTK_ACCESSIBLE_STATE_HIDDEN);
|
|
|
|
|
|
|
|
if (gtk_boolean_accessible_value_get (value))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_get_name:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
2020-10-16 16:03:50 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the accessible name of the `GtkATContext`.
|
2020-10-16 16:03:50 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* This is a convenience function meant to be used by `GtkATContext` implementations.
|
2020-10-16 16:03:50 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Returns: (transfer full): the label of the `GtkATContext`
|
2020-10-16 16:03:50 +00:00
|
|
|
*/
|
|
|
|
char *
|
|
|
|
gtk_at_context_get_name (GtkATContext *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
|
|
|
|
|
|
|
|
GPtrArray *names = g_ptr_array_new ();
|
|
|
|
|
|
|
|
gtk_at_context_get_name_accumulate (self, names, TRUE);
|
|
|
|
|
|
|
|
if (names->len == 0)
|
|
|
|
{
|
|
|
|
g_ptr_array_unref (names);
|
|
|
|
return g_strdup ("");
|
|
|
|
}
|
|
|
|
|
|
|
|
GString *res = g_string_new ("");
|
|
|
|
g_string_append (res, g_ptr_array_index (names, 0));
|
|
|
|
|
|
|
|
for (guint i = 1; i < names->len; i++)
|
|
|
|
{
|
|
|
|
g_string_append (res, " ");
|
|
|
|
g_string_append (res, g_ptr_array_index (names, i));
|
|
|
|
}
|
|
|
|
|
|
|
|
g_ptr_array_unref (names);
|
|
|
|
|
|
|
|
return g_string_free (res, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*< private >
|
|
|
|
* gtk_at_context_get_description:
|
2021-02-28 00:43:26 +00:00
|
|
|
* @self: a `GtkATContext`
|
2020-10-16 16:03:50 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Retrieves the accessible description of the `GtkATContext`.
|
2020-10-16 16:03:50 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* This is a convenience function meant to be used by `GtkATContext` implementations.
|
2020-10-16 16:03:50 +00:00
|
|
|
*
|
2021-02-28 00:43:26 +00:00
|
|
|
* Returns: (transfer full): the label of the `GtkATContext`
|
2020-10-16 16:03:50 +00:00
|
|
|
*/
|
|
|
|
char *
|
|
|
|
gtk_at_context_get_description (GtkATContext *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_AT_CONTEXT (self), NULL);
|
|
|
|
|
|
|
|
GPtrArray *names = g_ptr_array_new ();
|
|
|
|
|
|
|
|
gtk_at_context_get_description_accumulate (self, names, TRUE);
|
|
|
|
|
|
|
|
if (names->len == 0)
|
|
|
|
{
|
|
|
|
g_ptr_array_unref (names);
|
|
|
|
return g_strdup ("");
|
|
|
|
}
|
|
|
|
|
|
|
|
GString *res = g_string_new ("");
|
|
|
|
g_string_append (res, g_ptr_array_index (names, 0));
|
|
|
|
|
|
|
|
for (guint i = 1; i < names->len; i++)
|
|
|
|
{
|
|
|
|
g_string_append (res, " ");
|
|
|
|
g_string_append (res, g_ptr_array_index (names, i));
|
|
|
|
}
|
2020-10-09 20:23:19 +00:00
|
|
|
|
2020-10-16 16:03:50 +00:00
|
|
|
g_ptr_array_unref (names);
|
2020-10-09 20:23:19 +00:00
|
|
|
|
2020-10-16 16:03:50 +00:00
|
|
|
return g_string_free (res, FALSE);
|
2020-10-09 20:23:19 +00:00
|
|
|
}
|
2020-10-12 17:05:43 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gtk_at_context_platform_changed (GtkATContext *self,
|
|
|
|
GtkAccessiblePlatformChange change)
|
|
|
|
{
|
2021-04-20 00:39:32 +00:00
|
|
|
gtk_at_context_realize (self);
|
2020-10-19 16:44:50 +00:00
|
|
|
|
2020-10-19 15:19:57 +00:00
|
|
|
GTK_AT_CONTEXT_GET_CLASS (self)->platform_change (self, change);
|
2020-10-12 17:05:43 +00:00
|
|
|
}
|
2020-10-19 15:33:38 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gtk_at_context_bounds_changed (GtkATContext *self)
|
|
|
|
{
|
2020-10-19 16:44:50 +00:00
|
|
|
if (!self->realized)
|
|
|
|
return;
|
|
|
|
|
2020-10-19 15:33:38 +00:00
|
|
|
GTK_AT_CONTEXT_GET_CLASS (self)->bounds_change (self);
|
|
|
|
}
|
2020-10-15 13:49:14 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gtk_at_context_child_changed (GtkATContext *self,
|
|
|
|
GtkAccessibleChildChange change,
|
|
|
|
GtkAccessible *child)
|
|
|
|
{
|
2020-10-19 16:44:50 +00:00
|
|
|
if (!self->realized)
|
|
|
|
return;
|
|
|
|
|
2020-10-15 13:49:14 +00:00
|
|
|
GTK_AT_CONTEXT_GET_CLASS (self)->child_change (self, change, child);
|
|
|
|
}
|