a11y: implement get_contents_at for Gtk.Text
There are users of GetStringAtOffset, such as Orca. Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
This commit is contained in:
@@ -7472,6 +7472,19 @@ gtk_text_accessible_text_get_contents (GtkAccessibleText *self,
|
||||
return g_bytes_new_take (string, size);
|
||||
}
|
||||
|
||||
static GBytes *
|
||||
gtk_text_accessible_text_get_contents_at (GtkAccessibleText *self,
|
||||
unsigned int offset,
|
||||
GtkAccessibleTextGranularity granularity,
|
||||
unsigned int *start,
|
||||
unsigned int *end)
|
||||
{
|
||||
PangoLayout *layout = gtk_text_get_layout (GTK_TEXT (self));
|
||||
char *string = gtk_pango_get_string_at (layout, offset, granularity, start, end);
|
||||
|
||||
return g_bytes_new_take (string, strlen (string));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
gtk_text_accessible_text_get_caret_position (GtkAccessibleText *self)
|
||||
{
|
||||
@@ -7531,6 +7544,7 @@ static void
|
||||
gtk_text_accessible_text_init (GtkAccessibleTextInterface *iface)
|
||||
{
|
||||
iface->get_contents = gtk_text_accessible_text_get_contents;
|
||||
iface->get_contents_at = gtk_text_accessible_text_get_contents_at;
|
||||
iface->get_caret_position = gtk_text_accessible_text_get_caret_position;
|
||||
iface->get_selection = gtk_text_accessible_text_get_selection;
|
||||
iface->get_attributes = gtk_text_accessible_text_get_attributes;
|
||||
|
||||
Reference in New Issue
Block a user