forked from AuroraMiddleware/gtk
Merge branch 'a11y/editable' into 'master'
Improve the accessible support for editables See merge request GNOME/gtk!2719
This commit is contained in:
commit
e58e6a0fbe
@ -116,6 +116,7 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
|
|||||||
|
|
||||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||||
gtk_widget_class_set_css_name (widget_class, "entry");
|
gtk_widget_class_set_css_name (widget_class, "entry");
|
||||||
|
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_TEXT_BOX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkEditable *
|
static GtkEditable *
|
||||||
|
@ -971,6 +971,7 @@ gtk_editable_get_enable_undo
|
|||||||
gtk_editable_set_enable_undo
|
gtk_editable_set_enable_undo
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
gtk_editable_install_properties
|
gtk_editable_install_properties
|
||||||
|
gtk_editable_get_delegate
|
||||||
gtk_editable_init_delegate
|
gtk_editable_init_delegate
|
||||||
gtk_editable_finish_delegate
|
gtk_editable_finish_delegate
|
||||||
gtk_editable_delegate_set_property
|
gtk_editable_delegate_set_property
|
||||||
|
@ -59,14 +59,14 @@ text_received (GObject *source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
entry_handle_method (GDBusConnection *connection,
|
editable_handle_method (GDBusConnection *connection,
|
||||||
const gchar *sender,
|
const gchar *sender,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *interface_name,
|
const gchar *interface_name,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusMethodInvocation *invocation,
|
GDBusMethodInvocation *invocation,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkATContext *self = user_data;
|
GtkATContext *self = user_data;
|
||||||
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
||||||
@ -175,8 +175,8 @@ entry_handle_method (GDBusConnection *connection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const GDBusInterfaceVTable entry_vtable = {
|
static const GDBusInterfaceVTable editable_vtable = {
|
||||||
entry_handle_method,
|
editable_handle_method,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -348,11 +348,8 @@ static const GDBusInterfaceVTable text_view_vtable = {
|
|||||||
const GDBusInterfaceVTable *
|
const GDBusInterfaceVTable *
|
||||||
gtk_atspi_get_editable_text_vtable (GtkAccessible *accessible)
|
gtk_atspi_get_editable_text_vtable (GtkAccessible *accessible)
|
||||||
{
|
{
|
||||||
if (GTK_IS_ENTRY (accessible) ||
|
if (GTK_IS_EDITABLE (accessible))
|
||||||
GTK_IS_SEARCH_ENTRY (accessible) ||
|
return &editable_vtable;
|
||||||
GTK_IS_PASSWORD_ENTRY (accessible) ||
|
|
||||||
GTK_IS_SPIN_BUTTON (accessible))
|
|
||||||
return &entry_vtable;
|
|
||||||
else if (GTK_IS_TEXT_VIEW (accessible))
|
else if (GTK_IS_TEXT_VIEW (accessible))
|
||||||
return &text_view_vtable;
|
return &text_view_vtable;
|
||||||
|
|
||||||
|
@ -412,27 +412,28 @@ static const GDBusInterfaceVTable label_vtable = {
|
|||||||
static GtkText *
|
static GtkText *
|
||||||
gtk_editable_get_text_widget (GtkWidget *widget)
|
gtk_editable_get_text_widget (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
if (GTK_IS_ENTRY (widget))
|
if (GTK_IS_EDITABLE (widget))
|
||||||
return gtk_entry_get_text_widget (GTK_ENTRY (widget));
|
{
|
||||||
else if (GTK_IS_SEARCH_ENTRY (widget))
|
GtkEditable *delegate;
|
||||||
return gtk_search_entry_get_text_widget (GTK_SEARCH_ENTRY (widget));
|
|
||||||
else if (GTK_IS_PASSWORD_ENTRY (widget))
|
delegate = gtk_editable_get_delegate (GTK_EDITABLE (widget));
|
||||||
return gtk_password_entry_get_text_widget (GTK_PASSWORD_ENTRY (widget));
|
|
||||||
else if (GTK_IS_SPIN_BUTTON (widget))
|
if (GTK_IS_TEXT (delegate))
|
||||||
return gtk_spin_button_get_text_widget (GTK_SPIN_BUTTON (widget));
|
return GTK_TEXT (delegate);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
entry_handle_method (GDBusConnection *connection,
|
editable_handle_method (GDBusConnection *connection,
|
||||||
const gchar *sender,
|
const gchar *sender,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *interface_name,
|
const gchar *interface_name,
|
||||||
const gchar *method_name,
|
const gchar *method_name,
|
||||||
GVariant *parameters,
|
GVariant *parameters,
|
||||||
GDBusMethodInvocation *invocation,
|
GDBusMethodInvocation *invocation,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkATContext *self = user_data;
|
GtkATContext *self = user_data;
|
||||||
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
||||||
@ -742,13 +743,13 @@ entry_handle_method (GDBusConnection *connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
entry_get_property (GDBusConnection *connection,
|
editable_get_property (GDBusConnection *connection,
|
||||||
const gchar *sender,
|
const gchar *sender,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *interface_name,
|
const gchar *interface_name,
|
||||||
const gchar *property_name,
|
const gchar *property_name,
|
||||||
GError **error,
|
GError **error,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkATContext *self = user_data;
|
GtkATContext *self = user_data;
|
||||||
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
||||||
@ -776,9 +777,9 @@ entry_get_property (GDBusConnection *connection,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const GDBusInterfaceVTable entry_vtable = {
|
static const GDBusInterfaceVTable editable_vtable = {
|
||||||
entry_handle_method,
|
editable_handle_method,
|
||||||
entry_get_property,
|
editable_get_property,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1169,11 +1170,9 @@ gtk_atspi_get_text_vtable (GtkAccessible *accessible)
|
|||||||
{
|
{
|
||||||
if (GTK_IS_LABEL (accessible))
|
if (GTK_IS_LABEL (accessible))
|
||||||
return &label_vtable;
|
return &label_vtable;
|
||||||
else if (GTK_IS_ENTRY (accessible) ||
|
else if (GTK_IS_EDITABLE (accessible) &&
|
||||||
GTK_IS_SEARCH_ENTRY (accessible) ||
|
GTK_IS_TEXT (gtk_editable_get_delegate (GTK_EDITABLE (accessible))))
|
||||||
GTK_IS_PASSWORD_ENTRY (accessible) ||
|
return &editable_vtable;
|
||||||
GTK_IS_SPIN_BUTTON (accessible))
|
|
||||||
return &entry_vtable;
|
|
||||||
else if (GTK_IS_TEXT_VIEW (accessible))
|
else if (GTK_IS_TEXT_VIEW (accessible))
|
||||||
return &text_view_vtable;
|
return &text_view_vtable;
|
||||||
|
|
||||||
|
@ -941,6 +941,21 @@ delegate_notify (GObject *object,
|
|||||||
g_object_notify (data, pspec->name);
|
g_object_notify (data, pspec->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_editable_get_delegate:
|
||||||
|
* @editable: a #GtkEditable
|
||||||
|
*
|
||||||
|
* Gets the #GtkEditable that @editable is delegating its
|
||||||
|
* implementation to. Typically, the delegate is a #GtkText widget.
|
||||||
|
*
|
||||||
|
* Returns: (nullable) (transfer none): the delegate #GtkEditable
|
||||||
|
*/
|
||||||
|
GtkEditable *
|
||||||
|
gtk_editable_get_delegate (GtkEditable *editable)
|
||||||
|
{
|
||||||
|
return get_delegate (editable);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_editable_init_delegate:
|
* gtk_editable_init_delegate:
|
||||||
* @editable: a #GtkEditable
|
* @editable: a #GtkEditable
|
||||||
|
@ -162,6 +162,8 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
guint gtk_editable_install_properties (GObjectClass *object_class,
|
guint gtk_editable_install_properties (GObjectClass *object_class,
|
||||||
guint first_prop);
|
guint first_prop);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GtkEditable *gtk_editable_get_delegate (GtkEditable *editable);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_editable_init_delegate (GtkEditable *editable);
|
void gtk_editable_init_delegate (GtkEditable *editable);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_editable_finish_delegate (GtkEditable *editable);
|
void gtk_editable_finish_delegate (GtkEditable *editable);
|
||||||
|
Loading…
Reference in New Issue
Block a user