1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
|
/*
* Copyright (C) 2002 Red Hat, Inc.
*
* This is free software; you can redistribute it and/or modify it under
* the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* VTE accessibility object. Based heavily on inspection of libzvt's
* accessibility code. */
#include "../config.h"
#include <iconv.h>
#include <atk/atk.h>
#include <gtk/gtk.h>
#include "vte.h"
#include "vteaccess.h"
#define VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA "VteTerminalAccessiblePrivateData"
typedef struct _VteTerminalAccessiblePrivate {
gboolean snapshot_invalid;
VteTerminalSnapshot *snapshot;
GArray *snapshot_cells;
GArray *snapshot_linebreaks;
gint snapshot_caret;
} VteTerminalAccessiblePrivate;
static VteTerminalAccessiblePrivate *
vte_terminal_accessible_new_private_data(void)
{
VteTerminalAccessiblePrivate *priv;
priv = g_malloc0(sizeof(*priv));
priv->snapshot = NULL;
priv->snapshot_cells = NULL;
priv->snapshot_linebreaks = NULL;
priv->snapshot_caret = 0;
priv->snapshot_invalid = TRUE;
return priv;
}
static void
vte_terminal_accessible_update_private_data_if_needed(AtkObject *text)
{
VteTerminal *terminal;
VteTerminalAccessiblePrivate *priv;
struct VteTerminalSnapshotCell cell;
int row, col, i, caret;
g_return_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text));
/* Retrieve the private data structure. */
priv = g_object_get_data(G_OBJECT(text),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
g_return_if_fail(priv != NULL);
/* If nothing's changed, just return immediately. */
if (priv->snapshot_invalid == FALSE) {
return;
}
/* Free the possibly-outdated snapshot. */
if (priv->snapshot != NULL) {
vte_terminal_free_snapshot(priv->snapshot);
priv->snapshot = NULL;
}
if (priv->snapshot_cells != NULL) {
g_array_free(priv->snapshot_cells, FALSE);
priv->snapshot_cells = NULL;
}
if (priv->snapshot_linebreaks != NULL) {
g_array_free(priv->snapshot_linebreaks, FALSE);
priv->snapshot_linebreaks = NULL;
}
priv->snapshot_caret = 0;
/* Get a new snapshot, and munge it into something that might be
* mistaken for a continuous-text display widget. */
terminal = VTE_TERMINAL((GTK_ACCESSIBLE(text))->widget);
priv->snapshot = vte_terminal_get_snapshot(terminal);
if (priv->snapshot == NULL) {
/* Aaargh! We're screwed. */
return;
}
/* Get the addresses of each of the cells, and add them to a linear
* array of characters, tracking where line breaks occur, and setting
* the caret to point at the location where the cursor is. */
priv->snapshot_cells = g_array_new(FALSE, TRUE, sizeof(cell));
priv->snapshot_linebreaks = g_array_new(FALSE, TRUE, sizeof(int));
caret = -1;
for (row = 0; priv->snapshot->contents[row] != NULL; row++) {
for (col = 0;
priv->snapshot->contents[row][col].c != 0;
col++) {
if ((row == priv->snapshot->cursor.y) &&
(col == priv->snapshot->cursor.x)) {
caret = priv->snapshot_cells->len;
}
cell = priv->snapshot->contents[row][col];
g_array_append_val(priv->snapshot_cells, cell);
}
if ((row == priv->snapshot->cursor.y) && (caret == -1)) {
caret = priv->snapshot_cells->len;
}
i = row;
g_array_append_val(priv->snapshot_linebreaks, i);
}
if (caret == -1) {
caret = priv->snapshot_cells->len;
}
priv->snapshot_caret = caret;
}
static void
vte_terminal_accessible_free_private_data(VteTerminalAccessiblePrivate *priv)
{
g_return_if_fail(priv != NULL);
if (priv->snapshot != NULL) {
vte_terminal_free_snapshot(priv->snapshot);
priv->snapshot = NULL;
}
if (priv->snapshot_cells != NULL) {
g_array_free(priv->snapshot_cells, FALSE);
priv->snapshot_cells = NULL;
}
if (priv->snapshot_linebreaks != NULL) {
g_array_free(priv->snapshot_linebreaks, FALSE);
priv->snapshot_linebreaks = NULL;
}
g_free(priv);
}
/* A signal handler to catch "contents_changed" and "cursor_moved" signals. */
static void
vte_terminal_accessible_invalidate(VteTerminal *terminal, gpointer data)
{
VteTerminalAccessiblePrivate *priv;
g_return_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(data));
g_return_if_fail(G_IS_OBJECT(data));
priv = g_object_get_data(G_OBJECT(data),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
g_return_if_fail(priv != NULL);
priv->snapshot_invalid = TRUE;
}
AtkObject *
vte_terminal_accessible_new(VteTerminal *terminal)
{
GtkAccessible *access;
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
access = GTK_ACCESSIBLE(g_object_new(VTE_TYPE_TERMINAL_ACCESSIBLE,
NULL));
atk_object_initialize(ATK_OBJECT(access), G_OBJECT(terminal));
access->widget = GTK_WIDGET(terminal);
g_object_set_data(G_OBJECT(access),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA,
vte_terminal_accessible_new_private_data());
g_signal_connect(G_OBJECT(terminal), "contents_changed",
GTK_SIGNAL_FUNC(vte_terminal_accessible_invalidate),
access);
g_signal_connect(G_OBJECT(terminal), "cursor_moved",
GTK_SIGNAL_FUNC(vte_terminal_accessible_invalidate),
access);
return ATK_OBJECT(access);
}
static gchar *
vte_terminal_accessible_get_text(AtkText *text,
gint start_offset, gint end_offset)
{
VteTerminalAccessiblePrivate *priv;
gchar *buf, *p;
int i;
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
priv = g_object_get_data(G_OBJECT(text),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), NULL);
/* If the requested area is after all of the text, just return an
* empty string. */
if (start_offset >= priv->snapshot_cells->len) {
return g_strdup("");
}
/* Allocate space to hold as many UTF-8 characters as we have
* unicode characters. */
p = buf = g_malloc((end_offset - start_offset) * VTE_UTF8_BPC + 1);
for (i = start_offset; i < end_offset; i++) {
p += g_unichar_to_utf8(g_array_index(priv->snapshot_cells,
struct VteTerminalSnapshotCell,
i).c,
p);
}
*p = '\0';
return buf;
}
static gchar *
vte_terminal_accessible_get_text_somewhere(AtkText *text,
gint offset,
AtkTextBoundary boundary_type,
gint direction,
gint *start_offset,
gint *end_offset)
{
VteTerminalAccessiblePrivate *priv;
gunichar c;
gboolean word, in_word;
int i, line;
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
priv = g_object_get_data(G_OBJECT(text),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
switch (boundary_type) {
case ATK_TEXT_BOUNDARY_CHAR:
/* We're either looking at the character at this
* position, the one before it, or the one after it. */
offset += direction;
*start_offset = MAX(offset, 0);
*end_offset = MIN(offset + 1,
priv->snapshot_cells->len);
break;
case ATK_TEXT_BOUNDARY_WORD_START:
case ATK_TEXT_BOUNDARY_WORD_END:
/* Find the wordstart before the requested point. */
c = g_array_index(priv->snapshot_cells,
struct VteTerminalSnapshotCell,
offset).c;
word = in_word = !g_unichar_isspace(c);
*start_offset = offset;
for (i = offset; i >= 0; i--) {
c = g_array_index(priv->snapshot_cells,
struct VteTerminalSnapshotCell,
i).c;
if (word && g_unichar_isspace(c)) {
*start_offset = i + 1;
break;
}
if (i == 0) {
*start_offset = 0;
break;
}
word = g_unichar_isspace(c);
}
/* If we started in a word and we're looking for the
* word before this one, keep searching. */
if (in_word && (direction == -1)) {
word = !g_unichar_isspace(c);
for (i = *start_offset; i >= 0; i--) {
c = g_array_index(priv->snapshot_cells,
struct VteTerminalSnapshotCell,
i).c;
if (word && g_unichar_isspace(c)) {
*start_offset = i + 1;
break;
}
if (i == 0) {
*start_offset = 0;
break;
}
}
}
/* If we're looking for the word after this one,
* search forward. */
if (direction == 1) {
word = g_unichar_isspace(c);
for (i = *start_offset; i < priv->snapshot_cells->len; i--) {
c = g_array_index(priv->snapshot_cells,
struct VteTerminalSnapshotCell,
i).c;
if (!word && !g_unichar_isspace(c)) {
*start_offset = i;
break;
}
if (i == priv->snapshot_cells->len - 1) {
*start_offset = i + 1;
break;
}
}
}
/* Now find the end of this word. */
word = TRUE;
*end_offset = *start_offset;
for (i = *start_offset; i < priv->snapshot_cells->len; i--) {
c = g_array_index(priv->snapshot_cells,
struct VteTerminalSnapshotCell,
i).c;
if (!word && !g_unichar_isspace(c)) {
*end_offset = i;
break;
}
if (i == priv->snapshot_cells->len - 1) {
*end_offset = i + 1;
break;
}
}
break;
case ATK_TEXT_BOUNDARY_LINE_START:
case ATK_TEXT_BOUNDARY_LINE_END:
/* Figure out which line we're on. If the end of the
* i'th line is after the offset, then i is the line
* we're looking at. */
line = 0;
for (i = 0; i < priv->snapshot_cells->len; i++) {
if (g_array_index(priv->snapshot_linebreaks,
int, i) > offset) {
line = i;
break;
}
}
/* Perturb the line number to handle before/at/after. */
line += direction;
line = MAX(0, line);
line = MIN(line, priv->snapshot_linebreaks->len - 1);
/* Read the offsets for this line. */
if (line == 0) {
*start_offset = 0;
} else {
*start_offset = g_array_index(priv->snapshot_linebreaks,
int,
line - 1);
}
*end_offset = g_array_index(priv->snapshot_linebreaks,
int,
line);
break;
case ATK_TEXT_BOUNDARY_SENTENCE_START:
case ATK_TEXT_BOUNDARY_SENTENCE_END:
/* This doesn't make sense. Fall through. */
default:
*start_offset = *end_offset = 0;
break;
}
return vte_terminal_accessible_get_text(text,
*start_offset,
*end_offset);
}
static gchar *
vte_terminal_accessible_get_text_before_offset(AtkText *text, gint offset,
AtkTextBoundary boundary_type,
gint *start_offset,
gint *end_offset)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), NULL);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
return vte_terminal_accessible_get_text_somewhere(text,
offset,
boundary_type,
-1,
start_offset,
end_offset);
}
static gchar *
vte_terminal_accessible_get_text_after_offset(AtkText *text, gint offset,
AtkTextBoundary boundary_type,
gint *start_offset,
gint *end_offset)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), NULL);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
return vte_terminal_accessible_get_text_somewhere(text,
offset,
boundary_type,
1,
start_offset,
end_offset);
}
static gchar *
vte_terminal_accessible_get_text_at_offset(AtkText *text, gint offset,
AtkTextBoundary boundary_type,
gint *start_offset,
gint *end_offset)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), NULL);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
return vte_terminal_accessible_get_text_somewhere(text,
offset,
boundary_type,
0,
start_offset,
end_offset);
}
static gunichar
vte_terminal_accessible_get_character_at_offset(AtkText *text, gint offset)
{
VteTerminalAccessiblePrivate *priv;
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
priv = g_object_get_data(G_OBJECT(text),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
return g_array_index(priv->snapshot_cells,
struct VteTerminalSnapshotCell,
offset).c;
}
static gint
vte_terminal_accessible_get_caret_offset(AtkText *text)
{
VteTerminalAccessiblePrivate *priv;
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
priv = g_object_get_data(G_OBJECT(text),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
return priv->snapshot_caret;
}
static AtkAttributeSet *
vte_terminal_accessible_get_run_attributes(AtkText *text, gint offset,
gint *start_offset, gint *end_offset)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), NULL);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* FIXME */
return NULL;
}
static AtkAttributeSet *
vte_terminal_accessible_get_default_attributes(AtkText *text)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), NULL);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* FIXME */
return NULL;
}
static void
vte_terminal_accessible_get_character_extents(AtkText *text, gint offset,
gint *x, gint *y,
gint *width, gint *height,
AtkCoordType coords)
{
g_return_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text));
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* FIXME */
}
static gint
vte_terminal_accessible_get_character_count(AtkText *text)
{
VteTerminalAccessiblePrivate *priv;
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
priv = g_object_get_data(G_OBJECT(text),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
return priv->snapshot_cells->len;
}
static gint
vte_terminal_accessible_get_offset_at_point(AtkText *text,
gint x, gint y,
AtkCoordType coords)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), 0);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* FIXME */
return 0;
}
static gint
vte_terminal_accessible_get_n_selections(AtkText *text)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), 0);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* FIXME? */
return 0;
}
static gchar *
vte_terminal_accessible_get_selection(AtkText *text, gint selection_number,
gint *start_offset, gint *end_offset)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), NULL);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* FIXME? */
return NULL;
}
static gboolean
vte_terminal_accessible_add_selection(AtkText *text,
gint start_offset, gint end_offset)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), FALSE);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* FIXME? */
return FALSE;
}
static gboolean
vte_terminal_accessible_remove_selection(AtkText *text,
gint selection_number)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), FALSE);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* FIXME? */
return FALSE;
}
static gboolean
vte_terminal_accessible_set_selection(AtkText *text, gint selection_number,
gint start_offset, gint end_offset)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), FALSE);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* FIXME? */
return FALSE;
}
static gboolean
vte_terminal_accessible_set_caret_offset(AtkText *text, gint offset)
{
g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text), FALSE);
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
/* Whoa, very not allowed. */
return FALSE;
}
static void
vte_terminal_accessible_text_changed(AtkText *text, gint position, gint length)
{
g_return_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text));
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
}
static void
vte_terminal_accessible_text_caret_moved(AtkText *text, gint location)
{
g_return_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text));
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
}
static void
vte_terminal_accessible_text_selection_changed(AtkText *text)
{
g_return_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(text));
vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text));
}
static void
vte_terminal_accessible_text_init(gpointer iface, gpointer data)
{
AtkTextIface* text;
g_return_if_fail(ATK_IS_TEXT(iface));
text = iface;
text->get_text = vte_terminal_accessible_get_text;
text->get_text_after_offset = vte_terminal_accessible_get_text_after_offset;
text->get_text_at_offset = vte_terminal_accessible_get_text_at_offset;
text->get_character_at_offset = vte_terminal_accessible_get_character_at_offset;
text->get_text_before_offset = vte_terminal_accessible_get_text_before_offset;
text->get_caret_offset = vte_terminal_accessible_get_caret_offset;
text->get_run_attributes = vte_terminal_accessible_get_run_attributes;
text->get_default_attributes = vte_terminal_accessible_get_default_attributes;
text->get_character_extents = vte_terminal_accessible_get_character_extents;
text->get_character_count = vte_terminal_accessible_get_character_count;
text->get_offset_at_point = vte_terminal_accessible_get_offset_at_point;
text->get_n_selections = vte_terminal_accessible_get_n_selections;
text->get_selection = vte_terminal_accessible_get_selection;
text->add_selection = vte_terminal_accessible_add_selection;
text->remove_selection = vte_terminal_accessible_remove_selection;
text->set_selection = vte_terminal_accessible_set_selection;
text->set_caret_offset = vte_terminal_accessible_set_caret_offset;
text->text_changed = vte_terminal_accessible_text_changed;
text->text_caret_moved = vte_terminal_accessible_text_caret_moved;
text->text_selection_changed = vte_terminal_accessible_text_selection_changed;
}
static void
vte_terminal_accessible_text_finalize(gpointer iface, gpointer data)
{
GtkAccessibleClass *accessible_class;
VteTerminalAccessiblePrivate *priv;
accessible_class = g_type_class_peek(GTK_TYPE_ACCESSIBLE);
/* Free the private data. */
priv = g_object_get_data(G_OBJECT(iface),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
if (priv) {
vte_terminal_accessible_free_private_data(priv);
g_object_set_data(G_OBJECT(iface),
VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA,
NULL);
}
if ((G_OBJECT_CLASS(accessible_class))->finalize) {
(G_OBJECT_CLASS(accessible_class))->finalize(iface);
}
}
static void
vte_terminal_accessible_class_init(gpointer *klass)
{
GObjectClass *gobject_class;
AtkObjectClass *atk_object_class;
GtkAccessibleClass *gtk_accessible_class;
GInterfaceInfo text;
gobject_class = G_OBJECT_CLASS(klass);
atk_object_class = ATK_OBJECT_CLASS(klass);
gtk_accessible_class = GTK_ACCESSIBLE_CLASS(klass);
/* Add a text interface to this object class. */
text.interface_init = vte_terminal_accessible_text_init;
text.interface_finalize = vte_terminal_accessible_text_finalize;
text.interface_data = NULL;
g_type_add_interface_static(VTE_TYPE_TERMINAL_ACCESSIBLE,
ATK_TYPE_TEXT,
&text);
}
static void
vte_terminal_accessible_init(gpointer *instance, gpointer *klass)
{
/* Mark the role this object plays. The rest of the work is handled
* by the AtkText interface the object class exports. */
atk_object_set_role(ATK_OBJECT(instance), ATK_ROLE_TERMINAL);
}
GtkType
vte_terminal_accessible_get_type(void)
{
static GtkType terminal_accessible_type = 0;
static const GTypeInfo terminal_accessible_info = {
sizeof(VteTerminalAccessibleClass),
(GBaseInitFunc)NULL,
(GBaseFinalizeFunc)NULL,
(GClassInitFunc)vte_terminal_accessible_class_init,
(GClassFinalizeFunc)NULL,
(gconstpointer)NULL,
sizeof(VteTerminal),
0,
(GInstanceInitFunc)vte_terminal_accessible_init,
(GTypeValueTable*)NULL,
};
if (terminal_accessible_type == 0) {
terminal_accessible_type = g_type_register_static(GTK_TYPE_ACCESSIBLE,
"VteTerminalAccessible",
&terminal_accessible_info,
0);
}
return terminal_accessible_type;
}
|